pub struct TextRasterRequest {Show 14 fields
pub text: String,
pub font_size: f32,
pub max_width: f32,
pub line_height: f32,
pub align: TextAlign,
pub fill: TextFill,
pub emoji_policy: EmojiPolicy,
pub content_version: u64,
pub strokes: Vec<TextStroke>,
pub background: Option<TextBackground>,
pub split_background: bool,
pub font_family: Option<String>,
pub letter_spacing: f32,
pub font_weight: u16,
}Expand description
One text layout request.
Fields§
§text: StringUTF-8 text shaped by the selected font fallback stack.
font_size: f32Logical font size in pixels.
max_width: f32Maximum layout width. Non-positive values disable wrapping.
line_height: f32Baseline-to-baseline distance in font sizes. The em box (0.8 above the baseline, 0.2 below) is centered in lines taller than an em.
align: TextAlignPer-line horizontal alignment.
fill: TextFillGlyph paint. Color glyphs keep their own colors except for text-color parts, which use
TextFill::foreground, whose alpha is also their opacity.
emoji_policy: EmojiPolicyWhether color glyphs are drawn in color, and which fonts emoji take.
content_version: u64Caller-managed version. Change it whenever content/style/font inputs change.
strokes: Vec<TextStroke>Outlines, innermost first, each drawn behind the previous. At most 4, reaching at most 64 pixels together.
background: Option<TextBackground>A box behind each line, drawn behind the strokes.
split_background: boolDraws the background into TextRasterResult::background instead of under the glyphs,
so a caller can draw something (a shadow) between them.
font_family: Option<String>Preferred family, matched against any font_family_names entry after NFC and
lowercasing; the fallback stack fills missing glyphs. An unknown family keeps the fallback
order and is listed by TextRasterizer::unmatched_families.
letter_spacing: f32Space after each grapheme cluster, like CSS letter-spacing, in [-0.5, 1] font sizes.
Not applied after a line’s last cluster or within cursive scripts. Non-zero values disable
optional ligatures.
font_weight: u16Weight in [1, 1000], matched per CSS Fonts 4 and applied to a variable face’s wght
axis. Faces are never synthetically emboldened.
Implementations§
Source§impl TextRasterRequest
impl TextRasterRequest
Sourcepub fn decoration_margin(&self) -> u32
pub fn decoration_margin(&self) -> u32
Whole pixels the strokes or background reach past the layout box. The texture margin
(TextTexture::layout_x) adds room for ink overflow to this.