Skip to main content

layout_to_ops

Function layout_to_ops 

Source
pub fn layout_to_ops<T: ParsedFontTrait + 'static>(
    layout: &UnifiedLayout,
    page_height: Pt,
    font_id: &FontId,
    loaded_fonts: &LoadedFonts<T>,
    default_color: Color,
) -> Vec<Op>
Expand description

Convert a UnifiedLayout to PDF operations.

This is the main function for converting azul’s layout output to printpdf operations. It handles:

  • Coordinate transformation from layout space (top-left origin) to PDF space (bottom-left origin)
  • Font selection via SetFont operations
  • Glyph positioning via SetTextMatrix
  • Color handling via SetFillColor

§Arguments

  • layout - The unified layout from azul’s text3 engine
  • page_height - The page height in points (for Y-coordinate flipping)
  • font_id - The font ID to use in PDF operations
  • loaded_fonts - Pre-loaded fonts for glyph lookup
  • default_color - Default text color if not specified per-glyph

§Returns

A vector of PDF operations that render the text