@cantoo/fontkit 2.0.4 → 2.0.5

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.
Files changed (115) hide show
  1. package/dist/browser-module.mjs +28 -28
  2. package/dist/browser-module.mjs.map +1 -1
  3. package/dist/browser.cjs +28 -28
  4. package/dist/browser.cjs.map +1 -1
  5. package/dist/main.cjs +28 -28
  6. package/dist/main.cjs.map +1 -1
  7. package/dist/module.mjs +28 -28
  8. package/dist/module.mjs.map +1 -1
  9. package/package.json +2 -1
  10. package/src/CmapProcessor.js +2 -2
  11. package/src/DFont.js +5 -5
  12. package/src/TTFFont.js +11 -15
  13. package/src/TrueTypeCollection.js +10 -10
  14. package/src/WOFF2Font.js +0 -6
  15. package/src/aat/AATFeatureMap.js +21 -22
  16. package/src/aat/AATLayoutEngine.js +1 -1
  17. package/src/aat/AATLookupTable.js +2 -2
  18. package/src/aat/AATMorxProcessor.js +14 -14
  19. package/src/aat/AATStateMachine.js +3 -3
  20. package/src/base.js +1 -1
  21. package/src/cff/CFFDict.js +2 -2
  22. package/src/cff/CFFFont.js +1 -1
  23. package/src/cff/CFFIndex.js +4 -4
  24. package/src/cff/CFFOperand.js +1 -11
  25. package/src/cff/CFFPrivateDict.js +20 -20
  26. package/src/cff/CFFStandardStrings.js +67 -67
  27. package/src/cff/CFFTop.js +58 -58
  28. package/src/decorators.js +3 -3
  29. package/src/encodings.js +111 -111
  30. package/src/glyph/CFFGlyph.js +3 -4
  31. package/src/glyph/COLRGlyph.js +2 -2
  32. package/src/glyph/Glyph.js +4 -4
  33. package/src/glyph/GlyphVariationProcessor.js +23 -28
  34. package/src/glyph/Path.js +14 -14
  35. package/src/glyph/SBIXGlyph.js +2 -2
  36. package/src/glyph/TTFGlyph.js +31 -38
  37. package/src/glyph/TTFGlyphEncoder.js +26 -26
  38. package/src/glyph/WOFF2Glyph.js +2 -2
  39. package/src/layout/GlyphRun.js +3 -3
  40. package/src/layout/KernProcessor.js +1 -1
  41. package/src/layout/LayoutEngine.js +13 -14
  42. package/src/layout/Script.js +25 -25
  43. package/src/layout/UnicodeLayoutEngine.js +5 -6
  44. package/src/opentype/GlyphInfo.js +1 -1
  45. package/src/opentype/GlyphIterator.js +2 -2
  46. package/src/opentype/OTProcessor.js +8 -8
  47. package/src/opentype/ShapingPlan.js +1 -2
  48. package/src/opentype/shapers/ArabicShaper.js +8 -8
  49. package/src/opentype/shapers/DefaultShaper.js +3 -3
  50. package/src/opentype/shapers/HangulShaper.js +35 -35
  51. package/src/opentype/shapers/HebrewShaper.js +5 -5
  52. package/src/opentype/shapers/IndicShaper.js +20 -20
  53. package/src/opentype/shapers/ThaiShaper.js +15 -15
  54. package/src/opentype/shapers/UniversalShaper.js +2 -2
  55. package/src/opentype/shapers/index.js +33 -33
  56. package/src/opentype/shapers/indic-data.js +2 -2
  57. package/src/packages/unicode-properties/data-trie.js +1 -1
  58. package/src/packages/unicode-properties/data.js +1 -1
  59. package/src/packages/unicode-properties/dist/index.cjs +1 -1
  60. package/src/packages/unicode-properties/dist/index.cjs.map +2 -2
  61. package/src/packages/unicode-properties/dist/index.mjs +1 -1
  62. package/src/packages/unicode-properties/dist/index.mjs.map +2 -2
  63. package/src/packages/unicode-properties/generate.js +3 -4
  64. package/src/packages/unicode-properties/index.js +30 -30
  65. package/src/packages/unicode-properties/package.json +1 -1
  66. package/src/packages/unicode-trie/builder.js +18 -22
  67. package/src/packages/unicode-trie/dist/builder.cjs +6 -9
  68. package/src/packages/unicode-trie/dist/builder.cjs.map +2 -2
  69. package/src/packages/unicode-trie/dist/builder.mjs +6 -9
  70. package/src/packages/unicode-trie/dist/builder.mjs.map +2 -2
  71. package/src/packages/unicode-trie/dist/index.cjs.map +2 -2
  72. package/src/packages/unicode-trie/dist/index.mjs.map +2 -2
  73. package/src/packages/unicode-trie/index.js +1 -2
  74. package/src/packages/unicode-trie/package.json +1 -1
  75. package/src/packages/unicode-trie/swap.js +2 -2
  76. package/src/subset/Subset.js +2 -2
  77. package/src/subset/TTFSubset.js +5 -5
  78. package/src/tables/BASE.js +27 -27
  79. package/src/tables/COLR.js +9 -9
  80. package/src/tables/CPAL.js +1 -1
  81. package/src/tables/DSIG.js +7 -7
  82. package/src/tables/EBDT.js +0 -1
  83. package/src/tables/EBLC.js +3 -3
  84. package/src/tables/GDEF.js +17 -17
  85. package/src/tables/GPOS.js +74 -74
  86. package/src/tables/GSUB.js +37 -37
  87. package/src/tables/JSTF.js +16 -16
  88. package/src/tables/LTSH.js +3 -3
  89. package/src/tables/OS2.js +49 -49
  90. package/src/tables/PCLT.js +15 -15
  91. package/src/tables/VDMX.js +17 -17
  92. package/src/tables/VORG.js +7 -7
  93. package/src/tables/WOFF2Directory.js +2 -2
  94. package/src/tables/WOFFDirectory.js +18 -18
  95. package/src/tables/aat.js +2 -2
  96. package/src/tables/cmap.js +63 -63
  97. package/src/tables/directory.js +14 -14
  98. package/src/tables/gasp.js +5 -5
  99. package/src/tables/glyf.js +1 -1
  100. package/src/tables/hdmx.js +7 -7
  101. package/src/tables/head.js +16 -16
  102. package/src/tables/hhea.js +14 -14
  103. package/src/tables/hmtx.js +2 -2
  104. package/src/tables/index.js +0 -5
  105. package/src/tables/just.js +1 -1
  106. package/src/tables/kern.js +42 -42
  107. package/src/tables/loca.js +2 -2
  108. package/src/tables/maxp.js +15 -15
  109. package/src/tables/morx.js +16 -16
  110. package/src/tables/name.js +18 -18
  111. package/src/tables/opentype.js +91 -91
  112. package/src/tables/post.js +10 -10
  113. package/src/tables/variations.js +6 -6
  114. package/src/tables/vhea.js +14 -14
  115. package/src/tables/vmtx.js +3 -3
