Separate format font metrics from live expansion links
This commit is contained in:
1 parent
9b80a782cf
commit
b008c0693a
11 files changed
+379
-74
No files matched your search
@@ -4,6 +4,7 @@ use crate::{HorizontalBox, HorizontalItem, Paragraph, ParagraphFont};
|
|||||||
mod tail;
|
mod tail;
|
||||||
pub(super) use tail::TailNodeRef;
|
pub(super) use tail::TailNodeRef;
|
||||||
mod leaders;
|
mod leaders;
|
||||||
|
mod legacy_fonts;
|
||||||
pub use leaders::{LeaderGlue, LeaderMode, LeaderPattern};
|
pub use leaders::{LeaderGlue, LeaderMode, LeaderPattern};
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
//! Format schema 53 stored device faces in boxes. Rebind them to the original
|
||||||
|
//! logical font slots before a restored job changes any active expansion links.
|
||||||
|
use super::*;
|
||||||
|
use crate::{math_engine_tex::MathItem, native_font::NativeFont};
|
||||||
|
use std::{collections::BTreeMap, sync::Arc};
|
||||||
|
|
||||||
|
type Replacements = BTreeMap<(FontId, i32), Arc<NativeFont>>;
|
||||||
|
|
||||||
|
impl NativeBox {
|
||||||
|
pub(in crate::execution) fn rebind_legacy_expansion_fonts(&mut self, fonts: &Replacements) {
|
||||||
|
match &mut self.content {
|
||||||
|
BoxContent::Horizontal(nodes) => rebind_horizontal(nodes, fonts),
|
||||||
|
BoxContent::Vertical(nodes) => rebind_vertical(nodes, fonts),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rebind_horizontal(nodes: &mut [TextNode], fonts: &Replacements) {
|
||||||
|
for node in nodes {
|
||||||
|
match node {
|
||||||
|
TextNode::Glyph { glyph, .. } | TextNode::Box(glyph) | TextNode::MathChar(glyph) => {
|
||||||
|
if let Some(b) = &mut glyph.native_box {
|
||||||
|
b.rebind_legacy_expansion_fonts(fonts);
|
||||||
|
}
|
||||||
|
if let Some(geometry) = &mut glyph.math_geometry {
|
||||||
|
for item in &mut geometry.items {
|
||||||
|
if let MathItem::NativeGlyph { font, .. } = &mut item.item
|
||||||
|
&& let Some(logical) = fonts.get(&(font.id, font.expansion))
|
||||||
|
{
|
||||||
|
*font = logical.clone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TextNode::Discretionary { pre_break, post_break, .. } => {
|
||||||
|
rebind_horizontal(pre_break, fonts);
|
||||||
|
rebind_horizontal(post_break, fonts);
|
||||||
|
}
|
||||||
|
TextNode::Adjustment(value) => rebind_vertical(&mut value.nodes, fonts),
|
||||||
|
TextNode::Insertion(value) => rebind_vertical(&mut value.nodes, fonts),
|
||||||
|
TextNode::Leaders(leader) => rebind_leader(leader, fonts),
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rebind_vertical(nodes: &mut [NativeVerticalNode], fonts: &Replacements) {
|
||||||
|
for node in nodes {
|
||||||
|
match node {
|
||||||
|
NativeVerticalNode::Box(b) | NativeVerticalNode::Line(b) => {
|
||||||
|
b.rebind_legacy_expansion_fonts(fonts);
|
||||||
|
}
|
||||||
|
NativeVerticalNode::Insertion(value) => rebind_vertical(&mut value.nodes, fonts),
|
||||||
|
NativeVerticalNode::Leaders(leader) => rebind_leader(leader, fonts),
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rebind_leader(leader: &mut LeaderGlue, fonts: &Replacements) {
|
||||||
|
if let LeaderPattern::Box(b) = &mut leader.pattern {
|
||||||
|
b.rebind_legacy_expansion_fonts(fonts);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
//! Per-shipout device state. Original TeX boxes remain unscaled semantic lists.
|
//! Per-shipout device state. Original TeX boxes remain unscaled semantic lists.
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::pdf_device::{PdfColorProgram, PdfGraphics};
|
use crate::pdf_device::{PdfColorProgram, PdfGraphics};
|
||||||
use std::sync::Arc;
|
use std::{collections::BTreeMap, sync::Arc};
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct ShipoutDevice {
|
pub struct ShipoutDevice {
|
||||||
@@ -19,6 +19,8 @@ pub struct ShipoutDevice {
|
|||||||
pub struct NativeShipout {
|
pub struct NativeShipout {
|
||||||
pub box_node: NativeBox,
|
pub box_node: NativeBox,
|
||||||
pub device: ShipoutDevice,
|
pub device: ShipoutDevice,
|
||||||
|
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||||
|
pub(super) font_overrides: BTreeMap<FontId, Arc<crate::native_font::NativeFont>>,
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub(super) pdf_color_start: Vec<Arc<PdfColorProgram>>,
|
pub(super) pdf_color_start: Vec<Arc<PdfColorProgram>>,
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
@@ -136,7 +138,7 @@ impl NativeShipout {
|
|||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
size,
|
size,
|
||||||
font,
|
font: self.font_overrides.get(&font.id).cloned().unwrap_or(font),
|
||||||
slot,
|
slot,
|
||||||
character,
|
character,
|
||||||
paint: None,
|
paint: None,
|
||||||
|
|||||||
@@ -291,9 +291,16 @@ impl Executor {
|
|||||||
} else {
|
} else {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
};
|
};
|
||||||
|
let font_overrides = if device.pdf.is_some() {
|
||||||
|
self.reads.insert(Dependency::FontResources);
|
||||||
|
self.state.fonts.expansion_paint_fonts()
|
||||||
|
} else {
|
||||||
|
Default::default()
|
||||||
|
};
|
||||||
let mut shipout = NativeShipout {
|
let mut shipout = NativeShipout {
|
||||||
box_node: b,
|
box_node: b,
|
||||||
device,
|
device,
|
||||||
|
font_overrides,
|
||||||
pdf_color_start,
|
pdf_color_start,
|
||||||
pdf_color_steps: Vec::new(),
|
pdf_color_steps: Vec::new(),
|
||||||
pdf_graphics_steps: Vec::new(),
|
pdf_graphics_steps: Vec::new(),
|
||||||
|
|||||||
@@ -188,6 +188,10 @@ pub struct FontCatalog {
|
|||||||
fonts: Vec<FontInstance>,
|
fonts: Vec<FontInstance>,
|
||||||
resources: Vec<FontResource>,
|
resources: Vec<FontResource>,
|
||||||
parameter_words: usize,
|
parameter_words: usize,
|
||||||
|
// Metric synthesis shares parameter storage independently of active
|
||||||
|
// expansion links, including after a format has been reloaded.
|
||||||
|
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||||
|
parameter_owners: BTreeMap<FontId, FontId>,
|
||||||
limits: FontLimits,
|
limits: FontLimits,
|
||||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||||
protrusion: BTreeMap<FontId, BTreeMap<u8, [i16; 2]>>,
|
protrusion: BTreeMap<FontId, BTreeMap<u8, [i16; 2]>>,
|
||||||
@@ -232,6 +236,7 @@ impl FontCatalog {
|
|||||||
}],
|
}],
|
||||||
resources: Vec::new(),
|
resources: Vec::new(),
|
||||||
parameter_words: 7,
|
parameter_words: 7,
|
||||||
|
parameter_owners: BTreeMap::new(),
|
||||||
limits,
|
limits,
|
||||||
protrusion: BTreeMap::new(),
|
protrusion: BTreeMap::new(),
|
||||||
auto_kern: BTreeMap::new(),
|
auto_kern: BTreeMap::new(),
|
||||||
@@ -496,41 +501,39 @@ impl FontCatalog {
|
|||||||
}
|
}
|
||||||
let parameters = &mut self.fonts[owner.0 as usize].parameters;
|
let parameters = &mut self.fonts[owner.0 as usize].parameters;
|
||||||
Arc::make_mut(parameters)[index] = value;
|
Arc::make_mut(parameters)[index] = value;
|
||||||
if let Some(variants) = self.automatic_variants.get(&owner) {
|
|
||||||
let parameters = parameters.clone();
|
let parameters = parameters.clone();
|
||||||
for &variant in variants.values() {
|
for (&variant, &share) in &self.parameter_owners {
|
||||||
if self.parameter_owner(variant) == owner {
|
if share == owner {
|
||||||
let current = &mut self.fonts[variant.0 as usize].parameters;
|
let current = &mut self.fonts[variant.0 as usize].parameters;
|
||||||
if current.len() == parameters.len() {
|
if current.len() == parameters.len() {
|
||||||
*current = parameters.clone();
|
*current = parameters.clone();
|
||||||
} else {
|
} else if index < current.len() {
|
||||||
Arc::make_mut(current)[index] = value;
|
Arc::make_mut(current)[index] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parameter_owner(&self, id: FontId) -> FontId {
|
fn parameter_owner(&self, id: FontId) -> FontId {
|
||||||
let font = &self.fonts[id.0 as usize];
|
self.parameter_owners.get(&id).copied().unwrap_or(id)
|
||||||
match font.expansion_origin {
|
|
||||||
Some((base, _))
|
|
||||||
if font.glyph_font.as_ref().is_some_and(|glyph| glyph.expansion != 0) =>
|
|
||||||
{
|
|
||||||
base
|
|
||||||
}
|
|
||||||
_ => id,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn expansion_code_owner(&self, id: FontId) -> FontId {
|
||||||
|
self.fonts.get(id.index() as usize)
|
||||||
|
.and_then(|font| font.expansion_origin.map(|(base, _)| base))
|
||||||
|
.unwrap_or(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn protrusion_code(&self, font: FontId, slot: u8, right: bool) -> i32 {
|
pub(super) fn protrusion_code(&self, font: FontId, slot: u8, right: bool) -> i32 {
|
||||||
|
let font = self.expansion_code_owner(font);
|
||||||
self.protrusion.get(&font).and_then(|font| font.get(&slot))
|
self.protrusion.get(&font).and_then(|font| font.get(&slot))
|
||||||
.map_or(0, |codes| i32::from(codes[usize::from(right)]))
|
.map_or(0, |codes| i32::from(codes[usize::from(right)]))
|
||||||
}
|
}
|
||||||
pub(super) fn set_protrusion_code(
|
pub(super) fn set_protrusion_code(
|
||||||
&mut self, font: FontId, slot: u8, right: bool, code: i32,
|
&mut self, font: FontId, slot: u8, right: bool, code: i32,
|
||||||
) {
|
) {
|
||||||
|
let font = self.expansion_code_owner(font);
|
||||||
let code = code.clamp(-1000, 1000) as i16;
|
let code = code.clamp(-1000, 1000) as i16;
|
||||||
if code != 0 || self.protrusion.get(&font).is_some_and(|font| font.contains_key(&slot)) {
|
if code != 0 || self.protrusion.get(&font).is_some_and(|font| font.contains_key(&slot)) {
|
||||||
self.protrusion.entry(font).or_default().entry(slot).or_default()[usize::from(right)] = code;
|
self.protrusion.entry(font).or_default().entry(slot).or_default()[usize::from(right)] = code;
|
||||||
@@ -541,6 +544,7 @@ impl FontCatalog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn auto_kern_code(&self, font: FontId, slot: u8, after: bool) -> i32 {
|
pub(super) fn auto_kern_code(&self, font: FontId, slot: u8, after: bool) -> i32 {
|
||||||
|
let font = self.expansion_code_owner(font);
|
||||||
self.auto_kern
|
self.auto_kern
|
||||||
.get(&font)
|
.get(&font)
|
||||||
.and_then(|codes| codes.get(&slot))
|
.and_then(|codes| codes.get(&slot))
|
||||||
@@ -548,6 +552,7 @@ impl FontCatalog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn set_auto_kern_code(&mut self, font: FontId, slot: u8, after: bool, code: i32) {
|
pub(super) fn set_auto_kern_code(&mut self, font: FontId, slot: u8, after: bool, code: i32) {
|
||||||
|
let font = self.expansion_code_owner(font);
|
||||||
let side = usize::from(after);
|
let side = usize::from(after);
|
||||||
let code = code.clamp(-1000, 1000) as i16;
|
let code = code.clamp(-1000, 1000) as i16;
|
||||||
if code != 0 {
|
if code != 0 {
|
||||||
@@ -566,7 +571,7 @@ impl FontCatalog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn auto_kern_for(state: &State, font: FontId) -> Option<AutoKern<'_>> {
|
pub(super) fn auto_kern_for(state: &State, font: FontId) -> Option<AutoKern<'_>> {
|
||||||
let codes = state.fonts.auto_kern.get(&font)?;
|
let codes = state.fonts.auto_kern.get(&state.fonts.expansion_code_owner(font))?;
|
||||||
let prepend = state.parameter(Parameter::Pdfprependkern).width() > 0;
|
let prepend = state.parameter(Parameter::Pdfprependkern).width() > 0;
|
||||||
let append = state.parameter(Parameter::Pdfappendkern).width() > 0;
|
let append = state.parameter(Parameter::Pdfappendkern).width() > 0;
|
||||||
(prepend || append).then(|| AutoKern {
|
(prepend || append).then(|| AutoKern {
|
||||||
@@ -642,16 +647,14 @@ impl FontCatalog {
|
|||||||
} else if automatic {
|
} else if automatic {
|
||||||
self.check_font_capacity()?;
|
self.check_font_capacity()?;
|
||||||
let variant = FontId(self.fonts.len() as u32);
|
let variant = FontId(self.fonts.len() as u32);
|
||||||
let glyph_font = Arc::new(NativeFont {
|
let glyph_font = Self::synthesized_font(self.glyph_font(font)?, variant, &name, amount)?;
|
||||||
expansion: amount,
|
let owner = self.parameter_owner(font);
|
||||||
..self.glyph_font(font)?.as_ref().clone()
|
|
||||||
});
|
|
||||||
self.fonts.push(FontInstance {
|
self.fonts.push(FontInstance {
|
||||||
name,
|
name,
|
||||||
glyph_font: Some(glyph_font),
|
glyph_font: Some(glyph_font),
|
||||||
expansion_origin: Some((font, amount)),
|
|
||||||
..base.clone()
|
..base.clone()
|
||||||
});
|
});
|
||||||
|
self.parameter_owners.insert(variant, owner);
|
||||||
variant
|
variant
|
||||||
} else {
|
} else {
|
||||||
self.check_font_capacity()?;
|
self.check_font_capacity()?;
|
||||||
@@ -690,44 +693,101 @@ impl FontCatalog {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn expansion_face(
|
fn synthesized_font(
|
||||||
|
base: &NativeFont, id: FontId, name: &str, amount: i32,
|
||||||
|
) -> Result<Arc<NativeFont>, String> {
|
||||||
|
let mut metrics = base.metrics().clone();
|
||||||
|
metrics.expand_horizontal(amount)?;
|
||||||
|
Ok(Arc::new(NativeFont {
|
||||||
|
id,
|
||||||
|
name: name.into(),
|
||||||
|
metrics: Arc::new(metrics),
|
||||||
|
resource: base.resource.clone(),
|
||||||
|
expansion: 0,
|
||||||
|
layout_metrics: None,
|
||||||
|
letter_spacing: None,
|
||||||
|
pdf_space_font: false,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn ensure_expansion_variant(
|
||||||
&mut self,
|
&mut self,
|
||||||
font: FontId,
|
font: FontId,
|
||||||
amount: i32,
|
amount: i32,
|
||||||
defaults: FontIntegers,
|
defaults: FontIntegers,
|
||||||
files: &mut impl SourceProvider,
|
files: &mut impl SourceProvider,
|
||||||
) -> Result<(FontId, Arc<NativeFont>), String> {
|
) -> Result<FontId, String> {
|
||||||
|
if let Some(variant) = self.expansion_variant(font, amount) {
|
||||||
|
return Ok(variant);
|
||||||
|
}
|
||||||
if let Some(external) = self.external_expansion.get(&font) {
|
if let Some(external) = self.external_expansion.get(&font) {
|
||||||
let variant = if let Some(variant) = external.variants.get(&amount) {
|
|
||||||
*variant
|
|
||||||
} else {
|
|
||||||
let from = external.from.clone();
|
let from = external.from.clone();
|
||||||
let variant = self.load_expansion_variant(font, amount, false, &from, defaults, files)?;
|
let variant = self.load_expansion_variant(font, amount, false, &from, defaults, files)?;
|
||||||
self.external_expansion.get_mut(&font).unwrap().variants.insert(amount, variant);
|
self.external_expansion.get_mut(&font).unwrap().variants.insert(amount, variant);
|
||||||
variant
|
Ok(variant)
|
||||||
};
|
|
||||||
return Ok((variant, self.glyph_font(variant)?.clone()));
|
|
||||||
}
|
|
||||||
let variant = if let Some(variant) = self.expansion_variant(font, amount) {
|
|
||||||
variant
|
|
||||||
} else {
|
} else {
|
||||||
let variant = self.load_expansion_variant(font, amount, true, "", defaults, files)?;
|
let variant = self.load_expansion_variant(font, amount, true, "", defaults, files)?;
|
||||||
self.automatic_variants.entry(font).or_default().insert(amount, variant);
|
self.automatic_variants.entry(font).or_default().insert(amount, variant);
|
||||||
variant
|
Ok(variant)
|
||||||
};
|
}
|
||||||
let metrics = self.glyph_font(variant)?;
|
}
|
||||||
// Logical font IDs belong to character lists. The PDF and SVG
|
|
||||||
// device still use the base font program and one horizontal scale.
|
pub(super) fn expansion_paint_fonts(&self) -> BTreeMap<FontId, Arc<NativeFont>> {
|
||||||
let paint = if metrics.expansion != 0 {
|
// Layout retains the logical font and its metrics. A PDF shipout
|
||||||
metrics.clone()
|
// captures only the active links to the underlying programs.
|
||||||
} else {
|
let mut overrides = BTreeMap::new();
|
||||||
Arc::new(NativeFont {
|
for (&base, variants) in &self.automatic_variants {
|
||||||
|
let base = self.glyph_font(base).expect("registered expansion base");
|
||||||
|
for (&amount, &variant) in variants {
|
||||||
|
let font = self.glyph_font(variant).expect("registered expansion variant");
|
||||||
|
overrides.insert(variant, Arc::new(NativeFont {
|
||||||
expansion: amount,
|
expansion: amount,
|
||||||
layout_metrics: Some(metrics.metrics.clone()),
|
layout_metrics: Some(font.metrics.clone()),
|
||||||
..self.glyph_font(font)?.as_ref().clone()
|
..base.as_ref().clone()
|
||||||
})
|
}));
|
||||||
};
|
}
|
||||||
Ok((variant, paint))
|
}
|
||||||
|
overrides
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn reset_format_font_state(&mut self) {
|
||||||
|
for font in &mut self.fonts {
|
||||||
|
font.expansion_origin = None;
|
||||||
|
}
|
||||||
|
self.expansion.clear();
|
||||||
|
self.automatic_variants.clear();
|
||||||
|
self.external_expansion.clear();
|
||||||
|
self.expansion_codes.clear();
|
||||||
|
self.protrusion.clear();
|
||||||
|
self.auto_kern.clear();
|
||||||
|
self.pdf_settings.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Convert old device-shaped font entries into logical metrics before
|
||||||
|
/// removing the job's expansion links.
|
||||||
|
pub(super) fn restore_legacy_synthesized_fonts(
|
||||||
|
&mut self,
|
||||||
|
) -> Result<BTreeMap<(FontId, i32), Arc<NativeFont>>, String> {
|
||||||
|
let mut replaced = BTreeMap::new();
|
||||||
|
for (index, font) in self.fonts.iter_mut().enumerate() {
|
||||||
|
let Some((base, amount)) = font.expansion_origin else { continue };
|
||||||
|
let id = FontId(index as u32);
|
||||||
|
if self.automatic_variants.get(&base).and_then(|variants| variants.get(&amount)) != Some(&id) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let old = font.glyph_font.as_ref().ok_or("missing automatic expansion font")?;
|
||||||
|
if old.expansion != 0 {
|
||||||
|
let logical = Self::synthesized_font(old, id, &font.name, amount)?;
|
||||||
|
self.parameter_owners.insert(id, base);
|
||||||
|
font.glyph_font = Some(logical);
|
||||||
|
}
|
||||||
|
replaced.insert((base, amount), font.glyph_font.as_ref().unwrap().clone());
|
||||||
|
}
|
||||||
|
Ok(replaced)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn shares_font_parameters(&self, id: FontId) -> bool {
|
||||||
|
self.parameter_owners.contains_key(&id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn diagnostic_font(&self, font: FontId, expansion: i32) -> Result<(String, i32), String> {
|
pub(super) fn diagnostic_font(&self, font: FontId, expansion: i32) -> Result<(String, i32), String> {
|
||||||
@@ -735,7 +795,7 @@ impl FontCatalog {
|
|||||||
if let Some((base, amount)) = f.expansion_origin {
|
if let Some((base, amount)) = f.expansion_origin {
|
||||||
Ok((self.font(base)?.identifier_text(), amount))
|
Ok((self.font(base)?.identifier_text(), amount))
|
||||||
} else {
|
} else {
|
||||||
Ok((f.identifier_text(), expansion))
|
Ok((f.identifier_text(), if self.shares_font_parameters(font) { 0 } else { expansion }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -752,6 +812,7 @@ impl FontCatalog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn expansion_code(&self, font: FontId, slot: u8) -> i32 {
|
pub(super) fn expansion_code(&self, font: FontId, slot: u8) -> i32 {
|
||||||
|
let font = self.expansion_code_owner(font);
|
||||||
self.expansion_codes
|
self.expansion_codes
|
||||||
.get(&font)
|
.get(&font)
|
||||||
.and_then(|codes| codes.get(&slot))
|
.and_then(|codes| codes.get(&slot))
|
||||||
@@ -759,6 +820,7 @@ impl FontCatalog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn set_expansion_code(&mut self, font: FontId, slot: u8, code: i32) {
|
pub(super) fn set_expansion_code(&mut self, font: FontId, slot: u8, code: i32) {
|
||||||
|
let font = self.expansion_code_owner(font);
|
||||||
let code = code.clamp(0, 1000);
|
let code = code.clamp(0, 1000);
|
||||||
if code < 1000 {
|
if code < 1000 {
|
||||||
self.expansion_codes.entry(font).or_default().insert(slot, code as u16);
|
self.expansion_codes.entry(font).or_default().insert(slot, code as u16);
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ use std::{
|
|||||||
sync::{Arc, Mutex, OnceLock, Weak},
|
sync::{Arc, Mutex, OnceLock, Weak},
|
||||||
};
|
};
|
||||||
|
|
||||||
const SCHEMA: u32 = 53;
|
const SCHEMA: u32 = 54;
|
||||||
const COMPATIBLE_SCHEMAS: [u32; 22] = [
|
const COMPATIBLE_SCHEMAS: [u32; 23] = [
|
||||||
27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, SCHEMA,
|
27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, SCHEMA,
|
||||||
];
|
];
|
||||||
const ENGINE: &str = concat!("texrra-native/", env!("CARGO_PKG_VERSION"));
|
const ENGINE: &str = concat!("texrra-native/", env!("CARGO_PKG_VERSION"));
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ impl FormatImage {
|
|||||||
if !COMPATIBLE_SCHEMAS.contains(&identity.schema) || identity.engine != ENGINE {
|
if !COMPATIBLE_SCHEMAS.contains(&identity.schema) || identity.engine != ENGINE {
|
||||||
return Err("incompatible native format image".into());
|
return Err("incompatible native format image".into());
|
||||||
}
|
}
|
||||||
let image: Self =
|
let mut image: Self =
|
||||||
serde_json::from_str(&envelope.payload).map_err(|error| error.to_string())?;
|
serde_json::from_str(&envelope.payload).map_err(|error| error.to_string())?;
|
||||||
if image.schema != identity.schema
|
if image.schema != identity.schema
|
||||||
|| image.engine != ENGINE
|
|| image.engine != ENGINE
|
||||||
@@ -127,6 +127,10 @@ impl FormatImage {
|
|||||||
if image.state.fonts.has_unrecorded_expansion_limits() {
|
if image.state.fonts.has_unrecorded_expansion_limits() {
|
||||||
return Err("native format must be rebuilt to restore automatic expansion font identities".into());
|
return Err("native format must be rebuilt to restore automatic expansion font identities".into());
|
||||||
}
|
}
|
||||||
|
if image.schema < SCHEMA {
|
||||||
|
image.state.restore_legacy_format_fonts()?;
|
||||||
|
image.schema = SCHEMA;
|
||||||
|
}
|
||||||
Ok(image)
|
Ok(image)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ fn capacity(
|
|||||||
}
|
}
|
||||||
let variant = state.fonts.expansion_limit(font.id, amount)?;
|
let variant = state.fonts.expansion_limit(font.id, amount)?;
|
||||||
Ok(match right {
|
Ok(match right {
|
||||||
Some(right) => variant.horizontal(variant.metrics().kern(char::from(slot), char::from(right))),
|
Some(right) => variant.metrics().kern(char::from(slot), char::from(right)),
|
||||||
None => variant.advance(slot),
|
None => variant.advance(slot),
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
@@ -307,7 +307,7 @@ impl MarginVariation {
|
|||||||
if amount == 0 {
|
if amount == 0 {
|
||||||
return Ok(original);
|
return Ok(original);
|
||||||
}
|
}
|
||||||
let (selected, _) = state.fonts.expansion_face(font, amount, defaults, files)?;
|
let selected = state.fonts.ensure_expansion_variant(font, amount, defaults, files)?;
|
||||||
let quad = i64::from(state.fonts.font(selected)?.quad());
|
let quad = i64::from(state.fonts.font(selected)?.quad());
|
||||||
Ok(pdf_device::magnify(quad, code))
|
Ok(pdf_device::magnify(quad, code))
|
||||||
};
|
};
|
||||||
@@ -323,7 +323,7 @@ impl MarginVariation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct PackingFonts(BTreeMap<(FontId, i32), (FontId, Arc<NativeFont>)>);
|
struct PackingFonts(BTreeMap<(FontId, i32), FontId>);
|
||||||
|
|
||||||
impl PackingFonts {
|
impl PackingFonts {
|
||||||
fn select(
|
fn select(
|
||||||
@@ -332,16 +332,16 @@ impl PackingFonts {
|
|||||||
font: FontId,
|
font: FontId,
|
||||||
amount: i32,
|
amount: i32,
|
||||||
files: &mut impl SourceProvider,
|
files: &mut impl SourceProvider,
|
||||||
) -> Result<(FontId, Arc<NativeFont>), String> {
|
) -> Result<FontId, String> {
|
||||||
use std::collections::btree_map::Entry;
|
use std::collections::btree_map::Entry;
|
||||||
let selected = match self.0.entry((font, amount)) {
|
let selected = match self.0.entry((font, amount)) {
|
||||||
Entry::Occupied(entry) => entry.into_mut(),
|
Entry::Occupied(entry) => entry.into_mut(),
|
||||||
Entry::Vacant(entry) => {
|
Entry::Vacant(entry) => {
|
||||||
let defaults = state.font_defaults();
|
let defaults = state.font_defaults();
|
||||||
entry.insert(state.fonts.expansion_face(font, amount, defaults, files)?)
|
entry.insert(state.fonts.ensure_expansion_variant(font, amount, defaults, files)?)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Ok(selected.clone())
|
Ok(*selected)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn margin(
|
fn margin(
|
||||||
@@ -361,7 +361,7 @@ impl PackingFonts {
|
|||||||
if amount == 0 {
|
if amount == 0 {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
let (selected, _) = self.select(state, font, amount, files)?;
|
let selected = self.select(state, font, amount, files)?;
|
||||||
let code = state.fonts.protrusion_code(font, slot, right);
|
let code = state.fonts.protrusion_code(font, slot, right);
|
||||||
let quad = i64::from(state.fonts.font(selected)?.quad());
|
let quad = i64::from(state.fonts.font(selected)?.quad());
|
||||||
Ok(Some((-pdf_device::magnify(quad, code) as i32, selected)))
|
Ok(Some((-pdf_device::magnify(quad, code) as i32, selected)))
|
||||||
@@ -421,21 +421,24 @@ pub(super) fn pack(
|
|||||||
if amount == 0 {
|
if amount == 0 {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let (selected, paint) = fonts.select(state, glyph.id, amount, files)?;
|
let selected = fonts.select(state, glyph.id, amount, files)?;
|
||||||
let character = char::from(glyph.slot);
|
let character = char::from(glyph.slot);
|
||||||
let metrics = state.fonts.character(selected, glyph.slot)?
|
let metrics = state.fonts.character(selected, glyph.slot)?
|
||||||
.ok_or_else(|| format!("expanded font has no TFM slot {}", glyph.slot))?;
|
.ok_or_else(|| format!("expanded font has no TFM slot {}", glyph.slot))?;
|
||||||
// Reuse the original pair for synthesized kern scaling. A loaded
|
// Reuse the original pair for synthesized kern scaling. A loaded
|
||||||
// TFM can affect capacity without replacing the original pair kern.
|
// TFM can affect capacity without replacing the original pair kern.
|
||||||
if state.fonts.glyph_font(selected)?.expansion != 0
|
let face = state.fonts.glyph_font(selected)?;
|
||||||
|
if state.fonts.shares_font_parameters(selected)
|
||||||
|
&& !state.fonts.has_external_expansion(glyph.id)
|
||||||
&& let Some(TextNode::Kern { width, explicit: false }) = material.get(i + 1)
|
&& let Some(TextNode::Kern { width, explicit: false }) = material.get(i + 1)
|
||||||
&& let Some((left, right)) = pair(material, i + 1)
|
&& let Some((left, right)) = pair(material, i + 1)
|
||||||
{
|
{
|
||||||
let original = left.font.metrics().kern(character, char::from(right.slot));
|
let next = char::from(right.slot);
|
||||||
|
let original = left.font.metrics().kern(character, next);
|
||||||
if original == i64::from(*width)
|
if original == i64::from(*width)
|
||||||
&& let TextNode::Kern { width, .. } = &mut material[i + 1]
|
&& let TextNode::Kern { width, .. } = &mut material[i + 1]
|
||||||
{
|
{
|
||||||
*width = i32::try_from(pdf_device::magnify(original, 1000 + amount))
|
*width = i32::try_from(face.metrics().kern(character, next))
|
||||||
.map_err(|_| "expanded native font kern exceeds the scaled point range")?;
|
.map_err(|_| "expanded native font kern exceeds the scaled point range")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -454,7 +457,7 @@ pub(super) fn pack(
|
|||||||
let MathItem::NativeGlyph { font, .. } = &mut geometry.items[0].item else {
|
let MathItem::NativeGlyph { font, .. } = &mut geometry.items[0].item else {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
};
|
};
|
||||||
*font = paint;
|
*font = face.clone();
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -1465,9 +1465,20 @@ impl State {
|
|||||||
}
|
}
|
||||||
self.pdf_info.clear();
|
self.pdf_info.clear();
|
||||||
self.pdf_pages_attributes.clear();
|
self.pdf_pages_attributes.clear();
|
||||||
self.fonts.pdf_settings.clear();
|
self.fonts.reset_format_font_state();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
pub(super) fn restore_legacy_format_fonts(&mut self) -> Result<(), String> {
|
||||||
|
let replacements = self.fonts.restore_legacy_synthesized_fonts()?;
|
||||||
|
if !replacements.is_empty() {
|
||||||
|
for b in self.boxes.values_mut() {
|
||||||
|
b.rebind_legacy_expansion_fonts(&replacements);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.fonts.reset_format_font_state();
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_initex(&self) -> bool {
|
pub fn is_initex(&self) -> bool {
|
||||||
self.initex
|
self.initex
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ pub struct TfmMetrics {
|
|||||||
ec: u16,
|
ec: u16,
|
||||||
char_info: Vec<CharInfo>,
|
char_info: Vec<CharInfo>,
|
||||||
widths: Vec<i32>,
|
widths: Vec<i32>,
|
||||||
|
// Automatic expansion rounds the already sized horizontal tables.
|
||||||
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
|
horizontal_scales: Vec<i32>,
|
||||||
// The virtual font changes the already scaled widths by a uniform amount.
|
// The virtual font changes the already scaled widths by a uniform amount.
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
letter_spacing: Option<LetterspaceMetrics>,
|
letter_spacing: Option<LetterspaceMetrics>,
|
||||||
@@ -195,6 +198,7 @@ impl TfmMetrics {
|
|||||||
ec: ec as u16,
|
ec: ec as u16,
|
||||||
char_info,
|
char_info,
|
||||||
widths,
|
widths,
|
||||||
|
horizontal_scales: Vec::new(),
|
||||||
letter_spacing: None,
|
letter_spacing: None,
|
||||||
heights,
|
heights,
|
||||||
depths,
|
depths,
|
||||||
@@ -389,9 +393,34 @@ impl TfmMetrics {
|
|||||||
let Some(info) = self.char_info(c).filter(|info| info.width_index != 0) else {
|
let Some(info) = self.char_info(c).filter(|info| info.width_index != 0) else {
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
self.scaled(self.widths[usize::from(info.width_index)])
|
let width = self.scaled(self.widths[usize::from(info.width_index)])
|
||||||
.expect("validated TFM metric")
|
.expect("validated TFM metric")
|
||||||
+ self.letter_spacing.as_ref().map_or(0, |metrics| metrics.width_delta)
|
+ self.letter_spacing.as_ref().map_or(0, |metrics| metrics.width_delta);
|
||||||
|
self.scale_horizontal(width)
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
i32::try_from(scaled).map_err(|_| "expanded font metric exceeds the scaled point range")
|
||||||
|
};
|
||||||
|
let letter_spacing = self.letter_spacing.as_ref().map_or(0, |m| m.width_delta);
|
||||||
|
for &raw in self.widths.iter().skip(1) {
|
||||||
|
apply(self.scaled(raw)? + letter_spacing)?;
|
||||||
|
}
|
||||||
|
for &raw in self.italics.iter().chain(&self.kern_values) {
|
||||||
|
apply(self.scaled(raw)?)?;
|
||||||
|
}
|
||||||
|
self.horizontal_scales.push(1000 + amount);
|
||||||
|
// A synthesized font does not get the base font's TFM checksum.
|
||||||
|
self.checksum = 0;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn scale_horizontal(&self, value: i64) -> i64 {
|
||||||
|
self.horizontal_scales.iter().fold(value, |scaled, &factor| {
|
||||||
|
crate::pdf_device::magnify(scaled, factor)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn set_letter_spacing(
|
pub(crate) fn set_letter_spacing(
|
||||||
@@ -416,7 +445,7 @@ impl TfmMetrics {
|
|||||||
self.dimension(c, &self.depths, |i| i.depth_index)
|
self.dimension(c, &self.depths, |i| i.depth_index)
|
||||||
}
|
}
|
||||||
pub fn italic(&self, c: char) -> i64 {
|
pub fn italic(&self, c: char) -> i64 {
|
||||||
self.dimension(c, &self.italics, |i| i.italic_index)
|
self.scale_horizontal(self.dimension(c, &self.italics, |i| i.italic_index))
|
||||||
}
|
}
|
||||||
pub fn parameter_count(&self) -> usize {
|
pub fn parameter_count(&self) -> usize {
|
||||||
self.params.len().max(7)
|
self.params.len().max(7)
|
||||||
@@ -471,13 +500,10 @@ impl TfmMetrics {
|
|||||||
replacement: ins.remainder,
|
replacement: ins.remainder,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LigKernCommand::Kern(
|
let index = usize::from(ins.operation - 128) * 256
|
||||||
self.scaled(
|
+ usize::from(ins.remainder);
|
||||||
self.kern_values[usize::from(ins.operation - 128) * 256
|
let kern = self.scaled(self.kern_values[index]).expect("validated kern");
|
||||||
+ usize::from(ins.remainder)],
|
LigKernCommand::Kern(self.scale_horizontal(kern))
|
||||||
)
|
|
||||||
.expect("validated kern"),
|
|
||||||
)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ins.skip >= 128 {
|
if ins.skip >= 128 {
|
||||||
|
|||||||
@@ -214,3 +214,91 @@ fn format_load_validates_delivered_stream_prefix_without_requiring_eof() {
|
|||||||
assert!(load(b"READ\nunread trailing line\n").is_ok());
|
assert!(load(b"READ\nunread trailing line\n").is_ok());
|
||||||
assert!(load(b"EDIT\nunread trailing line\n").is_err());
|
assert!(load(b"EDIT\nunread trailing line\n").is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[path = "support/font_world.rs"]
|
||||||
|
mod font_world;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn format_retains_synthesized_slots_and_parameters_but_resets_active_paint() {
|
||||||
|
const SEED: &str = r"\catcode123=1 \catcode125=2
|
||||||
|
\pdfoutput=1
|
||||||
|
\font\roman=cmr10 \roman
|
||||||
|
\fontdimen8\roman=2pt
|
||||||
|
\pdffontexpand\roman 50 50 25 autoexpand
|
||||||
|
\hsize=31.5pt \parfillskip=0pt \pdfadjustspacing=1
|
||||||
|
\setbox0=\vbox{\noindent AAAA\par}
|
||||||
|
\efcode\roman65=500 \lpcode\roman65=250 \knaccode\roman65=100
|
||||||
|
\dump
|
||||||
|
";
|
||||||
|
let seed = source("expansion-seed.tex", SEED);
|
||||||
|
let state = State::initex().with_etex();
|
||||||
|
let dump = Executor::new(state.clone(), Limits::default())
|
||||||
|
.run(seed.clone(), &mut font_world::FontFiles)
|
||||||
|
.unwrap();
|
||||||
|
let tfm = dump.state.fonts().resources()[0].clone();
|
||||||
|
let image = FormatImage::from_dump(dump, vec![tfm.version.clone()], Vec::new())
|
||||||
|
.unwrap()
|
||||||
|
.encode()
|
||||||
|
.unwrap();
|
||||||
|
let job = FormatImage::decode(&image)
|
||||||
|
.unwrap()
|
||||||
|
.new_job(
|
||||||
|
state.profile(),
|
||||||
|
state.input_profile(),
|
||||||
|
JobTime::new(2026, 1, 2, 123).unwrap(),
|
||||||
|
Limits::default(),
|
||||||
|
|path| {
|
||||||
|
if path == tfm.version.path {
|
||||||
|
return Ok(tfm.data.as_ref().clone());
|
||||||
|
}
|
||||||
|
assert_eq!(path.to_str(), Some(seed.name.as_str()));
|
||||||
|
Ok(seed.data.clone())
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.with_native_pages()
|
||||||
|
.run(
|
||||||
|
source(
|
||||||
|
"expansion-document.tex",
|
||||||
|
r"\pdfoutput=1 \pdfpkresolution=600
|
||||||
|
\fontdimen8\roman=3pt
|
||||||
|
\font\positive=cmr10+50
|
||||||
|
\message{SHARED=\the\fontdimen8\positive}
|
||||||
|
\fontdimen8\positive=4pt
|
||||||
|
\message{BASE=\the\fontdimen8\roman}
|
||||||
|
\message{CODES=\the\efcode\roman65/\the\lpcode\roman65/\the\knaccode\roman65}
|
||||||
|
\message{WIDTH=\the\fontcharwd\positive65}
|
||||||
|
\shipout\copy0
|
||||||
|
\pdffontexpand\roman 50 50 25 autoexpand
|
||||||
|
\shipout\copy0
|
||||||
|
\end
|
||||||
|
",
|
||||||
|
),
|
||||||
|
&mut Host,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let mut messages = Vec::new();
|
||||||
|
let mut painted_fonts = Vec::new();
|
||||||
|
for event in &job.events {
|
||||||
|
if let Event::Message { text, .. } = event {
|
||||||
|
messages.push(text.as_str());
|
||||||
|
}
|
||||||
|
if let Event::Shipout(page) = event {
|
||||||
|
let display = page.display_list().unwrap();
|
||||||
|
let fonts = display.items.iter().filter_map(|item| match item {
|
||||||
|
texrra_tex_core::render::DisplayItem::NativeGlyph { font, .. } => {
|
||||||
|
Some((font.name.clone(), font.expansion))
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
});
|
||||||
|
painted_fonts.push(fonts.collect::<Vec<_>>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert_eq!(
|
||||||
|
messages,
|
||||||
|
["SHARED=3.0pt", "BASE=4.0pt", "CODES=1000/0/0", "WIDTH=7.87502pt"],
|
||||||
|
);
|
||||||
|
assert_eq!(job.state.fonts().fonts().len(), 4);
|
||||||
|
assert_eq!(painted_fonts[0], vec![("cmr10+50".into(), 0); 4]);
|
||||||
|
assert_eq!(painted_fonts[1], vec![("cmr10".into(), 50); 4]);
|
||||||
|
}
|
||||||
@@ -1987,6 +1987,43 @@ pdfTeX 的 INITEX dump 保留生成字体及共享参数位置,reload 后清
|
|||||||
参数所有权,再测试重载后重新声明的行为。
|
参数所有权,再测试重载后重新声明的行为。
|
||||||
[pdfTeX 的字体表 dump 与 undump](https://github.com/TeX-Live/texlive-source/blob/trunk/texk/web2c/pdftexdir/pdftex.web#L30631-L30700)
|
[pdfTeX 的字体表 dump 与 undump](https://github.com/TeX-Live/texlive-source/blob/trunk/texk/web2c/pdftexdir/pdftex.web#L30631-L30700)
|
||||||
|
|
||||||
|
### INITEX 格式保留字体度量并重置活动伸缩
|
||||||
|
|
||||||
|
原生字号字体表持有档位编号和水平度量,字宽、斜体校正与字距按尺寸化
|
||||||
|
之后的整数度量逐层取整。共享的字体参数有独立的所有权记录。PDF 出页
|
||||||
|
捕获当时激活的基准程序关联。盒子保存逻辑字体,因此一个格式预置盒在
|
||||||
|
重载后使用实际档位名,重新建立关联后使用基准程序和实际伸缩比。
|
||||||
|
格式 schema54 保留字体表和参数所有权,重置活动伸缩、悬挂及自动字距
|
||||||
|
字形码。增量检查点继续持有活动状态。现有 schema53 中已记录的合成字体
|
||||||
|
和预置盒可在读入时转换。缺少档位身份的更早自动伸缩格式仍需重建。
|
||||||
|
[pdfTeX 保存的字体字段](https://github.com/TeX-Live/texlive-source/blob/trunk/texk/web2c/pdftexdir/pdftex.web#L30631-L30700)
|
||||||
|
|
||||||
|
pdfTeX 1.40.29 独立对照涵盖重载后默认输出、按名字读取原先合成的字体、
|
||||||
|
字号与实际字距、双向共享第八个参数、拒绝给基准字体追加第九个参数、
|
||||||
|
重新声明及带入预置盒。重载后合成档位没有额外 TFM 读取。四份输出的
|
||||||
|
词框坐标差为 0 bp,600 dpi 彩色栅格完全一致。未映射的预置盒实际请求
|
||||||
|
`cmr10+25`,缺失该字体程序时两边均失败。加入同一实际 PFB 映射后成功。
|
||||||
|
用上一版本实际生成的 schema53 镜像重载,预置盒 PDF 与 schema54
|
||||||
|
字节完全一致。一次未跨格式的预加载档位复验保持与参考相同的栅格。
|
||||||
|
格式及盒诊断 13 项定向回归通过。证据位于 target/p3-expansion-format,
|
||||||
|
receipt.json 的 SHA-256 为
|
||||||
|
bb769f6184defae14f622c9936250142c7cd36ac62cda099aa336d7421b3a66c。
|
||||||
|
|
||||||
|
使用新格式启动三页工程,重新声明伸缩后进行连续编辑。非法字体参数
|
||||||
|
扩展保留上一版 PDF。修正后,第二页由 +25‰ 切换为 −25‰,复用
|
||||||
|
1196 个执行步骤,只替换第二页。PDF、SVG 和来源映射与独立全量一致。
|
||||||
|
incremental/run.log 的 SHA-256 为
|
||||||
|
a990cb72f80c9d8cad28da619f683f38f3b5a337be696c39b9d01acc0223b101。
|
||||||
|
|
||||||
|
下一处差异由 TeX Live 原样 `ptmr7t.vf` 复现。实际出页读取虚拟程序及
|
||||||
|
`ptmr8r.tfm` 后,pdfTeX 的正式字体表增长,之前最后加载的字体不能
|
||||||
|
再追加第九个参数。原生绘制侧读取同样的文件,但正式字体表未增长,
|
||||||
|
追加仍成功。删除出页的对照两边均可追加。next-virtual-receipt.json
|
||||||
|
的 SHA-256 为
|
||||||
|
07c25128d8ac56ec9ba46f750f78ae13f84212ea8ff3ea9ba5f66e8d5e38d9ba。
|
||||||
|
继续把实际 VF 局部字体、伸缩派生及其资源依赖接入执行与出页的同一
|
||||||
|
字体编号空间,保持已经验证的格式和检查点生命周期。
|
||||||
|
|
||||||
### 原生段落边缘悬挂
|
### 原生段落边缘悬挂
|
||||||
|
|
||||||
`\pdfprotrudechars`、`\lpcode`、`\rpcode` 接入实际字体槽和水平
|
`\pdfprotrudechars`、`\lpcode`、`\rpcode` 接入实际字体槽和水平
|
||||||
|
|||||||
Reference in new issue
Block a user