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): reject inside-aligned outlines

hugohe3907740d4d08b
diff --git a/docs/powerpoint-svg-mapping.md b/docs/powerpoint-svg-mapping.md
index 950f70c3..bb521ce8 100644
--- a/docs/powerpoint-svg-mapping.md
+++ b/docs/powerpoint-svg-mapping.md
@@ -155,6 +155,7 @@ preset selection and authoring behavior are documented in
| No outline | `stroke="none"` or the registered absence of a line | `a:noFill` under `a:ln` | `Native-stable` | Do not simulate absence with zero-width ambiguous CSS |
| Solid outline | Registered `stroke` and width | Native `a:ln` | `Native-stable` | Width and paint must use canonical units/grammar |
| Compound outline | No registered single-stroke SVG representation | Explicit geometry alternative or baked asset | `Bake-required` for the compound-line identity | PPTX import accepts only omitted/`sng` `cmpd`; other source values stop instead of becoming a single line |
+| Inside-aligned outline | No registered ordinary SVG stroke representation | Explicit inset geometry or baked asset | `Bake-required` for exact outline alignment | PPTX import accepts only omitted/`ctr` `algn`; `in` stops instead of becoming a centered stroke |
| Outline scaling under transforms | Exact `vector-effect="none"` or `vector-effect="non-scaling-stroke"` | Choice resolved into native line width | `Native-normalized` | Other values are rejected; generated spelling is exact and lowercase |
| Dashed or dotted outline | Registered dash array | Preset or custom DrawingML dash | `Native-normalized` | Unsupported dash semantics are rejected |
| Line cap and join | Registered cap/join values | Native line cap/join properties | `Native-stable` | Only documented values are accepted |
diff --git a/docs/zh/powerpoint-svg-mapping.md b/docs/zh/powerpoint-svg-mapping.md
index 933b9e56..50883761 100644
--- a/docs/zh/powerpoint-svg-mapping.md
+++ b/docs/zh/powerpoint-svg-mapping.md
@@ -150,6 +150,7 @@ PowerPoint 意图
| 无轮廓 | `stroke="none"` 或已登记线缺省 | `a:ln` 内的 `a:noFill` | `Native-stable` | 不得用零线宽模糊 CSS 模拟缺省 |
| 实线轮廓 | 已登记 `stroke` 与宽度 | 原生 `a:ln` | `Native-stable` | 宽度与 paint 必须使用规范单位/语法 |
| 复合轮廓线 | 无已登记的单一 SVG stroke 表达 | 显式几何替代或烘焙资产 | 复合线身份为 `Bake-required` | PPTX 回导仅接受省略/`sng` 的 `cmpd`;其他源值会阻断,不得退化为单线 |
+| 内侧对齐轮廓 | 无已登记的普通 SVG stroke 表达 | 显式内缩几何或烘焙资产 | 精确轮廓对齐为 `Bake-required` | PPTX 回导仅接受省略/`ctr` 的 `algn`;`in` 会阻断,不得退化为居中描边 |
| transform 下的轮廓缩放 | 精确的 `vector-effect="none"` 或 `vector-effect="non-scaling-stroke"` | 选择被解析为原生线宽 | `Native-normalized` | 拒绝其他取值;生成拼法必须精确且为小写 |
| 虚线或点线轮廓 | 已登记 dash array | 预设或自定义 DrawingML dash | `Native-normalized` | 拒绝不支持的 dash 语义 |
| 线端与连接样式 | 已登记 cap/join 值 | 原生 line cap/join 属性 | `Native-stable` | 仅接受文档化取值 |
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index 210e58d7..13ebd626 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -997,6 +997,9 @@ positive legal width to remain non-zero and quantize back to its source EMU.
PPTX import accepts an omitted `a:ln@cmpd` or explicit `sng`. Other compound
line values (`dbl`, `thickThin`, `thinThick`, `tri`) have no registered
single-stroke SVG mapping and stop import instead of becoming an ordinary line.
+PPTX import likewise accepts an omitted `a:ln@algn` or explicit `ctr`.
+Inside-aligned (`in`) and unknown source values stop import because an ordinary
+SVG stroke is centered and cannot preserve the source outline boundary.
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 371ab3e9..8d1d5595 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
@@ -80,6 +80,11 @@ def resolve_stroke(
raise ValueError(
f"Unsupported DrawingML compound line: {compound!r}"
)
+ alignment = ln.attrib.get("algn")
+ if alignment not in {None, "ctr"}:
+ raise ValueError(
+ f"Unsupported DrawingML line alignment: {alignment!r}"
+ )
# Width (a:ln@w in EMU)
width_emu = ln.attrib.get("w")
diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.py
index 4e644c1a..8088ef97 100644
--- a/skills/ppt-master/scripts/test_svg_quality_checker.py
+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py
@@ -2702,6 +2702,27 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
</p:spPr>''')
self.assertEqual(resolve_stroke(single, None).attrs, {})
+ def test_noncentered_native_line_is_rejected_on_import(self):
+ for alignment in ('in', 'futureAlignment'):
+ with self.subTest(alignment=alignment):
+ sp_pr = ET.fromstring(f'''
+<p:spPr xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
+ xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
+ <a:ln algn="{alignment}"/>
+</p:spPr>''')
+ with self.assertRaisesRegex(
+ ValueError,
+ f"Unsupported DrawingML line alignment: '{alignment}'",
+ ):
+ resolve_stroke(sp_pr, None)
+
+ centered = ET.fromstring('''
+<p:spPr xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
+ xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
+ <a:ln algn="ctr"/>
+</p:spPr>''')
+ self.assertEqual(resolve_stroke(centered, None).attrs, {})
+
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"