Allocate native automatic font expansion instances
This commit is contained in:
1 parent
2d036b807e
commit
9b80a782cf
11 files changed
+288
-107
No files matched your search
@@ -127,7 +127,14 @@ impl NativeText {
|
||||
let advance = match &paint.program {
|
||||
crate::native_font::NativeFontProgram::Pk(pk) => pk.advances[&slot],
|
||||
crate::native_font::NativeFontProgram::Type1(_) => {
|
||||
divide_scaled(font.metrics().width(char::from(slot)), size, 4).1
|
||||
let width = if font.layout_metrics.is_some() {
|
||||
let width = font.advance(slot);
|
||||
let factor = i64::from(1000 + font.expansion);
|
||||
width.signum() * ((1000 * width.abs() + factor / 2) / factor)
|
||||
} else {
|
||||
font.metrics().width(char::from(slot))
|
||||
};
|
||||
divide_scaled(width, size, 4).1
|
||||
}
|
||||
};
|
||||
if font.expansion == 0 {
|
||||
|
||||
Reference in new issue
Block a user