Skip to main content

font_ref_from_bytes

Function font_ref_from_bytes 

Source
pub fn font_ref_from_bytes(
    font_bytes: &[u8],
    font_index: usize,
    parse_outlines: bool,
) -> Option<FontRef>
Expand description

Creates a FontRef from font bytes by parsing them into a ParsedFont.

This is a bridge function that:

  1. Parses the bytes into a ParsedFont
  2. Wraps it in a FontRef with proper reference counting

ยงArguments

  • font_bytes - The raw font file data
  • font_index - Index of the font in a font collection (0 for single fonts)
  • parse_outlines - Whether to parse glyph outlines (expensive, usually false for layout)