Fall back per glyph outside the Type1 encodings

This commit is contained in:
gloamxun committed 2026-10-25 00:03:19 +08:00
1 parent 9ae86d9c86
commit c6860b7b4a
5 files changed
+155 -74

No files matched your search

+28
View File
@@ -59,6 +59,34 @@ fn paragraph(id: u64, marker: &str) -> Unit {
Unit::paragraph_with_style(id, text, body_style())
}
#[test]
fn accented_text_keeps_type1_ascii_and_falls_back_per_glyph() {
let mut document = Document::new(
1,
vec![Unit::paragraph_with_style(
1,
"caf\u{e9}".to_string(),
body_style(),
)],
);
document.page_goal = 200 * 65_536;
let engine = Engine::layout_paged(&document).expect("paged layout");
let lists: Vec<_> = engine
.pages()
.iter()
.map(|page| page.display_list())
.collect();
let pdf = display_lists_to_pdf_with_cm_type1(
&lists,
300 * 65_536,
300 * 65_536,
PageOrigin::default(),
);
let text = String::from_utf8_lossy(&pdf);
assert!(text.contains("/BaseFont /CMR10"), "{text}");
assert!(text.contains("/Subtype /Type0"), "{text}");
}
#[test]
fn route_d_article_exports_pdf_and_reflows_only_the_edited_page() {
let mut document = Document::new(