Share size-independent XDV Type 1 font dictionaries
This commit is contained in:
1 parent
01c6f1d4bd
commit
e72104eab3
4 files changed
+147
-11
No files matched your search
@@ -29,6 +29,7 @@ impl NativeText {
|
||||
x: i64,
|
||||
y: i64,
|
||||
font: &NativeFont,
|
||||
resource: FontId,
|
||||
paint: &crate::native_font::NativeFontPaint,
|
||||
slot: u8,
|
||||
height: i64,
|
||||
@@ -66,10 +67,10 @@ impl NativeText {
|
||||
}
|
||||
if space == Some(SpaceUse::Dedicated) {
|
||||
let dedicated = dedicated.expect("resolved PDF space font");
|
||||
state.select_font(out, &dedicated.font);
|
||||
state.select_font(out, &dedicated.font, dedicated.font.id);
|
||||
out.push_str("( ) Tj\n");
|
||||
}
|
||||
state.select_font(out, font);
|
||||
state.select_font(out, font, resource);
|
||||
let expansion_changed = state.expansion != font.expansion;
|
||||
if state.xdv && expansion_changed {
|
||||
state.close_string(out);
|
||||
@@ -139,7 +140,7 @@ impl NativeText {
|
||||
state.delta_h += state.char_advance(font, paint, slot, state.effective_size);
|
||||
}
|
||||
|
||||
fn select_font(&mut self, out: &mut PageContent, font: &NativeFont) {
|
||||
fn select_font(&mut self, out: &mut PageContent, font: &NativeFont, resource: FontId) {
|
||||
if self.font != Some(font.id) {
|
||||
self.close_string(out);
|
||||
let (number, size) = divide_scaled(font.size_sp(), 6_578_176, 6);
|
||||
@@ -148,7 +149,7 @@ impl NativeText {
|
||||
if !out.measuring {
|
||||
out.push_str(&format!(
|
||||
"/N{} {} Tf\n",
|
||||
font.id.index(),
|
||||
resource.index(),
|
||||
print_decimal(number, 4)
|
||||
));
|
||||
}
|
||||
@@ -239,6 +240,7 @@ impl NativeText {
|
||||
x,
|
||||
y,
|
||||
&dedicated.font,
|
||||
dedicated.font.id,
|
||||
&dedicated.paint,
|
||||
b' ',
|
||||
height,
|
||||
@@ -425,6 +427,7 @@ pub(crate) fn plan_spaces(
|
||||
*x,
|
||||
*y,
|
||||
font,
|
||||
font.id,
|
||||
paint,
|
||||
*slot,
|
||||
page.height,
|
||||
|
||||
Reference in new issue
Block a user