reamkit 1.25.1 → 1.27.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.
- package/README.md +12 -5
- package/dist/esm/pdf-reader/annot-draw.d.ts +65 -0
- package/dist/esm/pdf-reader/annot-draw.js +374 -0
- package/dist/esm/pdf-reader/annots.d.ts +3 -1
- package/dist/esm/pdf-reader/annots.js +18 -4
- package/dist/esm/pdf-reader/ccitt.d.ts +18 -0
- package/dist/esm/pdf-reader/ccitt.js +70 -2
- package/dist/esm/pdf-reader/cie-color.d.ts +33 -0
- package/dist/esm/pdf-reader/cie-color.js +112 -0
- package/dist/esm/pdf-reader/content.d.ts +47 -17
- package/dist/esm/pdf-reader/content.js +175 -14
- package/dist/esm/pdf-reader/display.d.ts +1 -1
- package/dist/esm/pdf-reader/display.js +21 -6
- package/dist/esm/pdf-reader/document.d.ts +6 -0
- package/dist/esm/pdf-reader/document.js +29 -1
- package/dist/esm/pdf-reader/embedded-fonts.d.ts +12 -3
- package/dist/esm/pdf-reader/embedded-fonts.js +22 -3
- package/dist/esm/pdf-reader/flow-build.d.ts +12 -4
- package/dist/esm/pdf-reader/flow-build.js +102 -8
- package/dist/esm/pdf-reader/font.js +97 -16
- package/dist/esm/pdf-reader/function.d.ts +16 -0
- package/dist/esm/pdf-reader/function.js +414 -0
- package/dist/esm/pdf-reader/glyph-names.d.ts +6 -0
- package/dist/esm/pdf-reader/glyph-names.js +408 -0
- package/dist/esm/pdf-reader/image-decode.d.ts +8 -4
- package/dist/esm/pdf-reader/image-decode.js +224 -12
- package/dist/esm/pdf-reader/images.d.ts +12 -0
- package/dist/esm/pdf-reader/images.js +109 -9
- package/dist/esm/pdf-reader/jbig2.d.ts +109 -0
- package/dist/esm/pdf-reader/jbig2.js +2606 -0
- package/dist/esm/pdf-reader/layout.d.ts +32 -0
- package/dist/esm/pdf-reader/layout.js +189 -40
- package/dist/esm/pdf-reader/lexer.d.ts +2 -0
- package/dist/esm/pdf-reader/lexer.js +4 -0
- package/dist/esm/pdf-reader/optional-content.d.ts +36 -0
- package/dist/esm/pdf-reader/optional-content.js +93 -0
- package/dist/esm/pdf-reader/reader.d.ts +5 -2
- package/dist/esm/pdf-reader/reader.js +80 -7
- package/dist/esm/pdf-reader/shading.d.ts +71 -6
- package/dist/esm/pdf-reader/shading.js +185 -15
- package/dist/esm/pdf-reader/standard-metrics.d.ts +8 -0
- package/dist/esm/pdf-reader/standard-metrics.js +18 -0
- package/dist/esm/pdf-reader/standard-widths.d.ts +20 -0
- package/dist/esm/pdf-reader/standard-widths.js +62 -0
- package/dist/esm/pdf-reader/tagged.js +204 -32
- package/dist/esm/pdf-reader/text-rules.d.ts +16 -0
- package/dist/esm/pdf-reader/text-rules.js +112 -0
- package/dist/esm/pdf-reader/text.js +78 -4
- package/dist/esm/pdf-reader/vector.d.ts +5 -0
- package/dist/esm/pdf-reader/vector.js +39 -25
- package/dist/esm/word/docx-writer.js +213 -23
- package/package.json +1 -1
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
import { FEATURES } from "../core/ir/features.js";
|
|
2
2
|
import { PdfFile } from "./document.js";
|
|
3
|
+
import { extractPageText } from "./text.js";
|
|
4
|
+
import { collectPageVectors } from "./vector.js";
|
|
3
5
|
import { reconstructByLayout } from "./layout.js";
|
|
4
6
|
import { reconstructTaggedPdf } from "./tagged.js";
|
|
5
7
|
//#region src/pdf-reader/reader.ts
|
|
6
8
|
function sniffPdf(bytes) {
|
|
7
9
|
const limit = Math.min(bytes.length - 5, 1024);
|
|
8
10
|
for (let i = 0; i <= limit; i++) if (bytes[i] === 37 && bytes[i + 1] === 80 && bytes[i + 2] === 68 && bytes[i + 3] === 70 && bytes[i + 4] === 45) return true;
|
|
9
|
-
return
|
|
11
|
+
return endsLikePdf(bytes);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* §7.5.5 — a file with no header at all, recognised by how it ENDS.
|
|
15
|
+
*
|
|
16
|
+
* bug1606566.pdf begins with the binary comment that normally FOLLOWS the
|
|
17
|
+
* header and has no `%PDF-` anywhere: the producer wrote the second line and
|
|
18
|
+
* not the first. Every reader takes it — poppler says "May not be a PDF file
|
|
19
|
+
* (continuing anyway)" and reads its one line of text — and we refused the file
|
|
20
|
+
* outright, which is the worst answer of the three.
|
|
21
|
+
*
|
|
22
|
+
* The two tokens that close every PDF and close nothing else: the cross-
|
|
23
|
+
* reference offset and the end-of-file marker, in that order, at the end.
|
|
24
|
+
*/
|
|
25
|
+
function endsLikePdf(bytes) {
|
|
26
|
+
const tail = bytes.subarray(Math.max(0, bytes.length - 2048));
|
|
27
|
+
const text = new TextDecoder("latin1").decode(tail);
|
|
28
|
+
const eof = text.lastIndexOf("%%EOF");
|
|
29
|
+
return eof >= 0 && text.lastIndexOf("startxref") < eof;
|
|
10
30
|
}
|
|
11
31
|
/**
|
|
12
32
|
* Parse PDF bytes into a {@link FlowDoc} (E-PDF EP5): reconstruct via the tagged
|
|
@@ -20,14 +40,17 @@ function sniffPdf(bytes) {
|
|
|
20
40
|
* opens permissions-only encryption.
|
|
21
41
|
* @param filters Decoders for `/Filter` names this reader does not implement
|
|
22
42
|
* (§7.4); see {@link StreamFilters}.
|
|
23
|
-
* @param layout `'
|
|
43
|
+
* @param layout `'auto'` (the default) lets the FILE decide: a page that is
|
|
44
|
+
* mostly marks is reproduced, one that is mostly lines is re-set,
|
|
45
|
+
* and the reader records which it chose. `'flow'` reads a
|
|
46
|
+
* re-flowable document out of the page —
|
|
24
47
|
* paragraphs and tables in reading order, from the structure
|
|
25
48
|
* tree where there is one. `'positional'` keeps the page: every
|
|
26
49
|
* line stands where its glyphs do, beside the artwork, which is
|
|
27
50
|
* what a form or a drawing needs and what a paragraph cannot be.
|
|
28
51
|
* @returns The reconstructed FlowDoc and its accumulated {@link Loss} report.
|
|
29
52
|
*/
|
|
30
|
-
function readPdf(bytes, password = "", layout = "
|
|
53
|
+
function readPdf(bytes, password = "", layout = "auto", filters = {}) {
|
|
31
54
|
const file = PdfFile.parse(bytes, password, filters);
|
|
32
55
|
const losses = [];
|
|
33
56
|
if (file.encryptionUnsupported) losses.push({
|
|
@@ -40,9 +63,15 @@ function readPdf(bytes, password = "", layout = "flow", filters = {}) {
|
|
|
40
63
|
feature: FEATURES.text,
|
|
41
64
|
detail: `PDF stream filter /${name} is not supported; streams using it are unreadable`
|
|
42
65
|
});
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
66
|
+
const reading = layout === "auto" ? readingOf(file) : layout;
|
|
67
|
+
if (layout === "auto") losses.push({
|
|
68
|
+
severity: "degraded",
|
|
69
|
+
feature: FEATURES.text,
|
|
70
|
+
detail: reading === "positional" ? "PDF read as a PAGE (placed): its artwork outweighs its prose, so every line stands where its glyphs stand — pass pdfLayout: \"flow\" to re-set it as a document instead" : "PDF read as a DOCUMENT (flowing): its prose outweighs its artwork, so the words re-set and the artwork takes its turn in reading order — pass pdfLayout: \"positional\" to reproduce the page instead"
|
|
71
|
+
});
|
|
72
|
+
const tagged = reading === "positional" ? void 0 : reconstructTaggedPdf(file);
|
|
73
|
+
const reconstruction = tagged ?? reconstructByLayout(file, reading);
|
|
74
|
+
if (!tagged && reading !== "positional") losses.push({
|
|
46
75
|
severity: "degraded",
|
|
47
76
|
feature: FEATURES.text,
|
|
48
77
|
detail: "untagged PDF — text and headings reconstructed heuristically from glyph positions; structure is approximate"
|
|
@@ -59,6 +88,50 @@ function readPdf(bytes, password = "", layout = "flow", filters = {}) {
|
|
|
59
88
|
};
|
|
60
89
|
}
|
|
61
90
|
/**
|
|
91
|
+
* Which reading a PDF asks for: a DOCUMENT to re-set, or a PAGE to reproduce.
|
|
92
|
+
*
|
|
93
|
+
* The two cannot be mixed. A flowing reading moves the words, and words that
|
|
94
|
+
* move cannot agree with rules that do not — anchored artwork over reflowed
|
|
95
|
+
* text puts every label on the wrong box. A placed reading keeps both where
|
|
96
|
+
* they were drawn, and reflows nothing.
|
|
97
|
+
*
|
|
98
|
+
* The file says which it is by what is on it. A form or a drawing is mostly
|
|
99
|
+
* MARKS — 160F-2019.pdf sets 28 numbered rows in 355 ruled boxes — and a paper
|
|
100
|
+
* is mostly LINES, with a rule or two between them. So the marks are counted
|
|
101
|
+
* against the lines, on the MEDIAN page rather than the worst, since one plan
|
|
102
|
+
* folded into a report does not make the report a plan.
|
|
103
|
+
*
|
|
104
|
+
* A threshold is a guess, and this one is stated rather than hidden: the reader
|
|
105
|
+
* records which reading it took and why, and the caller can name the other.
|
|
106
|
+
*/
|
|
107
|
+
function readingOf(file) {
|
|
108
|
+
/** Below this many marks a page is prose with decoration, whatever the ratio. */
|
|
109
|
+
const ENOUGH_MARKS = 20;
|
|
110
|
+
/** Twice as many marks as lines is a page that is drawn rather than written. */
|
|
111
|
+
const DRAWN = 2;
|
|
112
|
+
const ratios = [];
|
|
113
|
+
for (const page of file.pages()) {
|
|
114
|
+
let marks = 0;
|
|
115
|
+
let lines = 0;
|
|
116
|
+
try {
|
|
117
|
+
marks = collectPageVectors(file, page, []).vectors.length;
|
|
118
|
+
const ys = /* @__PURE__ */ new Set();
|
|
119
|
+
for (const run of extractPageText(file, page)) ys.add(Math.round(run.y));
|
|
120
|
+
lines = ys.size;
|
|
121
|
+
} catch {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (marks < ENOUGH_MARKS) {
|
|
125
|
+
ratios.push(0);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
ratios.push(lines > 0 ? marks / lines : DRAWN);
|
|
129
|
+
}
|
|
130
|
+
if (ratios.length === 0) return "flow";
|
|
131
|
+
const sorted = [...ratios].sort((a, b) => a - b);
|
|
132
|
+
return (sorted[Math.floor(sorted.length / 2)] ?? 0) >= DRAWN ? "positional" : "flow";
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
62
135
|
* The `pdfReader` adapter: a {@link DocumentReader} that sniffs the `%PDF-`
|
|
63
136
|
* header and parses the bytes into a {@link FlowDoc} (E-PDF EP5).
|
|
64
137
|
*/
|
|
@@ -72,7 +145,7 @@ var pdfReader = {
|
|
|
72
145
|
FEATURES.images
|
|
73
146
|
]),
|
|
74
147
|
sniff: sniffPdf,
|
|
75
|
-
read: (bytes, opts) => readPdf(bytes, typeof opts?.password === "string" ? opts.password : "", opts?.pdfLayout === "positional" ? "positional" : "flow", isFilters(opts?.filters) ? opts.filters : {})
|
|
148
|
+
read: (bytes, opts) => readPdf(bytes, typeof opts?.password === "string" ? opts.password : "", opts?.pdfLayout === "positional" ? "positional" : opts?.pdfLayout === "flow" ? "flow" : "auto", isFilters(opts?.filters) ? opts.filters : {})
|
|
76
149
|
};
|
|
77
150
|
/** A caller's `filters` option, when it is the shape the reader can use. */
|
|
78
151
|
function isFilters(value) {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { CieSpace } from './cie-color.js';
|
|
2
|
+
import { PdfFunction } from './function.js';
|
|
1
3
|
import { ShapeGradient } from '../core/vector.js';
|
|
2
|
-
import {
|
|
4
|
+
import { PdfDict } from '../pdf/objects.js';
|
|
5
|
+
import { PdfFile } from './document.js';
|
|
3
6
|
/**
|
|
4
7
|
* Resolve a page's `/Pattern` resources into gradient fills (E-PDF EP16c, ISO
|
|
5
8
|
* 32000-1 §8.7.4.5). Every `PatternType` 2 (shading) pattern is evaluated — its
|
|
@@ -8,9 +11,12 @@ import { PdfFile, PdfPage } from './document.js';
|
|
|
8
11
|
* filled with `/Pattern cs /Pn scn`. The bare `sh` operator (clip-bounded) is
|
|
9
12
|
* not captured.
|
|
10
13
|
*
|
|
14
|
+
* @param file The owning file.
|
|
15
|
+
* @param resources The resource dictionary in force — a page's, or the form or
|
|
16
|
+
* annotation appearance's own.
|
|
11
17
|
* @returns A map from pattern resource name to its {@link ShapeGradient}.
|
|
12
18
|
*/
|
|
13
|
-
export declare function buildShadingMap(file: PdfFile,
|
|
19
|
+
export declare function buildShadingMap(file: PdfFile, resources: PdfDict | undefined): Map<string, ShapeGradient>;
|
|
14
20
|
/**
|
|
15
21
|
* §11.6.4.4 — the constant fill alpha (`/ca`) of every `/ExtGState` the page
|
|
16
22
|
* names, by name.
|
|
@@ -20,8 +26,67 @@ export declare function buildShadingMap(file: PdfFile, page: PdfPage): Map<strin
|
|
|
20
26
|
* a green band at `ca` 0.6, meant to be read THROUGH: painted solid, the floor
|
|
21
27
|
* plan under each band disappears.
|
|
22
28
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
29
|
+
* §11.3.5 `/BM` comes off the same dictionary. A blend nothing downstream can
|
|
30
|
+
* perform is still worth knowing: `Multiply` and `Darken` both let dark ink
|
|
31
|
+
* under the paint show through, which is what a highlighter IS, and a mark that
|
|
32
|
+
* only darkens belongs UNDER the words rather than over them.
|
|
33
|
+
*
|
|
34
|
+
* @param file The owning file.
|
|
35
|
+
* @param resources The resource dictionary in force — a page's, or the form or
|
|
36
|
+
* annotation appearance's own, since `gs` resolves against
|
|
37
|
+
* whichever is current.
|
|
38
|
+
* @returns Name → the fill alpha and blend worth carrying, for the states that
|
|
39
|
+
* state one.
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildAlphaMap(file: PdfFile, resources: PdfDict | undefined): Map<string, GsPaint>;
|
|
42
|
+
/** What a `/ExtGState` says about paint that the reconstruction can carry. */
|
|
43
|
+
export interface GsPaint {
|
|
44
|
+
/** §11.6.4.4 `/ca` — the constant fill alpha, when it is below 1. */
|
|
45
|
+
readonly alpha?: number;
|
|
46
|
+
/** §11.3.5 `/BM` — the paint only darkens, so what it covers shows through. */
|
|
47
|
+
readonly darkens?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* §11.3.5 `/BM` — a blend NOTHING downstream can perform, named so the loss
|
|
50
|
+
* report can say which. `Normal` is no blend at all and is never named here.
|
|
51
|
+
*/
|
|
52
|
+
readonly blend?: string;
|
|
53
|
+
/**
|
|
54
|
+
* §11.6.5 `/SMask` — the paint's opacity varies from place to place, out of
|
|
55
|
+
* another group's luminosity or alpha. Nothing downstream has a mask like it.
|
|
56
|
+
*/
|
|
57
|
+
readonly masked?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* §8.6 — how many components a colour space takes, and what they mean.
|
|
61
|
+
*
|
|
62
|
+
* `sc` / `scn` give bare numbers; only the space in force says whether `1 1 1`
|
|
63
|
+
* is white or something else, and whether a lone `1` is white (DeviceGray) or
|
|
64
|
+
* the colorant at full strength (Separation), which is usually black.
|
|
65
|
+
*/
|
|
66
|
+
export interface ColorSpaceInfo {
|
|
67
|
+
readonly kind: 'gray' | 'rgb' | 'cmyk' | 'tint';
|
|
68
|
+
readonly components: number;
|
|
69
|
+
/**
|
|
70
|
+
* §8.6.5.6/§8.6.5.7 — the CIE parameters, for a `CalGray` or `CalRGB` space.
|
|
71
|
+
* Its numbers look like a device space's and are not: they mean what comes
|
|
72
|
+
* out of this transform.
|
|
73
|
+
*/
|
|
74
|
+
readonly cie?: CieSpace;
|
|
75
|
+
/**
|
|
76
|
+
* §8.6.6.4/§8.6.6.5 — for a `Separation` or `DeviceN`, the way OUT of it: the
|
|
77
|
+
* tint transform and the space its numbers land in. Absent where the file
|
|
78
|
+
* states a transform this cannot run, and then a tint is only "this much ink".
|
|
79
|
+
*/
|
|
80
|
+
readonly tint?: {
|
|
81
|
+
readonly transform: PdfFunction;
|
|
82
|
+
readonly alternate: ColorSpaceInfo;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The spaces a `/ColorSpace` resource dictionary names, by name.
|
|
87
|
+
*
|
|
88
|
+
* @param file The owning file.
|
|
89
|
+
* @param resources The resource dictionary in force.
|
|
90
|
+
* @returns Name → what the space comes to, for the spaces that are read.
|
|
26
91
|
*/
|
|
27
|
-
export declare function
|
|
92
|
+
export declare function buildColorSpaceMap(file: PdfFile, resources: PdfDict | undefined): Map<string, ColorSpaceInfo>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { PDF_NULL, PdfStream } from "../pdf/objects.js";
|
|
1
|
+
import { PDF_NULL, PdfName, PdfStream } from "../pdf/objects.js";
|
|
2
|
+
import { readFunction } from "./function.js";
|
|
2
3
|
//#region src/pdf-reader/shading.ts
|
|
3
4
|
/**
|
|
4
5
|
* Resolve a page's `/Pattern` resources into gradient fills (E-PDF EP16c, ISO
|
|
@@ -8,12 +9,15 @@ import { PDF_NULL, PdfStream } from "../pdf/objects.js";
|
|
|
8
9
|
* filled with `/Pattern cs /Pn scn`. The bare `sh` operator (clip-bounded) is
|
|
9
10
|
* not captured.
|
|
10
11
|
*
|
|
12
|
+
* @param file The owning file.
|
|
13
|
+
* @param resources The resource dictionary in force — a page's, or the form or
|
|
14
|
+
* annotation appearance's own.
|
|
11
15
|
* @returns A map from pattern resource name to its {@link ShapeGradient}.
|
|
12
16
|
*/
|
|
13
|
-
function buildShadingMap(file,
|
|
17
|
+
function buildShadingMap(file, resources) {
|
|
14
18
|
const out = /* @__PURE__ */ new Map();
|
|
15
|
-
if (!
|
|
16
|
-
const patterns = file.get(
|
|
19
|
+
if (!resources) return out;
|
|
20
|
+
const patterns = file.get(resources, "Pattern");
|
|
17
21
|
if (!(patterns instanceof Map)) return out;
|
|
18
22
|
for (const [nm, value] of patterns) {
|
|
19
23
|
const pat = file.resolve(value);
|
|
@@ -74,14 +78,30 @@ function parseFunction(file, value) {
|
|
|
74
78
|
const span = d1 - d0 || 1;
|
|
75
79
|
for (let i = 0; i < subs.length; i++) {
|
|
76
80
|
const sub = parseFunction(file, subs[i]);
|
|
77
|
-
if (!sub || sub.length
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
if (!sub || sub.length === 0) continue;
|
|
82
|
+
const lo = ((edges[i] ?? d0) - d0) / span;
|
|
83
|
+
const hi = ((edges[i + 1] ?? d1) - d0) / span;
|
|
84
|
+
for (const stop of sub) pushStop(stops, lo + stop.offset * (hi - lo), stop.colorHex);
|
|
80
85
|
}
|
|
81
86
|
return stops.length > 0 ? stops : void 0;
|
|
82
87
|
}
|
|
83
88
|
if (type === 0 && resolved instanceof PdfStream) return sampleFunction(file, resolved);
|
|
89
|
+
if (type === 4) {
|
|
90
|
+
const fn = readFunction(file, resolved);
|
|
91
|
+
if (!fn) return void 0;
|
|
92
|
+
const domain = numArray(file, dict.get("Domain")) ?? [0, 1];
|
|
93
|
+
const d0 = domain[0] ?? 0;
|
|
94
|
+
const d1 = domain[1] ?? 1;
|
|
95
|
+
const stops = [];
|
|
96
|
+
for (let s = 0; s < PS_STOPS; s++) {
|
|
97
|
+
const off = s / (PS_STOPS - 1);
|
|
98
|
+
pushStop(stops, off, colorOf(fn([d0 + off * (d1 - d0)])));
|
|
99
|
+
}
|
|
100
|
+
return stops.length > 0 ? stops : void 0;
|
|
101
|
+
}
|
|
84
102
|
}
|
|
103
|
+
/** How many places a type-4 gradient is sampled at along its domain. */
|
|
104
|
+
var PS_STOPS = 16;
|
|
85
105
|
function sampleFunction(file, stream) {
|
|
86
106
|
const d = stream.dict;
|
|
87
107
|
const size = numArray(file, d.get("Size"));
|
|
@@ -162,22 +182,172 @@ function pushStop(stops, offset, colorHex) {
|
|
|
162
182
|
* a green band at `ca` 0.6, meant to be read THROUGH: painted solid, the floor
|
|
163
183
|
* plan under each band disappears.
|
|
164
184
|
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
185
|
+
* §11.3.5 `/BM` comes off the same dictionary. A blend nothing downstream can
|
|
186
|
+
* perform is still worth knowing: `Multiply` and `Darken` both let dark ink
|
|
187
|
+
* under the paint show through, which is what a highlighter IS, and a mark that
|
|
188
|
+
* only darkens belongs UNDER the words rather than over them.
|
|
189
|
+
*
|
|
190
|
+
* @param file The owning file.
|
|
191
|
+
* @param resources The resource dictionary in force — a page's, or the form or
|
|
192
|
+
* annotation appearance's own, since `gs` resolves against
|
|
193
|
+
* whichever is current.
|
|
194
|
+
* @returns Name → the fill alpha and blend worth carrying, for the states that
|
|
195
|
+
* state one.
|
|
168
196
|
*/
|
|
169
|
-
function buildAlphaMap(file,
|
|
197
|
+
function buildAlphaMap(file, resources) {
|
|
170
198
|
const out = /* @__PURE__ */ new Map();
|
|
171
|
-
if (!
|
|
172
|
-
const states = file.get(
|
|
199
|
+
if (!resources) return out;
|
|
200
|
+
const states = file.get(resources, "ExtGState");
|
|
173
201
|
if (!(states instanceof Map)) return out;
|
|
174
202
|
for (const [name, value] of states) {
|
|
175
203
|
const state = file.resolve(value);
|
|
176
204
|
if (!(state instanceof Map)) continue;
|
|
177
205
|
const ca = file.resolve(state.get("ca") ?? PDF_NULL);
|
|
178
|
-
|
|
206
|
+
const alpha = typeof ca === "number" && ca >= 0 && ca < 1 ? ca : void 0;
|
|
207
|
+
const bm = file.resolve(state.get("BM") ?? PDF_NULL);
|
|
208
|
+
const first = Array.isArray(bm) ? file.resolve(bm[0] ?? PDF_NULL) : bm;
|
|
209
|
+
const mode = first instanceof PdfName ? first.value : void 0;
|
|
210
|
+
const darkens = mode === "Multiply" || mode === "Darken";
|
|
211
|
+
const blend = mode !== void 0 && mode !== "Normal" && mode !== "Compatible" && !darkens ? mode : void 0;
|
|
212
|
+
const masked = file.resolve(state.get("SMask") ?? PDF_NULL) instanceof Map;
|
|
213
|
+
if (alpha === void 0 && !darkens && blend === void 0 && !masked) continue;
|
|
214
|
+
out.set(name, {
|
|
215
|
+
...alpha !== void 0 ? { alpha } : {},
|
|
216
|
+
...darkens ? { darkens: true } : {},
|
|
217
|
+
...blend !== void 0 ? { blend } : {},
|
|
218
|
+
...masked ? { masked: true } : {}
|
|
219
|
+
});
|
|
179
220
|
}
|
|
180
221
|
return out;
|
|
181
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* The spaces a `/ColorSpace` resource dictionary names, by name.
|
|
225
|
+
*
|
|
226
|
+
* @param file The owning file.
|
|
227
|
+
* @param resources The resource dictionary in force.
|
|
228
|
+
* @returns Name → what the space comes to, for the spaces that are read.
|
|
229
|
+
*/
|
|
230
|
+
function buildColorSpaceMap(file, resources) {
|
|
231
|
+
const out = /* @__PURE__ */ new Map();
|
|
232
|
+
if (!resources) return out;
|
|
233
|
+
const spaces = file.get(resources, "ColorSpace");
|
|
234
|
+
if (!(spaces instanceof Map)) return out;
|
|
235
|
+
for (const [name, value] of spaces) {
|
|
236
|
+
const info = colorSpaceAt(file, file.resolve(value), 0);
|
|
237
|
+
if (info) out.set(name, info);
|
|
238
|
+
}
|
|
239
|
+
return out;
|
|
240
|
+
}
|
|
241
|
+
/** An alternate space may name another; this is where that stops. */
|
|
242
|
+
var MAX_ALTERNATE = 4;
|
|
243
|
+
/** What a colour space object comes to, or `undefined` for one not read. */
|
|
244
|
+
function colorSpaceAt(file, cs, depth) {
|
|
245
|
+
if (cs instanceof PdfName) return byFamily(cs.value, 0);
|
|
246
|
+
if (!Array.isArray(cs) || cs.length === 0) return void 0;
|
|
247
|
+
const head = file.resolve(cs[0]);
|
|
248
|
+
if (!(head instanceof PdfName)) return void 0;
|
|
249
|
+
if (head.value === "ICCBased") {
|
|
250
|
+
const stream = file.resolve(cs[1] ?? PDF_NULL);
|
|
251
|
+
const n = stream instanceof PdfStream ? file.get(stream.dict, "N") : void 0;
|
|
252
|
+
return byFamily("ICCBased", typeof n === "number" ? n : 3);
|
|
253
|
+
}
|
|
254
|
+
if (head.value === "Indexed") return;
|
|
255
|
+
if (head.value === "CalGray") {
|
|
256
|
+
const params = file.resolve(cs[1] ?? PDF_NULL);
|
|
257
|
+
const cie = params instanceof Map ? cieParams(file, params, false) : void 0;
|
|
258
|
+
const base = {
|
|
259
|
+
kind: "gray",
|
|
260
|
+
components: 1
|
|
261
|
+
};
|
|
262
|
+
return cie ? {
|
|
263
|
+
...base,
|
|
264
|
+
cie
|
|
265
|
+
} : base;
|
|
266
|
+
}
|
|
267
|
+
if (head.value === "Separation" || head.value === "DeviceN") {
|
|
268
|
+
const names = file.resolve(cs[1] ?? PDF_NULL);
|
|
269
|
+
const n = head.value === "Separation" ? 1 : Array.isArray(names) ? names.length : 1;
|
|
270
|
+
const alternate = depth < MAX_ALTERNATE ? colorSpaceAt(file, file.resolve(cs[2] ?? PDF_NULL), depth + 1) : void 0;
|
|
271
|
+
const transform = readFunction(file, cs[3]);
|
|
272
|
+
if (alternate && transform && alternate.kind !== "tint") return {
|
|
273
|
+
kind: "tint",
|
|
274
|
+
components: n,
|
|
275
|
+
tint: {
|
|
276
|
+
transform,
|
|
277
|
+
alternate
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
return {
|
|
281
|
+
kind: "tint",
|
|
282
|
+
components: n
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
return byFamily(head.value, 0);
|
|
286
|
+
}
|
|
287
|
+
/** §8.6.5.6/§8.6.5.7 — the white point, gamma and matrix a CIE space states. */
|
|
288
|
+
function cieParams(file, params, rgb) {
|
|
289
|
+
const nums = (v) => Array.isArray(v) ? v.map((x) => file.resolve(x)).filter((x) => typeof x === "number") : [];
|
|
290
|
+
const white = nums(file.get(params, "WhitePoint"));
|
|
291
|
+
if (white.length < 3 || !(white[1] > 0)) return void 0;
|
|
292
|
+
const gammaRaw = file.get(params, "Gamma");
|
|
293
|
+
const gamma = typeof gammaRaw === "number" ? [gammaRaw] : nums(gammaRaw);
|
|
294
|
+
const matrix = nums(file.get(params, "Matrix"));
|
|
295
|
+
return {
|
|
296
|
+
white: [
|
|
297
|
+
white[0],
|
|
298
|
+
white[1],
|
|
299
|
+
white[2]
|
|
300
|
+
],
|
|
301
|
+
gamma: gamma.length > 0 ? gamma : rgb ? [
|
|
302
|
+
1,
|
|
303
|
+
1,
|
|
304
|
+
1
|
|
305
|
+
] : [1],
|
|
306
|
+
...rgb ? { matrix: matrix.length === 9 ? matrix : [
|
|
307
|
+
1,
|
|
308
|
+
0,
|
|
309
|
+
0,
|
|
310
|
+
0,
|
|
311
|
+
1,
|
|
312
|
+
0,
|
|
313
|
+
0,
|
|
314
|
+
0,
|
|
315
|
+
1
|
|
316
|
+
] } : {}
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function byFamily(family, n) {
|
|
320
|
+
switch (family) {
|
|
321
|
+
case "DeviceGray":
|
|
322
|
+
case "CalGray":
|
|
323
|
+
case "G": return {
|
|
324
|
+
kind: "gray",
|
|
325
|
+
components: 1
|
|
326
|
+
};
|
|
327
|
+
case "DeviceRGB":
|
|
328
|
+
case "CalRGB":
|
|
329
|
+
case "Lab":
|
|
330
|
+
case "RGB": return {
|
|
331
|
+
kind: "rgb",
|
|
332
|
+
components: 3
|
|
333
|
+
};
|
|
334
|
+
case "DeviceCMYK":
|
|
335
|
+
case "CMYK": return {
|
|
336
|
+
kind: "cmyk",
|
|
337
|
+
components: 4
|
|
338
|
+
};
|
|
339
|
+
case "ICCBased": return n === 1 ? {
|
|
340
|
+
kind: "gray",
|
|
341
|
+
components: 1
|
|
342
|
+
} : n === 4 ? {
|
|
343
|
+
kind: "cmyk",
|
|
344
|
+
components: 4
|
|
345
|
+
} : {
|
|
346
|
+
kind: "rgb",
|
|
347
|
+
components: 3
|
|
348
|
+
};
|
|
349
|
+
default: return;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
182
352
|
//#endregion
|
|
183
|
-
export { buildAlphaMap, buildShadingMap };
|
|
353
|
+
export { buildAlphaMap, buildColorSpaceMap, buildShadingMap };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One face's metrics: `name code width` triples, where the name is the
|
|
3
|
+
* glyph's own, the code is the one Adobe's built-in encoding gives it, and
|
|
4
|
+
* the width is its advance in 1000ths of an em.
|
|
5
|
+
*/
|
|
6
|
+
export declare const STANDARD_METRICS: Readonly<Record<string, string>>;
|
|
7
|
+
/** Every Courier is 600 wide, every glyph — it is a typewriter face. */
|
|
8
|
+
export declare const COURIER_WIDTH = 600;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/pdf-reader/standard-metrics.ts
|
|
2
|
+
/**
|
|
3
|
+
* One face's metrics: `name code width` triples, where the name is the
|
|
4
|
+
* glyph's own, the code is the one Adobe's built-in encoding gives it, and
|
|
5
|
+
* the width is its advance in 1000ths of an em.
|
|
6
|
+
*/
|
|
7
|
+
var STANDARD_METRICS = {
|
|
8
|
+
Helvetica: "space 32 278 exclam 33 278 quotedbl 34 355 numbersign 35 556 dollar 36 556 percent 37 889 ampersand 38 667 quoteright 39 222 parenleft 40 333 parenright 41 333 asterisk 42 389 plus 43 584 comma 44 278 hyphen 45 333 period 46 278 slash 47 278 zero 48 556 one 49 556 two 50 556 three 51 556 four 52 556 five 53 556 six 54 556 seven 55 556 eight 56 556 nine 57 556 colon 58 278 semicolon 59 278 less 60 584 equal 61 584 greater 62 584 question 63 556 at 64 1015 A 65 667 B 66 667 C 67 722 D 68 722 E 69 667 F 70 611 G 71 778 H 72 722 I 73 278 J 74 500 K 75 667 L 76 556 M 77 833 N 78 722 O 79 778 P 80 667 Q 81 778 R 82 722 S 83 667 T 84 611 U 85 722 V 86 667 W 87 944 X 88 667 Y 89 667 Z 90 611 bracketleft 91 278 backslash 92 278 bracketright 93 278 asciicircum 94 469 underscore 95 556 quoteleft 96 222 a 97 556 b 98 556 c 99 500 d 100 556 e 101 556 f 102 278 g 103 556 h 104 556 i 105 222 j 106 222 k 107 500 l 108 222 m 109 833 n 110 556 o 111 556 p 112 556 q 113 556 r 114 333 s 115 500 t 116 278 u 117 556 v 118 500 w 119 722 x 120 500 y 121 500 z 122 500 braceleft 123 334 bar 124 260 braceright 125 334 asciitilde 126 584 exclamdown 161 333 cent 162 556 sterling 163 556 fraction 164 167 yen 165 556 florin 166 556 section 167 556 currency 168 556 quotesingle 169 191 quotedblleft 170 333 guillemotleft 171 556 guilsinglleft 172 333 guilsinglright 173 333 fi 174 500 fl 175 500 endash 177 556 dagger 178 556 daggerdbl 179 556 periodcentered 180 278 paragraph 182 537 bullet 183 350 quotesinglbase 184 222 quotedblbase 185 333 quotedblright 186 333 guillemotright 187 556 ellipsis 188 1000 perthousand 189 1000 questiondown 191 611 grave 193 333 acute 194 333 circumflex 195 333 tilde 196 333 macron 197 333 breve 198 333 dotaccent 199 333 dieresis 200 333 ring 202 333 cedilla 203 333 hungarumlaut 205 333 ogonek 206 333 caron 207 333 emdash 208 1000 AE 225 1000 ordfeminine 227 370 Lslash 232 556 Oslash 233 778 OE 234 1000 ordmasculine 235 365 ae 241 889 dotlessi 245 278 lslash 248 222 oslash 249 611 oe 250 944 germandbls 251 611 Idieresis -1 278 eacute -1 556 abreve -1 556 uhungarumlaut -1 556 ecaron -1 556 Ydieresis -1 667 divide -1 584 Yacute -1 667 Acircumflex -1 667 aacute -1 556 Ucircumflex -1 722 yacute -1 500 scommaaccent -1 500 ecircumflex -1 556 Uring -1 722 Udieresis -1 722 aogonek -1 556 Uacute -1 722 uogonek -1 556 Edieresis -1 667 Dcroat -1 722 commaaccent -1 250 copyright -1 737 Emacron -1 667 ccaron -1 500 aring -1 556 Ncommaaccent -1 722 lacute -1 222 agrave -1 556 Tcommaaccent -1 611 Cacute -1 722 atilde -1 556 Edotaccent -1 667 scaron -1 500 scedilla -1 500 iacute -1 278 lozenge -1 471 Rcaron -1 722 Gcommaaccent -1 778 ucircumflex -1 556 acircumflex -1 556 Amacron -1 667 rcaron -1 333 ccedilla -1 500 Zdotaccent -1 611 Thorn -1 667 Omacron -1 778 Racute -1 722 Sacute -1 667 dcaron -1 643 Umacron -1 722 uring -1 556 threesuperior -1 333 Ograve -1 778 Agrave -1 667 Abreve -1 667 multiply -1 584 uacute -1 556 Tcaron -1 611 partialdiff -1 476 ydieresis -1 500 Nacute -1 722 icircumflex -1 278 Ecircumflex -1 667 adieresis -1 556 edieresis -1 556 cacute -1 500 nacute -1 556 umacron -1 556 Ncaron -1 722 Iacute -1 278 plusminus -1 584 brokenbar -1 260 registered -1 737 Gbreve -1 778 Idotaccent -1 278 summation -1 600 Egrave -1 667 racute -1 333 omacron -1 556 Zacute -1 611 Zcaron -1 611 greaterequal -1 549 Eth -1 722 Ccedilla -1 722 lcommaaccent -1 222 tcaron -1 317 eogonek -1 556 Uogonek -1 722 Aacute -1 667 Adieresis -1 667 egrave -1 556 zacute -1 500 iogonek -1 222 Oacute -1 778 oacute -1 556 amacron -1 556 sacute -1 500 idieresis -1 278 Ocircumflex -1 778 Ugrave -1 722 Delta -1 612 thorn -1 556 twosuperior -1 333 Odieresis -1 778 mu -1 556 igrave -1 278 ohungarumlaut -1 556 Eogonek -1 667 dcroat -1 556 threequarters -1 834 Scedilla -1 667 lcaron -1 299 Kcommaaccent -1 667 Lacute -1 556 trademark -1 1000 edotaccent -1 556 Igrave -1 278 Imacron -1 278 Lcaron -1 556 onehalf -1 834 lessequal -1 549 ocircumflex -1 556 ntilde -1 556 Uhungarumlaut -1 722 Eacute -1 667 emacron -1 556 gbreve -1 556 onequarter -1 834 Scaron -1 667 Scommaaccent -1 667 Ohungarumlaut -1 778 degree -1 400 ograve -1 556 Ccaron -1 722 ugrave -1 556 radical -1 453 Dcaron -1 722 rcommaaccent -1 333 Ntilde -1 722 otilde -1 556 Rcommaaccent -1 722 Lcommaaccent -1 556 Atilde -1 667 Aogonek -1 667 Aring -1 667 Otilde -1 778 zdotaccent -1 500 Ecaron -1 667 Iogonek -1 278 kcommaaccent -1 500 minus -1 584 Icircumflex -1 278 ncaron -1 556 tcommaaccent -1 278 logicalnot -1 584 odieresis -1 556 udieresis -1 556 notequal -1 549 gcommaaccent -1 556 eth -1 556 zcaron -1 500 ncommaaccent -1 556 onesuperior -1 333 imacron -1 278 Euro -1 556",
|
|
9
|
+
"Helvetica-Bold": "space 32 278 exclam 33 333 quotedbl 34 474 numbersign 35 556 dollar 36 556 percent 37 889 ampersand 38 722 quoteright 39 278 parenleft 40 333 parenright 41 333 asterisk 42 389 plus 43 584 comma 44 278 hyphen 45 333 period 46 278 slash 47 278 zero 48 556 one 49 556 two 50 556 three 51 556 four 52 556 five 53 556 six 54 556 seven 55 556 eight 56 556 nine 57 556 colon 58 333 semicolon 59 333 less 60 584 equal 61 584 greater 62 584 question 63 611 at 64 975 A 65 722 B 66 722 C 67 722 D 68 722 E 69 667 F 70 611 G 71 778 H 72 722 I 73 278 J 74 556 K 75 722 L 76 611 M 77 833 N 78 722 O 79 778 P 80 667 Q 81 778 R 82 722 S 83 667 T 84 611 U 85 722 V 86 667 W 87 944 X 88 667 Y 89 667 Z 90 611 bracketleft 91 333 backslash 92 278 bracketright 93 333 asciicircum 94 584 underscore 95 556 quoteleft 96 278 a 97 556 b 98 611 c 99 556 d 100 611 e 101 556 f 102 333 g 103 611 h 104 611 i 105 278 j 106 278 k 107 556 l 108 278 m 109 889 n 110 611 o 111 611 p 112 611 q 113 611 r 114 389 s 115 556 t 116 333 u 117 611 v 118 556 w 119 778 x 120 556 y 121 556 z 122 500 braceleft 123 389 bar 124 280 braceright 125 389 asciitilde 126 584 exclamdown 161 333 cent 162 556 sterling 163 556 fraction 164 167 yen 165 556 florin 166 556 section 167 556 currency 168 556 quotesingle 169 238 quotedblleft 170 500 guillemotleft 171 556 guilsinglleft 172 333 guilsinglright 173 333 fi 174 611 fl 175 611 endash 177 556 dagger 178 556 daggerdbl 179 556 periodcentered 180 278 paragraph 182 556 bullet 183 350 quotesinglbase 184 278 quotedblbase 185 500 quotedblright 186 500 guillemotright 187 556 ellipsis 188 1000 perthousand 189 1000 questiondown 191 611 grave 193 333 acute 194 333 circumflex 195 333 tilde 196 333 macron 197 333 breve 198 333 dotaccent 199 333 dieresis 200 333 ring 202 333 cedilla 203 333 hungarumlaut 205 333 ogonek 206 333 caron 207 333 emdash 208 1000 AE 225 1000 ordfeminine 227 370 Lslash 232 611 Oslash 233 778 OE 234 1000 ordmasculine 235 365 ae 241 889 dotlessi 245 278 lslash 248 278 oslash 249 611 oe 250 944 germandbls 251 611 Idieresis -1 278 eacute -1 556 abreve -1 556 uhungarumlaut -1 611 ecaron -1 556 Ydieresis -1 667 divide -1 584 Yacute -1 667 Acircumflex -1 722 aacute -1 556 Ucircumflex -1 722 yacute -1 556 scommaaccent -1 556 ecircumflex -1 556 Uring -1 722 Udieresis -1 722 aogonek -1 556 Uacute -1 722 uogonek -1 611 Edieresis -1 667 Dcroat -1 722 commaaccent -1 250 copyright -1 737 Emacron -1 667 ccaron -1 556 aring -1 556 Ncommaaccent -1 722 lacute -1 278 agrave -1 556 Tcommaaccent -1 611 Cacute -1 722 atilde -1 556 Edotaccent -1 667 scaron -1 556 scedilla -1 556 iacute -1 278 lozenge -1 494 Rcaron -1 722 Gcommaaccent -1 778 ucircumflex -1 611 acircumflex -1 556 Amacron -1 722 rcaron -1 389 ccedilla -1 556 Zdotaccent -1 611 Thorn -1 667 Omacron -1 778 Racute -1 722 Sacute -1 667 dcaron -1 743 Umacron -1 722 uring -1 611 threesuperior -1 333 Ograve -1 778 Agrave -1 722 Abreve -1 722 multiply -1 584 uacute -1 611 Tcaron -1 611 partialdiff -1 494 ydieresis -1 556 Nacute -1 722 icircumflex -1 278 Ecircumflex -1 667 adieresis -1 556 edieresis -1 556 cacute -1 556 nacute -1 611 umacron -1 611 Ncaron -1 722 Iacute -1 278 plusminus -1 584 brokenbar -1 280 registered -1 737 Gbreve -1 778 Idotaccent -1 278 summation -1 600 Egrave -1 667 racute -1 389 omacron -1 611 Zacute -1 611 Zcaron -1 611 greaterequal -1 549 Eth -1 722 Ccedilla -1 722 lcommaaccent -1 278 tcaron -1 389 eogonek -1 556 Uogonek -1 722 Aacute -1 722 Adieresis -1 722 egrave -1 556 zacute -1 500 iogonek -1 278 Oacute -1 778 oacute -1 611 amacron -1 556 sacute -1 556 idieresis -1 278 Ocircumflex -1 778 Ugrave -1 722 Delta -1 612 thorn -1 611 twosuperior -1 333 Odieresis -1 778 mu -1 611 igrave -1 278 ohungarumlaut -1 611 Eogonek -1 667 dcroat -1 611 threequarters -1 834 Scedilla -1 667 lcaron -1 400 Kcommaaccent -1 722 Lacute -1 611 trademark -1 1000 edotaccent -1 556 Igrave -1 278 Imacron -1 278 Lcaron -1 611 onehalf -1 834 lessequal -1 549 ocircumflex -1 611 ntilde -1 611 Uhungarumlaut -1 722 Eacute -1 667 emacron -1 556 gbreve -1 611 onequarter -1 834 Scaron -1 667 Scommaaccent -1 667 Ohungarumlaut -1 778 degree -1 400 ograve -1 611 Ccaron -1 722 ugrave -1 611 radical -1 549 Dcaron -1 722 rcommaaccent -1 389 Ntilde -1 722 otilde -1 611 Rcommaaccent -1 722 Lcommaaccent -1 611 Atilde -1 722 Aogonek -1 722 Aring -1 722 Otilde -1 778 zdotaccent -1 500 Ecaron -1 667 Iogonek -1 278 kcommaaccent -1 556 minus -1 584 Icircumflex -1 278 ncaron -1 611 tcommaaccent -1 333 logicalnot -1 584 odieresis -1 611 udieresis -1 611 notequal -1 549 gcommaaccent -1 611 eth -1 611 zcaron -1 500 ncommaaccent -1 611 onesuperior -1 333 imacron -1 278 Euro -1 556",
|
|
10
|
+
"Times-Roman": "space 32 250 exclam 33 333 quotedbl 34 408 numbersign 35 500 dollar 36 500 percent 37 833 ampersand 38 778 quoteright 39 333 parenleft 40 333 parenright 41 333 asterisk 42 500 plus 43 564 comma 44 250 hyphen 45 333 period 46 250 slash 47 278 zero 48 500 one 49 500 two 50 500 three 51 500 four 52 500 five 53 500 six 54 500 seven 55 500 eight 56 500 nine 57 500 colon 58 278 semicolon 59 278 less 60 564 equal 61 564 greater 62 564 question 63 444 at 64 921 A 65 722 B 66 667 C 67 667 D 68 722 E 69 611 F 70 556 G 71 722 H 72 722 I 73 333 J 74 389 K 75 722 L 76 611 M 77 889 N 78 722 O 79 722 P 80 556 Q 81 722 R 82 667 S 83 556 T 84 611 U 85 722 V 86 722 W 87 944 X 88 722 Y 89 722 Z 90 611 bracketleft 91 333 backslash 92 278 bracketright 93 333 asciicircum 94 469 underscore 95 500 quoteleft 96 333 a 97 444 b 98 500 c 99 444 d 100 500 e 101 444 f 102 333 g 103 500 h 104 500 i 105 278 j 106 278 k 107 500 l 108 278 m 109 778 n 110 500 o 111 500 p 112 500 q 113 500 r 114 333 s 115 389 t 116 278 u 117 500 v 118 500 w 119 722 x 120 500 y 121 500 z 122 444 braceleft 123 480 bar 124 200 braceright 125 480 asciitilde 126 541 exclamdown 161 333 cent 162 500 sterling 163 500 fraction 164 167 yen 165 500 florin 166 500 section 167 500 currency 168 500 quotesingle 169 180 quotedblleft 170 444 guillemotleft 171 500 guilsinglleft 172 333 guilsinglright 173 333 fi 174 556 fl 175 556 endash 177 500 dagger 178 500 daggerdbl 179 500 periodcentered 180 250 paragraph 182 453 bullet 183 350 quotesinglbase 184 333 quotedblbase 185 444 quotedblright 186 444 guillemotright 187 500 ellipsis 188 1000 perthousand 189 1000 questiondown 191 444 grave 193 333 acute 194 333 circumflex 195 333 tilde 196 333 macron 197 333 breve 198 333 dotaccent 199 333 dieresis 200 333 ring 202 333 cedilla 203 333 hungarumlaut 205 333 ogonek 206 333 caron 207 333 emdash 208 1000 AE 225 889 ordfeminine 227 276 Lslash 232 611 Oslash 233 722 OE 234 889 ordmasculine 235 310 ae 241 667 dotlessi 245 278 lslash 248 278 oslash 249 500 oe 250 722 germandbls 251 500 Idieresis -1 333 eacute -1 444 abreve -1 444 uhungarumlaut -1 500 ecaron -1 444 Ydieresis -1 722 divide -1 564 Yacute -1 722 Acircumflex -1 722 aacute -1 444 Ucircumflex -1 722 yacute -1 500 scommaaccent -1 389 ecircumflex -1 444 Uring -1 722 Udieresis -1 722 aogonek -1 444 Uacute -1 722 uogonek -1 500 Edieresis -1 611 Dcroat -1 722 commaaccent -1 250 copyright -1 760 Emacron -1 611 ccaron -1 444 aring -1 444 Ncommaaccent -1 722 lacute -1 278 agrave -1 444 Tcommaaccent -1 611 Cacute -1 667 atilde -1 444 Edotaccent -1 611 scaron -1 389 scedilla -1 389 iacute -1 278 lozenge -1 471 Rcaron -1 667 Gcommaaccent -1 722 ucircumflex -1 500 acircumflex -1 444 Amacron -1 722 rcaron -1 333 ccedilla -1 444 Zdotaccent -1 611 Thorn -1 556 Omacron -1 722 Racute -1 667 Sacute -1 556 dcaron -1 588 Umacron -1 722 uring -1 500 threesuperior -1 300 Ograve -1 722 Agrave -1 722 Abreve -1 722 multiply -1 564 uacute -1 500 Tcaron -1 611 partialdiff -1 476 ydieresis -1 500 Nacute -1 722 icircumflex -1 278 Ecircumflex -1 611 adieresis -1 444 edieresis -1 444 cacute -1 444 nacute -1 500 umacron -1 500 Ncaron -1 722 Iacute -1 333 plusminus -1 564 brokenbar -1 200 registered -1 760 Gbreve -1 722 Idotaccent -1 333 summation -1 600 Egrave -1 611 racute -1 333 omacron -1 500 Zacute -1 611 Zcaron -1 611 greaterequal -1 549 Eth -1 722 Ccedilla -1 667 lcommaaccent -1 278 tcaron -1 326 eogonek -1 444 Uogonek -1 722 Aacute -1 722 Adieresis -1 722 egrave -1 444 zacute -1 444 iogonek -1 278 Oacute -1 722 oacute -1 500 amacron -1 444 sacute -1 389 idieresis -1 278 Ocircumflex -1 722 Ugrave -1 722 Delta -1 612 thorn -1 500 twosuperior -1 300 Odieresis -1 722 mu -1 500 igrave -1 278 ohungarumlaut -1 500 Eogonek -1 611 dcroat -1 500 threequarters -1 750 Scedilla -1 556 lcaron -1 344 Kcommaaccent -1 722 Lacute -1 611 trademark -1 980 edotaccent -1 444 Igrave -1 333 Imacron -1 333 Lcaron -1 611 onehalf -1 750 lessequal -1 549 ocircumflex -1 500 ntilde -1 500 Uhungarumlaut -1 722 Eacute -1 611 emacron -1 444 gbreve -1 500 onequarter -1 750 Scaron -1 556 Scommaaccent -1 556 Ohungarumlaut -1 722 degree -1 400 ograve -1 500 Ccaron -1 667 ugrave -1 500 radical -1 453 Dcaron -1 722 rcommaaccent -1 333 Ntilde -1 722 otilde -1 500 Rcommaaccent -1 667 Lcommaaccent -1 611 Atilde -1 722 Aogonek -1 722 Aring -1 722 Otilde -1 722 zdotaccent -1 444 Ecaron -1 611 Iogonek -1 333 kcommaaccent -1 500 minus -1 564 Icircumflex -1 333 ncaron -1 500 tcommaaccent -1 278 logicalnot -1 564 odieresis -1 500 udieresis -1 500 notequal -1 549 gcommaaccent -1 500 eth -1 500 zcaron -1 444 ncommaaccent -1 500 onesuperior -1 300 imacron -1 278 Euro -1 500",
|
|
11
|
+
"Times-Bold": "space 32 250 exclam 33 333 quotedbl 34 555 numbersign 35 500 dollar 36 500 percent 37 1000 ampersand 38 833 quoteright 39 333 parenleft 40 333 parenright 41 333 asterisk 42 500 plus 43 570 comma 44 250 hyphen 45 333 period 46 250 slash 47 278 zero 48 500 one 49 500 two 50 500 three 51 500 four 52 500 five 53 500 six 54 500 seven 55 500 eight 56 500 nine 57 500 colon 58 333 semicolon 59 333 less 60 570 equal 61 570 greater 62 570 question 63 500 at 64 930 A 65 722 B 66 667 C 67 722 D 68 722 E 69 667 F 70 611 G 71 778 H 72 778 I 73 389 J 74 500 K 75 778 L 76 667 M 77 944 N 78 722 O 79 778 P 80 611 Q 81 778 R 82 722 S 83 556 T 84 667 U 85 722 V 86 722 W 87 1000 X 88 722 Y 89 722 Z 90 667 bracketleft 91 333 backslash 92 278 bracketright 93 333 asciicircum 94 581 underscore 95 500 quoteleft 96 333 a 97 500 b 98 556 c 99 444 d 100 556 e 101 444 f 102 333 g 103 500 h 104 556 i 105 278 j 106 333 k 107 556 l 108 278 m 109 833 n 110 556 o 111 500 p 112 556 q 113 556 r 114 444 s 115 389 t 116 333 u 117 556 v 118 500 w 119 722 x 120 500 y 121 500 z 122 444 braceleft 123 394 bar 124 220 braceright 125 394 asciitilde 126 520 exclamdown 161 333 cent 162 500 sterling 163 500 fraction 164 167 yen 165 500 florin 166 500 section 167 500 currency 168 500 quotesingle 169 278 quotedblleft 170 500 guillemotleft 171 500 guilsinglleft 172 333 guilsinglright 173 333 fi 174 556 fl 175 556 endash 177 500 dagger 178 500 daggerdbl 179 500 periodcentered 180 250 paragraph 182 540 bullet 183 350 quotesinglbase 184 333 quotedblbase 185 500 quotedblright 186 500 guillemotright 187 500 ellipsis 188 1000 perthousand 189 1000 questiondown 191 500 grave 193 333 acute 194 333 circumflex 195 333 tilde 196 333 macron 197 333 breve 198 333 dotaccent 199 333 dieresis 200 333 ring 202 333 cedilla 203 333 hungarumlaut 205 333 ogonek 206 333 caron 207 333 emdash 208 1000 AE 225 1000 ordfeminine 227 300 Lslash 232 667 Oslash 233 778 OE 234 1000 ordmasculine 235 330 ae 241 722 dotlessi 245 278 lslash 248 278 oslash 249 500 oe 250 722 germandbls 251 556 Idieresis -1 389 eacute -1 444 abreve -1 500 uhungarumlaut -1 556 ecaron -1 444 Ydieresis -1 722 divide -1 570 Yacute -1 722 Acircumflex -1 722 aacute -1 500 Ucircumflex -1 722 yacute -1 500 scommaaccent -1 389 ecircumflex -1 444 Uring -1 722 Udieresis -1 722 aogonek -1 500 Uacute -1 722 uogonek -1 556 Edieresis -1 667 Dcroat -1 722 commaaccent -1 250 copyright -1 747 Emacron -1 667 ccaron -1 444 aring -1 500 Ncommaaccent -1 722 lacute -1 278 agrave -1 500 Tcommaaccent -1 667 Cacute -1 722 atilde -1 500 Edotaccent -1 667 scaron -1 389 scedilla -1 389 iacute -1 278 lozenge -1 494 Rcaron -1 722 Gcommaaccent -1 778 ucircumflex -1 556 acircumflex -1 500 Amacron -1 722 rcaron -1 444 ccedilla -1 444 Zdotaccent -1 667 Thorn -1 611 Omacron -1 778 Racute -1 722 Sacute -1 556 dcaron -1 672 Umacron -1 722 uring -1 556 threesuperior -1 300 Ograve -1 778 Agrave -1 722 Abreve -1 722 multiply -1 570 uacute -1 556 Tcaron -1 667 partialdiff -1 494 ydieresis -1 500 Nacute -1 722 icircumflex -1 278 Ecircumflex -1 667 adieresis -1 500 edieresis -1 444 cacute -1 444 nacute -1 556 umacron -1 556 Ncaron -1 722 Iacute -1 389 plusminus -1 570 brokenbar -1 220 registered -1 747 Gbreve -1 778 Idotaccent -1 389 summation -1 600 Egrave -1 667 racute -1 444 omacron -1 500 Zacute -1 667 Zcaron -1 667 greaterequal -1 549 Eth -1 722 Ccedilla -1 722 lcommaaccent -1 278 tcaron -1 416 eogonek -1 444 Uogonek -1 722 Aacute -1 722 Adieresis -1 722 egrave -1 444 zacute -1 444 iogonek -1 278 Oacute -1 778 oacute -1 500 amacron -1 500 sacute -1 389 idieresis -1 278 Ocircumflex -1 778 Ugrave -1 722 Delta -1 612 thorn -1 556 twosuperior -1 300 Odieresis -1 778 mu -1 556 igrave -1 278 ohungarumlaut -1 500 Eogonek -1 667 dcroat -1 556 threequarters -1 750 Scedilla -1 556 lcaron -1 394 Kcommaaccent -1 778 Lacute -1 667 trademark -1 1000 edotaccent -1 444 Igrave -1 389 Imacron -1 389 Lcaron -1 667 onehalf -1 750 lessequal -1 549 ocircumflex -1 500 ntilde -1 556 Uhungarumlaut -1 722 Eacute -1 667 emacron -1 444 gbreve -1 500 onequarter -1 750 Scaron -1 556 Scommaaccent -1 556 Ohungarumlaut -1 778 degree -1 400 ograve -1 500 Ccaron -1 722 ugrave -1 556 radical -1 549 Dcaron -1 722 rcommaaccent -1 444 Ntilde -1 722 otilde -1 500 Rcommaaccent -1 722 Lcommaaccent -1 667 Atilde -1 722 Aogonek -1 722 Aring -1 722 Otilde -1 778 zdotaccent -1 444 Ecaron -1 667 Iogonek -1 389 kcommaaccent -1 556 minus -1 570 Icircumflex -1 389 ncaron -1 556 tcommaaccent -1 333 logicalnot -1 570 odieresis -1 500 udieresis -1 556 notequal -1 549 gcommaaccent -1 500 eth -1 500 zcaron -1 444 ncommaaccent -1 556 onesuperior -1 300 imacron -1 278 Euro -1 500",
|
|
12
|
+
"Times-Italic": "space 32 250 exclam 33 333 quotedbl 34 420 numbersign 35 500 dollar 36 500 percent 37 833 ampersand 38 778 quoteright 39 333 parenleft 40 333 parenright 41 333 asterisk 42 500 plus 43 675 comma 44 250 hyphen 45 333 period 46 250 slash 47 278 zero 48 500 one 49 500 two 50 500 three 51 500 four 52 500 five 53 500 six 54 500 seven 55 500 eight 56 500 nine 57 500 colon 58 333 semicolon 59 333 less 60 675 equal 61 675 greater 62 675 question 63 500 at 64 920 A 65 611 B 66 611 C 67 667 D 68 722 E 69 611 F 70 611 G 71 722 H 72 722 I 73 333 J 74 444 K 75 667 L 76 556 M 77 833 N 78 667 O 79 722 P 80 611 Q 81 722 R 82 611 S 83 500 T 84 556 U 85 722 V 86 611 W 87 833 X 88 611 Y 89 556 Z 90 556 bracketleft 91 389 backslash 92 278 bracketright 93 389 asciicircum 94 422 underscore 95 500 quoteleft 96 333 a 97 500 b 98 500 c 99 444 d 100 500 e 101 444 f 102 278 g 103 500 h 104 500 i 105 278 j 106 278 k 107 444 l 108 278 m 109 722 n 110 500 o 111 500 p 112 500 q 113 500 r 114 389 s 115 389 t 116 278 u 117 500 v 118 444 w 119 667 x 120 444 y 121 444 z 122 389 braceleft 123 400 bar 124 275 braceright 125 400 asciitilde 126 541 exclamdown 161 389 cent 162 500 sterling 163 500 fraction 164 167 yen 165 500 florin 166 500 section 167 500 currency 168 500 quotesingle 169 214 quotedblleft 170 556 guillemotleft 171 500 guilsinglleft 172 333 guilsinglright 173 333 fi 174 500 fl 175 500 endash 177 500 dagger 178 500 daggerdbl 179 500 periodcentered 180 250 paragraph 182 523 bullet 183 350 quotesinglbase 184 333 quotedblbase 185 556 quotedblright 186 556 guillemotright 187 500 ellipsis 188 889 perthousand 189 1000 questiondown 191 500 grave 193 333 acute 194 333 circumflex 195 333 tilde 196 333 macron 197 333 breve 198 333 dotaccent 199 333 dieresis 200 333 ring 202 333 cedilla 203 333 hungarumlaut 205 333 ogonek 206 333 caron 207 333 emdash 208 889 AE 225 889 ordfeminine 227 276 Lslash 232 556 Oslash 233 722 OE 234 944 ordmasculine 235 310 ae 241 667 dotlessi 245 278 lslash 248 278 oslash 249 500 oe 250 667 germandbls 251 500 Idieresis -1 333 eacute -1 444 abreve -1 500 uhungarumlaut -1 500 ecaron -1 444 Ydieresis -1 556 divide -1 675 Yacute -1 556 Acircumflex -1 611 aacute -1 500 Ucircumflex -1 722 yacute -1 444 scommaaccent -1 389 ecircumflex -1 444 Uring -1 722 Udieresis -1 722 aogonek -1 500 Uacute -1 722 uogonek -1 500 Edieresis -1 611 Dcroat -1 722 commaaccent -1 250 copyright -1 760 Emacron -1 611 ccaron -1 444 aring -1 500 Ncommaaccent -1 667 lacute -1 278 agrave -1 500 Tcommaaccent -1 556 Cacute -1 667 atilde -1 500 Edotaccent -1 611 scaron -1 389 scedilla -1 389 iacute -1 278 lozenge -1 471 Rcaron -1 611 Gcommaaccent -1 722 ucircumflex -1 500 acircumflex -1 500 Amacron -1 611 rcaron -1 389 ccedilla -1 444 Zdotaccent -1 556 Thorn -1 611 Omacron -1 722 Racute -1 611 Sacute -1 500 dcaron -1 544 Umacron -1 722 uring -1 500 threesuperior -1 300 Ograve -1 722 Agrave -1 611 Abreve -1 611 multiply -1 675 uacute -1 500 Tcaron -1 556 partialdiff -1 476 ydieresis -1 444 Nacute -1 667 icircumflex -1 278 Ecircumflex -1 611 adieresis -1 500 edieresis -1 444 cacute -1 444 nacute -1 500 umacron -1 500 Ncaron -1 667 Iacute -1 333 plusminus -1 675 brokenbar -1 275 registered -1 760 Gbreve -1 722 Idotaccent -1 333 summation -1 600 Egrave -1 611 racute -1 389 omacron -1 500 Zacute -1 556 Zcaron -1 556 greaterequal -1 549 Eth -1 722 Ccedilla -1 667 lcommaaccent -1 278 tcaron -1 300 eogonek -1 444 Uogonek -1 722 Aacute -1 611 Adieresis -1 611 egrave -1 444 zacute -1 389 iogonek -1 278 Oacute -1 722 oacute -1 500 amacron -1 500 sacute -1 389 idieresis -1 278 Ocircumflex -1 722 Ugrave -1 722 Delta -1 612 thorn -1 500 twosuperior -1 300 Odieresis -1 722 mu -1 500 igrave -1 278 ohungarumlaut -1 500 Eogonek -1 611 dcroat -1 500 threequarters -1 750 Scedilla -1 500 lcaron -1 300 Kcommaaccent -1 667 Lacute -1 556 trademark -1 980 edotaccent -1 444 Igrave -1 333 Imacron -1 333 Lcaron -1 611 onehalf -1 750 lessequal -1 549 ocircumflex -1 500 ntilde -1 500 Uhungarumlaut -1 722 Eacute -1 611 emacron -1 444 gbreve -1 500 onequarter -1 750 Scaron -1 500 Scommaaccent -1 500 Ohungarumlaut -1 722 degree -1 400 ograve -1 500 Ccaron -1 667 ugrave -1 500 radical -1 453 Dcaron -1 722 rcommaaccent -1 389 Ntilde -1 667 otilde -1 500 Rcommaaccent -1 611 Lcommaaccent -1 556 Atilde -1 611 Aogonek -1 611 Aring -1 611 Otilde -1 722 zdotaccent -1 389 Ecaron -1 611 Iogonek -1 333 kcommaaccent -1 444 minus -1 675 Icircumflex -1 333 ncaron -1 500 tcommaaccent -1 278 logicalnot -1 675 odieresis -1 500 udieresis -1 500 notequal -1 549 gcommaaccent -1 500 eth -1 500 zcaron -1 389 ncommaaccent -1 500 onesuperior -1 300 imacron -1 278 Euro -1 500",
|
|
13
|
+
"Times-BoldItalic": "space 32 250 exclam 33 389 quotedbl 34 555 numbersign 35 500 dollar 36 500 percent 37 833 ampersand 38 778 quoteright 39 333 parenleft 40 333 parenright 41 333 asterisk 42 500 plus 43 570 comma 44 250 hyphen 45 333 period 46 250 slash 47 278 zero 48 500 one 49 500 two 50 500 three 51 500 four 52 500 five 53 500 six 54 500 seven 55 500 eight 56 500 nine 57 500 colon 58 333 semicolon 59 333 less 60 570 equal 61 570 greater 62 570 question 63 500 at 64 832 A 65 667 B 66 667 C 67 667 D 68 722 E 69 667 F 70 667 G 71 722 H 72 778 I 73 389 J 74 500 K 75 667 L 76 611 M 77 889 N 78 722 O 79 722 P 80 611 Q 81 722 R 82 667 S 83 556 T 84 611 U 85 722 V 86 667 W 87 889 X 88 667 Y 89 611 Z 90 611 bracketleft 91 333 backslash 92 278 bracketright 93 333 asciicircum 94 570 underscore 95 500 quoteleft 96 333 a 97 500 b 98 500 c 99 444 d 100 500 e 101 444 f 102 333 g 103 500 h 104 556 i 105 278 j 106 278 k 107 500 l 108 278 m 109 778 n 110 556 o 111 500 p 112 500 q 113 500 r 114 389 s 115 389 t 116 278 u 117 556 v 118 444 w 119 667 x 120 500 y 121 444 z 122 389 braceleft 123 348 bar 124 220 braceright 125 348 asciitilde 126 570 exclamdown 161 389 cent 162 500 sterling 163 500 fraction 164 167 yen 165 500 florin 166 500 section 167 500 currency 168 500 quotesingle 169 278 quotedblleft 170 500 guillemotleft 171 500 guilsinglleft 172 333 guilsinglright 173 333 fi 174 556 fl 175 556 endash 177 500 dagger 178 500 daggerdbl 179 500 periodcentered 180 250 paragraph 182 500 bullet 183 350 quotesinglbase 184 333 quotedblbase 185 500 quotedblright 186 500 guillemotright 187 500 ellipsis 188 1000 perthousand 189 1000 questiondown 191 500 grave 193 333 acute 194 333 circumflex 195 333 tilde 196 333 macron 197 333 breve 198 333 dotaccent 199 333 dieresis 200 333 ring 202 333 cedilla 203 333 hungarumlaut 205 333 ogonek 206 333 caron 207 333 emdash 208 1000 AE 225 944 ordfeminine 227 266 Lslash 232 611 Oslash 233 722 OE 234 944 ordmasculine 235 300 ae 241 722 dotlessi 245 278 lslash 248 278 oslash 249 500 oe 250 722 germandbls 251 500 Idieresis -1 389 eacute -1 444 abreve -1 500 uhungarumlaut -1 556 ecaron -1 444 Ydieresis -1 611 divide -1 570 Yacute -1 611 Acircumflex -1 667 aacute -1 500 Ucircumflex -1 722 yacute -1 444 scommaaccent -1 389 ecircumflex -1 444 Uring -1 722 Udieresis -1 722 aogonek -1 500 Uacute -1 722 uogonek -1 556 Edieresis -1 667 Dcroat -1 722 commaaccent -1 250 copyright -1 747 Emacron -1 667 ccaron -1 444 aring -1 500 Ncommaaccent -1 722 lacute -1 278 agrave -1 500 Tcommaaccent -1 611 Cacute -1 667 atilde -1 500 Edotaccent -1 667 scaron -1 389 scedilla -1 389 iacute -1 278 lozenge -1 494 Rcaron -1 667 Gcommaaccent -1 722 ucircumflex -1 556 acircumflex -1 500 Amacron -1 667 rcaron -1 389 ccedilla -1 444 Zdotaccent -1 611 Thorn -1 611 Omacron -1 722 Racute -1 667 Sacute -1 556 dcaron -1 608 Umacron -1 722 uring -1 556 threesuperior -1 300 Ograve -1 722 Agrave -1 667 Abreve -1 667 multiply -1 570 uacute -1 556 Tcaron -1 611 partialdiff -1 494 ydieresis -1 444 Nacute -1 722 icircumflex -1 278 Ecircumflex -1 667 adieresis -1 500 edieresis -1 444 cacute -1 444 nacute -1 556 umacron -1 556 Ncaron -1 722 Iacute -1 389 plusminus -1 570 brokenbar -1 220 registered -1 747 Gbreve -1 722 Idotaccent -1 389 summation -1 600 Egrave -1 667 racute -1 389 omacron -1 500 Zacute -1 611 Zcaron -1 611 greaterequal -1 549 Eth -1 722 Ccedilla -1 667 lcommaaccent -1 278 tcaron -1 366 eogonek -1 444 Uogonek -1 722 Aacute -1 667 Adieresis -1 667 egrave -1 444 zacute -1 389 iogonek -1 278 Oacute -1 722 oacute -1 500 amacron -1 500 sacute -1 389 idieresis -1 278 Ocircumflex -1 722 Ugrave -1 722 Delta -1 612 thorn -1 500 twosuperior -1 300 Odieresis -1 722 mu -1 576 igrave -1 278 ohungarumlaut -1 500 Eogonek -1 667 dcroat -1 500 threequarters -1 750 Scedilla -1 556 lcaron -1 382 Kcommaaccent -1 667 Lacute -1 611 trademark -1 1000 edotaccent -1 444 Igrave -1 389 Imacron -1 389 Lcaron -1 611 onehalf -1 750 lessequal -1 549 ocircumflex -1 500 ntilde -1 556 Uhungarumlaut -1 722 Eacute -1 667 emacron -1 444 gbreve -1 500 onequarter -1 750 Scaron -1 556 Scommaaccent -1 556 Ohungarumlaut -1 722 degree -1 400 ograve -1 500 Ccaron -1 667 ugrave -1 556 radical -1 549 Dcaron -1 722 rcommaaccent -1 389 Ntilde -1 722 otilde -1 500 Rcommaaccent -1 667 Lcommaaccent -1 611 Atilde -1 667 Aogonek -1 667 Aring -1 667 Otilde -1 722 zdotaccent -1 389 Ecaron -1 667 Iogonek -1 389 kcommaaccent -1 500 minus -1 606 Icircumflex -1 389 ncaron -1 556 tcommaaccent -1 278 logicalnot -1 606 odieresis -1 500 udieresis -1 556 notequal -1 549 gcommaaccent -1 500 eth -1 500 zcaron -1 389 ncommaaccent -1 556 onesuperior -1 300 imacron -1 278 Euro -1 500",
|
|
14
|
+
Symbol: "space 32 250 exclam 33 333 universal 34 713 numbersign 35 500 existential 36 549 percent 37 833 ampersand 38 778 suchthat 39 439 parenleft 40 333 parenright 41 333 asteriskmath 42 500 plus 43 549 comma 44 250 minus 45 549 period 46 250 slash 47 278 zero 48 500 one 49 500 two 50 500 three 51 500 four 52 500 five 53 500 six 54 500 seven 55 500 eight 56 500 nine 57 500 colon 58 278 semicolon 59 278 less 60 549 equal 61 549 greater 62 549 question 63 444 congruent 64 549 Alpha 65 722 Beta 66 667 Chi 67 722 Delta 68 612 Epsilon 69 611 Phi 70 763 Gamma 71 603 Eta 72 722 Iota 73 333 theta1 74 631 Kappa 75 722 Lambda 76 686 Mu 77 889 Nu 78 722 Omicron 79 722 Pi 80 768 Theta 81 741 Rho 82 556 Sigma 83 592 Tau 84 611 Upsilon 85 690 sigma1 86 439 Omega 87 768 Xi 88 645 Psi 89 795 Zeta 90 611 bracketleft 91 333 therefore 92 863 bracketright 93 333 perpendicular 94 658 underscore 95 500 radicalex 96 500 alpha 97 631 beta 98 549 chi 99 549 delta 100 494 epsilon 101 439 phi 102 521 gamma 103 411 eta 104 603 iota 105 329 phi1 106 603 kappa 107 549 lambda 108 549 mu 109 576 nu 110 521 omicron 111 549 pi 112 549 theta 113 521 rho 114 549 sigma 115 603 tau 116 439 upsilon 117 576 omega1 118 713 omega 119 686 xi 120 493 psi 121 686 zeta 122 494 braceleft 123 480 bar 124 200 braceright 125 480 similar 126 549 Euro 160 750 Upsilon1 161 620 minute 162 247 lessequal 163 549 fraction 164 167 infinity 165 713 florin 166 500 club 167 753 diamond 168 753 heart 169 753 spade 170 753 arrowboth 171 1042 arrowleft 172 987 arrowup 173 603 arrowright 174 987 arrowdown 175 603 degree 176 400 plusminus 177 549 second 178 411 greaterequal 179 549 multiply 180 549 proportional 181 713 partialdiff 182 494 bullet 183 460 divide 184 549 notequal 185 549 equivalence 186 549 approxequal 187 549 ellipsis 188 1000 arrowvertex 189 603 arrowhorizex 190 1000 carriagereturn 191 658 aleph 192 823 Ifraktur 193 686 Rfraktur 194 795 weierstrass 195 987 circlemultiply 196 768 circleplus 197 768 emptyset 198 823 intersection 199 768 union 200 768 propersuperset 201 713 reflexsuperset 202 713 notsubset 203 713 propersubset 204 713 reflexsubset 205 713 element 206 713 notelement 207 713 angle 208 768 gradient 209 713 registerserif 210 790 copyrightserif 211 790 trademarkserif 212 890 product 213 823 radical 214 549 dotmath 215 250 logicalnot 216 713 logicaland 217 603 logicalor 218 603 arrowdblboth 219 1042 arrowdblleft 220 987 arrowdblup 221 603 arrowdblright 222 987 arrowdbldown 223 603 lozenge 224 494 angleleft 225 329 registersans 226 790 copyrightsans 227 790 trademarksans 228 786 summation 229 713 parenlefttp 230 384 parenleftex 231 384 parenleftbt 232 384 bracketlefttp 233 384 bracketleftex 234 384 bracketleftbt 235 384 bracelefttp 236 494 braceleftmid 237 494 braceleftbt 238 494 braceex 239 494 angleright 241 329 integral 242 274 integraltp 243 686 integralex 244 686 integralbt 245 686 parenrighttp 246 384 parenrightex 247 384 parenrightbt 248 384 bracketrighttp 249 384 bracketrightex 250 384 bracketrightbt 251 384 bracerighttp 252 494 bracerightmid 253 494 bracerightbt 254 494 apple -1 790",
|
|
15
|
+
ZapfDingbats: "space 32 278 a1 33 974 a2 34 961 a202 35 974 a3 36 980 a4 37 719 a5 38 789 a119 39 790 a118 40 791 a117 41 690 a11 42 960 a12 43 939 a13 44 549 a14 45 855 a15 46 911 a16 47 933 a105 48 911 a17 49 945 a18 50 974 a19 51 755 a20 52 846 a21 53 762 a22 54 761 a23 55 571 a24 56 677 a25 57 763 a26 58 760 a27 59 759 a28 60 754 a6 61 494 a7 62 552 a8 63 537 a9 64 577 a10 65 692 a29 66 786 a30 67 788 a31 68 788 a32 69 790 a33 70 793 a34 71 794 a35 72 816 a36 73 823 a37 74 789 a38 75 841 a39 76 823 a40 77 833 a41 78 816 a42 79 831 a43 80 923 a44 81 744 a45 82 723 a46 83 749 a47 84 790 a48 85 792 a49 86 695 a50 87 776 a51 88 768 a52 89 792 a53 90 759 a54 91 707 a55 92 708 a56 93 682 a57 94 701 a58 95 826 a59 96 815 a60 97 789 a61 98 789 a62 99 707 a63 100 687 a64 101 696 a65 102 689 a66 103 786 a67 104 787 a68 105 713 a69 106 791 a70 107 785 a71 108 791 a72 109 873 a73 110 761 a74 111 762 a203 112 762 a75 113 759 a204 114 759 a76 115 892 a77 116 892 a78 117 788 a79 118 784 a81 119 438 a82 120 138 a83 121 277 a84 122 415 a97 123 392 a98 124 392 a99 125 668 a100 126 668 a89 128 390 a90 129 390 a93 130 317 a94 131 317 a91 132 276 a92 133 276 a205 134 509 a85 135 509 a206 136 410 a86 137 410 a87 138 234 a88 139 234 a95 140 334 a96 141 334 a101 161 732 a102 162 544 a103 163 544 a104 164 910 a106 165 667 a107 166 760 a108 167 760 a112 168 776 a111 169 595 a110 170 694 a109 171 626 a120 172 788 a121 173 788 a122 174 788 a123 175 788 a124 176 788 a125 177 788 a126 178 788 a127 179 788 a128 180 788 a129 181 788 a130 182 788 a131 183 788 a132 184 788 a133 185 788 a134 186 788 a135 187 788 a136 188 788 a137 189 788 a138 190 788 a139 191 788 a140 192 788 a141 193 788 a142 194 788 a143 195 788 a144 196 788 a145 197 788 a146 198 788 a147 199 788 a148 200 788 a149 201 788 a150 202 788 a151 203 788 a152 204 788 a153 205 788 a154 206 788 a155 207 788 a156 208 788 a157 209 788 a158 210 788 a159 211 788 a160 212 894 a161 213 838 a163 214 1016 a164 215 458 a196 216 748 a165 217 924 a192 218 748 a166 219 918 a167 220 927 a168 221 928 a169 222 928 a170 223 834 a171 224 873 a172 225 828 a173 226 924 a162 227 924 a174 228 917 a175 229 930 a176 230 931 a177 231 463 a178 232 883 a179 233 836 a193 234 836 a180 235 867 a199 236 867 a181 237 696 a200 238 696 a182 239 874 a201 241 874 a183 242 760 a184 243 946 a197 244 771 a185 245 865 a194 246 771 a198 247 888 a186 248 967 a195 249 888 a187 250 831 a188 251 873 a189 252 927 a190 253 970 a191 254 918"
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { STANDARD_METRICS };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which of the standard 14 a `/BaseFont` names, or `undefined` for a face this
|
|
3
|
+
* has no metrics for.
|
|
4
|
+
*
|
|
5
|
+
* The four obliques are the upright slanted rather than respaced, so they share
|
|
6
|
+
* its table, and every Courier is 600 flat. The names Arial, Times New Roman
|
|
7
|
+
* and Courier New are matched too: a file that names one and embeds nothing is
|
|
8
|
+
* asking for the metric-compatible face every reader substitutes, and giving it
|
|
9
|
+
* anything else measures the page wrong.
|
|
10
|
+
*/
|
|
11
|
+
export declare function standardFace(baseFont: string): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The advance of one code in a standard face, in 1000ths of an em.
|
|
14
|
+
*
|
|
15
|
+
* @param face One of the names {@link standardFace} returns.
|
|
16
|
+
* @param code The character code, as the content stream showed it.
|
|
17
|
+
* @param text What that code decodes to, when the font could say.
|
|
18
|
+
* @returns The width, or `undefined` where the face states none for it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function standardWidth(face: string, code: number, text: string): number | undefined;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { textForGlyphName } from "./glyph-names.js";
|
|
2
|
+
import { STANDARD_METRICS } from "./standard-metrics.js";
|
|
3
|
+
//#region src/pdf-reader/standard-widths.ts
|
|
4
|
+
/** Parsed on first use and kept: a face is asked for once per font, not once per glyph. */
|
|
5
|
+
var parsed = /* @__PURE__ */ new Map();
|
|
6
|
+
function metricsOf(face) {
|
|
7
|
+
const had = parsed.get(face);
|
|
8
|
+
if (had) return had;
|
|
9
|
+
const byChar = /* @__PURE__ */ new Map();
|
|
10
|
+
const byCode = /* @__PURE__ */ new Map();
|
|
11
|
+
const triples = (STANDARD_METRICS[face] ?? "").split(" ");
|
|
12
|
+
for (let i = 0; i + 2 < triples.length; i += 3) {
|
|
13
|
+
const name = triples[i];
|
|
14
|
+
const code = Number(triples[i + 1]);
|
|
15
|
+
const width = Number(triples[i + 2]);
|
|
16
|
+
if (!Number.isFinite(width)) continue;
|
|
17
|
+
if (Number.isFinite(code) && code >= 0) byCode.set(code, width);
|
|
18
|
+
const text = textForGlyphName(name);
|
|
19
|
+
if (text !== void 0 && text.length > 0 && !byChar.has(text)) byChar.set(text, width);
|
|
20
|
+
}
|
|
21
|
+
const made = {
|
|
22
|
+
byChar,
|
|
23
|
+
byCode
|
|
24
|
+
};
|
|
25
|
+
parsed.set(face, made);
|
|
26
|
+
return made;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Which of the standard 14 a `/BaseFont` names, or `undefined` for a face this
|
|
30
|
+
* has no metrics for.
|
|
31
|
+
*
|
|
32
|
+
* The four obliques are the upright slanted rather than respaced, so they share
|
|
33
|
+
* its table, and every Courier is 600 flat. The names Arial, Times New Roman
|
|
34
|
+
* and Courier New are matched too: a file that names one and embeds nothing is
|
|
35
|
+
* asking for the metric-compatible face every reader substitutes, and giving it
|
|
36
|
+
* anything else measures the page wrong.
|
|
37
|
+
*/
|
|
38
|
+
function standardFace(baseFont) {
|
|
39
|
+
const name = baseFont.replace(/^[A-Z]{6}\+/u, "").toLowerCase();
|
|
40
|
+
const bold = /bold|black|heavy|[-,]bd\b/u.test(name);
|
|
41
|
+
const italic = /italic|oblique|[-,]it\b/u.test(name);
|
|
42
|
+
if (/courier|mono/u.test(name)) return "Courier";
|
|
43
|
+
if (/times|serif|roman|georgia|book/u.test(name) && !/sans/u.test(name)) return bold ? italic ? "Times-BoldItalic" : "Times-Bold" : italic ? "Times-Italic" : "Times-Roman";
|
|
44
|
+
if (/zapf|dingbat/u.test(name)) return "ZapfDingbats";
|
|
45
|
+
if (/symbol/u.test(name)) return "Symbol";
|
|
46
|
+
if (/helvetica|arial|sans|verdana|tahoma|segoe|calibri/u.test(name)) return bold ? "Helvetica-Bold" : "Helvetica";
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The advance of one code in a standard face, in 1000ths of an em.
|
|
50
|
+
*
|
|
51
|
+
* @param face One of the names {@link standardFace} returns.
|
|
52
|
+
* @param code The character code, as the content stream showed it.
|
|
53
|
+
* @param text What that code decodes to, when the font could say.
|
|
54
|
+
* @returns The width, or `undefined` where the face states none for it.
|
|
55
|
+
*/
|
|
56
|
+
function standardWidth(face, code, text) {
|
|
57
|
+
if (face === "Courier") return 600;
|
|
58
|
+
const metrics = metricsOf(face);
|
|
59
|
+
return (text.length > 0 ? metrics.byChar.get(text) : void 0) ?? metrics.byCode.get(code);
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { standardFace, standardWidth };
|