From 9c3d39c5972cfac8dcec3effd90acb82e3c5afbc Mon Sep 17 00:00:00 2001 From: Dominik Strebel Date: Mon, 19 Oct 2026 13:37:43 +0200 Subject: [PATCH] DOCX: Punjabi in Pakistan takes the Arabic-script theme font lang_script mapped every `pa` tag to Gurmukhi. Measured in Word for Mac: with w:themeFontLang w:bidi="pa-PK" a majorBidi run takes the theme's Arab font, with "pa-IN" its Guru font. The test matrix gains both. Co-Authored-By: Claude Opus 5.5 --- crates/docx/src/read/props.rs | 2 ++ crates/docx/tests/fixtures.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/crates/docx/src/read/props.rs b/crates/docx/src/read/props.rs index d4414cd39..c9dfd947b 100644 --- a/crates/docx/src/read/props.rs +++ b/crates/docx/src/read/props.rs @@ -99,6 +99,8 @@ pub(crate) fn lang_script(tag: &str) -> &'static str { "th" => "Thai", "hi" | "mr" | "ne" | "sa" | "kok" => "Deva", "bn" | "as" => "Beng", + // Measured in Word: Punjabi takes the Arabic-script font in Pakistan, Gurmukhi elsewhere. + "pa" if rest.iter().any(|p| p.eq_ignore_ascii_case("pk")) => "Arab", "pa" => "Guru", "gu" => "Gujr", "or" => "Orya", diff --git a/crates/docx/tests/fixtures.rs b/crates/docx/tests/fixtures.rs index 931e0ec48..01103854d 100644 --- a/crates/docx/tests/fixtures.rs +++ b/crates/docx/tests/fixtures.rs @@ -3294,6 +3294,8 @@ fn bidi_theme_slots_follow_the_theme_font_language() { (Some(r#"w:bidi="ar-SA""#), "Arial", true, "", ["Georgia", "Trebuchet MS"]), (Some(r#"w:bidi="he-IL""#), "", true, "", ["Courier New", "Comic Sans MS"]), (Some(r#"w:bidi="ur-PK""#), "Arial", true, "", ["Georgia", "Trebuchet MS"]), + (Some(r#"w:bidi="pa-PK""#), "Arial", true, "", ["Georgia", "Trebuchet MS"]), + (Some(r#"w:bidi="pa-IN""#), "Arial", true, "", ["Arial", "Arial"]), (Some(r#"w:bidi="fr-FR""#), "Arial", true, "", ["Verdana", "Impact"]), (Some(r#"w:bidi="th-TH""#), "Arial", true, "", ["Arial", "Arial"]), (Some(r#"w:bidi="th-TH""#), "", true, "", [tnr, tnr]),