pdfjs-dist 2.1.266 → 2.5.207

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.

Potentially problematic release.


This version of pdfjs-dist might be problematic. Click here for more details.

Files changed (191) hide show
  1. package/CODE_OF_CONDUCT.md +15 -0
  2. package/README.md +4 -0
  3. package/bower.json +1 -1
  4. package/build/pdf.js +8382 -18492
  5. package/build/pdf.js.map +1 -1
  6. package/build/pdf.min.js +22 -1
  7. package/build/pdf.worker.entry.js +5 -3
  8. package/build/pdf.worker.js +20417 -29816
  9. package/build/pdf.worker.js.map +1 -1
  10. package/build/pdf.worker.min.js +22 -1
  11. package/es5/build/pdf.js +25688 -0
  12. package/es5/build/pdf.js.map +1 -0
  13. package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
  14. package/es5/build/pdf.worker.js +58239 -0
  15. package/es5/build/pdf.worker.js.map +1 -0
  16. package/es5/web/images/annotation-check.svg +11 -0
  17. package/es5/web/images/annotation-comment.svg +16 -0
  18. package/es5/web/images/annotation-help.svg +26 -0
  19. package/es5/web/images/annotation-insert.svg +10 -0
  20. package/es5/web/images/annotation-key.svg +11 -0
  21. package/es5/web/images/annotation-newparagraph.svg +11 -0
  22. package/es5/web/images/annotation-noicon.svg +7 -0
  23. package/es5/web/images/annotation-note.svg +42 -0
  24. package/es5/web/images/annotation-paragraph.svg +16 -0
  25. package/es5/web/images/loading-icon.gif +0 -0
  26. package/es5/web/images/shadow.png +0 -0
  27. package/es5/web/images/texture.png +0 -0
  28. package/es5/web/pdf_viewer.css +403 -0
  29. package/es5/web/pdf_viewer.js +7742 -0
  30. package/es5/web/pdf_viewer.js.map +1 -0
  31. package/image_decoders/pdf.image_decoders.js +1475 -4897
  32. package/image_decoders/pdf.image_decoders.js.map +1 -1
  33. package/image_decoders/pdf.image_decoders.min.js +22 -1
  34. package/lib/README.md +7 -0
  35. package/lib/core/annotation.js +750 -899
  36. package/lib/core/arithmetic_decoder.js +81 -97
  37. package/lib/core/bidi.js +54 -46
  38. package/lib/core/ccitt.js +88 -81
  39. package/lib/core/ccitt_stream.js +15 -14
  40. package/lib/core/cff_parser.js +235 -183
  41. package/lib/core/charsets.js +4 -4
  42. package/lib/core/chunked_stream.js +447 -542
  43. package/lib/core/cmap.js +222 -264
  44. package/lib/core/colorspace.js +699 -863
  45. package/lib/core/core_utils.js +152 -0
  46. package/lib/core/crypto.js +379 -437
  47. package/lib/core/document.js +573 -660
  48. package/lib/core/encodings.js +15 -15
  49. package/lib/core/evaluator.js +1103 -868
  50. package/lib/core/font_renderer.js +135 -178
  51. package/lib/core/fonts.js +570 -491
  52. package/lib/core/function.js +291 -288
  53. package/lib/core/glyphlist.js +4527 -4526
  54. package/lib/core/image.js +145 -149
  55. package/lib/core/image_utils.js +170 -0
  56. package/lib/core/jbig2.js +325 -316
  57. package/lib/core/jbig2_stream.js +18 -17
  58. package/lib/core/jpeg_stream.js +21 -26
  59. package/lib/core/jpg.js +284 -232
  60. package/lib/core/jpx.js +161 -143
  61. package/lib/core/jpx_stream.js +28 -28
  62. package/lib/core/metrics.js +2929 -2929
  63. package/lib/core/murmurhash3.js +90 -101
  64. package/lib/core/obj.js +1183 -1157
  65. package/lib/core/operator_list.js +99 -67
  66. package/lib/core/parser.js +972 -911
  67. package/lib/core/pattern.js +87 -70
  68. package/lib/core/pdf_manager.js +150 -315
  69. package/lib/core/primitives.js +83 -56
  70. package/lib/core/ps_parser.js +175 -214
  71. package/lib/core/standard_fonts.js +237 -236
  72. package/lib/core/stream.js +94 -74
  73. package/lib/core/type1_parser.js +87 -69
  74. package/lib/core/unicode.js +1654 -1654
  75. package/lib/core/worker.js +193 -390
  76. package/lib/core/worker_stream.js +168 -0
  77. package/lib/display/annotation_layer.js +741 -972
  78. package/lib/display/api.js +1500 -1791
  79. package/lib/display/api_compatibility.js +12 -17
  80. package/lib/display/canvas.js +165 -165
  81. package/lib/display/content_disposition.js +40 -59
  82. package/lib/display/display_utils.js +515 -0
  83. package/lib/display/fetch_stream.js +183 -298
  84. package/lib/display/font_loader.js +273 -413
  85. package/lib/display/metadata.js +86 -98
  86. package/lib/display/network.js +266 -359
  87. package/lib/display/network_utils.js +25 -18
  88. package/lib/display/node_stream.js +285 -458
  89. package/lib/display/pattern_helper.js +113 -65
  90. package/lib/display/svg.js +1166 -901
  91. package/lib/display/text_layer.js +156 -132
  92. package/lib/display/transport_stream.js +262 -278
  93. package/lib/display/webgl.js +70 -83
  94. package/lib/display/worker_options.js +3 -3
  95. package/lib/display/xml_parser.js +303 -392
  96. package/lib/examples/node/domstubs.js +40 -37
  97. package/lib/pdf.js +226 -59
  98. package/lib/pdf.worker.js +14 -6
  99. package/lib/shared/compatibility.js +3 -246
  100. package/lib/shared/is_node.js +7 -6
  101. package/lib/shared/message_handler.js +327 -332
  102. package/lib/shared/util.js +266 -416
  103. package/lib/test/unit/annotation_spec.js +1555 -701
  104. package/lib/test/unit/api_spec.js +802 -604
  105. package/lib/test/unit/bidi_spec.js +7 -7
  106. package/lib/test/unit/cff_parser_spec.js +84 -69
  107. package/lib/test/unit/clitests_helper.js +7 -9
  108. package/lib/test/unit/cmap_spec.js +74 -76
  109. package/lib/test/unit/colorspace_spec.js +166 -161
  110. package/lib/test/unit/core_utils_spec.js +211 -0
  111. package/lib/test/unit/crypto_spec.js +181 -181
  112. package/lib/test/unit/custom_spec.js +20 -22
  113. package/lib/test/unit/display_svg_spec.js +34 -39
  114. package/lib/test/unit/display_utils_spec.js +263 -0
  115. package/lib/test/unit/document_spec.js +16 -21
  116. package/lib/test/unit/encodings_spec.js +12 -34
  117. package/lib/test/unit/evaluator_spec.js +83 -83
  118. package/lib/test/unit/fetch_stream_spec.js +111 -0
  119. package/lib/test/unit/function_spec.js +206 -204
  120. package/lib/test/unit/jasmine-boot.js +46 -30
  121. package/lib/test/unit/message_handler_spec.js +173 -159
  122. package/lib/test/unit/metadata_spec.js +69 -69
  123. package/lib/test/unit/murmurhash3_spec.js +12 -12
  124. package/lib/test/unit/network_spec.js +13 -61
  125. package/lib/test/unit/network_utils_spec.js +183 -119
  126. package/lib/test/unit/node_stream_spec.js +78 -92
  127. package/lib/test/unit/parser_spec.js +172 -114
  128. package/lib/test/unit/pdf_find_controller_spec.js +55 -86
  129. package/lib/test/unit/pdf_find_utils_spec.js +32 -32
  130. package/lib/test/unit/pdf_history_spec.js +32 -32
  131. package/lib/test/unit/primitives_spec.js +140 -125
  132. package/lib/test/unit/stream_spec.js +16 -14
  133. package/lib/test/unit/test_utils.js +131 -143
  134. package/lib/test/unit/testreporter.js +19 -19
  135. package/lib/test/unit/type1_parser_spec.js +42 -42
  136. package/lib/test/unit/ui_utils_spec.js +297 -459
  137. package/lib/test/unit/unicode_spec.js +38 -38
  138. package/lib/test/unit/util_spec.js +121 -305
  139. package/lib/web/annotation_layer_builder.js +66 -103
  140. package/lib/web/app.js +1328 -1214
  141. package/lib/web/app_options.js +105 -107
  142. package/lib/web/base_viewer.js +824 -838
  143. package/lib/web/chromecom.js +165 -252
  144. package/lib/web/debugger.js +149 -205
  145. package/lib/web/download_manager.js +39 -55
  146. package/lib/web/firefox_print_service.js +37 -27
  147. package/lib/web/firefoxcom.js +212 -363
  148. package/lib/web/genericcom.js +26 -108
  149. package/lib/web/genericl10n.js +24 -153
  150. package/lib/web/grab_to_pan.js +32 -30
  151. package/lib/web/interfaces.js +80 -254
  152. package/lib/web/overlay_manager.js +70 -246
  153. package/lib/web/password_prompt.js +38 -64
  154. package/lib/web/pdf_attachment_viewer.js +113 -131
  155. package/lib/web/pdf_cursor_tools.js +75 -102
  156. package/lib/web/pdf_document_properties.js +221 -306
  157. package/lib/web/pdf_find_bar.js +136 -170
  158. package/lib/web/pdf_find_controller.js +491 -548
  159. package/lib/web/pdf_find_utils.js +13 -13
  160. package/lib/web/pdf_history.js +397 -406
  161. package/lib/web/pdf_link_service.js +304 -348
  162. package/lib/web/pdf_outline_viewer.js +140 -175
  163. package/lib/web/pdf_page_view.js +452 -523
  164. package/lib/web/pdf_presentation_mode.js +308 -357
  165. package/lib/web/pdf_print_service.js +90 -104
  166. package/lib/web/pdf_rendering_queue.js +84 -108
  167. package/lib/web/pdf_sidebar.js +276 -306
  168. package/lib/web/pdf_sidebar_resizer.js +92 -119
  169. package/lib/web/pdf_single_page_viewer.js +77 -126
  170. package/lib/web/pdf_thumbnail_view.js +276 -297
  171. package/lib/web/pdf_thumbnail_viewer.js +186 -206
  172. package/lib/web/pdf_viewer.component.js +20 -21
  173. package/lib/web/pdf_viewer.js +55 -115
  174. package/lib/web/preferences.js +82 -286
  175. package/lib/web/secondary_toolbar.js +164 -196
  176. package/lib/web/text_layer_builder.js +282 -339
  177. package/lib/web/toolbar.js +217 -210
  178. package/lib/web/ui_utils.js +267 -420
  179. package/lib/web/view_history.js +52 -226
  180. package/lib/web/viewer_compatibility.js +21 -6
  181. package/package.json +2 -9
  182. package/web/pdf_viewer.css +35 -25
  183. package/web/pdf_viewer.js +3489 -4855
  184. package/web/pdf_viewer.js.map +1 -1
  185. package/webpack.js +14 -5
  186. package/external/streams/streams-lib.js +0 -3962
  187. package/external/url/url-lib.js +0 -627
  188. package/lib/display/dom_utils.js +0 -494
  189. package/lib/shared/streams_polyfill.js +0 -43
  190. package/lib/shared/url_polyfill.js +0 -56
  191. package/lib/test/unit/dom_utils_spec.js +0 -89
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2018 Mozilla Foundation
5
+ * Copyright 2020 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -26,223 +26,224 @@ Object.defineProperty(exports, "__esModule", {
26
26
  });
