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(svg_to_pptx): treat digits as tabular width in estimate_text_width

Haoyang Pangde4ac4bf04e3
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 356733cb..3919cb88 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml_utils.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml_utils.py
@@ -449,10 +449,15 @@ def estimate_text_width(text: str, font_size: float, font_weight: str = '400') -
width += font_size
elif ch == ' ':
width += font_size * 0.3
- elif ch in 'mMwWOQ':
+ elif ch in 'mMwWOQ%':
width += font_size * 0.75
- elif ch in 'iIlj1!|':
+ elif ch in 'iIlj!|':
width += font_size * 0.3
+ elif ch.isdigit():
+ # digits are tabular (uniform ~0.55em) in most UI fonts, including
+ # '1' — classing it with 'il|' under-sizes the box and makes
+ # renderers that ignore wrap="none" (LibreOffice) wrap the line
+ width += font_size * 0.55
else:
width += font_size * 0.55