import { Buffer } from "buffer/index.js"; /** * Helper to create subsets of fonts * Large parts of this are a modified version of papandreou/subset-font */ export declare class SubsetManager { /** * Harfbuzz subset sets name id */ private static readonly HB_SUBSET_SETS_NAME_ID; /** * Harfbuzz subset sets layout feature tag */ private static readonly HB_SUBSET_SETS_LAYOUT_FEATURE_TAG; /** * Harfbuzz writable memory mode */ private static readonly HB_MEMORY_MODE_WRITABLE; /** * OpenType name table ID for the COPYRIGHT notice. */ private static readonly NAME_ID_COPYRIGHT; /** * OpenType name table ID for the TRADEMARK notice. */ private static readonly NAME_ID_TRADEMARK; /** * OpenType name table ID for the LICENSE notice. */ private static readonly NAME_ID_LICENSE; /** * OpenType name table ID for the LICENSE URL. */ private static readonly NAME_ID_LICENSE_URL; /** * The cached harfbuzzjs instance */ private harfbuzzJs?; /** * Used to limit the number of concurrent subsetFontInternal calls to 1 */ private readonly limiter; /** * Subsets a font * Modified version of papandreou/subset-font * Always includes the following name table entries: COPYRIGHT, TRADEMARK, LICENSE, LICENSE_URL * * @param originalFont the original font to subset * @param characters text including all characters that should be included in the subset, all characters are included if undefined * @param variationAxes optional object with variation axes to pin to specific values * @returns the subset font */ subsetFont(originalFont: Buffer, characters: string | undefined, variationAxes: Record | undefined): Promise; /** * Gets the harfbuzzjs instance * Result is cached * Must NOT be called concurrently / interleaved * * @returns the harfbuzzjs instance */ private getHarfbuzzJs; /** * Creates a 32-bit integer from a string. * * @param str The string to convert, should be 4 characters long. * @returns The 32-bit integer. */ private HB_TAG; /** * Subsets a font * Always includes the following name table entries: COPYRIGHT, TRADEMARK, LICENSE, LICENSE_URL * Must NOT be called concurrently / interleaved * * @param font the font to subset * @param characters text including all characters that should be included in the subset, all characters are included if undefined * @param variationAxes optional object with variation axes to pin to specific values * @returns the subset font */ private subsetFontInternal; /** * Computes the subset * * @param harfbuzzJsWasm the harfbuzzjs instance * @param heapu8 the harfbuzz instance heap to use * @param face the harfbuzz face pointer * @param input the harfbuzz input pointer * @param fontBuffer the font buffer * @returns the subset font */ private computeSubset; /** * Imports a font into harfbuzz * * @param harfbuzzJsWasm the harfbuzzjs instance * @param convertedFont the converted font * @param heapu8 the harfbuzz instance heap to use * @returns the input, face and font buffer */ private importFontIntoHarfbuzz; /** * Sets the input unicodes for the subset * * @param harfbuzzJsWasm the harfbuzzjs instance * @param input the harfbuzz input pointer * @param characters the characters to include in the subset, all characters are included if undefined */ private setInputUnicodesForSubset; /** * Sets the layout features for the subset * Removes all layout features * * @param harfbuzzJsWasm the harfbuzzjs instance * @param input the harfbuzz input pointer */ private setLayoutFeaturesForSubset; /** * Sets the variation axes for the subset * Removes all variation axes, uses the default value for non-provided axes * * @param harfbuzzJsWasm the harfbuzzjs instance * @param variationAxes the variation axes * @param input the harfbuzz input pointer * @param face the harfbuzz face pointer */ private setVariationAxesForSubset; /** * Sets the name table for the subset * Removes all name table entries except COPYRIGHT, TRADEMARK, LICENSE, LICENSE_URL * * @param harfbuzzJsWasm the harfbuzzjs instance * @param input the harfbuzz input pointer */ private setNameTableForSubset; /** * Cleans up resources * * @param harfbuzzJsWasm the harfbuzzjs instance * @param result the harfbuzz result pointer * @param subset the harfbuzz subset pointer * @param face the harfbuzz face pointer * @param fontBuffer the font buffer */ private cleanupResources; } //# sourceMappingURL=subsetFont.d.ts.map