@cantoo/fontkit 2.0.4
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/LICENSE +21 -0
- package/README.md +274 -0
- package/dist/browser-module.mjs +13660 -0
- package/dist/browser-module.mjs.map +1 -0
- package/dist/browser.cjs +13689 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/main.cjs +13712 -0
- package/dist/main.cjs.map +1 -0
- package/dist/module.mjs +13673 -0
- package/dist/module.mjs.map +1 -0
- package/package.json +99 -0
- package/src/CmapProcessor.js +285 -0
- package/src/DFont.js +113 -0
- package/src/TTFFont.js +621 -0
- package/src/TrueTypeCollection.js +65 -0
- package/src/WOFF2Font.js +222 -0
- package/src/WOFFFont.js +56 -0
- package/src/aat/AATFeatureMap.js +545 -0
- package/src/aat/AATLayoutEngine.js +48 -0
- package/src/aat/AATLookupTable.js +125 -0
- package/src/aat/AATMorxProcessor.js +429 -0
- package/src/aat/AATStateMachine.js +96 -0
- package/src/base.js +29 -0
- package/src/cff/CFFCharsets.js +99 -0
- package/src/cff/CFFDict.js +166 -0
- package/src/cff/CFFEncodings.js +48 -0
- package/src/cff/CFFFont.js +158 -0
- package/src/cff/CFFIndex.js +150 -0
- package/src/cff/CFFOperand.js +135 -0
- package/src/cff/CFFPointer.js +50 -0
- package/src/cff/CFFPrivateDict.js +39 -0
- package/src/cff/CFFStandardStrings.js +71 -0
- package/src/cff/CFFTop.js +236 -0
- package/src/decorators.js +36 -0
- package/src/encodings.js +219 -0
- package/src/fs.js +12 -0
- package/src/glyph/BBox.js +72 -0
- package/src/glyph/CBDTGlyph.js +9 -0
- package/src/glyph/CFFGlyph.js +635 -0
- package/src/glyph/COLRGlyph.js +108 -0
- package/src/glyph/Glyph.js +270 -0
- package/src/glyph/GlyphVariationProcessor.js +487 -0
- package/src/glyph/Path.js +257 -0
- package/src/glyph/SBIXGlyph.js +54 -0
- package/src/glyph/StandardNames.js +27 -0
- package/src/glyph/TTFGlyph.js +408 -0
- package/src/glyph/TTFGlyphEncoder.js +158 -0
- package/src/glyph/WOFF2Glyph.js +70 -0
- package/src/index.js +15 -0
- package/src/layout/GlyphPosition.js +30 -0
- package/src/layout/GlyphRun.js +108 -0
- package/src/layout/KernProcessor.js +97 -0
- package/src/layout/LayoutEngine.js +190 -0
- package/src/layout/Script.js +231 -0
- package/src/layout/UnicodeLayoutEngine.js +250 -0
- package/src/node.js +16 -0
- package/src/opentype/GPOSProcessor.js +311 -0
- package/src/opentype/GSUBProcessor.js +208 -0
- package/src/opentype/GlyphInfo.js +57 -0
- package/src/opentype/GlyphIterator.js +82 -0
- package/src/opentype/OTLayoutEngine.js +117 -0
- package/src/opentype/OTProcessor.js +472 -0
- package/src/opentype/ShapingPlan.js +121 -0
- package/src/opentype/shapers/ArabicShaper.js +124 -0
- package/src/opentype/shapers/DefaultShaper.js +116 -0
- package/src/opentype/shapers/HangulShaper.js +285 -0
- package/src/opentype/shapers/HebrewShaper.js +105 -0
- package/src/opentype/shapers/IndicShaper.js +914 -0
- package/src/opentype/shapers/ThaiShaper.js +238 -0
- package/src/opentype/shapers/UniversalShaper.js +186 -0
- package/src/opentype/shapers/data.trie +0 -0
- package/src/opentype/shapers/gen-indic.js +208 -0
- package/src/opentype/shapers/gen-use.js +287 -0
- package/src/opentype/shapers/generate-data.js +33 -0
- package/src/opentype/shapers/index.js +109 -0
- package/src/opentype/shapers/indic-data.js +175 -0
- package/src/opentype/shapers/indic.json +1 -0
- package/src/opentype/shapers/indic.machine +31 -0
- package/src/opentype/shapers/indic.trie +0 -0
- package/src/opentype/shapers/use.json +1 -0
- package/src/opentype/shapers/use.machine +44 -0
- package/src/opentype/shapers/use.trie +0 -0
- package/src/packages/unicode-properties/LICENSE +8 -0
- package/src/packages/unicode-properties/README.md +12 -0
- package/src/packages/unicode-properties/data-trie.js +1 -0
- package/src/packages/unicode-properties/data.js +1 -0
- package/src/packages/unicode-properties/data.json +1 -0
- package/src/packages/unicode-properties/data.trie +0 -0
- package/src/packages/unicode-properties/dist/index.cjs +257 -0
- package/src/packages/unicode-properties/dist/index.cjs.map +7 -0
- package/src/packages/unicode-properties/dist/index.mjs +234 -0
- package/src/packages/unicode-properties/dist/index.mjs.map +7 -0
- package/src/packages/unicode-properties/generate.js +107 -0
- package/src/packages/unicode-properties/index.js +184 -0
- package/src/packages/unicode-properties/package.json +50 -0
- package/src/packages/unicode-trie/LICENSE +8 -0
- package/src/packages/unicode-trie/README.md +13 -0
- package/src/packages/unicode-trie/builder.js +965 -0
- package/src/packages/unicode-trie/dist/builder.cjs +711 -0
- package/src/packages/unicode-trie/dist/builder.cjs.map +7 -0
- package/src/packages/unicode-trie/dist/builder.mjs +690 -0
- package/src/packages/unicode-trie/dist/builder.mjs.map +7 -0
- package/src/packages/unicode-trie/dist/index.cjs +112 -0
- package/src/packages/unicode-trie/dist/index.cjs.map +7 -0
- package/src/packages/unicode-trie/dist/index.mjs +91 -0
- package/src/packages/unicode-trie/dist/index.mjs.map +7 -0
- package/src/packages/unicode-trie/index.js +135 -0
- package/src/packages/unicode-trie/package.json +49 -0
- package/src/packages/unicode-trie/swap.js +21 -0
- package/src/subset/CFFSubset.js +176 -0
- package/src/subset/Subset.js +63 -0
- package/src/subset/TTFSubset.js +130 -0
- package/src/tables/BASE.js +78 -0
- package/src/tables/COLR.js +25 -0
- package/src/tables/CPAL.js +24 -0
- package/src/tables/DSIG.js +21 -0
- package/src/tables/EBDT.js +91 -0
- package/src/tables/EBLC.js +80 -0
- package/src/tables/GDEF.js +57 -0
- package/src/tables/GPOS.js +209 -0
- package/src/tables/GSUB.js +85 -0
- package/src/tables/HVAR.js +44 -0
- package/src/tables/JSTF.js +43 -0
- package/src/tables/LTSH.js +10 -0
- package/src/tables/OS2.js +84 -0
- package/src/tables/PCLT.js +21 -0
- package/src/tables/STAT.js +99 -0
- package/src/tables/VDMX.js +33 -0
- package/src/tables/VORG.js +14 -0
- package/src/tables/WOFF2Directory.js +73 -0
- package/src/tables/WOFFDirectory.js +37 -0
- package/src/tables/aat.js +157 -0
- package/src/tables/avar.js +19 -0
- package/src/tables/bsln.js +31 -0
- package/src/tables/cmap.js +127 -0
- package/src/tables/cvt.js +6 -0
- package/src/tables/directory.js +58 -0
- package/src/tables/feat.js +28 -0
- package/src/tables/fpgm.js +8 -0
- package/src/tables/fvar.js +31 -0
- package/src/tables/gasp.js +15 -0
- package/src/tables/glyf.js +4 -0
- package/src/tables/gvar.js +27 -0
- package/src/tables/hdmx.js +15 -0
- package/src/tables/head.js +25 -0
- package/src/tables/hhea.js +19 -0
- package/src/tables/hmtx.js +11 -0
- package/src/tables/index.js +119 -0
- package/src/tables/just.js +81 -0
- package/src/tables/kern.js +91 -0
- package/src/tables/loca.js +30 -0
- package/src/tables/maxp.js +20 -0
- package/src/tables/morx.js +79 -0
- package/src/tables/name.js +157 -0
- package/src/tables/opbd.js +15 -0
- package/src/tables/opentype.js +217 -0
- package/src/tables/post.js +34 -0
- package/src/tables/prep.js +6 -0
- package/src/tables/sbix.js +17 -0
- package/src/tables/variations.js +80 -0
- package/src/tables/vhea.js +19 -0
- package/src/tables/vmtx.js +12 -0
- package/src/utils.js +62 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as r from 'restructure';
|
|
2
|
+
|
|
3
|
+
export default class CFFPointer extends r.Pointer {
|
|
4
|
+
constructor(type, options = {}) {
|
|
5
|
+
if (options.type == null) {
|
|
6
|
+
options.type = 'global';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
super(null, type, options);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
decode(stream, parent, operands) {
|
|
13
|
+
this.offsetType = {
|
|
14
|
+
decode: () => operands[0]
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return super.decode(stream, parent, operands);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
encode(stream, value, ctx) {
|
|
21
|
+
if (!stream) {
|
|
22
|
+
// compute the size (so ctx.pointerSize is correct)
|
|
23
|
+
this.offsetType = {
|
|
24
|
+
size: () => 0
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
this.size(value, ctx);
|
|
28
|
+
return [new Ptr(0)];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let ptr = null;
|
|
32
|
+
this.offsetType = {
|
|
33
|
+
encode: (stream, val) => ptr = val
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
super.encode(stream, value, ctx);
|
|
37
|
+
return [new Ptr(ptr)];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
class Ptr {
|
|
42
|
+
constructor(val) {
|
|
43
|
+
this.val = val;
|
|
44
|
+
this.forceLarge = true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
valueOf() {
|
|
48
|
+
return this.val;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import CFFDict from './CFFDict';
|
|
2
|
+
import CFFIndex from './CFFIndex';
|
|
3
|
+
import CFFPointer from './CFFPointer';
|
|
4
|
+
|
|
5
|
+
class CFFBlendOp {
|
|
6
|
+
static decode(stream, parent, operands) {
|
|
7
|
+
let numBlends = operands.pop();
|
|
8
|
+
|
|
9
|
+
// TODO: actually blend. For now just consume the deltas
|
|
10
|
+
// since we don't use any of the values anyway.
|
|
11
|
+
while (operands.length > numBlends) {
|
|
12
|
+
operands.pop();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default new CFFDict([
|
|
18
|
+
// key name type default
|
|
19
|
+
[6, 'BlueValues', 'delta', null],
|
|
20
|
+
[7, 'OtherBlues', 'delta', null],
|
|
21
|
+
[8, 'FamilyBlues', 'delta', null],
|
|
22
|
+
[9, 'FamilyOtherBlues', 'delta', null],
|
|
23
|
+
[[12, 9], 'BlueScale', 'number', 0.039625],
|
|
24
|
+
[[12, 10], 'BlueShift', 'number', 7],
|
|
25
|
+
[[12, 11], 'BlueFuzz', 'number', 1],
|
|
26
|
+
[10, 'StdHW', 'number', null],
|
|
27
|
+
[11, 'StdVW', 'number', null],
|
|
28
|
+
[[12, 12], 'StemSnapH', 'delta', null],
|
|
29
|
+
[[12, 13], 'StemSnapV', 'delta', null],
|
|
30
|
+
[[12, 14], 'ForceBold', 'boolean', false],
|
|
31
|
+
[[12, 17], 'LanguageGroup', 'number', 0],
|
|
32
|
+
[[12, 18], 'ExpansionFactor', 'number', 0.06],
|
|
33
|
+
[[12, 19], 'initialRandomSeed', 'number', 0],
|
|
34
|
+
[20, 'defaultWidthX', 'number', 0],
|
|
35
|
+
[21, 'nominalWidthX', 'number', 0],
|
|
36
|
+
[22, 'vsindex', 'number', 0],
|
|
37
|
+
[23, 'blend', CFFBlendOp, null],
|
|
38
|
+
[19, 'Subrs', new CFFPointer(new CFFIndex, {type: 'local'}), null]
|
|
39
|
+
]);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Automatically generated from Appendix A of the CFF specification; do
|
|
2
|
+
// not edit. Length should be 391.
|
|
3
|
+
export default [
|
|
4
|
+
".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar",
|
|
5
|
+
"percent", "ampersand", "quoteright", "parenleft", "parenright",
|
|
6
|
+
"asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one",
|
|
7
|
+
"two", "three", "four", "five", "six", "seven", "eight", "nine", "colon",
|
|
8
|
+
"semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C",
|
|
9
|
+
"D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
|
|
10
|
+
"S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash",
|
|
11
|
+
"bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c",
|
|
12
|
+
"d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r",
|
|
13
|
+
"s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright",
|
|
14
|
+
"asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen",
|
|
15
|
+
"florin", "section", "currency", "quotesingle", "quotedblleft",
|
|
16
|
+
"guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash",
|
|
17
|
+
"dagger", "daggerdbl", "periodcentered", "paragraph", "bullet",
|
|
18
|
+
"quotesinglbase", "quotedblbase", "quotedblright", "guillemotright",
|
|
19
|
+
"ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex",
|
|
20
|
+
"tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla",
|
|
21
|
+
"hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash",
|
|
22
|
+
"Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe",
|
|
23
|
+
"germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth",
|
|
24
|
+
"onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar",
|
|
25
|
+
"degree", "thorn", "threequarters", "twosuperior", "registered", "minus",
|
|
26
|
+
"eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex",
|
|
27
|
+
"Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute",
|
|
28
|
+
"Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis",
|
|
29
|
+
"Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve",
|
|
30
|
+
"Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave",
|
|
31
|
+
"Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis",
|
|
32
|
+
"agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex",
|
|
33
|
+
"edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave",
|
|
34
|
+
"ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde",
|
|
35
|
+
"scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute",
|
|
36
|
+
"ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall",
|
|
37
|
+
"dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall",
|
|
38
|
+
"parenleftsuperior", "parenrightsuperior", "twodotenleader",
|
|
39
|
+
"onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle",
|
|
40
|
+
"threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle",
|
|
41
|
+
"sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior",
|
|
42
|
+
"threequartersemdash", "periodsuperior", "questionsmall", "asuperior",
|
|
43
|
+
"bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior",
|
|
44
|
+
"lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior",
|
|
45
|
+
"ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior",
|
|
46
|
+
"parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall",
|
|
47
|
+
"Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall",
|
|
48
|
+
"Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall",
|
|
49
|
+
"Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall",
|
|
50
|
+
"Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary",
|
|
51
|
+
"onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle",
|
|
52
|
+
"Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall",
|
|
53
|
+
"Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash",
|
|
54
|
+
"hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall",
|
|
55
|
+
"questiondownsmall", "oneeighth", "threeeighths", "fiveeighths",
|
|
56
|
+
"seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior",
|
|
57
|
+
"fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior",
|
|
58
|
+
"ninesuperior", "zeroinferior", "oneinferior", "twoinferior",
|
|
59
|
+
"threeinferior", "fourinferior", "fiveinferior", "sixinferior",
|
|
60
|
+
"seveninferior", "eightinferior", "nineinferior", "centinferior",
|
|
61
|
+
"dollarinferior", "periodinferior", "commainferior", "Agravesmall",
|
|
62
|
+
"Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall",
|
|
63
|
+
"Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall",
|
|
64
|
+
"Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall",
|
|
65
|
+
"Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall",
|
|
66
|
+
"Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall",
|
|
67
|
+
"Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall",
|
|
68
|
+
"Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall",
|
|
69
|
+
"Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black",
|
|
70
|
+
"Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold"
|
|
71
|
+
];
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import * as r from 'restructure';
|
|
2
|
+
import { resolveLength } from 'restructure';
|
|
3
|
+
import CFFDict from './CFFDict';
|
|
4
|
+
import CFFIndex from './CFFIndex';
|
|
5
|
+
import CFFPointer from './CFFPointer';
|
|
6
|
+
import CFFPrivateDict from './CFFPrivateDict';
|
|
7
|
+
import { StandardEncoding, ExpertEncoding } from './CFFEncodings';
|
|
8
|
+
import { ISOAdobeCharset, ExpertCharset, ExpertSubsetCharset } from './CFFCharsets';
|
|
9
|
+
import { ItemVariationStore } from '../tables/variations';
|
|
10
|
+
|
|
11
|
+
// Checks if an operand is an index of a predefined value,
|
|
12
|
+
// otherwise delegates to the provided type.
|
|
13
|
+
class PredefinedOp {
|
|
14
|
+
constructor(predefinedOps, type) {
|
|
15
|
+
this.predefinedOps = predefinedOps;
|
|
16
|
+
this.type = type;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
decode(stream, parent, operands) {
|
|
20
|
+
if (this.predefinedOps[operands[0]]) {
|
|
21
|
+
return this.predefinedOps[operands[0]];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return this.type.decode(stream, parent, operands);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
size(value, ctx) {
|
|
28
|
+
return this.type.size(value, ctx);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
encode(stream, value, ctx) {
|
|
32
|
+
let index = this.predefinedOps.indexOf(value);
|
|
33
|
+
if (index !== -1) {
|
|
34
|
+
return index;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return this.type.encode(stream, value, ctx);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
class CFFEncodingVersion extends r.Number {
|
|
42
|
+
constructor() {
|
|
43
|
+
super('UInt8');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
decode(stream) {
|
|
47
|
+
return r.uint8.decode(stream) & 0x7f;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let Range1 = new r.Struct({
|
|
52
|
+
first: r.uint16,
|
|
53
|
+
nLeft: r.uint8
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
let Range2 = new r.Struct({
|
|
57
|
+
first: r.uint16,
|
|
58
|
+
nLeft: r.uint16
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
let CFFCustomEncoding = new r.VersionedStruct(new CFFEncodingVersion(), {
|
|
62
|
+
0: {
|
|
63
|
+
nCodes: r.uint8,
|
|
64
|
+
codes: new r.Array(r.uint8, 'nCodes')
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
1: {
|
|
68
|
+
nRanges: r.uint8,
|
|
69
|
+
ranges: new r.Array(Range1, 'nRanges')
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// TODO: supplement?
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
let CFFEncoding = new PredefinedOp([ StandardEncoding, ExpertEncoding ], new CFFPointer(CFFCustomEncoding, { lazy: true }));
|
|
76
|
+
|
|
77
|
+
// Decodes an array of ranges until the total
|
|
78
|
+
// length is equal to the provided length.
|
|
79
|
+
class RangeArray extends r.Array {
|
|
80
|
+
decode(stream, parent) {
|
|
81
|
+
let length = resolveLength(this.length, stream, parent);
|
|
82
|
+
let count = 0;
|
|
83
|
+
let res = [];
|
|
84
|
+
while (count < length) {
|
|
85
|
+
let range = this.type.decode(stream, parent);
|
|
86
|
+
range.offset = count;
|
|
87
|
+
count += range.nLeft + 1;
|
|
88
|
+
res.push(range);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return res;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let CFFCustomCharset = new r.VersionedStruct(r.uint8, {
|
|
96
|
+
0: {
|
|
97
|
+
glyphs: new r.Array(r.uint16, t => t.parent.CharStrings.length - 1)
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
1: {
|
|
101
|
+
ranges: new RangeArray(Range1, t => t.parent.CharStrings.length - 1)
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
2: {
|
|
105
|
+
ranges: new RangeArray(Range2, t => t.parent.CharStrings.length - 1)
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
let CFFCharset = new PredefinedOp([ ISOAdobeCharset, ExpertCharset, ExpertSubsetCharset ], new CFFPointer(CFFCustomCharset, {lazy: true}));
|
|
110
|
+
|
|
111
|
+
let FDRange3 = new r.Struct({
|
|
112
|
+
first: r.uint16,
|
|
113
|
+
fd: r.uint8
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
let FDRange4 = new r.Struct({
|
|
117
|
+
first: r.uint32,
|
|
118
|
+
fd: r.uint16
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
let FDSelect = new r.VersionedStruct(r.uint8, {
|
|
122
|
+
0: {
|
|
123
|
+
fds: new r.Array(r.uint8, t => t.parent.CharStrings.length)
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
3: {
|
|
127
|
+
nRanges: r.uint16,
|
|
128
|
+
ranges: new r.Array(FDRange3, 'nRanges'),
|
|
129
|
+
sentinel: r.uint16
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
4: {
|
|
133
|
+
nRanges: r.uint32,
|
|
134
|
+
ranges: new r.Array(FDRange4, 'nRanges'),
|
|
135
|
+
sentinel: r.uint32
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
let ptr = new CFFPointer(CFFPrivateDict);
|
|
140
|
+
class CFFPrivateOp {
|
|
141
|
+
decode(stream, parent, operands) {
|
|
142
|
+
parent.length = operands[0];
|
|
143
|
+
return ptr.decode(stream, parent, [operands[1]]);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
size(dict, ctx) {
|
|
147
|
+
return [CFFPrivateDict.size(dict, ctx, false), ptr.size(dict, ctx)[0]];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
encode(stream, dict, ctx) {
|
|
151
|
+
return [CFFPrivateDict.size(dict, ctx, false), ptr.encode(stream, dict, ctx)[0]];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
let FontDict = new CFFDict([
|
|
156
|
+
// key name type(s) default
|
|
157
|
+
[18, 'Private', new CFFPrivateOp, null],
|
|
158
|
+
[[12, 38], 'FontName', 'sid', null],
|
|
159
|
+
[[12, 7], 'FontMatrix', 'array', [0.001, 0, 0, 0.001, 0, 0]],
|
|
160
|
+
[[12, 5], 'PaintType', 'number', 0],
|
|
161
|
+
]);
|
|
162
|
+
|
|
163
|
+
let CFFTopDict = new CFFDict([
|
|
164
|
+
// key name type(s) default
|
|
165
|
+
[[12, 30], 'ROS', ['sid', 'sid', 'number'], null],
|
|
166
|
+
|
|
167
|
+
[0, 'version', 'sid', null],
|
|
168
|
+
[1, 'Notice', 'sid', null],
|
|
169
|
+
[[12, 0], 'Copyright', 'sid', null],
|
|
170
|
+
[2, 'FullName', 'sid', null],
|
|
171
|
+
[3, 'FamilyName', 'sid', null],
|
|
172
|
+
[4, 'Weight', 'sid', null],
|
|
173
|
+
[[12, 1], 'isFixedPitch', 'boolean', false],
|
|
174
|
+
[[12, 2], 'ItalicAngle', 'number', 0],
|
|
175
|
+
[[12, 3], 'UnderlinePosition', 'number', -100],
|
|
176
|
+
[[12, 4], 'UnderlineThickness', 'number', 50],
|
|
177
|
+
[[12, 5], 'PaintType', 'number', 0],
|
|
178
|
+
[[12, 6], 'CharstringType', 'number', 2],
|
|
179
|
+
[[12, 7], 'FontMatrix', 'array', [0.001, 0, 0, 0.001, 0, 0]],
|
|
180
|
+
[13, 'UniqueID', 'number', null],
|
|
181
|
+
[5, 'FontBBox', 'array', [0, 0, 0, 0]],
|
|
182
|
+
[[12, 8], 'StrokeWidth', 'number', 0],
|
|
183
|
+
[14, 'XUID', 'array', null],
|
|
184
|
+
[15, 'charset', CFFCharset, ISOAdobeCharset],
|
|
185
|
+
[16, 'Encoding', CFFEncoding, StandardEncoding],
|
|
186
|
+
[17, 'CharStrings', new CFFPointer(new CFFIndex), null],
|
|
187
|
+
[18, 'Private', new CFFPrivateOp, null],
|
|
188
|
+
[[12, 20], 'SyntheticBase', 'number', null],
|
|
189
|
+
[[12, 21], 'PostScript', 'sid', null],
|
|
190
|
+
[[12, 22], 'BaseFontName', 'sid', null],
|
|
191
|
+
[[12, 23], 'BaseFontBlend', 'delta', null],
|
|
192
|
+
|
|
193
|
+
// CID font specific
|
|
194
|
+
[[12, 31], 'CIDFontVersion', 'number', 0],
|
|
195
|
+
[[12, 32], 'CIDFontRevision', 'number', 0],
|
|
196
|
+
[[12, 33], 'CIDFontType', 'number', 0],
|
|
197
|
+
[[12, 34], 'CIDCount', 'number', 8720],
|
|
198
|
+
[[12, 35], 'UIDBase', 'number', null],
|
|
199
|
+
[[12, 37], 'FDSelect', new CFFPointer(FDSelect), null],
|
|
200
|
+
[[12, 36], 'FDArray', new CFFPointer(new CFFIndex(FontDict)), null],
|
|
201
|
+
[[12, 38], 'FontName', 'sid', null]
|
|
202
|
+
]);
|
|
203
|
+
|
|
204
|
+
let VariationStore = new r.Struct({
|
|
205
|
+
length: r.uint16,
|
|
206
|
+
itemVariationStore: ItemVariationStore
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
let CFF2TopDict = new CFFDict([
|
|
210
|
+
[[12, 7], 'FontMatrix', 'array', [0.001, 0, 0, 0.001, 0, 0]],
|
|
211
|
+
[17, 'CharStrings', new CFFPointer(new CFFIndex), null],
|
|
212
|
+
[[12, 37], 'FDSelect', new CFFPointer(FDSelect), null],
|
|
213
|
+
[[12, 36], 'FDArray', new CFFPointer(new CFFIndex(FontDict)), null],
|
|
214
|
+
[24, 'vstore', new CFFPointer(VariationStore), null],
|
|
215
|
+
[25, 'maxstack', 'number', 193]
|
|
216
|
+
]);
|
|
217
|
+
|
|
218
|
+
let CFFTop = new r.VersionedStruct(r.fixed16, {
|
|
219
|
+
1: {
|
|
220
|
+
hdrSize: r.uint8,
|
|
221
|
+
offSize: r.uint8,
|
|
222
|
+
nameIndex: new CFFIndex(new r.String('length')),
|
|
223
|
+
topDictIndex: new CFFIndex(CFFTopDict),
|
|
224
|
+
stringIndex: new CFFIndex(new r.String('length')),
|
|
225
|
+
globalSubrIndex: new CFFIndex
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
2: {
|
|
229
|
+
hdrSize: r.uint8,
|
|
230
|
+
length: r.uint16,
|
|
231
|
+
topDict: CFF2TopDict,
|
|
232
|
+
globalSubrIndex: new CFFIndex
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
export default CFFTop;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This decorator caches the results of a getter or method such that
|
|
3
|
+
* the results are lazily computed once, and then cached.
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
6
|
+
export function cache(target, key, descriptor) {
|
|
7
|
+
if (descriptor.get) {
|
|
8
|
+
let get = descriptor.get;
|
|
9
|
+
descriptor.get = function() {
|
|
10
|
+
let value = get.call(this);
|
|
11
|
+
Object.defineProperty(this, key, { value });
|
|
12
|
+
return value;
|
|
13
|
+
};
|
|
14
|
+
} else if (typeof descriptor.value === 'function') {
|
|
15
|
+
let fn = descriptor.value;
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
get() {
|
|
19
|
+
let cache = new Map;
|
|
20
|
+
function memoized(...args) {
|
|
21
|
+
let key = args.length > 0 ? args[0] : 'value';
|
|
22
|
+
if (cache.has(key)) {
|
|
23
|
+
return cache.get(key);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let result = fn.apply(this, args);
|
|
27
|
+
cache.set(key, result);
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
Object.defineProperty(this, key, {value: memoized});
|
|
32
|
+
return memoized;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/encodings.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets an encoding name from platform, encoding, and language ids.
|
|
3
|
+
* Returned encoding names can be used in iconv-lite to decode text.
|
|
4
|
+
*/
|
|
5
|
+
export function getEncoding(platformID, encodingID, languageID = 0) {
|
|
6
|
+
if (platformID === 1 && MAC_LANGUAGE_ENCODINGS[languageID]) {
|
|
7
|
+
return MAC_LANGUAGE_ENCODINGS[languageID];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return ENCODINGS[platformID][encodingID];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const SINGLE_BYTE_ENCODINGS = new Set(['x-mac-roman', 'x-mac-cyrillic', 'iso-8859-6', 'iso-8859-8']);
|
|
14
|
+
const MAC_ENCODINGS = {
|
|
15
|
+
'x-mac-croatian': 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ',
|
|
16
|
+
'x-mac-gaelic': 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ',
|
|
17
|
+
'x-mac-greek': 'Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ\u00AD',
|
|
18
|
+
'x-mac-icelandic': 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ',
|
|
19
|
+
'x-mac-inuit': 'ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł',
|
|
20
|
+
'x-mac-ce': 'ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ',
|
|
21
|
+
'x-mac-romanian': 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ',
|
|
22
|
+
'x-mac-turkish': 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const encodingCache = new Map();
|
|
26
|
+
|
|
27
|
+
export function getEncodingMapping(encoding) {
|
|
28
|
+
let cached = encodingCache.get(encoding);
|
|
29
|
+
if (cached) {
|
|
30
|
+
return cached;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// These encodings aren't supported by TextDecoder.
|
|
34
|
+
let mapping = MAC_ENCODINGS[encoding];
|
|
35
|
+
if (mapping) {
|
|
36
|
+
let res = new Map();
|
|
37
|
+
for (let i = 0; i < mapping.length; i++) {
|
|
38
|
+
res.set(mapping.charCodeAt(i), 0x80 + i);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
encodingCache.set(encoding, res);
|
|
42
|
+
return res;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Only single byte encodings can be mapped 1:1.
|
|
46
|
+
if (SINGLE_BYTE_ENCODINGS.has(encoding)) {
|
|
47
|
+
// TextEncoder only supports utf8, whereas TextDecoder supports legacy encodings.
|
|
48
|
+
// Use this to create a mapping of code points.
|
|
49
|
+
let decoder = new TextDecoder(encoding);
|
|
50
|
+
let mapping = new Uint8Array(0x80);
|
|
51
|
+
for (let i = 0; i < 0x80; i++) {
|
|
52
|
+
mapping[i] = 0x80 + i;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let res = new Map();
|
|
56
|
+
let s = decoder.decode(mapping);
|
|
57
|
+
for (let i = 0; i < 0x80; i++) {
|
|
58
|
+
res.set(s.charCodeAt(i), 0x80 + i);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
encodingCache.set(encoding, res);
|
|
62
|
+
return res;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Map of platform ids to encoding ids.
|
|
67
|
+
export const ENCODINGS = [
|
|
68
|
+
// unicode
|
|
69
|
+
['utf-16be', 'utf-16be', 'utf-16be', 'utf-16be', 'utf-16be', 'utf-16be', 'utf-16be'],
|
|
70
|
+
|
|
71
|
+
// macintosh
|
|
72
|
+
// Mappings available at http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/
|
|
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
|
+
['x-mac-roman', 'shift-jis', 'big5', 'euc-kr', 'iso-8859-6', 'iso-8859-8',
|
|
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
|
+
// ISO (deprecated)
|
|
97
|
+
['ascii', null, 'iso-8859-1'],
|
|
98
|
+
|
|
99
|
+
// windows
|
|
100
|
+
// Docs here: http://msdn.microsoft.com/en-us/library/system.text.encoding(v=vs.110).aspx
|
|
101
|
+
['symbol', 'utf-16be', 'shift-jis', 'gb18030', 'big5', 'euc-kr', 'johab', null, null, null, 'utf-16be']
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
// Overrides for Mac scripts by language id.
|
|
105
|
+
// See http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt
|
|
106
|
+
export const MAC_LANGUAGE_ENCODINGS = {
|
|
107
|
+
15: 'x-mac-icelandic',
|
|
108
|
+
17: 'x-mac-turkish',
|
|
109
|
+
18: 'x-mac-croatian',
|
|
110
|
+
24: 'x-mac-ce',
|
|
111
|
+
25: 'x-mac-ce',
|
|
112
|
+
26: 'x-mac-ce',
|
|
113
|
+
27: 'x-mac-ce',
|
|
114
|
+
28: 'x-mac-ce',
|
|
115
|
+
30: 'x-mac-icelandic',
|
|
116
|
+
37: 'x-mac-romanian',
|
|
117
|
+
38: 'x-mac-ce',
|
|
118
|
+
39: 'x-mac-ce',
|
|
119
|
+
40: 'x-mac-ce',
|
|
120
|
+
143: 'x-mac-inuit',
|
|
121
|
+
146: 'x-mac-gaelic'
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// Map of platform ids to BCP-47 language codes.
|
|
125
|
+
export const LANGUAGES = [
|
|
126
|
+
// unicode
|
|
127
|
+
[],
|
|
128
|
+
|
|
129
|
+
{ // macintosh
|
|
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
|
+
},
|
|
161
|
+
|
|
162
|
+
// ISO (deprecated)
|
|
163
|
+
[],
|
|
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
|
+
}
|
|
219
|
+
];
|