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(pptx-to-svg): preserve minimum line widths

hugohe3e4f2f799b97f
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index f9db1bcb..3b9503cf 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -992,6 +992,8 @@ fidelity.
PPTX import accepts `a:ln@w` only as an integer DrawingML `ST_LineWidth` value
from `0` through `20116800` EMU. Malformed, negative, or oversized source widths
stop import instead of being dropped and replaced by a default SVG line width.
+The EMU-to-pixel token retains enough decimal precision for the smallest
+positive legal width to remain non-zero and quantize back to its source EMU.
An explicit source `a:ln@cap` must be `flat`, `rnd`, or `sq`, which map to SVG
`butt`, `round`, and `square`; unknown values stop import instead of falling
back to the SVG default cap.
diff --git a/skills/ppt-master/scripts/pptx_to_svg/ln_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/ln_to_svg.py
index 7375eea1..18621f80 100644
--- a/skills/ppt-master/scripts/pptx_to_svg/ln_to_svg.py
+++ b/skills/ppt-master/scripts/pptx_to_svg/ln_to_svg.py
@@ -86,7 +86,7 @@ def resolve_stroke(
) from None
validate_ooxml_line_width(width_value)
width_px = emu_to_px(width_value)
- attrs["stroke-width"] = fmt_num(width_px, 3)
+ attrs["stroke-width"] = fmt_num(width_px, 5)
# Cap
cap = ln.attrib.get("cap")
diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.py
index f8252f81..25cb766c 100644
--- a/skills/ppt-master/scripts/test_svg_quality_checker.py
+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py
@@ -2665,6 +2665,22 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
with self.assertRaisesRegex(ValueError, expected):
resolve_stroke(sp_pr, None)
+ def test_minimum_positive_native_line_width_round_trips(self):
+ sp_pr = ET.fromstring('''
+<p:spPr xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
+ xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
+ <a:ln w="1"/>
+</p:spPr>''')
+ stroke = resolve_stroke(sp_pr, None)
+ width = stroke.attrs['stroke-width']
+ self.assertEqual(width, '0.0001')
+ line = ET.fromstring(
+ '<line xmlns="http://www.w3.org/2000/svg" '
+ f'stroke="#112233" stroke-width="{width}"/>'
+ )
+ stroke_xml = build_stroke_xml(line, ConvertContext())
+ self.assertIn('<a:ln w="1">', stroke_xml)
+
def test_unknown_native_line_cap_is_rejected_on_import(self):
sp_pr = ET.fromstring('''
<p:spPr xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"