Renders text labels one glyph per character, laid out along each annotation's path. Characters are rasterized into the atlas on demand, so a label's text may change at any time.
On this page
Methods
new MVTLabelGlyphs(
options?: {
// Glyph size in pixels.
size: number = 16,
// Atlas slot size in pixels (defaults to `16 * devicePixelRatio`).
glyphSize?: number,
// Initial atlas slot capacity ( grows as needed ).
slotCount: number = 64,
// Explicit CSS font string; overrides `fontFamily`.
font: string | null = null,
// Font family used to build the CSS font when `font` isn't given.
fontFamily: string = 'sans-serif',
// Outline color drawn under each glyph.
strokeStyle: string = 'black',
// Outline width in atlas pixels ( 0 disables the outline ).
strokeWidth: number = 0
}
)reset(): voidResets the cached glyphs content. Used when changing fonts or styles.
measureChar(
// The character to measure.
char: string
): numberAdvance width of char in the label's size units, cached per character.