import { clampf2 , GLclampf2 , GLfloat2 } from '../tuples' ; /**
 * Glyph related data for glyph based text rendering. Most of the glyph data (except the advance) refers to the font
 * face's glyph-texture. This class does not provide dpi awareness. This has to be handled outside of this class, e.g.,
 * during layouting and rendering.
 * The following definitions are applied: http://chanae.walon.org/pub/ttf/ttf_glyphs.htm
 */ export class Glyph { see advance protected _advance : GLfloat ; see bearing protected _bearing : GLfloat2 = [ 0.0 , 0.0 ] ; see extent protected _extent : GLfloat2 = [ 0.0 , 0.0 ] ; see index protected _index : GLsizei ; see kernings protected _kernings = new Map < GLsizei , GLfloat > ( ) ; see subTextureOrigin protected _subTextureOrigin : GLclampf2 = [ 0.0 , 0.0 ] ; see subTextureExtent protected _subTextureExtent : GLclampf2 = [ 0.0 , 0.0 ] ; constructor ( index = 0 , advance = 0 ) { this . _index = index ; this . _advance = advance ; } returns depictable ( ) { return this . _subTextureExtent [ 0 ] > 0 && this . _subTextureExtent [ 1 ] > 0 ; } param subsequentIndex returns kerning ( subsequentIndex ) { const kerning = this . _kernings . get ( subsequentIndex ) ; if ( kerning !== undefined ) { return kerning ; } return 0.0 ; } /**
     * Set the glyph's kernel w.r.t. a subsequent glyph in pt. @see  kerning param subsequentIndex param kerning setKerning ( subsequentIndex , kerning ) { this . _kernings . set ( subsequentIndex , kerning ) ; } /**
     * Set the index of one single distinguishable character.
     */ set index ( index ) { this . _index = index ; } get index ( ) : GLsizei { return this . _index ; } /**
     * Upper left position of the glyph's sub-texture. The upper left position refers to the glyph-texture that is
     * specified by a font face (@see  FontFace ). It is the u and v coordinates pointing to the glyphs
     * sub-texture within the texture atlas. The coordinates are normalized in [0;1].
     *  param origin set subTextureOrigin ( origin ) { this . _subTextureOrigin = clampf2 ( origin , 'texture origin' ) ; } get subTextureOrigin ( ) : GLclampf2 { return this . _subTextureOrigin ; } param extent set subTextureExtent ( extent ) { this . _subTextureExtent = clampf2 ( extent , 'texture extent' ) ; } get subTextureExtent ( ) : GLclampf2 { return this . _subTextureExtent ; } /**
     * The x and y offsets w.r.t. to the pen-position on the baseline. The horizontal bearing does not comprise the
     * glyph-texture's padding provided by the owning font face (@see  FontFace ). The vertical bearing also does
     * not comprises the glyph texture's padding and is the measured w.r.t. baseline.
     *  param bearing set bearing ( bearing ) { this . _bearing = bearing ; } get bearing ( ) : GLfloat2 { return this . _bearing ; } param fontBase param xOffset param yOffset bearingFromFontBaseAndOffset ( fontBase , xOffset , yOffset ) { this . _bearing [ 0 ] = xOffset ; this . _bearing [ 1 ] = fontBase - yOffset ; } param extent set extent ( extent ) { this . _extent = extent ; } get extent ( ) : GLfloat2 { return this . _extent ; } param advance set advance ( advance ) { this . _advance = advance ; } get advance ( ) : GLfloat { return this . _advance ; } }