Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix: warn when a PDF's Arabic text layer is out of order; plan-core lists Arabic faces

hugohe3b3073f8fcf5d
diff --git a/skills/ppt-master/references/plan-core.md b/skills/ppt-master/references/plan-core.md
index b8708d1e..4513f6ad 100644
--- a/skills/ppt-master/references/plan-core.md
+++ b/skills/ppt-master/references/plan-core.md
@@ -163,7 +163,7 @@ python3 skills/ppt-master/scripts/visualization_recall.py validate \
**Family selection**: user/template typography is authoritative. Delivery target: an explicit user/template target first, otherwise Windows Microsoft PowerPoint (owner: [`shared-standards-core.md`](./shared-standards-core.md) §4.1) — the authoring host's installed fonts never select a face; name concrete faces installed or approved on that target; at most four families; a brand/web face leads only after user-confirmed installation, otherwise export a safe face and keep it as a Design Spec reference (fonts are not embedded; CSS tails are preview aids, not PowerPoint fallbacks). Avoid near-equivalent splits (YaHei↔PingFang, SimSun↔Songti, Arial↔Helvetica↔Segoe UI, Times↔Times New Roman). Fonts in one deck form contrast (different family, weight, or proportion) or concord (one family throughout); across the direction set include both a concord and a contrast pairing unless the user or template fixes the stack, and never default to title = body without a reason.
-**Reference — PPT-safe faces (recall, not a whitelist; one concrete named face per script — a stack carries at most one Latin face and one CJK face and never a fallback list of alternatives, because export takes the first named face of each script)**: CJK sans `Microsoft YaHei` / `SimHei`, CJK serif `SimSun` / `FangSong` / `KaiTi` (their macOS counterparts `PingFang SC` / `Heiti SC` / `Songti SC` are preview aliases, never the named face), Traditional Chinese sans `Microsoft JhengHei`, serif `PMingLiU` / `DFKai-SB`, Japanese sans `Yu Gothic` / `Meiryo`, serif `Yu Mincho`, Korean sans `Malgun Gothic`, serif `Batang` (text on another locale's CJK face takes that locale's glyph forms), Latin sans `Arial` / `Calibri` / `Segoe UI` / `Verdana` / `Trebuchet MS`, Latin serif `Times New Roman` / `Georgia` / `Cambria` / `Palatino` / `Garamond` (`Georgia` sets old-style figures whose digits sit at different heights — a hero-number or data role needs lining figures: `Times New Roman`, `Cambria`, or any listed sans or mono), mono `Consolas` / `Courier New`, display `Impact` / `Arial Black`. Let the locked style's character pick the axis and lead the title — `Microsoft YaHei` / `Arial` are the neutral members, never the automatic lead; a neutral sans title where the style asks for character is the failure to avoid. Non-pre-installed directions — retro/pixel Press Start 2P / VT323, rounded Nunito / Quicksand / OPPO Sans (safe substitute `Trebuchet MS` / `Verdana`), modern web Inter / HarmonyOS Sans / Source Han, calligraphic 隶书 / 华文行楷 / 华文新魏 (safe substitute `KaiTi` / `FangSong`, titles only), brand faces — need target installation or stay Design Spec references.
+**Reference — PPT-safe faces (recall, not a whitelist; one concrete named face per script — a stack carries at most one Latin face and one CJK face and never a fallback list of alternatives, because export takes the first named face of each script)**: CJK sans `Microsoft YaHei` / `SimHei`, CJK serif `SimSun` / `FangSong` / `KaiTi` (their macOS counterparts `PingFang SC` / `Heiti SC` / `Songti SC` are preview aliases, never the named face), Traditional Chinese sans `Microsoft JhengHei`, serif `PMingLiU` / `DFKai-SB`, Japanese sans `Yu Gothic` / `Meiryo`, serif `Yu Mincho`, Korean sans `Malgun Gothic`, serif `Batang` (text on another locale's CJK face takes that locale's glyph forms), Arabic `Segoe UI` / `Tahoma` / `Times New Roman` (one face carries both the Latin and Arabic text), Latin sans `Arial` / `Calibri` / `Segoe UI` / `Verdana` / `Trebuchet MS`, Latin serif `Times New Roman` / `Georgia` / `Cambria` / `Palatino` / `Garamond` (`Georgia` sets old-style figures whose digits sit at different heights — a hero-number or data role needs lining figures: `Times New Roman`, `Cambria`, or any listed sans or mono), mono `Consolas` / `Courier New`, display `Impact` / `Arial Black`. Let the locked style's character pick the axis and lead the title — `Microsoft YaHei` / `Arial` are the neutral members, never the automatic lead; a neutral sans title where the style asks for character is the failure to avoid. Non-pre-installed directions — retro/pixel Press Start 2P / VT323, rounded Nunito / Quicksand / OPPO Sans (safe substitute `Trebuchet MS` / `Verdana`), modern web Inter / HarmonyOS Sans / Source Han, calligraphic 隶书 / 华文行楷 / 华文新魏 (safe substitute `KaiTi` / `FangSong`, titles only), brand faces — need target installation or stay Design Spec references.
**Role extension after confirmation**: while composing the roster, add a lowercase snake_case role with an exact stack only for a recurring role that materially needs a different family (`annotation`, `footer`, `footnote`, `data`, `emphasis`, `quote`, `code`), coherent with the confirmed heading/body system and locked style; one-off garnish stays omitted and Default names any added role in one compact `Role rationale` line in §IV.
diff --git a/skills/ppt-master/scripts/source_to_md/pdf_to_md.py b/skills/ppt-master/scripts/source_to_md/pdf_to_md.py
index cdff8ff7..e7f43461 100644
--- a/skills/ppt-master/scripts/source_to_md/pdf_to_md.py
+++ b/skills/ppt-master/scripts/source_to_md/pdf_to_md.py
@@ -231,6 +231,29 @@ def scanned_pdf_warnings(markdown: str, page_count: int, image_count: int) -> li
]
+# Two alef forms before a lam ("اإلحصاءات" for "الإحصاءات") is a lam-alef
+# ligature decomposed in the wrong order; well-formed Arabic practically
+# never has it. A run of tatweel marks where glyphs were dropped.
+_BROKEN_LAM_ALEF_RE = re.compile("[\u0627\u0623\u0625\u0622][\u0627\u0623\u0625\u0622]\u0644")
+
+
+def arabic_text_layer_warnings(markdown: str) -> list[str]:
+ """Warn when an Arabic text layer came out in visual order or lost glyphs."""
+ arabic = len(re.findall("[\u0600-\u06ff]", markdown))
+ if arabic < 200:
+ return []
+ broken = len(_BROKEN_LAM_ALEF_RE.findall(markdown))
+ tatweel = markdown.count("\u0640")
+ if broken < 5 and tatweel < arabic // 20:
+ return []
+ return [
+ f"Arabic text layer looks damaged: {broken} reversed lam-alef "
+ f"sequences and {tatweel} tatweel marks in {arabic} Arabic letters; "
+ "words, table cells, and numbers may be out of order or missing "
+ "letters, so check every figure against the PDF itself"
+ ]
+
+
def detect_list_item(text: str) -> tuple:
"""Detect if the text is a list item. Returns (is_list, list_type, content)."""
text = text.strip()
@@ -1821,6 +1844,7 @@ def extract_pdf_to_markdown(
encoding="utf-8",
)
warnings = scanned_pdf_warnings(markdown_content, page_count, img_count)
+ warnings += arabic_text_layer_warnings(markdown_content)
for warning in warnings:
print(f"[WARN] {warning}")
profile_path = write_conversion_profile_best_effort(
diff --git a/skills/ppt-master/scripts/tests/test_dogfood_leaves_fixes.py b/skills/ppt-master/scripts/tests/test_dogfood_leaves_fixes.py
index 06764afd..b34f10c6 100644
--- a/skills/ppt-master/scripts/tests/test_dogfood_leaves_fixes.py
+++ b/skills/ppt-master/scripts/tests/test_dogfood_leaves_fixes.py
@@ -473,6 +473,16 @@ class StampIndependenceTests(unittest.TestCase):
self.assertIn("02_bad.svg: invalid SVG XML", err.getvalue())
+class ArabicPdfTests(unittest.TestCase):
+ def test_reversed_lam_alef_layer_warns(self) -> None:
+ broken = "نشرة اإلحصاءات الزراعية األعلى آالف " * 40
+ self.assertEqual(len(pdf_to_md.arabic_text_layer_warnings(broken)), 1)
+
+ def test_well_formed_arabic_does_not_warn(self) -> None:
+ clean = "القهوة العربية رمز للكرم والضيافة في شبه الجزيرة العربية " * 20
+ self.assertEqual(pdf_to_md.arabic_text_layer_warnings(clean), [])
+
+
class SlideSizeTypeTests(unittest.TestCase):
def test_standard_ratios_keep_their_token(self) -> None:
self.assertEqual(_slide_size_type(12192000, 6858000), "screen16x9")