Sign in

    wzzc-dev/moui_sun/text does not have a README file

    FontLoader

    pub(open) trait FontLoader {
    fn load_font_data(Self, String) -> Result[FontData, FontLoadError]
    }

    Pluggable source of keyed font bytes.

    CoverageMask

    type CoverageMask derive(
    Debug
    )

    Grayscale coverage mask produced by text rasterization

    CoverageMask::copy

    Copy this coverage mask and its pixel storage.

    CoverageMask::get_height

    fn CoverageMask::get_height(self : CoverageMask) -> Int

    Get the height of the mask

    CoverageMask::get_pixels

    fn CoverageMask::get_pixels(self : CoverageMask) -> FixedArray[Byte]

    Get the grayscale coverage pixels

    CoverageMask::get_width

    fn CoverageMask::get_width(self : CoverageMask) -> Int

    Get the width of the mask

    CoverageMask::new

    fn CoverageMask::new(width : Int, height : Int, pixels : FixedArray[Byte]) -> CoverageMask

    Create a coverage mask from grayscale pixels

    FaceGlyphMaskCacheResult

    type FaceGlyphMaskCacheResult derive(
    Debug
    )

    Result of reading a face glyph mask from cache or rasterizing it on miss.

    FaceGlyphMaskCacheResult::did_rasterize

    fn FaceGlyphMaskCacheResult::did_rasterize(self : FaceGlyphMaskCacheResult) -> Bool

    Return whether this lookup rasterized a new face glyph mask.

    FaceGlyphMaskCacheResult::get_mask

    Get the resulting face glyph coverage mask.

    FaceGlyphMaskCacheResult::get_placement

    Get placement data for the resulting face glyph coverage mask.

    FaceGlyphMaskPlacement

    type FaceGlyphMaskPlacement derive(
    Debug
    )

    Placement data for a glyph mask rendered from a font face.

    FaceGlyphMaskPlacement::get_draw_offset_x

    fn FaceGlyphMaskPlacement::get_draw_offset_x(self : FaceGlyphMaskPlacement) -> Int

    Get the draw offset X coordinate for this placement.

    FaceGlyphMaskPlacement::get_draw_offset_y

    fn FaceGlyphMaskPlacement::get_draw_offset_y(self : FaceGlyphMaskPlacement) -> Int

    Get the draw offset Y coordinate for this placement.

    FaceGlyphMaskPlacement::get_height

    fn FaceGlyphMaskPlacement::get_height(self : FaceGlyphMaskPlacement) -> Int

    Get the mask height for this placement.

    FaceGlyphMaskPlacement::get_origin_x

    fn FaceGlyphMaskPlacement::get_origin_x(self : FaceGlyphMaskPlacement) -> Double

    Get the raster origin X coordinate for this placement.

    FaceGlyphMaskPlacement::get_origin_y

    fn FaceGlyphMaskPlacement::get_origin_y(self : FaceGlyphMaskPlacement) -> Double

    Get the raster origin Y coordinate for this placement.

    FaceGlyphMaskPlacement::get_width

    fn FaceGlyphMaskPlacement::get_width(self : FaceGlyphMaskPlacement) -> Int

    Get the mask width for this placement.

    FileFontLoader

    type FileFontLoader derive(
    Debug
    )

    File-backed font loader keyed by caller-provided resource names.

    FileFontLoader::clear

    fn FileFontLoader::clear(self : FileFontLoader) -> Unit

    Drop all registered file sources.

    FileFontLoader::contains

    fn FileFontLoader::contains(self : FileFontLoader, key : String) -> Bool

    Return whether this loader has a source for a key.

    FileFontLoader::insert

    fn FileFontLoader::insert(self : FileFontLoader, key : String, source : FontFileSource) -> FontFileSource

    Register or replace a file source for a key.

    FileFontLoader::is_empty

    fn FileFontLoader::is_empty(self : FileFontLoader) -> Bool

    Return whether this loader has no registered file-backed font entries.

    FileFontLoader::len

    fn FileFontLoader::len(self : FileFontLoader) -> Int

    Return the number of registered file-backed font entries.

    FileFontLoader::load_font_data

    fn FileFontLoader::load_font_data(self : FileFontLoader, key : String) -> Result[FontData, FontLoadError]

    FileFontLoader::new

    Create an empty file-backed font loader.

    FileFontLoader::remove

    fn FileFontLoader::remove(self : FileFontLoader, key : String) -> Unit

    Remove a registered file source.

    Font

    Parsed font data

    Font::to_repr

    FontData

    Font data (simplified representation)

    FontData::get_data

    fn FontData::get_data(self : FontData) -> Bytes

    Get the raw font data

    FontData::get_font_index

    fn FontData::get_font_index(self : FontData) -> Int

    Get the face index inside a font collection.

    FontData::new

    fn FontData::new(data : Bytes, font_index? : Int) -> FontData

    Create font data from bytes

    FontData::parse

    fn FontData::parse(self : FontData) -> Result[FontFace, FontParseError]

    Parse this raw font-data container into a checked font face.

    FontData::to_repr

    FontFace

    Parsed font face used by higher-level layout and rendering APIs.

    FontFace::char_to_glyph

    fn FontFace::char_to_glyph(self : FontFace, char_code : Int) -> Int

    Map a Unicode codepoint to a glyph id.

    FontFace::from_bytes

    fn FontFace::from_bytes(data : Bytes) -> Result[FontFace, FontParseError]

    Parse TTF bytes into a checked font face.

    FontFace::from_data

    fn FontFace::from_data(data : FontData) -> Result[FontFace, FontParseError]

    Parse a raw font-data container into a checked font face.

    FontFace::get_metrics

    fn FontFace::get_metrics(self : FontFace) -> FontMetrics

    Get face-wide metrics in font units.

    FontFace::get_units_per_em

    fn FontFace::get_units_per_em(self : FontFace) -> Int

    Get units per em for the face.

    FontFace::has_glyph_for_char

    fn FontFace::has_glyph_for_char(self : FontFace, char_code : Int) -> Bool

    Return whether this face maps a Unicode codepoint to a drawable glyph.

    FontFace::text_run_outline

    fn FontFace::text_run_outline(self : FontFace, text : String, font_size : Double, origin_x : Double, baseline_y : Double, target_length? : Double) -> TextRunOutline

    Flatten every glyph contour of text laid out with font_size so that the run starts at origin_x and sits on the baseline baseline_y. Composite glyphs fall back to nothing (matching the rasterizer), so callers pairing this with a bitmap fallback keep full coverage.

    FontFace::to_repr

    FontFaceCache

    type FontFaceCache derive(
    Debug
    )

    Small checked font-face cache for GUI/resource code that repeatedly asks for the same parsed face.

    FontFaceCache::capacity

    fn FontFaceCache::capacity(self : FontFaceCache) -> Int

    Return the maximum number of cached font faces, or 0 for an unbounded cache.

    FontFaceCache::clear

    fn FontFaceCache::clear(self : FontFaceCache) -> Unit

    Drop all cached faces.

    FontFaceCache::contains

    fn FontFaceCache::contains(self : FontFaceCache, key : String) -> Bool

    Return whether the cache has a parsed face for this key without refreshing LRU.

    FontFaceCache::get

    fn FontFaceCache::get(self : FontFaceCache, key : String) -> FontFace?

    Look up a parsed face by caller-provided key.

    FontFaceCache::get_or_load

    fn[L : FontLoader] FontFaceCache::get_or_load(self : FontFaceCache, key : String, loader : L) -> Result[FontFace, FontLoadError]

    Load and parse a font face on first use, returning just the face.

    FontFaceCache::get_or_load_result

    fn[L : FontLoader] FontFaceCache::get_or_load_result(self : FontFaceCache, key : String, loader : L) -> Result[FontFaceCacheParseResult, FontLoadError]

    Load and parse a font face on first use, then reuse the cached face.

    FontFaceCache::get_or_parse

    fn FontFaceCache::get_or_parse(self : FontFaceCache, key : String, data : Bytes) -> Result[FontFace, FontParseError]

    Parse bytes on first use and return the cached checked face afterwards.

    FontFaceCache::get_or_parse_result

    fn FontFaceCache::get_or_parse_result(self : FontFaceCache, key : String, data : Bytes) -> Result[FontFaceCacheParseResult, FontParseError]

    Parse bytes on first use and report whether cache missed.

    FontFaceCache::insert

    fn FontFaceCache::insert(self : FontFaceCache, key : String, face : FontFace) -> FontFace

    Insert or replace a parsed face under a caller-provided key.

    FontFaceCache::is_capacity_bounded

    fn FontFaceCache::is_capacity_bounded(self : FontFaceCache) -> Bool

    Return whether the cache has a configured entry limit.

    FontFaceCache::is_empty

    fn FontFaceCache::is_empty(self : FontFaceCache) -> Bool

    Return whether the cache currently has no parsed faces.

    FontFaceCache::len

    fn FontFaceCache::len(self : FontFaceCache) -> Int

    Return the number of cached font faces.

    FontFaceCache::new

    Create an empty font-face cache.

    FontFaceCache::remove

    fn FontFaceCache::remove(self : FontFaceCache, key : String) -> Unit

    Remove a cached face by key.

    FontFaceCache::with_capacity

    fn FontFaceCache::with_capacity(capacity : Int) -> FontFaceCache

    Create an empty font-face cache with least-recently-used eviction.

    FontFaceCacheParseResult

    type FontFaceCacheParseResult derive(
    Debug
    )

    Result of reading a checked font face from cache or parsing it on miss.

    FontFaceCacheParseResult::did_hit_cache

    fn FontFaceCacheParseResult::did_hit_cache(self : FontFaceCacheParseResult) -> Bool

    Return whether this lookup reused a checked face from cache.

    FontFaceCacheParseResult::did_parse

    Return whether this lookup parsed bytes instead of hitting cache.

    FontFaceCacheParseResult::get_face

    Get the resulting checked font face.

    FontFallbackPlan

    type FontFallbackPlan derive(
    Debug
    )

    A font fallback plan for a text string.

    FontFallbackPlan::get_char_count

    fn FontFallbackPlan::get_char_count(self : FontFallbackPlan) -> Int

    Get the number of Unicode scalar values examined by this plan.

    FontFallbackPlan::get_missing_char_count

    fn FontFallbackPlan::get_missing_char_count(self : FontFallbackPlan) -> Int

    Get the number of scalar values not covered by any provided face.

    FontFallbackPlan::get_spans

    Get fallback spans in source-text order.

    FontFallbackPlan::has_missing_glyphs

    fn FontFallbackPlan::has_missing_glyphs(self : FontFallbackPlan) -> Bool

    Return whether any scalar value lacks glyph coverage.

    FontFallbackPlan::is_empty

    fn FontFallbackPlan::is_empty(self : FontFallbackPlan) -> Bool

    Return whether the plan has no text spans.

    FontFallbackPlan::span_count

    fn FontFallbackPlan::span_count(self : FontFallbackPlan) -> Int

    Get the number of fallback spans.

    FontFallbackSpan

    type FontFallbackSpan derive(
    Debug
    )

    A contiguous text segment covered by the same font-face index.

    FontFallbackSpan::get_char_count

    fn FontFallbackSpan::get_char_count(self : FontFallbackSpan) -> Int

    Get the number of Unicode scalar values in this span.

    FontFallbackSpan::get_face_index

    fn FontFallbackSpan::get_face_index(self : FontFallbackSpan) -> Int

    Get the index of the selected face, or -1 when no face covers this span.

    FontFallbackSpan::get_text

    fn FontFallbackSpan::get_text(self : FontFallbackSpan) -> String

    Get the text covered by this span.

    FontFallbackSpan::is_missing

    fn FontFallbackSpan::is_missing(self : FontFallbackSpan) -> Bool

    Return whether no provided face covers this span.

    FontFileSource

    type FontFileSource derive(Eq,
    Debug
    )

    One file-backed font source registered in a loader.

    FontFileSource::equal

    FontFileSource::get_font_index

    fn FontFileSource::get_font_index(self : FontFileSource) -> Int

    Return the face index inside the font file.

    FontFileSource::get_path

    fn FontFileSource::get_path(self : FontFileSource) -> String

    Return the file path for this source.

    FontFileSource::new

    fn FontFileSource::new(path : String, font_index? : Int) -> FontFileSource

    Create a file-backed font source.

    FontFileSource::not_equal

    fn FontFileSource::not_equal(x : FontFileSource, y : FontFileSource) -> Bool

    FontHead

    type FontHead derive(Eq,
    Debug
    )

    Font header (head table)

    FontHead::equal

    fn FontHead::equal(FontHead, FontHead) -> Bool

    FontHead::not_equal

    fn FontHead::not_equal(x : FontHead, y : FontHead) -> Bool

    FontHead::to_repr

    FontHhea

    type FontHhea derive(Eq,
    Debug
    )

    Horizontal header (hhea table)

    FontHhea::equal

    fn FontHhea::equal(FontHhea, FontHhea) -> Bool

    FontHhea::not_equal

    fn FontHhea::not_equal(x : FontHhea, y : FontHhea) -> Bool

    FontHhea::to_repr

    FontLoadError

    pub(all) enum FontLoadError {
    MissingFontData(String)
    FontFileReadFailed(String, String)
    FontParseFailed(String, FontParseError)
    } derive(Eq,
    Debug
    )

    Error returned by font loaders and loader-backed cache helpers.

    FontLoadError::equal

    FontLoadError::not_equal

    fn FontLoadError::not_equal(x : FontLoadError, y : FontLoadError) -> Bool

    FontMetrics

    pub struct FontMetrics {
    units_per_em : Int
    ascent : Int
    descent : Int
    line_gap : Int
    } derive(Eq,
    Debug
    )

    Font metrics information

    FontMetrics::equal

    fn FontMetrics::equal(FontMetrics, FontMetrics) -> Bool

    FontMetrics::line_height

    fn FontMetrics::line_height(self : FontMetrics) -> Int

    Get the line height (ascent - descent + line_gap)

    FontMetrics::new

    fn FontMetrics::new(units_per_em~ : Int, ascent~ : Int, descent~ : Int, line_gap? : Int) -> FontMetrics

    Create font metrics

    FontMetrics::not_equal

    fn FontMetrics::not_equal(x : FontMetrics, y : FontMetrics) -> Bool

    FontParseError

    pub(all) enum FontParseError {
    UnexpectedEndOfData(Int, Int, Int)
    InvalidFontHeader(UInt)
    UnsupportedFontIndex(Int)
    MissingTable(String)
    TableOutOfBounds(String, Int, Int, Int)
    TableTooShort(String, Int, Int)
    UnsupportedIndexToLocFormat(Int)
    MissingHorizontalMetrics
    UnsortedLocaOffsets
    UnsortedGlyphContourEndpoints
    GlyphFlagRepeatOverflow
    UnsupportedCmapVersion(Int)
    InvalidCmapSegmentCount(Int)
    InvalidCmapSegmentRange(Int, Int)
    InvalidCmapGroupRange(Int, Int)
    } derive(Eq,
    Debug
    )

    Error returned by the checked TTF parser entry point.

    FontParseError::equal

    FontParseError::not_equal

    fn FontParseError::not_equal(x : FontParseError, y : FontParseError) -> Bool

    GlyphAtlasEntry

    type GlyphAtlasEntry derive(
    Debug
    )

    Placement of one glyph mask inside a glyph mask atlas.

    GlyphAtlasEntry::get_height

    fn GlyphAtlasEntry::get_height(self : GlyphAtlasEntry) -> Int

    Get the entry height.

    GlyphAtlasEntry::get_key

    fn GlyphAtlasEntry::get_key(self : GlyphAtlasEntry) -> String

    Get the caller-provided glyph key for this atlas entry.

    GlyphAtlasEntry::get_width

    fn GlyphAtlasEntry::get_width(self : GlyphAtlasEntry) -> Int

    Get the entry width.

    GlyphAtlasEntry::get_x

    fn GlyphAtlasEntry::get_x(self : GlyphAtlasEntry) -> Int

    Get the atlas x coordinate.

    GlyphAtlasEntry::get_y

    fn GlyphAtlasEntry::get_y(self : GlyphAtlasEntry) -> Int

    Get the atlas y coordinate.

    GlyphAtlasEntry::new

    fn GlyphAtlasEntry::new(key~ : String, x~ : Int, y~ : Int, width~ : Int, height~ : Int) -> GlyphAtlasEntry

    Create a glyph atlas entry.

    GlyphComponent

    type GlyphComponent derive(
    Debug
    )

    A component of a composite glyph

    GlyphContour

    type GlyphContour derive(
    Debug
    )

    Glyph contour

    GlyphData

    type GlyphData derive(
    Debug
    )

    Glyph data (simple or composite)

    GlyphId

    Glyph ID type (wraps Int)

    GlyphId::equal

    fn GlyphId::equal(GlyphId, GlyphId) -> Bool

    GlyphId::new

    fn GlyphId::new(id : Int) -> GlyphId

    Create a glyph ID

    GlyphId::not_equal

    fn GlyphId::not_equal(x : GlyphId, y : GlyphId) -> Bool

    GlyphId::to_int

    fn GlyphId::to_int(self : GlyphId) -> Int

    Get the underlying ID value

    GlyphId::to_repr

    GlyphInfo

    type GlyphInfo derive(Eq,
    Debug
    )

    Glyph info with cluster mapping

    GlyphInfo::equal

    fn GlyphInfo::equal(GlyphInfo, GlyphInfo) -> Bool

    GlyphInfo::get_cluster

    fn GlyphInfo::get_cluster(self : GlyphInfo) -> Int

    Get the source cluster index.

    GlyphInfo::get_glyph_id

    fn GlyphInfo::get_glyph_id(self : GlyphInfo) -> GlyphId

    Get the shaped glyph id.

    GlyphInfo::new

    fn GlyphInfo::new(glyph_id~ : GlyphId, cluster~ : Int) -> GlyphInfo

    Create glyph info

    GlyphInfo::not_equal

    fn GlyphInfo::not_equal(x : GlyphInfo, y : GlyphInfo) -> Bool

    GlyphMaskAtlas

    type GlyphMaskAtlas derive(
    Debug
    )

    Small row-packed atlas for rendered glyph coverage masks.

    GlyphMaskAtlas::can_fit

    fn GlyphMaskAtlas::can_fit(self : GlyphMaskAtlas, mask : CoverageMask) -> Bool

    Return whether this mask can be placed as a new atlas entry.

    GlyphMaskAtlas::clear

    fn GlyphMaskAtlas::clear(self : GlyphMaskAtlas) -> Unit

    Remove all atlas entries and clear atlas pixels.

    GlyphMaskAtlas::get

    fn GlyphMaskAtlas::get(self : GlyphMaskAtlas, key : String) -> GlyphAtlasEntry?

    Look up a placed glyph mask by key.

    GlyphMaskAtlas::get_capacity

    fn GlyphMaskAtlas::get_capacity(self : GlyphMaskAtlas) -> Int

    Return the total pixel capacity of the atlas.

    GlyphMaskAtlas::get_free_pixel_count

    fn GlyphMaskAtlas::get_free_pixel_count(self : GlyphMaskAtlas) -> Int

    Return atlas capacity minus placed mask pixels.

    GlyphMaskAtlas::get_height

    fn GlyphMaskAtlas::get_height(self : GlyphMaskAtlas) -> Int

    Get the atlas height.

    GlyphMaskAtlas::get_occupancy_ratio

    fn GlyphMaskAtlas::get_occupancy_ratio(self : GlyphMaskAtlas) -> Double

    Return placed mask pixels divided by total atlas capacity.

    GlyphMaskAtlas::get_used_pixel_count

    fn GlyphMaskAtlas::get_used_pixel_count(self : GlyphMaskAtlas) -> Int

    Return the number of atlas pixels occupied by placed glyph masks.

    GlyphMaskAtlas::get_width

    fn GlyphMaskAtlas::get_width(self : GlyphMaskAtlas) -> Int

    Get the atlas width.

    GlyphMaskAtlas::insert

    fn GlyphMaskAtlas::insert(self : GlyphMaskAtlas, key : String, mask : CoverageMask) -> GlyphAtlasEntry?

    Insert a rendered glyph mask if there is space, or return the existing entry.

    GlyphMaskAtlas::insert_or_clear

    fn GlyphMaskAtlas::insert_or_clear(self : GlyphMaskAtlas, key : String, mask : CoverageMask) -> GlyphMaskAtlasInsertResult?

    Insert a mask, clearing the atlas first if the current row-packing state is full. When the result reports did_clear, previous atlas entries are no longer valid.

    GlyphMaskAtlas::is_empty

    fn GlyphMaskAtlas::is_empty(self : GlyphMaskAtlas) -> Bool

    Return whether the atlas has no placed glyph masks.

    GlyphMaskAtlas::len

    fn GlyphMaskAtlas::len(self : GlyphMaskAtlas) -> Int

    Return the number of placed glyph masks.

    GlyphMaskAtlas::new

    fn GlyphMaskAtlas::new(width : Int, height : Int) -> GlyphMaskAtlas

    Create an empty glyph mask atlas.

    GlyphMaskAtlas::to_mask

    Snapshot the full atlas pixels as a coverage mask.

    GlyphMaskAtlasInsertResult

    type GlyphMaskAtlasInsertResult derive(
    Debug
    )

    Result of inserting a glyph mask into an atlas with lifecycle policy.

    GlyphMaskAtlasInsertResult::did_clear

    Return whether the atlas was cleared before this entry was inserted.

    GlyphMaskAtlasInsertResult::did_reuse

    Return whether this result reused an existing atlas entry.

    GlyphMaskAtlasInsertResult::get_entry

    Get the placed atlas entry.

    GlyphMaskCache

    type GlyphMaskCache derive(
    Debug
    )

    Small keyed cache for rendered glyph coverage masks.

    GlyphMaskCache::capacity

    fn GlyphMaskCache::capacity(self : GlyphMaskCache) -> Int

    Return the maximum number of cached glyph masks, or 0 for an unbounded cache.

    GlyphMaskCache::clear

    fn GlyphMaskCache::clear(self : GlyphMaskCache) -> Unit

    Drop all cached glyph masks.

    GlyphMaskCache::contains

    fn GlyphMaskCache::contains(self : GlyphMaskCache, key : String) -> Bool

    Return whether the cache has a glyph mask for this key without refreshing LRU.

    GlyphMaskCache::get

    fn GlyphMaskCache::get(self : GlyphMaskCache, key : String) -> CoverageMask?

    Look up a rendered glyph mask by caller-provided key.

    GlyphMaskCache::get_or_rasterize_face_glyph_result

    fn GlyphMaskCache::get_or_rasterize_face_glyph_result(self : GlyphMaskCache, key : String, face : FontFace, glyph_id : Int, scale : Double) -> FaceGlyphMaskCacheResult?

    Rasterize a glyph from a parsed font face on first use and report cache state.

    GlyphMaskCache::insert

    fn GlyphMaskCache::insert(self : GlyphMaskCache, key : String, mask : CoverageMask) -> CoverageMask

    Insert or replace a rendered glyph mask under a caller-provided key.

    GlyphMaskCache::is_capacity_bounded

    fn GlyphMaskCache::is_capacity_bounded(self : GlyphMaskCache) -> Bool

    Return whether the cache has a configured entry limit.

    GlyphMaskCache::is_empty

    fn GlyphMaskCache::is_empty(self : GlyphMaskCache) -> Bool

    Return whether the cache currently has no glyph masks.

    GlyphMaskCache::len

    fn GlyphMaskCache::len(self : GlyphMaskCache) -> Int

    Return the number of cached glyph masks.

    GlyphMaskCache::new

    Create an empty glyph mask cache.

    GlyphMaskCache::remove

    fn GlyphMaskCache::remove(self : GlyphMaskCache, key : String) -> Unit

    Remove a cached glyph mask by key.

    GlyphMaskCache::with_capacity

    fn GlyphMaskCache::with_capacity(capacity : Int) -> GlyphMaskCache

    Create an empty glyph mask cache with least-recently-used eviction.

    GlyphMaskCacheRasterizeResult

    type GlyphMaskCacheRasterizeResult derive(
    Debug
    )

    Result of reading a glyph mask from cache or rasterizing it on miss.

    GlyphPoint

    type GlyphPoint derive(Eq,
    Debug
    )

    Simple glyph point

    GlyphPoint::equal

    fn GlyphPoint::equal(GlyphPoint, GlyphPoint) -> Bool

    GlyphPoint::not_equal

    fn GlyphPoint::not_equal(x : GlyphPoint, y : GlyphPoint) -> Bool

    GlyphPosition

    type GlyphPosition derive(Eq,
    Debug
    )

    Glyph position with advance and offset

    GlyphPosition::equal

    GlyphPosition::get_glyph_id

    fn GlyphPosition::get_glyph_id(self : GlyphPosition) -> GlyphId

    Get the glyph id for this position.

    GlyphPosition::get_x_advance

    fn GlyphPosition::get_x_advance(self : GlyphPosition) -> Int

    Get horizontal advance in font units.

    GlyphPosition::get_x_offset

    fn GlyphPosition::get_x_offset(self : GlyphPosition) -> Int

    Get horizontal offset in font units.

    GlyphPosition::get_y_advance

    fn GlyphPosition::get_y_advance(self : GlyphPosition) -> Int

    Get vertical advance in font units.

    GlyphPosition::get_y_offset

    fn GlyphPosition::get_y_offset(self : GlyphPosition) -> Int

    Get vertical offset in font units.

    GlyphPosition::new

    fn GlyphPosition::new(glyph_id~ : GlyphId, x_advance? : Int, y_advance? : Int, x_offset? : Int, y_offset? : Int) -> GlyphPosition

    Create a glyph position

    GlyphPosition::not_equal

    fn GlyphPosition::not_equal(x : GlyphPosition, y : GlyphPosition) -> Bool

    GlyphRun

    Positioned glyphs for a single shaped and laid-out line.

    GlyphRun::get_baseline_y

    fn GlyphRun::get_baseline_y(self : GlyphRun) -> Double

    Get baseline position in pixels from the layout origin.

    GlyphRun::get_glyphs

    fn GlyphRun::get_glyphs(self : GlyphRun) -> Array[PositionedGlyph]

    Get positioned glyphs in this run.

    GlyphRun::get_width

    fn GlyphRun::get_width(self : GlyphRun) -> Double

    Get run width in pixels.

    GlyphRun::glyph_count

    fn GlyphRun::glyph_count(self : GlyphRun) -> Int

    Get glyph count in this run.

    GlyphRun::to_repr

    KernPair

    type KernPair derive(Eq,
    Debug
    )

    Kerning pair

    KernPair::equal

    fn KernPair::equal(KernPair, KernPair) -> Bool

    KernPair::not_equal

    fn KernPair::not_equal(x : KernPair, y : KernPair) -> Bool

    KernPair::to_repr

    LayoutConfig

    pub struct LayoutConfig {
    max_width : Double
    font_size : Double
    line_height : Double
    alignment : TextAlign
    letter_spacing : Double
    word_spacing : Double
    } derive(
    Debug
    )

    Text layout configuration

    LayoutConfig::new

    fn LayoutConfig::new(max_width? : Double, font_size? : Double, line_height? : Double, alignment? : TextAlign, letter_spacing? : Double, word_spacing? : Double) -> LayoutConfig

    Create a layout config with default values

    LayoutLine

    type LayoutLine derive(
    Debug
    )

    A line of positioned glyphs

    LayoutMetrics

    pub struct LayoutMetrics {
    width : Double
    height : Double
    baseline : Double
    } derive(Eq,
    Debug
    )

    Layout metrics for text

    LayoutMetrics::equal

    LayoutMetrics::new

    fn LayoutMetrics::new(width~ : Double, height~ : Double, baseline~ : Double) -> LayoutMetrics

    Create layout metrics

    LayoutMetrics::not_equal

    fn LayoutMetrics::not_equal(x : LayoutMetrics, y : LayoutMetrics) -> Bool

    LayoutResult

    type LayoutResult derive(
    Debug
    )

    Layout result containing positioned glyphs

    LineBreakClass

    pub enum LineBreakClass {
    BK
    CR
    LF
    SP
    OP
    CL
    QU
    GL
    NS
    EX
    SY
    IS
    NU
    AL
    ID
    IN
    HY
    BA
    BB
    B2
    ZW
    CM
    WJ
    H2
    H3
    JL
    JT
    JV
    CP
    RI
    EB
    EModifier
    ZWJ
    AI
    Unknown
    } derive(Eq,
    Debug
    )

    Unicode Line Break classes (UAX #14)

    LineBreakClass::equal

    LineBreakClass::not_equal

    fn LineBreakClass::not_equal(x : LineBreakClass, y : LineBreakClass) -> Bool

    LineBreakClass::output

    fn LineBreakClass::output(self : LineBreakClass, logger : &Logger) -> Unit

    LineBreakClass::to_string

    fn LineBreakClass::to_string(self : LineBreakClass) -> String

    LineSegment

    type LineSegment derive(
    Debug
    )

    A line segment for rasterization

    LongHorMetric

    type LongHorMetric derive(Eq,
    Debug
    )

    Horizontal metrics

    LongHorMetric::equal

    LongHorMetric::not_equal

    fn LongHorMetric::not_equal(x : LongHorMetric, y : LongHorMetric) -> Bool

    MemoryFontLoader

    type MemoryFontLoader derive(
    Debug
    )

    In-memory font loader for tests, embedded assets, and caller-owned bytes.

    MemoryFontLoader::clear

    fn MemoryFontLoader::clear(self : MemoryFontLoader) -> Unit

    Drop all registered in-memory font entries.

    MemoryFontLoader::contains

    fn MemoryFontLoader::contains(self : MemoryFontLoader, key : String) -> Bool

    Return whether this loader has font data for a key.

    MemoryFontLoader::insert

    fn MemoryFontLoader::insert(self : MemoryFontLoader, key : String, data : FontData) -> FontData

    Register or replace font data for a key.

    MemoryFontLoader::is_empty

    fn MemoryFontLoader::is_empty(self : MemoryFontLoader) -> Bool

    Return whether this loader has no registered font entries.

    MemoryFontLoader::len

    fn MemoryFontLoader::len(self : MemoryFontLoader) -> Int

    Return the number of registered in-memory font entries.

    MemoryFontLoader::load_font_data

    fn MemoryFontLoader::load_font_data(self : MemoryFontLoader, key : String) -> Result[FontData, FontLoadError]

    MemoryFontLoader::new

    Create an empty in-memory font loader.

    MemoryFontLoader::remove

    fn MemoryFontLoader::remove(self : MemoryFontLoader, key : String) -> Unit

    Remove a registered in-memory font entry.

    PositionedGlyph

    type PositionedGlyph derive(
    Debug
    )

    A positioned glyph for rendering

    PositionedGlyph::get_advance_width

    fn PositionedGlyph::get_advance_width(self : PositionedGlyph) -> Double

    Get this positioned glyph's advance width in pixels.

    PositionedGlyph::get_glyph_id

    fn PositionedGlyph::get_glyph_id(self : PositionedGlyph) -> Int

    Get this positioned glyph's glyph id.

    PositionedGlyph::get_x

    fn PositionedGlyph::get_x(self : PositionedGlyph) -> Double

    Get this positioned glyph's x position in pixels.

    PositionedGlyph::get_y

    fn PositionedGlyph::get_y(self : PositionedGlyph) -> Double

    Get this positioned glyph's y position in pixels.

    Rasterizer

    type Rasterizer

    Rasterizer for rendering glyph outlines to pixels Implements scanline fill with anti-aliasing

    Rasterizer::clear

    fn Rasterizer::clear(self : Rasterizer) -> Unit

    Clear the buffer

    Rasterizer::draw_line

    fn Rasterizer::draw_line(self : Rasterizer, x0 : Double, y0 : Double, x1 : Double, y1 : Double) -> Unit

    Draw a line using Bresenham's algorithm (for outline rendering)

    Rasterizer::get_height

    fn Rasterizer::get_height(self : Rasterizer) -> Int

    Get the rasterizer height

    Rasterizer::get_pixels

    fn Rasterizer::get_pixels(self : Rasterizer) -> FixedArray[Byte]

    Get the pixel buffer (grayscale)

    Rasterizer::get_width

    fn Rasterizer::get_width(self : Rasterizer) -> Int

    Get the rasterizer width

    Rasterizer::new

    fn Rasterizer::new(width : Int, height : Int) -> Rasterizer

    Create a new rasterizer

    Rasterizer::rasterize_text_face

    fn Rasterizer::rasterize_text_face(self : Rasterizer, face : FontFace, text : String, x : Double, y : Double, config : LayoutConfig) -> Unit

    Rasterize laid-out text from a parsed font face into this rasterizer.

    Rasterizer::to_mask

    fn Rasterizer::to_mask(self : Rasterizer) -> CoverageMask

    Snapshot the current grayscale pixels as a coverage mask

    Script

    Text script (ISO 15924 code)

    Script::cjk

    fn Script::cjk() -> Script

    Script::cyrillic

    fn Script::cyrillic() -> Script

    Script::equal

    fn Script::equal(Script, Script) -> Bool

    Script::get_tag

    fn Script::get_tag(self : Script) -> String

    Get the ISO 15924 script tag.

    Script::latin

    fn Script::latin() -> Script

    Common scripts

    Script::not_equal

    fn Script::not_equal(x : Script, y : Script) -> Bool

    Script::to_repr

    ShapedText

    type ShapedText derive(
    Debug
    )

    Result of text shaping operation

    ShapedText::get_glyphs

    fn ShapedText::get_glyphs(self : ShapedText) -> Array[GlyphInfo]

    Get shaped glyph infos.

    ShapedText::get_positions

    fn ShapedText::get_positions(self : ShapedText) -> Array[GlyphPosition]

    Get shaped glyph positions.

    ShapedText::get_width

    fn ShapedText::get_width(self : ShapedText) -> Int

    Get the total width of the shaped text

    ShapedText::glyph_count

    fn ShapedText::glyph_count(self : ShapedText) -> Int

    Get the glyph count

    ShapingBuffer

    type ShapingBuffer derive(
    Debug
    )

    Shaping buffer for text layout

    ShapingBuffer::get_direction

    fn ShapingBuffer::get_direction(self : ShapingBuffer) -> TextDirection

    Get the shaping direction.

    ShapingBuffer::get_font_size

    fn ShapingBuffer::get_font_size(self : ShapingBuffer) -> Double

    Get the requested shaping font size.

    ShapingBuffer::get_script

    fn ShapingBuffer::get_script(self : ShapingBuffer) -> Script

    Get the shaping script.

    ShapingBuffer::get_text

    fn ShapingBuffer::get_text(self : ShapingBuffer) -> String

    Get the text being shaped.

    ShapingBuffer::new

    fn ShapingBuffer::new(text : String, direction? : TextDirection, script? : Script, font_size? : Double) -> ShapingBuffer

    Create a new shaping buffer

    ShapingBuffer::shape

    fn ShapingBuffer::shape(self : ShapingBuffer, _font : FontData) -> ShapedText

    Shape text into glyphs (simplified implementation) In a real implementation, this would use the font data to perform OpenType shaping

    SimpleGlyph

    type SimpleGlyph derive(
    Debug
    )

    Simple glyph data

    TableRecord

    type TableRecord derive(Eq,
    Debug
    )

    Table record in font file

    TableRecord::equal

    fn TableRecord::equal(TableRecord, TableRecord) -> Bool

    TableRecord::not_equal

    fn TableRecord::not_equal(x : TableRecord, y : TableRecord) -> Bool

    TextAlign

    pub(all) enum TextAlign {
    Left
    Center
    Right
    Justify
    } derive(Eq,
    Debug
    )

    Text alignment.

    TextAlign::equal

    fn TextAlign::equal(TextAlign, TextAlign) -> Bool

    TextAlign::not_equal

    fn TextAlign::not_equal(x : TextAlign, y : TextAlign) -> Bool

    TextCaret

    type TextCaret derive(Eq,
    Debug
    )

    Caret geometry in layout-local coordinates for one text insertion point.

    TextCaret::equal

    fn TextCaret::equal(TextCaret, TextCaret) -> Bool

    TextCaret::get_baseline_y

    fn TextCaret::get_baseline_y(self : TextCaret) -> Double

    Return the baseline y for the caret line.

    TextCaret::get_height

    fn TextCaret::get_height(self : TextCaret) -> Double

    Return caret rectangle height.

    TextCaret::get_index

    fn TextCaret::get_index(self : TextCaret) -> Int

    Return the clamped text insertion index.

    TextCaret::get_line

    fn TextCaret::get_line(self : TextCaret) -> Int

    Return the zero-based visual line containing this caret.

    TextCaret::get_x

    fn TextCaret::get_x(self : TextCaret) -> Double

    Return caret x in layout-local coordinates.

    TextCaret::get_y

    fn TextCaret::get_y(self : TextCaret) -> Double

    Return caret top y in layout-local coordinates.

    TextCaret::not_equal

    fn TextCaret::not_equal(x : TextCaret, y : TextCaret) -> Bool

    TextDirection

    pub enum TextDirection {
    LeftToRight
    RightToLeft
    } derive(Eq,
    Debug
    )

    Text direction

    TextDirection::equal

    TextDirection::left_to_right

    fn TextDirection::left_to_right() -> TextDirection

    Left-to-right text direction.

    TextDirection::not_equal

    fn TextDirection::not_equal(x : TextDirection, y : TextDirection) -> Bool

    TextDirection::right_to_left

    fn TextDirection::right_to_left() -> TextDirection

    Right-to-left text direction.

    TextLayout

    type TextLayout derive(
    Debug
    )

    Stable text layout facade used by higher-level renderers and GUI code.

    TextLayout::get_baseline

    fn TextLayout::get_baseline(self : TextLayout) -> Double

    Get the first baseline from the layout origin.

    TextLayout::get_height

    fn TextLayout::get_height(self : TextLayout) -> Double

    Get total layout height.

    TextLayout::get_metrics

    fn TextLayout::get_metrics(self : TextLayout) -> LayoutMetrics

    Get layout metrics.

    TextLayout::get_runs

    fn TextLayout::get_runs(self : TextLayout) -> Array[GlyphRun]

    Get glyph runs for this layout.

    TextLayout::get_width

    fn TextLayout::get_width(self : TextLayout) -> Double

    Get total layout width.

    TextLayout::layout

    fn TextLayout::layout(face : FontFace, text : String, config : LayoutConfig) -> TextLayout

    Layout text with a parsed font face.

    TextLayout::run_count

    fn TextLayout::run_count(self : TextLayout) -> Int

    Get the number of glyph runs.

    TextMaskCache

    type TextMaskCache derive(
    Debug
    )

    Small keyed cache for rendered text coverage masks.

    TextMaskCache::capacity

    fn TextMaskCache::capacity(self : TextMaskCache) -> Int

    Return the maximum number of cached text masks, or 0 for an unbounded cache.

    TextMaskCache::clear

    fn TextMaskCache::clear(self : TextMaskCache) -> Unit

    Drop all cached masks.

    TextMaskCache::contains

    fn TextMaskCache::contains(self : TextMaskCache, key : String) -> Bool

    Return whether the cache has a text mask for this key without refreshing LRU.

    TextMaskCache::get

    fn TextMaskCache::get(self : TextMaskCache, key : String) -> CoverageMask?

    Look up a rendered mask by caller-provided key.

    TextMaskCache::get_or_render_face

    fn TextMaskCache::get_or_render_face(self : TextMaskCache, key : String, face : FontFace, text : String, width : Int, height : Int, x : Double, y : Double, config : LayoutConfig) -> CoverageMask

    Render text from a checked face on first use and return the cached mask afterwards.

    TextMaskCache::get_or_render_face_result

    fn TextMaskCache::get_or_render_face_result(self : TextMaskCache, key : String, face : FontFace, text : String, width : Int, height : Int, x : Double, y : Double, config : LayoutConfig) -> TextMaskCacheRenderResult

    Render text from a checked face on first use and report whether cache missed.

    TextMaskCache::insert

    fn TextMaskCache::insert(self : TextMaskCache, key : String, mask : CoverageMask) -> CoverageMask

    Insert or replace a rendered mask under a caller-provided key.

    TextMaskCache::is_capacity_bounded

    fn TextMaskCache::is_capacity_bounded(self : TextMaskCache) -> Bool

    Return whether the cache has a configured entry limit.

    TextMaskCache::is_empty

    fn TextMaskCache::is_empty(self : TextMaskCache) -> Bool

    Return whether the cache currently has no masks.

    TextMaskCache::len

    fn TextMaskCache::len(self : TextMaskCache) -> Int

    Return the number of cached masks.

    TextMaskCache::new

    Create an empty text mask cache.

    TextMaskCache::remove

    fn TextMaskCache::remove(self : TextMaskCache, key : String) -> Unit

    Remove a cached mask by key.

    TextMaskCache::with_capacity

    fn TextMaskCache::with_capacity(capacity : Int) -> TextMaskCache

    Create an empty text mask cache with least-recently-used eviction.

    TextMaskCacheRenderResult

    type TextMaskCacheRenderResult derive(
    Debug
    )

    Result of reading a rendered text mask from cache or rendering it on miss.

    TextMaskCacheRenderResult::did_render

    Return whether this lookup rendered a new mask instead of hitting cache.

    TextMaskCacheRenderResult::get_mask

    Get the resulting text coverage mask.

    TextRunOutline

    pub(all) struct TextRunOutline {
    width : Double
    polygons : Array[Array[(Double, Double)]]
    } derive(
    Debug
    )

    Flattened outline of one laid-out text run, in user-space coordinates.

    TextSelectionRect

    type TextSelectionRect derive(Eq,
    Debug
    )

    Highlight geometry for one visual line of a text selection.

    TextSelectionRect::equal

    TextSelectionRect::get_baseline_y

    fn TextSelectionRect::get_baseline_y(self : TextSelectionRect) -> Double

    Return the baseline y for the selection rect line.

    TextSelectionRect::get_end_index

    fn TextSelectionRect::get_end_index(self : TextSelectionRect) -> Int

    Return the clamped source end index covered by this selection rect.

    TextSelectionRect::get_height

    fn TextSelectionRect::get_height(self : TextSelectionRect) -> Double

    Return selection rect height.

    TextSelectionRect::get_line

    fn TextSelectionRect::get_line(self : TextSelectionRect) -> Int

    Return the zero-based visual line containing this selection rect.

    TextSelectionRect::get_start_index

    fn TextSelectionRect::get_start_index(self : TextSelectionRect) -> Int

    Return the clamped source start index covered by this selection rect.

    TextSelectionRect::get_width

    fn TextSelectionRect::get_width(self : TextSelectionRect) -> Double

    Return selection rect width.

    TextSelectionRect::get_x

    fn TextSelectionRect::get_x(self : TextSelectionRect) -> Double

    Return selection rect x in layout-local coordinates.

    TextSelectionRect::get_y

    fn TextSelectionRect::get_y(self : TextSelectionRect) -> Double

    Return selection rect top y in layout-local coordinates.

    TextSelectionRect::not_equal

    fn TextSelectionRect::not_equal(x : TextSelectionRect, y : TextSelectionRect) -> Bool

    TextSystem

    type TextSystem derive(
    Debug
    )

    High-level text state for GUI/editor code: a keyed font registry plus layout and caret helpers built on the stable FontFace/TextLayout facades.

    TextSystem::caret_at_text_position

    fn TextSystem::caret_at_text_position(self : TextSystem, key : String, text : String, x : Double, y : Double, config : LayoutConfig) -> Result[TextCaret, FontLoadError]

    Compute caret geometry for the nearest insertion point at a layout-local position using a registered font.

    TextSystem::caret_for_text

    fn TextSystem::caret_for_text(self : TextSystem, key : String, text : String, index : Int, config : LayoutConfig) -> Result[TextCaret, FontLoadError]

    Compute caret geometry for a text insertion index using a registered font.

    TextSystem::clear_font_face_cache

    fn TextSystem::clear_font_face_cache(self : TextSystem) -> Unit

    Clear parsed face cache entries while preserving registered font data.

    TextSystem::clear_fonts

    fn TextSystem::clear_fonts(self : TextSystem) -> Unit

    Drop registered font data and parsed face cache entries.

    TextSystem::contains_cached_font_face

    fn TextSystem::contains_cached_font_face(self : TextSystem, key : String) -> Bool

    Return whether a parsed face is cached for a registered font key.

    TextSystem::contains_font

    fn TextSystem::contains_font(self : TextSystem, key : String) -> Bool

    Return whether font data has been registered for a key.

    TextSystem::font_count

    fn TextSystem::font_count(self : TextSystem) -> Int

    Return the number of registered font-data entries.

    TextSystem::font_face_cache_capacity

    fn TextSystem::font_face_cache_capacity(self : TextSystem) -> Int

    Return the parsed face cache capacity, or 0 for unbounded caches.

    TextSystem::font_face_cache_len

    fn TextSystem::font_face_cache_len(self : TextSystem) -> Int

    Return the number of parsed font faces currently cached.

    TextSystem::get_font_data

    fn TextSystem::get_font_data(self : TextSystem, key : String) -> Result[FontData, FontLoadError]

    Return registered font data for a key.

    TextSystem::get_font_face

    fn TextSystem::get_font_face(self : TextSystem, key : String) -> Result[FontFace, FontLoadError]

    Return a checked face for a registered font key.

    TextSystem::get_font_face_result

    fn TextSystem::get_font_face_result(self : TextSystem, key : String) -> Result[FontFaceCacheParseResult, FontLoadError]

    Return a checked face for a registered font key with cache telemetry.

    TextSystem::get_font_key

    fn TextSystem::get_font_key(self : TextSystem, index : Int) -> String?

    Return a registered font key by registration-order index.

    TextSystem::get_font_keys

    fn TextSystem::get_font_keys(self : TextSystem) -> Array[String]

    Return registered font keys in registration order.

    TextSystem::is_font_face_cache_capacity_bounded

    fn TextSystem::is_font_face_cache_capacity_bounded(self : TextSystem) -> Bool

    Return whether the parsed face cache has an entry capacity.

    TextSystem::layout_text

    fn TextSystem::layout_text(self : TextSystem, key : String, text : String, config : LayoutConfig) -> Result[TextLayout, FontLoadError]

    Layout text using a registered font key.

    TextSystem::load_font_data

    fn TextSystem::load_font_data(self : TextSystem, key : String) -> Result[FontData, FontLoadError]

    TextSystem::new

    fn TextSystem::new() -> TextSystem

    Create an empty text system with an unbounded parsed-face cache.

    TextSystem::prepare_layout

    fn TextSystem::prepare_layout(self : TextSystem, key : String, text : String, config : LayoutConfig) -> Result[TextSystemLayout, FontLoadError]

    Prepare a reusable layout snapshot for caret, hit-test, and selection geometry queries.

    TextSystem::register_font_bytes

    fn TextSystem::register_font_bytes(self : TextSystem, key : String, data : Bytes, font_index? : Int) -> Result[FontFace, FontParseError]

    Register checked font bytes under a caller-provided key.

    TextSystem::register_font_bytes_result

    fn TextSystem::register_font_bytes_result(self : TextSystem, key : String, data : Bytes, font_index? : Int) -> Result[TextSystemFontRegistration, FontParseError]

    Register checked font bytes and return registration telemetry.

    TextSystem::register_font_data

    fn TextSystem::register_font_data(self : TextSystem, key : String, font_data : FontData) -> Result[FontFace, FontParseError]

    Register checked font data under a caller-provided key.

    TextSystem::register_font_data_result

    fn TextSystem::register_font_data_result(self : TextSystem, key : String, font_data : FontData) -> Result[TextSystemFontRegistration, FontParseError]

    Register checked font data and return registration telemetry.

    TextSystem::register_font_file

    fn TextSystem::register_font_file(self : TextSystem, key : String, path : String, font_index? : Int) -> Result[FontFace, FontLoadError]

    Read checked font bytes from a file and register them under a caller-provided key, caching the loaded data in this TextSystem.

    TextSystem::register_font_file_result

    fn TextSystem::register_font_file_result(self : TextSystem, key : String, path : String, font_index? : Int) -> Result[TextSystemFontRegistration, FontLoadError]

    Read checked font bytes from a file, register them as in-memory font data, and return registration telemetry.

    TextSystem::remove_font

    fn TextSystem::remove_font(self : TextSystem, key : String) -> Bool

    Drop one registered font-data entry and any parsed face cached for the key.

    Returns whether font data was registered before removal.

    TextSystem::selection_rects_for_text

    fn TextSystem::selection_rects_for_text(self : TextSystem, key : String, text : String, start_index : Int, end_index : Int, config : LayoutConfig) -> Result[Array[TextSelectionRect], FontLoadError]

    Compute one highlight rectangle per visual line for a text selection range.

    TextSystem::with_font_cache_capacity

    fn TextSystem::with_font_cache_capacity(capacity : Int) -> TextSystem

    Create an empty text system with an LRU parsed-face cache capacity.

    TextSystemFontRegistration

    type TextSystemFontRegistration derive(
    Debug
    )

    Result of registering checked font data in a TextSystem.

    TextSystemFontRegistration::did_replace

    Return whether registration replaced existing font data for the key.

    TextSystemFontRegistration::did_replace_cached_face

    fn TextSystemFontRegistration::did_replace_cached_face(self : TextSystemFontRegistration) -> Bool

    Return whether registration replaced an already-cached parsed face.

    TextSystemFontRegistration::get_face

    Return the checked face that was registered.

    TextSystemFontRegistration::get_font_count

    fn TextSystemFontRegistration::get_font_count(self : TextSystemFontRegistration) -> Int

    Return the registered font-data entry count after this registration.

    TextSystemFontRegistration::get_font_data

    Return the checked font data that was registered.

    TextSystemFontRegistration::get_key

    Return the font registry key that was registered.

    TextSystemLayout

    type TextSystemLayout derive(
    Debug
    )

    Prepared text layout for GUI/editor code that needs several geometry queries from the same registered font, text, and layout config.

    TextSystemLayout::caret_at_position

    fn TextSystemLayout::caret_at_position(self : TextSystemLayout, x : Double, y : Double) -> TextCaret

    Compute nearest caret geometry at a layout-local position from this prepared layout.

    TextSystemLayout::caret_for_index

    fn TextSystemLayout::caret_for_index(self : TextSystemLayout, index : Int) -> TextCaret

    Compute caret geometry for a text insertion index from this prepared layout.

    TextSystemLayout::get_config

    Return the layout configuration used by this prepared layout.

    TextSystemLayout::get_face

    Return the checked font face captured by this prepared layout.

    TextSystemLayout::get_key

    fn TextSystemLayout::get_key(self : TextSystemLayout) -> String

    Return the registered font key used by this prepared layout.

    TextSystemLayout::get_layout

    fn TextSystemLayout::get_layout(self : TextSystemLayout) -> TextLayout

    Return the computed text layout.

    TextSystemLayout::get_text

    fn TextSystemLayout::get_text(self : TextSystemLayout) -> String

    Return the source text used by this prepared layout.

    TextSystemLayout::selection_rects

    fn TextSystemLayout::selection_rects(self : TextSystemLayout, start_index : Int, end_index : Int) -> Array[TextSelectionRect]

    Compute selection highlight rectangles from this prepared layout.

    file_exists

    fn file_exists(path : String) -> Bool

    Check if a file exists

    get_line_break_class

    fn get_line_break_class(ch : Int) -> LineBreakClass

    Get line break class for a character

    grayscale_to_rgba

    fn grayscale_to_rgba(pixels : FixedArray[Byte], width : Int, height : Int) -> FixedArray[Byte]

    Convert grayscale pixels to RGBA for display

    is_line_break_allowed

    fn is_line_break_allowed(prev_class : LineBreakClass, curr_class : LineBreakClass) -> Bool

    Check if a line break is allowed between two line break classes

    layout_text_face

    fn layout_text_face(face : FontFace, text : String, config : LayoutConfig) -> TextLayout

    Layout text with a parsed font face.

    load_font_data

    fn[L : FontLoader] load_font_data(loader : L, key : String) -> Result[FontData, FontLoadError]

    Load font data from a generic loader.

    load_font_face

    fn[L : FontLoader] load_font_face(loader : L, key : String) -> Result[FontFace, FontLoadError]

    Load and parse a checked font face from a generic loader.

    plan_font_fallback

    fn plan_font_fallback(faces : Array[FontFace], text : String) -> FontFallbackPlan

    Segment text by the first provided face that covers each Unicode scalar.

    read_file

    fn read_file(path : String) -> Bytes raise
    IOError

    Read a file into Bytes

    render_text_mask_face

    fn render_text_mask_face(face : FontFace, text : String, width : Int, height : Int, x : Double, y : Double, config : LayoutConfig) -> CoverageMask

    Render text from a parsed font face into a grayscale coverage mask.

    select_font_face_index_for_char

    fn select_font_face_index_for_char(faces : Array[FontFace], char_code : Int) -> Int

    Select the first face that maps a Unicode codepoint to a drawable glyph.

    write_file

    fn write_file(path : String, data : Bytes) -> Unit raise
    IOError

    Write bytes to a file