Render legacy XeLaTeX composite Type 1 fonts

This commit is contained in:
gloamxun committed 2026-11-28 22:36:13 +08:00
1 parent ff52a9f66b
commit e7ab132520
11 files changed
+497 -116

No files matched your search

+9 -3
View File
@@ -1924,7 +1924,9 @@ fn write_native_font(
return Ok(pk_fonts::write_font(objects, face.id, pk, used, compression, target));
}
if paint.legacy_cid_font().is_some() {
return legacy_cid::write(objects, paint, used.keys().copied(), compression, subset_tags, target);
return legacy_cid::write(
objects, paint, face.metrics(), used.keys().copied(), compression, subset_tags, target,
);
}
let id = target.unwrap_or_else(|| {
objects.push(Vec::new());
@@ -2031,7 +2033,7 @@ fn write_native_font(
}
("Type1", descriptor, name, format!("{width_object} 0 R"), encoding, mapped_encoding.is_some())
}
NativeFontProgram::Pk(_) => unreachable!(),
NativeFontProgram::Pk(_) | NativeFontProgram::CompositeType1(_) => unreachable!(),
};
let unicode = objects.len() + 1;
let cmap = if let Some(texts) = &paint.xdv_unicode {
@@ -2527,6 +2529,7 @@ fn write_pdf(
let face_index = match &paint.program {
crate::native_font::NativeFontProgram::TrueType(program) => program.face_index,
crate::native_font::NativeFontProgram::OpenTypeCff(program) => program.face_index,
crate::native_font::NativeFontProgram::CompositeType1(_) => 0,
_ => unreachable!("legacy CID program"),
};
*cid_owners.entry((paint.program_version()?, face_index, composite)).or_insert(id)
@@ -2559,7 +2562,10 @@ fn write_pdf(
{
return Err("shared PDF font has inconsistent output encoding or program".into());
}
if paint.xdv_descriptor.is_some() && xdv_font_aliases.contains_key(&id) {
if paint.legacy_cid_font().is_none()
&& paint.xdv_descriptor.is_some()
&& xdv_font_aliases.contains_key(&id)
{
// Separate map entries can resolve to the same physical
// program with disjoint sets of measured glyph widths.
for slot in used.keys() {