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

feat(svg_to_pptx): add glow effect, stroke-linejoin, and text-decoration support

hugohe30e99c2e3c7bd
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index dc977f16..2bfd9fca 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -113,7 +113,7 @@ python3 scripts/svg_to_pptx.py <project_path> -s final
#### Filter Soft Shadow — Recommended
-Best for: cards, floating panels, elevated elements. `svg_to_shapes.py` automatically converts `feGaussianBlur` + `feOffset` into native PPTX `<a:outerShdw>`.
+Best for: cards, floating panels, elevated elements. The `svg_to_pptx` converter automatically converts `feGaussianBlur` + `feOffset` into native PPTX `<a:outerShdw>`.
```xml
<defs>
@@ -158,6 +158,34 @@ Best for: accent buttons, brand-colored cards. Use the element's own color famil
Replace `flood-color` with the element's brand color; keep `flood-opacity` between 0.12–0.20.
+#### Glow Effect
+
+Best for: title highlights, key metrics, hero text. The converter automatically converts `feGaussianBlur` without `feOffset` into native PPTX `<a:glow>`.
+
+```xml
+<defs>
+ <filter id="titleGlow" x="-30%" y="-30%" width="160%" height="160%">
+ <feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/>
+ <feFlood flood-color="#1A73E8" flood-opacity="0.40" result="glowColor"/>
+ <feComposite in="glowColor" in2="blur" operator="in" result="glow"/>
+ <feMerge>
+ <feMergeNode in="glow"/>
+ <feMergeNode in="SourceGraphic"/>
+ </feMerge>
+ </filter>
+</defs>
+<text x="640" y="360" text-anchor="middle" font-size="48" fill="#1A73E8" filter="url(#titleGlow)">Key Insight</text>
+```
+
+Recommended parameters:
+```
+stdDeviation: 2–5 (smaller = subtle, larger = prominent)
+flood-color: brand color or accent color (NOT black)
+flood-opacity: 0.25–0.50 (stronger than shadow for visibility)
+```
+
+**Key difference from shadow**: No `<feOffset>` element (or dx=0/dy=0). The converter uses this to distinguish glow from shadow.
+
#### Layered Rect Shadow — High-Compatibility Fallback
Best for: maximum compatibility with older PowerPoint versions. Stack 2–3 semi-transparent rectangles behind the main card:
@@ -237,6 +265,7 @@ Best for: slides needing strong visual brand identity.
|----------|-----------------------|-------|
| Card / panel shadow | Filter soft shadow (`flood-opacity` ≤ 0.12) | Hard black shadow |
| Accent / CTA button | Colored shadow (same hue family) | Generic gray shadow |
+| Title / metric highlight | Glow filter (brand color, no offset) | Overuse on body text |
| Text over image | Linear gradient overlay (direction matches text side) | Uniform flat opacity over whole image |
| Cover / full-image slide | Bottom gradient bar + brand color | Solid black overlay |
| Atmosphere / hero slide | Radial vignette | Unprocessed raw image |
@@ -244,7 +273,44 @@ Best for: slides needing strong visual brand identity.
---
-## 7. Project Directory Structure
+## 7. Stroke & Text Decoration
+
+### stroke-linejoin
+
+Controls how line segments join at corners. Supported values convert to native PPTX line join types:
+
+| SVG Value | PPTX Equivalent | Best For |
+|-----------|-----------------|----------|
+| `round` | Round join | Smooth polyline charts, organic shapes |
+| `bevel` | Bevel join | Technical diagrams |
+| `miter` | Miter join (default) | Sharp-cornered rectangles, arrows |
+
+```xml
+<polyline points="100,200 200,100 300,200" fill="none"
+ stroke="#1A73E8" stroke-width="3" stroke-linejoin="round"/>
+```
+
+### text-decoration
+
+Supported text decorations convert to native PPTX text formatting:
+
+| SVG Value | PPTX Equivalent | Best For |
+|-----------|-----------------|----------|
+| `underline` | Single underline | Emphasis, links, key terms |
+| `line-through` | Strikethrough | Removed items, before/after comparisons |
+
+```xml
+<text x="100" y="200" font-size="20" fill="#333333" text-decoration="underline">Important Term</text>
+
+<!-- Per-tspan decoration -->
+<text x="100" y="240" font-size="18" fill="#333333">
+ Regular text <tspan text-decoration="line-through" fill="#999999">old value</tspan> new value
+</text>
+```
+
+---
+
+## 8. Project Directory Structure
```
project/
diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py
index eef8b27f..32a3da22 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py
@@ -11,7 +11,7 @@ from .drawingml_utils import (
SVG_NS,
_extract_inheritable_styles, resolve_url_id,
)
-from .drawingml_styles import build_shadow_xml
+from .drawingml_styles import build_effect_xml
from .drawingml_elements import (
convert_rect, convert_circle, convert_ellipse,
convert_line, convert_path,
@@ -125,7 +125,7 @@ def convert_g(elem: ET.Element, ctx: ConvertContext) -> str:
group_effect = ''
if filter_id and filter_id in ctx.defs:
- group_effect = build_shadow_xml(ctx.defs[filter_id])
+ group_effect = build_effect_xml(ctx.defs[filter_id])
return f'''<p:grpSp>
<p:nvGrpSpPr>
diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py
index f65fdc28..7747ff94 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py
@@ -19,7 +19,7 @@ from .drawingml_utils import (
)
from .drawingml_styles import (
build_solid_fill, build_gradient_fill,
- build_fill_xml, build_stroke_xml, build_shadow_xml,
+ build_fill_xml, build_stroke_xml, build_effect_xml,
get_fill_opacity, get_stroke_opacity,
)
from .drawingml_paths import (
@@ -76,7 +76,7 @@ def convert_rect(elem: ET.Element, ctx: ConvertContext) -> str:
effect = ''
filt_id = get_effective_filter_id(elem, ctx)
if filt_id and filt_id in ctx.defs:
- effect = build_shadow_xml(ctx.defs[filt_id])
+ effect = build_effect_xml(ctx.defs[filt_id])
geom = '<a:prstGeom prst="rect"><a:avLst/></a:prstGeom>'
@@ -238,7 +238,7 @@ def convert_circle(elem: ET.Element, ctx: ConvertContext) -> str:
effect = ''
filt_id = get_effective_filter_id(elem, ctx)
if filt_id and filt_id in ctx.defs:
- effect = build_shadow_xml(ctx.defs[filt_id])
+ effect = build_effect_xml(ctx.defs[filt_id])
shape_id = ctx.next_id()
return _wrap_shape(
@@ -266,7 +266,7 @@ def convert_circle(elem: ET.Element, ctx: ConvertContext) -> str:
effect = ''
filt_id = get_effective_filter_id(elem, ctx)
if filt_id and filt_id in ctx.defs:
- effect = build_shadow_xml(ctx.defs[filt_id])
+ effect = build_effect_xml(ctx.defs[filt_id])
geom = '<a:prstGeom prst="ellipse"><a:avLst/></a:prstGeom>'
@@ -375,7 +375,7 @@ def convert_path(elem: ET.Element, ctx: ConvertContext) -> str:
effect = ''
filt_id = get_effective_filter_id(elem, ctx)
if filt_id and filt_id in ctx.defs:
- effect = build_shadow_xml(ctx.defs[filt_id])
+ effect = build_effect_xml(ctx.defs[filt_id])
shape_id = ctx.next_id()
return _wrap_shape(
@@ -529,6 +529,8 @@ def _build_text_runs(
run_attrs['font_family'] = child.get('font-family')
if child.get('font-style'):
run_attrs['font_style'] = child.get('font-style')
+ if child.get('text-decoration'):
+ run_attrs['text_decoration'] = child.get('text-decoration')
runs.append({**run_attrs, 'text': t})
# Tail text after </tspan> belongs to parent
@@ -555,9 +557,13 @@ def _build_run_xml(
ff = run.get('font_family', '')
opacity = run.get('opacity')
+ text_dec = run.get('text_decoration', '')
+
sz = round(fs_px * FONT_PX_TO_HUNDREDTHS_PT)
b_attr = ' b="1"' if fw in ('bold', '600', '700', '800', '900') else ''
i_attr = ' i="1"' if fstyle == 'italic' else ''
+ u_attr = ' u="sng"' if 'underline' in text_dec else ''
+ strike_attr = ' strike="sngStrike"' if 'line-through' in text_dec else ''
fonts = parse_font_family(ff) if ff else default_fonts
@@ -572,7 +578,7 @@ def _build_run_xml(
fill_xml = f'<a:solidFill><a:srgbClr val="{fill}">{alpha_xml}</a:srgbClr></a:solidFill>'
return f'''<a:r>
-<a:rPr lang="zh-CN" sz="{sz}"{b_attr}{i_attr} dirty="0">
+<a:rPr lang="zh-CN" sz="{sz}"{b_attr}{i_attr}{u_attr}{strike_attr} dirty="0">
{fill_xml}
<a:latin typeface="{_xml_escape(fonts['latin'])}"/>
<a:ea typeface="{_xml_escape(fonts['ea'])}"/>
@@ -594,6 +600,7 @@ def convert_text(elem: ET.Element, ctx: ConvertContext) -> str:
fill_color = parse_hex_color(fill_raw) or '000000'
opacity = get_fill_opacity(elem, ctx)
font_style = _get_attr(elem, 'font-style', ctx) or ''
+ text_decoration = _get_attr(elem, 'text-decoration', ctx) or ''
fonts = parse_font_family(font_family_str)
@@ -604,6 +611,7 @@ def convert_text(elem: ET.Element, ctx: ConvertContext) -> str:
'font_size': font_size,
'font_family': font_family_str,
'font_style': font_style,
+ 'text_decoration': text_decoration,
'opacity': opacity,
}
runs = _build_text_runs(elem, parent_attrs)
@@ -658,7 +666,7 @@ def convert_text(elem: ET.Element, ctx: ConvertContext) -> str:
effect_xml = ''
filt_id = get_effective_filter_id(elem, ctx)
if filt_id and filt_id in ctx.defs:
- effect_xml = build_shadow_xml(ctx.defs[filt_id])
+ effect_xml = build_effect_xml(ctx.defs[filt_id])
shape_id = ctx.next_id()
rot_attr = f' rot="{text_rot}"' if text_rot else ''
diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml_styles.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml_styles.py
index 4148efa4..882c839a 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml_styles.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml_styles.py
@@ -161,11 +161,21 @@ def build_stroke_xml(
if linecap and linecap in cap_map:
cap_attr = f' cap="{cap_map[linecap]}"'
+ # Line join
+ join_xml = ''
+ linejoin = _get_attr(elem, 'stroke-linejoin', ctx)
+ if linejoin == 'round':
+ join_xml = '<a:round/>'
+ elif linejoin == 'bevel':
+ join_xml = '<a:bevel/>'
+ elif linejoin == 'miter':
+ join_xml = '<a:miter lim="800000"/>'
+
# Gradient stroke
grad_id = resolve_url_id(stroke)
if grad_id and grad_id in ctx.defs:
grad_fill = build_gradient_fill(ctx.defs[grad_id], opacity)
- return f'<a:ln w="{width_emu}"{cap_attr}>{grad_fill}{dash_xml}</a:ln>'
+ return f'<a:ln w="{width_emu}"{cap_attr}>{grad_fill}{dash_xml}{join_xml}</a:ln>'
# Solid color stroke
color = parse_hex_color(stroke)
@@ -177,20 +187,24 @@ def build_stroke_xml(
alpha_xml = f'<a:alpha val="{int(opacity * 100000)}"/>'
return f'''<a:ln w="{width_emu}"{cap_attr}>
-<a:solidFill><a:srgbClr val="{color}">{alpha_xml}</a:srgbClr></a:solidFill>{dash_xml}
+<a:solidFill><a:srgbClr val="{color}">{alpha_xml}</a:srgbClr></a:solidFill>{dash_xml}{join_xml}
</a:ln>'''
-def build_shadow_xml(filter_elem: ET.Element) -> str:
- """Build <a:effectLst> with <a:outerShdw> from SVG filter element."""
- if filter_elem is None:
- return ''
+def _parse_filter_params(
+ filter_elem: ET.Element,
+) -> dict[str, float | str]:
+ """Extract common parameters from an SVG filter element.
+ Returns:
+ Dict with keys: std_dev, dx, dy, opacity, color, has_offset.
+ """
std_dev = 4.0
dx = 0.0
- dy = 4.0
- shadow_opacity = 0.3
- shadow_color = '000000'
+ dy = 0.0
+ opacity = 0.3
+ color = '000000'
+ has_offset = False
for child in filter_elem.iter():
tag = child.tag.replace(f'{{{SVG_NS}}}', '')
@@ -198,28 +212,85 @@ def build_shadow_xml(filter_elem: ET.Element) -> str:
std_dev = _f(child.get('stdDeviation'), 4.0)
elif tag == 'feOffset':
dx = _f(child.get('dx'), 0.0)
- dy = _f(child.get('dy'), 4.0)
+ dy = _f(child.get('dy'), 0.0)
+ if abs(dx) > 0.01 or abs(dy) > 0.01:
+ has_offset = True
elif tag == 'feFlood':
- shadow_opacity = _f(child.get('flood-opacity'), 0.3)
+ opacity = _f(child.get('flood-opacity'), 0.3)
raw_color = child.get('flood-color', '').strip().lstrip('#')
if len(raw_color) == 6 and all(c in '0123456789abcdefABCDEF' for c in raw_color):
- shadow_color = raw_color.upper()
+ color = raw_color.upper()
elif tag == 'feFuncA':
if child.get('type') == 'linear':
- shadow_opacity = _f(child.get('slope'), 0.3)
+ opacity = _f(child.get('slope'), 0.3)
+
+ return {
+ 'std_dev': std_dev, 'dx': dx, 'dy': dy,
+ 'opacity': opacity, 'color': color, 'has_offset': has_offset,
+ }
+
+
+def build_shadow_xml(filter_elem: ET.Element) -> str:
+ """Build <a:effectLst> with <a:outerShdw> from SVG filter element."""
+ if filter_elem is None:
+ return ''
+
+ p = _parse_filter_params(filter_elem)
+ std_dev = p['std_dev']
+ dx = p['dx']
+ dy = p['dy']
+ # For shadow, default dy to 4 if no offset was found
+ if not p['has_offset']:
+ dy = 4.0
blur_rad = px_to_emu(std_dev * 2)
dist = px_to_emu(math.sqrt(dx * dx + dy * dy))
dir_angle = int(((90 + math.degrees(math.atan2(dy, max(dx, 0.001)))) % 360) * ANGLE_UNIT)
- alpha_val = int(shadow_opacity * 100000)
+ alpha_val = int(p['opacity'] * 100000)
return f'''<a:effectLst>
<a:outerShdw blurRad="{blur_rad}" dist="{dist}" dir="{dir_angle}" algn="tl" rotWithShape="0">
-<a:srgbClr val="{shadow_color}"><a:alpha val="{alpha_val}"/></a:srgbClr>
+<a:srgbClr val="{p['color']}"><a:alpha val="{alpha_val}"/></a:srgbClr>
</a:outerShdw>
</a:effectLst>'''
+def build_glow_xml(filter_elem: ET.Element) -> str:
+ """Build <a:effectLst> with <a:glow> from SVG filter element.
+
+ Used for filters that have feGaussianBlur without meaningful feOffset,
+ typically title glow or highlight effects.
+ """
+ if filter_elem is None:
+ return ''
+
+ p = _parse_filter_params(filter_elem)
+ rad = px_to_emu(p['std_dev'] * 2)
+ alpha_val = int(p['opacity'] * 100000)
+
+ return f'''<a:effectLst>
+<a:glow rad="{rad}">
+<a:srgbClr val="{p['color']}"><a:alpha val="{alpha_val}"/></a:srgbClr>
+</a:glow>
+</a:effectLst>'''
+
+
+def build_effect_xml(filter_elem: ET.Element) -> str:
+ """Build effect XML by classifying the SVG filter as shadow or glow.
+
+ Classification rules:
+ - feOffset with non-zero dx/dy → outer shadow
+ - No feOffset or zero offset → glow effect
+ """
+ if filter_elem is None:
+ return ''
+
+ p = _parse_filter_params(filter_elem)
+ if p['has_offset']:
+ return build_shadow_xml(filter_elem)
+ return build_glow_xml(filter_elem)
+
+
def get_element_opacity(elem: ET.Element) -> float | None:
"""Get opacity value from element. Returns None if 1.0 or not set."""
op = elem.get('opacity')
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 2e7a8c9a..a4d0c84f 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml_utils.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml_utils.py
@@ -21,9 +21,9 @@ ANGLE_UNIT = 60000 # DrawingML angle: 60000ths of a degree
# SVG attributes inheritable from parent <g>
INHERITABLE_ATTRS = [
'fill', 'stroke', 'stroke-width', 'stroke-dasharray', 'stroke-linecap',
- 'opacity', 'fill-opacity', 'stroke-opacity',
+ 'stroke-linejoin', 'opacity', 'fill-opacity', 'stroke-opacity',
'font-family', 'font-size', 'font-weight', 'font-style',
- 'text-anchor', 'letter-spacing',
+ 'text-anchor', 'letter-spacing', 'text-decoration',
]
# Known East Asian fonts