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(text-measure,notes): size Unicode fixed-width spaces by definition; flag stale per-page notes

hugohe370705ebfead5
diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py
index 1e296561..edfa1f4a 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py
@@ -3652,6 +3652,23 @@ def resolve_text_run_fonts(text: str, fonts: dict[str, str]) -> dict[str, str]:
return {'latin': latin, 'ea': ea, 'cs': latin}
+# Unicode fixed-width spaces carry their width in their definition; bundled
+# advance tables omit them, and the generic 0.55em fallback triples the thin
+# spaces German and French typography sets before '%', units, and '§'.
+_FIXED_SPACE_EMS = {
+ ' ': 0.5, # en space
+ ' ': 1.0, # em space
+ ' ': 1 / 3, # three-per-em space
+ ' ': 0.25, # four-per-em space
+ ' ': 1 / 6, # six-per-em space
+ ' ': 0.55, # figure space
+ ' ': 0.3, # punctuation space
+ ' ': 0.2, # thin space
+ ' ': 0.1, # hair space
+ ' ': 0.2, # narrow no-break space
+}
+
+
def _estimate_character_width(ch: str, font_size: float) -> float:
if (
0xFF00 <= ord(ch) <= 0xFFEF
@@ -3662,6 +3679,8 @@ def _estimate_character_width(ch: str, font_size: float) -> float:
return font_size
if ch == ' ':
return font_size * 0.3
+ if ch in _FIXED_SPACE_EMS:
+ return font_size * _FIXED_SPACE_EMS[ch]
if ch in 'mMwWOQ%':
return font_size * 0.75
if ch in 'iIlj!|':
diff --git a/skills/ppt-master/scripts/total_md_split.py b/skills/ppt-master/scripts/total_md_split.py
index cd8cac24..f27c6828 100644
--- a/skills/ppt-master/scripts/total_md_split.py
+++ b/skills/ppt-master/scripts/total_md_split.py
@@ -359,6 +359,16 @@ Features:
# Split notes
success = split_notes(notes, output_dir, verbose)
+ # A renamed, dropped, or renumbered page leaves its old per-page file
+ # behind; nothing reads it now, but a page that returns to that stem would.
+ stale = sorted(
+ p.name for p in output_dir.glob('*.md')
+ if p.stem not in notes and extract_leading_number(p.stem) is not None
+ )
+ if stale:
+ print(f"[ADVISORY] {len(stale)} per-page notes file(s) match no current page; "
+ f"delete them if they are leftovers: {', '.join(stale)}")
+
if success:
if verbose:
print(f"\n[Done] Notes splitting complete")