Module: graphics.font.text

Source: ./graphics/font/text.reef


Overview

graphics/font/text.reef - Text layout Part of reef-stdlib graphics module

This module provides text layout functionality for positioning glyphs and handling text wrapping, alignment, and hit testing.


Types

PositionedGlyph

Fields:

Name Type
glyph_idx int
x float
y float
advance_x float
char_idx int

TextLayout

Fields:

Name Type
source_text string
glyphs [PositionedGlyph]
width float
height float
num_lines int
line_height float

Functions

fn layout_text_bitmap(text: string, f: bitmap.BitmapFont, size: float): TextLayout

Layout text on a single line using a BitmapFont

fn layout_text_wrapped_bitmap(text: string, f: bitmap.BitmapFont, size: float, max_width: float): TextLayout

Layout text with word wrapping using a BitmapFont

fn text_bounds(layout: TextLayout): core.Rect

fn hit_test(layout: TextLayout, x: float, y: float): int

Hit test: find character index at position (x, y) Returns -1 if outside layout bounds

fn layout_text_ttf(text: string, f: ttf.TTFFont, size: float): TextLayout

Layout text on a single line using a TTFFont

fn layout_text_wrapped_ttf(text: string, f: ttf.TTFFont, size: float, max_width: float): TextLayout

Layout text with word wrapping using a TTFFont


Generated by reefc doc