@pdfme/pdf-lib 6.0.3-dev.0 → 6.0.4-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (449) hide show
  1. package/{src/api/Embeddable.ts → dist/api/Embeddable.d.ts} +1 -1
  2. package/dist/api/PDFDocument.d.ts +778 -0
  3. package/dist/api/PDFDocumentOptions.d.ts +38 -0
  4. package/dist/api/PDFEmbeddedFile.d.ts +38 -0
  5. package/dist/api/PDFEmbeddedPage.d.ts +73 -0
  6. package/dist/api/PDFFont.d.ts +94 -0
  7. package/dist/api/PDFImage.d.ts +95 -0
  8. package/dist/api/PDFJavaScript.d.ts +38 -0
  9. package/dist/api/PDFPage.d.ts +910 -0
  10. package/dist/api/PDFPageOptions.d.ts +172 -0
  11. package/dist/api/StandardFonts.d.ts +16 -0
  12. package/dist/api/colors.d.ts +34 -0
  13. package/dist/api/errors.d.ts +42 -0
  14. package/dist/api/form/PDFButton.d.ts +137 -0
  15. package/dist/api/form/PDFCheckBox.d.ts +142 -0
  16. package/dist/api/form/PDFDropdown.d.ts +402 -0
  17. package/dist/api/form/PDFField.d.ts +203 -0
  18. package/dist/api/form/PDFForm.d.ts +411 -0
  19. package/dist/api/form/PDFOptionList.d.ts +335 -0
  20. package/dist/api/form/PDFRadioGroup.d.ts +252 -0
  21. package/dist/api/form/PDFSignature.d.ts +29 -0
  22. package/dist/api/form/PDFTextField.d.ts +537 -0
  23. package/dist/api/form/appearances.d.ts +41 -0
  24. package/dist/api/image/alignment.d.ts +5 -0
  25. package/dist/api/objects.d.ts +4 -0
  26. package/dist/api/operations.d.ts +226 -0
  27. package/dist/api/operators.d.ts +90 -0
  28. package/dist/api/rotations.d.ts +38 -0
  29. package/dist/api/sizes.d.ts +52 -0
  30. package/dist/api/svg.d.ts +70 -0
  31. package/dist/api/svgPath.d.ts +2 -0
  32. package/dist/api/text/alignment.d.ts +5 -0
  33. package/dist/api/text/layout.d.ts +54 -0
  34. package/dist/core/PDFContext.d.ts +84 -0
  35. package/dist/core/PDFObjectCopier.d.ts +37 -0
  36. package/dist/core/acroform/PDFAcroButton.d.ts +21 -0
  37. package/dist/core/acroform/PDFAcroCheckBox.d.ts +13 -0
  38. package/dist/core/acroform/PDFAcroChoice.d.ts +20 -0
  39. package/dist/core/acroform/PDFAcroComboBox.d.ts +9 -0
  40. package/dist/core/acroform/PDFAcroField.d.ts +36 -0
  41. package/dist/core/acroform/PDFAcroForm.d.ts +20 -0
  42. package/dist/core/acroform/PDFAcroListBox.d.ts +9 -0
  43. package/dist/core/acroform/PDFAcroNonTerminal.d.ts +13 -0
  44. package/dist/core/acroform/PDFAcroPushButton.d.ts +9 -0
  45. package/dist/core/acroform/PDFAcroRadioButton.d.ts +13 -0
  46. package/{src/core/acroform/PDFAcroSignature.ts → dist/core/acroform/PDFAcroSignature.d.ts} +2 -4
  47. package/dist/core/acroform/PDFAcroTerminal.d.ts +16 -0
  48. package/dist/core/acroform/PDFAcroText.d.ts +22 -0
  49. package/dist/core/acroform/flags.d.ts +141 -0
  50. package/dist/core/acroform/utils.d.ts +6 -0
  51. package/dist/core/annotation/AppearanceCharacteristics.d.ts +33 -0
  52. package/dist/core/annotation/BorderStyle.d.ts +11 -0
  53. package/dist/core/annotation/PDFAnnotation.d.ts +51 -0
  54. package/dist/core/annotation/PDFWidgetAnnotation.d.ts +26 -0
  55. package/dist/core/annotation/flags.d.ts +79 -0
  56. package/dist/core/crypto.d.ts +95 -0
  57. package/dist/core/document/PDFCrossRefSection.d.ts +27 -0
  58. package/dist/core/document/PDFHeader.d.ts +10 -0
  59. package/dist/core/document/PDFTrailer.d.ts +9 -0
  60. package/dist/core/document/PDFTrailerDict.d.ts +10 -0
  61. package/dist/core/embedders/CMap.d.ts +3 -0
  62. package/dist/core/embedders/CustomFontEmbedder.d.ts +44 -0
  63. package/dist/core/embedders/CustomFontSubsetEmbedder.d.ts +20 -0
  64. package/dist/core/embedders/FileEmbedder.d.ts +33 -0
  65. package/dist/core/embedders/FontFlags.d.ts +13 -0
  66. package/dist/core/embedders/JavaScriptEmbedder.d.ts +10 -0
  67. package/dist/core/embedders/JpegEmbedder.d.ts +23 -0
  68. package/dist/core/embedders/PDFPageEmbedder.d.ts +37 -0
  69. package/dist/core/embedders/PngEmbedder.d.ts +19 -0
  70. package/dist/core/embedders/StandardFontEmbedder.d.ts +36 -0
  71. package/dist/core/errors.d.ts +94 -0
  72. package/{src/core/index.ts → dist/core/index.d.ts} +1 -17
  73. package/dist/core/interactive/ViewerPreferences.d.ts +347 -0
  74. package/dist/core/objects/PDFArray.d.ts +63 -0
  75. package/dist/core/objects/PDFBool.d.ts +13 -0
  76. package/dist/core/objects/PDFDict.d.ts +62 -0
  77. package/dist/core/objects/PDFHexString.d.ts +16 -0
  78. package/dist/core/objects/PDFInvalidObject.d.ts +11 -0
  79. package/dist/core/objects/PDFName.d.ts +41 -0
  80. package/dist/core/objects/PDFNull.d.ts +10 -0
  81. package/dist/core/objects/PDFNumber.d.ts +15 -0
  82. package/dist/core/objects/PDFObject.d.ts +8 -0
  83. package/dist/core/objects/PDFRawStream.d.ts +16 -0
  84. package/dist/core/objects/PDFRef.d.ts +13 -0
  85. package/dist/core/objects/PDFStream.d.ts +16 -0
  86. package/dist/core/objects/PDFString.d.ts +16 -0
  87. package/dist/core/operators/PDFOperator.d.ts +19 -0
  88. package/dist/core/operators/PDFOperatorNames.d.ts +76 -0
  89. package/dist/core/parser/BaseParser.d.ts +14 -0
  90. package/dist/core/parser/ByteStream.d.ts +26 -0
  91. package/dist/core/parser/PDFObjectParser.d.ts +31 -0
  92. package/dist/core/parser/PDFObjectStreamParser.d.ts +13 -0
  93. package/dist/core/parser/PDFParser.d.ts +46 -0
  94. package/dist/core/parser/PDFXRefStreamParser.d.ts +21 -0
  95. package/dist/core/streams/Ascii85Stream.d.ts +9 -0
  96. package/dist/core/streams/AsciiHexStream.d.ts +9 -0
  97. package/dist/core/streams/DecodeStream.d.ts +26 -0
  98. package/dist/core/streams/DecryptStream.d.ts +12 -0
  99. package/dist/core/streams/FlateStream.d.ts +13 -0
  100. package/dist/core/streams/LZWStream.d.ts +12 -0
  101. package/dist/core/streams/RunLengthStream.d.ts +8 -0
  102. package/dist/core/streams/Stream.d.ts +34 -0
  103. package/dist/core/streams/decode.d.ts +3 -0
  104. package/dist/core/structures/PDFCatalog.d.ts +27 -0
  105. package/dist/core/structures/PDFContentStream.d.ts +15 -0
  106. package/dist/core/structures/PDFCrossRefStream.d.ts +53 -0
  107. package/dist/core/structures/PDFFlateStream.d.ts +13 -0
  108. package/dist/core/structures/PDFObjectStream.d.ts +20 -0
  109. package/dist/core/structures/PDFPageLeaf.d.ts +54 -0
  110. package/dist/core/structures/PDFPageTree.d.ts +41 -0
  111. package/dist/core/syntax/CharCodes.d.ts +61 -0
  112. package/dist/core/syntax/Delimiters.d.ts +1 -0
  113. package/dist/core/syntax/Irregular.d.ts +1 -0
  114. package/dist/core/syntax/Keywords.d.ts +22 -0
  115. package/dist/core/syntax/Numeric.d.ts +3 -0
  116. package/dist/core/syntax/Whitespace.d.ts +1 -0
  117. package/dist/core/writers/PDFStreamWriter.d.ts +19 -0
  118. package/dist/core/writers/PDFWriter.d.ts +29 -0
  119. package/dist/index.js +19124 -0
  120. package/dist/index.js.map +1 -0
  121. package/dist/types/fontkit.d.ts +597 -0
  122. package/{src/types/index.ts → dist/types/index.d.ts} +8 -13
  123. package/{src/types/matrix.ts → dist/types/matrix.d.ts} +1 -2
  124. package/dist/utils/Cache.d.ts +10 -0
  125. package/dist/utils/arrays.d.ts +16 -0
  126. package/dist/utils/async.d.ts +5 -0
  127. package/dist/utils/base64.d.ts +10 -0
  128. package/dist/utils/elements/Arc.d.ts +22 -0
  129. package/dist/utils/elements/Circle.d.ts +14 -0
  130. package/dist/utils/elements/Ellipse.d.ts +20 -0
  131. package/dist/utils/elements/GraphElement.d.ts +6 -0
  132. package/dist/utils/elements/Line.d.ts +23 -0
  133. package/dist/utils/elements/Plot.d.ts +11 -0
  134. package/dist/utils/elements/Point.d.ts +18 -0
  135. package/dist/utils/elements/Rectangle.d.ts +21 -0
  136. package/dist/utils/elements/Segment.d.ts +19 -0
  137. package/dist/utils/errors.d.ts +1 -0
  138. package/dist/utils/intersections.d.ts +9 -0
  139. package/dist/utils/maths.d.ts +45 -0
  140. package/dist/utils/numbers.d.ts +23 -0
  141. package/dist/utils/objects.d.ts +15 -0
  142. package/dist/utils/pdfDocEncoding.d.ts +7 -0
  143. package/dist/utils/png.d.ts +17 -0
  144. package/dist/utils/rng.d.ts +13 -0
  145. package/dist/utils/strings.d.ts +25 -0
  146. package/{src/utils/unicode.ts → dist/utils/unicode.d.ts} +8 -195
  147. package/dist/utils/validators.d.ts +26 -0
  148. package/package.json +6 -1
  149. package/__tests__/api/PDFDocument.spec.ts +0 -576
  150. package/__tests__/api/PDFImage.spec.ts +0 -60
  151. package/__tests__/api/PDFPage.spec.ts +0 -151
  152. package/__tests__/api/form/PDFCheckBox.spec.ts +0 -71
  153. package/__tests__/api/form/PDFDropdown.spec.ts +0 -118
  154. package/__tests__/api/form/PDFForm.spec.ts +0 -370
  155. package/__tests__/api/form/PDFOptionList.spec.ts +0 -104
  156. package/__tests__/api/form/PDFRadioGroup.spec.ts +0 -183
  157. package/__tests__/api/form/PDFTextField.spec.ts +0 -148
  158. package/__tests__/api/svgPath.spec.ts +0 -153
  159. package/__tests__/api/text/layout.spec.ts +0 -166
  160. package/__tests__/core/PDFContext.spec.ts +0 -194
  161. package/__tests__/core/PDFObjectCopier.spec.ts +0 -421
  162. package/__tests__/core/acroform/PDFAcroField.spec.ts +0 -98
  163. package/__tests__/core/acroform/PDFAcroTerminal.spec.ts +0 -39
  164. package/__tests__/core/annotation/PDFWidgetAnnotation.spec.ts +0 -40
  165. package/__tests__/core/document/PDFCrossRefSection.spec.ts +0 -88
  166. package/__tests__/core/document/PDFHeader.spec.ts +0 -22
  167. package/__tests__/core/document/PDFTrailer.spec.ts +0 -28
  168. package/__tests__/core/document/PDFTrailerDict.spec.ts +0 -24
  169. package/__tests__/core/embedders/CMap.spec.ts +0 -47
  170. package/__tests__/core/embedders/CustomFontEmbedder.spec.ts +0 -96
  171. package/__tests__/core/embedders/CustomFontSubsetEmbedder.spec.ts +0 -62
  172. package/__tests__/core/embedders/FileEmbedder.spec.ts +0 -54
  173. package/__tests__/core/embedders/JpegEmbedder.spec.ts +0 -67
  174. package/__tests__/core/embedders/PDFPageEmbedder.spec.ts +0 -65
  175. package/__tests__/core/embedders/PngEmbedder.spec.ts +0 -87
  176. package/__tests__/core/embedders/StandardFontEmbedder.spec.ts +0 -79
  177. package/__tests__/core/embedders/data/SourceHanSerifJP-Regular.otf.cmap +0 -16096
  178. package/__tests__/core/embedders/data/Ubuntu-R.ttf.cmap +0 -1211
  179. package/__tests__/core/objects/PDFArray.spec.ts +0 -134
  180. package/__tests__/core/objects/PDFBool.spec.ts +0 -42
  181. package/__tests__/core/objects/PDFDict.spec.ts +0 -195
  182. package/__tests__/core/objects/PDFHexString.spec.ts +0 -168
  183. package/__tests__/core/objects/PDFInvalidObject.spec.ts +0 -32
  184. package/__tests__/core/objects/PDFName.spec.ts +0 -122
  185. package/__tests__/core/objects/PDFNull.spec.ts +0 -30
  186. package/__tests__/core/objects/PDFNumber.spec.ts +0 -50
  187. package/__tests__/core/objects/PDFObject.spec.ts +0 -29
  188. package/__tests__/core/objects/PDFRawStream.spec.ts +0 -45
  189. package/__tests__/core/objects/PDFRef.spec.ts +0 -60
  190. package/__tests__/core/objects/PDFString.spec.ts +0 -237
  191. package/__tests__/core/operators/PDFOperator.spec.ts +0 -77
  192. package/__tests__/core/parser/PDFObjectParser.spec.ts +0 -730
  193. package/__tests__/core/parser/PDFObjectStreamParser.spec.ts +0 -158
  194. package/__tests__/core/parser/PDFParser.spec.ts +0 -398
  195. package/__tests__/core/parser/PDFXRefStreamParser.spec.ts +0 -187
  196. package/__tests__/core/parser/data/object-stream-invalid +0 -2
  197. package/__tests__/core/parser/data/object-stream1 +0 -16
  198. package/__tests__/core/parser/data/object-stream2 +0 -10
  199. package/__tests__/core/parser/data/object-stream3 +0 -0
  200. package/__tests__/core/parser/data/object-stream4 +0 -0
  201. package/__tests__/core/parser/data/xref-stream1 +0 -0
  202. package/__tests__/core/parser/data/xref-stream2 +0 -0
  203. package/__tests__/core/parser/data/xref-stream3 +0 -0
  204. package/__tests__/core/parser/data/xref-stream4 +0 -0
  205. package/__tests__/core/streams/Ascii85Stream.spec.ts +0 -20
  206. package/__tests__/core/streams/AsciiHexStream.spec.ts +0 -20
  207. package/__tests__/core/streams/FlateStream.spec.ts +0 -20
  208. package/__tests__/core/streams/LZWStream.spec.ts +0 -20
  209. package/__tests__/core/streams/RunLengthStream.spec.ts +0 -20
  210. package/__tests__/core/streams/Stream.spec.ts +0 -128
  211. package/__tests__/core/streams/data/ascii85/1.decoded +0 -0
  212. package/__tests__/core/streams/data/ascii85/1.encoded +0 -43
  213. package/__tests__/core/streams/data/asciihex/1.decoded +0 -1
  214. package/__tests__/core/streams/data/asciihex/1.encoded +0 -1
  215. package/__tests__/core/streams/data/asciihex/2.decoded +0 -7
  216. package/__tests__/core/streams/data/asciihex/2.encoded +0 -1
  217. package/__tests__/core/streams/data/flate/1.corrupt.encoded +0 -1
  218. package/__tests__/core/streams/data/flate/1.decoded +0 -0
  219. package/__tests__/core/streams/data/flate/1.encoded +0 -2
  220. package/__tests__/core/streams/data/flate/2.decoded +0 -33
  221. package/__tests__/core/streams/data/flate/2.encoded +0 -0
  222. package/__tests__/core/streams/data/flate/3.decoded +0 -15
  223. package/__tests__/core/streams/data/flate/3.encoded +0 -0
  224. package/__tests__/core/streams/data/flate/4.decoded +0 -16
  225. package/__tests__/core/streams/data/flate/4.encoded +0 -0
  226. package/__tests__/core/streams/data/flate/5.decoded +0 -0
  227. package/__tests__/core/streams/data/flate/5.encoded +0 -0
  228. package/__tests__/core/streams/data/flate/6.decoded +0 -17
  229. package/__tests__/core/streams/data/flate/6.encoded +0 -0
  230. package/__tests__/core/streams/data/flate/7.decoded +0 -20
  231. package/__tests__/core/streams/data/flate/7.encoded +0 -1
  232. package/__tests__/core/streams/data/lzw/1.decoded +0 -0
  233. package/__tests__/core/streams/data/lzw/1.encoded +0 -0
  234. package/__tests__/core/streams/data/lzw/2.decoded +0 -0
  235. package/__tests__/core/streams/data/lzw/2.encoded +0 -0
  236. package/__tests__/core/streams/data/lzw/3.decoded +0 -14
  237. package/__tests__/core/streams/data/lzw/3.encoded +0 -2
  238. package/__tests__/core/streams/data/lzw/4.decoded +0 -14
  239. package/__tests__/core/streams/data/lzw/4.encoded +0 -2
  240. package/__tests__/core/streams/data/runlength/1.decoded +0 -1
  241. package/__tests__/core/streams/data/runlength/1.encoded +0 -1
  242. package/__tests__/core/streams/data/runlength/2.decoded +0 -1
  243. package/__tests__/core/streams/data/runlength/2.encoded +0 -1
  244. package/__tests__/core/streams/data/runlength/3.decoded +0 -0
  245. package/__tests__/core/streams/data/runlength/3.encoded +0 -0
  246. package/__tests__/core/streams/data/runlength/4.decoded +0 -1
  247. package/__tests__/core/streams/data/runlength/4.encoded +0 -1
  248. package/__tests__/core/streams/data/runlength/5.decoded +0 -1
  249. package/__tests__/core/streams/data/runlength/5.encoded +0 -1
  250. package/__tests__/core/streams/data/runlength/empty.encoded +0 -1
  251. package/__tests__/core/structures/PDFCatalog.spec.ts +0 -108
  252. package/__tests__/core/structures/PDFContentStream.spec.ts +0 -117
  253. package/__tests__/core/structures/PDFCrossRefStream.spec.ts +0 -145
  254. package/__tests__/core/structures/PDFObjectStream.spec.ts +0 -138
  255. package/__tests__/core/structures/PDFPageLeaf.spec.ts +0 -355
  256. package/__tests__/core/structures/PDFPageTree.spec.ts +0 -592
  257. package/__tests__/core/writers/PDFStreamWriter.spec.ts +0 -71
  258. package/__tests__/core/writers/PDFWriter.spec.ts +0 -144
  259. package/__tests__/core/writers/data/stream-writer-1.pdf +0 -0
  260. package/__tests__/index.test.ts +0 -12
  261. package/__tests__/utils/base64.spec.ts +0 -61
  262. package/__tests__/utils/data/simple.pdf +0 -201
  263. package/__tests__/utils/data/simple.pdf.base64 +0 -1
  264. package/__tests__/utils/pdfDocEncoding.spec.ts +0 -82
  265. package/__tests__/utils/png.spec.ts +0 -53
  266. package/__tests__/utils/rng.spec.ts +0 -14
  267. package/__tests__/utils/strings.spec.ts +0 -98
  268. package/__tests__/utils/unicode.spec.ts +0 -337
  269. package/assets/fonts/source_hans_jp/SourceHanSerifJP-Regular.otf +0 -0
  270. package/assets/fonts/ubuntu/Ubuntu-B.ttf +0 -0
  271. package/assets/fonts/ubuntu/Ubuntu-R.ttf +0 -0
  272. package/assets/images/cat_riding_unicorn.jpg +0 -0
  273. package/assets/images/cmyk_colorspace.jpg +0 -0
  274. package/assets/images/greyscale_bird.png +0 -0
  275. package/assets/images/minions_banana_alpha.png +0 -0
  276. package/assets/images/minions_banana_no_alpha.png +0 -0
  277. package/assets/images/minions_laughing.jpg +0 -0
  278. package/assets/pdfs/bixby_guide.pdf +0 -0
  279. package/assets/pdfs/encrypted_new.pdf +0 -0
  280. package/assets/pdfs/encrypted_old.pdf +0 -0
  281. package/assets/pdfs/fancy_fields.pdf +0 -0
  282. package/assets/pdfs/giraffe.pdf +0 -0
  283. package/assets/pdfs/invalid_root_ref.pdf +0 -0
  284. package/assets/pdfs/just_metadata.pdf +0 -49
  285. package/assets/pdfs/missing_endobj_keyword.pdf +0 -70
  286. package/assets/pdfs/missing_xref_trailer_dict.pdf +0 -141
  287. package/assets/pdfs/normal.pdf +0 -0
  288. package/assets/pdfs/pdf20examples/PDF 2.0 with offset start.pdf +0 -179
  289. package/assets/pdfs/stuff_following_header.pdf +0 -0
  290. package/assets/pdfs/us_constitution.pdf +0 -0
  291. package/assets/pdfs/with_comments.pdf +0 -0
  292. package/assets/pdfs/with_invalid_objects.pdf +0 -53
  293. package/assets/pdfs/with_invalid_stream_EOL.pdf +0 -0
  294. package/assets/pdfs/with_null_parent_entry.pdf +0 -0
  295. package/assets/pdfs/with_signature.pdf +0 -0
  296. package/assets/pdfs/with_update_sections.pdf +0 -0
  297. package/assets/pdfs/with_viewer_prefs.pdf +0 -0
  298. package/assets/pdfs/with_xfa_fields.pdf +0 -0
  299. package/src/api/PDFDocument.ts +0 -1389
  300. package/src/api/PDFDocumentOptions.ts +0 -45
  301. package/src/api/PDFEmbeddedFile.ts +0 -87
  302. package/src/api/PDFEmbeddedPage.ts +0 -100
  303. package/src/api/PDFFont.ts +0 -149
  304. package/src/api/PDFImage.ts +0 -143
  305. package/src/api/PDFJavaScript.ts +0 -75
  306. package/src/api/PDFPage.ts +0 -1604
  307. package/src/api/PDFPageOptions.ts +0 -175
  308. package/src/api/StandardFonts.ts +0 -16
  309. package/src/api/colors.ts +0 -109
  310. package/src/api/errors.ts +0 -110
  311. package/src/api/form/PDFButton.ts +0 -242
  312. package/src/api/form/PDFCheckBox.ts +0 -247
  313. package/src/api/form/PDFDropdown.ts +0 -637
  314. package/src/api/form/PDFField.ts +0 -491
  315. package/src/api/form/PDFForm.ts +0 -842
  316. package/src/api/form/PDFOptionList.ts +0 -555
  317. package/src/api/form/PDFRadioGroup.ts +0 -455
  318. package/src/api/form/PDFSignature.ts +0 -44
  319. package/src/api/form/PDFTextField.ts +0 -811
  320. package/src/api/form/appearances.ts +0 -655
  321. package/src/api/image/alignment.ts +0 -5
  322. package/src/api/objects.ts +0 -10
  323. package/src/api/operations.ts +0 -873
  324. package/src/api/operators.ts +0 -335
  325. package/src/api/rotations.ts +0 -84
  326. package/src/api/sizes.ts +0 -52
  327. package/src/api/svg.ts +0 -888
  328. package/src/api/svgPath.ts +0 -460
  329. package/src/api/text/alignment.ts +0 -5
  330. package/src/api/text/layout.ts +0 -328
  331. package/src/core/PDFContext.ts +0 -274
  332. package/src/core/PDFObjectCopier.ts +0 -142
  333. package/src/core/acroform/PDFAcroButton.ts +0 -104
  334. package/src/core/acroform/PDFAcroCheckBox.ts +0 -48
  335. package/src/core/acroform/PDFAcroChoice.ts +0 -143
  336. package/src/core/acroform/PDFAcroComboBox.ts +0 -21
  337. package/src/core/acroform/PDFAcroField.ts +0 -168
  338. package/src/core/acroform/PDFAcroForm.ts +0 -96
  339. package/src/core/acroform/PDFAcroListBox.ts +0 -19
  340. package/src/core/acroform/PDFAcroNonTerminal.ts +0 -33
  341. package/src/core/acroform/PDFAcroPushButton.ts +0 -21
  342. package/src/core/acroform/PDFAcroRadioButton.ts +0 -57
  343. package/src/core/acroform/PDFAcroTerminal.ts +0 -70
  344. package/src/core/acroform/PDFAcroText.ts +0 -76
  345. package/src/core/acroform/flags.ts +0 -162
  346. package/src/core/acroform/utils.ts +0 -129
  347. package/src/core/annotation/AppearanceCharacteristics.ts +0 -133
  348. package/src/core/annotation/BorderStyle.ts +0 -31
  349. package/src/core/annotation/PDFAnnotation.ts +0 -148
  350. package/src/core/annotation/PDFWidgetAnnotation.ts +0 -111
  351. package/src/core/annotation/flags.ts +0 -90
  352. package/src/core/crypto.ts +0 -1844
  353. package/src/core/document/PDFCrossRefSection.ts +0 -161
  354. package/src/core/document/PDFHeader.ts +0 -48
  355. package/src/core/document/PDFTrailer.ts +0 -48
  356. package/src/core/document/PDFTrailerDict.ts +0 -39
  357. package/src/core/embedders/CMap.ts +0 -65
  358. package/src/core/embedders/CustomFontEmbedder.ts +0 -237
  359. package/src/core/embedders/CustomFontSubsetEmbedder.ts +0 -89
  360. package/src/core/embedders/FileEmbedder.ts +0 -77
  361. package/src/core/embedders/FontFlags.ts +0 -45
  362. package/src/core/embedders/JavaScriptEmbedder.ts +0 -34
  363. package/src/core/embedders/JpegEmbedder.ts +0 -118
  364. package/src/core/embedders/PDFPageEmbedder.ts +0 -139
  365. package/src/core/embedders/PngEmbedder.ts +0 -69
  366. package/src/core/embedders/StandardFontEmbedder.ts +0 -121
  367. package/src/core/errors.ts +0 -226
  368. package/src/core/interactive/ViewerPreferences.ts +0 -565
  369. package/src/core/objects/PDFArray.ts +0 -179
  370. package/src/core/objects/PDFBool.ts +0 -53
  371. package/src/core/objects/PDFDict.ts +0 -220
  372. package/src/core/objects/PDFHexString.ts +0 -94
  373. package/src/core/objects/PDFInvalidObject.ts +0 -34
  374. package/src/core/objects/PDFName.ts +0 -152
  375. package/src/core/objects/PDFNull.ts +0 -30
  376. package/src/core/objects/PDFNumber.ts +0 -44
  377. package/src/core/objects/PDFObject.ts +0 -22
  378. package/src/core/objects/PDFRawStream.ts +0 -41
  379. package/src/core/objects/PDFRef.ts +0 -51
  380. package/src/core/objects/PDFStream.ts +0 -87
  381. package/src/core/objects/PDFString.ts +0 -118
  382. package/src/core/operators/PDFOperator.ts +0 -72
  383. package/src/core/operators/PDFOperatorNames.ts +0 -92
  384. package/src/core/parser/BaseParser.ts +0 -119
  385. package/src/core/parser/ByteStream.ts +0 -76
  386. package/src/core/parser/PDFObjectParser.ts +0 -302
  387. package/src/core/parser/PDFObjectStreamParser.ts +0 -65
  388. package/src/core/parser/PDFParser.ts +0 -363
  389. package/src/core/parser/PDFXRefStreamParser.ts +0 -129
  390. package/src/core/streams/Ascii85Stream.ts +0 -97
  391. package/src/core/streams/AsciiHexStream.ts +0 -77
  392. package/src/core/streams/DecodeStream.ts +0 -188
  393. package/src/core/streams/DecryptStream.ts +0 -49
  394. package/src/core/streams/FlateStream.ts +0 -397
  395. package/src/core/streams/LZWStream.ts +0 -157
  396. package/src/core/streams/RunLengthStream.ts +0 -55
  397. package/src/core/streams/Stream.ts +0 -126
  398. package/src/core/streams/decode.ts +0 -70
  399. package/src/core/structures/PDFCatalog.ts +0 -81
  400. package/src/core/structures/PDFContentStream.ts +0 -58
  401. package/src/core/structures/PDFCrossRefStream.ts +0 -238
  402. package/src/core/structures/PDFFlateStream.ts +0 -40
  403. package/src/core/structures/PDFObjectStream.ts +0 -91
  404. package/src/core/structures/PDFPageLeaf.ts +0 -244
  405. package/src/core/structures/PDFPageTree.ts +0 -192
  406. package/src/core/syntax/CharCodes.ts +0 -62
  407. package/src/core/syntax/Delimiters.ts +0 -14
  408. package/src/core/syntax/Irregular.ts +0 -10
  409. package/src/core/syntax/Keywords.ts +0 -57
  410. package/src/core/syntax/Numeric.ts +0 -26
  411. package/src/core/syntax/Whitespace.ts +0 -10
  412. package/src/core/writers/PDFStreamWriter.ts +0 -114
  413. package/src/core/writers/PDFWriter.ts +0 -146
  414. package/src/types/fontkit.ts +0 -643
  415. package/src/utils/Cache.ts +0 -26
  416. package/src/utils/arrays.ts +0 -153
  417. package/src/utils/async.ts +0 -8
  418. package/src/utils/base64.ts +0 -98
  419. package/src/utils/elements/Arc.ts +0 -97
  420. package/src/utils/elements/Circle.ts +0 -47
  421. package/src/utils/elements/Ellipse.ts +0 -117
  422. package/src/utils/elements/GraphElement.ts +0 -14
  423. package/src/utils/elements/Line.ts +0 -83
  424. package/src/utils/elements/Plot.ts +0 -50
  425. package/src/utils/elements/Point.ts +0 -37
  426. package/src/utils/elements/Rectangle.ts +0 -65
  427. package/src/utils/elements/Segment.ts +0 -81
  428. package/src/utils/errors.ts +0 -3
  429. package/src/utils/intersections.ts +0 -237
  430. package/src/utils/maths.ts +0 -96
  431. package/src/utils/numbers.ts +0 -55
  432. package/src/utils/objects.ts +0 -13
  433. package/src/utils/pdfDocEncoding.ts +0 -69
  434. package/src/utils/png.ts +0 -100
  435. package/src/utils/rng.ts +0 -21
  436. package/src/utils/strings.ts +0 -191
  437. package/src/utils/validators.ts +0 -192
  438. package/tsconfig.build.json +0 -14
  439. package/tsconfig.json +0 -15
  440. package/vite.config.mts +0 -39
  441. /package/{src/api/form/index.ts → dist/api/form/index.d.ts} +0 -0
  442. /package/{src/api/image/index.ts → dist/api/image/index.d.ts} +0 -0
  443. /package/{src/api/index.ts → dist/api/index.d.ts} +0 -0
  444. /package/{src/api/text/index.ts → dist/api/text/index.d.ts} +0 -0
  445. /package/{src/core/acroform/index.ts → dist/core/acroform/index.d.ts} +0 -0
  446. /package/{src/core/annotation/index.ts → dist/core/annotation/index.d.ts} +0 -0
  447. /package/{src/index.ts → dist/index.d.ts} +0 -0
  448. /package/{src/utils/elements/index.ts → dist/utils/elements/index.d.ts} +0 -0
  449. /package/{src/utils/index.ts → dist/utils/index.d.ts} +0 -0
