Render vertical and CFF legacy XeLaTeX composite fonts
This commit is contained in:
1 parent
bbeeca0317
commit
ff52a9f66b
14 files changed
+877
-292
No files matched your search
@@ -27,6 +27,8 @@ pub(crate) mod objects;
|
||||
#[path = "pdf_pk.rs"]
|
||||
mod pk_fonts;
|
||||
mod cff_fonts;
|
||||
mod cid_cff;
|
||||
mod legacy_cid;
|
||||
mod truetype_fonts;
|
||||
#[path = "pdf_opentype.rs"]
|
||||
mod opentype_fonts;
|
||||
@@ -1921,8 +1923,8 @@ fn write_native_font(
|
||||
if let NativeFontProgram::Pk(pk) = &paint.program {
|
||||
return Ok(pk_fonts::write_font(objects, face.id, pk, used, compression, target));
|
||||
}
|
||||
if let NativeFontProgram::TrueType(program) = &paint.program && program.composite.is_some() {
|
||||
return truetype_fonts::write_cid(objects, program, used.keys().copied(), compression, subset_tags, target);
|
||||
if paint.legacy_cid_font().is_some() {
|
||||
return legacy_cid::write(objects, paint, used.keys().copied(), compression, subset_tags, target);
|
||||
}
|
||||
let id = target.unwrap_or_else(|| {
|
||||
objects.push(Vec::new());
|
||||
@@ -2521,10 +2523,13 @@ fn write_pdf(
|
||||
let mut owners = HashMap::new();
|
||||
let mut cid_owners = HashMap::new();
|
||||
native_used.iter().filter_map(|(&id, (_, paint, _))| {
|
||||
let owner = if let crate::native_font::NativeFontProgram::TrueType(program) = &paint.program
|
||||
&& let Some(composite) = &program.composite
|
||||
{
|
||||
*cid_owners.entry((paint.program_version()?, program.face_index, composite)).or_insert(id)
|
||||
let owner = if let Some(composite) = paint.legacy_cid_font() {
|
||||
let face_index = match &paint.program {
|
||||
crate::native_font::NativeFontProgram::TrueType(program) => program.face_index,
|
||||
crate::native_font::NativeFontProgram::OpenTypeCff(program) => program.face_index,
|
||||
_ => unreachable!("legacy CID program"),
|
||||
};
|
||||
*cid_owners.entry((paint.program_version()?, face_index, composite)).or_insert(id)
|
||||
} else {
|
||||
paint.xdv_descriptor?;
|
||||
let key = (paint.type1_program_key()?, paint.encoding_version());
|
||||
@@ -2661,10 +2666,10 @@ fn write_pdf(
|
||||
for (&id, (face, paint, used)) in &native_used {
|
||||
let target = registry.and_then(|objects| objects.font_number(id))
|
||||
.map(|number| device_objects[&number] as usize);
|
||||
let encoding = if matches!(
|
||||
let encoding = if paint.legacy_cid_font().is_none() && (matches!(
|
||||
paint.program,
|
||||
crate::native_font::NativeFontProgram::OpenTypeCff(_) | crate::native_font::NativeFontProgram::DeviceType1(_)
|
||||
) || paint.xdv_descriptor.is_some() {
|
||||
) || paint.xdv_descriptor.is_some()) {
|
||||
mapped_encodings.mark(&mut objects, paint, used.keys().copied())
|
||||
} else {
|
||||
None
|
||||
|
||||
Reference in new issue
Block a user