UNPKG

molstar

Version:

A comprehensive macromolecular library.

60 lines (59 loc) 2.01 kB
/** * Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> */ import { ParamDefinition as PD } from '../../../mol-util/param-definition'; import { TextureImage } from '../../../mol-gl/renderable/util'; export declare function getFontAtlas(props: Partial<FontAtlasProps>): FontAtlas; export declare type FontFamily = 'sans-serif' | 'monospace' | 'serif' | 'cursive'; export declare type FontStyle = 'normal' | 'italic' | 'oblique'; export declare type FontVariant = 'normal' | 'small-caps'; export declare type FontWeight = 'normal' | 'bold'; export declare const FontAtlasParams: { fontFamily: PD.Select<FontFamily>; fontQuality: PD.Select<number>; fontStyle: PD.Select<FontStyle>; fontVariant: PD.Select<FontVariant>; fontWeight: PD.Select<FontWeight>; }; export declare type FontAtlasParams = typeof FontAtlasParams; export declare type FontAtlasProps = PD.Values<FontAtlasParams>; export declare type FontAtlasMap = { x: number; y: number; w: number; h: number; nw: number; nh: number; }; export declare class FontAtlas { readonly props: Readonly<FontAtlasProps>; readonly mapped: { [k: string]: FontAtlasMap; }; readonly placeholder: FontAtlasMap; readonly texture: TextureImage<Uint8Array>; private scratchW; private scratchH; private currentX; private currentY; private readonly scratchData; private readonly cutoff; readonly buffer: number; private readonly radius; private gridOuter; private gridInner; private f; private d; private z; private v; private scratchCanvas; private scratchContext; readonly lineHeight: number; private readonly maxWidth; private readonly middle; constructor(props?: Partial<FontAtlasProps>); get(char: string): FontAtlasMap; draw(char: string): void; }