mirror of
https://github.com/typst/typst
synced 2025-06-28 16:22:53 +08:00
Write the font name for Type 3 fonts (#5070)
This commit is contained in:
parent
66147979ba
commit
ada9650a06
@ -84,8 +84,18 @@ pub fn write_color_fonts(
|
|||||||
gids.push(color_glyph.gid);
|
gids.push(color_glyph.gid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determine the base font name.
|
||||||
|
gids.sort();
|
||||||
|
let subset_tag = subset_tag(&gids);
|
||||||
|
let postscript_name = font_slice
|
||||||
|
.font
|
||||||
|
.find_name(name_id::POST_SCRIPT_NAME)
|
||||||
|
.unwrap_or_else(|| "unknown".to_string());
|
||||||
|
let base_font = eco_format!("{subset_tag}+{postscript_name}");
|
||||||
|
|
||||||
// Write the Type3 font object.
|
// Write the Type3 font object.
|
||||||
let mut pdf_font = chunk.type3_font(subfont_id);
|
let mut pdf_font = chunk.type3_font(subfont_id);
|
||||||
|
pdf_font.name(Name(base_font.as_bytes()));
|
||||||
pdf_font.pair(Name(b"Resources"), color_fonts.resources.reference);
|
pdf_font.pair(Name(b"Resources"), color_fonts.resources.reference);
|
||||||
pdf_font.bbox(color_font.bbox);
|
pdf_font.bbox(color_font.bbox);
|
||||||
pdf_font.matrix([1.0 / scale_factor, 0.0, 0.0, 1.0 / scale_factor, 0.0, 0.0]);
|
pdf_font.matrix([1.0 / scale_factor, 0.0, 0.0, 1.0 / scale_factor, 0.0, 0.0]);
|
||||||
@ -129,13 +139,6 @@ pub fn write_color_fonts(
|
|||||||
chunk.cmap(cmap_ref, &cmap.finish());
|
chunk.cmap(cmap_ref, &cmap.finish());
|
||||||
|
|
||||||
// Write the font descriptor.
|
// Write the font descriptor.
|
||||||
gids.sort();
|
|
||||||
let subset_tag = subset_tag(&gids);
|
|
||||||
let postscript_name = font_slice
|
|
||||||
.font
|
|
||||||
.find_name(name_id::POST_SCRIPT_NAME)
|
|
||||||
.unwrap_or_else(|| "unknown".to_string());
|
|
||||||
let base_font = eco_format!("{subset_tag}+{postscript_name}");
|
|
||||||
write_font_descriptor(
|
write_font_descriptor(
|
||||||
&mut chunk,
|
&mut chunk,
|
||||||
descriptor_ref,
|
descriptor_ref,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user