import { FontFace } from './fontface'; type StringPairs = Map; /** * Transforms input raw data of a text-based font file to a font face (@see {@link FontFace}) specification. All * referenced pages/glyph atlases will be loaded and setup as well. This is intended to be used directly by the * FontFace and is not required to be exposed to webgl-operates public API. */ export declare class FontFaceLoader { /** * Parses the info fields for padding values and stores them in the font face * @param stream - The stream of the 'info' identifier. * @param fontFace - The font face in which the padding is stored. */ protected static processInfo(stream: Array, fontFace: FontFace): boolean; /** * Parses the common fields for lineHeight, base, ascent, descent, scaleW and scaleH to store them * in the font face. If ascent and/or descent are not available, they can be computed using the largest y-offset * (ascent = baseline - max_yoffset) and descent can be derived as well (descent = - fontsize + ascent). * @param stream - The stream of the 'common' identifier. * @param fontFace - The font face in which the parsed values are stored. */ protected static processCommon(stream: Array, fontFace: FontFace): boolean; /** * Parses a page to load the associated png-file, i.e., the glyph atlas. * @param stream - The stream of the 'page' identifier. * @param fontFace - The font face in which the loaded glyph texture is stored. * @param url - Uniform resource locator string referencing the fnt-file (used for base path retrieval). * @returns - Promise for handling image load status. */ protected static processPage(stream: Array, fontFace: FontFace, url: string): Promise | undefined; /** * Fetches a single page (e.g., a png-file) for the glyph atlas of a font face. * @param fontFace - The font face in which the loaded glyph texture should be stored. * @param pageFileUrlsByPageID - Page urls mapped to page IDs. * @returns - Promise for handling image load status. */ protected static processPages(fontFace: FontFace, pageFileUrlsByPageID: Map): Promise | undefined; /** * Parses the char fields for character id (code point), x, y, width, height, xoffset, yoffset, xadvance to * store them in the font face as instances of Glyph. * This relies on fontFace.base and fontFace.glyphTextureExtent, so execute processCommon() first. * @param stream - The stream of the 'char' identifier. * @param fontFace - The font face in which the loaded glyph texture is stored. */ protected static processChar(stream: Array, fontFace: FontFace): boolean; /** * Parses the kerning fields for first and second character and the amount, to store them in the font face. * @param stream The stream of the 'kerning' identifier. * @param fontFace The font face in which the kerning tuples are stored. */ protected static processKerning(stream: Array, fontFace: FontFace): boolean; /** * Parses to find key-value pairs for given mandatory keys. * @param stream - The stream from which the pairs should be read. * @param mandatoryKeys - The found pairs are only valid if the mandatory keys are found. * @param result - key-value pairs, or undefined if not all mandatory keys are found. * @returns - success */ protected static readKeyValuePairs(stream: Array, mandatoryKeys: Array, resultPairs: StringPairs): boolean; /** * Derives ascent and descent data for the font face. Since the computation is based on the available glyphs and * not all of the font's glyphs might be included in the font face, the ascent/descent might be off (based on * minimum y-offset). * @param fontFace - Font face to find ascent and/or descent for (if missing). * @param size - Suggested size of the font face as read from the font file. Note that the actual size of the font * face is determined by the sum of ascent and descent (which should equal the font files info size). */ protected static findAscentAndDescentIfNoneProvided(fontFace: FontFace, size: number): void; /** * Asynchronously loads a fnt-file and provided/referenced pages to create a font face from them. * @param fontFace - Font face object to transform data into. * @param data - Font face data, probably fetched from an URL. * @param url - Uniform resource locator string referencing the fnt-file that was loaded. * @param headless - Whether or not to enable headless mode. If enabled, pages are not loaded. */ static process(fontFace: FontFace, data: string, fontFileUrl: string, pageFileUrlsByPageID: undefined | Map, headless?: boolean): Promise; } export {};