pdf-codec 3.5.3 → 3.6.0

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 (46) hide show
  1. package/README.md +12 -2
  2. package/dist/{afm-widths-W02fJh-k.cjs → afm-widths-BTu0IDp2.cjs} +570 -1
  3. package/dist/{afm-widths-B6KdmpRF.js → afm-widths-De_QMWgC.js} +541 -2
  4. package/dist/afm-widths.cjs +1 -1
  5. package/dist/afm-widths.js +1 -1
  6. package/dist/builtin-encoding.cjs +221 -0
  7. package/dist/builtin-encoding.d.cts +8 -0
  8. package/dist/builtin-encoding.d.ts +8 -0
  9. package/dist/builtin-encoding.js +220 -0
  10. package/dist/cff.cjs +14 -0
  11. package/dist/cff.d.cts +4 -1
  12. package/dist/cff.d.ts +4 -1
  13. package/dist/cff.js +12 -1
  14. package/dist/cmap-table.cjs +76 -13
  15. package/dist/cmap-table.d.cts +9 -1
  16. package/dist/cmap-table.d.ts +9 -1
  17. package/dist/cmap-table.js +77 -15
  18. package/dist/codec.d.cts +2 -0
  19. package/dist/codec.d.ts +2 -0
  20. package/dist/content-write.cjs +1 -1
  21. package/dist/content-write.js +1 -1
  22. package/dist/encoding.cjs +6 -1
  23. package/dist/encoding.d.cts +6 -1
  24. package/dist/encoding.d.ts +6 -1
  25. package/dist/encoding.js +2 -2
  26. package/dist/font-read.cjs +56 -11
  27. package/dist/font-read.js +57 -12
  28. package/dist/font-tables.cjs +31 -0
  29. package/dist/font-tables.d.cts +3 -1
  30. package/dist/font-tables.d.ts +3 -1
  31. package/dist/font-tables.js +31 -2
  32. package/dist/index.cjs +1 -1
  33. package/dist/index.js +1 -1
  34. package/dist/interpret.cjs +72 -41
  35. package/dist/interpret.js +72 -41
  36. package/dist/layout.d.cts +4 -0
  37. package/dist/layout.d.ts +4 -0
  38. package/dist/math-font.cjs +1 -1
  39. package/dist/math-font.js +1 -1
  40. package/dist/measure.cjs +1 -1
  41. package/dist/measure.js +1 -1
  42. package/dist/winansi.cjs +1 -1
  43. package/dist/winansi.js +1 -1
  44. package/dist/write.cjs +1 -1
  45. package/dist/write.js +1 -1
  46. package/package.json +2 -2
@@ -1046,6 +1046,535 @@ const ZAPFDINGBATS_GLYPH_NAMES = [
1046
1046
  "a191",
1047
1047
  ""
1048
1048
  ];