27
27
  exports.CFFFDSelect = exports.CFFCompiler = exports.CFFPrivateDict = exports.CFFTopDict = exports.CFFCharset = exports.CFFIndex = exports.CFFStrings = exports.CFFHeader = exports.CFF = exports.CFFParser = exports.CFFStandardStrings = void 0;
28
28
 
29
- var _util = require("../shared/util");
29
+ var _util = require("../shared/util.js");
30
30
 
31
- var _charsets = require("./charsets");
31
+ var _charsets = require("./charsets.js");
32
32
 
33
- var _encodings = require("./encodings");
33
+ var _encodings = require("./encodings.js");
34
34
 
35
35
  var MAX_SUBR_NESTING = 10;
36
- var CFFStandardStrings = ['.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'];
36
+ var CFFStandardStrings = [".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"];
37
37
  exports.CFFStandardStrings = CFFStandardStrings;
38
+ const NUM_STANDARD_CFF_STRINGS = 391;
38
39
 
39
40
  var CFFParser = function CFFParserClosure() {
40
41
  var CharstringValidationData = [null, {
41
- id: 'hstem',
42
+ id: "hstem",
42
43
  min: 2,
43
44
  stackClearing: true,
44
45
  stem: true
45
46
  }, null, {
46
- id: 'vstem',
47
+ id: "vstem",
47
48
  min: 2,
48
49
  stackClearing: true,
49
50
  stem: true
50
51
  }, {
51
- id: 'vmoveto',
52
+ id: "vmoveto",
52
53
  min: 1,
53
54
  stackClearing: true
54
55
  }, {
55
- id: 'rlineto',
56
+ id: "rlineto",
56
57
  min: 2,
57
58
  resetStack: true
58
59
  }, {
59
- id: 'hlineto',
60
+ id: "hlineto",
60
61
  min: 1,
61
62
  resetStack: true
62
63
  }, {
63
- id: 'vlineto',
64
+ id: "vlineto",
64
65
  min: 1,
65
66
  resetStack: true
66
67
  }, {
67
- id: 'rrcurveto',
68
+ id: "rrcurveto",
68
69
  min: 6,
69
70
  resetStack: true
70
71
  }, null, {
71
- id: 'callsubr',
72
+ id: "callsubr",
72
73
  min: 1,
73
74
  undefStack: true
74
75
  }, {
75
- id: 'return',
76
+ id: "return",
76
77
  min: 0,
77
78
  undefStack: true
78
79
  }, null, null, {
79
- id: 'endchar',
80
+ id: "endchar",
80
81
  min: 0,
81
82
  stackClearing: true
82
83
  }, null, null, null, {
83
- id: 'hstemhm',
84
+ id: "hstemhm",
84
85
  min: 2,
85
86
  stackClearing: true,
86
87
  stem: true
87
88
  }, {
88
- id: 'hintmask',
89
+ id: "hintmask",
89
90
  min: 0,
90
91
  stackClearing: true
91
92
  }, {
92
- id: 'cntrmask',
93
+ id: "cntrmask",
93
94
  min: 0,
94
95
  stackClearing: true
95
96
  }, {
96
- id: 'rmoveto',
97
+ id: "rmoveto",
97
98
  min: 2,
98
99
  stackClearing: true
99
100
  }, {
100
- id: 'hmoveto',
101
+ id: "hmoveto",
101
102
  min: 1,
102
103
  stackClearing: true
103
104
  }, {
104
- id: 'vstemhm',
105
+ id: "vstemhm",
105
106
  min: 2,
106
107
  stackClearing: true,
107
108
  stem: true
108
109
  }, {
109
- id: 'rcurveline',
110
+ id: "rcurveline",
110
111
  min: 8,
111
112
  resetStack: true
112
113
  }, {
113
- id: 'rlinecurve',
114
+ id: "rlinecurve",
114
115
  min: 8,
115
116
  resetStack: true
116
117
  }, {
117
- id: 'vvcurveto',
118
+ id: "vvcurveto",
118
119
  min: 4,
119
120
  resetStack: true
120
121
  }, {
121
- id: 'hhcurveto',
122
+ id: "hhcurveto",
122
123
  min: 4,
123
124
  resetStack: true
124
125
  }, null, {
125
- id: 'callgsubr',
126
+ id: "callgsubr",
126
127
  min: 1,
127
128
  undefStack: true
128
129
  }, {
129
- id: 'vhcurveto',
130
+ id: "vhcurveto",
130
131
  min: 4,
131
132
  resetStack: true
132
133
  }, {
133
- id: 'hvcurveto',
134
+ id: "hvcurveto",
134
135
  min: 4,
135
136
  resetStack: true
136
137
  }];
137
138
  var CharstringValidationData12 = [null, null, null, {
138
- id: 'and',
139
+ id: "and",
139
140
  min: 2,
140
141
  stackDelta: -1
141
142
  }, {
142
- id: 'or',
143
+ id: "or",
143
144
  min: 2,
144
145
  stackDelta: -1
145
146
  }, {
146
- id: 'not',
147
+ id: "not",
147
148
  min: 1,
148
149
  stackDelta: 0
149
150
  }, null, null, null, {
150
- id: 'abs',
151
+ id: "abs",
151
152
  min: 1,
152
153
  stackDelta: 0
153
154
  }, {
154
- id: 'add',
155
+ id: "add",
155
156
  min: 2,
156
157
  stackDelta: -1,
157
158
  stackFn: function stack_div(stack, index) {
158
159
  stack[index - 2] = stack[index - 2] + stack[index - 1];
159
160
  }
160
161
  }, {
161
- id: 'sub',
162
+ id: "sub",
162
163
  min: 2,
163
164
  stackDelta: -1,
164
165
  stackFn: function stack_div(stack, index) {
165
166
  stack[index - 2] = stack[index - 2] - stack[index - 1];
166
167
  }
167
168
  }, {
168
- id: 'div',
169
+ id: "div",
169
170
  min: 2,
170
171
  stackDelta: -1,
171
172
  stackFn: function stack_div(stack, index) {
172
173
  stack[index - 2] = stack[index - 2] / stack[index - 1];
173
174
  }
174
175
  }, null, {
175
- id: 'neg',
176
+ id: "neg",
176
177
  min: 1,
177
178
  stackDelta: 0,
178
179
  stackFn: function stack_div(stack, index) {
179
180
  stack[index - 1] = -stack[index - 1];
180
181
  }
181
182
  }, {
182
- id: 'eq',
183
+ id: "eq",
183
184
  min: 2,
184
185
  stackDelta: -1
185
186
  }, null, null, {
186
- id: 'drop',
187
+ id: "drop",
187
188
  min: 1,
188
189
  stackDelta: -1
189
190
  }, null, {
190
- id: 'put',
191
+ id: "put",
191
192
  min: 2,
192
193
  stackDelta: -2
193
194
  }, {
194
- id: 'get',
195
+ id: "get",
195
196
  min: 1,
196
197
  stackDelta: 0
197
198
  }, {
198
- id: 'ifelse',
199
+ id: "ifelse",
199
200
  min: 4,
200
201
  stackDelta: -3
201
202
  }, {
202
- id: 'random',
203
+ id: "random",
203
204
  min: 0,
204
205
  stackDelta: 1
205
206
  }, {
206
- id: 'mul',
207
+ id: "mul",
207
208
  min: 2,
208
209
  stackDelta: -1,
209
210
  stackFn: function stack_div(stack, index) {
210
211
  stack[index - 2] = stack[index - 2] * stack[index - 1];
211
212
  }
212
213
  }, null, {
213
- id: 'sqrt',
214
+ id: "sqrt",
214
215
  min: 1,
215
216
  stackDelta: 0
216
217
  }, {
217
- id: 'dup',
218
+ id: "dup",
218
219
  min: 1,
219
220
  stackDelta: 1
220
221
  }, {
221
- id: 'exch',
222
+ id: "exch",
222
223
  min: 2,
223
224
  stackDelta: 0
224
225
  }, {
225
- id: 'index',
226
+ id: "index",
226
227
  min: 2,
227
228
  stackDelta: 0
228
229
  }, {
229
- id: 'roll',
230
+ id: "roll",
230
231
  min: 3,
231
232
  stackDelta: -2
232
233
  }, null, null, null, {
233
- id: 'hflex',
234
+ id: "hflex",
234
235
  min: 7,
235
236
  resetStack: true
236
237
  }, {
237
- id: 'flex',
238
+ id: "flex",
238
239
  min: 13,
239
240
  resetStack: true
240
241
  }, {
241
- id: 'hflex1',
242
+ id: "hflex1",
242
243
  min: 9,
243
244
  resetStack: true
244
245
  }, {
245
- id: 'flex1',
246
+ id: "flex1",
246
247
  min: 11,
247
248
  resetStack: true
248
249
  }];
@@ -271,16 +272,16 @@ var CFFParser = function CFFParserClosure() {
271
272
  cff.topDict = topDict;
272
273
  cff.globalSubrIndex = globalSubrIndex.obj;
273
274
  this.parsePrivateDict(cff.topDict);
274
- cff.isCIDFont = topDict.hasName('ROS');
275
- var charStringOffset = topDict.getByName('CharStrings');
275
+ cff.isCIDFont = topDict.hasName("ROS");
276
+ var charStringOffset = topDict.getByName("CharStrings");
276
277
  var charStringIndex = this.parseIndex(charStringOffset).obj;
277
- var fontMatrix = topDict.getByName('FontMatrix');
278
+ var fontMatrix = topDict.getByName("FontMatrix");
278
279
 
279
280
  if (fontMatrix) {
280
281
  properties.fontMatrix = fontMatrix;
281
282
  }
282
283
 
283
- var fontBBox = topDict.getByName('FontBBox');
284
+ var fontBBox = topDict.getByName("FontBBox");
284
285
 
285
286
  if (fontBBox) {
286
287
  properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
@@ -291,7 +292,7 @@ var CFFParser = function CFFParserClosure() {
291
292
  var charset, encoding;
292
293
 
293
294
  if (cff.isCIDFont) {
294
- var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj;
295
+ var fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
295
296
 
296
297
  for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
297
298
  var dictRaw = fdArrayIndex.get(i);
@@ -301,11 +302,11 @@ var CFFParser = function CFFParserClosure() {
301
302
  }
302
303
 
303
304
  encoding = null;
304
- charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, true);
305
- cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), charStringIndex.count);
305
+ charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
306
+ cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
306
307
  } else {
307
- charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, false);
308
- encoding = this.parseEncoding(topDict.getByName('Encoding'), properties, cff.strings, charset.charset);
308
+ charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
309
+ encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
309
310
  }
