Skip to main content

Crate oxframe_text

Crate oxframe_text 

Source
Expand description

Text for oxframe: layout with parley, glyph outlines with skrifa.

Status: oxframe is under very active development. The API is not stable yet and may change from version to version. Pin the exact version in your Cargo.toml and check the changelog before upgrading.

Text becomes a BezPath, so it renders identically on every backend and can be morphed and trimmed like any other path.

Determinism: only embedded fonts are used — Inter and JetBrains Mono (SIL OFL 1.1, see fonts/) plus fonts registered with register_font. System fonts are never consulted.

Structs§

CodeDiff
Edit script from one source to another.
EditError
Why a source edit could not be applied.
GlyphInfo
Where a glyph came from.
Loc
A place in a source. Lines are 1-based, columns are 0-based characters.
Piece
One highlight token, split at whitespace so a renamed word does not take the spaces around it with it. The color is still the highlighter’s.
TextLayout
Laid-out text. Coordinates: origin at the top-left of the layout box, y pointing down.
TextSpan
A run of text with its own style; unset fields inherit the base style.
TextStyle
How text is laid out.

Enums§

Align
Horizontal alignment of lines.
Lang
Language for syntax highlighting.
LineEdit
What happened to one line. Indexes are 0-based.
PieceEdit
What happened to one piece.
Token
Kind of a highlighted piece of code.

Constants§

MONO
Built-in monospace family (JetBrains Mono).
SANS
Built-in sans-serif family (Inter).

Functions§

code_lines
Lines of src, without their newlines. A trailing newline does not add an empty line; a blank line in the middle does.
diff_code
Diff from into to. Highlight tokens come from lang.
highlight
Splits code into highlighted ranges covering all of it.
insert_at
Inserts text at line (1-based) and col (0-based characters).
layout
Lays out text (cached by text and style).
layout_rich
Lays out styled spans as one paragraph (cached).
line_pieces
Highlight pieces of one line, split at whitespace.
map_focus
Where the focused old lines land. (0, 0) stays “everything”. None when every focused line was deleted.
register_font
Registers a font (TTF/OTF/TTC bytes, e.g. from include_bytes!). Returns the family names it provides.
remove_range
Removes the half-open range start..end.
replace_range
Replaces the half-open range start..end with text.