pdf-codec 5.8.0 โ 5.8.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.
- package/README.md +2 -0
- package/dist/font-read.cjs +5 -2
- package/dist/font-read.js +5 -2
- package/dist/symbol-font-private-use.cjs +86 -0
- package/dist/symbol-font-private-use.d.cts +18 -0
- package/dist/symbol-font-private-use.d.ts +18 -0
- package/dist/symbol-font-private-use.js +84 -0
- package/dist/wingdings-characters.cjs +262 -0
- package/dist/wingdings-characters.d.cts +4 -0
- package/dist/wingdings-characters.d.ts +4 -0
- package/dist/wingdings-characters.js +261 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -332,6 +332,8 @@ Reading a program's built-in encoding is what stops a symbol-encoded subset โ
|
|
|
332
332
|
|
|
333
333
|
A TrueType subset can lose its glyph names and its `cmap` both and keep nothing but outlines, metrics and its `name` table, while still numbering its glyphs as the full face does. Producers write exactly that for the core faces they embed most (the Arial, Times New Roman and Courier New families) as composite subsets with no `/ToUnicode`, and then the face's published glyph order is the only statement of what each glyph draws. `core-font-glyph-orders.ts` carries that order for those faces, with each glyph's advance width, and a program that names itself as one of them (its own `name` table's PostScript name, or `/BaseFont` when the table states none) is read through it glyph by glyph only where the program's own advance width for the glyph equals the face's on the same design grid. A renumbered subset, another face under the same name or a glyph a later release redrew to a new width therefore stays unmapped instead of being read as the wrong character. The data is generated by `scripts/generate-core-font-glyph-orders.mjs` from installed copies of the faces (the newest release found of each): a glyph's text comes from the face's Unicode `cmap`, or for a ligature glyph no code point reaches, from the components its `GSUB` ligature substitution joins.
|
|
334
334
|
|
|
335
|
+
A `/ToUnicode` CMap that a producer writes for the Symbol or Wingdings font (Word does, for a bullet, a tick or an arrow it draws in them) gives each glyph the private-use code point its 8-bit code makes in the 0xF000 range, which identifies the glyph in that one font and nothing else: 0xFC is a check mark in Wingdings and a piece of a right brace in Symbol. `symbol-font-private-use.ts` reads such a code point as the character the named font draws at that code, applied to the text a `/ToUnicode` CMap gave for a Symbol, SymbolMT or Wingdings font, by name, and to no other font: Symbol through its published encoding (the assembly pieces of a tall bracket and the integral extension as their Unicode characters), Wingdings through `wingdings-characters.ts`, the table of Unicode's own Wingdings document. A code the font has no character at, and Wingdings 2 and 3, Webdings and ZapfDingbats, stay as the producer wrote them.
|
|
336
|
+
|
|
335
337
|
**Where nothing states an answer, the answer is the replacement character plus a `text/unmapped-encoding` diagnostic, never a guess.** Cases that reach it in practice: a symbolic font with no embedded program and no `/ToUnicode`; a subsetted font that both strips its glyph names and maps its glyphs only from private-use code points; a nameless, `cmap`-less subset of a face whose glyph order this package does not carry, or of a carried face at a glyph its recorded releases do not number; and a composite font whose `/Encoding` is a CMap other than Identity-H or Identity-V, whose codes reach CIDs this reader does not map. A private-use code point identifies a glyph inside one font and says nothing about the character it draws, so it is treated as no answer rather than a wrong one.
|
|
336
338
|
|
|
337
339
|
## Grouping text runs into lines and words
|
package/dist/font-read.cjs
CHANGED
|
@@ -9,6 +9,7 @@ const require_builtin_encoding = require("./builtin-encoding.cjs");
|
|
|
9
9
|
const require_cmap = require("./cmap.cjs");
|
|
10
10
|
const require_encoding_symbol_tables = require("./encoding-symbol-tables.cjs");
|
|
11
11
|
const require_fonts = require("./fonts.cjs");
|
|
12
|
+
const require_symbol_font_private_use = require("./symbol-font-private-use.cjs");
|
|
12
13
|
//#region src/font-read.ts
|
|
13
14
|
const BITS_PER_BYTE = 8;
|
|
14
15
|
const SYMBOLIC_FLAG_BIT = 4;
|
|
@@ -84,6 +85,7 @@ function buildSimpleFont(fontDict, context) {
|
|
|
84
85
|
const { baseFamily, bold, italic } = require_font_style.styleFromBaseFontName(baseFont, styleFlags);
|
|
85
86
|
const symbolic = styleFlags.symbolic ?? false;
|
|
86
87
|
const builtinGlyphName = builtinSymbolGlyphNameLookup(baseFamily);
|
|
88
|
+
const symbolFont = require_symbol_font_private_use.symbolFontOf(baseFamily);
|
|
87
89
|
const widthsArr = resolvedArray(require_objects.dictGet(fontDict, "Widths"), context);
|
|
88
90
|
const firstChar = require_objects.asNumber(require_objects.dictGet(fontDict, "FirstChar")) ?? 0;
|
|
89
91
|
const missingWidth = (descriptor !== void 0 ? require_objects.asNumber(require_objects.dictGet(descriptor, "MissingWidth")) : void 0) ?? 0;
|
|
@@ -160,7 +162,7 @@ function buildSimpleFont(fontDict, context) {
|
|
|
160
162
|
for (const code of codes) {
|
|
161
163
|
const viaToUnicode = toUnicode?.lookup(code);
|
|
162
164
|
if (viaToUnicode !== void 0) {
|
|
163
|
-
out += viaToUnicode;
|
|
165
|
+
out += require_symbol_font_private_use.withSymbolFontCharacters(symbolFont, viaToUnicode);
|
|
164
166
|
continue;
|
|
165
167
|
}
|
|
166
168
|
const unicode = unicodeForCode(code);
|
|
@@ -321,6 +323,7 @@ function buildCompositeFont(fontDict, context) {
|
|
|
321
323
|
};
|
|
322
324
|
};
|
|
323
325
|
const toUnicode = readToUnicodeCMap(fontDict, context);
|
|
326
|
+
const symbolFont = require_symbol_font_private_use.symbolFontOf(baseFamily);
|
|
324
327
|
const glyphIdOf = cidToGlyphId(fontDict, descendantDict, context);
|
|
325
328
|
const programEncoding = glyphIdOf !== void 0 ? lazyFontProgram(descriptor, baseFont, context) : void 0;
|
|
326
329
|
const decodeToUnicode = (codes) => {
|
|
@@ -332,7 +335,7 @@ function buildCompositeFont(fontDict, context) {
|
|
|
332
335
|
const cid = (codes[i] ?? 0) << BITS_PER_BYTE | (codes[i + 1] ?? 0);
|
|
333
336
|
const mapped = toUnicode?.lookup(cid);
|
|
334
337
|
if (mapped !== void 0) {
|
|
335
|
-
out += mapped;
|
|
338
|
+
out += require_symbol_font_private_use.withSymbolFontCharacters(symbolFont, mapped);
|
|
336
339
|
continue;
|
|
337
340
|
}
|
|
338
341
|
const glyphId = glyphIdOf?.(cid);
|
package/dist/font-read.js
CHANGED
|
@@ -8,6 +8,7 @@ import { readFontProgramEncoding } from "./builtin-encoding.js";
|
|
|
8
8
|
import { parseToUnicodeCMap } from "./cmap.js";
|
|
9
9
|
import { symbolGlyphName, zapfDingbatsGlyphName } from "./encoding-symbol-tables.js";
|
|
10
10
|
import { resolveStandardFont } from "./fonts.js";
|
|
11
|
+
import { symbolFontOf, withSymbolFontCharacters } from "./symbol-font-private-use.js";
|
|
11
12
|
//#region src/font-read.ts
|
|
12
13
|
const BITS_PER_BYTE = 8;
|
|
13
14
|
const SYMBOLIC_FLAG_BIT = 4;
|
|
@@ -83,6 +84,7 @@ function buildSimpleFont(fontDict, context) {
|
|
|
83
84
|
const { baseFamily, bold, italic } = styleFromBaseFontName(baseFont, styleFlags);
|
|
84
85
|
const symbolic = styleFlags.symbolic ?? false;
|
|
85
86
|
const builtinGlyphName = builtinSymbolGlyphNameLookup(baseFamily);
|
|
87
|
+
const symbolFont = symbolFontOf(baseFamily);
|
|
86
88
|
const widthsArr = resolvedArray(dictGet(fontDict, "Widths"), context);
|
|
87
89
|
const firstChar = asNumber(dictGet(fontDict, "FirstChar")) ?? 0;
|
|
88
90
|
const missingWidth = (descriptor !== void 0 ? asNumber(dictGet(descriptor, "MissingWidth")) : void 0) ?? 0;
|
|
@@ -159,7 +161,7 @@ function buildSimpleFont(fontDict, context) {
|
|
|
159
161
|
for (const code of codes) {
|
|
160
162
|
const viaToUnicode = toUnicode?.lookup(code);
|
|
161
163
|
if (viaToUnicode !== void 0) {
|
|
162
|
-
out += viaToUnicode;
|
|
164
|
+
out += withSymbolFontCharacters(symbolFont, viaToUnicode);
|
|
163
165
|
continue;
|
|
164
166
|
}
|
|
165
167
|
const unicode = unicodeForCode(code);
|
|
@@ -320,6 +322,7 @@ function buildCompositeFont(fontDict, context) {
|
|
|
320
322
|
};
|
|
321
323
|
};
|
|
322
324
|
const toUnicode = readToUnicodeCMap(fontDict, context);
|
|
325
|
+
const symbolFont = symbolFontOf(baseFamily);
|
|
323
326
|
const glyphIdOf = cidToGlyphId(fontDict, descendantDict, context);
|
|
324
327
|
const programEncoding = glyphIdOf !== void 0 ? lazyFontProgram(descriptor, baseFont, context) : void 0;
|
|
325
328
|
const decodeToUnicode = (codes) => {
|
|
@@ -331,7 +334,7 @@ function buildCompositeFont(fontDict, context) {
|
|
|
331
334
|
const cid = (codes[i] ?? 0) << BITS_PER_BYTE | (codes[i + 1] ?? 0);
|
|
332
335
|
const mapped = toUnicode?.lookup(cid);
|
|
333
336
|
if (mapped !== void 0) {
|
|
334
|
-
out += mapped;
|
|
337
|
+
out += withSymbolFontCharacters(symbolFont, mapped);
|
|
335
338
|
continue;
|
|
336
339
|
}
|
|
337
340
|
const glyphId = glyphIdOf?.(cid);
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_glyph_names = require("./glyph-names.cjs");
|
|
3
|
+
const require_encoding_symbol_tables = require("./encoding-symbol-tables.cjs");
|
|
4
|
+
const require_wingdings_characters = require("./wingdings-characters.cjs");
|
|
5
|
+
//#region src/symbol-font-private-use.ts
|
|
6
|
+
const SYMBOL_FONT_PRIVATE_USE_BASE = 61440;
|
|
7
|
+
/**
|
|
8
|
+
* The symbol font a font family name stands for, whichever way the producer spells it ("Symbol", "SymbolMT", "Wingdings"), or `undefined` for any other font.
|
|
9
|
+
* @param family - The font's family as `styleFromBaseFontName` reads it from `/BaseFont`: the subset tag and style suffix already removed.
|
|
10
|
+
* @returns The symbol font the family names, or `undefined`.
|
|
11
|
+
*/
|
|
12
|
+
function symbolFontOf(family) {
|
|
13
|
+
const name = family.replace(/[\s_-]/gu, "").toLowerCase();
|
|
14
|
+
if (name === "symbol" || name === "symbolmt") return "symbol";
|
|
15
|
+
return name === "wingdings" ? "wingdings" : void 0;
|
|
16
|
+
}
|
|
17
|
+
function isSymbolFontCode(codePoint) {
|
|
18
|
+
return codePoint >= 61472 && codePoint <= 61695;
|
|
19
|
+
}
|
|
20
|
+
function isPrivateUse(text) {
|
|
21
|
+
return /^\p{Co}/u.test(text);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The Symbol glyphs that the Adobe Glyph List gives code points of Adobe's own Private Use Area (U+F6xx and U+F8xx), which name no character, and the Unicode characters that are the same glyphs: the pieces a tall bracket, parenthesis or brace is assembled from, the extensions of the integral, vertical-arrow and horizontal-arrow signs, and the serif and sans-serif registered, copyright and trade mark signs. Keyed by the glyph's PostScript name in the Symbol font's built-in encoding (Adobe's `symbol.txt`, https://www.unicode.org/Public/MAPPINGS/VENDORS/ADOBE/symbol.txt, archived at https://web.archive.org/web/20261011050748/http://www.unicode.org/Public/MAPPINGS/VENDORS/ADOBE/symbol.txt), valued by the character of the Unicode Miscellaneous Technical block (https://www.unicode.org/charts/PDF/U2300.pdf, archived at https://web.archive.org/web/2026/https://www.unicode.org/charts/PDF/U2300.pdf) or Latin-1 and Letterlike Symbols block the glyph is. `radicalex`, the extension of the radical sign, is the one such glyph with no Unicode character, and stays as it was written.
|
|
25
|
+
*/
|
|
26
|
+
const SYMBOL_ASSEMBLY_PIECES = /* @__PURE__ */ new Map([
|
|
27
|
+
["parenlefttp", "โ"],
|
|
28
|
+
["parenleftex", "โ"],
|
|
29
|
+
["parenleftbt", "โ"],
|
|
30
|
+
["parenrighttp", "โ"],
|
|
31
|
+
["parenrightex", "โ"],
|
|
32
|
+
["parenrightbt", "โ "],
|
|
33
|
+
["bracketlefttp", "โก"],
|
|
34
|
+
["bracketleftex", "โข"],
|
|
35
|
+
["bracketleftbt", "โฃ"],
|
|
36
|
+
["bracketrighttp", "โค"],
|
|
37
|
+
["bracketrightex", "โฅ"],
|
|
38
|
+
["bracketrightbt", "โฆ"],
|
|
39
|
+
["bracelefttp", "โง"],
|
|
40
|
+
["braceleftmid", "โจ"],
|
|
41
|
+
["braceleftbt", "โฉ"],
|
|
42
|
+
["braceex", "โช"],
|
|
43
|
+
["bracerighttp", "โซ"],
|
|
44
|
+
["bracerightmid", "โฌ"],
|
|
45
|
+
["bracerightbt", "โญ"],
|
|
46
|
+
["integralex", "โฎ"],
|
|
47
|
+
["arrowhorizex", "โฏ"],
|
|
48
|
+
["arrowvertex", "โ"],
|
|
49
|
+
["registerserif", "ยฎ"],
|
|
50
|
+
["registersans", "ยฎ"],
|
|
51
|
+
["copyrightserif", "ยฉ"],
|
|
52
|
+
["copyrightsans", "ยฉ"],
|
|
53
|
+
["trademarkserif", "โข"],
|
|
54
|
+
["trademarksans", "โข"]
|
|
55
|
+
]);
|
|
56
|
+
function symbolCharacter(code) {
|
|
57
|
+
const name = require_encoding_symbol_tables.symbolGlyphName(code);
|
|
58
|
+
if (name === void 0) return;
|
|
59
|
+
const piece = SYMBOL_ASSEMBLY_PIECES.get(name);
|
|
60
|
+
if (piece !== void 0) return piece;
|
|
61
|
+
const text = require_glyph_names.glyphNameToUnicode(name);
|
|
62
|
+
return text !== void 0 && text !== "" && !isPrivateUse(text) ? text : void 0;
|
|
63
|
+
}
|
|
64
|
+
function wingdingsCharacter(code) {
|
|
65
|
+
const character = require_wingdings_characters.WINGDINGS_CHARACTERS[code];
|
|
66
|
+
return character === void 0 || character === "" ? void 0 : character;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* `text`, the Unicode a font's /ToUnicode CMap gave for a run of its codes, with each Private Use Area code point that is one of the font's own 8-bit codes (0xF020 to 0xF0FF) replaced by the character the font's glyph at that code is. Nothing else changes: a code point outside that range, one the font has no character at, and every character of a font that is not a symbol font stay as they were.
|
|
70
|
+
* @param font - The symbol font the text was read through, `undefined` for any other font, whose text is returned as it is.
|
|
71
|
+
* @param text - The text a CMap gave for one or more codes.
|
|
72
|
+
* @returns The text with the font's own characters in place of its private-use code points.
|
|
73
|
+
*/
|
|
74
|
+
function withSymbolFontCharacters(font, text) {
|
|
75
|
+
if (font === void 0) return text;
|
|
76
|
+
const character = font === "symbol" ? symbolCharacter : wingdingsCharacter;
|
|
77
|
+
let out = "";
|
|
78
|
+
for (const char of text) {
|
|
79
|
+
const codePoint = char.codePointAt(0);
|
|
80
|
+
out += codePoint !== void 0 && isSymbolFontCode(codePoint) ? character(codePoint - SYMBOL_FONT_PRIVATE_USE_BASE) ?? char : char;
|
|
81
|
+
}
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
exports.symbolFontOf = symbolFontOf;
|
|
86
|
+
exports.withSymbolFontCharacters = withSymbolFontCharacters;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/symbol-font-private-use.d.ts
|
|
2
|
+
/** The symbol fonts whose 8-bit codes are mapped: the two a Word document uses for bullets, ticks, arrows and mathematical signs. Wingdings 2 and 3, Webdings and ZapfDingbats are different fonts with their own tables and are left as the producer wrote them. */
|
|
3
|
+
type SymbolFont = "symbol" | "wingdings";
|
|
4
|
+
/**
|
|
5
|
+
* The symbol font a font family name stands for, whichever way the producer spells it ("Symbol", "SymbolMT", "Wingdings"), or `undefined` for any other font.
|
|
6
|
+
* @param family - The font's family as `styleFromBaseFontName` reads it from `/BaseFont`: the subset tag and style suffix already removed.
|
|
7
|
+
* @returns The symbol font the family names, or `undefined`.
|
|
8
|
+
*/
|
|
9
|
+
declare function symbolFontOf(family: string): SymbolFont | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* `text`, the Unicode a font's /ToUnicode CMap gave for a run of its codes, with each Private Use Area code point that is one of the font's own 8-bit codes (0xF020 to 0xF0FF) replaced by the character the font's glyph at that code is. Nothing else changes: a code point outside that range, one the font has no character at, and every character of a font that is not a symbol font stay as they were.
|
|
12
|
+
* @param font - The symbol font the text was read through, `undefined` for any other font, whose text is returned as it is.
|
|
13
|
+
* @param text - The text a CMap gave for one or more codes.
|
|
14
|
+
* @returns The text with the font's own characters in place of its private-use code points.
|
|
15
|
+
*/
|
|
16
|
+
declare function withSymbolFontCharacters(font: SymbolFont | undefined, text: string): string;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { SymbolFont, symbolFontOf, withSymbolFontCharacters };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/symbol-font-private-use.d.ts
|
|
2
|
+
/** The symbol fonts whose 8-bit codes are mapped: the two a Word document uses for bullets, ticks, arrows and mathematical signs. Wingdings 2 and 3, Webdings and ZapfDingbats are different fonts with their own tables and are left as the producer wrote them. */
|
|
3
|
+
type SymbolFont = "symbol" | "wingdings";
|
|
4
|
+
/**
|
|
5
|
+
* The symbol font a font family name stands for, whichever way the producer spells it ("Symbol", "SymbolMT", "Wingdings"), or `undefined` for any other font.
|
|
6
|
+
* @param family - The font's family as `styleFromBaseFontName` reads it from `/BaseFont`: the subset tag and style suffix already removed.
|
|
7
|
+
* @returns The symbol font the family names, or `undefined`.
|
|
8
|
+
*/
|
|
9
|
+
declare function symbolFontOf(family: string): SymbolFont | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* `text`, the Unicode a font's /ToUnicode CMap gave for a run of its codes, with each Private Use Area code point that is one of the font's own 8-bit codes (0xF020 to 0xF0FF) replaced by the character the font's glyph at that code is. Nothing else changes: a code point outside that range, one the font has no character at, and every character of a font that is not a symbol font stay as they were.
|
|
12
|
+
* @param font - The symbol font the text was read through, `undefined` for any other font, whose text is returned as it is.
|
|
13
|
+
* @param text - The text a CMap gave for one or more codes.
|
|
14
|
+
* @returns The text with the font's own characters in place of its private-use code points.
|
|
15
|
+
*/
|
|
16
|
+
declare function withSymbolFontCharacters(font: SymbolFont | undefined, text: string): string;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { SymbolFont, symbolFontOf, withSymbolFontCharacters };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { glyphNameToUnicode } from "./glyph-names.js";
|
|
2
|
+
import { symbolGlyphName } from "./encoding-symbol-tables.js";
|
|
3
|
+
import { WINGDINGS_CHARACTERS } from "./wingdings-characters.js";
|
|
4
|
+
//#region src/symbol-font-private-use.ts
|
|
5
|
+
const SYMBOL_FONT_PRIVATE_USE_BASE = 61440;
|
|
6
|
+
/**
|
|
7
|
+
* The symbol font a font family name stands for, whichever way the producer spells it ("Symbol", "SymbolMT", "Wingdings"), or `undefined` for any other font.
|
|
8
|
+
* @param family - The font's family as `styleFromBaseFontName` reads it from `/BaseFont`: the subset tag and style suffix already removed.
|
|
9
|
+
* @returns The symbol font the family names, or `undefined`.
|
|
10
|
+
*/
|
|
11
|
+
function symbolFontOf(family) {
|
|
12
|
+
const name = family.replace(/[\s_-]/gu, "").toLowerCase();
|
|
13
|
+
if (name === "symbol" || name === "symbolmt") return "symbol";
|
|
14
|
+
return name === "wingdings" ? "wingdings" : void 0;
|
|
15
|
+
}
|
|
16
|
+
function isSymbolFontCode(codePoint) {
|
|
17
|
+
return codePoint >= 61472 && codePoint <= 61695;
|
|
18
|
+
}
|
|
19
|
+
function isPrivateUse(text) {
|
|
20
|
+
return /^\p{Co}/u.test(text);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The Symbol glyphs that the Adobe Glyph List gives code points of Adobe's own Private Use Area (U+F6xx and U+F8xx), which name no character, and the Unicode characters that are the same glyphs: the pieces a tall bracket, parenthesis or brace is assembled from, the extensions of the integral, vertical-arrow and horizontal-arrow signs, and the serif and sans-serif registered, copyright and trade mark signs. Keyed by the glyph's PostScript name in the Symbol font's built-in encoding (Adobe's `symbol.txt`, https://www.unicode.org/Public/MAPPINGS/VENDORS/ADOBE/symbol.txt, archived at https://web.archive.org/web/20261011050748/http://www.unicode.org/Public/MAPPINGS/VENDORS/ADOBE/symbol.txt), valued by the character of the Unicode Miscellaneous Technical block (https://www.unicode.org/charts/PDF/U2300.pdf, archived at https://web.archive.org/web/2026/https://www.unicode.org/charts/PDF/U2300.pdf) or Latin-1 and Letterlike Symbols block the glyph is. `radicalex`, the extension of the radical sign, is the one such glyph with no Unicode character, and stays as it was written.
|
|
24
|
+
*/
|
|
25
|
+
const SYMBOL_ASSEMBLY_PIECES = /* @__PURE__ */ new Map([
|
|
26
|
+
["parenlefttp", "โ"],
|
|
27
|
+
["parenleftex", "โ"],
|
|
28
|
+
["parenleftbt", "โ"],
|
|
29
|
+
["parenrighttp", "โ"],
|
|
30
|
+
["parenrightex", "โ"],
|
|
31
|
+
["parenrightbt", "โ "],
|
|
32
|
+
["bracketlefttp", "โก"],
|
|
33
|
+
["bracketleftex", "โข"],
|
|
34
|
+
["bracketleftbt", "โฃ"],
|
|
35
|
+
["bracketrighttp", "โค"],
|
|
36
|
+
["bracketrightex", "โฅ"],
|
|
37
|
+
["bracketrightbt", "โฆ"],
|
|
38
|
+
["bracelefttp", "โง"],
|
|
39
|
+
["braceleftmid", "โจ"],
|
|
40
|
+
["braceleftbt", "โฉ"],
|
|
41
|
+
["braceex", "โช"],
|
|
42
|
+
["bracerighttp", "โซ"],
|
|
43
|
+
["bracerightmid", "โฌ"],
|
|
44
|
+
["bracerightbt", "โญ"],
|
|
45
|
+
["integralex", "โฎ"],
|
|
46
|
+
["arrowhorizex", "โฏ"],
|
|
47
|
+
["arrowvertex", "โ"],
|
|
48
|
+
["registerserif", "ยฎ"],
|
|
49
|
+
["registersans", "ยฎ"],
|
|
50
|
+
["copyrightserif", "ยฉ"],
|
|
51
|
+
["copyrightsans", "ยฉ"],
|
|
52
|
+
["trademarkserif", "โข"],
|
|
53
|
+
["trademarksans", "โข"]
|
|
54
|
+
]);
|
|
55
|
+
function symbolCharacter(code) {
|
|
56
|
+
const name = symbolGlyphName(code);
|
|
57
|
+
if (name === void 0) return;
|
|
58
|
+
const piece = SYMBOL_ASSEMBLY_PIECES.get(name);
|
|
59
|
+
if (piece !== void 0) return piece;
|
|
60
|
+
const text = glyphNameToUnicode(name);
|
|
61
|
+
return text !== void 0 && text !== "" && !isPrivateUse(text) ? text : void 0;
|
|
62
|
+
}
|
|
63
|
+
function wingdingsCharacter(code) {
|
|
64
|
+
const character = WINGDINGS_CHARACTERS[code];
|
|
65
|
+
return character === void 0 || character === "" ? void 0 : character;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* `text`, the Unicode a font's /ToUnicode CMap gave for a run of its codes, with each Private Use Area code point that is one of the font's own 8-bit codes (0xF020 to 0xF0FF) replaced by the character the font's glyph at that code is. Nothing else changes: a code point outside that range, one the font has no character at, and every character of a font that is not a symbol font stay as they were.
|
|
69
|
+
* @param font - The symbol font the text was read through, `undefined` for any other font, whose text is returned as it is.
|
|
70
|
+
* @param text - The text a CMap gave for one or more codes.
|
|
71
|
+
* @returns The text with the font's own characters in place of its private-use code points.
|
|
72
|
+
*/
|
|
73
|
+
function withSymbolFontCharacters(font, text) {
|
|
74
|
+
if (font === void 0) return text;
|
|
75
|
+
const character = font === "symbol" ? symbolCharacter : wingdingsCharacter;
|
|
76
|
+
let out = "";
|
|
77
|
+
for (const char of text) {
|
|
78
|
+
const codePoint = char.codePointAt(0);
|
|
79
|
+
out += codePoint !== void 0 && isSymbolFontCode(codePoint) ? character(codePoint - SYMBOL_FONT_PRIVATE_USE_BASE) ?? char : char;
|
|
80
|
+
}
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { symbolFontOf, withSymbolFontCharacters };
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/wingdings-characters.ts
|
|
3
|
+
const WINGDINGS_CHARACTERS = [
|
|
4
|
+
"",
|
|
5
|
+
"",
|
|
6
|
+
"",
|
|
7
|
+
"",
|
|
8
|
+
"",
|
|
9
|
+
"",
|
|
10
|
+
"",
|
|
11
|
+
"",
|
|
12
|
+
"",
|
|
13
|
+
"",
|
|
14
|
+
"",
|
|
15
|
+
"",
|
|
16
|
+
"",
|
|
17
|
+
"",
|
|
18
|
+
"",
|
|
19
|
+
"",
|
|
20
|
+
"",
|
|
21
|
+
"",
|
|
22
|
+
"",
|
|
23
|
+
"",
|
|
24
|
+
"",
|
|
25
|
+
"",
|
|
26
|
+
"",
|
|
27
|
+
"",
|
|
28
|
+
"",
|
|
29
|
+
"",
|
|
30
|
+
"",
|
|
31
|
+
"",
|
|
32
|
+
"",
|
|
33
|
+
"",
|
|
34
|
+
"",
|
|
35
|
+
"",
|
|
36
|
+
" ",
|
|
37
|
+
"๐",
|
|
38
|
+
"โ",
|
|
39
|
+
"โ",
|
|
40
|
+
"๐",
|
|
41
|
+
"๐ญ",
|
|
42
|
+
"๐ฎ",
|
|
43
|
+
"๐ฏ",
|
|
44
|
+
"๐ฟ",
|
|
45
|
+
"โ",
|
|
46
|
+
"๐",
|
|
47
|
+
"๐",
|
|
48
|
+
"๐ช",
|
|
49
|
+
"๐ซ",
|
|
50
|
+
"๐ฌ",
|
|
51
|
+
"๐ญ",
|
|
52
|
+
"๐",
|
|
53
|
+
"๐",
|
|
54
|
+
"๐",
|
|
55
|
+
"๐",
|
|
56
|
+
"๐",
|
|
57
|
+
"๐",
|
|
58
|
+
"โณ",
|
|
59
|
+
"๐ฎ",
|
|
60
|
+
"๐ฐ",
|
|
61
|
+
"๐ฒ",
|
|
62
|
+
"๐ณ",
|
|
63
|
+
"๐ด",
|
|
64
|
+
"๐ซ",
|
|
65
|
+
"๐ฌ",
|
|
66
|
+
"โ",
|
|
67
|
+
"โ",
|
|
68
|
+
"๐",
|
|
69
|
+
"โ",
|
|
70
|
+
"๐",
|
|
71
|
+
"๐",
|
|
72
|
+
"๐",
|
|
73
|
+
"โ",
|
|
74
|
+
"โ",
|
|
75
|
+
"โ",
|
|
76
|
+
"๐",
|
|
77
|
+
"๐",
|
|
78
|
+
"โบ",
|
|
79
|
+
"๐",
|
|
80
|
+
"โน",
|
|
81
|
+
"๐ฃ",
|
|
82
|
+
"๐ฑ",
|
|
83
|
+
"๐ณ",
|
|
84
|
+
"๐ฑ",
|
|
85
|
+
"โ",
|
|
86
|
+
"โผ",
|
|
87
|
+
"๐ข",
|
|
88
|
+
"โ",
|
|
89
|
+
"๐",
|
|
90
|
+
"โ",
|
|
91
|
+
"๐",
|
|
92
|
+
"โ ",
|
|
93
|
+
"โก",
|
|
94
|
+
"โช",
|
|
95
|
+
"โฏ",
|
|
96
|
+
"๐",
|
|
97
|
+
"โธ",
|
|
98
|
+
"โ",
|
|
99
|
+
"โ",
|
|
100
|
+
"โ",
|
|
101
|
+
"โ",
|
|
102
|
+
"โ",
|
|
103
|
+
"โ",
|
|
104
|
+
"โ",
|
|
105
|
+
"โ",
|
|
106
|
+
"โ",
|
|
107
|
+
"โ",
|
|
108
|
+
"โ",
|
|
109
|
+
"โ",
|
|
110
|
+
"๐ฐ",
|
|
111
|
+
"๐ต",
|
|
112
|
+
"โซ",
|
|
113
|
+
"๐พ",
|
|
114
|
+
"โผ",
|
|
115
|
+
"๐",
|
|
116
|
+
"๐",
|
|
117
|
+
"โ",
|
|
118
|
+
"โ",
|
|
119
|
+
"๐",
|
|
120
|
+
"โงซ",
|
|
121
|
+
"โ",
|
|
122
|
+
"โ",
|
|
123
|
+
"๐",
|
|
124
|
+
"โง",
|
|
125
|
+
"โฎน",
|
|
126
|
+
"โ",
|
|
127
|
+
"๐ต",
|
|
128
|
+
"๐ถ",
|
|
129
|
+
"๐ถ",
|
|
130
|
+
"๐ท",
|
|
131
|
+
"",
|
|
132
|
+
"๐",
|
|
133
|
+
"โ",
|
|
134
|
+
"โ",
|
|
135
|
+
"โ",
|
|
136
|
+
"โ",
|
|
137
|
+
"โ",
|
|
138
|
+
"โ
",
|
|
139
|
+
"โ",
|
|
140
|
+
"โ",
|
|
141
|
+
"โ",
|
|
142
|
+
"โ",
|
|
143
|
+
"๐",
|
|
144
|
+
"โ",
|
|
145
|
+
"โ",
|
|
146
|
+
"โ",
|
|
147
|
+
"โ",
|
|
148
|
+
"โ",
|
|
149
|
+
"โ",
|
|
150
|
+
"โ",
|
|
151
|
+
"โ",
|
|
152
|
+
"โ",
|
|
153
|
+
"โ",
|
|
154
|
+
"๐ข",
|
|
155
|
+
"๐ ",
|
|
156
|
+
"๐ก",
|
|
157
|
+
"๐ฃ",
|
|
158
|
+
"๐",
|
|
159
|
+
"๐",
|
|
160
|
+
"๐",
|
|
161
|
+
"๐",
|
|
162
|
+
"โ",
|
|
163
|
+
"โข",
|
|
164
|
+
"โฌ",
|
|
165
|
+
"โญ",
|
|
166
|
+
"๐",
|
|
167
|
+
"๐",
|
|
168
|
+
"๐",
|
|
169
|
+
"๐",
|
|
170
|
+
"๐ฟ",
|
|
171
|
+
"โช",
|
|
172
|
+
"๐",
|
|
173
|
+
"๐",
|
|
174
|
+
"๐
",
|
|
175
|
+
"โ
",
|
|
176
|
+
"๐",
|
|
177
|
+
"๐",
|
|
178
|
+
"๐",
|
|
179
|
+
"๐",
|
|
180
|
+
"โฏ",
|
|
181
|
+
"โ",
|
|
182
|
+
"โฏ",
|
|
183
|
+
"โฏ",
|
|
184
|
+
"โฏ",
|
|
185
|
+
"โช",
|
|
186
|
+
"โฐ",
|
|
187
|
+
"๐",
|
|
188
|
+
"๐",
|
|
189
|
+
"๐",
|
|
190
|
+
"๐",
|
|
191
|
+
"๐",
|
|
192
|
+
"๐",
|
|
193
|
+
"๐",
|
|
194
|
+
"๐",
|
|
195
|
+
"๐",
|
|
196
|
+
"๐",
|
|
197
|
+
"๐",
|
|
198
|
+
"๐",
|
|
199
|
+
"โฎฐ",
|
|
200
|
+
"โฎฑ",
|
|
201
|
+
"โฎฒ",
|
|
202
|
+
"โฎณ",
|
|
203
|
+
"โฎด",
|
|
204
|
+
"โฎต",
|
|
205
|
+
"โฎถ",
|
|
206
|
+
"โฎท",
|
|
207
|
+
"๐ช",
|
|
208
|
+
"๐ซ",
|
|
209
|
+
"๐",
|
|
210
|
+
"๐",
|
|
211
|
+
"๐",
|
|
212
|
+
"๐",
|
|
213
|
+
"๐",
|
|
214
|
+
"๐",
|
|
215
|
+
"๐",
|
|
216
|
+
"๐",
|
|
217
|
+
"โซ",
|
|
218
|
+
"โฆ",
|
|
219
|
+
"โฎ",
|
|
220
|
+
"โฎ",
|
|
221
|
+
"โฎ",
|
|
222
|
+
"โฎ",
|
|
223
|
+
"โฎ",
|
|
224
|
+
"โฎ",
|
|
225
|
+
"โฎ",
|
|
226
|
+
"โฎ",
|
|
227
|
+
"๐กจ",
|
|
228
|
+
"๐กช",
|
|
229
|
+
"๐กฉ",
|
|
230
|
+
"๐กซ",
|
|
231
|
+
"๐กฌ",
|
|
232
|
+
"๐กญ",
|
|
233
|
+
"๐กฏ",
|
|
234
|
+
"๐กฎ",
|
|
235
|
+
"๐กธ",
|
|
236
|
+
"๐กบ",
|
|
237
|
+
"๐กน",
|
|
238
|
+
"๐กป",
|
|
239
|
+
"๐กผ",
|
|
240
|
+
"๐กฝ",
|
|
241
|
+
"๐กฟ",
|
|
242
|
+
"๐กพ",
|
|
243
|
+
"โฆ",
|
|
244
|
+
"โจ",
|
|
245
|
+
"โง",
|
|
246
|
+
"โฉ",
|
|
247
|
+
"โฌ",
|
|
248
|
+
"โณ",
|
|
249
|
+
"โฌ",
|
|
250
|
+
"โฌ",
|
|
251
|
+
"โฌ",
|
|
252
|
+
"โฌ",
|
|
253
|
+
"๐ขฌ",
|
|
254
|
+
"๐ขญ",
|
|
255
|
+
"๐ถ",
|
|
256
|
+
"โ",
|
|
257
|
+
"๐ท",
|
|
258
|
+
"๐น",
|
|
259
|
+
""
|
|
260
|
+
];
|
|
261
|
+
//#endregion
|
|
262
|
+
exports.WINGDINGS_CHARACTERS = WINGDINGS_CHARACTERS;
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
//#region src/wingdings-characters.ts
|
|
2
|
+
const WINGDINGS_CHARACTERS = [
|
|
3
|
+
"",
|
|
4
|
+
"",
|
|
5
|
+
"",
|
|
6
|
+
"",
|
|
7
|
+
"",
|
|
8
|
+
"",
|
|
9
|
+
"",
|
|
10
|
+
"",
|
|
11
|
+
"",
|
|
12
|
+
"",
|
|
13
|
+
"",
|
|
14
|
+
"",
|
|
15
|
+
"",
|
|
16
|
+
"",
|
|
17
|
+
"",
|
|
18
|
+
"",
|
|
19
|
+
"",
|
|
20
|
+
"",
|
|
21
|
+
"",
|
|
22
|
+
"",
|
|
23
|
+
"",
|
|
24
|
+
"",
|
|
25
|
+
"",
|
|
26
|
+
"",
|
|
27
|
+
"",
|
|
28
|
+
"",
|
|
29
|
+
"",
|
|
30
|
+
"",
|
|
31
|
+
"",
|
|
32
|
+
"",
|
|
33
|
+
"",
|
|
34
|
+
"",
|
|
35
|
+
" ",
|
|
36
|
+
"๐",
|
|
37
|
+
"โ",
|
|
38
|
+
"โ",
|
|
39
|
+
"๐",
|
|
40
|
+
"๐ญ",
|
|
41
|
+
"๐ฎ",
|
|
42
|
+
"๐ฏ",
|
|
43
|
+
"๐ฟ",
|
|
44
|
+
"โ",
|
|
45
|
+
"๐",
|
|
46
|
+
"๐",
|
|
47
|
+
"๐ช",
|
|
48
|
+
"๐ซ",
|
|
49
|
+
"๐ฌ",
|
|
50
|
+
"๐ญ",
|
|
51
|
+
"๐",
|
|
52
|
+
"๐",
|
|
53
|
+
"๐",
|
|
54
|
+
"๐",
|
|
55
|
+
"๐",
|
|
56
|
+
"๐",
|
|
57
|
+
"โณ",
|
|
58
|
+
"๐ฎ",
|
|
59
|
+
"๐ฐ",
|
|
60
|
+
"๐ฒ",
|
|
61
|
+
"๐ณ",
|
|
62
|
+
"๐ด",
|
|
63
|
+
"๐ซ",
|
|
64
|
+
"๐ฌ",
|
|
65
|
+
"โ",
|
|
66
|
+
"โ",
|
|
67
|
+
"๐",
|
|
68
|
+
"โ",
|
|
69
|
+
"๐",
|
|
70
|
+
"๐",
|
|
71
|
+
"๐",
|
|
72
|
+
"โ",
|
|
73
|
+
"โ",
|
|
74
|
+
"โ",
|
|
75
|
+
"๐",
|
|
76
|
+
"๐",
|
|
77
|
+
"โบ",
|
|
78
|
+
"๐",
|
|
79
|
+
"โน",
|
|
80
|
+
"๐ฃ",
|
|
81
|
+
"๐ฑ",
|
|
82
|
+
"๐ณ",
|
|
83
|
+
"๐ฑ",
|
|
84
|
+
"โ",
|
|
85
|
+
"โผ",
|
|
86
|
+
"๐ข",
|
|
87
|
+
"โ",
|
|
88
|
+
"๐",
|
|
89
|
+
"โ",
|
|
90
|
+
"๐",
|
|
91
|
+
"โ ",
|
|
92
|
+
"โก",
|
|
93
|
+
"โช",
|
|
94
|
+
"โฏ",
|
|
95
|
+
"๐",
|
|
96
|
+
"โธ",
|
|
97
|
+
"โ",
|
|
98
|
+
"โ",
|
|
99
|
+
"โ",
|
|
100
|
+
"โ",
|
|
101
|
+
"โ",
|
|
102
|
+
"โ",
|
|
103
|
+
"โ",
|
|
104
|
+
"โ",
|
|
105
|
+
"โ",
|
|
106
|
+
"โ",
|
|
107
|
+
"โ",
|
|
108
|
+
"โ",
|
|
109
|
+
"๐ฐ",
|
|
110
|
+
"๐ต",
|
|
111
|
+
"โซ",
|
|
112
|
+
"๐พ",
|
|
113
|
+
"โผ",
|
|
114
|
+
"๐",
|
|
115
|
+
"๐",
|
|
116
|
+
"โ",
|
|
117
|
+
"โ",
|
|
118
|
+
"๐",
|
|
119
|
+
"โงซ",
|
|
120
|
+
"โ",
|
|
121
|
+
"โ",
|
|
122
|
+
"๐",
|
|
123
|
+
"โง",
|
|
124
|
+
"โฎน",
|
|
125
|
+
"โ",
|
|
126
|
+
"๐ต",
|
|
127
|
+
"๐ถ",
|
|
128
|
+
"๐ถ",
|
|
129
|
+
"๐ท",
|
|
130
|
+
"",
|
|
131
|
+
"๐",
|
|
132
|
+
"โ",
|
|
133
|
+
"โ",
|
|
134
|
+
"โ",
|
|
135
|
+
"โ",
|
|
136
|
+
"โ",
|
|
137
|
+
"โ
",
|
|
138
|
+
"โ",
|
|
139
|
+
"โ",
|
|
140
|
+
"โ",
|
|
141
|
+
"โ",
|
|
142
|
+
"๐",
|
|
143
|
+
"โ",
|
|
144
|
+
"โ",
|
|
145
|
+
"โ",
|
|
146
|
+
"โ",
|
|
147
|
+
"โ",
|
|
148
|
+
"โ",
|
|
149
|
+
"โ",
|
|
150
|
+
"โ",
|
|
151
|
+
"โ",
|
|
152
|
+
"โ",
|
|
153
|
+
"๐ข",
|
|
154
|
+
"๐ ",
|
|
155
|
+
"๐ก",
|
|
156
|
+
"๐ฃ",
|
|
157
|
+
"๐",
|
|
158
|
+
"๐",
|
|
159
|
+
"๐",
|
|
160
|
+
"๐",
|
|
161
|
+
"โ",
|
|
162
|
+
"โข",
|
|
163
|
+
"โฌ",
|
|
164
|
+
"โญ",
|
|
165
|
+
"๐",
|
|
166
|
+
"๐",
|
|
167
|
+
"๐",
|
|
168
|
+
"๐",
|
|
169
|
+
"๐ฟ",
|
|
170
|
+
"โช",
|
|
171
|
+
"๐",
|
|
172
|
+
"๐",
|
|
173
|
+
"๐
",
|
|
174
|
+
"โ
",
|
|
175
|
+
"๐",
|
|
176
|
+
"๐",
|
|
177
|
+
"๐",
|
|
178
|
+
"๐",
|
|
179
|
+
"โฏ",
|
|
180
|
+
"โ",
|
|
181
|
+
"โฏ",
|
|
182
|
+
"โฏ",
|
|
183
|
+
"โฏ",
|
|
184
|
+
"โช",
|
|
185
|
+
"โฐ",
|
|
186
|
+
"๐",
|
|
187
|
+
"๐",
|
|
188
|
+
"๐",
|
|
189
|
+
"๐",
|
|
190
|
+
"๐",
|
|
191
|
+
"๐",
|
|
192
|
+
"๐",
|
|
193
|
+
"๐",
|
|
194
|
+
"๐",
|
|
195
|
+
"๐",
|
|
196
|
+
"๐",
|
|
197
|
+
"๐",
|
|
198
|
+
"โฎฐ",
|
|
199
|
+
"โฎฑ",
|
|
200
|
+
"โฎฒ",
|
|
201
|
+
"โฎณ",
|
|
202
|
+
"โฎด",
|
|
203
|
+
"โฎต",
|
|
204
|
+
"โฎถ",
|
|
205
|
+
"โฎท",
|
|
206
|
+
"๐ช",
|
|
207
|
+
"๐ซ",
|
|
208
|
+
"๐",
|
|
209
|
+
"๐",
|
|
210
|
+
"๐",
|
|
211
|
+
"๐",
|
|
212
|
+
"๐",
|
|
213
|
+
"๐",
|
|
214
|
+
"๐",
|
|
215
|
+
"๐",
|
|
216
|
+
"โซ",
|
|
217
|
+
"โฆ",
|
|
218
|
+
"โฎ",
|
|
219
|
+
"โฎ",
|
|
220
|
+
"โฎ",
|
|
221
|
+
"โฎ",
|
|
222
|
+
"โฎ",
|
|
223
|
+
"โฎ",
|
|
224
|
+
"โฎ",
|
|
225
|
+
"โฎ",
|
|
226
|
+
"๐กจ",
|
|
227
|
+
"๐กช",
|
|
228
|
+
"๐กฉ",
|
|
229
|
+
"๐กซ",
|
|
230
|
+
"๐กฌ",
|
|
231
|
+
"๐กญ",
|
|
232
|
+
"๐กฏ",
|
|
233
|
+
"๐กฎ",
|
|
234
|
+
"๐กธ",
|
|
235
|
+
"๐กบ",
|
|
236
|
+
"๐กน",
|
|
237
|
+
"๐กป",
|
|
238
|
+
"๐กผ",
|
|
239
|
+
"๐กฝ",
|
|
240
|
+
"๐กฟ",
|
|
241
|
+
"๐กพ",
|
|
242
|
+
"โฆ",
|
|
243
|
+
"โจ",
|
|
244
|
+
"โง",
|
|
245
|
+
"โฉ",
|
|
246
|
+
"โฌ",
|
|
247
|
+
"โณ",
|
|
248
|
+
"โฌ",
|
|
249
|
+
"โฌ",
|
|
250
|
+
"โฌ",
|
|
251
|
+
"โฌ",
|
|
252
|
+
"๐ขฌ",
|
|
253
|
+
"๐ขญ",
|
|
254
|
+
"๐ถ",
|
|
255
|
+
"โ",
|
|
256
|
+
"๐ท",
|
|
257
|
+
"๐น",
|
|
258
|
+
""
|
|
259
|
+
];
|
|
260
|
+
//#endregion
|
|
261
|
+
export { WINGDINGS_CHARACTERS };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdf-codec",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.1",
|
|
4
4
|
"description": "Hand-written, dependency-minimal PDF codec: parses arbitrary real-world PDFs and generates new ones, built on its own codec-owned LayoutDocument item model and Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|