@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.
- package/dist/browser-module.mjs +28 -28
- package/dist/browser-module.mjs.map +1 -1
- package/dist/browser.cjs +28 -28
- package/dist/browser.cjs.map +1 -1
- package/dist/main.cjs +28 -28
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +28 -28
- package/dist/module.mjs.map +1 -1
- package/package.json +2 -1
- package/src/CmapProcessor.js +2 -2
- package/src/DFont.js +5 -5
- package/src/TTFFont.js +11 -15
- package/src/TrueTypeCollection.js +10 -10
- package/src/WOFF2Font.js +0 -6
- package/src/aat/AATFeatureMap.js +21 -22
- package/src/aat/AATLayoutEngine.js +1 -1
- package/src/aat/AATLookupTable.js +2 -2
- package/src/aat/AATMorxProcessor.js +14 -14
- package/src/aat/AATStateMachine.js +3 -3
- package/src/base.js +1 -1
- package/src/cff/CFFDict.js +2 -2
- package/src/cff/CFFFont.js +1 -1
- package/src/cff/CFFIndex.js +4 -4
- package/src/cff/CFFOperand.js +1 -11
- package/src/cff/CFFPrivateDict.js +20 -20
- package/src/cff/CFFStandardStrings.js +67 -67
- package/src/cff/CFFTop.js +58 -58
- package/src/decorators.js +3 -3
- package/src/encodings.js +111 -111
- package/src/glyph/CFFGlyph.js +3 -4
- package/src/glyph/COLRGlyph.js +2 -2
- package/src/glyph/Glyph.js +4 -4
- package/src/glyph/GlyphVariationProcessor.js +23 -28
- package/src/glyph/Path.js +14 -14
- package/src/glyph/SBIXGlyph.js +2 -2
- package/src/glyph/TTFGlyph.js +31 -38
- package/src/glyph/TTFGlyphEncoder.js +26 -26
- package/src/glyph/WOFF2Glyph.js +2 -2
- package/src/layout/GlyphRun.js +3 -3
- package/src/layout/KernProcessor.js +1 -1
- package/src/layout/LayoutEngine.js +13 -14
- package/src/layout/Script.js +25 -25
- package/src/layout/UnicodeLayoutEngine.js +5 -6
- package/src/opentype/GlyphInfo.js +1 -1
- package/src/opentype/GlyphIterator.js +2 -2
- package/src/opentype/OTProcessor.js +8 -8
- package/src/opentype/ShapingPlan.js +1 -2
- package/src/opentype/shapers/ArabicShaper.js +8 -8
- package/src/opentype/shapers/DefaultShaper.js +3 -3
- package/src/opentype/shapers/HangulShaper.js +35 -35
- package/src/opentype/shapers/HebrewShaper.js +5 -5
- package/src/opentype/shapers/IndicShaper.js +20 -20
- package/src/opentype/shapers/ThaiShaper.js +15 -15
- package/src/opentype/shapers/UniversalShaper.js +2 -2
- package/src/opentype/shapers/index.js +33 -33
- package/src/opentype/shapers/indic-data.js +2 -2
- package/src/packages/unicode-properties/data-trie.js +1 -1
- package/src/packages/unicode-properties/data.js +1 -1
- package/src/packages/unicode-properties/dist/index.cjs +1 -1
- package/src/packages/unicode-properties/dist/index.cjs.map +2 -2
- package/src/packages/unicode-properties/dist/index.mjs +1 -1
- package/src/packages/unicode-properties/dist/index.mjs.map +2 -2
- package/src/packages/unicode-properties/generate.js +3 -4
- package/src/packages/unicode-properties/index.js +30 -30
- package/src/packages/unicode-properties/package.json +1 -1
- package/src/packages/unicode-trie/builder.js +18 -22
- package/src/packages/unicode-trie/dist/builder.cjs +6 -9
- package/src/packages/unicode-trie/dist/builder.cjs.map +2 -2
- package/src/packages/unicode-trie/dist/builder.mjs +6 -9
- package/src/packages/unicode-trie/dist/builder.mjs.map +2 -2
- package/src/packages/unicode-trie/dist/index.cjs.map +2 -2
- package/src/packages/unicode-trie/dist/index.mjs.map +2 -2
- package/src/packages/unicode-trie/index.js +1 -2
- package/src/packages/unicode-trie/package.json +1 -1
- package/src/packages/unicode-trie/swap.js +2 -2
- package/src/subset/Subset.js +2 -2
- package/src/subset/TTFSubset.js +5 -5
- package/src/tables/BASE.js +27 -27
- package/src/tables/COLR.js +9 -9
- package/src/tables/CPAL.js +1 -1
- package/src/tables/DSIG.js +7 -7
- package/src/tables/EBDT.js +0 -1
- package/src/tables/EBLC.js +3 -3
- package/src/tables/GDEF.js +17 -17
- package/src/tables/GPOS.js +74 -74
- package/src/tables/GSUB.js +37 -37
- package/src/tables/JSTF.js +16 -16
- package/src/tables/LTSH.js +3 -3
- package/src/tables/OS2.js +49 -49
- package/src/tables/PCLT.js +15 -15
- package/src/tables/VDMX.js +17 -17
- package/src/tables/VORG.js +7 -7
- package/src/tables/WOFF2Directory.js +2 -2
- package/src/tables/WOFFDirectory.js +18 -18
- package/src/tables/aat.js +2 -2
- package/src/tables/cmap.js +63 -63
- package/src/tables/directory.js +14 -14
- package/src/tables/gasp.js +5 -5
- package/src/tables/glyf.js +1 -1
- package/src/tables/hdmx.js +7 -7
- package/src/tables/head.js +16 -16
- package/src/tables/hhea.js +14 -14
- package/src/tables/hmtx.js +2 -2
- package/src/tables/index.js +0 -5
- package/src/tables/just.js +1 -1
- package/src/tables/kern.js +42 -42
- package/src/tables/loca.js +2 -2
- package/src/tables/maxp.js +15 -15
- package/src/tables/morx.js +16 -16
- package/src/tables/name.js +18 -18
- package/src/tables/opentype.js +91 -91
- package/src/tables/post.js +10 -10
- package/src/tables/variations.js +6 -6
- package/src/tables/vhea.js +14 -14
- package/src/tables/vmtx.js +3 -3
package/src/encodings.js
CHANGED
|
@@ -6,7 +6,7 @@ export function getEncoding(platformID, encodingID, languageID = 0) {
|
|
|
6
6
|
if (platformID === 1 && MAC_LANGUAGE_ENCODINGS[languageID]) {
|
|
7
7
|
return MAC_LANGUAGE_ENCODINGS[languageID];
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
return ENCODINGS[platformID][encodingID];
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -67,35 +67,35 @@ export function getEncodingMapping(encoding) {
|
|
|
67
67
|
export const ENCODINGS = [
|
|
68
68
|
// unicode
|
|
69
69
|
['utf-16be', 'utf-16be', 'utf-16be', 'utf-16be', 'utf-16be', 'utf-16be', 'utf-16be'],
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
// macintosh
|
|
72
72
|
// Mappings available at http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/
|
|
73
|
-
// 0
|
|
74
|
-
// 1
|
|
75
|
-
// 2
|
|
76
|
-
// 3
|
|
77
|
-
// 4
|
|
78
|
-
// 5
|
|
79
|
-
// 6
|
|
80
|
-
// 7
|
|
81
|
-
// 8
|
|
82
|
-
// 9
|
|
83
|
-
// 10
|
|
84
|
-
// 11
|
|
85
|
-
// 12
|
|
86
|
-
// 13
|
|
87
|
-
// 14
|
|
88
|
-
// 15
|
|
89
|
-
// 16
|
|
73
|
+
// 0 Roman 17 Malayalam
|
|
74
|
+
// 1 Japanese 18 Sinhalese
|
|
75
|
+
// 2 Traditional Chinese 19 Burmese
|
|
76
|
+
// 3 Korean 20 Khmer
|
|
77
|
+
// 4 Arabic 21 Thai
|
|
78
|
+
// 5 Hebrew 22 Laotian
|
|
79
|
+
// 6 Greek 23 Georgian
|
|
80
|
+
// 7 Russian 24 Armenian
|
|
81
|
+
// 8 RSymbol 25 Simplified Chinese
|
|
82
|
+
// 9 Devanagari 26 Tibetan
|
|
83
|
+
// 10 Gurmukhi 27 Mongolian
|
|
84
|
+
// 11 Gujarati 28 Geez
|
|
85
|
+
// 12 Oriya 29 Slavic
|
|
86
|
+
// 13 Bengali 30 Vietnamese
|
|
87
|
+
// 14 Tamil 31 Sindhi
|
|
88
|
+
// 15 Telugu 32 (Uninterpreted)
|
|
89
|
+
// 16 Kannada
|
|
90
90
|
['x-mac-roman', 'shift-jis', 'big5', 'euc-kr', 'iso-8859-6', 'iso-8859-8',
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
'x-mac-greek', 'x-mac-cyrillic', 'x-mac-symbol', 'x-mac-devanagari', 'x-mac-gurmukhi', 'x-mac-gujarati',
|
|
92
|
+
'Oriya', 'Bengali', 'Tamil', 'Telugu', 'Kannada', 'Malayalam', 'Sinhalese',
|
|
93
|
+
'Burmese', 'Khmer', 'iso-8859-11', 'Laotian', 'Georgian', 'Armenian', 'gbk',
|
|
94
|
+
'Tibetan', 'Mongolian', 'Geez', 'x-mac-ce', 'Vietnamese', 'Sindhi'],
|
|
95
|
+
|
|
96
96
|
// ISO (deprecated)
|
|
97
97
|
['ascii', null, 'iso-8859-1'],
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
// windows
|
|
100
100
|
// Docs here: http://msdn.microsoft.com/en-us/library/system.text.encoding(v=vs.110).aspx
|
|
101
101
|
['symbol', 'utf-16be', 'shift-jis', 'gb18030', 'big5', 'euc-kr', 'johab', null, null, null, 'utf-16be']
|
|
@@ -125,95 +125,95 @@ export const MAC_LANGUAGE_ENCODINGS = {
|
|
|
125
125
|
export const LANGUAGES = [
|
|
126
126
|
// unicode
|
|
127
127
|
[],
|
|
128
|
-
|
|
128
|
+
|
|
129
129
|
{ // macintosh
|
|
130
|
-
0: 'en',
|
|
131
|
-
1: 'fr',
|
|
132
|
-
2: 'de',
|
|
133
|
-
3: 'it',
|
|
134
|
-
4: 'nl',
|
|
135
|
-
5: 'sv',
|
|
136
|
-
6: 'es',
|
|
137
|
-
7: 'da',
|
|
138
|
-
8: 'pt',
|
|
139
|
-
9: 'no',
|
|
140
|
-
10: 'he',
|
|
141
|
-
11: 'ja',
|
|
142
|
-
12: 'ar',
|
|
143
|
-
13: 'fi',
|
|
144
|
-
14: 'el',
|
|
145
|
-
15: 'is',
|
|
146
|
-
16: 'mt',
|
|
147
|
-
17: 'tr',
|
|
148
|
-
18: 'hr',
|
|
149
|
-
19: 'zh-Hant',
|
|
150
|
-
20: 'ur',
|
|
151
|
-
21: 'hi',
|
|
152
|
-
22: 'th',
|
|
153
|
-
23: 'ko',
|
|
154
|
-
24: 'lt',
|
|
155
|
-
25: 'pl',
|
|
156
|
-
26: 'hu',
|
|
157
|
-
27: 'es',
|
|
158
|
-
28: 'lv',
|
|
159
|
-
29: 'se',
|
|
130
|
+
0: 'en', 30: 'fo', 60: 'ks', 90: 'rw',
|
|
131
|
+
1: 'fr', 31: 'fa', 61: 'ku', 91: 'rn',
|
|
132
|
+
2: 'de', 32: 'ru', 62: 'sd', 92: 'ny',
|
|
133
|
+
3: 'it', 33: 'zh', 63: 'bo', 93: 'mg',
|
|
134
|
+
4: 'nl', 34: 'nl-BE', 64: 'ne', 94: 'eo',
|
|
135
|
+
5: 'sv', 35: 'ga', 65: 'sa', 128: 'cy',
|
|
136
|
+
6: 'es', 36: 'sq', 66: 'mr', 129: 'eu',
|
|
137
|
+
7: 'da', 37: 'ro', 67: 'bn', 130: 'ca',
|
|
138
|
+
8: 'pt', 38: 'cz', 68: 'as', 131: 'la',
|
|
139
|
+
9: 'no', 39: 'sk', 69: 'gu', 132: 'qu',
|
|
140
|
+
10: 'he', 40: 'si', 70: 'pa', 133: 'gn',
|
|
141
|
+
11: 'ja', 41: 'yi', 71: 'or', 134: 'ay',
|
|
142
|
+
12: 'ar', 42: 'sr', 72: 'ml', 135: 'tt',
|
|
143
|
+
13: 'fi', 43: 'mk', 73: 'kn', 136: 'ug',
|
|
144
|
+
14: 'el', 44: 'bg', 74: 'ta', 137: 'dz',
|
|
145
|
+
15: 'is', 45: 'uk', 75: 'te', 138: 'jv',
|
|
146
|
+
16: 'mt', 46: 'be', 76: 'si', 139: 'su',
|
|
147
|
+
17: 'tr', 47: 'uz', 77: 'my', 140: 'gl',
|
|
148
|
+
18: 'hr', 48: 'kk', 78: 'km', 141: 'af',
|
|
149
|
+
19: 'zh-Hant', 49: 'az-Cyrl', 79: 'lo', 142: 'br',
|
|
150
|
+
20: 'ur', 50: 'az-Arab', 80: 'vi', 143: 'iu',
|
|
151
|
+
21: 'hi', 51: 'hy', 81: 'id', 144: 'gd',
|
|
152
|
+
22: 'th', 52: 'ka', 82: 'tl', 145: 'gv',
|
|
153
|
+
23: 'ko', 53: 'mo', 83: 'ms', 146: 'ga',
|
|
154
|
+
24: 'lt', 54: 'ky', 84: 'ms-Arab', 147: 'to',
|
|
155
|
+
25: 'pl', 55: 'tg', 85: 'am', 148: 'el-polyton',
|
|
156
|
+
26: 'hu', 56: 'tk', 86: 'ti', 149: 'kl',
|
|
157
|
+
27: 'es', 57: 'mn-CN', 87: 'om', 150: 'az',
|
|
158
|
+
28: 'lv', 58: 'mn', 88: 'so', 151: 'nn',
|
|
159
|
+
29: 'se', 59: 'ps', 89: 'sw'
|
|
160
160
|
},
|
|
161
|
-
|
|
161
|
+
|
|
162
162
|
// ISO (deprecated)
|
|
163
163
|
[],
|
|
164
|
-
|
|
165
|
-
{ // windows
|
|
166
|
-
0x0436: 'af',
|
|
167
|
-
0x041C: 'sq',
|
|
168
|
-
0x0484: 'gsw',
|
|
169
|
-
0x045E: 'am',
|
|
170
|
-
0x1401: 'ar-DZ',
|
|
171
|
-
0x3C01: 'ar-BH',
|
|
172
|
-
0x0C01: 'ar',
|
|
173
|
-
0x0801: 'ar-IQ',
|
|
174
|
-
0x2C01: 'ar-JO',
|
|
175
|
-
0x3401: 'ar-KW',
|
|
176
|
-
0x3001: 'ar-LB',
|
|
177
|
-
0x1001: 'ar-LY',
|
|
178
|
-
0x1801: 'ary',
|
|
179
|
-
0x2001: 'ar-OM',
|
|
180
|
-
0x4001: 'ar-QA',
|
|
181
|
-
0x0401: 'ar-SA',
|
|
182
|
-
0x2801: 'ar-SY',
|
|
183
|
-
0x1C01: 'aeb',
|
|
184
|
-
0x3801: 'ar-AE',
|
|
185
|
-
0x2401: 'ar-YE',
|
|
186
|
-
0x042B: 'hy',
|
|
187
|
-
0x044D: 'as',
|
|
188
|
-
0x082C: 'az-Cyrl',
|
|
189
|
-
0x042C: 'az',
|
|
190
|
-
0x046D: 'ba',
|
|
191
|
-
0x042D: 'eu',
|
|
192
|
-
0x0423: 'be',
|
|
193
|
-
0x0845: 'bn',
|
|
194
|
-
0x0445: 'bn-IN',
|
|
195
|
-
0x201A: 'bs-Cyrl',
|
|
196
|
-
0x141A: 'bs',
|
|
197
|
-
0x047E: 'br',
|
|
198
|
-
0x0402: 'bg',
|
|
199
|
-
0x0403: 'ca',
|
|
200
|
-
0x0C04: 'zh-HK',
|
|
201
|
-
0x1404: 'zh-MO',
|
|
202
|
-
0x0804: 'zh',
|
|
203
|
-
0x1004: 'zh-SG',
|
|
204
|
-
0x0404: 'zh-TW',
|
|
205
|
-
0x0483: 'co',
|
|
206
|
-
0x041A: 'hr',
|
|
207
|
-
0x101A: 'hr-BA',
|
|
208
|
-
0x0405: 'cs',
|
|
209
|
-
0x0406: 'da',
|
|
210
|
-
0x048C: 'prs',
|
|
211
|
-
0x0465: 'dv',
|
|
212
|
-
0x0813: 'nl-BE',
|
|
213
|
-
0x0413: 'nl',
|
|
214
|
-
0x0C09: 'en-AU',
|
|
215
|
-
0x2809: 'en-BZ',
|
|
216
|
-
0x1009: 'en-CA',
|
|
217
|
-
0x2409: 'en-029',
|
|
164
|
+
|
|
165
|
+
{ // windows
|
|
166
|
+
0x0436: 'af', 0x4009: 'en-IN', 0x0487: 'rw', 0x0432: 'tn',
|
|
167
|
+
0x041C: 'sq', 0x1809: 'en-IE', 0x0441: 'sw', 0x045B: 'si',
|
|
168
|
+
0x0484: 'gsw', 0x2009: 'en-JM', 0x0457: 'kok', 0x041B: 'sk',
|
|
169
|
+
0x045E: 'am', 0x4409: 'en-MY', 0x0412: 'ko', 0x0424: 'sl',
|
|
170
|
+
0x1401: 'ar-DZ', 0x1409: 'en-NZ', 0x0440: 'ky', 0x2C0A: 'es-AR',
|
|
171
|
+
0x3C01: 'ar-BH', 0x3409: 'en-PH', 0x0454: 'lo', 0x400A: 'es-BO',
|
|
172
|
+
0x0C01: 'ar', 0x4809: 'en-SG', 0x0426: 'lv', 0x340A: 'es-CL',
|
|
173
|
+
0x0801: 'ar-IQ', 0x1C09: 'en-ZA', 0x0427: 'lt', 0x240A: 'es-CO',
|
|
174
|
+
0x2C01: 'ar-JO', 0x2C09: 'en-TT', 0x082E: 'dsb', 0x140A: 'es-CR',
|
|
175
|
+
0x3401: 'ar-KW', 0x0809: 'en-GB', 0x046E: 'lb', 0x1C0A: 'es-DO',
|
|
176
|
+
0x3001: 'ar-LB', 0x0409: 'en', 0x042F: 'mk', 0x300A: 'es-EC',
|
|
177
|
+
0x1001: 'ar-LY', 0x3009: 'en-ZW', 0x083E: 'ms-BN', 0x440A: 'es-SV',
|
|
178
|
+
0x1801: 'ary', 0x0425: 'et', 0x043E: 'ms', 0x100A: 'es-GT',
|
|
179
|
+
0x2001: 'ar-OM', 0x0438: 'fo', 0x044C: 'ml', 0x480A: 'es-HN',
|
|
180
|
+
0x4001: 'ar-QA', 0x0464: 'fil', 0x043A: 'mt', 0x080A: 'es-MX',
|
|
181
|
+
0x0401: 'ar-SA', 0x040B: 'fi', 0x0481: 'mi', 0x4C0A: 'es-NI',
|
|
182
|
+
0x2801: 'ar-SY', 0x080C: 'fr-BE', 0x047A: 'arn', 0x180A: 'es-PA',
|
|
183
|
+
0x1C01: 'aeb', 0x0C0C: 'fr-CA', 0x044E: 'mr', 0x3C0A: 'es-PY',
|
|
184
|
+
0x3801: 'ar-AE', 0x040C: 'fr', 0x047C: 'moh', 0x280A: 'es-PE',
|
|
185
|
+
0x2401: 'ar-YE', 0x140C: 'fr-LU', 0x0450: 'mn', 0x500A: 'es-PR',
|
|
186
|
+
0x042B: 'hy', 0x180C: 'fr-MC', 0x0850: 'mn-CN', 0x0C0A: 'es',
|
|
187
|
+
0x044D: 'as', 0x100C: 'fr-CH', 0x0461: 'ne', 0x040A: 'es',
|
|
188
|
+
0x082C: 'az-Cyrl', 0x0462: 'fy', 0x0414: 'nb', 0x540A: 'es-US',
|
|
189
|
+
0x042C: 'az', 0x0456: 'gl', 0x0814: 'nn', 0x380A: 'es-UY',
|
|
190
|
+
0x046D: 'ba', 0x0437: 'ka', 0x0482: 'oc', 0x200A: 'es-VE',
|
|
191
|
+
0x042D: 'eu', 0x0C07: 'de-AT', 0x0448: 'or', 0x081D: 'sv-FI',
|
|
192
|
+
0x0423: 'be', 0x0407: 'de', 0x0463: 'ps', 0x041D: 'sv',
|
|
193
|
+
0x0845: 'bn', 0x1407: 'de-LI', 0x0415: 'pl', 0x045A: 'syr',
|
|
194
|
+
0x0445: 'bn-IN', 0x1007: 'de-LU', 0x0416: 'pt', 0x0428: 'tg',
|
|
195
|
+
0x201A: 'bs-Cyrl', 0x0807: 'de-CH', 0x0816: 'pt-PT', 0x085F: 'tzm',
|
|
196
|
+
0x141A: 'bs', 0x0408: 'el', 0x0446: 'pa', 0x0449: 'ta',
|
|
197
|
+
0x047E: 'br', 0x046F: 'kl', 0x046B: 'qu-BO', 0x0444: 'tt',
|
|
198
|
+
0x0402: 'bg', 0x0447: 'gu', 0x086B: 'qu-EC', 0x044A: 'te',
|
|
199
|
+
0x0403: 'ca', 0x0468: 'ha', 0x0C6B: 'qu', 0x041E: 'th',
|
|
200
|
+
0x0C04: 'zh-HK', 0x040D: 'he', 0x0418: 'ro', 0x0451: 'bo',
|
|
201
|
+
0x1404: 'zh-MO', 0x0439: 'hi', 0x0417: 'rm', 0x041F: 'tr',
|
|
202
|
+
0x0804: 'zh', 0x040E: 'hu', 0x0419: 'ru', 0x0442: 'tk',
|
|
203
|
+
0x1004: 'zh-SG', 0x040F: 'is', 0x243B: 'smn', 0x0480: 'ug',
|
|
204
|
+
0x0404: 'zh-TW', 0x0470: 'ig', 0x103B: 'smj-NO', 0x0422: 'uk',
|
|
205
|
+
0x0483: 'co', 0x0421: 'id', 0x143B: 'smj', 0x042E: 'hsb',
|
|
206
|
+
0x041A: 'hr', 0x045D: 'iu', 0x0C3B: 'se-FI', 0x0420: 'ur',
|
|
207
|
+
0x101A: 'hr-BA', 0x085D: 'iu-Latn', 0x043B: 'se', 0x0843: 'uz-Cyrl',
|
|
208
|
+
0x0405: 'cs', 0x083C: 'ga', 0x083B: 'se-SE', 0x0443: 'uz',
|
|
209
|
+
0x0406: 'da', 0x0434: 'xh', 0x203B: 'sms', 0x042A: 'vi',
|
|
210
|
+
0x048C: 'prs', 0x0435: 'zu', 0x183B: 'sma-NO', 0x0452: 'cy',
|
|
211
|
+
0x0465: 'dv', 0x0410: 'it', 0x1C3B: 'sms', 0x0488: 'wo',
|
|
212
|
+
0x0813: 'nl-BE', 0x0810: 'it-CH', 0x044F: 'sa', 0x0485: 'sah',
|
|
213
|
+
0x0413: 'nl', 0x0411: 'ja', 0x1C1A: 'sr-Cyrl-BA', 0x0478: 'ii',
|
|
214
|
+
0x0C09: 'en-AU', 0x044B: 'kn', 0x0C1A: 'sr', 0x046A: 'yo',
|
|
215
|
+
0x2809: 'en-BZ', 0x043F: 'kk', 0x181A: 'sr-Latn-BA',
|
|
216
|
+
0x1009: 'en-CA', 0x0453: 'km', 0x081A: 'sr-Latn',
|
|
217
|
+
0x2409: 'en-029', 0x0486: 'quc', 0x046C: 'nso'
|
|
218
218
|
}
|
|
219
219
|
];
|
package/src/glyph/CFFGlyph.js
CHANGED
|
@@ -33,7 +33,7 @@ export default class CFFGlyph extends Glyph {
|
|
|
33
33
|
let end = str.offset + str.length;
|
|
34
34
|
stream.pos = str.offset;
|
|
35
35
|
|
|
36
|
-
let path = new Path;
|
|
36
|
+
let path = new Path();
|
|
37
37
|
let stack = [];
|
|
38
38
|
let trans = [];
|
|
39
39
|
|
|
@@ -104,8 +104,8 @@ export default class CFFGlyph extends Glyph {
|
|
|
104
104
|
let pts;
|
|
105
105
|
|
|
106
106
|
switch (op) {
|
|
107
|
-
case 1:
|
|
108
|
-
case 3:
|
|
107
|
+
case 1: // hstem
|
|
108
|
+
case 3: // vstem
|
|
109
109
|
case 18: // hstemhm
|
|
110
110
|
case 23: // vstemhm
|
|
111
111
|
parseStems();
|
|
@@ -609,7 +609,6 @@ export default class CFFGlyph extends Glyph {
|
|
|
609
609
|
default:
|
|
610
610
|
throw new Error(`Unknown op: ${op}`);
|
|
611
611
|
}
|
|
612
|
-
|
|
613
612
|
} else if (op < 247) {
|
|
614
613
|
stack.push(op - 139);
|
|
615
614
|
} else if (op < 251) {
|
package/src/glyph/COLRGlyph.js
CHANGED
|
@@ -23,7 +23,7 @@ export default class COLRGlyph extends Glyph {
|
|
|
23
23
|
return g ? g.bbox : new BBox(0, 0, 0, 0);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
let bbox = new BBox;
|
|
26
|
+
let bbox = new BBox();
|
|
27
27
|
for (let i = 0; i < layers.length; i++) {
|
|
28
28
|
let layer = layers[i];
|
|
29
29
|
let b = layer.glyph.bbox;
|
|
@@ -98,7 +98,7 @@ export default class COLRGlyph extends Glyph {
|
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
for (let {glyph, color} of layers) {
|
|
101
|
+
for (let { glyph, color } of layers) {
|
|
102
102
|
ctx.fillColor([color.red, color.green, color.blue], color.alpha / 255 * 100);
|
|
103
103
|
glyph.render(ctx, size);
|
|
104
104
|
}
|
package/src/glyph/Glyph.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cache } from '../decorators';
|
|
2
2
|
import Path from './Path';
|
|
3
|
-
import {isMark} from '../packages/unicode-properties/index.js';
|
|
3
|
+
import { isMark } from '../packages/unicode-properties/index.js';
|
|
4
4
|
import StandardNames from './StandardNames';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -63,12 +63,12 @@ export default class Glyph {
|
|
|
63
63
|
if (this._metrics) { return this._metrics; }
|
|
64
64
|
if (cbox == null) { ({ cbox } = this); }
|
|
65
65
|
|
|
66
|
-
let {advance: advanceWidth, bearing: leftBearing} = this._getTableMetrics(this._font.hmtx);
|
|
66
|
+
let { advance: advanceWidth, bearing: leftBearing } = this._getTableMetrics(this._font.hmtx);
|
|
67
67
|
|
|
68
68
|
// Vertical metrics: vmtx, else font ascent/descent (respects useTypoMetrics)
|
|
69
69
|
let advanceHeight, topBearing;
|
|
70
70
|
if (this._font.vmtx) {
|
|
71
|
-
({advance: advanceHeight, bearing: topBearing} = this._getTableMetrics(this._font.vmtx));
|
|
71
|
+
({ advance: advanceHeight, bearing: topBearing } = this._getTableMetrics(this._font.vmtx));
|
|
72
72
|
} else {
|
|
73
73
|
advanceHeight = Math.abs(this._font.ascent - this._font.descent);
|
|
74
74
|
topBearing = this._font.ascent - cbox.maxY;
|
|
@@ -78,7 +78,7 @@ export default class Glyph {
|
|
|
78
78
|
advanceWidth += this._font._variationProcessor.getAdvanceAdjustment(this.id, this._font.HVAR);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
let {width, height} = cbox;
|
|
81
|
+
let { width, height } = cbox;
|
|
82
82
|
return this._metrics = {
|
|
83
83
|
width,
|
|
84
84
|
height,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
const TUPLES_SHARE_POINT_NUMBERS = 0x8000;
|
|
2
|
-
const TUPLE_COUNT_MASK
|
|
3
|
-
const EMBEDDED_TUPLE_COORD
|
|
4
|
-
const INTERMEDIATE_TUPLE
|
|
5
|
-
const PRIVATE_POINT_NUMBERS
|
|
6
|
-
const TUPLE_INDEX_MASK
|
|
7
|
-
const POINTS_ARE_WORDS
|
|
8
|
-
const POINT_RUN_COUNT_MASK
|
|
9
|
-
const DELTAS_ARE_ZERO
|
|
10
|
-
const DELTAS_ARE_WORDS
|
|
11
|
-
const DELTA_RUN_COUNT_MASK
|
|
2
|
+
const TUPLE_COUNT_MASK = 0x0fff;
|
|
3
|
+
const EMBEDDED_TUPLE_COORD = 0x8000;
|
|
4
|
+
const INTERMEDIATE_TUPLE = 0x4000;
|
|
5
|
+
const PRIVATE_POINT_NUMBERS = 0x2000;
|
|
6
|
+
const TUPLE_INDEX_MASK = 0x0fff;
|
|
7
|
+
const POINTS_ARE_WORDS = 0x80;
|
|
8
|
+
const POINT_RUN_COUNT_MASK = 0x7f;
|
|
9
|
+
const DELTAS_ARE_ZERO = 0x80;
|
|
10
|
+
const DELTAS_ARE_WORDS = 0x40;
|
|
11
|
+
const DELTA_RUN_COUNT_MASK = 0x3f;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* This class is transforms TrueType glyphs according to the data from
|
|
@@ -25,7 +25,7 @@ export default class GlyphVariationProcessor {
|
|
|
25
25
|
constructor(font, coords) {
|
|
26
26
|
this.font = font;
|
|
27
27
|
this.normalizedCoords = this.normalizeCoords(coords);
|
|
28
|
-
this.blendVectors = new Map;
|
|
28
|
+
this.blendVectors = new Map();
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
normalizeCoords(coords) {
|
|
@@ -50,9 +50,9 @@ export default class GlyphVariationProcessor {
|
|
|
50
50
|
let pair = segment.correspondence[j];
|
|
51
51
|
if (j >= 1 && normalized[i] < pair.fromCoord) {
|
|
52
52
|
let prev = segment.correspondence[j - 1];
|
|
53
|
-
normalized[i] = ((normalized[i] - prev.fromCoord) * (pair.toCoord - prev.toCoord) + Number.EPSILON)
|
|
54
|
-
(pair.fromCoord - prev.fromCoord + Number.EPSILON)
|
|
55
|
-
prev.toCoord;
|
|
53
|
+
normalized[i] = ((normalized[i] - prev.fromCoord) * (pair.toCoord - prev.toCoord) + Number.EPSILON)
|
|
54
|
+
/ (pair.fromCoord - prev.fromCoord + Number.EPSILON)
|
|
55
|
+
+ prev.toCoord;
|
|
56
56
|
|
|
57
57
|
break;
|
|
58
58
|
}
|
|
@@ -103,7 +103,6 @@ export default class GlyphVariationProcessor {
|
|
|
103
103
|
for (let a = 0; a < gvar.axisCount; a++) {
|
|
104
104
|
tupleCoords.push(stream.readInt16BE() / 16384);
|
|
105
105
|
}
|
|
106
|
-
|
|
107
106
|
} else {
|
|
108
107
|
if ((tupleIndex & TUPLE_INDEX_MASK) >= gvar.globalCoordCount) {
|
|
109
108
|
throw new Error('Invalid gvar table');
|
|
@@ -219,7 +218,6 @@ export default class GlyphVariationProcessor {
|
|
|
219
218
|
|
|
220
219
|
if (run & DELTAS_ARE_ZERO) {
|
|
221
220
|
i += runCount;
|
|
222
|
-
|
|
223
221
|
} else {
|
|
224
222
|
let fn = run & DELTAS_ARE_WORDS ? stream.readInt16BE : stream.readInt8;
|
|
225
223
|
for (let j = 0; j < runCount && i < count; j++) {
|
|
@@ -246,20 +244,18 @@ export default class GlyphVariationProcessor {
|
|
|
246
244
|
}
|
|
247
245
|
|
|
248
246
|
if ((tupleIndex & INTERMEDIATE_TUPLE) === 0) {
|
|
249
|
-
if ((normalized[i] < Math.min(0, tupleCoords[i]))
|
|
250
|
-
|
|
247
|
+
if ((normalized[i] < Math.min(0, tupleCoords[i]))
|
|
248
|
+
|| (normalized[i] > Math.max(0, tupleCoords[i]))) {
|
|
251
249
|
return 0;
|
|
252
250
|
}
|
|
253
251
|
|
|
254
252
|
factor = (factor * normalized[i] + Number.EPSILON) / (tupleCoords[i] + Number.EPSILON);
|
|
255
253
|
} else {
|
|
256
|
-
if ((normalized[i] < startCoords[i])
|
|
257
|
-
|
|
254
|
+
if ((normalized[i] < startCoords[i])
|
|
255
|
+
|| (normalized[i] > endCoords[i])) {
|
|
258
256
|
return 0;
|
|
259
|
-
|
|
260
257
|
} else if (normalized[i] < tupleCoords[i]) {
|
|
261
258
|
factor = factor * (normalized[i] - startCoords[i] + Number.EPSILON) / (tupleCoords[i] - startCoords[i] + Number.EPSILON);
|
|
262
|
-
|
|
263
259
|
} else {
|
|
264
260
|
factor = factor * (endCoords[i] - normalized[i] + Number.EPSILON) / (endCoords[i] - tupleCoords[i] + Number.EPSILON);
|
|
265
261
|
}
|
|
@@ -393,7 +389,7 @@ export default class GlyphVariationProcessor {
|
|
|
393
389
|
idx = table.advanceWidthMapping.mapCount - 1;
|
|
394
390
|
}
|
|
395
391
|
|
|
396
|
-
({outerIndex, innerIndex} = table.advanceWidthMapping.mapData[idx]);
|
|
392
|
+
({ outerIndex, innerIndex } = table.advanceWidthMapping.mapData[idx]);
|
|
397
393
|
} else {
|
|
398
394
|
outerIndex = 0;
|
|
399
395
|
innerIndex = gid;
|
|
@@ -449,7 +445,6 @@ export default class GlyphVariationProcessor {
|
|
|
449
445
|
// ignore invalid ranges
|
|
450
446
|
if (axis.startCoord > axis.peakCoord || axis.peakCoord > axis.endCoord) {
|
|
451
447
|
axisScalar = 1;
|
|
452
|
-
|
|
453
448
|
} else if (axis.startCoord < 0 && axis.endCoord > 0 && axis.peakCoord !== 0) {
|
|
454
449
|
axisScalar = 1;
|
|
455
450
|
|
|
@@ -466,11 +461,11 @@ export default class GlyphVariationProcessor {
|
|
|
466
461
|
if (normalizedCoords[j] === axis.peakCoord) {
|
|
467
462
|
axisScalar = 1;
|
|
468
463
|
} else if (normalizedCoords[j] < axis.peakCoord) {
|
|
469
|
-
axisScalar = (normalizedCoords[j] - axis.startCoord + Number.EPSILON)
|
|
470
|
-
(axis.peakCoord - axis.startCoord + Number.EPSILON);
|
|
464
|
+
axisScalar = (normalizedCoords[j] - axis.startCoord + Number.EPSILON)
|
|
465
|
+
/ (axis.peakCoord - axis.startCoord + Number.EPSILON);
|
|
471
466
|
} else {
|
|
472
|
-
axisScalar = (axis.endCoord - normalizedCoords[j] + Number.EPSILON)
|
|
473
|
-
(axis.endCoord - axis.peakCoord + Number.EPSILON);
|
|
467
|
+
axisScalar = (axis.endCoord - normalizedCoords[j] + Number.EPSILON)
|
|
468
|
+
/ (axis.endCoord - axis.peakCoord + Number.EPSILON);
|
|
474
469
|
}
|
|
475
470
|
}
|
|
476
471
|
|
package/src/glyph/Path.js
CHANGED
|
@@ -27,10 +27,10 @@ export default class Path {
|
|
|
27
27
|
* @return {string}
|
|
28
28
|
*/
|
|
29
29
|
toFunction() {
|
|
30
|
-
return ctx => {
|
|
31
|
-
this.commands.forEach(c => {
|
|
32
|
-
return ctx[c.command].apply(ctx, c.args)
|
|
33
|
-
})
|
|
30
|
+
return (ctx) => {
|
|
31
|
+
this.commands.forEach((c) => {
|
|
32
|
+
return ctx[c.command].apply(ctx, c.args);
|
|
33
|
+
});
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -39,7 +39,7 @@ export default class Path {
|
|
|
39
39
|
* @return {string}
|
|
40
40
|
*/
|
|
41
41
|
toSVG() {
|
|
42
|
-
let cmds = this.commands.map(c => {
|
|
42
|
+
let cmds = this.commands.map((c) => {
|
|
43
43
|
let args = c.args.map(arg => Math.round(arg * 100) / 100);
|
|
44
44
|
return `${SVG_COMMANDS[c.command]}${args.join(' ')}`;
|
|
45
45
|
});
|
|
@@ -59,7 +59,7 @@ export default class Path {
|
|
|
59
59
|
if (this.commands.length === 0) {
|
|
60
60
|
this._cbox = Object.freeze(new BBox(0, 0, 0, 0));
|
|
61
61
|
} else {
|
|
62
|
-
let cbox = new BBox;
|
|
62
|
+
let cbox = new BBox();
|
|
63
63
|
for (let command of this.commands) {
|
|
64
64
|
for (let i = 0; i < command.args.length; i += 2) {
|
|
65
65
|
cbox.addPoint(command.args[i], command.args[i + 1]);
|
|
@@ -87,7 +87,7 @@ export default class Path {
|
|
|
87
87
|
return this._bbox = Object.freeze(new BBox(0, 0, 0, 0));
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
let bbox = new BBox;
|
|
90
|
+
let bbox = new BBox();
|
|
91
91
|
let cx = 0, cy = 0;
|
|
92
92
|
|
|
93
93
|
for (let c of this.commands) {
|
|
@@ -109,9 +109,9 @@ export default class Path {
|
|
|
109
109
|
let [qp1x, qp1y, qp3x, qp3y] = c.args;
|
|
110
110
|
p3x = qp3x;
|
|
111
111
|
p3y = qp3y;
|
|
112
|
-
cp1x = cx + 2 / 3 * (qp1x - cx);
|
|
112
|
+
cp1x = cx + 2 / 3 * (qp1x - cx); // CP1 = QP0 + 2/3 * (QP1-QP0)
|
|
113
113
|
cp1y = cy + 2 / 3 * (qp1y - cy);
|
|
114
|
-
cp2x = p3x + 2 / 3 * (qp1x - p3x);
|
|
114
|
+
cp2x = p3x + 2 / 3 * (qp1x - p3x); // CP2 = QP2 + 2/3 * (QP1-QP2)
|
|
115
115
|
cp2y = p3y + 2 / 3 * (qp1y - p3y);
|
|
116
116
|
} else {
|
|
117
117
|
[cp1x, cp1y, cp2x, cp2y, p3x, p3y] = c.args;
|
|
@@ -127,9 +127,9 @@ export default class Path {
|
|
|
127
127
|
|
|
128
128
|
let f = (t, i) => (
|
|
129
129
|
Math.pow(1 - t, 3) * p0[i]
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
+ 3 * Math.pow(1 - t, 2) * t * p1[i]
|
|
131
|
+
+ 3 * (1 - t) * Math.pow(t, 2) * p2[i]
|
|
132
|
+
+ Math.pow(t, 3) * p3[i]
|
|
133
133
|
);
|
|
134
134
|
|
|
135
135
|
for (let i = 0; i <= 1; i++) {
|
|
@@ -194,7 +194,7 @@ export default class Path {
|
|
|
194
194
|
* @return {Path}
|
|
195
195
|
*/
|
|
196
196
|
mapPoints(fn) {
|
|
197
|
-
let path = new Path;
|
|
197
|
+
let path = new Path();
|
|
198
198
|
|
|
199
199
|
for (let c of this.commands) {
|
|
200
200
|
let args = [];
|
|
@@ -245,7 +245,7 @@ export default class Path {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
for (let command of ['moveTo', 'lineTo', 'quadraticCurveTo', 'bezierCurveTo', 'closePath']) {
|
|
248
|
-
Path.prototype[command] = function(...args) {
|
|
248
|
+
Path.prototype[command] = function (...args) {
|
|
249
249
|
this._bbox = this._cbox = null;
|
|
250
250
|
this.commands.push({
|
|
251
251
|
command,
|
package/src/glyph/SBIXGlyph.js
CHANGED
|
@@ -37,14 +37,14 @@ export default class SBIXGlyph extends TTFGlyph {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
this._font.stream.pos = start;
|
|
40
|
-
return SBIXImage.decode(this._font.stream, {buflen: end - start});
|
|
40
|
+
return SBIXImage.decode(this._font.stream, { buflen: end - start });
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
render(ctx, size) {
|
|
44
44
|
let img = this.getImageForSize(size);
|
|
45
45
|
if (img != null) {
|
|
46
46
|
let scale = size / this._font.unitsPerEm;
|
|
47
|
-
ctx.image(img.data, {height: size, x: img.originX, y: (this.bbox.minY - img.originY) * scale});
|
|
47
|
+
ctx.image(img.data, { height: size, x: img.originX, y: (this.bbox.minY - img.originY) * scale });
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
if (this._font.sbix.flags.renderOutlines) {
|