pub struct StyleProperties {Show 21 fields
pub font_stack: FontStack,
pub font_size_px: f32,
pub color: ColorU,
pub background_color: Option<ColorU>,
pub background_content: Vec<StyleBackgroundContent>,
pub border: Option<InlineBorderInfo>,
pub letter_spacing: Spacing,
pub word_spacing: Spacing,
pub line_height: f32,
pub text_decoration: TextDecoration,
pub font_features: Vec<String>,
pub font_variations: Vec<(FourCc, f32)>,
pub tab_size: f32,
pub text_transform: TextTransform,
pub writing_mode: WritingMode,
pub text_orientation: TextOrientation,
pub text_combine_upright: Option<TextCombineUpright>,
pub font_variant_caps: FontVariantCaps,
pub font_variant_numeric: FontVariantNumeric,
pub font_variant_ligatures: FontVariantLigatures,
pub font_variant_east_asian: FontVariantEastAsian,
}Expand description
Style properties with vertical text support
Fields§
§font_stack: FontStackFont stack for fallback support (priority order) Can be either a list of FontSelectors (resolved via fontconfig) or a direct FontRef (bypasses fontconfig entirely).
font_size_px: f32§color: ColorU§background_color: Option<ColorU>Background color for inline elements (e.g., <span style="background-color: yellow">)
This is propagated from CSS through the style system and eventually used by
the PDF renderer to draw filled rectangles behind text. The value is None
for transparent backgrounds (the default).
The propagation chain is:
CSS -> get_style_properties() -> StyleProperties -> ShapedGlyph -> PdfGlyphRun
See PdfGlyphRun::background_color for how this is used in PDF rendering.
background_content: Vec<StyleBackgroundContent>Full background content layers (for gradients, images, etc.) This extends background_color to support CSS gradients on inline elements.
border: Option<InlineBorderInfo>Border information for inline elements
letter_spacing: Spacing§word_spacing: Spacing§line_height: f32§text_decoration: TextDecoration§font_features: Vec<String>§font_variations: Vec<(FourCc, f32)>§tab_size: f32§text_transform: TextTransform§writing_mode: WritingMode§text_orientation: TextOrientation§text_combine_upright: Option<TextCombineUpright>§font_variant_caps: FontVariantCaps§font_variant_numeric: FontVariantNumeric§font_variant_ligatures: FontVariantLigatures§font_variant_east_asian: FontVariantEastAsianImplementations§
Source§impl StyleProperties
impl StyleProperties
Sourcepub fn layout_hash(&self) -> u64
pub fn layout_hash(&self) -> u64
Returns a hash that only includes properties that affect text layout.
Properties that DON’T affect layout (only rendering):
- color, background_color, background_content
- text_decoration (underline, etc.)
- border (for inline elements)
Properties that DO affect layout:
- font_stack, font_size_px, font_features, font_variations
- letter_spacing, word_spacing, line_height, tab_size
- writing_mode, text_orientation, text_combine_upright
- text_transform
- font_variant_* (affects glyph selection)
This allows the layout cache to reuse layouts when only rendering properties change (e.g., color changes on hover).
Trait Implementations§
Source§impl Clone for StyleProperties
impl Clone for StyleProperties
Source§fn clone(&self) -> StyleProperties
fn clone(&self) -> StyleProperties
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StyleProperties
impl Debug for StyleProperties
Source§impl Default for StyleProperties
impl Default for StyleProperties
Source§impl Hash for StyleProperties
impl Hash for StyleProperties
Source§impl PartialEq for StyleProperties
impl PartialEq for StyleProperties
impl StructuralPartialEq for StyleProperties
Auto Trait Implementations§
impl Freeze for StyleProperties
impl RefUnwindSafe for StyleProperties
impl Send for StyleProperties
impl Sync for StyleProperties
impl Unpin for StyleProperties
impl UnwindSafe for StyleProperties
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more