Skip to main content

show_string

Function show_string 

Source
pub fn show_string(
    text_state: &mut TextState,
    string_bytes: &[u8],
    get_width: &dyn Fn(u32) -> f64,
) -> Vec<RawChar>
Expand description

Tj operator: show a string.

Each byte in string_bytes is treated as a single character code. For each byte:

  1. Snapshot the current text matrix as the character’s render position
  2. Look up the glyph width via get_width(char_code) (in glyph space, 1/1000 units)
  3. Calculate text-space displacement and advance the text position

Returns a Vec<RawChar> with one entry per byte.