1049
+ const STANDARD_GLYPH_NAMES = [
1050
+ "",
1051
+ "",
1052
+ "",
1053
+ "",
1054
+ "",
1055
+ "",
1056
+ "",
1057
+ "",
1058
+ "",
1059
+ "",
1060
+ "",
1061
+ "",
1062
+ "",
1063
+ "",
1064
+ "",
1065
+ "",
1066
+ "",
1067
+ "",
1068
+ "",
1069
+ "",
1070
+ "",
1071
+ "",
1072
+ "",
1073
+ "",
1074
+ "",
1075
+ "",
1076
+ "",
1077
+ "",
1078
+ "",
1079
+ "",
1080
+ "",
1081
+ "",
1082
+ "space",
1083
+ "exclam",
1084
+ "quotedbl",
1085
+ "numbersign",
1086
+ "dollar",
1087
+ "percent",
1088
+ "ampersand",
1089
+ "quoteright",
1090
+ "parenleft",
1091
+ "parenright",
1092
+ "asterisk",
1093
+ "plus",
1094
+ "comma",
1095
+ "hyphen",
1096
+ "period",
1097
+ "slash",
1098
+ "zero",
1099
+ "one",
1100
+ "two",
1101
+ "three",
1102
+ "four",
1103
+ "five",
1104
+ "six",
1105
+ "seven",
1106
+ "eight",
1107
+ "nine",
1108
+ "colon",
1109
+ "semicolon",
1110
+ "less",
1111
+ "equal",
1112
+ "greater",
1113
+ "question",
1114
+ "at",
1115
+ "A",
1116
+ "B",
1117
+ "C",
1118
+ "D",
1119
+ "E",
1120
+ "F",
1121
+ "G",
1122
+ "H",
1123
+ "I",
1124
+ "J",
1125
+ "K",
1126
+ "L",
1127
+ "M",
1128
+ "N",
1129
+ "O",
1130
+ "P",
1131
+ "Q",
1132
+ "R",
1133
+ "S",
1134
+ "T",
1135
+ "U",
1136
+ "V",
1137
+ "W",
1138
+ "X",
1139
+ "Y",
1140
+ "Z",
1141
+ "bracketleft",
1142
+ "backslash",
1143
+ "bracketright",
1144
+ "asciicircum",
1145
+ "underscore",
1146
+ "quoteleft",
1147
+ "a",
1148
+ "b",
1149
+ "c",
1150
+ "d",
1151
+ "e",
1152
+ "f",
1153
+ "g",
1154
+ "h",
1155
+ "i",
1156
+ "j",
1157
+ "k",
1158
+ "l",
1159
+ "m",
1160
+ "n",
1161
+ "o",
1162
+ "p",
1163
+ "q",
1164
+ "r",
1165
+ "s",
1166
+ "t",
1167
+ "u",
1168
+ "v",
1169
+ "w",
1170
+ "x",
1171
+ "y",
1172
+ "z",
1173
+ "braceleft",
1174
+ "bar",
1175
+ "braceright",
1176
+ "asciitilde",
1177
+ "",
1178
+ "",
1179
+ "",
1180
+ "",
1181
+ "",
1182
+ "",
1183
+ "",
1184
+ "",
1185
+ "",
1186
+ "",
1187
+ "",
1188
+ "",
1189
+ "",
1190
+ "",
1191
+ "",
1192
+ "",
1193
+ "",
1194
+ "",
1195
+ "",
1196
+ "",
1197
+ "",
1198
+ "",
1199
+ "",
1200
+ "",
1201
+ "",
1202
+ "",
1203
+ "",
1204
+ "",
1205
+ "",
1206
+ "",
1207
+ "",
1208
+ "",
1209
+ "",
1210
+ "",
1211
+ "exclamdown",
1212
+ "cent",
1213
+ "sterling",
1214
+ "fraction",
1215
+ "yen",
1216
+ "florin",
1217
+ "section",
1218
+ "currency",
1219
+ "quotesingle",
1220
+ "quotedblleft",
1221
+ "guillemotleft",
1222
+ "guilsinglleft",
1223
+ "guilsinglright",
1224
+ "fi",
1225
+ "fl",
1226
+ "",
1227
+ "endash",
1228
+ "dagger",
1229
+ "daggerdbl",
1230
+ "periodcentered",
1231
+ "",
1232
+ "paragraph",
1233
+ "bullet",
1234
+ "quotesinglbase",
1235
+ "quotedblbase",
1236
+ "quotedblright",
1237
+ "guillemotright",
1238
+ "ellipsis",
1239
+ "perthousand",
1240
+ "",
1241
+ "questiondown",
1242
+ "",
1243
+ "grave",
1244
+ "acute",
1245
+ "circumflex",
1246
+ "tilde",
1247
+ "macron",
1248
+ "breve",
1249
+ "dotaccent",
1250
+ "dieresis",
1251
+ "",
1252
+ "ring",
1253
+ "cedilla",
1254
+ "",
1255
+ "hungarumlaut",
1256
+ "ogonek",
1257
+ "caron",
1258
+ "emdash",
1259
+ "",
1260
+ "",
1261
+ "",
1262
+ "",
1263
+ "",
1264
+ "",
1265
+ "",
1266
+ "",
1267
+ "",
1268
+ "",
1269
+ "",
1270
+ "",
1271
+ "",
1272
+ "",
1273
+ "",
1274
+ "",
1275
+ "AE",
1276
+ "",
1277
+ "ordfeminine",
1278
+ "",
1279
+ "",
1280
+ "",
1281
+ "",
1282
+ "Lslash",
1283
+ "Oslash",
1284
+ "OE",
1285
+ "ordmasculine",
1286
+ "",
1287
+ "",
1288
+ "",
1289
+ "",
1290
+ "",
1291
+ "ae",
1292
+ "",
1293
+ "",
1294
+ "",
1295
+ "dotlessi",
1296
+ "",
1297
+ "",
1298
+ "lslash",
1299
+ "oslash",
1300
+ "oe",
1301
+ "germandbls",
1302
+ "",
1303
+ "",
1304
+ "",
1305
+ ""
1306
+ ];
1307
+ function standardGlyphName(code) {
1308
+ const name = STANDARD_GLYPH_NAMES[code];
1309
+ return name === void 0 || name === "" ? void 0 : name;
1310
+ }
1311
+ const MACROMAN_GLYPH_NAMES = [
1312
+ "NUL",
1313
+ "Eth",
1314
+ "eth",
1315
+ "Lslash",
1316
+ "lslash",
1317
+ "Scaron",
1318
+ "scaron",
1319
+ "Yacute",
1320
+ "yacute",
1321
+ "HT",
1322
+ "LF",
1323
+ "Thorn",
1324
+ "thorn",
1325
+ "CR",
1326
+ "Zcaron",
1327
+ "zcaron",
1328
+ "DLE",
1329
+ "DC1",
1330
+ "DC2",
1331
+ "DC3",
1332
+ "DC4",
1333
+ "onehalf",
1334
+ "onequarter",
1335
+ "onesuperior",
1336
+ "threequarters",
1337
+ "threesuperior",
1338
+ "twosuperior",
1339
+ "brokenbar",
1340
+ "minus",
1341
+ "multiply",
1342
+ "RS",
1343
+ "US",
1344
+ "space",
1345
+ "exclam",
1346
+ "quotedbl",
1347
+ "numbersign",
1348
+ "dollar",
1349
+ "percent",
1350
+ "ampersand",
1351
+ "quotesingle",
1352
+ "parenleft",
1353
+ "parenright",
1354
+ "asterisk",
1355
+ "plus",
1356
+ "comma",
1357
+ "hyphen",
1358
+ "period",
1359
+ "slash",
1360
+ "zero",
1361
+ "one",
1362
+ "two",
1363
+ "three",
1364
+ "four",
1365
+ "five",
1366
+ "six",
1367
+ "seven",
1368
+ "eight",
1369
+ "nine",
1370
+ "colon",
1371
+ "semicolon",
1372
+ "less",
1373
+ "equal",
1374
+ "greater",
1375
+ "question",
1376
+ "at",
1377
+ "A",
1378
+ "B",
1379
+ "C",
1380
+ "D",
1381
+ "E",
1382
+ "F",
1383
+ "G",
1384
+ "H",
1385
+ "I",
1386
+ "J",
1387
+ "K",
1388
+ "L",
1389
+ "M",
1390
+ "N",
1391
+ "O",
1392
+ "P",
1393
+ "Q",
1394
+ "R",
1395
+ "S",
1396
+ "T",
1397
+ "U",
1398
+ "V",
1399
+ "W",
1400
+ "X",
1401
+ "Y",
1402
+ "Z",
1403
+ "bracketleft",
1404
+ "backslash",
1405
+ "bracketright",
1406
+ "asciicircum",
1407
+ "underscore",
1408
+ "grave",
1409
+ "a",
1410
+ "b",
1411
+ "c",
1412
+ "d",
1413
+ "e",
1414
+ "f",
1415
+ "g",
1416
+ "h",
1417
+ "i",
1418
+ "j",
1419
+ "k",
1420
+ "l",
1421
+ "m",
1422
+ "n",
1423
+ "o",
1424
+ "p",
1425
+ "q",
1426
+ "r",
1427
+ "s",
1428
+ "t",
1429
+ "u",
1430
+ "v",
1431
+ "w",
1432
+ "x",
1433
+ "y",
1434
+ "z",
1435
+ "braceleft",
1436
+ "bar",
1437
+ "braceright",
1438
+ "asciitilde",
1439
+ "DEL",
1440
+ "Adieresis",
1441
+ "Aring",
1442
+ "Ccedilla",
1443
+ "Eacute",
1444
+ "Ntilde",
1445
+ "Odieresis",
1446
+ "Udieresis",
1447
+ "aacute",
1448
+ "agrave",
1449
+ "acircumflex",
1450
+ "adieresis",
1451
+ "atilde",
1452
+ "aring",
1453
+ "ccedilla",
1454
+ "eacute",
1455
+ "egrave",
1456
+ "ecircumflex",
1457
+ "edieresis",
1458
+ "iacute",
1459
+ "igrave",
1460
+ "icircumflex",
1461
+ "idieresis",
1462
+ "ntilde",
1463
+ "oacute",
1464
+ "ograve",
1465
+ "ocircumflex",
1466
+ "odieresis",
1467
+ "otilde",
1468
+ "uacute",
1469
+ "ugrave",
1470
+ "ucircumflex",
1471
+ "udieresis",
1472
+ "dagger",
1473
+ "degree",
1474
+ "cent",
1475
+ "sterling",
1476
+ "section",
1477
+ "bullet",
1478
+ "paragraph",
1479
+ "germandbls",
1480
+ "registered",
1481
+ "copyright",
1482
+ "trademark",
1483
+ "acute",
1484
+ "dieresis",
1485
+ "notequal",
1486
+ "AE",
1487
+ "Oslash",
1488
+ "infinity",
1489
+ "plusminus",
1490
+ "lessequal",
1491
+ "greaterequal",
1492
+ "yen",
1493
+ "mu",
1494
+ "partialdiff",
1495
+ "summation",
1496
+ "product",
1497
+ "pi",
1498
+ "integral",
1499
+ "ordfeminine",
1500
+ "ordmasculine",
1501
+ "Omega",
1502
+ "ae",
1503
+ "oslash",
1504
+ "questiondown",
1505
+ "exclamdown",
1506
+ "logicalnot",
1507
+ "radical",
1508
+ "florin",
1509
+ "approxequal",
1510
+ "Delta",
1511
+ "guillemotleft",
1512
+ "guillemotright",
1513
+ "ellipsis",
1514
+ "nbspace",
1515
+ "Agrave",
1516
+ "Atilde",
1517
+ "Otilde",
1518
+ "OE",
1519
+ "oe",
1520
+ "endash",
1521
+ "emdash",
1522
+ "quotedblleft",
1523
+ "quotedblright",
1524
+ "quoteleft",
1525
+ "quoteright",
1526
+ "divide",
1527
+ "lozenge",
1528
+ "ydieresis",
1529
+ "Ydieresis",
1530
+ "fraction",
1531
+ "currency",
1532
+ "guilsinglleft",
1533
+ "guilsinglright",
1534
+ "fi",
1535
+ "fl",
1536
+ "daggerdbl",
1537
+ "periodcentered",
1538
+ "quotesinglbase",
1539
+ "quotedblbase",
1540
+ "perthousand",
1541
+ "Acircumflex",
1542
+ "Ecircumflex",
1543
+ "Aacute",
1544
+ "Edieresis",
1545
+ "Egrave",
1546
+ "Iacute",
1547
+ "Icircumflex",
1548
+ "Idieresis",
1549
+ "Igrave",
1550
+ "Oacute",
1551
+ "Ocircumflex",
1552
+ "apple",
1553
+ "Ograve",
1554
+ "Uacute",
1555
+ "Ucircumflex",
1556
+ "Ugrave",
1557
+ "dotlessi",
1558
+ "circumflex",
1559
+ "tilde",
1560
+ "macron",
1561
+ "breve",
1562
+ "dotaccent",
1563
+ "ring",
1564
+ "cedilla",
1565
+ "hungarumlaut",
1566
+ "ogonek",
1567
+ "caron"
1568
+ ];
1569
+ function macRomanGlyphName(code) {
1570
+ const name = MACROMAN_GLYPH_NAMES[code];
1571
+ return name === void 0 || name === "" ? void 0 : name;
1572
+ }
1573
+ function namedEncodingGlyphName(encodingName) {
1574
+ if (encodingName === "WinAnsiEncoding") return winAnsiGlyphName;
1575
+ if (encodingName === "MacRomanEncoding") return macRomanGlyphName;
1576
+ if (encodingName === "StandardEncoding") return standardGlyphName;
1577
+ }
1049
1578
  function zapfDingbatsGlyphName(code) {
1050
1579
  const name = ZAPFDINGBATS_GLYPH_NAMES[code];
1051
1580
  return name === void 0 || name === "" ? void 0 : name;
@@ -1414,8 +1943,18 @@ function glyphNameToUnicode(name) {
1414
1943
  }
1415
1944
  glyphNameToUnicodeTable = table;
1416
1945
  }
