Resolve mapped Type 1 fonts for included pdfTeX pages
This commit is contained in:
1 parent
02d4c3116a
commit
0f6aa1f33d
13 files changed
+504
-19
No files matched your search
@@ -3078,7 +3078,7 @@ impl Executor {
|
|||||||
return self.fail("PDF object reference requires a native PDF shipout");
|
return self.fail("PDF object reference requires a native PDF shipout");
|
||||||
}
|
}
|
||||||
OutputOperation::PdfImage { image, .. } => {
|
OutputOperation::PdfImage { image, .. } => {
|
||||||
return self.declare_pdf_image(image.id);
|
return self.declare_pdf_image(image.id, files);
|
||||||
}
|
}
|
||||||
OutputOperation::PdfColor { .. } => {
|
OutputOperation::PdfColor { .. } => {
|
||||||
return self.fail("PDF color operation requires native PDF paint");
|
return self.fail("PDF color operation requires native PDF paint");
|
||||||
|
|||||||
@@ -210,6 +210,15 @@ impl Executor {
|
|||||||
span,
|
span,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
pub(super) fn pdf_copy_imported_fonts(&mut self) -> bool {
|
||||||
|
if let Some(copy) = self.state.pdf_copy_imported_fonts {
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
let copy = self.read_parameter(Parameter::Pdfinclusioncopyfonts).width() > 0;
|
||||||
|
self.state.pdf_copy_imported_fonts = Some(copy);
|
||||||
|
copy
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn pdf_page_data(
|
pub(super) fn pdf_page_data(
|
||||||
&mut self,
|
&mut self,
|
||||||
files: &mut impl SourceProvider,
|
files: &mut impl SourceProvider,
|
||||||
@@ -227,6 +236,9 @@ impl Executor {
|
|||||||
if mode <= 0 {
|
if mode <= 0 {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
if self.state.input_profile() == InputProfile::TeX8Bit {
|
||||||
|
self.pdf_copy_imported_fonts();
|
||||||
|
}
|
||||||
let major = self.read_parameter(Parameter::Pdfmajorversion).width();
|
let major = self.read_parameter(Parameter::Pdfmajorversion).width();
|
||||||
let minor = self.read_parameter(Parameter::Pdfminorversion).width();
|
let minor = self.read_parameter(Parameter::Pdfminorversion).width();
|
||||||
if major < 1 || !(0..=9).contains(&minor) {
|
if major < 1 || !(0..=9).contains(&minor) {
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ impl Executor {
|
|||||||
files: &mut impl SourceProvider,
|
files: &mut impl SourceProvider,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
self.check_pdf_image()?;
|
self.check_pdf_image()?;
|
||||||
|
// Even a deferred image declaration fixes the inclusion policy.
|
||||||
|
let remap_type1 = self.state.input_profile() == InputProfile::TeX8Bit
|
||||||
|
&& !self.pdf_copy_imported_fonts();
|
||||||
let mut dimensions = [None; 3];
|
let mut dimensions = [None; 3];
|
||||||
loop {
|
loop {
|
||||||
let index = if self.keyword("width", files)? {
|
let index = if self.keyword("width", files)? {
|
||||||
@@ -124,7 +127,8 @@ impl Executor {
|
|||||||
} else {
|
} else {
|
||||||
let page = usize::try_from(page)
|
let page = usize::try_from(page)
|
||||||
.map_err(|_| self.error("required page does not exist", token.span))?;
|
.map_err(|_| self.error("required page does not exist", token.span))?;
|
||||||
PdfImage::read(source, page, page_box).map_err(|error| self.error(error, token.span))?
|
PdfImage::read(source, page, page_box, remap_type1)
|
||||||
|
.map_err(|error| self.error(error, token.span))?
|
||||||
};
|
};
|
||||||
let image = PdfImageUse::new(self.pdf_images.len() + 1, image, dimensions)
|
let image = PdfImageUse::new(self.pdf_images.len() + 1, image, dimensions)
|
||||||
.map_err(|error| self.error(error, token.span))?;
|
.map_err(|error| self.error(error, token.span))?;
|
||||||
@@ -134,7 +138,7 @@ impl Executor {
|
|||||||
attributes: Some(attributes),
|
attributes: Some(attributes),
|
||||||
});
|
});
|
||||||
if immediate {
|
if immediate {
|
||||||
self.declare_pdf_image(id)?;
|
self.declare_pdf_image(id, files)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -309,12 +313,25 @@ impl Executor {
|
|||||||
// A PDF image object is emitted once, when used at shipout or immediately.
|
// A PDF image object is emitted once, when used at shipout or immediately.
|
||||||
// Expansion took place during registration, but escapechar and catcodes
|
// Expansion took place during registration, but escapechar and catcodes
|
||||||
// belong to the token printer at the time of writing the object.
|
// belong to the token printer at the time of writing the object.
|
||||||
pub(super) fn declare_pdf_image(&mut self, id: usize) -> Result<(), Error> {
|
pub(super) fn declare_pdf_image(
|
||||||
|
&mut self, id: usize, files: &mut impl SourceProvider,
|
||||||
|
) -> Result<(), Error> {
|
||||||
let registered = &mut self.pdf_images[id - 1];
|
let registered = &mut self.pdf_images[id - 1];
|
||||||
let Some(tokens) = registered.attributes.take() else {
|
let Some(tokens) = registered.attributes.take() else {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
let image = registered.image.clone();
|
let mut image = registered.image.clone();
|
||||||
|
if image.image.has_imported_fonts() {
|
||||||
|
let from = self.source_name(self.current);
|
||||||
|
self.reads.insert(Dependency::FontResources);
|
||||||
|
let font_map = Arc::make_mut(&mut self.pdf_virtual_fonts);
|
||||||
|
let mapped = image.image.resolve_imported_fonts(|name| {
|
||||||
|
font_map.imported_type1_program(name, std::path::Path::new(&from), files)
|
||||||
|
}).map_err(|error| self.error(error, self.current))?;
|
||||||
|
if let Some(mapped) = mapped {
|
||||||
|
Arc::make_mut(&mut image).image = Arc::new(mapped);
|
||||||
|
}
|
||||||
|
}
|
||||||
if let Some(xdv) = &image.xdv
|
if let Some(xdv) = &image.xdv
|
||||||
&& (xdv.page_request < 0 || xdv.page_request as usize > image.image.page_count)
|
&& (xdv.page_request < 0 || xdv.page_request as usize > image.image.page_count)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ pub enum Parameter {
|
|||||||
Pdfdecimaldigits,
|
Pdfdecimaldigits,
|
||||||
Pdfpkresolution,
|
Pdfpkresolution,
|
||||||
Pdfimageresolution,
|
Pdfimageresolution,
|
||||||
|
Pdfinclusioncopyfonts,
|
||||||
Pdfgentounicode,
|
Pdfgentounicode,
|
||||||
Pdfsuppresswarningdupmap,
|
Pdfsuppresswarningdupmap,
|
||||||
Pdfinfoomitdate,
|
Pdfinfoomitdate,
|
||||||
@@ -149,6 +150,7 @@ impl Parameter {
|
|||||||
| Self::Pdfdecimaldigits
|
| Self::Pdfdecimaldigits
|
||||||
| Self::Pdfpkresolution
|
| Self::Pdfpkresolution
|
||||||
| Self::Pdfimageresolution
|
| Self::Pdfimageresolution
|
||||||
|
| Self::Pdfinclusioncopyfonts
|
||||||
| Self::Pdfgentounicode
|
| Self::Pdfgentounicode
|
||||||
| Self::Pdfsuppresswarningdupmap
|
| Self::Pdfsuppresswarningdupmap
|
||||||
| Self::Pdfinfoomitdate
|
| Self::Pdfinfoomitdate
|
||||||
@@ -186,6 +188,7 @@ impl Parameter {
|
|||||||
Self::Pdfdecimaldigits,
|
Self::Pdfdecimaldigits,
|
||||||
Self::Pdfpkresolution,
|
Self::Pdfpkresolution,
|
||||||
Self::Pdfimageresolution,
|
Self::Pdfimageresolution,
|
||||||
|
Self::Pdfinclusioncopyfonts,
|
||||||
Self::Pdfgentounicode,
|
Self::Pdfgentounicode,
|
||||||
Self::Pdfsuppresswarningdupmap,
|
Self::Pdfsuppresswarningdupmap,
|
||||||
Self::Pdfinfoomitdate,
|
Self::Pdfinfoomitdate,
|
||||||
|
|||||||
@@ -789,6 +789,8 @@ pub struct State {
|
|||||||
pub(super) magnification_set: Option<i32>,
|
pub(super) magnification_set: Option<i32>,
|
||||||
pub(super) output_mode_set: Option<i32>,
|
pub(super) output_mode_set: Option<i32>,
|
||||||
pub(super) pdf_file_options: Option<crate::pdf_device::PdfFileOptions>,
|
pub(super) pdf_file_options: Option<crate::pdf_device::PdfFileOptions>,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub(super) pdf_copy_imported_fonts: Option<bool>,
|
||||||
#[serde(default, skip_serializing_if = "crate::pdf_device::xdv_destination::Setup::is_default")]
|
#[serde(default, skip_serializing_if = "crate::pdf_device::xdv_destination::Setup::is_default")]
|
||||||
pub(super) xdv_setup: crate::pdf_device::xdv_destination::Setup,
|
pub(super) xdv_setup: crate::pdf_device::xdv_destination::Setup,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
@@ -992,6 +994,7 @@ impl Default for State {
|
|||||||
magnification_set: None,
|
magnification_set: None,
|
||||||
output_mode_set: None,
|
output_mode_set: None,
|
||||||
pdf_file_options: None,
|
pdf_file_options: None,
|
||||||
|
pdf_copy_imported_fonts: None,
|
||||||
xdv_setup: Default::default(),
|
xdv_setup: Default::default(),
|
||||||
xdv_navigation: None,
|
xdv_navigation: None,
|
||||||
pdf_catalog: None,
|
pdf_catalog: None,
|
||||||
@@ -1631,6 +1634,7 @@ impl State {
|
|||||||
self.magnification_set = None;
|
self.magnification_set = None;
|
||||||
self.output_mode_set = None;
|
self.output_mode_set = None;
|
||||||
self.pdf_file_options = None;
|
self.pdf_file_options = None;
|
||||||
|
self.pdf_copy_imported_fonts = None;
|
||||||
self.xdv_setup = Default::default();
|
self.xdv_setup = Default::default();
|
||||||
self.xdv_navigation = None;
|
self.xdv_navigation = None;
|
||||||
self.pdf_catalog = None;
|
self.pdf_catalog = None;
|
||||||
|
|||||||
@@ -18,11 +18,20 @@ pub(super) struct MapEntry {
|
|||||||
file: Option<String>,
|
file: Option<String>,
|
||||||
pub encoding: Option<String>,
|
pub encoding: Option<String>,
|
||||||
postscript_name: bool,
|
postscript_name: bool,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
ps_name: Option<String>,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
descriptor_flags: Option<i32>,
|
||||||
#[serde(default, skip_serializing_if = "Type1Transform::is_identity")]
|
#[serde(default, skip_serializing_if = "Type1Transform::is_identity")]
|
||||||
pub transform: Type1Transform,
|
pub transform: Type1Transform,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PostscriptKey = (String, i32, i32);
|
||||||
|
|
||||||
impl MapEntry {
|
impl MapEntry {
|
||||||
|
fn postscript_key(&self) -> Option<PostscriptKey> {
|
||||||
|
Some((self.ps_name.clone()?, self.transform.slant, self.transform.extend))
|
||||||
|
}
|
||||||
fn is_scalable(&self) -> bool {
|
fn is_scalable(&self) -> bool {
|
||||||
self.file.is_some() || self.postscript_name
|
self.file.is_some() || self.postscript_name
|
||||||
}
|
}
|
||||||
@@ -84,6 +93,8 @@ fn parse_map_line(
|
|||||||
file: None,
|
file: None,
|
||||||
encoding: None,
|
encoding: None,
|
||||||
postscript_name: false,
|
postscript_name: false,
|
||||||
|
ps_name: None,
|
||||||
|
descriptor_flags: None,
|
||||||
transform: Type1Transform::default(),
|
transform: Type1Transform::default(),
|
||||||
};
|
};
|
||||||
for (index, (quote, value)) in fields.into_iter().skip(1).enumerate() {
|
for (index, (quote, value)) in fields.into_iter().skip(1).enumerate() {
|
||||||
@@ -116,6 +127,9 @@ fn parse_map_line(
|
|||||||
}
|
}
|
||||||
} else if index == 0 && !value.as_bytes()[0].is_ascii_digit() {
|
} else if index == 0 && !value.as_bytes()[0].is_ascii_digit() {
|
||||||
entry.postscript_name = true;
|
entry.postscript_name = true;
|
||||||
|
entry.ps_name = Some(value);
|
||||||
|
} else if index == usize::from(entry.postscript_name) {
|
||||||
|
entry.descriptor_flags = value.parse().ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if entry.transform.extend == 1000 {
|
if entry.transform.extend == 1000 {
|
||||||
@@ -175,6 +189,9 @@ pub(super) struct JobFontMap {
|
|||||||
pending_ids: BTreeSet<FontId>,
|
pending_ids: BTreeSet<FontId>,
|
||||||
entries: Arc<BTreeMap<String, Arc<MapEntry>>>,
|
entries: Arc<BTreeMap<String, Arc<MapEntry>>>,
|
||||||
used_names: BTreeSet<String>,
|
used_names: BTreeSet<String>,
|
||||||
|
// PDF inclusion addresses the PostScript name independently of the TFM.
|
||||||
|
postscript_entries: Arc<BTreeMap<PostscriptKey, (String, Arc<MapEntry>)>>,
|
||||||
|
used_postscript: BTreeSet<PostscriptKey>,
|
||||||
bindings: Option<Arc<PdfFontBindings>>,
|
bindings: Option<Arc<PdfFontBindings>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,8 +228,13 @@ impl JobFontMap {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let entry = self.entries.get(name).cloned();
|
let entry = self.entries.get(name).cloned();
|
||||||
if entry.is_some() {
|
if let Some(entry) = &entry {
|
||||||
self.used_names.insert(name.into());
|
self.used_names.insert(name.into());
|
||||||
|
if let Some(key) = entry.postscript_key()
|
||||||
|
&& self.postscript_entries.get(&key).is_some_and(|(_, imported)| Arc::ptr_eq(imported, entry))
|
||||||
|
{
|
||||||
|
self.used_postscript.insert(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Arc::make_mut(bindings).fonts.insert(id, entry);
|
Arc::make_mut(bindings).fonts.insert(id, entry);
|
||||||
}
|
}
|
||||||
@@ -240,6 +262,29 @@ impl JobFontMap {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(super) fn imported_type1_program(
|
||||||
|
&mut self, name: &str, from: &Path, files: &mut impl SourceProvider,
|
||||||
|
) -> Result<Option<(crate::type1::Type1Font, i32)>, String> {
|
||||||
|
let (name, transform) = imported_postscript_name(name);
|
||||||
|
if self.bindings.is_none() {
|
||||||
|
self.initialize(true, from, files)?;
|
||||||
|
}
|
||||||
|
let key = (name.to_owned(), transform.slant, transform.extend);
|
||||||
|
let Some((tfm, entry)) = self.postscript_entries.get(&key) else { return Ok(None) };
|
||||||
|
let file = entry.type1_file(name)?;
|
||||||
|
let Some(resource) = files.optional_font_file(ResourceKind::Type1, file,
|
||||||
|
&entry.from.to_string_lossy())? else { return Ok(None) };
|
||||||
|
let resource = verify_resource(resource, ResourceKind::Type1, file)?;
|
||||||
|
let mut font = crate::type1::Type1Font::from_pfb(&resource.data)
|
||||||
|
.ok_or_else(|| format!("invalid Type1 PFB program: {file}"))?;
|
||||||
|
font.apply_map_transform(transform)?;
|
||||||
|
if self.entries.get(tfm).is_some_and(|direct| Arc::ptr_eq(direct, entry)) {
|
||||||
|
self.used_names.insert(tfm.clone());
|
||||||
|
}
|
||||||
|
self.used_postscript.insert(key);
|
||||||
|
Ok(Some((font, entry.descriptor_flags.unwrap_or(4))))
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn command(
|
pub(super) fn command(
|
||||||
&mut self,
|
&mut self,
|
||||||
input: &[u8],
|
input: &[u8],
|
||||||
@@ -339,14 +384,49 @@ impl JobFontMap {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let entry = Arc::new(entry);
|
||||||
if mode == MapMode::Delete {
|
if mode == MapMode::Delete {
|
||||||
Arc::make_mut(&mut self.entries).remove(&name);
|
Arc::make_mut(&mut self.entries).remove(&name);
|
||||||
} else {
|
} else {
|
||||||
Arc::make_mut(&mut self.entries).insert(name, Arc::new(entry));
|
Arc::make_mut(&mut self.entries).insert(name.clone(), entry.clone());
|
||||||
|
}
|
||||||
|
let Some(key) = entry.postscript_key() else { return };
|
||||||
|
if self.postscript_entries.contains_key(&key) {
|
||||||
|
if mode == MapMode::Add || self.used_postscript.contains(&key) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Arc::make_mut(&mut self.postscript_entries).remove(&key);
|
||||||
|
}
|
||||||
|
if mode != MapMode::Delete && entry.type1_file(&name).is_ok() {
|
||||||
|
Arc::make_mut(&mut self.postscript_entries).insert(key, (name, entry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn imported_postscript_name(name: &str) -> (&str, Type1Transform) {
|
||||||
|
let mut name = if name.as_bytes().get(6) == Some(&b'+')
|
||||||
|
&& name.as_bytes()[..6].iter().all(u8::is_ascii_uppercase)
|
||||||
|
{
|
||||||
|
&name[7..]
|
||||||
|
} else {
|
||||||
|
name
|
||||||
|
};
|
||||||
|
let mut transform = Type1Transform::default();
|
||||||
|
if let Some((base, value)) = name.rsplit_once("-Extend_")
|
||||||
|
&& let Ok(value) = value.parse()
|
||||||
|
{
|
||||||
|
name = base;
|
||||||
|
transform.extend = value;
|
||||||
|
}
|
||||||
|
if let Some((base, value)) = name.rsplit_once("-Slant_")
|
||||||
|
&& let Ok(value) = value.parse()
|
||||||
|
{
|
||||||
|
name = base;
|
||||||
|
transform.slant = value;
|
||||||
|
}
|
||||||
|
(name, transform)
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn load_map(
|
pub(super) fn load_map(
|
||||||
files: &mut impl SourceProvider,
|
files: &mut impl SourceProvider,
|
||||||
name: &str,
|
name: &str,
|
||||||
@@ -388,6 +468,8 @@ pub(super) fn dedicated_space_map(font: &NativeFont) -> MapEntry {
|
|||||||
file: Some("pdftexspace.pfb".into()),
|
file: Some("pdftexspace.pfb".into()),
|
||||||
encoding: None,
|
encoding: None,
|
||||||
postscript_name: false,
|
postscript_name: false,
|
||||||
|
ps_name: None,
|
||||||
|
descriptor_flags: None,
|
||||||
transform: Type1Transform::default(),
|
transform: Type1Transform::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -406,6 +406,12 @@ impl JobVirtualFonts {
|
|||||||
self.font_map.command(bytes, map_file, from, suppress_duplicates, files)
|
self.font_map.command(bytes, map_file, from, suppress_duplicates, files)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn imported_type1_program(
|
||||||
|
&mut self, name: &str, from: &std::path::Path, files: &mut impl SourceProvider,
|
||||||
|
) -> Result<Option<(crate::type1::Type1Font, i32)>, String> {
|
||||||
|
self.font_map.imported_type1_program(name, from, files)
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn is_known_physical(&self, id: FontId) -> bool {
|
pub(crate) fn is_known_physical(&self, id: FontId) -> bool {
|
||||||
matches!(self.programs.get(&id), Some(None))
|
matches!(self.programs.get(&id), Some(None))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
mod bmp;
|
mod bmp;
|
||||||
mod jpeg;
|
mod jpeg;
|
||||||
mod icc;
|
mod icc;
|
||||||
|
mod imported_fonts;
|
||||||
mod png;
|
mod png;
|
||||||
use crate::{
|
use crate::{
|
||||||
pdf_device::Affine,
|
pdf_device::Affine,
|
||||||
@@ -43,6 +44,8 @@ pub struct PdfImage {
|
|||||||
pub natural: [i64; 2],
|
pub natural: [i64; 2],
|
||||||
extent: [u64; 2],
|
extent: [u64; 2],
|
||||||
objects: Vec<Vec<Part>>,
|
objects: Vec<Vec<Part>>,
|
||||||
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
|
imported_fonts: Vec<imported_fonts::ImportedType1>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||||
@@ -438,6 +441,7 @@ impl PdfImage {
|
|||||||
natural,
|
natural,
|
||||||
extent: extent.map(f64::to_bits),
|
extent: extent.map(f64::to_bits),
|
||||||
objects,
|
objects,
|
||||||
|
imported_fonts: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,6 +487,7 @@ impl PdfImage {
|
|||||||
natural: natural(bp),
|
natural: natural(bp),
|
||||||
extent: bp.map(f64::to_bits),
|
extent: bp.map(f64::to_bits),
|
||||||
objects: vec![vec![part]],
|
objects: vec![vec![part]],
|
||||||
|
imported_fonts: Vec::new(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -524,8 +529,9 @@ impl PdfImage {
|
|||||||
resource: LoadedResource,
|
resource: LoadedResource,
|
||||||
page: usize,
|
page: usize,
|
||||||
kind: PageBox,
|
kind: PageBox,
|
||||||
|
remap_type1: bool,
|
||||||
) -> Result<Self, String> {
|
) -> Result<Self, String> {
|
||||||
Self::read_page(resource, kind.keys(), false, |pages| {
|
Self::read_page(resource, kind.keys(), false, remap_type1, |pages| {
|
||||||
u32::try_from(page)
|
u32::try_from(page)
|
||||||
.ok()
|
.ok()
|
||||||
.filter(|&page| page > 0 && page as usize <= pages)
|
.filter(|&page| page > 0 && page as usize <= pages)
|
||||||
@@ -546,7 +552,7 @@ impl PdfImage {
|
|||||||
b"TrimBox",
|
b"TrimBox",
|
||||||
b"ArtBox",
|
b"ArtBox",
|
||||||
];
|
];
|
||||||
Self::read_page(resource, &keys, true, |pages| {
|
Self::read_page(resource, &keys, true, false, |pages| {
|
||||||
let pages = i64::try_from(pages).ok()?;
|
let pages = i64::try_from(pages).ok()?;
|
||||||
let page = match page {
|
let page = match page {
|
||||||
0 => 1,
|
0 => 1,
|
||||||
@@ -578,6 +584,7 @@ impl PdfImage {
|
|||||||
resource: LoadedResource,
|
resource: LoadedResource,
|
||||||
box_keys: &[&[u8]],
|
box_keys: &[&[u8]],
|
||||||
keep_page_origin: bool,
|
keep_page_origin: bool,
|
||||||
|
remap_type1: bool,
|
||||||
select_page: impl FnOnce(usize) -> Option<u32>,
|
select_page: impl FnOnce(usize) -> Option<u32>,
|
||||||
) -> Result<(Self, [f64; 2]), String> {
|
) -> Result<(Self, [f64; 2]), String> {
|
||||||
let doc = Self::open_pdf(&resource)?;
|
let doc = Self::open_pdf(&resource)?;
|
||||||
@@ -688,6 +695,11 @@ impl PdfImage {
|
|||||||
stream.extend_from_slice(b"\nendstream");
|
stream.extend_from_slice(b"\nendstream");
|
||||||
form.push(Part::Bytes(stream));
|
form.push(Part::Bytes(stream));
|
||||||
graph.bodies[0] = form;
|
graph.bodies[0] = form;
|
||||||
|
let imported_fonts = if remap_type1 {
|
||||||
|
imported_fonts::capture(&mut graph, inherited(b"Resources"))?
|
||||||
|
} else {
|
||||||
|
Vec::new()
|
||||||
|
};
|
||||||
Ok((
|
Ok((
|
||||||
Self {
|
Self {
|
||||||
version: resource.version,
|
version: resource.version,
|
||||||
@@ -696,6 +708,7 @@ impl PdfImage {
|
|||||||
natural,
|
natural,
|
||||||
extent: [width.to_bits(), height.to_bits()],
|
extent: [width.to_bits(), height.to_bits()],
|
||||||
objects: graph.bodies,
|
objects: graph.bodies,
|
||||||
|
imported_fonts,
|
||||||
},
|
},
|
||||||
[left, bottom],
|
[left, bottom],
|
||||||
))
|
))
|
||||||
@@ -843,15 +856,7 @@ impl Graph<'_> {
|
|||||||
Object::Real(n) if n.is_finite() => bytes(out, real(*n).as_bytes()),
|
Object::Real(n) if n.is_finite() => bytes(out, real(*n).as_bytes()),
|
||||||
Object::Real(_) => return Err("non-finite number in PDF image".into()),
|
Object::Real(_) => return Err("non-finite number in PDF image".into()),
|
||||||
Object::Name(name) => {
|
Object::Name(name) => {
|
||||||
let mut encoded = vec![b'/'];
|
bytes(out, &pdf_name(name));
|
||||||
for &ch in name {
|
|
||||||
if (33..=126).contains(&ch) && !b"#%()<>[]{}/".contains(&ch) {
|
|
||||||
encoded.push(ch);
|
|
||||||
} else {
|
|
||||||
write!(encoded, "#{ch:02X}").unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bytes(out, &encoded);
|
|
||||||
}
|
}
|
||||||
Object::String(data, _) => {
|
Object::String(data, _) => {
|
||||||
let mut encoded = vec![b'<'];
|
let mut encoded = vec![b'<'];
|
||||||
@@ -911,3 +916,15 @@ impl Graph<'_> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn pdf_name(name: &[u8]) -> Vec<u8> {
|
||||||
|
let mut encoded = vec![b'/'];
|
||||||
|
for &byte in name {
|
||||||
|
if (33..=126).contains(&byte) && !b"#%()<>[]{}/".contains(&byte) {
|
||||||
|
encoded.push(byte);
|
||||||
|
} else {
|
||||||
|
write!(encoded, "#{byte:02X}").unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
encoded
|
||||||
|
}
|
||||||
@@ -0,0 +1,298 @@
|
|||||||
|
//! Replacement of fonts in the root resources of an included pdfTeX page.
|
||||||
|
use super::{Graph, Part, PdfImage, number, pdf_name, resolved};
|
||||||
|
use crate::type1::{Type1Font, builtin_encoding};
|
||||||
|
use lopdf::{Dictionary, Document, Object, Stream};
|
||||||
|
use std::collections::BTreeSet;
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub(super) struct ImportedType1 {
|
||||||
|
index: usize,
|
||||||
|
postscript_name: String,
|
||||||
|
stem_v: i32,
|
||||||
|
dictionary: Result<Vec<Part>, String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn capture(
|
||||||
|
graph: &mut Graph<'_>,
|
||||||
|
resources: Option<&Object>,
|
||||||
|
) -> Result<Vec<ImportedType1>, String> {
|
||||||
|
let doc = graph.doc;
|
||||||
|
let Some(resources) = resources else {
|
||||||
|
return Ok(Vec::new());
|
||||||
|
};
|
||||||
|
let resources = resolved(doc, resources)?
|
||||||
|
.as_dict()
|
||||||
|
.map_err(|error| error.to_string())?;
|
||||||
|
let Ok(fonts) = resources.get(b"Font") else {
|
||||||
|
return Ok(Vec::new());
|
||||||
|
};
|
||||||
|
let fonts = resolved(doc, fonts)?
|
||||||
|
.as_dict()
|
||||||
|
.map_err(|error| error.to_string())?;
|
||||||
|
let mut captured = Vec::new();
|
||||||
|
let mut seen = BTreeSet::new();
|
||||||
|
for (_, object) in fonts.iter() {
|
||||||
|
let Ok(id) = object.as_reference() else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let Some(&index) = graph.ids.get(&id) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
if !seen.insert(index) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let dict = resolved(doc, object)?
|
||||||
|
.as_dict()
|
||||||
|
.map_err(|error| error.to_string())?;
|
||||||
|
if dict
|
||||||
|
.get(b"Subtype")
|
||||||
|
.ok()
|
||||||
|
.and_then(|object| resolved(doc, object).ok())
|
||||||
|
.and_then(|object| object.as_name().ok())
|
||||||
|
!= Some(b"Type1")
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let Ok(base) = dict.get(b"BaseFont") else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let Ok(name) = resolved(doc, base)?.as_name() else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let Ok(postscript_name) = std::str::from_utf8(name) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let Ok(descriptor) = dict.get(b"FontDescriptor") else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
if descriptor.as_reference().is_err() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let Ok(descriptor) = resolved(doc, descriptor)?.as_dict() else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let Ok(file) = descriptor.get(b"FontFile") else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let Ok(file) = resolved(doc, file)?.as_stream() else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let stem_v = descriptor
|
||||||
|
.get(b"StemV")
|
||||||
|
.ok()
|
||||||
|
.and_then(|value| number(doc, value).ok())
|
||||||
|
.unwrap_or(0.0)
|
||||||
|
.round() as i32;
|
||||||
|
let dictionary = font_template(graph, dict, file);
|
||||||
|
captured.push(ImportedType1 {
|
||||||
|
index,
|
||||||
|
postscript_name: postscript_name.to_owned(),
|
||||||
|
stem_v,
|
||||||
|
dictionary,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Ok(captured)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn font_template(
|
||||||
|
graph: &mut Graph<'_>,
|
||||||
|
dict: &Dictionary,
|
||||||
|
file: &Stream,
|
||||||
|
) -> Result<Vec<Part>, String> {
|
||||||
|
let doc = graph.doc;
|
||||||
|
let mut replacement = dict.clone();
|
||||||
|
replacement.remove(b"BaseFont");
|
||||||
|
replacement.remove(b"FontDescriptor");
|
||||||
|
if let Some(encoding) = replace_implicit_encoding(doc, dict, file)? {
|
||||||
|
replacement.set("Encoding", encoding);
|
||||||
|
}
|
||||||
|
let mut parts = Vec::new();
|
||||||
|
graph.render(&Object::Dictionary(replacement), &mut parts, 0)?;
|
||||||
|
let Some(Part::Bytes(end)) = parts.last_mut() else {
|
||||||
|
return Err("missing imported font dictionary end".into());
|
||||||
|
};
|
||||||
|
end.truncate(end.len() - 2);
|
||||||
|
Ok(parts)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn replace_implicit_encoding(
|
||||||
|
doc: &Document,
|
||||||
|
font: &Dictionary,
|
||||||
|
program: &Stream,
|
||||||
|
) -> Result<Option<Dictionary>, String> {
|
||||||
|
let encoding = font
|
||||||
|
.get(b"Encoding")
|
||||||
|
.ok()
|
||||||
|
.map(|object| resolved(doc, object))
|
||||||
|
.transpose()?;
|
||||||
|
let differences = match encoding {
|
||||||
|
Some(Object::Name(_)) => return Ok(None),
|
||||||
|
Some(Object::Dictionary(dict)) if dict.has(b"BaseEncoding") => return Ok(None),
|
||||||
|
Some(Object::Dictionary(dict)) => dict.get(b"Differences").ok(),
|
||||||
|
None | Some(Object::Null) => None,
|
||||||
|
_ => return Err("invalid Type1 encoding in included PDF".into()),
|
||||||
|
};
|
||||||
|
let length = program
|
||||||
|
.dict
|
||||||
|
.get(b"Length1")
|
||||||
|
.map_err(|error| error.to_string())?;
|
||||||
|
let length = resolved(doc, length)?
|
||||||
|
.as_i64()
|
||||||
|
.ok()
|
||||||
|
.and_then(|n| usize::try_from(n).ok())
|
||||||
|
.ok_or("invalid included Type1 Length1")?;
|
||||||
|
let bytes = if program.dict.has(b"Filter") {
|
||||||
|
program
|
||||||
|
.decompressed_content()
|
||||||
|
.map_err(|error| error.to_string())?
|
||||||
|
} else {
|
||||||
|
program.content.clone()
|
||||||
|
};
|
||||||
|
let mut names: Vec<Vec<u8>> = builtin_encoding(
|
||||||
|
bytes
|
||||||
|
.get(..length)
|
||||||
|
.ok_or("included Type1 header is truncated")?,
|
||||||
|
)?
|
||||||
|
.into_iter()
|
||||||
|
.map(String::into_bytes)
|
||||||
|
.collect();
|
||||||
|
if let Some(differences) = differences {
|
||||||
|
let differences = resolved(doc, differences)?
|
||||||
|
.as_array()
|
||||||
|
.map_err(|error| error.to_string())?;
|
||||||
|
let mut slot = 0usize;
|
||||||
|
for value in differences {
|
||||||
|
match resolved(doc, value)? {
|
||||||
|
Object::Integer(code) => {
|
||||||
|
slot = usize::try_from(*code)
|
||||||
|
.ok()
|
||||||
|
.filter(|&slot| slot < names.len())
|
||||||
|
.ok_or("invalid Type1 encoding difference index")?;
|
||||||
|
}
|
||||||
|
Object::Name(glyph) => {
|
||||||
|
*names
|
||||||
|
.get_mut(slot)
|
||||||
|
.ok_or("Type1 encoding difference exceeds 256 slots")? = glyph.clone();
|
||||||
|
slot += 1;
|
||||||
|
}
|
||||||
|
_ => return Err("invalid Type1 encoding difference".into()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let mut generated = Dictionary::new();
|
||||||
|
generated.set("Type", Object::Name(b"Encoding".to_vec()));
|
||||||
|
let first = font
|
||||||
|
.get(b"FirstChar")
|
||||||
|
.ok()
|
||||||
|
.and_then(|object| resolved(doc, object).ok())
|
||||||
|
.and_then(|object| object.as_i64().ok())
|
||||||
|
.unwrap_or(0)
|
||||||
|
.clamp(0, 255);
|
||||||
|
let last = font
|
||||||
|
.get(b"LastChar")
|
||||||
|
.ok()
|
||||||
|
.and_then(|object| resolved(doc, object).ok())
|
||||||
|
.and_then(|object| object.as_i64().ok())
|
||||||
|
.unwrap_or(255)
|
||||||
|
.clamp(first, 255);
|
||||||
|
let mut differences = vec![Object::Integer(first)];
|
||||||
|
differences.extend(
|
||||||
|
names
|
||||||
|
.drain(first as usize..=last as usize)
|
||||||
|
.map(Object::Name),
|
||||||
|
);
|
||||||
|
generated.set("Differences", Object::Array(differences));
|
||||||
|
Ok(Some(generated))
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PdfImage {
|
||||||
|
pub(crate) fn has_imported_fonts(&self) -> bool {
|
||||||
|
!self.imported_fonts.is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn resolve_imported_fonts(
|
||||||
|
&self,
|
||||||
|
mut load: impl FnMut(&str) -> Result<Option<(Type1Font, i32)>, String>,
|
||||||
|
) -> Result<Option<Self>, String> {
|
||||||
|
let mut result: Option<Self> = None;
|
||||||
|
for entry in &self.imported_fonts {
|
||||||
|
let Some((program, flags)) = load(&entry.postscript_name)? else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let mut dictionary = entry.dictionary.clone()?;
|
||||||
|
let mut name = b" /BaseFont ".to_vec();
|
||||||
|
name.extend(pdf_name(program.name.as_bytes()));
|
||||||
|
name.extend(b" /FontDescriptor ");
|
||||||
|
let image = result.get_or_insert_with(|| self.clone());
|
||||||
|
let descriptor = image.objects.len();
|
||||||
|
dictionary.push(Part::Bytes(name));
|
||||||
|
dictionary.push(Part::Ref(descriptor));
|
||||||
|
dictionary.push(Part::Bytes(b">>".to_vec()));
|
||||||
|
image.objects[entry.index] = dictionary;
|
||||||
|
|
||||||
|
let [left, bottom, right, top] = program.bbox;
|
||||||
|
let angle = &program.italic_angle;
|
||||||
|
let mut body = b"<< /Type /FontDescriptor /FontName ".to_vec();
|
||||||
|
body.extend(pdf_name(program.name.as_bytes()));
|
||||||
|
body.extend(format!(
|
||||||
|
" /Flags {flags} /FontBBox [{left} {bottom} {right} {top}] /ItalicAngle {angle} \
|
||||||
|
/Ascent {top} /Descent {bottom} /CapHeight {top} /StemV {} /FontFile ",
|
||||||
|
entry.stem_v,
|
||||||
|
).into_bytes());
|
||||||
|
image.objects.push(vec![
|
||||||
|
Part::Bytes(body),
|
||||||
|
Part::Ref(descriptor + 1),
|
||||||
|
Part::Bytes(b">>".to_vec()),
|
||||||
|
]);
|
||||||
|
let keys = format!(
|
||||||
|
"/Length1 {} /Length2 {} /Length3 {}",
|
||||||
|
program.length1, program.length2, program.length3
|
||||||
|
);
|
||||||
|
image
|
||||||
|
.objects
|
||||||
|
.push(vec![Part::Bytes(crate::pdf::objects::stream(
|
||||||
|
&keys,
|
||||||
|
&program.program,
|
||||||
|
0,
|
||||||
|
))]);
|
||||||
|
}
|
||||||
|
if let Some(image) = result.as_mut() {
|
||||||
|
image.imported_fonts.clear();
|
||||||
|
image.retain_reachable_objects();
|
||||||
|
}
|
||||||
|
Ok(result)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn retain_reachable_objects(&mut self) {
|
||||||
|
let mut used = vec![false; self.objects.len()];
|
||||||
|
let mut visit = vec![0];
|
||||||
|
while let Some(index) = visit.pop() {
|
||||||
|
if std::mem::replace(&mut used[index], true) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
visit.extend(self.objects[index].iter().filter_map(|part| {
|
||||||
|
if let Part::Ref(index) = part {
|
||||||
|
Some(*index)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
let mut reindex = vec![0; used.len()];
|
||||||
|
let mut keep = Vec::new();
|
||||||
|
for (index, parts) in std::mem::take(&mut self.objects).into_iter().enumerate() {
|
||||||
|
if used[index] {
|
||||||
|
reindex[index] = keep.len();
|
||||||
|
keep.push(parts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for parts in &mut keep {
|
||||||
|
for part in parts {
|
||||||
|
if let Part::Ref(index) = part {
|
||||||
|
*index = reindex[*index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.objects = keep;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -136,6 +136,7 @@ pub(super) fn read(
|
|||||||
natural,
|
natural,
|
||||||
extent: [1.0_f64.to_bits(); 2],
|
extent: [1.0_f64.to_bits(); 2],
|
||||||
objects: vec![vec![Part::Png(image)]],
|
objects: vec![vec![Part::Png(image)]],
|
||||||
|
imported_fonts: Vec::new(),
|
||||||
},
|
},
|
||||||
warning,
|
warning,
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
use crate::type1_outline::Tokens;
|
use crate::type1_outline::Tokens;
|
||||||
use std::{collections::BTreeMap, ops::Range};
|
use std::{collections::BTreeMap, ops::Range};
|
||||||
|
|
||||||
fn builtin_encoding(header: &[u8]) -> Result<Vec<String>, String> {
|
pub(crate) fn builtin_encoding(header: &[u8]) -> Result<Vec<String>, String> {
|
||||||
let mut tokens = Tokens::new(header);
|
let mut tokens = Tokens::new(header);
|
||||||
while tokens.required()? != "/Encoding" {}
|
while tokens.required()? != "/Encoding" {}
|
||||||
let specification = tokens.required()?;
|
let specification = tokens.required()?;
|
||||||
|
|||||||
@@ -2175,6 +2175,42 @@ PDF,恢复实际 PFB 并反转斜切时复用 1277 步,只替换第二页。
|
|||||||
全量编译一致。incremental-receipt.json 的 SHA-256 为
|
全量编译一致。incremental-receipt.json 的 SHA-256 为
|
||||||
bbc0991b0316e6d76aa58649ec873525f5544ab530d93fe491fc6e16bd00a27d。
|
bbc0991b0316e6d76aa58649ec873525f5544ab530d93fe491fc6e16bd00a27d。
|
||||||
|
|
||||||
|
### pdfTeX 导入页面的 Type 1 字体与 CAS 图摘
|
||||||
|
|
||||||
|
`\pdfinclusioncopyfonts` 在首次初始化 PDF 输出时锁定,普通
|
||||||
|
`\pdfximage` 注册也会触发锁定。实际写出图像时,用其根资源字典中的
|
||||||
|
间接 Type 1 字体和当前 PostScript 映射处理有实际 PFB 的条目。
|
||||||
|
独立维护 TFM 和 PostScript 两套索引,简称删除只作用于 TFM 项。
|
||||||
|
资源读取交给作业宿主,保留映射和 PFB 的真实依赖。
|
||||||
|
[参考 PDF 初始化](https://github.com/TeX-Live/texlive-source/blob/fb6158926661cb7a7246b3a94a0cb170a9624d5a/texk/web2c/pdftexdir/pdftex.web#L15463-L15494)
|
||||||
|
[参考导入字体选择](https://github.com/TeX-Live/texlive-source/blob/fb6158926661cb7a7246b3a94a0cb170a9624d5a/texk/web2c/pdftexdir/pdftoepdf.cc#L389-L460)
|
||||||
|
[参考两个映射索引](https://github.com/TeX-Live/texlive-source/blob/fb6158926661cb7a7246b3a94a0cb170a9624d5a/texk/web2c/pdftexdir/mapfile.c#L187-L256)
|
||||||
|
|
||||||
|
源含隐式 Type 1 编码时,从原程序读取实际字形名并应用 Differences。
|
||||||
|
保留原字宽和 ToUnicode。重建描述符时从映射选定的真实 PFB 读取
|
||||||
|
边界和斜角,使用实际映射 flags 与源 StemV,清理替换后失去引用的
|
||||||
|
资源节点。当前这条路径嵌入完整 PFB。Type1C 映射重建、子集生成
|
||||||
|
及与正文共享描述符留在后续范围。
|
||||||
|
[参考描述符默认度量](https://github.com/TeX-Live/texlive-source/blob/fb6158926661cb7a7246b3a94a0cb170a9624d5a/texk/web2c/pdftexdir/writefont.c#L137-L169)
|
||||||
|
|
||||||
|
独立有文字的图像通过八种配置对照。覆盖默认、原样复制、注册后
|
||||||
|
与首个发页后改变开关、空映射、注册后更换 flags、完整项删除和
|
||||||
|
仅 TFM 删除。各配置的真实字体描述符、词框和 144 DPI 灰度一致。
|
||||||
|
按参考行为读取或保留原程序的资源清单均核对。保留原图摘单独导入
|
||||||
|
时无可提取文字的诊断样例。
|
||||||
|
|
||||||
|
原样 Elsevier CAS 双栏保持 30 项原样交付、固定格式、映射和参考。
|
||||||
|
三轮 aux、实际 bbl 逐字节一致,无未定义引用。图摘数字的最大词框
|
||||||
|
差由 0.557906 bp 降到 0,六页 1889 个提取词同序。第 3、4、5 页
|
||||||
|
仍分别有 77、215、108 个差异像素,正文最大词框差 0.009963 bp。
|
||||||
|
下一入口是正文的水平文字定位。
|
||||||
|
|
||||||
|
三次更改经预览的真实 PDF 源资源,同时重写实际 aux,各复用 99
|
||||||
|
步,只更新第二页。图像来源命中、PDF、SVG、来源映射和生成文件
|
||||||
|
均与同初始状态的独立全量一致。
|
||||||
|
回执 `target/p3-cas-imported-fonts/receipt.json` 的 SHA-256 为
|
||||||
|
`21aa04737612326e9ad53c2bdacff40326d0aa0adb4cf399deb7858997f49b73`。
|
||||||
|
|
||||||
### pdfTeX 装盒中的字偶距与原样 arXiv 页面
|
### pdfTeX 装盒中的字偶距与原样 arXiv 页面
|
||||||
|
|
||||||
计算伸缩容量时读取正常 kern 节点的实际宽度,并用同字体相邻字形的
|
计算伸缩容量时读取正常 kern 节点的实际宽度,并用同字体相邻字形的
|
||||||
|
|||||||
@@ -977,6 +977,15 @@ LuaLaTex、languages 和 argues 的断行与冻结参考一致。PDF 提取的
|
|||||||
字形提取仍待对照,当前整页版面门禁保持未通过。
|
字形提取仍待对照,当前整页版面门禁保持未通过。
|
||||||
阶段回执 `target/p3-xetex-native-hyphenation/receipt.json`。
|
阶段回执 `target/p3-xetex-native-hyphenation/receipt.json`。
|
||||||
|
|
||||||
|
### Elsevier CAS 双栏导入字体复验
|
||||||
|
|
||||||
|
保留原 30 项交付文件、冻结 schema51、字体映射和参考。原生三轮
|
||||||
|
aux 与实际 bbl 逐字节一致,无未定义引用。图摘通过实际 PostScript
|
||||||
|
映射选中 CMR10,导入数码的上下边界取自实际 PFB。第一页面的
|
||||||
|
19 个词框完全一致,修正前最大词框差为 0.557906 bp。六页共
|
||||||
|
1889 个词,同序。第 3、4、5 页仍有 77、215、108 个像素差异。
|
||||||
|
[阶段记录](P2_M1_PROGRESS.md#pdftex-导入页面的-type-1-字体与-cas-图摘)
|
||||||
|
|
||||||
### 原样 Elsevier CAS 双栏与 NeurIPS 2025
|
### 原样 Elsevier CAS 双栏与 NeurIPS 2025
|
||||||
|
|
||||||
以 `767c8ff`、既有真实 schema51 和参考格式复验官方 CAS 双栏。
|
以 `767c8ff`、既有真实 schema51 和参考格式复验官方 CAS 双栏。
|
||||||
|
|||||||
Reference in new issue
Block a user