ntk 8.26.0 → 8.26.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- // fontkit 2.0.4-windowkit.3: the windowkit fork's dist/browser-module.mjs, from
2
- // https://github.com/windowkit/fontkit/releases/download/v2.0.4-windowkit.3/fontkit-2.0.4-windowkit.3.tgz
3
- // sha256 4fae6ec9559c20b65c0c8b5e05ab2efd4392128188ddf4731cf655fa2af40d26
1
+ // fontkit 2.0.4-windowkit.4: the windowkit fork's dist/browser-module.mjs, from
2
+ // https://github.com/windowkit/fontkit/releases/download/v2.0.4-windowkit.4/fontkit-2.0.4-windowkit.4.tgz
3
+ // sha256 45318f8c3917fa6e33c9104bed8839c0cb4658a41d6ccf12f48a0606af6613be
4
4
  //
5
5
  // Made by scripts/vendor-fontkit.mjs; do not edit. Why ntk carries fontkit
6
6
  // rather than depending on it: AGENTS.md, "The fontkit fork".
@@ -7123,9 +7123,11 @@ class $0aee9744d4a73be3$export$2e2bcd8739ae039 {
7123
7123
  * specified features and features chosen by the shaper.
7124
7124
  * @type {object}
7125
7125
  */ this.features = {};
7126
- // Convert features to an object
7126
+ // Convert features to an object. A copy, since the shaper adds the
7127
+ // features it chooses: written into the caller's object, they would be
7128
+ // asked for by the user the next time the object was handed in.
7127
7129
  if (Array.isArray(features)) for (let tag of features)this.features[tag] = true;
7128
- else if (typeof features === 'object') this.features = features;
7130
+ else if (typeof features === 'object') Object.assign(this.features, features);
7129
7131
  }
7130
7132
  /**
7131
7133
  * The total advance width of the run.
@@ -8739,10 +8741,16 @@ class $d6106e27efe2333c$export$2e2bcd8739ae039 {
8739
8741
  this.add(arg, global);
8740
8742
  }
8741
8743
  }
8742
- setFeatureOverrides(features) {
8743
- if (Array.isArray(features)) this.add(features);
8744
+ /**
8745
+ * Applies the features the user asked for, or turned off.
8746
+ * A feature the user asks for applies to every glyph, as HarfBuzz applies
8747
+ * a feature asked for over the whole run: one the shaper planned for some
8748
+ * glyphs only, like numr and dnom around a fraction slash, is made global,
8749
+ * in the stage the shaper planned it in.
8750
+ */ setFeatureOverrides(features) {
8751
+ if (Array.isArray(features)) for (let tag of features)this._addGlobal(tag);
8744
8752
  else if (typeof features === 'object') for(let tag in features){
8745
- if (features[tag]) this.add(tag);
8753
+ if (features[tag]) this._addGlobal(tag);
8746
8754
  else if (this.allFeatures[tag] != null) {
8747
8755
  let stage = this.stages[this.allFeatures[tag]];
8748
8756
  stage.splice(stage.indexOf(tag), 1);
@@ -8751,6 +8759,10 @@ class $d6106e27efe2333c$export$2e2bcd8739ae039 {
8751
8759
  }
8752
8760
  }
8753
8761
  }
8762
+ _addGlobal(tag) {
8763
+ this.add(tag);
8764
+ this.globalFeatures[tag] = true;
8765
+ }
8754
8766
  /**
8755
8767
  * Assigns the global features to the given glyphs
8756
8768
  */ assignGlobalFeatures(glyphs) {
@@ -622,6 +622,14 @@ function resolveStyle(node, parent) {
622
622
  value = urlReference(v);
623
623
  if (value === '') value = 'none';
624
624
  break;
625
+ case 'fill':
626
+ case 'stroke':
627
+ value = paintValue(v);
628
+ break;
629
+ case 'color':
630
+ // `currentColor` as a colour is the parent's (CSS Color 4, 6.4)
631
+ if (v.toLowerCase() !== 'currentcolor') value = v;
632
+ break;
625
633
  default:
626
634
  value = v;
627
635
  }
@@ -633,6 +641,18 @@ function resolveStyle(node, parent) {
633
641
  return style;
634
642
  }
635
643
 
644
+ /**
645
+ * A fill or a stroke as `_paint` and the paint scan read it: `currentColor`
646
+ * and `none` are keywords, which CSS reads in any case (CSS Values 4, 2.5),
647
+ * and anything else is as written. `currentcolor`, as CSS Color 4 writes it
648
+ * and as Apple's pages do, reached the context as a colour nobody knows and
649
+ * painted nothing.
650
+ */
651
+ function paintValue(value) {
652
+ const k = value.toLowerCase();
653
+ return k === 'currentcolor' ? 'currentColor' : k === 'none' ? 'none' : value;
654
+ }
655
+
636
656
  /**
637
657
  * A length in a dash pattern or its offset, in user units: a number, or one
638
658
  * in `px` (SVG 2, 13.5.6). A percentage of the viewport's diagonal, or a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ntk",
3
- "version": "8.26.0",
3
+ "version": "8.26.2",
4
4
  "description": "Desktop UI toolkit for X11 with canvas-like 2d and OpenGL rendering",
5
5
  "author": "Andrey Sidorov <sidorares@yandex.ru>",
6
6
  "license": "MIT",