Renderer · interface

SdfFont

Explained in Hello world.

interface SdfFont
import type { SdfFont } from '@driftengine/core';

Properties

NameTypeDescription
familyreadonlystring
unitsPerEmreadonlynumber
ascenderreadonlynumber
descenderreadonlynumber
lineHeightreadonlynumber
distanceRangereadonlynumber
atlasWidthreadonlynumber
atlasHeightreadonlynumber
runsreadonlyreadonly string[]Keys in the glyph table that are more than one character, longest first.
More

A pre-shaped run: a string the generator handed to the platform's own text stack, which joined, reordered and shaped it, baked as one atlas cell. The runtime draws quads from metrics and does no shaping at all, so a script that joins its letters or reads right to left cannot be assembled from single glyphs at draw time. أبو came out as three disconnected isolated forms marching the wrong way; as one run it comes out as the word.

Longest first because sdfTextLayout.ts takes the first match at the pen, and a shorter run that is a prefix of a longer one must not win.

Methods

glyph

glyph(character: string): SdfGlyph | null
ParameterTypeDescription
characterstring

kerning

kerning(left: string, right: string): number
ParameterTypeDescription
leftstring
rightstring