Skip to main content

Module software_text_raster

Module software_text_raster 

Source
Expand description

CPU text rasterization: fonts, glyph layout and glyph masks.

Structs§

FontFamilyKey
Identity an app-supplied face was registered under.
SoftwareGlyphAtlasGlyph
A glyph with its mask, where to draw it and in which color.
SoftwareGlyphAtlasKey
Identifies one rasterized glyph in a glyph atlas: the font, the glyph, and the scale and the synthetic styling it was drawn with.
SoftwareGlyphAtlasMask
The coverage mask of one rasterized glyph.
SoftwareGlyphAtlasPlacement
Where to draw a glyph whose mask the atlas already holds.
SoftwareGlyphRasterCache
A cache of rasterized glyph masks and kerning pairs, kept across frames.
SoftwareGlyphRasterCacheStats
Counters of a SoftwareGlyphRasterCache.
SoftwareTextFont
A parsed face that measures and rasterizes text on the CPU, with its family names, weight and style.
SoftwareTextFontSet
The faces that text resolves against, with the choice of the default face.
SoftwareTextMeasurer
A TextMeasurer that measures text with a SoftwareTextFontSet and caches the results.
StyledTextRef
The slice of a text payload that solid-run rasterization reads: content plus span styles. Borrowable from both an AnnotatedString (UI-side text) and a RenderString (a lowered scene’s link-handler-free view), so the run collectors serve both without copying either.

Enums§

FontBytes
The bytes a face is parsed from.
SoftwareGlyphAtlasRunGlyph
One glyph of a text run for a renderer that draws from a glyph atlas.
SoftwareTextFontError
Why a font could not be built for software text.

Functions§

collect_cached_solid_text_atlas_placements
Appends to out the atlas placements of the glyphs of text, without rasterizing anything. Returns None when a glyph has no cached mask or the style cannot be drawn as solid atlas glyphs. Arguments are as for rasterize_text_to_image.
collect_solid_text_atlas_glyphs
Appends to out every glyph of text that puts pixels down, with its mask, for a renderer that draws solid text from a glyph atlas. Returns None when the style cannot be drawn as solid atlas glyphs. Arguments are as for rasterize_text_to_image.
collect_solid_text_atlas_run
Appends the glyphs of text that put pixels down to out: each either placed from the mask cache or rasterized into it.
cursor_x_for_offset_with_font
Returns the x position in logical pixels of the caret at byte offset of text. An offset past the end counts as the end, and one inside a character moves back to its start.
default_software_text_font
The embedded default font, or None when the build has none or it cannot be parsed.
layout_text_with_font
Lays out text with font in style and returns the per-character positions and line boxes as a TextLayoutResult.
measure_annotated_text_with_font
Measures annotated text, including its span styles, drawn with font in style at font_size logical pixels.
measure_annotated_text_with_font_set
Measures annotated text with the faces of fonts, choosing a face for each span and falling back to other faces for characters that the first face lacks.
measure_text_with_font
Measures text drawn with font in style at font_size logical pixels.
rasterize_annotated_text_region
Rasterizes an annotated paragraph into rect, preserving its original text_origin when the image covers only a clipped portion of the paragraph. Glyphs from every span share line baselines and may extend across line boxes.
rasterize_annotated_text_to_image_with_glyph_cache
Rasterizes annotated text with fonts into an RGBA image that covers rect, reusing glyph masks from glyph_cache. Arguments are as for rasterize_text_to_image.
rasterize_text_to_image
Rasterizes text with font into an RGBA image that covers rect, in logical pixels, at scale device pixels per logical pixel. fallback_color paints text whose style names no color, and font_size is in logical pixels. Returns None when there is nothing to draw.
rasterize_text_to_image_with_font
Rasterize a raw font at its ab_glyph pixel scale with explicit style spacing. Use rasterize_text_to_image for registered font sizing and automatic tracking.
rasterize_text_to_image_with_glyph_cache
Like rasterize_text_to_image, and reuses glyph masks from glyph_cache.
software_text_font_from_fonts_or_default
Returns the default face of the font set that fonts yields, or None when that set is empty.
software_text_font_set_from_fonts_or_default
Builds the font set for fonts. See SoftwareTextFontSet::from_fonts_or_default.
text_offset_for_position_with_font
Returns the byte offset in text of the caret position nearest to the point (x, y), in logical pixels in the text’s own coordinates.
try_default_software_text_font
Parses the embedded default font, or fails with EmbeddedFontDisabled in a build without the embedded-default-font feature.