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 at size_pt, given the face’s units-per-em. Values are carried as i32 because shapers use signed advances, but current embedded output normalizes to PDF-emittable hmtx advances in 0..=65535. Preserve sign here anyway 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);