How to get units_per_em of a font #83
Answered
by
wezm
floppyhammer
asked this question in
Q&A
-
I'm trying to convert GlyphPosition::hori_advance to something in pixels. I suppose I can get what I want by doing hori_advance * font_size / units_per_em But I'm struck at getting |
Beta Was this translation helpful? Give feedback.
Answered by
wezm
Jan 8, 2023
Replies: 1 comment 1 reply
-
let head = font.head_table()
.expect("unable to parse head table")
.expect("font lacks a head table");
println!("units per em: {}", head.units_per_em); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
floppyhammer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
units_per_em
is in thehead
table. If you have a Font you can do something like this: