From 674a208990d4925436abf16f849a23bb1f0c9e3b Mon Sep 17 00:00:00 2001 From: Grzegorz Martens Date: Mon, 9 Nov 2026 17:18:51 +0100 Subject: [PATCH] M7: a test pins that Repair Thai maps refuses a map that isn't Identity The Legal forms review of b7224cbc9..4d6ff291d: - Nothing pinned that `recovered_thai_map`'s rewritten guard still refuses a /CIDToGIDMap that isn't Identity: deleting it left every Thai test passing. `recovered_thai_map_checks_every_kept_glyph_against_ the_font_program` now asserts no map for a map stream that moves glyphs and for another name. - The guard's comment and the test's cited Identity as the default of ISO 32000-2 Table 115. It is the default of PDF 1.x (ISO 32000-1); PDF 2.0 gives it none and requires the map with a /FontFile2. Both now say so, and that the renderer takes a missing map as Identity too. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY --- crates/fonts/src/pdf/thai.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/fonts/src/pdf/thai.rs b/crates/fonts/src/pdf/thai.rs index 28d29b0055..e15799ed04 100644 --- a/crates/fonts/src/pdf/thai.rs +++ b/crates/fonts/src/pdf/thai.rs @@ -24,8 +24,9 @@ pub fn recovered_thai_map(doc: &Document, font: &Dict) -> Option| { let mut f = font.clone(); let Some(Object::Array(desc)) = f.get(b"DescendantFonts").cloned() else { panic!("fixture") }; @@ -572,6 +573,10 @@ mod tests { let by_reference = with_map(Some(Object::Ref(doc.add(Object::name("Identity"))))); assert_eq!(recovered_thai_map(&doc, &by_reference), recovered_thai_map(&doc, &font), "a map by reference"); assert_eq!(recovered_thai_map(&doc, &with_map(None)), recovered_thai_map(&doc, &font), "a missing map"); + // Any other map is refused: one that moves glyphs, and another name. + let moved = Object::Ref(doc.add(Object::Stream(Stream::flate(Dict::new(), &[0, 1, 0, 0])))); + assert_eq!(recovered_thai_map(&doc, &with_map(Some(moved))), None, "a map that moves glyphs"); + assert_eq!(recovered_thai_map(&doc, &with_map(Some(Object::name("Foo")))), None, "another name"); // 259–261 are ฮ, ฯ and ะ, between the last anchor (อ, 258) and the first mark: a font that // put Mai Han-akat one glyph earlier passes every anchor and only this check sees it. let mut shifted = thai_ordered_program();