UNPKG

cn-font-split

Version:

划时代的字体切割工具,CJK与任何字符!支持 otf、ttf、woff2 字体多线程切割,完美地细颗粒度地进行包大小控制。A revolutionary font subetter that supports CJK and any characters! It enables multi-threaded subset of otf, ttf, and woff2 fonts, allowing for precise control over package size.

47 lines (46 loc) 1.55 kB
import { IFs } from 'memfs-browser'; import { WASI } from '@tybys/wasm-util'; import { FontSplitProps } from '../interface'; export * from '../interface.js'; export * from '../createAPI.js'; export declare class APIInterface { key: string; constructor(key?: string); fs: IFs; init(fs?: IFs): Promise<void>; setConfig(config: FontSplitProps | ArrayBuffer): Promise<void>; callback(): Promise<({ name: string; data: Uint8Array<ArrayBufferLike>; } | undefined)[]>; } export declare function fontSplit(input: FontSplitProps | ArrayBuffer, loadWasm: (imports: any) => Promise<WebAssembly.WebAssemblyInstantiatedSource>, options?: { key?: string; logger: (str: string, type: 'log' | 'error') => void; fs?: IFs; }): Promise<({ name: string; data: Uint8Array<ArrayBufferLike>; } | undefined)[]>; export declare function createWasi(api: APIInterface, options: { key?: string; logger: (str: string, type: 'log' | 'error') => void; fs?: IFs; } | undefined): { imports: { wasi_snapshot_preview1: Record<string, any>; env: { pthread_mutex_init: () => number; pthread_mutex_lock: () => number; pthread_mutex_unlock: () => number; pthread_mutex_destroy: () => number; }; }; wasi: WASI; }; export declare class StaticWasm { wasmBuffer: Promise<ArrayBuffer>; url: string; constructor(url: string | Uint8Array); WasiHandle: (imports: any) => Promise<WebAssembly.WebAssemblyInstantiatedSource>; }