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 glyph_index(g: PositionedGlyph): int
fn glyph_x(g: PositionedGlyph): float
fn glyph_y(g: PositionedGlyph): float
fn glyph_advance(g: PositionedGlyph): float
fn glyph_char_index(g: PositionedGlyph): int
fn text_layout_text(layout: TextLayout): string
fn text_layout_glyphs(layout: TextLayout): [PositionedGlyph]
fn text_layout_width(layout: TextLayout): float
fn text_layout_height(layout: TextLayout): float
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 line_count(layout: TextLayout): int
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 char_to_int(c: char): int
Convert char to codepoint (ASCII)
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