/** * Loader for A-Frame fonts. * * See: * https://github.com/mattdesl/bmfont2json * https://github.com/etiennepinchon/aframe-fonts * * * @typedef {import("../types/bmFont.js").BMFont} BMFont * @typedef {import("./bmFontMetrics.js").BMFontMetrics} BMFontMetrics * * @typedef {"normal" | "italic"} FontStyle * @typedef {number} FontWeight * * @typedef {object} FontKey * @prop {string} family * @prop {FontStyle} style * @prop {FontWeight} weight * * @typedef {object} FontEntry * @prop {BMFontMetrics} metrics * @prop {WebGLTexture} texture */ export default class BmFontManager { /** * @param {import("../gl/webGLHelper.js").default} [webGLHelper] */ constructor(webGLHelper?: import("../gl/webGLHelper.js").default); _webGLHelper: import("../gl/webGLHelper.js").default; fontRepository: string; /** * @type {Map} */ _fonts: Map; /** @type {Map>} */ _metadataPromises: Map>; /** @type {Map>} */ _fontPromises: Map>; /** @type {Promise[]} Keep track of overall font loading state */ _promises: Promise[]; /** * A default/fallback font to be used when font loading fails * @type {FontEntry} */ _defaultFontEntry: FontEntry; waitUntilReady(): Promise; /** * * @param {string} family For example: "Lato" * @param {FontStyle} style * @param {FontWeight | keyof WEIGHTS} weight * @returns {FontEntry} */ getFont(family: string, style?: FontStyle, weight?: FontWeight | ("bold" | "normal" | "thin" | "light" | "regular" | "medium" | "black")): FontEntry; /** * * @param {FontEntry} fontEntry An uninitialized font entry * @param {FontKey} key */ _loadFontEntry(fontEntry: FontEntry, key: FontKey): Promise; /** * @param {string} url */ _loadFont(url: string): Promise; /** * * @param {string} family */ _loadMetadata(family: string): Promise; getDefaultFont(): FontEntry; /** * * @param {string} bitmapUrl * @returns {Promise} */ _createTexture(bitmapUrl: string): Promise; /** * * @param {string} bitmapUrl * @returns {WebGLTexture} */ _createTextureNow(bitmapUrl: string): WebGLTexture; } /** * A super-naive method for parsing METADATA.pb. * It's a text-format protobuf message, but I couldn't find a lightweight parser * for it. */ export type GoogleFontMetadataEntry = { /** * "Open Sans" */ name: string; /** * "italic" */ style: string; /** * 400 */ weight: number; /** * "OpenSans-Italic.ttf" */ filename: string; /** * "OpenSans-Italic" */ post_script_name: string; /** * "Open Sans Italic" */ full_name: string; /** * "Digitized data copyright 2010-2011, Google Corporation." */ copyright: string; }; /** * Loader for A-Frame fonts. * * See: * https://github.com/mattdesl/bmfont2json * https://github.com/etiennepinchon/aframe-fonts */ export type BMFont = import("../types/bmFont.js").BMFont; /** * Loader for A-Frame fonts. * * See: * https://github.com/mattdesl/bmfont2json * https://github.com/etiennepinchon/aframe-fonts */ export type BMFontMetrics = import("./bmFontMetrics.js").BMFontMetrics; /** * Loader for A-Frame fonts. * * See: * https://github.com/mattdesl/bmfont2json * https://github.com/etiennepinchon/aframe-fonts */ export type FontStyle = "normal" | "italic"; /** * Loader for A-Frame fonts. * * See: * https://github.com/mattdesl/bmfont2json * https://github.com/etiennepinchon/aframe-fonts */ export type FontWeight = number; /** * Loader for A-Frame fonts. * * See: * https://github.com/mattdesl/bmfont2json * https://github.com/etiennepinchon/aframe-fonts */ export type FontKey = { family: string; style: FontStyle; weight: FontWeight; }; /** * Loader for A-Frame fonts. * * See: * https://github.com/mattdesl/bmfont2json * https://github.com/etiennepinchon/aframe-fonts */ export type FontEntry = { metrics: BMFontMetrics; texture: WebGLTexture; }; //# sourceMappingURL=bmFontManager.d.ts.map