@@ -1,643 +0,0 @@
1
- /**
2
- * Represents a glyph bounding box
3
- */
4
- export interface BoundingBox {
5
- minX: number /** The minimum X position in the bounding box */;
6
- minY: number /** The minimum Y position in the bounding box */;
7
- maxX: number /** The maxmimum X position in the bounding box */;
8
- maxY: number /** The maxmimum Y position in the bounding box */;
9
- width: number /** The width of the bounding box */;
10
- height: number /** The height of the bounding box */;
11
- }
12
-
13
- /**
14
- * Path objects are returned by glyphs and represent the actual vector outlines
15
- * for each glyph in the font. Paths can be converted to SVG path data strings,
16
- * or to functions that can be applied to render the path to a graphics context.
17
- */
18
- export interface Path {
19
- /**
20
- * This property represents the path’s bounding box, i.e. the smallest
21
- * rectangle that contains the entire path shape. This is the exact
22
- * bounding box, taking into account control points that may be outside the
23
- * visible shape.
24
- */
25
- bbox: BoundingBox;
26
-
27
- /**
28
- * This property represents the path’s control box. It is like the
29
- * bounding box, but it includes all points of the path, including control
30
- * points of bezier segments. It is much faster to compute than the real
31
- * bounding box, but less accurate if there are control points outside of the
32
- * visible shape.
33
- */
34
- cbox: BoundingBox;
35
-
36
- /**
37
- * Moves the virtual pen to the given x, y coordinates.
38
- */
39
- moveTo(x: number, y: number): void;
40
-
41
- /**
42
- * Adds a line to the path from the current point to the
43
- * given x, y coordinates.
44
- */
45
- lineTo(x: number, y: number): void;
46
-
47
- /**
48
- * Adds a quadratic curve to the path from the current point to the
49
- * given x, y coordinates using cpx, cpy as a control point.
50
- */
51
- quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
52
-
53
- /**
54
- * Adds a bezier curve to the path from the current point to the
55
- * given x, y coordinates using cp1x, cp1y and cp2x, cp2y as control points.
56
- */
57
- bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
58
-
59
- /**
60
- * Closes the current sub-path by drawing a straight line back to the
61
- * starting point.
62
- */
63
- closePath(): void;
64
-
65
- /**
66
- * Compiles the path to a JavaScript function that can be applied with a
67
- * graphics context in order to render the path.
68
- */
69
- toFunction(): Function; // tslint:disable-line ban-types
70
-
71
- /**
72
- * Converts the path to an SVG path data string.
73
- */
74
- toSVG(): string;
75
- }
76
-
77
- /**
78
- * Glyph objects represent a glyph in the font. They have various properties for
79
- * accessing metrics and the actual vector path the glyph represents, and
80
- * methods for rendering the glyph to a graphics context.
81
- *
82
- * You do not create glyph objects directly. They are created by various methods
83
- * on the Font object. There are several subclasses of the base Glyph class
84
- * internally that may be returned depending on the font format, but they all
85
- * include the following API.
86
- */
87
- export interface Glyph {
88
- // Properties
89
- id: number /** The glyph's id in the font */;
90
- /**
91
- * An array of unicode code points that are represented by this glyph. There
92
- * can be multiple code points in the case of ligatures and other glyphs that
93
- * represent multiple visual characters.
94
- */
95
- codePoints: number[];
96
- path: Path /** Vector Path object representing the glyph */;
97
- /**
98
- * The Glyph’s bounding box, i.e. the rectangle that encloses the glyph
99
- * outline as tightly as possible.
100
- */
101
- bbox: BoundingBox;
102
- /**
103
- * The Glyph’s control box. This is often the same as the bounding box, but is
104
- * faster to compute. Because of the way bezier curves are defined, some of
105
- * the control points can be outside of the bounding box. Where bbox takes
106
- * this into account, cbox does not. Thus, cbox is less accurate, but faster
107
- * to compute.
108
- */
109
- cbox: BoundingBox;
110
- advanceWidth: number /** The Glyph's advance width */;
111
-
112
- /**
113
- * For COLR glyphs, which are vector based, this returns an array of objects
114
- * representing the glyphs and colors for each layer in render order.
115
- */
116
- layers: any[];
117
-
118
- // Methods
119
- /**
120
- * Renders the glyph to the given graphics context, at the specified
121
- * font size.
122
- */
123
- render(context: any, size: number): void;
124
-
125
- // Color Glyph Properties/Methods
126
- /**
127
- * For SBIX glyphs, which are bitmap based, this returns an object containing
128
- * some properties about the image, along with the image data itself
129
- * (usually PNG).
130
- */
131
- getImageForSize(size: number): Uint8Array;
132
- }
133
-
134
- /**
135
- * Represents positioning information for a glyph in a GlyphRun.
136
- */
137
- export interface GlyphPosition {
138
- /**
139
- * The amount to move the virtual pen in the X direction after rendering
140
- * this glyph.
141
- */
142
- xAdvance: number;
143
-
144
- /**
145
- * The amount to move the virtual pen in the Y direction after rendering
146
- * this glyph.
147
- */
148
- yAdvance: number;
149
-
150
- /**
151
- * The offset from the pen position in the X direction at which to render
152
- * this glyph.
153
- */
154
- xOffset: number;
155
-
156
- /**
157
- * The offset from the pen position in the Y direction at which to render
158
- * this glyph.
159
- */
160
- yOffset: number;
161
- }
162
-
163
- /**
164
- * Represents a run of Glyph and GlyphPosition objects.
165
- * Returned by the Font.layout method.
166
- */
167
- export interface GlyphRun {
168
- /**
169
- * An array of Glyph objects in the run
170
- */
171
- glyphs: Glyph[];
172
-
173
- /**
174
- * An array of GlyphPosition objects for each glyph in the run
175
- */
176
- positions: GlyphPosition[];
177
-
178
- /**
179
- * The script that was requested for shaping. This was either passed in or detected automatically.
180
- */
181
- script: string;
182
-
183
- /**
184
- * The language requested for shaping, as passed in. If `null`, the default language for the
185
- * script was used.
186
- */
187
- language: string | null;
188
-
189
- /**
190
- * The direction requested for shaping, as passed in (either ltr or rtl).
191
- * If `null`, the default direction of the script is used.
192
- */
193
- direction: 'ltr' | 'rtl' | null;
194
-
195
- /**
196
- * The features requested during shaping. This is a combination of user
197
- * specified features and features chosen by the shaper.
198
- */
199
- features: object;
200
-
201
- /**
202
- * The total advance width of the run.
203
- */
204
- advanceWidth: number;
205
-
206
- /**
207
- * The total advance height of the run.
208
- */
209
- advanceHeight: number;
210
-
211
- /**
212
- * The bounding box containing all glyphs in the run.
213
- */
214
- bbox: BoundingBox;
215
- }
216
-
217
- export interface SubsetStream {
218
- on: (eventType: 'data' | 'end', callback: (data: Uint8Array) => any) => SubsetStream;
219
- }
220
-
221
- export type Subset = {
222
- /**
223
- * Includes the given glyph object or glyph ID in the subset.
224
- * Returns the glyph's new ID in the subset.
225
- */
226
- includeGlyph(glyph: number | Glyph): number;
227
- } & (SubsetV1 | SubsetV2);
228
-
229
- /**
230
- * Compatible with https://github.com/foliojs/fontkit (v1.x)
231
- */
232
- interface SubsetV1 {
233
- /**
234
- * Returns a stream containing the encoded font file that can be piped to a
235
- * destination, such as a file.
236
- */
237
- encodeStream(): SubsetStream;
238
- }
239
-
240
- /**
241
- * Compatible with https://github.com/foliojs/fontkit (v2.x)
242
- */
243
- interface SubsetV2 {
244
- /**
245
- * Returns a unit8array containing the encoded font file that can be piped to a
246
- * destination, such as a file.
247
- */
248
- encode(): Uint8Array;
249
- }
250
-
251
- /**
252
- * A map of OpenType features as described in OpenType's spec:
253
- * https://docs.microsoft.com/en-gb/typography/opentype/spec/featurelist.
254
- */
255
- export interface OpenTypeFeatures {
256
- aalt?: boolean;
257
- abvf?: boolean;
258
- abvm?: boolean;
259
- abvs?: boolean;
260
- afrc?: boolean;
261
- akhn?: boolean;
262
- blwf?: boolean;
263
- blwm?: boolean;
264
- blws?: boolean;
265
- calt?: boolean;
266
- case?: boolean;
267
- ccmp?: boolean;
268
- cfar?: boolean;
269
- cjct?: boolean;
270
- clig?: boolean;
271
- cpct?: boolean;
272
- cpsp?: boolean;
273
- cswh?: boolean;
274
- curs?: boolean;
275
- cv01?: boolean;
276
- cv02?: boolean;
277
- cv03?: boolean;
278
- cv04?: boolean;
279
- cv05?: boolean;
280
- cv06?: boolean;
281
- cv07?: boolean;
282
- cv08?: boolean;
283
- cv09?: boolean;
284
- cv10?: boolean;
285
- cv11?: boolean;
286
- cv22?: boolean;
287
- cv23?: boolean;
288
- cv24?: boolean;
289
- cv25?: boolean;
290
- cv26?: boolean;
291
- cv27?: boolean;
292
- cv28?: boolean;
293
- cv29?: boolean;
294
- cv30?: boolean;
295
- cv31?: boolean;
296
- cv32?: boolean;
297
- cv33?: boolean;
298
- cv34?: boolean;
299
- cv35?: boolean;
300
- cv36?: boolean;
301
- cv37?: boolean;
302
- cv38?: boolean;
303
- cv39?: boolean;
304
- cv40?: boolean;
305
- cv41?: boolean;
306
- cv42?: boolean;
307
- cv43?: boolean;
308
- cv44?: boolean;
309
- cv45?: boolean;
310
- cv46?: boolean;
311
- cv47?: boolean;
312
- cv48?: boolean;
313
- cv49?: boolean;
314
- cv50?: boolean;
315
- cv51?: boolean;
316
- cv52?: boolean;
317
- cv53?: boolean;
318
- cv54?: boolean;
319
- cv55?: boolean;
320
- cv56?: boolean;
321
- cv57?: boolean;
322
- cv58?: boolean;
323
- cv59?: boolean;
324
- cv60?: boolean;
325
- cv61?: boolean;
326
- cv62?: boolean;
327
- cv63?: boolean;
328
- cv64?: boolean;
329
- cv65?: boolean;
330
- cv66?: boolean;
331
- cv67?: boolean;
332
- cv68?: boolean;
333
- cv69?: boolean;
334
- cv70?: boolean;
335
- cv71?: boolean;
336
- cv72?: boolean;
337
- cv73?: boolean;
338
- cv74?: boolean;
339
- cv75?: boolean;
340
- cv76?: boolean;
341
- cv77?: boolean;
342
- cv78?: boolean;
343
- cv79?: boolean;
344
- cv80?: boolean;
345
- cv81?: boolean;
346
- cv82?: boolean;
347
- cv83?: boolean;
348
- cv84?: boolean;
349
- cv85?: boolean;
350
- cv86?: boolean;
351
- cv87?: boolean;
352
- cv88?: boolean;
353
- cv89?: boolean;
354
- cv90?: boolean;
355
- cv91?: boolean;
356
- cv92?: boolean;
357
- cv93?: boolean;
358
- cv94?: boolean;
359
- cv95?: boolean;
360
- cv96?: boolean;
361
- cv97?: boolean;
362
- cv98?: boolean;
363
- cv99?: boolean;
364
- c2pc?: boolean;
365
- c2sc?: boolean;
366
- dist?: boolean;
367
- dlig?: boolean;
368
- dnom?: boolean;
369
- dtls?: boolean;
370
- expt?: boolean;
371
- falt?: boolean;
372
- fin2?: boolean;
373
- fin3?: boolean;
374
- fina?: boolean;
375
- flac?: boolean;
376
- frac?: boolean;
377
- fwid?: boolean;
378
- half?: boolean;
379
- haln?: boolean;
380
- halt?: boolean;
381
- hist?: boolean;
382
- hkna?: boolean;
383
- hlig?: boolean;
384
- hngl?: boolean;
385
- hojo?: boolean;
386
- hwid?: boolean;
387
- init?: boolean;
388
- isol?: boolean;
389
- ital?: boolean;
390
- jalt?: boolean;
391
- jp78?: boolean;
392
- jp83?: boolean;
393
- jp90?: boolean;
394
- jp04?: boolean;
395
- kern?: boolean;
396
- lfbd?: boolean;
397
- liga?: boolean;
398
- ljmo?: boolean;
399
- lnum?: boolean;
400
- locl?: boolean;
401
- ltra?: boolean;
402
- ltrm?: boolean;
403
- mark?: boolean;
404
- med2?: boolean;
405
- medi?: boolean;
406
- mgrk?: boolean;
407
- mkmk?: boolean;
408
- mset?: boolean;
409
- nalt?: boolean;
410
- nlck?: boolean;
411
- nukt?: boolean;
412
- numr?: boolean;
413
- onum?: boolean;
414
- opbd?: boolean;
415
- ordn?: boolean;
416
- ornm?: boolean;
417
- palt?: boolean;
418
- pcap?: boolean;
419
- pkna?: boolean;
420
- pnum?: boolean;
421
- pref?: boolean;
422
- pres?: boolean;
423
- pstf?: boolean;
424
- psts?: boolean;
425
- pwid?: boolean;
426
- qwid?: boolean;
427
- rand?: boolean;
428
- rclt?: boolean;
429
- rkrf?: boolean;
430
- rlig?: boolean;
431
- rphf?: boolean;
432
- rtbd?: boolean;
433
- rtla?: boolean;
434
- rtlm?: boolean;
435
- ruby?: boolean;
436
- rvrn?: boolean;
437
- salt?: boolean;
438
- sinf?: boolean;
439
- size?: boolean;
440
- smcp?: boolean;
441
- smpl?: boolean;
442
- ss01?: boolean;
443
- ss02?: boolean;
444
- ss03?: boolean;
445
- ss04?: boolean;
446
- ss05?: boolean;
447
- ss06?: boolean;
448
- ss07?: boolean;
449
- ss08?: boolean;
450
- ss09?: boolean;
451
- ss10?: boolean;
452
- ss11?: boolean;
453
- ss12?: boolean;
454
- ss13?: boolean;
455
- ss14?: boolean;
456
- ss15?: boolean;
457
- ss16?: boolean;
458
- ss17?: boolean;
459
- ss18?: boolean;
460
- ss19?: boolean;
461
- ss20?: boolean;
462
- ssty?: boolean;
463
- stch?: boolean;
464
- subs?: boolean;
465
- sups?: boolean;
466
- swsh?: boolean;
467
- titl?: boolean;
468
- tjmo?: boolean;
469
- tnam?: boolean;
470
- tnum?: boolean;
471
- trad?: boolean;
472
- twid?: boolean;
473
- unic?: boolean;
474
- valt?: boolean;
475
- vatu?: boolean;
476
- vert?: boolean;
477
- vhal?: boolean;
478
- vjmo?: boolean;
479
- vkna?: boolean;
480
- vkrn?: boolean;
481
- vpal?: boolean;
482
- vrt2?: boolean;
483
- vrtr?: boolean;
484
- zero?: boolean;
485
- }
486
- /**
487
- * A map of Apple Advanced Typography (AAT) as decribed by Apple’s TrueType
488
- * Reference manual:
489
- * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6AATIntro.html
490
- */
491
- export interface AATFeatures {
492
- acnt?: boolean;
493
- ankr?: boolean;
494
- avar?: boolean;
495
- bdat?: boolean;
496
- bhed?: boolean;
497
- bloc?: boolean;
498
- bsln?: boolean;
499
- cmap?: boolean;
500
- cvar?: boolean;
501
- cvt?: boolean;
502
- EBSC?: boolean;
503
- fdsc?: boolean;
504
- feat?: boolean;
505
- fmtx?: boolean;
506
- fond?: boolean;
507
- fpgm?: boolean;
508
- fvar?: boolean;
509
- gasp?: boolean;
510
- gcid?: boolean;
511
- glyf?: boolean;
512
- gvar?: boolean;
513
- hdmx?: boolean;
514
- head?: boolean;
515
- hhea?: boolean;
516
- hmtx?: boolean;
517
- just?: boolean;
518
- kern?: boolean;
519
- kerx?: boolean;
520
- lcar?: boolean;
521
- loca?: boolean;
522
- ltag?: boolean;
523
- maxp?: boolean;
524
- meta?: boolean;
525
- mort?: boolean;
526
- morx?: boolean;
527
- name?: boolean;
528
- opbd?: boolean;
529
- 'OS/2'?: boolean;
530
- post?: boolean;
531
- prep?: boolean;
532
- prop?: boolean;
533
- sbix?: boolean;
534
- trak?: boolean;
535
- vhea?: boolean;
536
- vmtx?: boolean;
537
- xref?: boolean;
538
- Zapf?: boolean;
539
- }
540
-
541
- /**
542
- * The features is an object mapping OpenType features to a boolean
543
- * enabling or disabling each. If this is an AAT font,
544
- * the OpenType feature tags are mapped to AAT features.
545
- */
546
- export interface TypeFeatures extends OpenTypeFeatures, AATFeatures {
547
- [key: string]: boolean | undefined;
548
- }
549
-
550
- /**
551
- * There are several different types of font objects that are returned by
552
- * fontkit depending on the font format. They all inherit from the TTFFont class
553
- * and have the same public API.
554
- */
555
- export interface Font {
556
- // Metadata properties
557
- postscriptName: string | null;
558
- fullName: string | null;
559
- familyName: string | null;
560
- subfamilyName: string | null;
561
- copyright: string | null;
562
- version: string | null;
563
-
564
- // Metrics properties
565
- unitsPerEm: number /** Size of the font’s internal coordinate grid */;
566
- ascent: number /** The font’s ascender */;
567
- descent: number /** The font’s descender */;
568
- lineGap: number /** Amount of space that should be included between lines */;
569
- underlinePosition: number /** Offset from the normal underline position that should be used */;
570
- underlineThickness: number /** Weight of the underline that should be used */;
571
- italicAngle: number /** If this is an italic font, the angle the cursor should be drawn at to match the font design */;
572
- capHeight: number /** Height of capital letters above the baseline. */;
573
- xHeight: number /** Height of lower case letters. */;
574
- bbox: BoundingBox /** Font’s bounding box, i.e. the box that encloses all glyphs in the font */;
575
-
576
- // Other properties
577
- numGlyphs: number /** Number of glyphs in the font */;
578
- characterSet: number[] /** Array of all of the unicode code points supported by the font */;
579
- availableFeatures: (keyof TypeFeatures)[] /** Array of all OpenType feature tags (or mapped AAT tags) supported by the font */;
580
- cff: any;
581
- 'OS/2': { sFamilyClass: number };
582
- head: { macStyle: { italic: boolean } };
583
- post: { isFixedPitch: boolean };
584
-
585
- // Character to Glyph Mapping Methods
586
-
587
- /**
588
- * Maps a single unicode code point (number) to a Glyph object.
589
- * Does not perform any advanced substitutions (there is no context to do so).
590
- */
591
- glyphForCodePoint(codePoint: number): Glyph;
592
-
593
- /**
594
- * Returns whether there is glyph in the font for the given
595
- * unicode code point.
596
- */
597
- hasGlyphForCodePoint(codePoint: number): boolean;
598
-
599
- /**
600
- * This method returns an array of Glyph objects for the given string.
601
- * This is only a one-to-one mapping from characters to glyphs. For most uses,
602
- * you should use Font.layout, which provides a much more advanced mapping
603
- * supporting AAT and OpenType shaping.
604
- */
605
- glyphsForString(str: string): Glyph[];
606
-
607
- // Glyph Metrics and Layout Methods
608
-
609
- /**
610
- * Returns the advance width (described above) for a single glyph id.
611
- */
612
- widthOfGlyph(glyphId: number): number;
613
-
614
- /**
615
- * This method returns a GlyphRun object, which includes an array of Glyphs
616
- * and GlyphPositions for the given string. Glyph objects are described below.
617
- * GlyphPosition objects include 4 properties: xAdvance, yAdvance, xOffset,
618
- * and yOffset.
619
- *
620
- * The features parameter is an array of OpenType feature tags to be applied
621
- * in addition to the default set. If this is an AAT font, the OpenType
622
- * feature tags are mapped to AAT features.
623
- */
624
- layout(str: string, features?: TypeFeatures | (keyof TypeFeatures)[]): GlyphRun;
625
-
626
- // Other Methods
627
-
628
- /**
629
- * Returns a glyph object for the given glyph id. You can pass the array of
630
- * code points this glyph represents for your use later, and it will be
631
- * stored in the glyph object.
632
- */
633
- getGlyph(glyphId: number, codePoints?: number[]): Glyph;
634
-
635
- /**
636
- * Returns a Subset object for this font.
637
- */
638
- createSubset(): Subset;
639
- }
640
-
641
- export interface Fontkit {
642
- create(buffer: Uint8Array, postscriptName?: string): Font;
643
- }
@@ -1,26 +0,0 @@
1
- class Cache<T> {
2
- static readonly populatedBy = <T>(populate: () => T) => new Cache(populate);
3
-
4
- private readonly populate: () => T;
5
- private value: T | undefined;
6
-
7
- private constructor(populate: () => T) {
8
- this.populate = populate;
9
- this.value = undefined;
10
- }
11
-
12
- getValue(): T | undefined {
13
- return this.value;
14
- }
15
-
16
- access(): T {
17
- if (!this.value) this.value = this.populate();
18
- return this.value;
19
- }
20
-
21
- invalidate(): void {
22
- this.value = undefined;
23
- }
24
- }
25
-
26
- export default Cache;