@cantoo/fontkit 2.0.8 → 2.0.9
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/dist/browser-module.d.ts +27 -16
- package/dist/browser-module.mjs +20 -0
- package/dist/browser-module.mjs.map +1 -1
- package/dist/browser.cjs +20 -0
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +27 -16
- package/dist/fontkit.umd.d.ts +27 -16
- package/dist/fontkit.umd.js +21 -0
- package/dist/fontkit.umd.js.map +2 -2
- package/dist/fontkit.umd.min.js +11 -0
- package/dist/fontkit.umd.min.js.map +7 -0
- package/dist/index.d.ts +27 -16
- package/dist/main.cjs +22 -0
- package/dist/main.cjs.map +1 -1
- package/dist/main.d.ts +27 -16
- package/dist/module.d.ts +27 -16
- package/dist/module.mjs +22 -0
- package/dist/module.mjs.map +1 -1
- package/dist/unicode-properties/index.cjs +270 -0
- package/dist/unicode-properties/index.cjs.map +7 -0
- package/dist/unicode-properties/index.d.ts +37 -0
- package/dist/unicode-properties/index.mjs +246 -0
- package/dist/unicode-properties/index.mjs.map +7 -0
- package/dist/unicode-properties/index.umd.js +640 -0
- package/dist/unicode-properties/index.umd.js.map +7 -0
- package/dist/unicode-trie/builder.cjs +821 -0
- package/dist/unicode-trie/builder.cjs.map +7 -0
- package/dist/unicode-trie/builder.d.ts +19 -0
- package/dist/unicode-trie/builder.mjs +799 -0
- package/dist/unicode-trie/builder.mjs.map +7 -0
- package/dist/unicode-trie/index.cjs +125 -0
- package/dist/unicode-trie/index.cjs.map +7 -0
- package/dist/unicode-trie/index.d.ts +19 -0
- package/dist/unicode-trie/index.mjs +103 -0
- package/dist/unicode-trie/index.mjs.map +7 -0
- package/dist/unicode-trie/index.umd.js +498 -0
- package/dist/unicode-trie/index.umd.js.map +7 -0
- package/package.json +14 -13
- package/src/base.js +33 -0
- package/src/index.js +2 -1
- package/src/node.js +7 -1
- package/types/index.d.ts +27 -16
package/dist/index.d.ts
CHANGED
|
@@ -138,16 +138,15 @@ export interface VariationAxisInfo {
|
|
|
138
138
|
max: number;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
/** Font subset writer. */
|
|
141
|
+
/** Font subset writer (sync encode only in @cantoo/fontkit). */
|
|
142
142
|
export interface Subset {
|
|
143
143
|
includeGlyph(glyph: Glyph | number): number;
|
|
144
|
-
|
|
145
|
-
encode(
|
|
144
|
+
/** Encode the subset as a font buffer (synchronous). */
|
|
145
|
+
encode(): Uint8Array;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
|
-
* An opened font (
|
|
150
|
-
* Matches the public surface of TTFFont / WOFF / WOFF2 / etc.
|
|
149
|
+
* An opened single font face (TTF / OTF / WOFF / WOFF2).
|
|
151
150
|
*/
|
|
152
151
|
export interface Font {
|
|
153
152
|
type: string;
|
|
@@ -193,14 +192,20 @@ export interface Font {
|
|
|
193
192
|
getGlyph(glyph: number, characters?: number[]): Glyph | null;
|
|
194
193
|
createSubset(): Subset;
|
|
195
194
|
getVariation(variation: string | Record<string, number> | number[]): Font;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* A TrueType Collection (TTC) or Mac DFont container.
|
|
199
|
+
*/
|
|
200
|
+
export interface FontCollection {
|
|
201
|
+
type: 'TTC' | 'DFont' | string;
|
|
202
|
+
readonly fonts: Font[];
|
|
203
|
+
getFont(postscriptName: string | Uint8Array): Font | null;
|
|
199
204
|
}
|
|
200
205
|
|
|
201
206
|
/** Constructible font format registered with registerFormat(). */
|
|
202
207
|
export interface FontFormat {
|
|
203
|
-
new (stream: unknown, variationCoords?: number[] | null): Font;
|
|
208
|
+
new (stream: unknown, variationCoords?: number[] | null): Font | FontCollection;
|
|
204
209
|
probe(buffer: ArrayBufferView): boolean;
|
|
205
210
|
}
|
|
206
211
|
|
|
@@ -208,23 +213,29 @@ export declare let logErrors: boolean;
|
|
|
208
213
|
export declare let defaultLanguage: string;
|
|
209
214
|
|
|
210
215
|
export declare function registerFormat(format: FontFormat): void;
|
|
216
|
+
export declare function setDefaultLanguage(lang?: string): void;
|
|
217
|
+
|
|
218
|
+
/** Open a font or collection from a buffer (no face selected). */
|
|
219
|
+
export declare function create(buffer: ArrayBufferView): Font | FontCollection;
|
|
220
|
+
/** Open a buffer and select a face by PostScript name. */
|
|
211
221
|
export declare function create(
|
|
212
222
|
buffer: ArrayBufferView,
|
|
213
|
-
postscriptName
|
|
214
|
-
): Font | null
|
|
215
|
-
export declare function setDefaultLanguage(lang?: string): void;
|
|
223
|
+
postscriptName: string | Uint8Array
|
|
224
|
+
): Font | null;
|
|
216
225
|
|
|
217
226
|
/** Node-only: open a font file asynchronously. */
|
|
227
|
+
export declare function open(filename: string | import('fs').PathLike): Promise<Font | FontCollection>;
|
|
218
228
|
export declare function open(
|
|
219
229
|
filename: string | import('fs').PathLike,
|
|
220
|
-
postscriptName
|
|
221
|
-
): Promise<Font | null
|
|
230
|
+
postscriptName: string | Uint8Array
|
|
231
|
+
): Promise<Font | null>;
|
|
222
232
|
|
|
223
233
|
/** Node-only: open a font file synchronously. */
|
|
234
|
+
export declare function openSync(filename: string | import('fs').PathLike): Font | FontCollection;
|
|
224
235
|
export declare function openSync(
|
|
225
236
|
filename: string | import('fs').PathLike,
|
|
226
|
-
postscriptName
|
|
227
|
-
): Font | null
|
|
237
|
+
postscriptName: string | Uint8Array
|
|
238
|
+
): Font | null;
|
|
228
239
|
|
|
229
240
|
declare const fontkit: {
|
|
230
241
|
logErrors: boolean;
|
package/dist/main.cjs
CHANGED
|
@@ -39,6 +39,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
39
39
|
var node_exports = {};
|
|
40
40
|
__export(node_exports, {
|
|
41
41
|
create: () => create,
|
|
42
|
+
default: () => node_default,
|
|
42
43
|
defaultLanguage: () => defaultLanguage,
|
|
43
44
|
logErrors: () => logErrors,
|
|
44
45
|
open: () => open,
|
|
@@ -72,6 +73,24 @@ var defaultLanguage = "en";
|
|
|
72
73
|
function setDefaultLanguage(lang = "en") {
|
|
73
74
|
defaultLanguage = lang;
|
|
74
75
|
}
|
|
76
|
+
var fontkit = {
|
|
77
|
+
get logErrors() {
|
|
78
|
+
return logErrors;
|
|
79
|
+
},
|
|
80
|
+
set logErrors(value) {
|
|
81
|
+
logErrors = value;
|
|
82
|
+
},
|
|
83
|
+
get defaultLanguage() {
|
|
84
|
+
return defaultLanguage;
|
|
85
|
+
},
|
|
86
|
+
set defaultLanguage(value) {
|
|
87
|
+
defaultLanguage = value;
|
|
88
|
+
},
|
|
89
|
+
registerFormat,
|
|
90
|
+
create,
|
|
91
|
+
setDefaultLanguage
|
|
92
|
+
};
|
|
93
|
+
var base_default = fontkit;
|
|
75
94
|
|
|
76
95
|
// src/decorators.js
|
|
77
96
|
function cache(target, key, descriptor) {
|
|
@@ -17006,6 +17025,9 @@ registerFormat(WOFFFont);
|
|
|
17006
17025
|
registerFormat(WOFF2Font);
|
|
17007
17026
|
registerFormat(TrueTypeCollection);
|
|
17008
17027
|
registerFormat(DFont);
|
|
17028
|
+
base_default.open = open;
|
|
17029
|
+
base_default.openSync = openSync;
|
|
17030
|
+
var node_default = base_default;
|
|
17009
17031
|
// Annotate the CommonJS export names for ESM import in node:
|
|
17010
17032
|
0 && (module.exports = {
|
|
17011
17033
|
create,
|