@ot-builder/io-bin-ttf 1.7.6 → 1.8.0
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.
- package/lib/cfg/index.d.ts +1 -0
- package/lib/cfg/index.js +1 -0
- package/lib/glyf/write.d.ts +2 -1
- package/lib/glyf/write.js +9 -9
- package/lib/index.d.ts +1 -1
- package/package.json +17 -17
package/lib/cfg/index.d.ts
CHANGED
package/lib/cfg/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DefaultTtfCfgProps = void 0;
|
|
4
4
|
exports.DefaultTtfCfgProps = {
|
|
5
|
+
glyfIncludeOverlapSimpleFlag: true,
|
|
5
6
|
gvarOptimizeTolerance: 1 / 128,
|
|
6
7
|
gvarForceProduceGVD: false,
|
|
7
8
|
gvarForceZeroGapsBetweenGVD: false,
|
package/lib/glyf/write.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Write } from "@ot-builder/bin-util";
|
|
2
2
|
import { OtGlyph } from "@ot-builder/ot-glyphs";
|
|
3
3
|
import { Data } from "@ot-builder/prelude";
|
|
4
|
+
import { TtfCfg } from "../cfg";
|
|
4
5
|
import { TtfWritingExtraInfoSink } from "../extra-info-sink/index";
|
|
5
6
|
import { LocaTable } from "./loca";
|
|
6
|
-
export declare const GlyfTableWrite: Write<Data.Order<OtGlyph>, [outLoca: LocaTable, stat: OtGlyph.Stat.Sink, extraInfoSink: TtfWritingExtraInfoSink]>;
|
|
7
|
+
export declare const GlyfTableWrite: Write<Data.Order<OtGlyph>, [cfg: TtfCfg, outLoca: LocaTable, stat: OtGlyph.Stat.Sink, extraInfoSink: TtfWritingExtraInfoSink]>;
|
|
7
8
|
//# sourceMappingURL=write.d.ts.map
|
package/lib/glyf/write.js
CHANGED
|
@@ -9,7 +9,8 @@ const variance_1 = require("@ot-builder/variance");
|
|
|
9
9
|
const classifier_1 = require("./classifier");
|
|
10
10
|
const shared_1 = require("./shared");
|
|
11
11
|
class FlagShrinker {
|
|
12
|
-
constructor() {
|
|
12
|
+
constructor(cfg) {
|
|
13
|
+
this.cfg = cfg;
|
|
13
14
|
this.flags = [];
|
|
14
15
|
this.repeating = 0;
|
|
15
16
|
this.last = 0;
|
|
@@ -42,8 +43,7 @@ class FlagShrinker {
|
|
|
42
43
|
this.count++;
|
|
43
44
|
}
|
|
44
45
|
finalizeAndGetFlags() {
|
|
45
|
-
|
|
46
|
-
if (this.flags.length) {
|
|
46
|
+
if (this.cfg.ttf.glyfIncludeOverlapSimpleFlag && this.flags.length) {
|
|
47
47
|
this.flags[0] |= shared_1.SimpleGlyphFlag.OVERLAP_SIMPLE;
|
|
48
48
|
}
|
|
49
49
|
return this.flags;
|
|
@@ -68,10 +68,10 @@ class FlagShrinker {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
// TODO: could we optimize MORE?
|
|
71
|
-
function collectSimpleGlyphOutlineData(sg) {
|
|
71
|
+
function collectSimpleGlyphOutlineData(sg, cfg) {
|
|
72
72
|
let endPtsOfContours = -1;
|
|
73
73
|
const endPtsOfContoursArray = [];
|
|
74
|
-
const shrinker = new FlagShrinker();
|
|
74
|
+
const shrinker = new FlagShrinker(cfg);
|
|
75
75
|
const fragX = new bin_util_1.Frag();
|
|
76
76
|
const fragY = new bin_util_1.Frag();
|
|
77
77
|
let cx = 0, cy = 0;
|
|
@@ -93,14 +93,14 @@ function collectSimpleGlyphOutlineData(sg) {
|
|
|
93
93
|
}
|
|
94
94
|
return { flags: shrinker.finalizeAndGetFlags(), fragX, fragY, endPtsOfContoursArray };
|
|
95
95
|
}
|
|
96
|
-
const SimpleGlyphData = (0, bin_util_1.Write)((frag, sg) => {
|
|
96
|
+
const SimpleGlyphData = (0, bin_util_1.Write)((frag, sg, cfg) => {
|
|
97
97
|
const st = sg.getStatData();
|
|
98
98
|
frag.int16(st.eigenContours)
|
|
99
99
|
.int16(st.extent.xMin)
|
|
100
100
|
.int16(st.extent.yMin)
|
|
101
101
|
.int16(st.extent.xMax)
|
|
102
102
|
.int16(st.extent.yMax);
|
|
103
|
-
const analysis = collectSimpleGlyphOutlineData(sg);
|
|
103
|
+
const analysis = collectSimpleGlyphOutlineData(sg, cfg);
|
|
104
104
|
for (const zid of analysis.endPtsOfContoursArray)
|
|
105
105
|
frag.uint16(zid);
|
|
106
106
|
frag.uint16(sg.instructions.byteLength);
|
|
@@ -217,7 +217,7 @@ const CompositeGlyphData = (0, bin_util_1.Write)((frag, cg, iGlyph, gOrd, extraI
|
|
|
217
217
|
);
|
|
218
218
|
}
|
|
219
219
|
});
|
|
220
|
-
exports.GlyfTableWrite = (0, bin_util_1.Write)((frag, gOrd, outLoca, stat, extraInfoSink) => {
|
|
220
|
+
exports.GlyfTableWrite = (0, bin_util_1.Write)((frag, gOrd, cfg, outLoca, stat, extraInfoSink) => {
|
|
221
221
|
const sink = new StdGlyfDataSink(outLoca, frag);
|
|
222
222
|
sink.begin();
|
|
223
223
|
stat.setNumGlyphs(gOrd.length);
|
|
@@ -228,7 +228,7 @@ exports.GlyfTableWrite = (0, bin_util_1.Write)((frag, gOrd, outLoca, stat, extra
|
|
|
228
228
|
cg.stat(stat);
|
|
229
229
|
const fGlyph = new bin_util_1.Frag();
|
|
230
230
|
if (cg instanceof classifier_1.SimpleGlyph) {
|
|
231
|
-
fGlyph.push(SimpleGlyphData, cg);
|
|
231
|
+
fGlyph.push(SimpleGlyphData, cg, cfg);
|
|
232
232
|
}
|
|
233
233
|
else if (cg instanceof classifier_1.CompositeGlyph) {
|
|
234
234
|
fGlyph.push(CompositeGlyphData, cg, iGlyph, gOrd, extraInfoSink);
|
package/lib/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare namespace Loca {
|
|
|
17
17
|
export declare namespace Glyf {
|
|
18
18
|
const Tag = "glyf";
|
|
19
19
|
const Read: import("@ot-builder/bin-util").Read<void, [loca: LocaTable, gOrd: import("@ot-builder/prelude/lib/data").Order<import("@ot-builder/ot-glyphs").OtGlyph>, coStat: import("@ot-builder/ot-glyphs/lib/ot-glyph/co-stat").Source]>;
|
|
20
|
-
const Write: import("@ot-builder/bin-util").Write<import("@ot-builder/prelude/lib/data").Order<import("@ot-builder/ot-glyphs").OtGlyph>, [outLoca: LocaTable, stat: import("@ot-builder/ot-glyphs/lib/ot-glyph/stat").Sink, extraInfoSink: import("./extra-info-sink/index").TtfWritingExtraInfoSink]>;
|
|
20
|
+
const Write: import("@ot-builder/bin-util").Write<import("@ot-builder/prelude/lib/data").Order<import("@ot-builder/ot-glyphs").OtGlyph>, [cfg: import("./cfg/index").TtfCfg, outLoca: LocaTable, stat: import("@ot-builder/ot-glyphs/lib/ot-glyph/stat").Sink, extraInfoSink: import("./extra-info-sink/index").TtfWritingExtraInfoSink]>;
|
|
21
21
|
}
|
|
22
22
|
export declare namespace Gvar {
|
|
23
23
|
const Tag = "gvar";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ot-builder/io-bin-ttf",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.8.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -24,24 +24,24 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ot-builder/bin-util": "1.7.
|
|
28
|
-
"@ot-builder/common-impl": "1.7.
|
|
29
|
-
"@ot-builder/errors": "1.7.
|
|
30
|
-
"@ot-builder/ot-glyphs": "1.7.
|
|
31
|
-
"@ot-builder/ot-metadata": "1.7.
|
|
32
|
-
"@ot-builder/prelude": "1.7.
|
|
33
|
-
"@ot-builder/primitive": "1.7.
|
|
34
|
-
"@ot-builder/stat-glyphs": "1.7.
|
|
35
|
-
"@ot-builder/var-store": "1.7.
|
|
36
|
-
"@ot-builder/variance": "1.7.
|
|
27
|
+
"@ot-builder/bin-util": "1.7.8",
|
|
28
|
+
"@ot-builder/common-impl": "1.7.7",
|
|
29
|
+
"@ot-builder/errors": "1.7.7",
|
|
30
|
+
"@ot-builder/ot-glyphs": "1.7.8",
|
|
31
|
+
"@ot-builder/ot-metadata": "1.7.8",
|
|
32
|
+
"@ot-builder/prelude": "1.7.7",
|
|
33
|
+
"@ot-builder/primitive": "1.7.8",
|
|
34
|
+
"@ot-builder/stat-glyphs": "1.7.8",
|
|
35
|
+
"@ot-builder/var-store": "1.7.8",
|
|
36
|
+
"@ot-builder/variance": "1.7.8",
|
|
37
37
|
"tslib": "^2.8.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@ot-builder/ot-sfnt": "1.7.
|
|
41
|
-
"@ot-builder/io-bin-metadata": "1.7.
|
|
42
|
-
"@ot-builder/io-bin-sfnt": "1.7.
|
|
43
|
-
"@ot-builder/test-util": "1.7.
|
|
44
|
-
"@types/jest": "^
|
|
45
|
-
"jest": "^
|
|
40
|
+
"@ot-builder/ot-sfnt": "1.7.8",
|
|
41
|
+
"@ot-builder/io-bin-metadata": "1.7.8",
|
|
42
|
+
"@ot-builder/io-bin-sfnt": "1.7.8",
|
|
43
|
+
"@ot-builder/test-util": "1.7.8",
|
|
44
|
+
"@types/jest": "^30.0.0",
|
|
45
|
+
"jest": "^30.2.0"
|
|
46
46
|
}
|
|
47
47
|
}
|