@turntrout/subfont 1.7.1 → 1.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/CLAUDE.md +39 -13
- package/README.md +24 -14
- package/lib/FontTracerPool.d.ts +1 -0
- package/lib/FontTracerPool.d.ts.map +1 -1
- package/lib/FontTracerPool.js +48 -25
- package/lib/FontTracerPool.js.map +1 -1
- package/lib/HeadlessBrowser.d.ts +18 -0
- package/lib/HeadlessBrowser.d.ts.map +1 -0
- package/lib/HeadlessBrowser.js +216 -210
- package/lib/HeadlessBrowser.js.map +1 -0
- package/lib/codepointMaps.d.ts +4 -0
- package/lib/codepointMaps.d.ts.map +1 -0
- package/lib/codepointMaps.js +115 -0
- package/lib/codepointMaps.js.map +1 -0
- package/lib/collectFeatureGlyphIds.d.ts +3 -0
- package/lib/collectFeatureGlyphIds.d.ts.map +1 -0
- package/lib/collectFeatureGlyphIds.js +124 -138
- package/lib/collectFeatureGlyphIds.js.map +1 -0
- package/lib/collectTextsByPage.d.ts +41 -0
- package/lib/collectTextsByPage.d.ts.map +1 -0
- package/lib/collectTextsByPage.js +726 -965
- package/lib/collectTextsByPage.js.map +1 -0
- package/lib/concurrencyLimit.d.ts +3 -0
- package/lib/concurrencyLimit.d.ts.map +1 -0
- package/lib/concurrencyLimit.js +12 -11
- package/lib/concurrencyLimit.js.map +1 -0
- package/lib/escapeJsStringLiteral.d.ts +3 -0
- package/lib/escapeJsStringLiteral.d.ts.map +1 -0
- package/lib/escapeJsStringLiteral.js +7 -6
- package/lib/escapeJsStringLiteral.js.map +1 -0
- package/lib/extractReferencedCustomPropertyNames.d.ts +3 -0
- package/lib/extractReferencedCustomPropertyNames.d.ts.map +1 -0
- package/lib/extractReferencedCustomPropertyNames.js +15 -16
- package/lib/extractReferencedCustomPropertyNames.js.map +1 -0
- package/lib/extractVisibleText.d.ts +7 -0
- package/lib/extractVisibleText.d.ts.map +1 -0
- package/lib/extractVisibleText.js +110 -119
- package/lib/extractVisibleText.js.map +1 -0
- package/lib/findCustomPropertyDefinitions.d.ts +8 -0
- package/lib/findCustomPropertyDefinitions.d.ts.map +1 -0
- package/lib/findCustomPropertyDefinitions.js +41 -48
- package/lib/findCustomPropertyDefinitions.js.map +1 -0
- package/lib/fontConverter.d.ts +2 -0
- package/lib/fontConverter.d.ts.map +1 -0
- package/lib/fontConverter.js +40 -21
- package/lib/fontConverter.js.map +1 -0
- package/lib/fontConverterWorker.d.ts +2 -0
- package/lib/fontConverterWorker.d.ts.map +1 -0
- package/lib/fontConverterWorker.js +52 -15
- package/lib/fontConverterWorker.js.map +1 -0
- package/lib/fontFaceHelpers.d.ts +64 -0
- package/lib/fontFaceHelpers.d.ts.map +1 -0
- package/lib/fontFaceHelpers.js +237 -249
- package/lib/fontFaceHelpers.js.map +1 -0
- package/lib/fontFeatureHelpers.d.ts +30 -0
- package/lib/fontFeatureHelpers.d.ts.map +1 -0
- package/lib/fontFeatureHelpers.js +277 -212
- package/lib/fontFeatureHelpers.js.map +1 -0
- package/lib/fontTracerWorker.d.ts +11 -0
- package/lib/fontTracerWorker.d.ts.map +1 -0
- package/lib/fontTracerWorker.js +94 -60
- package/lib/fontTracerWorker.js.map +1 -0
- package/lib/gatherStylesheetsWithPredicates.d.ts +26 -0
- package/lib/gatherStylesheetsWithPredicates.d.ts.map +1 -0
- package/lib/gatherStylesheetsWithPredicates.js +75 -84
- package/lib/gatherStylesheetsWithPredicates.js.map +1 -0
- package/lib/getCssRulesByProperty.d.ts +29 -0
- package/lib/getCssRulesByProperty.d.ts.map +1 -0
- package/lib/getCssRulesByProperty.js +316 -316
- package/lib/getCssRulesByProperty.js.map +1 -0
- package/lib/getFontInfo.d.ts +11 -0
- package/lib/getFontInfo.d.ts.map +1 -0
- package/lib/getFontInfo.js +35 -33
- package/lib/getFontInfo.js.map +1 -0
- package/lib/initialValueByProp.d.ts +3 -0
- package/lib/initialValueByProp.d.ts.map +1 -0
- package/lib/initialValueByProp.js +20 -17
- package/lib/initialValueByProp.js.map +1 -0
- package/lib/injectSubsetDefinitions.d.ts +3 -0
- package/lib/injectSubsetDefinitions.d.ts.map +1 -0
- package/lib/injectSubsetDefinitions.js +54 -59
- package/lib/injectSubsetDefinitions.js.map +1 -0
- package/lib/normalizeFontPropertyValue.d.ts +3 -0
- package/lib/normalizeFontPropertyValue.d.ts.map +1 -0
- package/lib/normalizeFontPropertyValue.js +59 -54
- package/lib/normalizeFontPropertyValue.js.map +1 -0
- package/lib/parseCommandLineOptions.d.ts +9 -0
- package/lib/parseCommandLineOptions.d.ts.map +1 -0
- package/lib/parseCommandLineOptions.js +145 -149
- package/lib/parseCommandLineOptions.js.map +1 -0
- package/lib/parseFontVariationSettings.d.ts +3 -0
- package/lib/parseFontVariationSettings.d.ts.map +1 -0
- package/lib/parseFontVariationSettings.js +38 -36
- package/lib/parseFontVariationSettings.js.map +1 -0
- package/lib/progress.d.ts +27 -0
- package/lib/progress.d.ts.map +1 -0
- package/lib/progress.js +51 -54
- package/lib/progress.js.map +1 -0
- package/lib/sfntCache.d.ts +4 -0
- package/lib/sfntCache.d.ts.map +1 -0
- package/lib/sfntCache.js +70 -25
- package/lib/sfntCache.js.map +1 -0
- package/lib/stripLocalTokens.d.ts +3 -0
- package/lib/stripLocalTokens.d.ts.map +1 -0
- package/lib/stripLocalTokens.js +23 -21
- package/lib/stripLocalTokens.js.map +1 -0
- package/lib/subfont.d.ts +22 -1
- package/lib/subfont.d.ts.map +1 -1
- package/lib/subfont.js +7 -6
- package/lib/subfont.js.map +1 -1
- package/lib/subsetFontWithGlyphs.d.ts +4 -0
- package/lib/subsetFontWithGlyphs.d.ts.map +1 -1
- package/lib/subsetFontWithGlyphs.js +78 -17
- package/lib/subsetFontWithGlyphs.js.map +1 -1
- package/lib/subsetFonts.d.ts +1 -5
- package/lib/subsetFonts.d.ts.map +1 -1
- package/lib/subsetFonts.js +18 -17
- package/lib/subsetFonts.js.map +1 -1
- package/lib/subsetGeneration.d.ts +3 -6
- package/lib/subsetGeneration.d.ts.map +1 -1
- package/lib/subsetGeneration.js +42 -9
- package/lib/subsetGeneration.js.map +1 -1
- package/lib/types/shared.d.ts +11 -0
- package/lib/types/shared.d.ts.map +1 -0
- package/lib/types/shared.js +3 -0
- package/lib/types/shared.js.map +1 -0
- package/lib/unicodeRange.d.ts +3 -0
- package/lib/unicodeRange.d.ts.map +1 -0
- package/lib/unicodeRange.js +17 -30
- package/lib/unicodeRange.js.map +1 -0
- package/lib/unquote.d.ts +3 -0
- package/lib/unquote.d.ts.map +1 -0
- package/lib/unquote.js +18 -25
- package/lib/unquote.js.map +1 -0
- package/lib/variationAxes.d.ts +33 -0
- package/lib/variationAxes.d.ts.map +1 -0
- package/lib/variationAxes.js +127 -157
- package/lib/variationAxes.js.map +1 -0
- package/lib/warnAboutMissingGlyphs.d.ts +43 -0
- package/lib/warnAboutMissingGlyphs.d.ts.map +1 -0
- package/lib/warnAboutMissingGlyphs.js +141 -147
- package/lib/warnAboutMissingGlyphs.js.map +1 -0
- package/lib/wasmQueue.d.ts +3 -0
- package/lib/wasmQueue.d.ts.map +1 -0
- package/lib/wasmQueue.js +13 -10
- package/lib/wasmQueue.js.map +1 -0
- package/package.json +7 -3
|
@@ -1,150 +1,136 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
const sfntCache_1 = require("./sfntCache");
|
|
3
|
+
const enqueueWasm = require("./wasmQueue");
|
|
3
4
|
// GSUB feature tags that can produce alternate glyphs. Used as the
|
|
4
5
|
// fallback set when CSS doesn't specify which features are in use.
|
|
5
|
-
// Keep in sync with fontVariantToOTTags in
|
|
6
|
+
// Keep in sync with fontVariantToOTTags in fontFeatureHelpers.ts.
|
|
6
7
|
const GSUB_FEATURE_TAGS = new Set([
|
|
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
|
-
|
|
8
|
+
'aalt',
|
|
9
|
+
'afrc',
|
|
10
|
+
'c2pc',
|
|
11
|
+
'c2sc',
|
|
12
|
+
'calt',
|
|
13
|
+
'ccmp', // glyph composition/decomposition — needed for combining characters
|
|
14
|
+
'clig',
|
|
15
|
+
'dlig',
|
|
16
|
+
'dnom',
|
|
17
|
+
'frac',
|
|
18
|
+
'fwid',
|
|
19
|
+
'hist',
|
|
20
|
+
'hlig',
|
|
21
|
+
'jp04',
|
|
22
|
+
'jp78',
|
|
23
|
+
'jp83',
|
|
24
|
+
'jp90',
|
|
25
|
+
'liga',
|
|
26
|
+
'lnum',
|
|
27
|
+
'locl', // localized forms — language-specific glyph variants
|
|
28
|
+
'nalt',
|
|
29
|
+
'numr',
|
|
30
|
+
'onum',
|
|
31
|
+
'ordn',
|
|
32
|
+
'ornm',
|
|
33
|
+
'pcap',
|
|
34
|
+
'pnum',
|
|
35
|
+
'pwid',
|
|
36
|
+
'rclt', // required contextual alternates — needed for many scripts
|
|
37
|
+
'rlig', // required ligatures — mandatory for Arabic/Indic scripts
|
|
38
|
+
'ruby',
|
|
39
|
+
'salt',
|
|
40
|
+
'sinf',
|
|
41
|
+
'smcp',
|
|
42
|
+
'smpl',
|
|
43
|
+
'ss01',
|
|
44
|
+
'ss02',
|
|
45
|
+
'ss03',
|
|
46
|
+
'ss04',
|
|
47
|
+
'ss05',
|
|
48
|
+
'ss06',
|
|
49
|
+
'ss07',
|
|
50
|
+
'ss08',
|
|
51
|
+
'ss09',
|
|
52
|
+
'ss10',
|
|
53
|
+
'ss11',
|
|
54
|
+
'ss12',
|
|
55
|
+
'ss13',
|
|
56
|
+
'ss14',
|
|
57
|
+
'ss15',
|
|
58
|
+
'ss16',
|
|
59
|
+
'ss17',
|
|
60
|
+
'ss18',
|
|
61
|
+
'ss19',
|
|
62
|
+
'ss20',
|
|
63
|
+
'subs',
|
|
64
|
+
'sups',
|
|
65
|
+
'swsh',
|
|
66
|
+
'titl',
|
|
67
|
+
'tnum',
|
|
68
|
+
'trad',
|
|
69
|
+
'unic',
|
|
70
|
+
'zero',
|
|
70
71
|
]);
|
|
71
|
-
|
|
72
|
-
const enqueueWasm = require('./wasmQueue');
|
|
73
|
-
|
|
74
72
|
async function collectFeatureGlyphIdsImpl(fontBuffer, text, cssFeatureTags) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const font = harfbuzzJs.createFont(face);
|
|
81
|
-
|
|
82
|
-
try {
|
|
83
|
-
const fontFeatures = new Set(face.getTableFeatureTags('GSUB'));
|
|
84
|
-
|
|
85
|
-
// When CSS specifies which features are used, only test those.
|
|
86
|
-
// Otherwise fall back to the full set of supported GSUB features.
|
|
87
|
-
const allowedTags =
|
|
88
|
-
cssFeatureTags && cssFeatureTags.length > 0
|
|
89
|
-
? new Set(cssFeatureTags)
|
|
90
|
-
: GSUB_FEATURE_TAGS;
|
|
91
|
-
|
|
92
|
-
const featuresToTest = [...fontFeatures].filter((tag) =>
|
|
93
|
-
allowedTags.has(tag)
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
if (featuresToTest.length === 0) return [];
|
|
97
|
-
|
|
98
|
-
// Shape the full string once per feature: O(features) calls, not O(chars × features).
|
|
99
|
-
const uniqueChars = [...new Set(text)].filter((ch) => ch.trim() !== '');
|
|
100
|
-
if (uniqueChars.length === 0) return [];
|
|
101
|
-
const testText = uniqueChars.join('');
|
|
102
|
-
|
|
103
|
-
const baseBuf = harfbuzzJs.createBuffer();
|
|
104
|
-
let baseGids;
|
|
73
|
+
const harfbuzzJs = await require('harfbuzzjs');
|
|
74
|
+
const sfnt = await (0, sfntCache_1.toSfnt)(fontBuffer);
|
|
75
|
+
const blob = harfbuzzJs.createBlob(sfnt);
|
|
76
|
+
const face = harfbuzzJs.createFace(blob, 0);
|
|
77
|
+
const font = harfbuzzJs.createFont(face);
|
|
105
78
|
try {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
79
|
+
const fontFeatures = new Set(face.getTableFeatureTags('GSUB'));
|
|
80
|
+
// When CSS specifies which features are used, only test those.
|
|
81
|
+
// Otherwise fall back to the full set of supported GSUB features.
|
|
82
|
+
const cssTagsArr = cssFeatureTags ? [...cssFeatureTags] : [];
|
|
83
|
+
const allowedTags = cssTagsArr.length > 0 ? new Set(cssTagsArr) : GSUB_FEATURE_TAGS;
|
|
84
|
+
const featuresToTest = [...fontFeatures].filter((tag) => allowedTags.has(tag));
|
|
85
|
+
if (featuresToTest.length === 0)
|
|
86
|
+
return [];
|
|
87
|
+
// Shape the full string once per feature: O(features) calls, not O(chars × features).
|
|
88
|
+
const uniqueChars = [...new Set(text)].filter((ch) => ch.trim() !== '');
|
|
89
|
+
if (uniqueChars.length === 0)
|
|
90
|
+
return [];
|
|
91
|
+
const testText = uniqueChars.join('');
|
|
92
|
+
const baseBuf = harfbuzzJs.createBuffer();
|
|
93
|
+
let baseGids;
|
|
94
|
+
try {
|
|
95
|
+
baseBuf.addText(testText);
|
|
96
|
+
baseBuf.guessSegmentProperties();
|
|
97
|
+
harfbuzzJs.shapeWithTrace(font, baseBuf, '', 10000, 0);
|
|
98
|
+
const baseGlyphs = baseBuf.json(font);
|
|
99
|
+
if (baseGlyphs.length === 0)
|
|
100
|
+
return [];
|
|
101
|
+
baseGids = new Set(baseGlyphs.map((g) => g.g));
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
baseBuf.destroy();
|
|
130
105
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
106
|
+
const altGlyphIds = new Set();
|
|
107
|
+
for (const feat of featuresToTest) {
|
|
108
|
+
const buf = harfbuzzJs.createBuffer();
|
|
109
|
+
try {
|
|
110
|
+
buf.addText(testText);
|
|
111
|
+
buf.guessSegmentProperties();
|
|
112
|
+
harfbuzzJs.shapeWithTrace(font, buf, `+${feat}`, 10000, 0);
|
|
113
|
+
const result = buf.json(font);
|
|
114
|
+
for (const glyph of result) {
|
|
115
|
+
if (!baseGids.has(glyph.g)) {
|
|
116
|
+
altGlyphIds.add(glyph.g);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
finally {
|
|
121
|
+
buf.destroy();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return [...altGlyphIds];
|
|
125
|
+
}
|
|
126
|
+
finally {
|
|
127
|
+
font.destroy();
|
|
128
|
+
face.destroy();
|
|
129
|
+
blob.destroy();
|
|
134
130
|
}
|
|
135
|
-
|
|
136
|
-
return [...altGlyphIds];
|
|
137
|
-
} finally {
|
|
138
|
-
font.destroy();
|
|
139
|
-
face.destroy();
|
|
140
|
-
blob.destroy();
|
|
141
|
-
}
|
|
142
131
|
}
|
|
143
|
-
|
|
144
132
|
function collectFeatureGlyphIds(fontBuffer, text, cssFeatureTags) {
|
|
145
|
-
|
|
146
|
-
collectFeatureGlyphIdsImpl(fontBuffer, text, cssFeatureTags)
|
|
147
|
-
);
|
|
133
|
+
return enqueueWasm(() => collectFeatureGlyphIdsImpl(fontBuffer, text, cssFeatureTags));
|
|
148
134
|
}
|
|
149
|
-
|
|
150
135
|
module.exports = collectFeatureGlyphIds;
|
|
136
|
+
//# sourceMappingURL=collectFeatureGlyphIds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectFeatureGlyphIds.js","sourceRoot":"","sources":["../src/collectFeatureGlyphIds.ts"],"names":[],"mappings":";AAAA,2CAAqC;AACrC,2CAA4C;AAE5C,oEAAoE;AACpE,mEAAmE;AACnE,kEAAkE;AAClE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAS;IACxC,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM,EAAE,oEAAoE;IAC5E,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM,EAAE,qDAAqD;IAC7D,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM,EAAE,2DAA2D;IACnE,MAAM,EAAE,0DAA0D;IAClE,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IAC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AK,EAAE,CAAC,CAAC,CAAC;gBAC3D,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAE9B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;oBAC3B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;wBAC3B,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;oBAC3B,CAAC;gBACH,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,GAAG,CAAC,OAAO,EAAE,CAAC;YAChB,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,WAAW,CAAC,CAAC;IAC1B,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;AACH,CAAC;AAED,SAAS,sBAAsB,CAC7B,UAA+B,EAC/B,IAAY,EACZ,cAAmD;IAEnD,OAAO,WAAW,CAAC,GAAG,EAAE,CACtB,0BAA0B,CAAC,UAAU,EAAE,IAAI,EAAE,cAAc,CAAC,CAC7D,CAAC;AACJ,CAAC;AAED,iBAAS,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { findFontFamiliesWithFeatureSettings } from './fontFeatureHelpers';
|
|
2
|
+
import type { Asset, AssetGraph, Relation } from 'assetgraph';
|
|
3
|
+
interface FontFaceDeclaration {
|
|
4
|
+
'font-family'?: string;
|
|
5
|
+
'font-style'?: string;
|
|
6
|
+
'font-weight'?: string;
|
|
7
|
+
'font-stretch'?: string;
|
|
8
|
+
src?: string;
|
|
9
|
+
'-subfont-text'?: string;
|
|
10
|
+
relations: Relation[];
|
|
11
|
+
[descriptor: string]: string | Relation[] | undefined;
|
|
12
|
+
}
|
|
13
|
+
interface TextByPropsEntry {
|
|
14
|
+
text: string;
|
|
15
|
+
props: Record<string, string>;
|
|
16
|
+
htmlOrSvgAsset?: Asset;
|
|
17
|
+
}
|
|
18
|
+
interface AssetTextWithPropsEntry {
|
|
19
|
+
htmlOrSvgAsset: Asset;
|
|
20
|
+
textByProps: TextByPropsEntry[];
|
|
21
|
+
accumulatedFontFaceDeclarations: FontFaceDeclaration[];
|
|
22
|
+
fontFamiliesWithFeatureSettings: ReturnType<typeof findFontFamiliesWithFeatureSettings>;
|
|
23
|
+
featureTagsByFamily: Map<string, Set<string>>;
|
|
24
|
+
fontUsages: any[];
|
|
25
|
+
}
|
|
26
|
+
interface CollectTextsByPageOptions {
|
|
27
|
+
text?: string;
|
|
28
|
+
console?: Console | null;
|
|
29
|
+
dynamic?: boolean;
|
|
30
|
+
debug?: boolean;
|
|
31
|
+
concurrency?: number;
|
|
32
|
+
chromeArgs?: string[];
|
|
33
|
+
}
|
|
34
|
+
interface CollectTextsByPageResult {
|
|
35
|
+
htmlOrSvgAssetTextsWithProps: AssetTextWithPropsEntry[];
|
|
36
|
+
fontFaceDeclarationsByHtmlOrSvgAsset: Map<Asset, FontFaceDeclaration[]>;
|
|
37
|
+
subTimings: Record<string, number | undefined>;
|
|
38
|
+
}
|
|
39
|
+
declare function collectTextsByPage(assetGraph: AssetGraph, htmlOrSvgAssets: Asset[], { text, console, dynamic, debug, concurrency, chromeArgs, }?: CollectTextsByPageOptions): Promise<CollectTextsByPageResult>;
|
|
40
|
+
export = collectTextsByPage;
|
|
41
|
+
//# sourceMappingURL=collectTextsByPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectTextsByPage.d.ts","sourceRoot":"","sources":["../src/collectTextsByPage.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,mCAAmC,EAEpC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAe,MAAM,YAAY,CAAC;AAkC3E,UAAU,mBAAmB;IAC3B,aAAa,C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