1417
- return glyphNameToUnicodeTable.get(name) ?? SYMBOL_AND_ZAPFDINGBATS_GLYPH_UNICODE.get(name);
1946
+ const base = name.includes(".") ? name.slice(0, name.indexOf(".")) : name;
1947
+ return glyphNameToUnicodeTable.get(base) ?? SYMBOL_AND_ZAPFDINGBATS_GLYPH_UNICODE.get(base) ?? algorithmicGlyphNameToUnicode(base);
1948
+ }
1949
+ function algorithmicGlyphNameToUnicode(name) {
1950
+ const uniMatch = /^uni([0-9A-Fa-f]{4})$/.exec(name);
1951
+ if (uniMatch?.[1] !== void 0) return Number.parseInt(uniMatch[1], 16);
1952
+ const uMatch = /^u([0-9A-Fa-f]{4,6})$/.exec(name);
1953
+ if (uMatch?.[1] === void 0) return;
1954
+ const codePoint = Number.parseInt(uMatch[1], 16);
1955
+ return codePoint <= MAX_UNICODE_CODE_POINT ? codePoint : void 0;
1418
1956
  }
1957
+ const MAX_UNICODE_CODE_POINT = 1114111;
1419
1958
  //#endregion
1420
1959
  //#region src/afm-widths.ts
