UNPKG

hummus-recipe

Version:

A powerful PDF tool for NodeJS based on HummusJS

1,431 lines (1,208 loc) 520 kB
'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var r = _interopDefault(require('restructure')); var _Object$getOwnPropertyDescriptor = _interopDefault(require('babel-runtime/core-js/object/get-own-property-descriptor')); var _getIterator = _interopDefault(require('babel-runtime/core-js/get-iterator')); var _Object$freeze = _interopDefault(require('babel-runtime/core-js/object/freeze')); var _typeof = _interopDefault(require('babel-runtime/helpers/typeof')); var _Object$keys = _interopDefault(require('babel-runtime/core-js/object/keys')); var _Object$defineProperty = _interopDefault(require('babel-runtime/core-js/object/define-property')); var _classCallCheck = _interopDefault(require('babel-runtime/helpers/classCallCheck')); var _createClass = _interopDefault(require('babel-runtime/helpers/createClass')); var _Map = _interopDefault(require('babel-runtime/core-js/map')); var _possibleConstructorReturn = _interopDefault(require('babel-runtime/helpers/possibleConstructorReturn')); var _inherits = _interopDefault(require('babel-runtime/helpers/inherits')); var restructure_src_utils = require('restructure/src/utils'); var _Object$defineProperties = _interopDefault(require('babel-runtime/core-js/object/define-properties')); var isEqual = _interopDefault(require('deep-equal')); var _Object$assign = _interopDefault(require('babel-runtime/core-js/object/assign')); var _String$fromCodePoint = _interopDefault(require('babel-runtime/core-js/string/from-code-point')); var _Array$from = _interopDefault(require('babel-runtime/core-js/array/from')); var _Set = _interopDefault(require('babel-runtime/core-js/set')); var unicode = _interopDefault(require('unicode-properties')); var UnicodeTrie = _interopDefault(require('unicode-trie')); var StateMachine = _interopDefault(require('dfa')); var _Number$EPSILON = _interopDefault(require('babel-runtime/core-js/number/epsilon')); var cloneDeep = _interopDefault(require('clone')); var inflate = _interopDefault(require('tiny-inflate')); var brotli = _interopDefault(require('brotli/decompress')); var fs = require('fs'); var fontkit = {}; fontkit.logErrors = false; var formats = []; fontkit.registerFormat = function (format) { formats.push(format); }; fontkit.openSync = function (filename, postscriptName) { var buffer = fs.readFileSync(filename); return fontkit.create(buffer, postscriptName); }; fontkit.open = function (filename, postscriptName, callback) { if (typeof postscriptName === 'function') { callback = postscriptName; postscriptName = null; } fs.readFile(filename, function (err, buffer) { if (err) { return callback(err); } try { var font = fontkit.create(buffer, postscriptName); } catch (e) { return callback(e); } return callback(null, font); }); return; }; fontkit.create = function (buffer, postscriptName) { for (var i = 0; i < formats.length; i++) { var format = formats[i]; if (format.probe(buffer)) { var font = new format(new r.DecodeStream(buffer)); if (postscriptName) { return font.getFont(postscriptName); } return font; } } throw new Error('Unknown font format'); }; fontkit.defaultLanguage = 'en'; fontkit.setDefaultLanguage = function () { var lang = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'en'; fontkit.defaultLanguage = lang; }; /** * This decorator caches the results of a getter or method such that * the results are lazily computed once, and then cached. * @private */ function cache(target, key, descriptor) { if (descriptor.get) { var get = descriptor.get; descriptor.get = function () { var value = get.call(this); _Object$defineProperty(this, key, { value: value }); return value; }; } else if (typeof descriptor.value === 'function') { var fn = descriptor.value; return { get: function get() { var cache = new _Map(); function memoized() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var key = args.length > 0 ? args[0] : 'value'; if (cache.has(key)) { return cache.get(key); } var result = fn.apply(this, args); cache.set(key, result); return result; }; _Object$defineProperty(this, key, { value: memoized }); return memoized; } }; } } var SubHeader = new r.Struct({ firstCode: r.uint16, entryCount: r.uint16, idDelta: r.int16, idRangeOffset: r.uint16 }); var CmapGroup = new r.Struct({ startCharCode: r.uint32, endCharCode: r.uint32, glyphID: r.uint32 }); var UnicodeValueRange = new r.Struct({ startUnicodeValue: r.uint24, additionalCount: r.uint8 }); var UVSMapping = new r.Struct({ unicodeValue: r.uint24, glyphID: r.uint16 }); var DefaultUVS = new r.Array(UnicodeValueRange, r.uint32); var NonDefaultUVS = new r.Array(UVSMapping, r.uint32); var VarSelectorRecord = new r.Struct({ varSelector: r.uint24, defaultUVS: new r.Pointer(r.uint32, DefaultUVS, { type: 'parent' }), nonDefaultUVS: new r.Pointer(r.uint32, NonDefaultUVS, { type: 'parent' }) }); var CmapSubtable = new r.VersionedStruct(r.uint16, { 0: { // Byte encoding length: r.uint16, // Total table length in bytes (set to 262 for format 0) language: r.uint16, // Language code for this encoding subtable, or zero if language-independent codeMap: new r.LazyArray(r.uint8, 256) }, 2: { // High-byte mapping (CJK) length: r.uint16, language: r.uint16, subHeaderKeys: new r.Array(r.uint16, 256), subHeaderCount: function subHeaderCount(t) { return Math.max.apply(Math, t.subHeaderKeys); }, subHeaders: new r.LazyArray(SubHeader, 'subHeaderCount'), glyphIndexArray: new r.LazyArray(r.uint16, 'subHeaderCount') }, 4: { // Segment mapping to delta values length: r.uint16, // Total table length in bytes language: r.uint16, // Language code segCountX2: r.uint16, segCount: function segCount(t) { return t.segCountX2 >> 1; }, searchRange: r.uint16, entrySelector: r.uint16, rangeShift: r.uint16, endCode: new r.LazyArray(r.uint16, 'segCount'), reservedPad: new r.Reserved(r.uint16), // This value should be zero startCode: new r.LazyArray(r.uint16, 'segCount'), idDelta: new r.LazyArray(r.int16, 'segCount'), idRangeOffset: new r.LazyArray(r.uint16, 'segCount'), glyphIndexArray: new r.LazyArray(r.uint16, function (t) { return (t.length - t._currentOffset) / 2; }) }, 6: { // Trimmed table length: r.uint16, language: r.uint16, firstCode: r.uint16, entryCount: r.uint16, glyphIndices: new r.LazyArray(r.uint16, 'entryCount') }, 8: { // mixed 16-bit and 32-bit coverage reserved: new r.Reserved(r.uint16), length: r.uint32, language: r.uint16, is32: new r.LazyArray(r.uint8, 8192), nGroups: r.uint32, groups: new r.LazyArray(CmapGroup, 'nGroups') }, 10: { // Trimmed Array reserved: new r.Reserved(r.uint16), length: r.uint32, language: r.uint32, firstCode: r.uint32, entryCount: r.uint32, glyphIndices: new r.LazyArray(r.uint16, 'numChars') }, 12: { // Segmented coverage reserved: new r.Reserved(r.uint16), length: r.uint32, language: r.uint32, nGroups: r.uint32, groups: new r.LazyArray(CmapGroup, 'nGroups') }, 13: { // Many-to-one range mappings (same as 12 except for group.startGlyphID) reserved: new r.Reserved(r.uint16), length: r.uint32, language: r.uint32, nGroups: r.uint32, groups: new r.LazyArray(CmapGroup, 'nGroups') }, 14: { // Unicode Variation Sequences length: r.uint32, numRecords: r.uint32, varSelectors: new r.LazyArray(VarSelectorRecord, 'numRecords') } }); var CmapEntry = new r.Struct({ platformID: r.uint16, // Platform identifier encodingID: r.uint16, // Platform-specific encoding identifier table: new r.Pointer(r.uint32, CmapSubtable, { type: 'parent', lazy: true }) }); // character to glyph mapping var cmap = new r.Struct({ version: r.uint16, numSubtables: r.uint16, tables: new r.Array(CmapEntry, 'numSubtables') }); // font header var head = new r.Struct({ version: r.int32, // 0x00010000 (version 1.0) revision: r.int32, // set by font manufacturer checkSumAdjustment: r.uint32, magicNumber: r.uint32, // set to 0x5F0F3CF5 flags: r.uint16, unitsPerEm: r.uint16, // range from 64 to 16384 created: new r.Array(r.int32, 2), modified: new r.Array(r.int32, 2), xMin: r.int16, // for all glyph bounding boxes yMin: r.int16, // for all glyph bounding boxes xMax: r.int16, // for all glyph bounding boxes yMax: r.int16, // for all glyph bounding boxes macStyle: new r.Bitfield(r.uint16, ['bold', 'italic', 'underline', 'outline', 'shadow', 'condensed', 'extended']), lowestRecPPEM: r.uint16, // smallest readable size in pixels fontDirectionHint: r.int16, indexToLocFormat: r.int16, // 0 for short offsets, 1 for long glyphDataFormat: r.int16 // 0 for current format }); // horizontal header var hhea = new r.Struct({ version: r.int32, ascent: r.int16, // Distance from baseline of highest ascender descent: r.int16, // Distance from baseline of lowest descender lineGap: r.int16, // Typographic line gap advanceWidthMax: r.uint16, // Maximum advance width value in 'hmtx' table minLeftSideBearing: r.int16, // Maximum advance width value in 'hmtx' table minRightSideBearing: r.int16, // Minimum right sidebearing value xMaxExtent: r.int16, caretSlopeRise: r.int16, // Used to calculate the slope of the cursor (rise/run); 1 for vertical caretSlopeRun: r.int16, // 0 for vertical caretOffset: r.int16, // Set to 0 for non-slanted fonts reserved: new r.Reserved(r.int16, 4), metricDataFormat: r.int16, // 0 for current format numberOfMetrics: r.uint16 // Number of advance widths in 'hmtx' table }); var HmtxEntry = new r.Struct({ advance: r.uint16, bearing: r.int16 }); var hmtx = new r.Struct({ metrics: new r.LazyArray(HmtxEntry, function (t) { return t.parent.hhea.numberOfMetrics; }), bearings: new r.LazyArray(r.int16, function (t) { return t.parent.maxp.numGlyphs - t.parent.hhea.numberOfMetrics; }) }); // maxiumum profile var maxp = new r.Struct({ version: r.int32, numGlyphs: r.uint16, // The number of glyphs in the font maxPoints: r.uint16, // Maximum points in a non-composite glyph maxContours: r.uint16, // Maximum contours in a non-composite glyph maxComponentPoints: r.uint16, // Maximum points in a composite glyph maxComponentContours: r.uint16, // Maximum contours in a composite glyph maxZones: r.uint16, // 1 if instructions do not use the twilight zone, 2 otherwise maxTwilightPoints: r.uint16, // Maximum points used in Z0 maxStorage: r.uint16, // Number of Storage Area locations maxFunctionDefs: r.uint16, // Number of FDEFs maxInstructionDefs: r.uint16, // Number of IDEFs maxStackElements: r.uint16, // Maximum stack depth maxSizeOfInstructions: r.uint16, // Maximum byte count for glyph instructions maxComponentElements: r.uint16, // Maximum number of components referenced at “top level” for any composite glyph maxComponentDepth: r.uint16 // Maximum levels of recursion; 1 for simple components }); /** * Gets an encoding name from platform, encoding, and language ids. * Returned encoding names can be used in iconv-lite to decode text. */ function getEncoding(platformID, encodingID) { var languageID = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; if (platformID === 1 && MAC_LANGUAGE_ENCODINGS[languageID]) { return MAC_LANGUAGE_ENCODINGS[languageID]; } return ENCODINGS[platformID][encodingID]; } // Map of platform ids to encoding ids. var ENCODINGS = [ // unicode ['utf16be', 'utf16be', 'utf16be', 'utf16be', 'utf16be', 'utf16be'], // macintosh // Mappings available at http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/ // 0 Roman 17 Malayalam // 1 Japanese 18 Sinhalese // 2 Traditional Chinese 19 Burmese // 3 Korean 20 Khmer // 4 Arabic 21 Thai // 5 Hebrew 22 Laotian // 6 Greek 23 Georgian // 7 Russian 24 Armenian // 8 RSymbol 25 Simplified Chinese // 9 Devanagari 26 Tibetan // 10 Gurmukhi 27 Mongolian // 11 Gujarati 28 Geez // 12 Oriya 29 Slavic // 13 Bengali 30 Vietnamese // 14 Tamil 31 Sindhi // 15 Telugu 32 (Uninterpreted) // 16 Kannada ['macroman', 'shift-jis', 'big5', 'euc-kr', 'iso-8859-6', 'iso-8859-8', 'macgreek', 'maccyrillic', 'symbol', 'Devanagari', 'Gurmukhi', 'Gujarati', 'Oriya', 'Bengali', 'Tamil', 'Telugu', 'Kannada', 'Malayalam', 'Sinhalese', 'Burmese', 'Khmer', 'macthai', 'Laotian', 'Georgian', 'Armenian', 'gb-2312-80', 'Tibetan', 'Mongolian', 'Geez', 'maccenteuro', 'Vietnamese', 'Sindhi'], // ISO (deprecated) ['ascii'], // windows // Docs here: http://msdn.microsoft.com/en-us/library/system.text.encoding(v=vs.110).aspx ['symbol', 'utf16be', 'shift-jis', 'gb18030', 'big5', 'wansung', 'johab', null, null, null, 'utf16be']]; // Overrides for Mac scripts by language id. // See http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt var MAC_LANGUAGE_ENCODINGS = { 15: 'maciceland', 17: 'macturkish', 18: 'maccroatian', 24: 'maccenteuro', 25: 'maccenteuro', 26: 'maccenteuro', 27: 'maccenteuro', 28: 'maccenteuro', 30: 'maciceland', 37: 'macromania', 38: 'maccenteuro', 39: 'maccenteuro', 40: 'maccenteuro', 143: 'macinuit', // Unsupported by iconv-lite 146: 'macgaelic' // Unsupported by iconv-lite }; // Map of platform ids to BCP-47 language codes. var LANGUAGES = [ // unicode [], { // macintosh 0: 'en', 30: 'fo', 60: 'ks', 90: 'rw', 1: 'fr', 31: 'fa', 61: 'ku', 91: 'rn', 2: 'de', 32: 'ru', 62: 'sd', 92: 'ny', 3: 'it', 33: 'zh', 63: 'bo', 93: 'mg', 4: 'nl', 34: 'nl-BE', 64: 'ne', 94: 'eo', 5: 'sv', 35: 'ga', 65: 'sa', 128: 'cy', 6: 'es', 36: 'sq', 66: 'mr', 129: 'eu', 7: 'da', 37: 'ro', 67: 'bn', 130: 'ca', 8: 'pt', 38: 'cz', 68: 'as', 131: 'la', 9: 'no', 39: 'sk', 69: 'gu', 132: 'qu', 10: 'he', 40: 'si', 70: 'pa', 133: 'gn', 11: 'ja', 41: 'yi', 71: 'or', 134: 'ay', 12: 'ar', 42: 'sr', 72: 'ml', 135: 'tt', 13: 'fi', 43: 'mk', 73: 'kn', 136: 'ug', 14: 'el', 44: 'bg', 74: 'ta', 137: 'dz', 15: 'is', 45: 'uk', 75: 'te', 138: 'jv', 16: 'mt', 46: 'be', 76: 'si', 139: 'su', 17: 'tr', 47: 'uz', 77: 'my', 140: 'gl', 18: 'hr', 48: 'kk', 78: 'km', 141: 'af', 19: 'zh-Hant', 49: 'az-Cyrl', 79: 'lo', 142: 'br', 20: 'ur', 50: 'az-Arab', 80: 'vi', 143: 'iu', 21: 'hi', 51: 'hy', 81: 'id', 144: 'gd', 22: 'th', 52: 'ka', 82: 'tl', 145: 'gv', 23: 'ko', 53: 'mo', 83: 'ms', 146: 'ga', 24: 'lt', 54: 'ky', 84: 'ms-Arab', 147: 'to', 25: 'pl', 55: 'tg', 85: 'am', 148: 'el-polyton', 26: 'hu', 56: 'tk', 86: 'ti', 149: 'kl', 27: 'es', 57: 'mn-CN', 87: 'om', 150: 'az', 28: 'lv', 58: 'mn', 88: 'so', 151: 'nn', 29: 'se', 59: 'ps', 89: 'sw' }, // ISO (deprecated) [], { // windows 0x0436: 'af', 0x4009: 'en-IN', 0x0487: 'rw', 0x0432: 'tn', 0x041C: 'sq', 0x1809: 'en-IE', 0x0441: 'sw', 0x045B: 'si', 0x0484: 'gsw', 0x2009: 'en-JM', 0x0457: 'kok', 0x041B: 'sk', 0x045E: 'am', 0x4409: 'en-MY', 0x0412: 'ko', 0x0424: 'sl', 0x1401: 'ar-DZ', 0x1409: 'en-NZ', 0x0440: 'ky', 0x2C0A: 'es-AR', 0x3C01: 'ar-BH', 0x3409: 'en-PH', 0x0454: 'lo', 0x400A: 'es-BO', 0x0C01: 'ar', 0x4809: 'en-SG', 0x0426: 'lv', 0x340A: 'es-CL', 0x0801: 'ar-IQ', 0x1C09: 'en-ZA', 0x0427: 'lt', 0x240A: 'es-CO', 0x2C01: 'ar-JO', 0x2C09: 'en-TT', 0x082E: 'dsb', 0x140A: 'es-CR', 0x3401: 'ar-KW', 0x0809: 'en-GB', 0x046E: 'lb', 0x1C0A: 'es-DO', 0x3001: 'ar-LB', 0x0409: 'en', 0x042F: 'mk', 0x300A: 'es-EC', 0x1001: 'ar-LY', 0x3009: 'en-ZW', 0x083E: 'ms-BN', 0x440A: 'es-SV', 0x1801: 'ary', 0x0425: 'et', 0x043E: 'ms', 0x100A: 'es-GT', 0x2001: 'ar-OM', 0x0438: 'fo', 0x044C: 'ml', 0x480A: 'es-HN', 0x4001: 'ar-QA', 0x0464: 'fil', 0x043A: 'mt', 0x080A: 'es-MX', 0x0401: 'ar-SA', 0x040B: 'fi', 0x0481: 'mi', 0x4C0A: 'es-NI', 0x2801: 'ar-SY', 0x080C: 'fr-BE', 0x047A: 'arn', 0x180A: 'es-PA', 0x1C01: 'aeb', 0x0C0C: 'fr-CA', 0x044E: 'mr', 0x3C0A: 'es-PY', 0x3801: 'ar-AE', 0x040C: 'fr', 0x047C: 'moh', 0x280A: 'es-PE', 0x2401: 'ar-YE', 0x140C: 'fr-LU', 0x0450: 'mn', 0x500A: 'es-PR', 0x042B: 'hy', 0x180C: 'fr-MC', 0x0850: 'mn-CN', 0x0C0A: 'es', 0x044D: 'as', 0x100C: 'fr-CH', 0x0461: 'ne', 0x040A: 'es', 0x082C: 'az-Cyrl', 0x0462: 'fy', 0x0414: 'nb', 0x540A: 'es-US', 0x042C: 'az', 0x0456: 'gl', 0x0814: 'nn', 0x380A: 'es-UY', 0x046D: 'ba', 0x0437: 'ka', 0x0482: 'oc', 0x200A: 'es-VE', 0x042D: 'eu', 0x0C07: 'de-AT', 0x0448: 'or', 0x081D: 'sv-FI', 0x0423: 'be', 0x0407: 'de', 0x0463: 'ps', 0x041D: 'sv', 0x0845: 'bn', 0x1407: 'de-LI', 0x0415: 'pl', 0x045A: 'syr', 0x0445: 'bn-IN', 0x1007: 'de-LU', 0x0416: 'pt', 0x0428: 'tg', 0x201A: 'bs-Cyrl', 0x0807: 'de-CH', 0x0816: 'pt-PT', 0x085F: 'tzm', 0x141A: 'bs', 0x0408: 'el', 0x0446: 'pa', 0x0449: 'ta', 0x047E: 'br', 0x046F: 'kl', 0x046B: 'qu-BO', 0x0444: 'tt', 0x0402: 'bg', 0x0447: 'gu', 0x086B: 'qu-EC', 0x044A: 'te', 0x0403: 'ca', 0x0468: 'ha', 0x0C6B: 'qu', 0x041E: 'th', 0x0C04: 'zh-HK', 0x040D: 'he', 0x0418: 'ro', 0x0451: 'bo', 0x1404: 'zh-MO', 0x0439: 'hi', 0x0417: 'rm', 0x041F: 'tr', 0x0804: 'zh', 0x040E: 'hu', 0x0419: 'ru', 0x0442: 'tk', 0x1004: 'zh-SG', 0x040F: 'is', 0x243B: 'smn', 0x0480: 'ug', 0x0404: 'zh-TW', 0x0470: 'ig', 0x103B: 'smj-NO', 0x0422: 'uk', 0x0483: 'co', 0x0421: 'id', 0x143B: 'smj', 0x042E: 'hsb', 0x041A: 'hr', 0x045D: 'iu', 0x0C3B: 'se-FI', 0x0420: 'ur', 0x101A: 'hr-BA', 0x085D: 'iu-Latn', 0x043B: 'se', 0x0843: 'uz-Cyrl', 0x0405: 'cs', 0x083C: 'ga', 0x083B: 'se-SE', 0x0443: 'uz', 0x0406: 'da', 0x0434: 'xh', 0x203B: 'sms', 0x042A: 'vi', 0x048C: 'prs', 0x0435: 'zu', 0x183B: 'sma-NO', 0x0452: 'cy', 0x0465: 'dv', 0x0410: 'it', 0x1C3B: 'sms', 0x0488: 'wo', 0x0813: 'nl-BE', 0x0810: 'it-CH', 0x044F: 'sa', 0x0485: 'sah', 0x0413: 'nl', 0x0411: 'ja', 0x1C1A: 'sr-Cyrl-BA', 0x0478: 'ii', 0x0C09: 'en-AU', 0x044B: 'kn', 0x0C1A: 'sr', 0x046A: 'yo', 0x2809: 'en-BZ', 0x043F: 'kk', 0x181A: 'sr-Latn-BA', 0x1009: 'en-CA', 0x0453: 'km', 0x081A: 'sr-Latn', 0x2409: 'en-029', 0x0486: 'quc', 0x046C: 'nso' }]; var NameRecord = new r.Struct({ platformID: r.uint16, encodingID: r.uint16, languageID: r.uint16, nameID: r.uint16, length: r.uint16, string: new r.Pointer(r.uint16, new r.String('length', function (t) { return getEncoding(t.platformID, t.encodingID, t.languageID); }), { type: 'parent', relativeTo: 'parent.stringOffset', allowNull: false }) }); var LangTagRecord = new r.Struct({ length: r.uint16, tag: new r.Pointer(r.uint16, new r.String('length', 'utf16be'), { type: 'parent', relativeTo: 'stringOffset' }) }); var NameTable = new r.VersionedStruct(r.uint16, { 0: { count: r.uint16, stringOffset: r.uint16, records: new r.Array(NameRecord, 'count') }, 1: { count: r.uint16, stringOffset: r.uint16, records: new r.Array(NameRecord, 'count'), langTagCount: r.uint16, langTags: new r.Array(LangTagRecord, 'langTagCount') } }); var NAMES = ['copyright', 'fontFamily', 'fontSubfamily', 'uniqueSubfamily', 'fullName', 'version', 'postscriptName', // Note: A font may have only one PostScript name and that name must be ASCII. 'trademark', 'manufacturer', 'designer', 'description', 'vendorURL', 'designerURL', 'license', 'licenseURL', null, // reserved 'preferredFamily', 'preferredSubfamily', 'compatibleFull', 'sampleText', 'postscriptCIDFontName', 'wwsFamilyName', 'wwsSubfamilyName']; NameTable.process = function (stream) { var records = {}; for (var _iterator = this.records, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) { var _ref; if (_isArray) { if (_i >= _iterator.length) break; _ref = _iterator[_i++]; } else { _i = _iterator.next(); if (_i.done) break; _ref = _i.value; } var record = _ref; // find out what language this is for var language = LANGUAGES[record.platformID][record.languageID]; if (language == null && this.langTags != null && record.languageID >= 0x8000) { language = this.langTags[record.languageID - 0x8000].tag; } if (language == null) { language = record.platformID + '-' + record.languageID; } // if the nameID is >= 256, it is a font feature record (AAT) var key = record.nameID >= 256 ? 'fontFeatures' : NAMES[record.nameID] || record.nameID; if (records[key] == null) { records[key] = {}; } var obj = records[key]; if (record.nameID >= 256) { obj = obj[record.nameID] || (obj[record.nameID] = {}); } if (typeof record.string === 'string' || typeof obj[language] !== 'string') { obj[language] = record.string; } } this.records = records; }; NameTable.preEncode = function () { if (Array.isArray(this.records)) return; this.version = 0; var records = []; for (var key in this.records) { var val = this.records[key]; if (key === 'fontFeatures') continue; records.push({ platformID: 3, encodingID: 1, languageID: 0x409, nameID: NAMES.indexOf(key), length: Buffer.byteLength(val.en, 'utf16le'), string: val.en }); if (key === 'postscriptName') { records.push({ platformID: 1, encodingID: 0, languageID: 0, nameID: NAMES.indexOf(key), length: val.en.length, string: val.en }); } } this.records = records; this.count = records.length; this.stringOffset = NameTable.size(this, null, false); }; var OS2 = new r.VersionedStruct(r.uint16, { header: { xAvgCharWidth: r.int16, // average weighted advance width of lower case letters and space usWeightClass: r.uint16, // visual weight of stroke in glyphs usWidthClass: r.uint16, // relative change from the normal aspect ratio (width to height ratio) fsType: new r.Bitfield(r.uint16, [// Indicates font embedding licensing rights null, 'noEmbedding', 'viewOnly', 'editable', null, null, null, null, 'noSubsetting', 'bitmapOnly']), ySubscriptXSize: r.int16, // recommended horizontal size in pixels for subscripts ySubscriptYSize: r.int16, // recommended vertical size in pixels for subscripts ySubscriptXOffset: r.int16, // recommended horizontal offset for subscripts ySubscriptYOffset: r.int16, // recommended vertical offset form the baseline for subscripts ySuperscriptXSize: r.int16, // recommended horizontal size in pixels for superscripts ySuperscriptYSize: r.int16, // recommended vertical size in pixels for superscripts ySuperscriptXOffset: r.int16, // recommended horizontal offset for superscripts ySuperscriptYOffset: r.int16, // recommended vertical offset from the baseline for superscripts yStrikeoutSize: r.int16, // width of the strikeout stroke yStrikeoutPosition: r.int16, // position of the strikeout stroke relative to the baseline sFamilyClass: r.int16, // classification of font-family design panose: new r.Array(r.uint8, 10), // describe the visual characteristics of a given typeface ulCharRange: new r.Array(r.uint32, 4), vendorID: new r.String(4), // four character identifier for the font vendor fsSelection: new r.Bitfield(r.uint16, [// bit field containing information about the font 'italic', 'underscore', 'negative', 'outlined', 'strikeout', 'bold', 'regular', 'useTypoMetrics', 'wws', 'oblique']), usFirstCharIndex: r.uint16, // The minimum Unicode index in this font usLastCharIndex: r.uint16 // The maximum Unicode index in this font }, // The Apple version of this table ends here, but the Microsoft one continues on... 0: {}, 1: { typoAscender: r.int16, typoDescender: r.int16, typoLineGap: r.int16, winAscent: r.uint16, winDescent: r.uint16, codePageRange: new r.Array(r.uint32, 2) }, 2: { // these should be common with version 1 somehow typoAscender: r.int16, typoDescender: r.int16, typoLineGap: r.int16, winAscent: r.uint16, winDescent: r.uint16, codePageRange: new r.Array(r.uint32, 2), xHeight: r.int16, capHeight: r.int16, defaultChar: r.uint16, breakChar: r.uint16, maxContent: r.uint16 }, 5: { typoAscender: r.int16, typoDescender: r.int16, typoLineGap: r.int16, winAscent: r.uint16, winDescent: r.uint16, codePageRange: new r.Array(r.uint32, 2), xHeight: r.int16, capHeight: r.int16, defaultChar: r.uint16, breakChar: r.uint16, maxContent: r.uint16, usLowerOpticalPointSize: r.uint16, usUpperOpticalPointSize: r.uint16 } }); var versions = OS2.versions; versions[3] = versions[4] = versions[2]; // PostScript information var post = new r.VersionedStruct(r.fixed32, { header: { // these fields exist at the top of all versions italicAngle: r.fixed32, // Italic angle in counter-clockwise degrees from the vertical. underlinePosition: r.int16, // Suggested distance of the top of the underline from the baseline underlineThickness: r.int16, // Suggested values for the underline thickness isFixedPitch: r.uint32, // Whether the font is monospaced minMemType42: r.uint32, // Minimum memory usage when a TrueType font is downloaded as a Type 42 font maxMemType42: r.uint32, // Maximum memory usage when a TrueType font is downloaded as a Type 42 font minMemType1: r.uint32, // Minimum memory usage when a TrueType font is downloaded as a Type 1 font maxMemType1: r.uint32 // Maximum memory usage when a TrueType font is downloaded as a Type 1 font }, 1: {}, // version 1 has no additional fields 2: { numberOfGlyphs: r.uint16, glyphNameIndex: new r.Array(r.uint16, 'numberOfGlyphs'), names: new r.Array(new r.String(r.uint8)) }, 2.5: { numberOfGlyphs: r.uint16, offsets: new r.Array(r.uint8, 'numberOfGlyphs') }, 3: {}, // version 3 has no additional fields 4: { map: new r.Array(r.uint32, function (t) { return t.parent.maxp.numGlyphs; }) } }); // An array of predefined values accessible by instructions var cvt = new r.Struct({ controlValues: new r.Array(r.int16) }); // A list of instructions that are executed once when a font is first used. // These instructions are known as the font program. The main use of this table // is for the definition of functions that are used in many different glyph programs. var fpgm = new r.Struct({ instructions: new r.Array(r.uint8) }); var loca = new r.VersionedStruct('head.indexToLocFormat', { 0: { offsets: new r.Array(r.uint16) }, 1: { offsets: new r.Array(r.uint32) } }); loca.process = function () { if (this.version === 0) { for (var i = 0; i < this.offsets.length; i++) { this.offsets[i] <<= 1; } } }; loca.preEncode = function () { if (this.version === 0) { for (var i = 0; i < this.offsets.length; i++) { this.offsets[i] >>>= 1; } } }; // Set of instructions executed whenever the point size or font transformation change var prep = new r.Struct({ controlValueProgram: new r.Array(r.uint8) }); // only used for encoding var glyf = new r.Array(new r.Buffer()); var CFFIndex = function () { function CFFIndex(type) { _classCallCheck(this, CFFIndex); this.type = type; } CFFIndex.prototype.getCFFVersion = function getCFFVersion(ctx) { while (ctx && !ctx.hdrSize) { ctx = ctx.parent; } return ctx ? ctx.version : -1; }; CFFIndex.prototype.decode = function decode(stream, parent) { var version = this.getCFFVersion(parent); var count = version >= 2 ? stream.readUInt32BE() : stream.readUInt16BE(); if (count === 0) { return []; } var offSize = stream.readUInt8(); var offsetType = void 0; if (offSize === 1) { offsetType = r.uint8; } else if (offSize === 2) { offsetType = r.uint16; } else if (offSize === 3) { offsetType = r.uint24; } else if (offSize === 4) { offsetType = r.uint32; } else { throw new Error("Bad offset size in CFFIndex: " + offSize + " " + stream.pos); } var ret = []; var startPos = stream.pos + (count + 1) * offSize - 1; var start = offsetType.decode(stream); for (var i = 0; i < count; i++) { var end = offsetType.decode(stream); if (this.type != null) { var pos = stream.pos; stream.pos = startPos + start; parent.length = end - start; ret.push(this.type.decode(stream, parent)); stream.pos = pos; } else { ret.push({ offset: startPos + start, length: end - start }); } start = end; } stream.pos = startPos + start; return ret; }; CFFIndex.prototype.size = function size(arr, parent) { var size = 2; if (arr.length === 0) { return size; } var type = this.type || new r.Buffer(); // find maximum offset to detminine offset type var offset = 1; for (var i = 0; i < arr.length; i++) { var item = arr[i]; offset += type.size(item, parent); } var offsetType = void 0; if (offset <= 0xff) { offsetType = r.uint8; } else if (offset <= 0xffff) { offsetType = r.uint16; } else if (offset <= 0xffffff) { offsetType = r.uint24; } else if (offset <= 0xffffffff) { offsetType = r.uint32; } else { throw new Error("Bad offset in CFFIndex"); } size += 1 + offsetType.size() * (arr.length + 1); size += offset - 1; return size; }; CFFIndex.prototype.encode = function encode(stream, arr, parent) { stream.writeUInt16BE(arr.length); if (arr.length === 0) { return; } var type = this.type || new r.Buffer(); // find maximum offset to detminine offset type var sizes = []; var offset = 1; for (var _iterator = arr, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) { var _ref; if (_isArray) { if (_i >= _iterator.length) break; _ref = _iterator[_i++]; } else { _i = _iterator.next(); if (_i.done) break; _ref = _i.value; } var item = _ref; var s = type.size(item, parent); sizes.push(s); offset += s; } var offsetType = void 0; if (offset <= 0xff) { offsetType = r.uint8; } else if (offset <= 0xffff) { offsetType = r.uint16; } else if (offset <= 0xffffff) { offsetType = r.uint24; } else if (offset <= 0xffffffff) { offsetType = r.uint32; } else { throw new Error("Bad offset in CFFIndex"); } // write offset size stream.writeUInt8(offsetType.size()); // write elements offset = 1; offsetType.encode(stream, offset); for (var _iterator2 = sizes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _getIterator(_iterator2);;) { var _ref2; if (_isArray2) { if (_i2 >= _iterator2.length) break; _ref2 = _iterator2[_i2++]; } else { _i2 = _iterator2.next(); if (_i2.done) break; _ref2 = _i2.value; } var size = _ref2; offset += size; offsetType.encode(stream, offset); } for (var _iterator3 = arr, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _getIterator(_iterator3);;) { var _ref3; if (_isArray3) { if (_i3 >= _iterator3.length) break; _ref3 = _iterator3[_i3++]; } else { _i3 = _iterator3.next(); if (_i3.done) break; _ref3 = _i3.value; } var _item = _ref3; type.encode(stream, _item, parent); } return; }; return CFFIndex; }(); var FLOAT_EOF = 0xf; var FLOAT_LOOKUP = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'E', 'E-', null, '-']; var FLOAT_ENCODE_LOOKUP = { '.': 10, 'E': 11, 'E-': 12, '-': 14 }; var CFFOperand = function () { function CFFOperand() { _classCallCheck(this, CFFOperand); } CFFOperand.decode = function decode(stream, value) { if (32 <= value && value <= 246) { return value - 139; } if (247 <= value && value <= 250) { return (value - 247) * 256 + stream.readUInt8() + 108; } if (251 <= value && value <= 254) { return -(value - 251) * 256 - stream.readUInt8() - 108; } if (value === 28) { return stream.readInt16BE(); } if (value === 29) { return stream.readInt32BE(); } if (value === 30) { var str = ''; while (true) { var b = stream.readUInt8(); var n1 = b >> 4; if (n1 === FLOAT_EOF) { break; } str += FLOAT_LOOKUP[n1]; var n2 = b & 15; if (n2 === FLOAT_EOF) { break; } str += FLOAT_LOOKUP[n2]; } return parseFloat(str); } return null; }; CFFOperand.size = function size(value) { // if the value needs to be forced to the largest size (32 bit) // e.g. for unknown pointers, set to 32768 if (value.forceLarge) { value = 32768; } if ((value | 0) !== value) { // floating point var str = '' + value; return 1 + Math.ceil((str.length + 1) / 2); } else if (-107 <= value && value <= 107) { return 1; } else if (108 <= value && value <= 1131 || -1131 <= value && value <= -108) { return 2; } else if (-32768 <= value && value <= 32767) { return 3; } else { return 5; } }; CFFOperand.encode = function encode(stream, value) { // if the value needs to be forced to the largest size (32 bit) // e.g. for unknown pointers, save the old value and set to 32768 var val = Number(value); if (value.forceLarge) { stream.writeUInt8(29); return stream.writeInt32BE(val); } else if ((val | 0) !== val) { // floating point stream.writeUInt8(30); var str = '' + val; for (var i = 0; i < str.length; i += 2) { var c1 = str[i]; var n1 = FLOAT_ENCODE_LOOKUP[c1] || +c1; if (i === str.length - 1) { var n2 = FLOAT_EOF; } else { var c2 = str[i + 1]; var n2 = FLOAT_ENCODE_LOOKUP[c2] || +c2; } stream.writeUInt8(n1 << 4 | n2 & 15); } if (n2 !== FLOAT_EOF) { return stream.writeUInt8(FLOAT_EOF << 4); } } else if (-107 <= val && val <= 107) { return stream.writeUInt8(val + 139); } else if (108 <= val && val <= 1131) { val -= 108; stream.writeUInt8((val >> 8) + 247); return stream.writeUInt8(val & 0xff); } else if (-1131 <= val && val <= -108) { val = -val - 108; stream.writeUInt8((val >> 8) + 251); return stream.writeUInt8(val & 0xff); } else if (-32768 <= val && val <= 32767) { stream.writeUInt8(28); return stream.writeInt16BE(val); } else { stream.writeUInt8(29); return stream.writeInt32BE(val); } }; return CFFOperand; }(); var CFFDict = function () { function CFFDict() { var ops = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; _classCallCheck(this, CFFDict); this.ops = ops; this.fields = {}; for (var _iterator = ops, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) { var _ref; if (_isArray) { if (_i >= _iterator.length) break; _ref = _iterator[_i++]; } else { _i = _iterator.next(); if (_i.done) break; _ref = _i.value; } var field = _ref; var key = Array.isArray(field[0]) ? field[0][0] << 8 | field[0][1] : field[0]; this.fields[key] = field; } } CFFDict.prototype.decodeOperands = function decodeOperands(type, stream, ret, operands) { var _this = this; if (Array.isArray(type)) { return operands.map(function (op, i) { return _this.decodeOperands(type[i], stream, ret, [op]); }); } else if (type.decode != null) { return type.decode(stream, ret, operands); } else { switch (type) { case 'number': case 'offset': case 'sid': return operands[0]; case 'boolean': return !!operands[0]; default: return operands; } } }; CFFDict.prototype.encodeOperands = function encodeOperands(type, stream, ctx, operands) { var _this2 = this; if (Array.isArray(type)) { return operands.map(function (op, i) { return _this2.encodeOperands(type[i], stream, ctx, op)[0]; }); } else if (type.encode != null) { return type.encode(stream, operands, ctx); } else if (typeof operands === 'number') { return [operands]; } else if (typeof operands === 'boolean') { return [+operands]; } else if (Array.isArray(operands)) { return operands; } else { return [operands]; } }; CFFDict.prototype.decode = function decode(stream, parent) { var end = stream.pos + parent.length; var ret = {}; var operands = []; // define hidden properties _Object$defineProperties(ret, { parent: { value: parent }, _startOffset: { value: stream.pos } }); // fill in defaults for (var key in this.fields) { var field = this.fields[key]; ret[field[1]] = field[3]; } while (stream.pos < end) { var b = stream.readUInt8(); if (b < 28) { if (b === 12) { b = b << 8 | stream.readUInt8(); } var _field = this.fields[b]; if (!_field) { throw new Error('Unknown operator ' + b); } var val = this.decodeOperands(_field[2], stream, ret, operands); if (val != null) { if (val instanceof restructure_src_utils.PropertyDescriptor) { _Object$defineProperty(ret, _field[1], val); } else { ret[_field[1]] = val; } } operands = []; } else { operands.push(CFFOperand.decode(stream, b)); } } return ret; }; CFFDict.prototype.size = function size(dict, parent) { var includePointers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; var ctx = { parent: parent, val: dict, pointerSize: 0, startOffset: parent.startOffset || 0 }; var len = 0; for (var k in this.fields) { var field = this.fields[k]; var val = dict[field[1]]; if (val == null || isEqual(val, field[3])) { continue; } var operands = this.encodeOperands(field[2], null, ctx, val); for (var _iterator2 = operands, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _getIterator(_iterator2);;) { var _ref2; if (_isArray2) { if (_i2 >= _iterator2.length) break; _ref2 = _iterator2[_i2++]; } else { _i2 = _iterator2.next(); if (_i2.done) break; _ref2 = _i2.value; } var op = _ref2; len += CFFOperand.size(op); } var key = Array.isArray(field[0]) ? field[0] : [field[0]]; len += key.length; } if (includePointers) { len += ctx.pointerSize; } return len; }; CFFDict.prototype.encode = function encode(stream, dict, parent) { var ctx = { pointers: [], startOffset: stream.pos, parent: parent, val: dict, pointerSize: 0 }; ctx.pointerOffset = stream.pos + this.size(dict, ctx, false); for (var _iterator3 = this.ops, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _getIterator(_iterator3);;) { var _ref3; if (_isArray3) { if (_i3 >= _iterator3.length) break; _ref3 = _iterator3[_i3++]; } else { _i3 = _iterator3.next(); if (_i3.done) break; _ref3 = _i3.value; } var field = _ref3; var val = dict[field[1]]; if (val == null || isEqual(val, field[3])) { continue; } var operands = this.encodeOperands(field[2], stream, ctx, val); for (var _iterator4 = operands, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _getIterator(_iterator4);;) { var _ref4; if (_isArray4) { if (_i4 >= _iterator4.length) break; _ref4 = _iterator4[_i4++]; } else { _i4 = _iterator4.next(); if (_i4.done) break; _ref4 = _i4.value; } var op = _ref4; CFFOperand.encode(stream, op); } var key = Array.isArray(field[0]) ? field[0] : [field[0]]; for (var _iterator5 = key, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _getIterator(_iterator5);;) { var _ref5; if (_isArray5) { if (_i5 >= _iterator5.length) break; _ref5 = _iterator5[_i5++]; } else { _i5 = _iterator5.next(); if (_i5.done) break; _ref5 = _i5.value; } var _op = _ref5; stream.writeUInt8(_op); } } var i = 0; while (i < ctx.pointers.length) { var ptr = ctx.pointers[i++]; ptr.type.encode(stream, ptr.val, ptr.parent); } return; }; return CFFDict; }(); var CFFPointer = function (_r$Pointer) { _inherits(CFFPointer, _r$Pointer); function CFFPointer(type) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, CFFPointer); if (options.type == null) { options.type = 'global'; } return _possibleConstructorReturn(this, _r$Pointer.call(this, null, type, options)); } CFFPointer.prototype.decode = function decode(stream, parent, operands) { this.offsetType = { decode: function decode() { return operands[0]; } }; return _r$Pointer.prototype.decode.call(this, stream, parent, operands); }; CFFPointer.prototype.encode = function encode(stream, value, ctx) { if (!stream) { // compute the size (so ctx.pointerSize is correct) this.offsetType = { size: function size() { return 0; } }; this.size(value, ctx); return [new Ptr(0)]; } var ptr = null; this.offsetType = { encode: function encode(stream, val) { return ptr = val; } }; _r$Pointer.prototype.encode.call(this, stream, value, ctx); return [new Ptr(ptr)]; }; return CFFPointer; }(r.Pointer); var Ptr = function () { function Ptr(val) { _classCallCheck(this, Ptr); this.val = val; this.forceLarge = true; } Ptr.prototype.valueOf = function valueOf() { return this.val; }; return Ptr; }(); var CFFBlendOp = function () { function CFFBlendOp() { _classCallCheck(this, CFFBlendOp); } CFFBlendOp.decode = function decode(stream, parent, operands) { var numBlends = operands.pop(); // TODO: actually blend. For now just consume the deltas // since we don't use any of the values anyway. while (operands.length > numBlends) { operands.pop(); } }; return CFFBlendOp; }(); var CFFPrivateDict = new CFFDict([ // key name type default [6, 'BlueValues', 'delta', null], [7, 'OtherBlues', 'delta', null], [8, 'FamilyBlues', 'delta', null], [9, 'FamilyOtherBlues', 'delta', null], [[12, 9], 'BlueScale', 'number', 0.039625], [[12, 10], 'BlueShift', 'number', 7], [[12, 11], 'BlueFuzz', 'number', 1], [10, 'StdHW', 'number', null], [11, 'StdVW', 'number', null], [[12, 12], 'StemSnapH', 'delta', null], [[12, 13], 'StemSnapV', 'delta', null], [[12, 14], 'ForceBold', 'boolean', false], [[12, 17], 'LanguageGroup', 'number', 0], [[12, 18], 'ExpansionFactor', 'number', 0.06], [[12, 19], 'initialRandomSeed', 'number', 0], [20, 'defaultWidthX', 'number', 0], [21, 'nominalWidthX', 'number', 0], [22, 'vsindex', 'number', 0], [23, 'blend', CFFBlendOp, null], [19, 'Subrs', new CFFPointer(new CFFIndex(), { type: 'local' }), null]]); // Automatically generated from Appendix A of the CFF specification; do // not edit. Length should be 391. var standardStrings = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold"]; var StandardEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nin