Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LayoutLine ¶
LayoutLine represents a single computed line of text within a bounding box.
type LayoutResult ¶
type LayoutResult struct {
Height int
LineCount int
Lines []LayoutLine
}
func Layout ¶
func Layout(prepared *PreparedText, maxWidth int, lineHeight int) *LayoutResult
Layout performs pure arithmetic line-breaking using the cached segment widths. This is incredibly fast (O(N) arithmetic) and skips the GUI engine entirely.
type PreparedText ¶
type PreparedText struct {
Segments []Segment
Font fltk_bridge.Font
FontSize int
}
PreparedText represents a string that has been split and measured, allowing for extremely fast layout calculations without re-measuring. Inspired by pretext (https://github.com/chenglou/pretext).
func Prepare ¶
func Prepare(text string, font fltk_bridge.Font, fontSize int) *PreparedText
Prepare normalizes and breaks text into measurable segments (words, spaces, breaks), then measures each segment using FLTK's native font engine. This is the "expensive" step that should be cached.
type Segment ¶
type Segment struct {
Text string
Width int
Type SegmentType
}
Segment holds cached measurement data for a piece of text.
type SegmentType ¶
type SegmentType int
SegmentType identifies the type of a text segment.
const ( WordSegment SegmentType = iota SpaceSegment BreakSegment )