@ot-builder/io-bin-layout 1.6.1 → 1.6.3

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/CHANGELOG.json CHANGED
@@ -2,7 +2,265 @@
2
2
  "name": "@ot-builder/io-bin-layout",
3
3
  "entries": [
4
4
  {
5
- "date": "Sat, 28 Jan 2023 01:10:30 GMT",
5
+ "date": "Sat, 22 Apr 2023 00:59:44 GMT",
6
+ "tag": "@ot-builder/io-bin-layout_v1.6.3",
7
+ "version": "1.6.3",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "otbbuilder-dev@users.noreply.github.com",
12
+ "package": "@ot-builder/io-bin-layout",
13
+ "commit": "dc2c43855a1556176041326c5aac1cb4c8868b9e",
14
+ "comment": "Bugfix for a mark class that has no bases"
15
+ },
16
+ {
17
+ "author": "otbbuilder-dev@users.noreply.github.com",
18
+ "package": "@ot-builder/io-bin-layout",
19
+ "commit": "df27eccdd84a210e939708f225c465911a0882cd",
20
+ "comment": "Fix handling of mark attachment flags in lookups"
21
+ },
22
+ {
23
+ "author": "otbbuilder-dev@users.noreply.github.com",
24
+ "package": "@ot-builder/io-bin-layout",
25
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2",
26
+ "comment": "Fix handling of ignore glyph set when merging fonts"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@ot-builder/io-bin-layout",
31
+ "comment": "Bump @ot-builder/bin-composite-types to v1.6.3",
32
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@ot-builder/io-bin-layout",
37
+ "comment": "Bump @ot-builder/bin-util to v1.6.3",
38
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@ot-builder/io-bin-layout",
43
+ "comment": "Bump @ot-builder/errors to v1.6.3",
44
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
45
+ },
46
+ {
47
+ "author": "beachball",
48
+ "package": "@ot-builder/io-bin-layout",
49
+ "comment": "Bump @ot-builder/ot-glyphs to v1.6.3",
50
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
51
+ },
52
+ {
53
+ "author": "beachball",
54
+ "package": "@ot-builder/io-bin-layout",
55
+ "comment": "Bump @ot-builder/ot-layout to v1.6.3",
56
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
57
+ },
58
+ {
59
+ "author": "beachball",
60
+ "package": "@ot-builder/io-bin-layout",
61
+ "comment": "Bump @ot-builder/ot-metadata to v1.6.3",
62
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
63
+ },
64
+ {
65
+ "author": "beachball",
66
+ "package": "@ot-builder/io-bin-layout",
67
+ "comment": "Bump @ot-builder/prelude to v1.6.3",
68
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
69
+ },
70
+ {
71
+ "author": "beachball",
72
+ "package": "@ot-builder/io-bin-layout",
73
+ "comment": "Bump @ot-builder/primitive to v1.6.3",
74
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
75
+ },
76
+ {
77
+ "author": "beachball",
78
+ "package": "@ot-builder/io-bin-layout",
79
+ "comment": "Bump @ot-builder/var-store to v1.6.3",
80
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
81
+ },
82
+ {
83
+ "author": "beachball",
84
+ "package": "@ot-builder/io-bin-layout",
85
+ "comment": "Bump @ot-builder/variance to v1.6.3",
86
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
87
+ },
88
+ {
89
+ "author": "beachball",
90
+ "package": "@ot-builder/io-bin-layout",
91
+ "comment": "Bump @ot-builder/common-impl to v1.6.3",
92
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
93
+ },
94
+ {
95
+ "author": "beachball",
96
+ "package": "@ot-builder/io-bin-layout",
97
+ "comment": "Bump @ot-builder/ot-sfnt to v1.6.3",
98
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
99
+ },
100
+ {
101
+ "author": "beachball",
102
+ "package": "@ot-builder/io-bin-layout",
103
+ "comment": "Bump @ot-builder/io-bin-sfnt to v1.6.3",
104
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
105
+ },
106
+ {
107
+ "author": "beachball",
108
+ "package": "@ot-builder/io-bin-layout",
109
+ "comment": "Bump @ot-builder/io-bin-glyph-store to v1.6.3",
110
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
111
+ },
112
+ {
113
+ "author": "beachball",
114
+ "package": "@ot-builder/io-bin-layout",
115
+ "comment": "Bump @ot-builder/io-bin-metadata to v1.6.3",
116
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
117
+ },
118
+ {
119
+ "author": "beachball",
120
+ "package": "@ot-builder/io-bin-layout",
121
+ "comment": "Bump @ot-builder/ot-encoding to v1.6.3",
122
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
123
+ },
124
+ {
125
+ "author": "beachball",
126
+ "package": "@ot-builder/io-bin-layout",
127
+ "comment": "Bump @ot-builder/io-bin-encoding to v1.6.3",
128
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
129
+ },
130
+ {
131
+ "author": "beachball",
132
+ "package": "@ot-builder/io-bin-layout",
133
+ "comment": "Bump @ot-builder/test-util to v1.6.3",
134
+ "commit": "b19d6f897aa2a52a78cc95ca4832baeda71446a2"
135
+ }
136
+ ]
137
+ }
138
+ },
139
+ {
140
+ "date": "Sat, 15 Apr 2023 01:06:43 GMT",
141
+ "tag": "@ot-builder/io-bin-layout_v1.6.2",
142
+ "version": "1.6.2",
143
+ "comments": {
144
+ "patch": [
145
+ {
146
+ "author": "otbbuilder-dev@users.noreply.github.com",
147
+ "package": "@ot-builder/io-bin-layout",
148
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9",
149
+ "comment": "Upgrade to typescript 5"
150
+ },
151
+ {
152
+ "author": "beachball",
153
+ "package": "@ot-builder/io-bin-layout",
154
+ "comment": "Bump @ot-builder/bin-composite-types to v1.6.2",
155
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
156
+ },
157
+ {
158
+ "author": "beachball",
159
+ "package": "@ot-builder/io-bin-layout",
160
+ "comment": "Bump @ot-builder/bin-util to v1.6.2",
161
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
162
+ },
163
+ {
164
+ "author": "beachball",
165
+ "package": "@ot-builder/io-bin-layout",
166
+ "comment": "Bump @ot-builder/errors to v1.6.2",
167
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
168
+ },
169
+ {
170
+ "author": "beachball",
171
+ "package": "@ot-builder/io-bin-layout",
172
+ "comment": "Bump @ot-builder/ot-glyphs to v1.6.2",
173
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
174
+ },
175
+ {
176
+ "author": "beachball",
177
+ "package": "@ot-builder/io-bin-layout",
178
+ "comment": "Bump @ot-builder/ot-layout to v1.6.2",
179
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
180
+ },
181
+ {
182
+ "author": "beachball",
183
+ "package": "@ot-builder/io-bin-layout",
184
+ "comment": "Bump @ot-builder/ot-metadata to v1.6.2",
185
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
186
+ },
187
+ {
188
+ "author": "beachball",
189
+ "package": "@ot-builder/io-bin-layout",
190
+ "comment": "Bump @ot-builder/prelude to v1.6.2",
191
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
192
+ },
193
+ {
194
+ "author": "beachball",
195
+ "package": "@ot-builder/io-bin-layout",
196
+ "comment": "Bump @ot-builder/primitive to v1.6.2",
197
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
198
+ },
199
+ {
200
+ "author": "beachball",
201
+ "package": "@ot-builder/io-bin-layout",
202
+ "comment": "Bump @ot-builder/var-store to v1.6.2",
203
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
204
+ },
205
+ {
206
+ "author": "beachball",
207
+ "package": "@ot-builder/io-bin-layout",
208
+ "comment": "Bump @ot-builder/variance to v1.6.2",
209
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
210
+ },
211
+ {
212
+ "author": "beachball",
213
+ "package": "@ot-builder/io-bin-layout",
214
+ "comment": "Bump @ot-builder/common-impl to v1.6.2",
215
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
216
+ },
217
+ {
218
+ "author": "beachball",
219
+ "package": "@ot-builder/io-bin-layout",
220
+ "comment": "Bump @ot-builder/ot-sfnt to v1.6.2",
221
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
222
+ },
223
+ {
224
+ "author": "beachball",
225
+ "package": "@ot-builder/io-bin-layout",
226
+ "comment": "Bump @ot-builder/io-bin-sfnt to v1.6.2",
227
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
228
+ },
229
+ {
230
+ "author": "beachball",
231
+ "package": "@ot-builder/io-bin-layout",
232
+ "comment": "Bump @ot-builder/io-bin-glyph-store to v1.6.2",
233
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
234
+ },
235
+ {
236
+ "author": "beachball",
237
+ "package": "@ot-builder/io-bin-layout",
238
+ "comment": "Bump @ot-builder/io-bin-metadata to v1.6.2",
239
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
240
+ },
241
+ {
242
+ "author": "beachball",
243
+ "package": "@ot-builder/io-bin-layout",
244
+ "comment": "Bump @ot-builder/ot-encoding to v1.6.2",
245
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
246
+ },
247
+ {
248
+ "author": "beachball",
249
+ "package": "@ot-builder/io-bin-layout",
250
+ "comment": "Bump @ot-builder/io-bin-encoding to v1.6.2",
251
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
252
+ },
253
+ {
254
+ "author": "beachball",
255
+ "package": "@ot-builder/io-bin-layout",
256
+ "comment": "Bump @ot-builder/test-util to v1.6.2",
257
+ "commit": "904070a829a8f0464bb379923786f95a40dbbbb9"
258
+ }
259
+ ]
260
+ }
261
+ },
262
+ {
263
+ "date": "Sat, 28 Jan 2023 01:12:19 GMT",
6
264
  "tag": "@ot-builder/io-bin-layout_v1.6.1",
7
265
  "version": "1.6.1",
8
266
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,66 @@
1
1
  # Change Log - @ot-builder/io-bin-layout
2
2
 
3
- This log was last generated on Sat, 28 Jan 2023 01:10:30 GMT and should not be manually modified.
3
+ This log was last generated on Sat, 22 Apr 2023 00:59:44 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.6.3
8
+
9
+ Sat, 22 Apr 2023 00:59:44 GMT
10
+
11
+ ### Patches
12
+
13
+ - Bugfix for a mark class that has no bases (otbbuilder-dev@users.noreply.github.com)
14
+ - Fix handling of mark attachment flags in lookups (otbbuilder-dev@users.noreply.github.com)
15
+ - Fix handling of ignore glyph set when merging fonts (otbbuilder-dev@users.noreply.github.com)
16
+ - Bump @ot-builder/bin-composite-types to v1.6.3
17
+ - Bump @ot-builder/bin-util to v1.6.3
18
+ - Bump @ot-builder/errors to v1.6.3
19
+ - Bump @ot-builder/ot-glyphs to v1.6.3
20
+ - Bump @ot-builder/ot-layout to v1.6.3
21
+ - Bump @ot-builder/ot-metadata to v1.6.3
22
+ - Bump @ot-builder/prelude to v1.6.3
23
+ - Bump @ot-builder/primitive to v1.6.3
24
+ - Bump @ot-builder/var-store to v1.6.3
25
+ - Bump @ot-builder/variance to v1.6.3
26
+ - Bump @ot-builder/common-impl to v1.6.3
27
+ - Bump @ot-builder/ot-sfnt to v1.6.3
28
+ - Bump @ot-builder/io-bin-sfnt to v1.6.3
29
+ - Bump @ot-builder/io-bin-glyph-store to v1.6.3
30
+ - Bump @ot-builder/io-bin-metadata to v1.6.3
31
+ - Bump @ot-builder/ot-encoding to v1.6.3
32
+ - Bump @ot-builder/io-bin-encoding to v1.6.3
33
+ - Bump @ot-builder/test-util to v1.6.3
34
+
35
+ ## 1.6.2
36
+
37
+ Sat, 15 Apr 2023 01:06:43 GMT
38
+
39
+ ### Patches
40
+
41
+ - Upgrade to typescript 5 (otbbuilder-dev@users.noreply.github.com)
42
+ - Bump @ot-builder/bin-composite-types to v1.6.2
43
+ - Bump @ot-builder/bin-util to v1.6.2
44
+ - Bump @ot-builder/errors to v1.6.2
45
+ - Bump @ot-builder/ot-glyphs to v1.6.2
46
+ - Bump @ot-builder/ot-layout to v1.6.2
47
+ - Bump @ot-builder/ot-metadata to v1.6.2
48
+ - Bump @ot-builder/prelude to v1.6.2
49
+ - Bump @ot-builder/primitive to v1.6.2
50
+ - Bump @ot-builder/var-store to v1.6.2
51
+ - Bump @ot-builder/variance to v1.6.2
52
+ - Bump @ot-builder/common-impl to v1.6.2
53
+ - Bump @ot-builder/ot-sfnt to v1.6.2
54
+ - Bump @ot-builder/io-bin-sfnt to v1.6.2
55
+ - Bump @ot-builder/io-bin-glyph-store to v1.6.2
56
+ - Bump @ot-builder/io-bin-metadata to v1.6.2
57
+ - Bump @ot-builder/ot-encoding to v1.6.2
58
+ - Bump @ot-builder/io-bin-encoding to v1.6.2
59
+ - Bump @ot-builder/test-util to v1.6.2
60
+
7
61
  ## 1.6.1
8
62
 
9
- Sat, 28 Jan 2023 01:10:30 GMT
63
+ Sat, 28 Jan 2023 01:12:19 GMT
10
64
 
11
65
  ### Patches
12
66
 
@@ -11,6 +11,7 @@ export interface LayoutCfgPt {
11
11
  }
12
12
  export declare const DefaultLayoutProps: LayoutCfgProps;
13
13
  export declare enum LookupWriteTrick {
14
+ None = 0,
14
15
  AvoidUseExtension = 1,
15
16
  AvoidBreakSubtable = 2,
16
17
  UseFlatCoverage = 4,
package/lib/cfg/index.js CHANGED
@@ -4,6 +4,7 @@ exports.LookupWriteTrick = exports.DefaultLayoutProps = void 0;
4
4
  exports.DefaultLayoutProps = {};
5
5
  var LookupWriteTrick;
6
6
  (function (LookupWriteTrick) {
7
+ LookupWriteTrick[LookupWriteTrick["None"] = 0] = "None";
7
8
  LookupWriteTrick[LookupWriteTrick["AvoidUseExtension"] = 1] = "AvoidUseExtension";
8
9
  LookupWriteTrick[LookupWriteTrick["AvoidBreakSubtable"] = 2] = "AvoidBreakSubtable";
9
10
  LookupWriteTrick[LookupWriteTrick["UseFlatCoverage"] = 4] = "UseFlatCoverage";
@@ -1,11 +1,11 @@
1
1
  import { Gdef } from "@ot-builder/ot-layout";
2
2
  import { Data } from "@ot-builder/prelude";
3
3
  export interface IgnoreFlagOptions {
4
- ignoreBaseGlyphs: boolean;
5
- ignoreLigatures: boolean;
6
- ignoreMarks: boolean;
4
+ ignoreBaseGlyphs?: boolean;
5
+ ignoreLigatures?: boolean;
6
+ ignoreMarks?: boolean;
7
7
  markAttachmentType?: number;
8
8
  markFilteringSet?: number;
9
9
  }
10
- export declare function decideIgnoreFlags<G, X>(gs: Data.Maybe<ReadonlySet<G>>, fn: Data.Maybe<Gdef.General.TableT<G, X>>): null | IgnoreFlagOptions;
10
+ export declare function decideIgnoreFlags<G, X>(gs: Data.Maybe<ReadonlySet<G>>, gdef: Data.Maybe<Gdef.General.TableT<G, X>>): null | IgnoreFlagOptions;
11
11
  //# sourceMappingURL=decide-ignore-flags.d.ts.map
@@ -2,121 +2,100 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.decideIgnoreFlags = void 0;
4
4
  const ot_layout_1 = require("@ot-builder/ot-layout");
5
- function decideIgnoreFlags(gs, fn) {
6
- if (!fn)
5
+ function decideIgnoreFlags(gs, gdef) {
6
+ if (!gdef || !gs || !gs.size)
7
7
  return null;
8
- return (igfEmpty(gs) ||
9
- igfGlyphClass(gs, fn.glyphClassDef) ||
10
- igcMarkAttachmentClass(gs, fn.markAttachClassDef) ||
11
- igfMarkGlyphSet(gs, fn.markGlyphSets));
8
+ const [nonMarks, marks] = gsSplitMarks(gs, gdef.glyphClassDef);
9
+ const igfBase = igfGlyphClass(nonMarks, gdef.glyphClassDef, ot_layout_1.Gdef.GlyphClass.Base, { ignoreBaseGlyphs: true }, { ignoreBaseGlyphs: false });
10
+ const igfLigature = igfGlyphClass(nonMarks, gdef.glyphClassDef, ot_layout_1.Gdef.GlyphClass.Ligature, { ignoreLigatures: true }, { ignoreLigatures: false });
11
+ const igfMark = igfGlyphClass(marks, gdef.glyphClassDef, ot_layout_1.Gdef.GlyphClass.Mark, { ignoreMarks: true }, { ignoreMarks: false }) ||
12
+ igfMarkAttachmentClass(marks, gdef.glyphClassDef, gdef.markAttachClassDef) ||
13
+ igfMarkFilterSet(marks, gdef.glyphClassDef, gdef.markGlyphSets);
14
+ return {
15
+ ...igfBase,
16
+ ...igfLigature,
17
+ ...igfMark
18
+ };
12
19
  }
13
20
  exports.decideIgnoreFlags = decideIgnoreFlags;
14
- function igfEmpty(gs) {
15
- if (!gs || !gs.size) {
16
- return {
17
- ignoreBaseGlyphs: false,
18
- ignoreLigatures: false,
19
- ignoreMarks: false
20
- };
21
+ /// Split non-mark and mark glyphs
22
+ function gsSplitMarks(ignoredGlyphs, glyphClassDef) {
23
+ if (!glyphClassDef)
24
+ return [new Set(ignoredGlyphs), new Set()];
25
+ const marks = new Set(), nonMarks = new Set();
26
+ for (const g of ignoredGlyphs) {
27
+ if (ot_layout_1.Gdef.GlyphClass.Mark === glyphClassDef.get(g)) {
28
+ marks.add(g);
29
+ }
30
+ else {
31
+ nonMarks.add(g);
32
+ }
21
33
  }
22
- return null;
34
+ return [nonMarks, marks];
23
35
  }
24
- class HasAllState {
25
- constructor() {
26
- this.has = false;
27
- this.all = true;
36
+ function igfGlyphClass(ignoredGlyphs, glyphClassDef, glyphClass, positive, negative) {
37
+ if (!glyphClassDef)
38
+ return null;
39
+ let has = false, all = true;
40
+ for (const [g, cl] of glyphClassDef) {
41
+ if (cl !== glyphClass)
42
+ continue;
43
+ if (ignoredGlyphs.has(g)) {
44
+ has = true;
45
+ }
46
+ else {
47
+ all = false;
48
+ }
28
49
  }
29
- update(x) {
30
- if (x)
31
- this.has = true;
32
- else
33
- this.all = false;
50
+ if (!has) {
51
+ return negative;
34
52
  }
35
- get mix() {
36
- return this.has && !this.all;
53
+ else if (all) {
54
+ return positive;
37
55
  }
38
- }
39
- function igfGlyphClass(gs, cd) {
40
- if (!gs || !gs.size || !cd)
56
+ else {
41
57
  return null;
42
- const base = new HasAllState(), ligature = new HasAllState(), mark = new HasAllState();
43
- const cov = new Set();
44
- for (const [g, cl] of cd) {
45
- const inSet = gs.has(g);
46
- switch (cl) {
47
- case ot_layout_1.Gdef.GlyphClass.Base:
48
- base.update(inSet);
49
- cov.add(g);
50
- break;
51
- case ot_layout_1.Gdef.GlyphClass.Ligature:
52
- ligature.update(inSet);
53
- cov.add(g);
54
- break;
55
- case ot_layout_1.Gdef.GlyphClass.Mark:
56
- mark.update(inSet);
57
- cov.add(g);
58
- }
59
58
  }
60
- if (base.mix || ligature.mix || mark.mix)
61
- return null;
62
- for (const g of gs)
63
- if (!cov.has(g))
64
- return null;
65
- return {
66
- ignoreBaseGlyphs: base.has,
67
- ignoreLigatures: ligature.has,
68
- ignoreMarks: mark.has
69
- };
70
59
  }
71
- function igcMarkAttachmentClass(gs, maCd) {
72
- if (!gs || !gs.size || !maCd)
60
+ function igfMarkAttachmentClass(ignoredMarks, glyphClassDef, markAttachmentClassDef) {
61
+ if (!glyphClassDef || !markAttachmentClassDef)
73
62
  return null;
74
- // Get an matching mark class
75
- let kMark = undefined;
76
- for (const g of gs) {
77
- const kg = maCd.get(g);
78
- if (kg === undefined)
63
+ // We need to iterate through all the marks, since in some cases we are ignoring mark class "0"
64
+ const keptMarkClasses = new Set();
65
+ const ignoredMarkClasses = new Set();
66
+ for (const [g, gc] of glyphClassDef) {
67
+ if (gc !== ot_layout_1.Gdef.GlyphClass.Mark)
68
+ continue;
69
+ const k = markAttachmentClassDef.get(g) || 0;
70
+ (ignoredMarks.has(g) ? ignoredMarkClasses : keptMarkClasses).add(k);
71
+ }
72
+ let finalMarkClass = undefined;
73
+ for (const k of keptMarkClasses) {
74
+ // Hybrid class, fail
75
+ if (ignoredMarkClasses.has(k))
79
76
  return null;
80
- if (kMark === undefined)
81
- kMark = kg;
82
- else if (kg !== kMark)
77
+ // Multiple mark classes to keep, fail
78
+ if (finalMarkClass != undefined)
83
79
  return null;
80
+ finalMarkClass = k;
84
81
  }
85
- // ensure the glyph set satisfying this mark class equal to GS
86
- if (kMark === undefined)
82
+ // Nothing to keep, fail
83
+ if (!finalMarkClass || finalMarkClass <= 0 || finalMarkClass > 0xff)
87
84
  return null;
88
- for (const [g, cl] of maCd) {
89
- if (cl === kMark && !gs.has(g))
90
- return null;
91
- }
92
- return {
93
- ignoreBaseGlyphs: false,
94
- ignoreLigatures: false,
95
- ignoreMarks: false,
96
- markAttachmentType: kMark
97
- };
98
- }
99
- function setEqual(a, b) {
100
- for (const g of a)
101
- if (!b.has(g))
102
- return false;
103
- for (const g of b)
104
- if (!a.has(g))
105
- return false;
106
- return true;
85
+ return { markAttachmentType: finalMarkClass };
107
86
  }
108
- function igfMarkGlyphSet(gs, mgs) {
109
- if (!mgs || !gs || !gs.size)
87
+ function igfMarkFilterSet(ignoredMarks, glyphClassDef, markGlyphSets) {
88
+ if (!glyphClassDef || !markGlyphSets)
110
89
  return null;
111
- for (let mgsIndex = 0; mgsIndex < mgs.length; mgsIndex++) {
112
- if (setEqual(gs, mgs[mgsIndex])) {
113
- return {
114
- ignoreBaseGlyphs: false,
115
- ignoreLigatures: false,
116
- ignoreMarks: false,
117
- markFilteringSet: mgsIndex
118
- };
90
+ out: for (let mgsIndex = 0; mgsIndex < markGlyphSets.length; mgsIndex++) {
91
+ const mgs = markGlyphSets[mgsIndex];
92
+ for (const [g, gc] of glyphClassDef) {
93
+ if (gc !== ot_layout_1.Gdef.GlyphClass.Mark)
94
+ continue;
95
+ if (ignoredMarks.has(g) !== !mgs.has(g))
96
+ continue out;
119
97
  }
98
+ return { markFilteringSet: mgsIndex };
120
99
  }
121
100
  return null;
122
101
  }
@@ -39,23 +39,32 @@ class CReadLookupList {
39
39
  }
40
40
  }
41
41
  applyGdefMarkAttachDefIgnores(ignores, flags, gdef) {
42
- if (gdef.markAttachClassDef && flags & general_1.LookupFlag.MarkAttachmentType) {
42
+ if (gdef.glyphClassDef &&
43
+ gdef.markAttachClassDef &&
44
+ flags & general_1.LookupFlag.MarkAttachmentType) {
43
45
  const maCls = (flags & general_1.LookupFlag.MarkAttachmentType) >>> 8;
44
- for (const [g, cls] of gdef.markAttachClassDef) {
45
- if (cls === maCls)
46
+ for (const [g, cls] of gdef.glyphClassDef) {
47
+ if (cls !== ot_layout_1.Gdef.GlyphClass.Mark)
48
+ continue;
49
+ const k = gdef.markAttachClassDef.get(g) || 0;
50
+ if (k !== maCls)
46
51
  ignores.add(g);
47
52
  }
48
53
  }
49
54
  }
50
55
  applyGdefMarkGlyphSetIgnores(ignores, flags, markFilteringSet, gdef) {
51
- if (gdef.markGlyphSets &&
56
+ if (gdef.glyphClassDef &&
57
+ gdef.markGlyphSets &&
52
58
  flags & general_1.LookupFlag.UseMarkFilteringSet &&
53
59
  markFilteringSet != null) {
54
60
  const mgs = gdef.markGlyphSets[markFilteringSet];
55
- if (mgs) {
56
- for (const g of mgs) {
61
+ if (!mgs)
62
+ return;
63
+ for (const [g, cls] of gdef.glyphClassDef) {
64
+ if (cls !== ot_layout_1.Gdef.GlyphClass.Mark)
65
+ continue;
66
+ if (!mgs.has(g))
57
67
  ignores.add(g);
58
- }
59
68
  }
60
69
  }
61
70
  }
@@ -95,10 +95,10 @@ class LookupListWriter {
95
95
  if (ignore) {
96
96
  if (ignore.ignoreBaseGlyphs)
97
97
  flags |= general_1.LookupFlag.IgnoreBaseGlyphs;
98
- if (ignore.ignoreMarks)
99
- flags |= general_1.LookupFlag.IgnoreMarks;
100
98
  if (ignore.ignoreLigatures)
101
99
  flags |= general_1.LookupFlag.IgnoreLigatures;
100
+ if (ignore.ignoreMarks)
101
+ flags |= general_1.LookupFlag.IgnoreMarks;
102
102
  if (ignore.markAttachmentType != null) {
103
103
  flags |= ignore.markAttachmentType << 8;
104
104
  }
@@ -250,7 +250,9 @@ exports.WriteLookupList = (0, bin_util_1.Write)(function (frag, lookups, lwf, lw
250
250
  dependentLookups.add(dep);
251
251
  }
252
252
  for (const lookup of lookups) {
253
- const trick = lwc.tricks ? lwc.tricks.get(lookup) || 0 : 0;
253
+ const trick = lwc.tricks
254
+ ? lwc.tricks.get(lookup) || cfg_1.LookupWriteTrick.None
255
+ : cfg_1.LookupWriteTrick.None;
254
256
  llw.pushLookup(lookup, dependentLookups.has(lookup), lwf, lwc.gdef, {
255
257
  trick,
256
258
  gOrd: lwc.gOrd,
@@ -40,6 +40,7 @@ declare abstract class GposMarkWriterBase<G, B> {
40
40
  private getInitialPlans;
41
41
  private getMaxAnchorClass;
42
42
  private fetchValidPlan;
43
+ private basesHasAtLeastOneBaseInThisClass;
43
44
  }
44
45
  export declare class GposMarkToBaseWriter extends GposMarkWriterBase<OtGlyph, Gpos.BaseRecord> implements LookupWriter<Gpos.Lookup, Gpos.MarkToBase> {
45
46
  canBeUsed(l: Gpos.Lookup): l is Gpos.MarkToBase;
@@ -274,7 +274,13 @@ class GposMarkWriterBase {
274
274
  loopCls: for (let c = 0; c < maxCls; c++) {
275
275
  if (clsSetAdded.has(c))
276
276
  continue;
277
- let conflict = false;
277
+ // Detect that we have at least one base that contains this class
278
+ // If not, just treat this class processed and move on
279
+ if (!this.basesHasAtLeastOneBaseInThisClass(cls, c, bases)) {
280
+ clsSetAdded.add(c);
281
+ continue;
282
+ }
283
+ let fConflict = false;
278
284
  const currentClassMarks = new Map();
279
285
  // Process mark list: ensure this class doesn't conflict with existing marks
280
286
  for (const [g, ma] of marks) {
@@ -283,9 +289,9 @@ class GposMarkWriterBase {
283
289
  continue;
284
290
  currentClassMarks.set(g, { glyph: g, class: c, anchor });
285
291
  if (planMarks.has(g))
286
- conflict = true;
292
+ fConflict = true;
287
293
  }
288
- if (conflict)
294
+ if (fConflict)
289
295
  break loopCls;
290
296
  // Ensure the base array is a rectangular matrix
291
297
  if (firstClass) {
@@ -313,6 +319,14 @@ class GposMarkWriterBase {
313
319
  return null;
314
320
  }
315
321
  }
322
+ basesHasAtLeastOneBaseInThisClass(cls, c, bases) {
323
+ for (const [g, br] of bases) {
324
+ if (cls.baseCoversMarkClass(c, br)) {
325
+ return true;
326
+ }
327
+ }
328
+ return false;
329
+ }
316
330
  }
317
331
  class GposMarkToBaseWriter extends GposMarkWriterBase {
318
332
  canBeUsed(l) {
@@ -5,6 +5,7 @@ import { Data } from "@ot-builder/prelude";
5
5
  import { ReadTimeIVS, WriteTimeIVS } from "@ot-builder/var-store";
6
6
  import { OtVar } from "@ot-builder/variance";
7
7
  export declare enum GposAdjustmentFormat {
8
+ ELIMINATED = 0,
8
9
  X_PLACEMENT = 1,
9
10
  Y_PLACEMENT = 2,
10
11
  X_ADVANCE = 4,
@@ -8,6 +8,7 @@ const variance_1 = require("@ot-builder/variance");
8
8
  const device_table_1 = require("./device-table");
9
9
  var GposAdjustmentFormat;
10
10
  (function (GposAdjustmentFormat) {
11
+ GposAdjustmentFormat[GposAdjustmentFormat["ELIMINATED"] = 0] = "ELIMINATED";
11
12
  GposAdjustmentFormat[GposAdjustmentFormat["X_PLACEMENT"] = 1] = "X_PLACEMENT";
12
13
  GposAdjustmentFormat[GposAdjustmentFormat["Y_PLACEMENT"] = 2] = "Y_PLACEMENT";
13
14
  GposAdjustmentFormat[GposAdjustmentFormat["X_ADVANCE"] = 4] = "X_ADVANCE";
@@ -152,7 +153,7 @@ exports.GposAdjustment = {
152
153
  return estimatePackedSizeImpl(format, adj);
153
154
  },
154
155
  decideFormat(adj) {
155
- let f = 0;
156
+ let f = GposAdjustmentFormat.ELIMINATED;
156
157
  if (!variance_1.OtVar.Ops.isZero(adj.dX))
157
158
  f |= GposAdjustmentFormat.X_PLACEMENT;
158
159
  if (!variance_1.OtVar.Ops.isZero(adj.dY))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ot-builder/io-bin-layout",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,27 +23,27 @@
23
23
  "access": "public"
24
24
  },
25
25
  "dependencies": {
26
- "@ot-builder/bin-composite-types": "1.6.1",
27
- "@ot-builder/bin-util": "1.6.1",
28
- "@ot-builder/errors": "1.6.1",
29
- "@ot-builder/ot-glyphs": "1.6.1",
30
- "@ot-builder/ot-layout": "1.6.1",
31
- "@ot-builder/ot-metadata": "1.6.1",
32
- "@ot-builder/prelude": "1.6.1",
33
- "@ot-builder/primitive": "1.6.1",
34
- "@ot-builder/var-store": "1.6.1",
35
- "@ot-builder/variance": "1.6.1",
36
- "@ot-builder/common-impl": "1.6.1",
37
- "@ot-builder/ot-sfnt": "1.6.1",
38
- "@ot-builder/io-bin-sfnt": "1.6.1",
26
+ "@ot-builder/bin-composite-types": "1.6.3",
27
+ "@ot-builder/bin-util": "1.6.3",
28
+ "@ot-builder/errors": "1.6.3",
29
+ "@ot-builder/ot-glyphs": "1.6.3",
30
+ "@ot-builder/ot-layout": "1.6.3",
31
+ "@ot-builder/ot-metadata": "1.6.3",
32
+ "@ot-builder/prelude": "1.6.3",
33
+ "@ot-builder/primitive": "1.6.3",
34
+ "@ot-builder/var-store": "1.6.3",
35
+ "@ot-builder/variance": "1.6.3",
36
+ "@ot-builder/common-impl": "1.6.3",
37
+ "@ot-builder/ot-sfnt": "1.6.3",
38
+ "@ot-builder/io-bin-sfnt": "1.6.3",
39
39
  "tslib": "^2.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@ot-builder/io-bin-glyph-store": "1.6.1",
43
- "@ot-builder/io-bin-metadata": "1.6.1",
44
- "@ot-builder/ot-encoding": "1.6.1",
45
- "@ot-builder/io-bin-encoding": "1.6.1",
46
- "@ot-builder/test-util": "1.6.1",
42
+ "@ot-builder/io-bin-glyph-store": "1.6.3",
43
+ "@ot-builder/io-bin-metadata": "1.6.3",
44
+ "@ot-builder/ot-encoding": "1.6.3",
45
+ "@ot-builder/io-bin-encoding": "1.6.3",
46
+ "@ot-builder/test-util": "1.6.3",
47
47
  "@types/jest": "^26.0.23",
48
48
  "jest": "^29.3.1"
49
49
  }