1421
1960
  function parseWidths(source) {
@@ -1649,4 +2188,4 @@ function widthOfCode(font, code) {
1649
2188
  return width;
1650
2189
  }
1651
2190
  //#endregion
1652
- export { ZAPFDINGBATS_GLYPH_NAMES as a, winAnsiGlyphName as c, sanitizeToWinAnsi as d, winAnsiCodeToUnicode as f, WINANSI_GLYPH_NAMES as i, zapfDingbatsGlyphName as l, widthOfCode as n, glyphNameToUnicode as o, SYMBOL_GLYPH_NAMES as r, symbolGlyphName as s, STANDARD_METRICS as t, encodeForShow as u };
2191
+ export { winAnsiCodeToUnicode as _, SYMBOL_GLYPH_NAMES as a, glyphNameToUnicode as c, standardGlyphName as d, symbolGlyphName as f, sanitizeToWinAnsi as g, encodeForShow as h, STANDARD_GLYPH_NAMES as i, macRomanGlyphName as l, zapfDingbatsGlyphName as m, widthOfCode as n, WINANSI_GLYPH_NAMES as o, winAnsiGlyphName as p, MACROMAN_GLYPH_NAMES as r, ZAPFDINGBATS_GLYPH_NAMES as s, STANDARD_METRICS as t, namedEncodingGlyphName as u };
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_afm_widths = require("./afm-widths-W02fJh-k.cjs");
2
+ const require_afm_widths = require("./afm-widths-BTu0IDp2.cjs");
3
3
  exports.STANDARD_METRICS = require_afm_widths.STANDARD_METRICS;
4
4
  exports.widthOfCode = require_afm_widths.widthOfCode;
@@ -1,2 +1,2 @@
1
- import { n as widthOfCode, t as STANDARD_METRICS } from "./afm-widths-B6KdmpRF.js";
1
+ import { n as widthOfCode, t as STANDARD_METRICS } from "./afm-widths-De_QMWgC.js";
2
2
  export { STANDARD_METRICS, widthOfCode };