@@ -2,24 +2,24 @@ import * as r from 'restructure';
2
2
 
3
3
  // font header
4
4
  export default new r.Struct({
5
- version: r.int32, // 0x00010000 (version 1.0)
6
- revision: r.int32, // set by font manufacturer
5
+ version: r.int32, // 0x00010000 (version 1.0)
6
+ revision: r.int32, // set by font manufacturer
7
7
  checkSumAdjustment: r.uint32,
8
- magicNumber: r.uint32, // set to 0x5F0F3CF5
9
- flags: r.uint16,
10
- unitsPerEm: r.uint16, // range from 64 to 16384
11
- created: new r.Array(r.int32, 2),
12
- modified: new r.Array(r.int32, 2),
13
- xMin: r.int16, // for all glyph bounding boxes
14
- yMin: r.int16, // for all glyph bounding boxes
15
- xMax: r.int16, // for all glyph bounding boxes
16
- yMax: r.int16, // for all glyph bounding boxes
17
- macStyle: new r.Bitfield(r.uint16, [
8
+ magicNumber: r.uint32, // set to 0x5F0F3CF5
9
+ flags: r.uint16,
10
+ unitsPerEm: r.uint16, // range from 64 to 16384
11
+ created: new r.Array(r.int32, 2),
12
+ modified: new r.Array(r.int32, 2),
13
+ xMin: r.int16, // for all glyph bounding boxes
14
+ yMin: r.int16, // for all glyph bounding boxes
15
+ xMax: r.int16, // for all glyph bounding boxes
16
+ yMax: r.int16, // for all glyph bounding boxes
17
+ macStyle: new r.Bitfield(r.uint16, [
18
18
  'bold', 'italic', 'underline', 'outline',
19
19
  'shadow', 'condensed', 'extended'
20
20
  ]),
21
- lowestRecPPEM: r.uint16, // smallest readable size in pixels
22
- fontDirectionHint: r.int16,
23
- indexToLocFormat: r.int16, // 0 for short offsets, 1 for long
24
- glyphDataFormat: r.int16 // 0 for current format
21
+ lowestRecPPEM: r.uint16, // smallest readable size in pixels
22
+ fontDirectionHint: r.int16,
23
+ indexToLocFormat: r.int16, // 0 for short offsets, 1 for long
24
+ glyphDataFormat: r.int16 // 0 for current format
25
25
  });
@@ -2,18 +2,18 @@ import * as r from 'restructure';
2
2
 
3
3
  // horizontal header
4
4
  export default new r.Struct({
5
- version: r.int32,
6
- ascent: r.int16, // Distance from baseline of highest ascender
7
- descent: r.int16, // Distance from baseline of lowest descender
8
- lineGap: r.int16, // Typographic line gap
9
- advanceWidthMax: r.uint16, // Maximum advance width value in 'hmtx' table
10
- minLeftSideBearing: r.int16, // Maximum advance width value in 'hmtx' table
11
- minRightSideBearing: r.int16, // Minimum right sidebearing value
12
- xMaxExtent: r.int16,
13
- caretSlopeRise: r.int16, // Used to calculate the slope of the cursor (rise/run); 1 for vertical
14
- caretSlopeRun: r.int16, // 0 for vertical
15
- caretOffset: r.int16, // Set to 0 for non-slanted fonts
16
- reserved: new r.Reserved(r.int16, 4),
17
- metricDataFormat: r.int16, // 0 for current format
18
- numberOfMetrics: r.uint16 // Number of advance widths in 'hmtx' table
5
+ version: r.int32,
6
+ ascent: r.int16, // Distance from baseline of highest ascender
7
+ descent: r.int16, // Distance from baseline of lowest descender
8
+ lineGap: r.int16, // Typographic line gap
9
+ advanceWidthMax: r.uint16, // Maximum advance width value in 'hmtx' table
10
+ minLeftSideBearing: r.int16, // Maximum advance width value in 'hmtx' table
11
+ minRightSideBearing: r.int16, // Minimum right sidebearing value
12
+ xMaxExtent: r.int16,
13
+ caretSlopeRise: r.int16, // Used to calculate the slope of the cursor (rise/run); 1 for vertical
14
+ caretSlopeRun: r.int16, // 0 for vertical
15
+ caretOffset: r.int16, // Set to 0 for non-slanted fonts
16
+ reserved: new r.Reserved(r.int16, 4),
17
+ metricDataFormat: r.int16, // 0 for current format
18
+ numberOfMetrics: r.uint16 // Number of advance widths in 'hmtx' table
19
19
  });
@@ -6,6 +6,6 @@ let HmtxEntry = new r.Struct({
6
6
  });
7
7
 
8
8
  export default new r.Struct({
9
- metrics: new r.LazyArray(HmtxEntry, t => t.parent.hhea.numberOfMetrics),
10
- bearings: new r.LazyArray(r.int16, t => t.parent.maxp.numGlyphs - t.parent.hhea.numberOfMetrics)
9
+ metrics: new r.LazyArray(HmtxEntry, t => t.parent.hhea.numberOfMetrics),
10
+ bearings: new r.LazyArray(r.int16, t => t.parent.maxp.numGlyphs - t.parent.hhea.numberOfMetrics)
11
11
  });
@@ -20,7 +20,6 @@ tables.name = name;
20
20
  tables['OS/2'] = OS2;
21
21
  tables.post = post;
22
22
 
23
-
24
23
  // TrueType Outlines
25
24
  import cvt from './cvt';
26
25
  import fpgm from './fpgm';
@@ -34,7 +33,6 @@ tables.prep = prep;
34
33
  tables['cvt '] = cvt;
35
34
  tables.glyf = glyf;
36
35
 
37
-
38
36
  // PostScript Outlines
39
37
  import CFFFont from '../cff/CFFFont';
40
38
  import VORG from './VORG';
@@ -43,7 +41,6 @@ tables['CFF '] = CFFFont;
43
41
  tables['CFF2'] = CFFFont;
44
42
  tables.VORG = VORG;
45
43
 
46
-
47
44
  // Bitmap Glyphs
48
45
  import EBLC from './EBLC';
49
46
  import sbix from './sbix';
@@ -56,7 +53,6 @@ tables.sbix = sbix;
56
53
  tables.COLR = COLR;
57
54
  tables.CPAL = CPAL;
58
55
 
59
-
60
56
  // Advanced OpenType Tables
61
57
  import BASE from './BASE';
62
58
  import GDEF from './GDEF';
@@ -98,7 +94,6 @@ tables.VDMX = VDMX;
98
94
  tables.vhea = vhea;
99
95
  tables.vmtx = vmtx;
100
96
 
101
-
102
97
  // Apple Advanced Typography Tables
103
98
  import avar from './avar';
104
99
  import bsln from './bsln';
@@ -5,7 +5,7 @@ let ClassTable = new r.Struct({
5
5
  length: r.uint16,
6
6
  coverage: r.uint16,
7
7
  subFeatureFlags: r.uint32,
8
- stateTable: new StateTable1
8
+ stateTable: new StateTable1()
9
9
  });
10
10
 
11
11
  let WidthDeltaRecord = new r.Struct({
@@ -1,9 +1,9 @@
1
1
  import * as r from 'restructure';
2
2
 
3
3
  let KernPair = new r.Struct({
4
- left: r.uint16,
5
- right: r.uint16,
6
- value: r.int16
4
+ left: r.uint16,
5
+ right: r.uint16,
6
+ value: r.int16
7
7
  });
8
8
 
9
9
  let ClassTable = new r.Struct({
@@ -21,71 +21,71 @@ let Kern2Array = new r.Struct({
21
21
 
22
22
  let KernSubtable = new r.VersionedStruct('format', {
23
23
  0: {
24
- nPairs: r.uint16,
25
- searchRange: r.uint16,
26
- entrySelector: r.uint16,
27
- rangeShift: r.uint16,
28
- pairs: new r.Array(KernPair, 'nPairs')
24
+ nPairs: r.uint16,
25
+ searchRange: r.uint16,
26
+ entrySelector: r.uint16,
27
+ rangeShift: r.uint16,
28
+ pairs: new r.Array(KernPair, 'nPairs')
29
29
  },
30
30
 
31
31
  2: {
32
- rowWidth: r.uint16,
33
- leftTable: new r.Pointer(r.uint16, ClassTable, {type: 'parent'}),
34
- rightTable: new r.Pointer(r.uint16, ClassTable, {type: 'parent'}),
35
- array: new r.Pointer(r.uint16, Kern2Array, {type: 'parent'})
32
+ rowWidth: r.uint16,
33
+ leftTable: new r.Pointer(r.uint16, ClassTable, { type: 'parent' }),
34
+ rightTable: new r.Pointer(r.uint16, ClassTable, { type: 'parent' }),
35
+ array: new r.Pointer(r.uint16, Kern2Array, { type: 'parent' })
36
36
  },
37
37
 
38
38
  3: {
39
- glyphCount: r.uint16,
40
- kernValueCount: r.uint8,
41
- leftClassCount: r.uint8,
42
- rightClassCount: r.uint8,
43
- flags: r.uint8,
44
- kernValue: new r.Array(r.int16, 'kernValueCount'),
45
- leftClass: new r.Array(r.uint8, 'glyphCount'),
46
- rightClass: new r.Array(r.uint8, 'glyphCount'),
47
- kernIndex: new r.Array(r.uint8, t => t.leftClassCount * t.rightClassCount)
39
+ glyphCount: r.uint16,
40
+ kernValueCount: r.uint8,
41
+ leftClassCount: r.uint8,
42
+ rightClassCount: r.uint8,
43
+ flags: r.uint8,
44
+ kernValue: new r.Array(r.int16, 'kernValueCount'),
45
+ leftClass: new r.Array(r.uint8, 'glyphCount'),
46
+ rightClass: new r.Array(r.uint8, 'glyphCount'),
47
+ kernIndex: new r.Array(r.uint8, t => t.leftClassCount * t.rightClassCount)
48
48
  }
49
49
  });
50
50
 
51
51
  let KernTable = new r.VersionedStruct('version', {
52
52
  0: { // Microsoft uses this format
53
- subVersion: r.uint16, // Microsoft has an extra sub-table version number
54
- length: r.uint16, // Length of the subtable, in bytes
55
- format: r.uint8, // Format of subtable
56
- coverage: new r.Bitfield(r.uint8, [
57
- 'horizontal', // 1 if table has horizontal data, 0 if vertical
58
- 'minimum', // If set to 1, the table has minimum values. If set to 0, the table has kerning values.
59
- 'crossStream', // If set to 1, kerning is perpendicular to the flow of the text
60
- 'override' // If set to 1 the value in this table replaces the accumulated value
53
+ subVersion: r.uint16, // Microsoft has an extra sub-table version number
54
+ length: r.uint16, // Length of the subtable, in bytes
55
+ format: r.uint8, // Format of subtable
56
+ coverage: new r.Bitfield(r.uint8, [
57
+ 'horizontal', // 1 if table has horizontal data, 0 if vertical
58
+ 'minimum', // If set to 1, the table has minimum values. If set to 0, the table has kerning values.
59
+ 'crossStream', // If set to 1, kerning is perpendicular to the flow of the text
60
+ 'override' // If set to 1 the value in this table replaces the accumulated value
61
61
  ]),
62
- subtable: KernSubtable,
62
+ subtable: KernSubtable,
63
63
  padding: new r.Reserved(r.uint8, t => t.length - t._currentOffset)
64
64
  },
65
65
  1: { // Apple uses this format
66
- length: r.uint32,
67
- coverage: new r.Bitfield(r.uint8, [
66
+ length: r.uint32,
67
+ coverage: new r.Bitfield(r.uint8, [
68
68
  null, null, null, null, null,
69
- 'variation', // Set if table has variation kerning values
70
- 'crossStream', // Set if table has cross-stream kerning values
71
- 'vertical' // Set if table has vertical kerning values
69
+ 'variation', // Set if table has variation kerning values
70
+ 'crossStream', // Set if table has cross-stream kerning values
71
+ 'vertical' // Set if table has vertical kerning values
72
72
  ]),
73
- format: r.uint8,
73
+ format: r.uint8,
74
74
  tupleIndex: r.uint16,
75
- subtable: KernSubtable,
75
+ subtable: KernSubtable,
76
76
  padding: new r.Reserved(r.uint8, t => t.length - t._currentOffset)
77
77
  }
78
78
  });
79
79
 
80
80
  export default new r.VersionedStruct(r.uint16, {
81
81
  0: { // Microsoft Version
82
- nTables: r.uint16,
83
- tables: new r.Array(KernTable, 'nTables')
82
+ nTables: r.uint16,
83
+ tables: new r.Array(KernTable, 'nTables')
84
84
  },
85
85
 
86
86
  1: { // Apple Version
87
- reserved: new r.Reserved(r.uint16), // the other half of the version number
88
- nTables: r.uint32,
89
- tables: new r.Array(KernTable, 'nTables')
87
+ reserved: new r.Reserved(r.uint16), // the other half of the version number
88
+ nTables: r.uint32,
89
+ tables: new r.Array(KernTable, 'nTables')
90
90
  }
91
91
  });
@@ -9,7 +9,7 @@ let loca = new r.VersionedStruct('head.indexToLocFormat', {
9
9
  }
10
10
  });
11
11
 
12
- loca.process = function() {
12
+ loca.process = function () {
13
13
  if (this.version === 0 && !this._processed) {
14
14
  for (let i = 0; i < this.offsets.length; i++) {
15
15
  this.offsets[i] <<= 1;
@@ -18,7 +18,7 @@ loca.process = function() {
18
18
  }
19
19
  };
20
20
 
21
- loca.preEncode = function() {
21
+ loca.preEncode = function () {
22
22
  if (this.version === 0 && this._processed !== false) {
23
23
  for (let i = 0; i < this.offsets.length; i++) {
24
24
  this.offsets[i] >>>= 1;
@@ -2,19 +2,19 @@ import * as r from 'restructure';
2
2
 
3
3
  // maxiumum profile
4
4
  export default new r.Struct({
5
- version: r.int32,
6
- numGlyphs: r.uint16, // The number of glyphs in the font
7
- maxPoints: r.uint16, // Maximum points in a non-composite glyph
8
- maxContours: r.uint16, // Maximum contours in a non-composite glyph
9
- maxComponentPoints: r.uint16, // Maximum points in a composite glyph
10
- maxComponentContours: r.uint16, // Maximum contours in a composite glyph
11
- maxZones: r.uint16, // 1 if instructions do not use the twilight zone, 2 otherwise
12
- maxTwilightPoints: r.uint16, // Maximum points used in Z0
13
- maxStorage: r.uint16, // Number of Storage Area locations
14
- maxFunctionDefs: r.uint16, // Number of FDEFs
15
- maxInstructionDefs: r.uint16, // Number of IDEFs
16
- maxStackElements: r.uint16, // Maximum stack depth
17
- maxSizeOfInstructions: r.uint16, // Maximum byte count for glyph instructions
18
- maxComponentElements: r.uint16, // Maximum number of components referenced at “top level” for any composite glyph
19
- maxComponentDepth: r.uint16 // Maximum levels of recursion; 1 for simple components
5
+ version: r.int32,
6
+ numGlyphs: r.uint16, // The number of glyphs in the font
7
+ maxPoints: r.uint16, // Maximum points in a non-composite glyph
8
+ maxContours: r.uint16, // Maximum contours in a non-composite glyph
9
+ maxComponentPoints: r.uint16, // Maximum points in a composite glyph
10
+ maxComponentContours: r.uint16, // Maximum contours in a composite glyph
11
+ maxZones: r.uint16, // 1 if instructions do not use the twilight zone, 2 otherwise
12
+ maxTwilightPoints: r.uint16, // Maximum points used in Z0
13
+ maxStorage: r.uint16, // Number of Storage Area locations
14
+ maxFunctionDefs: r.uint16, // Number of FDEFs
15
+ maxInstructionDefs: r.uint16, // Number of IDEFs
16
+ maxStackElements: r.uint16, // Maximum stack depth
17
+ maxSizeOfInstructions: r.uint16, // Maximum byte count for glyph instructions
18
+ maxComponentElements: r.uint16, // Maximum number of components referenced at “top level” for any composite glyph
19
+ maxComponentDepth: r.uint16 // Maximum levels of recursion; 1 for simple components
20
20
  });
@@ -16,12 +16,12 @@ let InsertionData = {
16
16
  };
17
17
 
18
18
  let SubstitutionTable = new r.Struct({
19
- items: new UnboundedArray(new r.Pointer(r.uint32, new LookupTable))
19
+ items: new UnboundedArray(new r.Pointer(r.uint32, new LookupTable()))
20
20
  });
21
21
 
22
22
  let SubtableData = new r.VersionedStruct('type', {
23
23
  0: { // Indic Rearrangement Subtable
24
- stateTable: new StateTable
24
+ stateTable: new StateTable()
25
25
  },
26
26
 
27
27
  1: { // Contextual Glyph Substitution Subtable
@@ -37,7 +37,7 @@ let SubtableData = new r.VersionedStruct('type', {
37
37
  },
38
38
 
39
39
  4: { // Non-contextual Glyph Substitution Subtable
40
- lookupTable: new LookupTable
40
+ lookupTable: new LookupTable()
41
41
  },
42
42
 
43
43
  5: { // Glyph Insertion Subtable
@@ -56,24 +56,24 @@ let Subtable = new r.Struct({
56
56
  });
57
57
 
58
58
  let FeatureEntry = new r.Struct({
59
- featureType: r.uint16,
59
+ featureType: r.uint16,
60
60
  featureSetting: r.uint16,
61
- enableFlags: r.uint32,
62
- disableFlags: r.uint32
61
+ enableFlags: r.uint32,
62
+ disableFlags: r.uint32
63
63
  });
64
64
 
65
65
  let MorxChain = new r.Struct({
66
- defaultFlags: r.uint32,
67
- chainLength: r.uint32,
68
- nFeatureEntries: r.uint32,
69
- nSubtables: r.uint32,
70
- features: new r.Array(FeatureEntry, 'nFeatureEntries'),
71
- subtables: new r.Array(Subtable, 'nSubtables')
66
+ defaultFlags: r.uint32,
67
+ chainLength: r.uint32,
68
+ nFeatureEntries: r.uint32,
69
+ nSubtables: r.uint32,
70
+ features: new r.Array(FeatureEntry, 'nFeatureEntries'),
71
+ subtables: new r.Array(Subtable, 'nSubtables')
72
72
  });
73
73
 
74
74
  export default new r.Struct({
75
- version: r.uint16,
76
- unused: new r.Reserved(r.uint16),
77
- nChains: r.uint32,
78
- chains: new r.Array(MorxChain, 'nChains')
75
+ version: r.uint16,
76
+ unused: new r.Reserved(r.uint16),
77
+ nChains: r.uint32,
78
+ chains: new r.Array(MorxChain, 'nChains')
79
79
  });
@@ -1,35 +1,35 @@
1
1
  import * as r from 'restructure';
2
- import {getEncoding, LANGUAGES} from '../encodings';
2
+ import { getEncoding, LANGUAGES } from '../encodings';
3
3
 
4
4
  let NameRecord = new r.Struct({
5
5
  platformID: r.uint16,
6
6
  encodingID: r.uint16,
7
7
  languageID: r.uint16,
8
- nameID: r.uint16,
9
- length: r.uint16,
10
- string: new r.Pointer(r.uint16,
8
+ nameID: r.uint16,
9
+ length: r.uint16,
10
+ string: new r.Pointer(r.uint16,
11
11
  new r.String('length', t => getEncoding(t.platformID, t.encodingID, t.languageID)),
12
12
  { type: 'parent', relativeTo: ctx => ctx.parent.stringOffset, allowNull: false }
13
13
  )
14
14
  });
15
15
 
16
16
  let LangTagRecord = new r.Struct({
17
- length: r.uint16,
18
- tag: new r.Pointer(r.uint16, new r.String('length', 'utf16be'), {type: 'parent', relativeTo: ctx => ctx.stringOffset})
17
+ length: r.uint16,
18
+ tag: new r.Pointer(r.uint16, new r.String('length', 'utf16be'), { type: 'parent', relativeTo: ctx => ctx.stringOffset })
19
19
  });
20
20
 
21
21
  var NameTable = new r.VersionedStruct(r.uint16, {
22
22
  0: {
23
- count: r.uint16,
24
- stringOffset: r.uint16,
25
- records: new r.Array(NameRecord, 'count')
23
+ count: r.uint16,
24
+ stringOffset: r.uint16,
25
+ records: new r.Array(NameRecord, 'count')
26
26
  },
27
27
  1: {
28
- count: r.uint16,
29
- stringOffset: r.uint16,
30
- records: new r.Array(NameRecord, 'count'),
31
- langTagCount: r.uint16,
32
- langTags: new r.Array(LangTagRecord, 'langTagCount')
28
+ count: r.uint16,
29
+ stringOffset: r.uint16,
30
+ records: new r.Array(NameRecord, 'count'),
31
+ langTagCount: r.uint16,
32
+ langTags: new r.Array(LangTagRecord, 'langTagCount')
33
33
  }
34
34
  });
35
35
 
@@ -61,7 +61,7 @@ const NAMES = [
61
61
  'wwsSubfamilyName',
62
62
  'lightBackgroundPalette',
63
63
  'darkBackgroundPalette',
64
- 'variationsPostScriptNamePrefix',
64
+ 'variationsPostScriptNamePrefix'
65
65
  ];
66
66
 
67
67
  function pushEnRecord(out, nameID, string) {
@@ -77,8 +77,8 @@ function pushEnRecord(out, nameID, string) {
77
77
  });
78
78
  }
79
79
 
80
- NameTable.process = function(_stream) {
81
- let records = {fontFeatures: {}};
80
+ NameTable.process = function (_stream) {
81
+ let records = { fontFeatures: {} };
82
82
 
83
83
  for (let record of this.records) {
84
84
  let language = LANGUAGES[record.platformID][record.languageID];
@@ -112,7 +112,7 @@ NameTable.process = function(_stream) {
112
112
  this.records = records;
113
113
  };
114
114
 
115
- NameTable.preEncode = function() {
115
+ NameTable.preEncode = function () {
116
116
  if (Array.isArray(this.records)) return;
117
117
  this.version = 0;
118
118