@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/main.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/module.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/module.mjs
CHANGED
|
@@ -33,6 +33,24 @@ var defaultLanguage = "en";
|
|
|
33
33
|
function setDefaultLanguage(lang = "en") {
|
|
34
34
|
defaultLanguage = lang;
|
|
35
35
|
}
|
|
36
|
+
var fontkit = {
|
|
37
|
+
get logErrors() {
|
|
38
|
+
return logErrors;
|
|
39
|
+
},
|
|
40
|
+
set logErrors(value) {
|
|
41
|
+
logErrors = value;
|
|
42
|
+
},
|
|
43
|
+
get defaultLanguage() {
|
|
44
|
+
return defaultLanguage;
|
|
45
|
+
},
|
|
46
|
+
set defaultLanguage(value) {
|
|
47
|
+
defaultLanguage = value;
|
|
48
|
+
},
|
|
49
|
+
registerFormat,
|
|
50
|
+
create,
|
|
51
|
+
setDefaultLanguage
|
|
52
|
+
};
|
|
53
|
+
var base_default = fontkit;
|
|
36
54
|
|
|
37
55
|
// src/decorators.js
|
|
38
56
|
function cache(target, key, descriptor) {
|
|
@@ -16967,8 +16985,12 @@ registerFormat(WOFFFont);
|
|
|
16967
16985
|
registerFormat(WOFF2Font);
|
|
16968
16986
|
registerFormat(TrueTypeCollection);
|
|
16969
16987
|
registerFormat(DFont);
|
|
16988
|
+
base_default.open = open;
|
|
16989
|
+
base_default.openSync = openSync;
|
|
16990
|
+
var node_default = base_default;
|
|
16970
16991
|
export {
|
|
16971
16992
|
create,
|
|
16993
|
+
node_default as default,
|
|
16972
16994
|
defaultLanguage,
|
|
16973
16995
|
logErrors,
|
|
16974
16996
|
open,
|