Use physical Type 1 glyph widths in XeTeX PDF output

This commit is contained in:
gloamxun committed 2026-11-28 06:23:12 +08:00
1 parent 885911485e
commit b22e127e93
11 files changed
+210 -33

No files matched your search

+8
View File
@@ -407,6 +407,14 @@ impl TfmMetrics {
self.scale_horizontal(width)
}
/// Width used when reading a legacy TFM glyph on the XDV device. The
/// driver rounds the exact fixword product to a scaled point.
pub(crate) fn xdv_width(&self, slot: u8) -> i64 {
let Some(info) = self.char_info(char::from(slot)) else { return 0 };
let product = i64::from(self.widths[usize::from(info.width_index)]) * self.size;
product.signum() * ((product.abs() + (1 << 19)) >> 20)
}
pub(crate) fn expand_horizontal(&mut self, amount: i32) -> Result<(), String> {
let apply = |value| {
let scaled = crate::pdf_device::magnify(self.scale_horizontal(value), 1000 + amount);