Renderer · class
SdfTextLayout
Explained in Hello world.
class SdfTextLayoutimport { SdfTextLayout } from '@driftengine/core';Constructor
new
constructor()Properties
| Name | Type | Description |
|---|---|---|
positionsreadonly | Float32Array<ArrayBuffer> | |
uvsreadonly | Float32Array<ArrayBuffer> | |
indicesreadonly | Uint32Array<ArrayBuffer> | |
quadCount | number | |
width | number | |
height | number |
Methods
set
set(font: SdfFont, text: string, style: SdfTextStyle): booleanLay a string out. Returns whether anything moved, so a caller can skip the upload.
| Parameter | Type | Description |
|---|---|---|
font | SdfFont | |
text | string | |
style | SdfTextStyle |
More
The key covers the style as well as the text, because a size change moves every vertex and a string that only compared its characters would keep the old geometry at the new size -- which reads as the wrong font rather than as a stale buffer.
A piece is one code point, unless the font carries a pre-shaped run that starts here,
in which case it is that run and it draws as a single quad. See SdfFont.runs: the
engine does no shaping, so a script that joins or reorders its letters has to arrive
already shaped, as one cell.