Skip to main content

advance_units_to_pt

Function advance_units_to_pt 

Source
pub fn advance_units_to_pt(advance_units: i32, size_pt: f32, upem: f32) -> f32
Expand description

Convert a font-unit advance to PDF user-space points.

Values are carried as i32 because shapers use signed advances. Preserve sign here so future positioned shaping cannot turn a negative adjustment into a huge positive width.

ยงExamples

use mos_fonts::advance_units_to_pt;

assert_eq!(advance_units_to_pt(500, 12.0, 1000.0), 6.0);
assert_eq!(advance_units_to_pt(-500, 12.0, 1000.0), -6.0);