310
311
 
311
312
  cff.charset = charset;
@@ -333,11 +334,11 @@ var CFFParser = function CFFParserClosure() {
333
334
  }
334
335
 
335
336
  if (offset >= bytesLength) {
336
- throw new _util.FormatError('Invalid CFF header');
337
+ throw new _util.FormatError("Invalid CFF header");
337
338
  }
338
339
 
339
340
  if (offset !== 0) {
340
- (0, _util.info)('cff data is shifted');
341
+ (0, _util.info)("cff data is shifted");
341
342
  bytes = bytes.subarray(offset);
342
343
  this.bytes = bytes;
343
344
  }
@@ -383,9 +384,9 @@ var CFFParser = function CFFParserClosure() {
383
384
  }
384
385
 
385
386
  function parseFloatOperand() {
386
- var str = '';
387
+ var str = "";
387
388
  var eof = 15;
388
- var lookup = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'E', 'E-', null, '-'];
389
+ const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
389
390
  var length = dict.length;
390
391
 
391
392
  while (pos < length) {
@@ -566,7 +567,7 @@ var CFFParser = function CFFParserClosure() {
566
567
 
567
568
  if (!subrsIndex) {
568
569
  validationCommand = CharstringValidationData[value];
569
- (0, _util.warn)('Missing subrsIndex for ' + validationCommand.id);
570
+ (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
570
571
  return false;
571
572
  }
572
573
 
@@ -582,7 +583,7 @@ var CFFParser = function CFFParserClosure() {
582
583
 
583
584
  if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
584
585
  validationCommand = CharstringValidationData[value];
585
- (0, _util.warn)('Out of bounds subrIndex for ' + validationCommand.id);
586
+ (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
586
587
  return false;
587
588
  }
588
589
 
@@ -611,14 +612,14 @@ var CFFParser = function CFFParserClosure() {
611
612
  if (value === 3 || value === 23) {
612
613
  state.hasVStems = true;
613
614
  } else if (state.hasVStems && (value === 1 || value === 18)) {
614
- (0, _util.warn)('CFF stem hints are in wrong order');
615
+ (0, _util.warn)("CFF stem hints are in wrong order");
615
616
  data[j - 1] = value === 1 ? 3 : 23;
616
617
  }
617
618
  }
618
619
 
619
- if ('min' in validationCommand) {
620
+ if ("min" in validationCommand) {
620
621
  if (!state.undefStack && stackSize < validationCommand.min) {
621
- (0, _util.warn)('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min);
622
+ (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
622
623
  return false;
623
624
  }
624
625
  }
@@ -630,7 +631,7 @@ var CFFParser = function CFFParserClosure() {
630
631
  if (stackSize >= 2 && validationCommand.stem) {
631
632
  stackSize %= 2;
632
633
  } else if (stackSize > 1) {
633
- (0, _util.warn)('Found too many parameters for stack-clearing command');
634
+ (0, _util.warn)("Found too many parameters for stack-clearing command");
634
635
  }
635
636
 
636
637
  if (stackSize > 0 && stack[stackSize - 1] >= 0) {
@@ -638,8 +639,8 @@ var CFFParser = function CFFParserClosure() {
638
639
  }
639
640
  }
640
641
 
641
- if ('stackDelta' in validationCommand) {
642
- if ('stackFn' in validationCommand) {
642
+ if ("stackDelta" in validationCommand) {
643
+ if ("stackFn" in validationCommand) {
643
644
  validationCommand.stackFn(stack, stackSize);
644
645
  }
645
646
 
@@ -660,13 +661,15 @@ var CFFParser = function CFFParserClosure() {
660
661
  state.stackSize = stackSize;
661
662
  return true;
662
663
  },
663
- parseCharStrings: function parseCharStrings(_ref) {
664
- var charStrings = _ref.charStrings,
665
- localSubrIndex = _ref.localSubrIndex,
666
- globalSubrIndex = _ref.globalSubrIndex,
667
- fdSelect = _ref.fdSelect,
668
- fdArray = _ref.fdArray,
669
- privateDict = _ref.privateDict;
664
+
665
+ parseCharStrings({
666
+ charStrings,
667
+ localSubrIndex,
668
+ globalSubrIndex,
669
+ fdSelect,
670
+ fdArray,
671
+ privateDict
672
+ }) {
670
673
  var seacs = [];
671
674
  var widths = [];
672
675
  var count = charStrings.count;
@@ -692,12 +695,12 @@ var CFFParser = function CFFParserClosure() {
692
695
  var fdIndex = fdSelect.getFDIndex(i);
693
696
 
694
697
  if (fdIndex === -1) {
695
- (0, _util.warn)('Glyph index is not in fd select.');
698
+ (0, _util.warn)("Glyph index is not in fd select.");
696
699
  valid = false;
697
700
  }
698
701
 
699
702
  if (fdIndex >= fdArray.length) {
700
- (0, _util.warn)('Invalid fd index for glyph index.');
703
+ (0, _util.warn)("Invalid fd index for glyph index.");
701
704
  valid = false;
702
705
  }
703
706
 
@@ -714,10 +717,10 @@ var CFFParser = function CFFParserClosure() {
714
717
  }
715
718
 
716
719
  if (state.width !== null) {
717
- var nominalWidth = privateDictToUse.getByName('nominalWidthX');
720
+ const nominalWidth = privateDictToUse.getByName("nominalWidthX");
718
721
  widths[i] = nominalWidth + state.width;
719
722
  } else {
720
- var defaultWidth = privateDictToUse.getByName('defaultWidthX');
723
+ const defaultWidth = privateDictToUse.getByName("defaultWidthX");
721
724
  widths[i] = defaultWidth;
722
725
  }
723
726
 
@@ -731,26 +734,27 @@ var CFFParser = function CFFParserClosure() {
731
734
  }
732
735
 
733
736
  return {
734
- charStrings: charStrings,
735
- seacs: seacs,
736
- widths: widths
737
+ charStrings,
738
+ seacs,
739
+ widths
737
740
  };
738
741
  },
742
+
739
743
  emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
740
744
  var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
741
745
  parentDict.setByKey(18, [0, 0]);
742
746
  parentDict.privateDict = privateDict;
743
747
  },
744
748
  parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
745
- if (!parentDict.hasName('Private')) {
749
+ if (!parentDict.hasName("Private")) {
746
750
  this.emptyPrivateDictionary(parentDict);
747
751
  return;
748
752
  }
749
753
 
750
- var privateOffset = parentDict.getByName('Private');
754
+ var privateOffset = parentDict.getByName("Private");
751
755
 
752
756
  if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
753
- parentDict.removeByName('Private');
757
+ parentDict.removeByName("Private");
754
758
  return;
755
759
  }
756
760
 
@@ -768,11 +772,11 @@ var CFFParser = function CFFParserClosure() {
768
772
  var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
769
773
  parentDict.privateDict = privateDict;
770
774
 
771
- if (!privateDict.getByName('Subrs')) {
775
+ if (!privateDict.getByName("Subrs")) {
772
776
  return;
773
777
  }
774
778
 
775
- var subrsOffset = privateDict.getByName('Subrs');
779
+ var subrsOffset = privateDict.getByName("Subrs");
776
780
  var relativeOffset = offset + subrsOffset;
777
781
 
778
782
  if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
@@ -795,7 +799,7 @@ var CFFParser = function CFFParserClosure() {
795
799
  var bytes = this.bytes;
796
800
  var start = pos;
797
801
  var format = bytes[pos++];
798
- var charset = ['.notdef'];
802
+ const charset = [cid ? 0 : ".notdef"];
799
803
  var id, count, i;
800
804
  length -= 1;
801
805
 
@@ -833,7 +837,7 @@ var CFFParser = function CFFParserClosure() {
833
837
  break;
834
838
 
835
839
  default:
836
- throw new _util.FormatError('Unknown charset format');
840
+ throw new _util.FormatError("Unknown charset format");
837
841
  }
838
842
 
839
843
  var end = pos;
@@ -899,7 +903,7 @@ var CFFParser = function CFFParserClosure() {
899
903
  break;
900
904
 
901
905
  default:
902
- throw new _util.FormatError("Unknown encoding format: ".concat(format, " in CFF"));
906
+ throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
903
907
  }
904
908
 
905
909
  var dataEnd = pos;
@@ -937,7 +941,7 @@ var CFFParser = function CFFParserClosure() {
937
941
  var first = bytes[pos++] << 8 | bytes[pos++];
938
942
 
939
943
  if (i === 0 && first !== 0) {
940
- (0, _util.warn)('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.');
944
+ (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
941
945
  first = 0;
942
946
  }
943
947
 
@@ -953,11 +957,11 @@ var CFFParser = function CFFParserClosure() {
953
957
  break;
954
958
 
955
959
  default:
956
- throw new _util.FormatError("parseFDSelect: Unknown format \"".concat(format, "\"."));
960
+ throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
957
961
  }
958
962
 
959
963
  if (fdSelect.length !== length) {
960
- throw new _util.FormatError('parseFDSelect: Invalid font data.');
964
+ throw new _util.FormatError("parseFDSelect: Invalid font data.");
961
965
  }
962
966
 
963
967
  return new CFFFDSelect(format, fdSelect);
@@ -986,7 +990,7 @@ var CFF = function CFFClosure() {
986
990
  CFF.prototype = {
987
991
  duplicateFirstGlyph: function CFF_duplicateFirstGlyph() {
988
992
  if (this.charStrings.count >= 65535) {
989
- (0, _util.warn)('Not enough space in charstrings to duplicate first glyph.');
993
+ (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
990
994
  return;
991
995
  }
992
996
 
@@ -1031,16 +1035,31 @@ var CFFStrings = function CFFStringsClosure() {
1031
1035
 
1032
1036
  CFFStrings.prototype = {
1033
1037
  get: function CFFStrings_get(index) {
1034
- if (index >= 0 && index <= 390) {
1038
+ if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
1035
1039
  return CFFStandardStrings[index];
1036
1040
  }
1037
1041
 
1038
- if (index - 391 <= this.strings.length) {
1039
- return this.strings[index - 391];
1042
+ if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
1043
+ return this.strings[index - NUM_STANDARD_CFF_STRINGS];
1040
1044
  }
1041
1045
 
1042
1046
  return CFFStandardStrings[0];
1043
1047
  },
1048
+ getSID: function CFFStrings_getSID(str) {
1049
+ let index = CFFStandardStrings.indexOf(str);
1050
+
1051
+ if (index !== -1) {
1052
+ return index;
1053
+ }
1054
+
1055
+ index = this.strings.indexOf(str);
1056
+
1057
+ if (index !== -1) {
1058
+ return index + NUM_STANDARD_CFF_STRINGS;
1059
+ }
1060
+
1061
+ return -1;
1062
+ },
1044
1063
  add: function CFFStrings_add(value) {
1045
1064
  this.strings.push(value);
1046
1065
  },
@@ -1117,7 +1136,7 @@ var CFFDict = function CFFDictClosure() {
1117
1136
 
1118
1137
  var type = this.types[key];
1119
1138
 
1120
- if (type === 'num' || type === 'sid' || type === 'offset') {
1139
+ if (type === "num" || type === "sid" || type === "offset") {
1121
1140
  value = value[0];
1122
1141
  }
1123
1142
 
@@ -1126,7 +1145,7 @@ var CFFDict = function CFFDictClosure() {
1126
1145
  },
1127
1146
  setByName: function CFFDict_setByName(name, value) {
1128
1147
  if (!(name in this.nameToKeyMap)) {
1129
- throw new _util.FormatError("Invalid dictionary name \"".concat(name, "\""));
1148
+ throw new _util.FormatError(`Invalid dictionary name "${name}"`);
1130
1149
  }
1131
1150
 
1132
1151
  this.values[this.nameToKeyMap[name]] = value;
@@ -1136,7 +1155,7 @@ var CFFDict = function CFFDictClosure() {
1136
1155
  },
1137
1156
  getByName: function CFFDict_getByName(name) {
1138
1157
  if (!(name in this.nameToKeyMap)) {
1139
- throw new _util.FormatError("Invalid dictionary name ".concat(name, "\""));
1158
+ throw new _util.FormatError(`Invalid dictionary name ${name}"`);
1140
1159
  }
1141
1160
 
1142
1161
  var key = this.nameToKeyMap[name];
@@ -1180,7 +1199,7 @@ var CFFDict = function CFFDictClosure() {
1180
1199
  }();
1181
1200
 
1182
1201
  var CFFTopDict = function CFFTopDictClosure() {
1183
- var layout = [[[12, 30], 'ROS', ['sid', 'sid', 'num'], null], [[12, 20], 'SyntheticBase', 'num', null], [0, 'version', 'sid', null], [1, 'Notice', 'sid', null], [[12, 0], 'Copyright', 'sid', null], [2, 'FullName', 'sid', null], [3, 'FamilyName', 'sid', null], [4, 'Weight', 'sid', null], [[12, 1], 'isFixedPitch', 'num', 0], [[12, 2], 'ItalicAngle', 'num', 0], [[12, 3], 'UnderlinePosition', 'num', -100], [[12, 4], 'UnderlineThickness', 'num', 50], [[12, 5], 'PaintType', 'num', 0], [[12, 6], 'CharstringType', 'num', 2], [[12, 7], 'FontMatrix', ['num', 'num', 'num', 'num', 'num', 'num'], [0.001, 0, 0, 0.001, 0, 0]], [13, 'UniqueID', 'num', null], [5, 'FontBBox', ['num', 'num', 'num', 'num'], [0, 0, 0, 0]], [[12, 8], 'StrokeWidth', 'num', 0], [14, 'XUID', 'array', null], [15, 'charset', 'offset', 0], [16, 'Encoding', 'offset', 0], [17, 'CharStrings', 'offset', 0], [18, 'Private', ['offset', 'offset'], null], [[12, 21], 'PostScript', 'sid', null], [[12, 22], 'BaseFontName', 'sid', null], [[12, 23], 'BaseFontBlend', 'delta', null], [[12, 31], 'CIDFontVersion', 'num', 0], [[12, 32], 'CIDFontRevision', 'num', 0], [[12, 33], 'CIDFontType', 'num', 0], [[12, 34], 'CIDCount', 'num', 8720], [[12, 35], 'UIDBase', 'num', null], [[12, 37], 'FDSelect', 'offset', null], [[12, 36], 'FDArray', 'offset', null], [[12, 38], 'FontName', 'sid', null]];
1202
+ var layout = [[[12, 30], "ROS", ["sid", "sid", "num"], null], [[12, 20], "SyntheticBase", "num", null], [0, "version", "sid", null], [1, "Notice", "sid", null], [[12, 0], "Copyright", "sid", null], [2, "FullName", "sid", null], [3, "FamilyName", "sid", null], [4, "Weight", "sid", null], [[12, 1], "isFixedPitch", "num", 0], [[12, 2], "ItalicAngle", "num", 0], [[12, 3], "UnderlinePosition", "num", -100], [[12, 4], "UnderlineThickness", "num", 50], [[12, 5], "PaintType", "num", 0], [[12, 6], "CharstringType", "num", 2], [[12, 7], "FontMatrix", ["num", "num", "num", "num", "num", "num"], [0.001, 0, 0, 0.001, 0, 0]], [13, "UniqueID", "num", null], [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]], [[12, 8], "StrokeWidth", "num", 0], [14, "XUID", "array", null], [15, "charset", "offset", 0], [16, "Encoding", "offset", 0], [17, "CharStrings", "offset", 0], [18, "Private", ["offset", "offset"], null], [[12, 21], "PostScript", "sid", null], [[12, 22], "BaseFontName", "sid", null], [[12, 23], "BaseFontBlend", "delta", null], [[12, 31], "CIDFontVersion", "num", 0], [[12, 32], "CIDFontRevision", "num", 0], [[12, 33], "CIDFontType", "num", 0], [[12, 34], "CIDCount", "num", 8720], [[12, 35], "UIDBase", "num", null], [[12, 37], "FDSelect", "offset", null], [[12, 36], "FDArray", "offset", null], [[12, 38], "FontName", "sid", null]];
1184
1203
  var tables = null;
1185
1204
 
1186
1205
  function CFFTopDict(strings) {
@@ -1199,7 +1218,7 @@ var CFFTopDict = function CFFTopDictClosure() {
1199
1218
  exports.CFFTopDict = CFFTopDict;
1200
1219
 
1201
1220
  var CFFPrivateDict = function CFFPrivateDictClosure() {
1202
- var layout = [[6, 'BlueValues', 'delta', null], [7, 'OtherBlues', 'delta', null], [8, 'FamilyBlues', 'delta', null], [9, 'FamilyOtherBlues', 'delta', null], [[12, 9], 'BlueScale', 'num', 0.039625], [[12, 10], 'BlueShift', 'num', 7], [[12, 11], 'BlueFuzz', 'num', 1], [10, 'StdHW', 'num', null], [11, 'StdVW', 'num', null], [[12, 12], 'StemSnapH', 'delta', null], [[12, 13], 'StemSnapV', 'delta', null], [[12, 14], 'ForceBold', 'num', 0], [[12, 17], 'LanguageGroup', 'num', 0], [[12, 18], 'ExpansionFactor', 'num', 0.06], [[12, 19], 'initialRandomSeed', 'num', 0], [20, 'defaultWidthX', 'num', 0], [21, 'nominalWidthX', 'num', 0], [19, 'Subrs', 'offset', null]];
1221
+ var layout = [[6, "BlueValues", "delta", null], [7, "OtherBlues", "delta", null], [8, "FamilyBlues", "delta", null], [9, "FamilyOtherBlues", "delta", null], [[12, 9], "BlueScale", "num", 0.039625], [[12, 10], "BlueShift", "num", 7], [[12, 11], "BlueFuzz", "num", 1], [10, "StdHW", "num", null], [11, "StdVW", "num", null], [[12, 12], "StemSnapH", "delta", null], [[12, 13], "StemSnapV", "delta", null], [[12, 14], "ForceBold", "num", 0], [[12, 17], "LanguageGroup", "num", 0], [[12, 18], "ExpansionFactor", "num", 0.06], [[12, 19], "initialRandomSeed", "num", 0], [20, "defaultWidthX", "num", 0], [21, "nominalWidthX", "num", 0], [19, "Subrs", "offset", null]];
1203
1222
  var tables = null;
1204
1223
 
1205
1224
  function CFFPrivateDict(strings) {
@@ -1277,7 +1296,7 @@ var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
1277
1296
  },
1278
1297
  track: function CFFOffsetTracker_track(key, location) {
1279
1298
  if (key in this.offsets) {
1280
- throw new _util.FormatError("Already tracking location of ".concat(key));
1299
+ throw new _util.FormatError(`Already tracking location of ${key}`);
1281
1300
  }
1282
1301
 
1283
1302
  this.offsets[key] = location;
@@ -1289,7 +1308,7 @@ var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
1289
1308
  },
1290
1309
  setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
1291
1310
  if (!(key in this.offsets)) {
1292
- throw new _util.FormatError("Not tracking location of ".concat(key));
1311
+ throw new _util.FormatError(`Not tracking location of ${key}`);
1293
1312
  }
1294
1313
 
1295
1314
  var data = output.data;
@@ -1304,15 +1323,15 @@ var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
1304
1323
  var offset4 = offset0 + 4;
1305
1324
 
1306
1325
  if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
1307
- throw new _util.FormatError('writing to an offset that is not empty');
1326
+ throw new _util.FormatError("writing to an offset that is not empty");
1308
1327
  }
1309
1328
 
1310
1329
  var value = values[i];
1311
1330
  data[offset0] = 0x1d;
1312
- data[offset1] = value >> 24 & 0xFF;
1313
- data[offset2] = value >> 16 & 0xFF;
1314
- data[offset3] = value >> 8 & 0xFF;
1315
- data[offset4] = value & 0xFF;
1331
+ data[offset1] = value >> 24 & 0xff;
1332
+ data[offset2] = value >> 16 & 0xff;
1333
+ data[offset3] = value >> 8 & 0xff;
1334
+ data[offset4] = value & 0xff;
1316
1335
  }
1317
1336
  }
1318
1337
  };
@@ -1341,24 +1360,24 @@ var CFFCompiler = function CFFCompilerClosure() {
1341
1360
  output.add(nameIndex);
1342
1361
 
1343
1362
  if (cff.isCIDFont) {
1344
- if (cff.topDict.hasName('FontMatrix')) {
1345
- var base = cff.topDict.getByName('FontMatrix');
1346
- cff.topDict.removeByName('FontMatrix');
1363
+ if (cff.topDict.hasName("FontMatrix")) {
1364
+ var base = cff.topDict.getByName("FontMatrix");
1365
+ cff.topDict.removeByName("FontMatrix");
1347
1366
 
1348
1367
  for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
1349
1368
  var subDict = cff.fdArray[i];
1350
1369
  var matrix = base.slice(0);
1351
1370
 
1352
- if (subDict.hasName('FontMatrix')) {
1353
- matrix = _util.Util.transform(matrix, subDict.getByName('FontMatrix'));
1371
+ if (subDict.hasName("FontMatrix")) {
1372
+ matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
1354
1373
  }
1355
1374
 
1356
- subDict.setByName('FontMatrix', matrix);
1375
+ subDict.setByName("FontMatrix", matrix);
1357
1376
  }
1358
1377
  }
1359
1378
  }
1360
1379
 
1361
- cff.topDict.setByName('charset', 0);
1380
+ cff.topDict.setByName("charset", 0);
1362
1381
  var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
1363
1382
  output.add(compiled.output);
1364
1383
  var topDictTracker = compiled.trackers[0];
@@ -1367,29 +1386,29 @@ var CFFCompiler = function CFFCompilerClosure() {
1367
1386
  var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
1368
1387
  output.add(globalSubrIndex);
1369
1388
 
1370
- if (cff.encoding && cff.topDict.hasName('Encoding')) {
1389
+ if (cff.encoding && cff.topDict.hasName("Encoding")) {
1371
1390
  if (cff.encoding.predefined) {
1372
- topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], output);
1391
+ topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
1373
1392
  } else {
1374
1393
  var encoding = this.compileEncoding(cff.encoding);
1375
- topDictTracker.setEntryLocation('Encoding', [output.length], output);
1394
+ topDictTracker.setEntryLocation("Encoding", [output.length], output);
1376
1395
  output.add(encoding);
1377
1396
  }
1378
1397
  }
1379
1398
 
1380
- var charset = this.compileCharset(cff.charset);
1381
- topDictTracker.setEntryLocation('charset', [output.length], output);
1399
+ var charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
1400
+ topDictTracker.setEntryLocation("charset", [output.length], output);
1382
1401
  output.add(charset);
1383
1402
  var charStrings = this.compileCharStrings(cff.charStrings);
1384
- topDictTracker.setEntryLocation('CharStrings', [output.length], output);
1403
+ topDictTracker.setEntryLocation("CharStrings", [output.length], output);
1385
1404
  output.add(charStrings);
1386
1405
 
1387
1406
  if (cff.isCIDFont) {
1388
- topDictTracker.setEntryLocation('FDSelect', [output.length], output);
1407
+ topDictTracker.setEntryLocation("FDSelect", [output.length], output);
1389
1408
  var fdSelect = this.compileFDSelect(cff.fdSelect);
1390
1409
  output.add(fdSelect);
1391
1410
  compiled = this.compileTopDicts(cff.fdArray, output.length, true);
1392
- topDictTracker.setEntryLocation('FDArray', [output.length], output);
1411
+ topDictTracker.setEntryLocation("FDArray", [output.length], output);
1393
1412
  output.add(compiled.output);
1394
1413
  var fontDictTrackers = compiled.trackers;
1395
1414
  this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
@@ -1411,28 +1430,28 @@ var CFFCompiler = function CFFCompilerClosure() {
1411
1430
  var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
1412
1431
 
1413
1432
  if (m) {
1414
- var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
1433
+ var epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
1415
1434
  value = (Math.round(num * epsilon) / epsilon).toString();
1416
1435
  }
1417
1436
 
1418
- var nibbles = '';
1437
+ var nibbles = "";
1419
1438
  var i, ii;
1420
1439
 
1421
1440
  for (i = 0, ii = value.length; i < ii; ++i) {
1422
1441
  var a = value[i];
1423
1442
 
1424
- if (a === 'e') {
1425
- nibbles += value[++i] === '-' ? 'c' : 'b';
1426
- } else if (a === '.') {
1427
- nibbles += 'a';
1428
- } else if (a === '-') {
1429
- nibbles += 'e';
1443
+ if (a === "e") {
1444
+ nibbles += value[++i] === "-" ? "c" : "b";
1445
+ } else if (a === ".") {
1446
+ nibbles += "a";
1447
+ } else if (a === "-") {
1448
+ nibbles += "e";
1430
1449
  } else {
1431
1450
  nibbles += a;
1432
1451
  }
1433
1452
  }
1434
1453
 
1435
- nibbles += nibbles.length & 1 ? 'f' : 'ff';
1454
+ nibbles += nibbles.length & 1 ? "f" : "ff";
1436
1455
  var out = [30];
1437
1456
 
1438
1457
  for (i = 0, ii = nibbles.length; i < ii; i += 2) {
@@ -1448,14 +1467,14 @@ var CFFCompiler = function CFFCompilerClosure() {
1448
1467
  code = [value + 139];
1449
1468
  } else if (value >= 108 && value <= 1131) {
1450
1469
  value = value - 108;
1451
- code = [(value >> 8) + 247, value & 0xFF];
1470
+ code = [(value >> 8) + 247, value & 0xff];
1452
1471
  } else if (value >= -1131 && value <= -108) {
1453
1472
  value = -value - 108;
1454
- code = [(value >> 8) + 251, value & 0xFF];
1473
+ code = [(value >> 8) + 251, value & 0xff];
1455
1474
  } else if (value >= -32768 && value <= 32767) {
1456
- code = [0x1c, value >> 8 & 0xFF, value & 0xFF];
1475
+ code = [0x1c, value >> 8 & 0xff, value & 0xff];
1457
1476
  } else {
1458
- code = [0x1d, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF];
1477
+ code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
1459
1478
  }
1460
1479
 
1461
1480
  return code;
@@ -1474,17 +1493,17 @@ var CFFCompiler = function CFFCompilerClosure() {
1474
1493
  for (var j = 0; j < length; j++) {
1475
1494
  var char = name[j];
1476
1495
 
1477
- if (char < '!' || char > '~' || char === '[' || char === ']' || char === '(' || char === ')' || char === '{' || char === '}' || char === '<' || char === '>' || char === '/' || char === '%') {
1478
- char = '_';
1496
+ if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
1497
+ char = "_";
1479
1498
  }
1480
1499
 
1481
1500
  sanitizedName[j] = char;
1482
1501
  }
1483
1502
 
1484
- sanitizedName = sanitizedName.join('');
1503
+ sanitizedName = sanitizedName.join("");
1485
1504
 
1486
- if (sanitizedName === '') {
1487
- sanitizedName = 'Bad_Font_Name';
1505
+ if (sanitizedName === "") {
1506
+ sanitizedName = "Bad_Font_Name";
1488
1507
  }
1489
1508
 
1490
1509
  nameIndex.add((0, _util.stringToBytes)(sanitizedName));
@@ -1500,11 +1519,11 @@ var CFFCompiler = function CFFCompilerClosure() {
1500
1519
  var fontDict = dicts[i];
1501
1520
 
1502
1521
  if (removeCidKeys) {
1503
- fontDict.removeByName('CIDFontVersion');
1504
- fontDict.removeByName('CIDFontRevision');
1505
- fontDict.removeByName('CIDFontType');
1506
- fontDict.removeByName('CIDCount');
1507
- fontDict.removeByName('UIDBase');
1522
+ fontDict.removeByName("CIDFontVersion");
1523
+ fontDict.removeByName("CIDFontRevision");
1524
+ fontDict.removeByName("CIDFontType");
1525
+ fontDict.removeByName("CIDCount");
1526
+ fontDict.removeByName("UIDBase");
1508
1527
  }
1509
1528
 
1510
1529
  var fontDictTracker = new CFFOffsetTracker();
@@ -1525,8 +1544,8 @@ var CFFCompiler = function CFFCompilerClosure() {
1525
1544
  var fontDict = dicts[i];
1526
1545
  var privateDict = fontDict.privateDict;
1527
1546
 
1528
- if (!privateDict || !fontDict.hasName('Private')) {
1529
- throw new _util.FormatError('There must be a private dictionary.');
1547
+ if (!privateDict || !fontDict.hasName("Private")) {
1548
+ throw new _util.FormatError("There must be a private dictionary.");
1530
1549
  }
1531
1550
 
1532
1551
  var privateDictTracker = new CFFOffsetTracker();
@@ -1538,12 +1557,12 @@ var CFFCompiler = function CFFCompilerClosure() {
1538
1557
  outputLength = 0;
1539
1558
  }
1540
1559
 
1541
- trackers[i].setEntryLocation('Private', [privateDictData.length, outputLength], output);
1560
+ trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
1542
1561
  output.add(privateDictData);
1543
1562
 
1544
- if (privateDict.subrsIndex && privateDict.hasName('Subrs')) {
1563
+ if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
1545
1564
  var subrs = this.compileIndex(privateDict.subrsIndex);
1546
- privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], output);
1565
+ privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
1547
1566
  output.add(subrs);
1548
1567
  }
1549
1568
  }
@@ -1579,12 +1598,12 @@ var CFFCompiler = function CFFCompilerClosure() {
1579
1598
  var value = values[j];
1580
1599
 
1581
1600
  switch (type) {
1582
- case 'num':
1583
- case 'sid':
1601
+ case "num":
1602
+ case "sid":
1584
1603
  out = out.concat(this.encodeNumber(value));
1585
1604
  break;
1586
1605
 
1587
- case 'offset':
1606
+ case "offset":
1588
1607
  var name = dict.keyToNameMap[key];
1589
1608
 
1590
1609
  if (!offsetTracker.isTracking(name)) {
@@ -1594,8 +1613,8 @@ var CFFCompiler = function CFFCompilerClosure() {
1594
1613
  out = out.concat([0x1d, 0, 0, 0, 0]);
1595
1614
  break;
1596
1615
 
1597
- case 'array':
1598
- case 'delta':
1616
+ case "array":
1617
+ case "delta":
1599
1618
  out = out.concat(this.encodeNumber(value));
1600
1619
 
1601
1620
  for (var k = 1, kk = values.length; k < kk; ++k) {
@@ -1605,7 +1624,7 @@ var CFFCompiler = function CFFCompilerClosure() {
1605
1624
  break;
1606
1625
 
1607
1626
  default:
1608
- throw new _util.FormatError("Unknown data type of ".concat(type));
1627
+ throw new _util.FormatError(`Unknown data type of ${type}`);
1609
1628
  }
1610
1629
  }
1611
1630
 
@@ -1634,7 +1653,7 @@ var CFFCompiler = function CFFCompilerClosure() {
1634
1653
  var glyph = charStrings.get(i);
1635
1654
 
1636
1655
  if (glyph.length === 0) {
1637
- charStringsIndex.add(new Uint8Array([0x8B, 0x0E]));
1656
+ charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
1638
1657
  continue;
1639
1658
  }
1640
1659
 
@@ -1643,17 +1662,50 @@ var CFFCompiler = function CFFCompilerClosure() {
1643
1662
 
1644
1663
  return this.compileIndex(charStringsIndex);
1645
1664
  },
1646
- compileCharset: function CFFCompiler_compileCharset(charset) {
1647
- var length = 1 + (this.cff.charStrings.count - 1) * 2;
1648
- var out = new Uint8Array(length);
1665
+ compileCharset: function CFFCompiler_compileCharset(charset, numGlyphs, strings, isCIDFont) {
1666
+ let out;
1667
+ const numGlyphsLessNotDef = numGlyphs - 1;
1668
+
1669
+ if (isCIDFont) {
1670
+ out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
1671
+ } else {
1672
+ const length = 1 + numGlyphsLessNotDef * 2;
1673
+ out = new Uint8Array(length);
1674
+ out[0] = 0;
1675
+ let charsetIndex = 0;
1676
+ const numCharsets = charset.charset.length;
1677
+ let warned = false;
1678
+
1679
+ for (let i = 1; i < out.length; i += 2) {
1680
+ let sid = 0;
1681
+
1682
+ if (charsetIndex < numCharsets) {
1683
+ const name = charset.charset[charsetIndex++];
1684
+ sid = strings.getSID(name);
1685
+
1686
+ if (sid === -1) {
1687
+ sid = 0;
1688
+
1689
+ if (!warned) {
1690
+ warned = true;
1691
+ (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
1692
+ }
1693
+ }
1694
+ }
1695
+
1696
+ out[i] = sid >> 8 & 0xff;
1697
+ out[i + 1] = sid & 0xff;
1698
+ }
1699
+ }
1700
+
1649
1701
  return this.compileTypedArray(out);
1650
1702
  },
1651
1703
  compileEncoding: function CFFCompiler_compileEncoding(encoding) {
1652
1704
  return this.compileTypedArray(encoding.raw);
1653
1705
  },
1654
1706
  compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
1655
- var format = fdSelect.format;
1656
- var out, i;
1707
+ const format = fdSelect.format;
1708
+ let out, i;
1657
1709
 
1658
1710
  switch (format) {
1659
1711
  case 0:
@@ -1667,23 +1719,23 @@ var CFFCompiler = function CFFCompilerClosure() {
1667
1719
  break;
1668
1720
 
1669
1721
  case 3:
1670
- var start = 0;
1671
- var lastFD = fdSelect.fdSelect[0];
1672
- var ranges = [format, 0, 0, start >> 8 & 0xFF, start & 0xFF, lastFD];
1722
+ const start = 0;
1723
+ let lastFD = fdSelect.fdSelect[0];
1724
+ const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
1673
1725
 
1674
1726
  for (i = 1; i < fdSelect.fdSelect.length; i++) {
1675
- var currentFD = fdSelect.fdSelect[i];
1727
+ const currentFD = fdSelect.fdSelect[i];
1676
1728
 
1677
1729
  if (currentFD !== lastFD) {
1678
- ranges.push(i >> 8 & 0xFF, i & 0xFF, currentFD);
1730
+ ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
1679
1731
  lastFD = currentFD;
1680
1732
  }
1681
1733
  }
1682
1734
 
1683
- var numRanges = (ranges.length - 3) / 3;
1684
- ranges[1] = numRanges >> 8 & 0xFF;
1685
- ranges[2] = numRanges & 0xFF;
1686
- ranges.push(i >> 8 & 0xFF, i & 0xFF);
1735
+ const numRanges = (ranges.length - 3) / 3;
1736
+ ranges[1] = numRanges >> 8 & 0xff;
1737
+ ranges[2] = numRanges & 0xff;
1738
+ ranges.push(i >> 8 & 0xff, i & 0xff);
1687
1739
  out = new Uint8Array(ranges);
1688
1740
  break;
1689
1741
  }
@@ -1708,7 +1760,7 @@ var CFFCompiler = function CFFCompilerClosure() {
1708
1760
  return [0, 0, 0];
1709
1761
  }
1710
1762
 
1711
- var data = [count >> 8 & 0xFF, count & 0xff];
1763
+ var data = [count >> 8 & 0xff, count & 0xff];
1712
1764
  var lastOffset = 1,
1713
1765
  i;
1714
1766
 
@@ -1733,13 +1785,13 @@ var CFFCompiler = function CFFCompilerClosure() {
1733
1785
 
1734
1786
  for (i = 0; i < count + 1; i++) {
1735
1787
  if (offsetSize === 1) {
1736
- data.push(relativeOffset & 0xFF);
1788
+ data.push(relativeOffset & 0xff);
1737
1789
  } else if (offsetSize === 2) {
1738
- data.push(relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
1790
+ data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
1739
1791
  } else if (offsetSize === 3) {
1740
- data.push(relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
1792
+ data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
1741
1793
  } else {
1742
- data.push(relativeOffset >>> 24 & 0xFF, relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
1794
+ data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
1743
1795
  }
1744
1796
 
1745
1797
  if (objects[i]) {