@cantoo/fontkit 2.0.7 → 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 -10
- package/src/base.js +33 -0
- package/src/index.js +2 -1
- package/src/node.js +7 -1
- package/src/packages/unicode-properties/dist/index.d.ts +37 -0
- package/src/packages/unicode-properties/dist/index.umd.js +640 -0
- package/src/packages/unicode-properties/dist/index.umd.js.map +7 -0
- package/src/packages/unicode-properties/index.d.ts +37 -0
- package/src/packages/unicode-properties/package.json +6 -1
- package/src/packages/unicode-trie/builder.d.ts +19 -0
- package/src/packages/unicode-trie/dist/builder.d.ts +19 -0
- package/src/packages/unicode-trie/dist/index.d.ts +19 -0
- package/src/packages/unicode-trie/dist/index.umd.js +498 -0
- package/src/packages/unicode-trie/dist/index.umd.js.map +7 -0
- package/src/packages/unicode-trie/index.d.ts +19 -0
- package/src/packages/unicode-trie/package.json +8 -1
- package/types/index.d.ts +27 -16
package/dist/browser.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/fontkit.umd.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/fontkit.umd.js
CHANGED
|
@@ -3780,6 +3780,7 @@ var fontkit = (() => {
|
|
|
3780
3780
|
var index_exports = {};
|
|
3781
3781
|
__export(index_exports, {
|
|
3782
3782
|
create: () => create,
|
|
3783
|
+
default: () => index_default,
|
|
3783
3784
|
defaultLanguage: () => defaultLanguage,
|
|
3784
3785
|
logErrors: () => logErrors,
|
|
3785
3786
|
registerFormat: () => registerFormat,
|
|
@@ -4845,6 +4846,24 @@ var fontkit = (() => {
|
|
|
4845
4846
|
function setDefaultLanguage(lang = "en") {
|
|
4846
4847
|
defaultLanguage = lang;
|
|
4847
4848
|
}
|
|
4849
|
+
var fontkit = {
|
|
4850
|
+
get logErrors() {
|
|
4851
|
+
return logErrors;
|
|
4852
|
+
},
|
|
4853
|
+
set logErrors(value) {
|
|
4854
|
+
logErrors = value;
|
|
4855
|
+
},
|
|
4856
|
+
get defaultLanguage() {
|
|
4857
|
+
return defaultLanguage;
|
|
4858
|
+
},
|
|
4859
|
+
set defaultLanguage(value) {
|
|
4860
|
+
defaultLanguage = value;
|
|
4861
|
+
},
|
|
4862
|
+
registerFormat,
|
|
4863
|
+
create,
|
|
4864
|
+
setDefaultLanguage
|
|
4865
|
+
};
|
|
4866
|
+
var base_default = fontkit;
|
|
4848
4867
|
|
|
4849
4868
|
// src/decorators.js
|
|
4850
4869
|
function cache(target, key, descriptor) {
|
|
@@ -22065,8 +22084,10 @@ var fontkit = (() => {
|
|
|
22065
22084
|
registerFormat(WOFF2Font);
|
|
22066
22085
|
registerFormat(TrueTypeCollection);
|
|
22067
22086
|
registerFormat(DFont);
|
|
22087
|
+
var index_default = base_default;
|
|
22068
22088
|
return __toCommonJS(index_exports);
|
|
22069
22089
|
})();
|
|
22090
|
+
fontkit = fontkit.default ?? fontkit;
|
|
22070
22091
|
if (typeof module === "object" && module.exports) {
|
|
22071
22092
|
module.exports = fontkit;
|
|
22072
22093
|
}
|