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(ppt): preserve SVG text stroke in native export
hugohe3fbcc0abdcb95
diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.pyindex b5c3845b..2da71a05 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py@@ -811,6 +811,15 @@ def _override_run_attrs(c = parse_hex_color(child_fill)if c:run_attrs['fill'] = c+ if tspan.get('stroke'):+ run_attrs['stroke_raw'] = tspan.get('stroke')+ if tspan.get('stroke-width'):+ run_attrs['stroke_width'] = _f(tspan.get('stroke-width'), run_attrs.get('stroke_width', 1.0))+ if tspan.get('stroke-opacity'):+ try:+ run_attrs['stroke_opacity'] = float(tspan.get('stroke-opacity', '1'))+ except ValueError:+ passif tspan.get('font-size'):run_attrs['font_size'] = _f(tspan.get('font-size'), run_attrs['font_size'])if tspan.get('font-family'):@@ -889,6 +898,49 @@ def _build_text_runs(return runs+def _build_text_fill_xml(+ fill: str,+ fill_raw: str,+ opacity: float | None,+ ctx: ConvertContext | None,+) -> str:+ """Build DrawingML fill XML for a text run."""+ if fill_raw == 'none':+ return '<a:noFill/>'++ grad_id = resolve_url_id(fill_raw)+ if grad_id and ctx and grad_id in ctx.defs:+ return build_gradient_fill(ctx.defs[grad_id], opacity)++ alpha_xml = ''+ if opacity is not None and opacity < 1.0:+ alpha_xml = f'<a:alpha val="{int(opacity * 100000)}"/>'+ return f'<a:solidFill><a:srgbClr val="{fill}">{alpha_xml}</a:srgbClr></a:solidFill>'+++def _build_text_outline_xml(run: dict[str, Any]) -> str:+ """Build DrawingML outline XML for a text run from SVG stroke attributes."""+ stroke_raw = run.get('stroke_raw')+ if not stroke_raw or stroke_raw == 'none':+ return ''++ color = parse_hex_color(stroke_raw)+ if not color:+ return ''++ stroke_width = _f(str(run.get('stroke_width', 1.0)), 1.0)+ stroke_opacity = run.get('stroke_opacity')+ alpha_xml = ''+ if stroke_opacity is not None and stroke_opacity < 1.0:+ alpha_xml = f'<a:alpha val="{int(stroke_opacity * 100000)}"/>'++ return (+ f'<a:ln w="{px_to_emu(stroke_width)}">'+ f'<a:solidFill><a:srgbClr val="{color}">{alpha_xml}</a:srgbClr></a:solidFill>'+ '</a:ln>'+ )++def _build_run_xml(run: dict[str, Any],default_fonts: dict[str, str],@@ -915,20 +967,14 @@ def _build_run_xml(fonts = parse_font_family(ff) if ff else default_fonts- # Build fill XML - gradient or solid- grad_id = resolve_url_id(fill_raw)- if grad_id and ctx and grad_id in ctx.defs:- fill_xml = build_gradient_fill(ctx.defs[grad_id], opacity)- else:- alpha_xml = ''- if opacity is not None and opacity < 1.0:- alpha_xml = f'<a:alpha val="{int(opacity * 100000)}"/>'- fill_xml = f'<a:solidFill><a:srgbClr val="{fill}">{alpha_xml}</a:srgbClr></a:solidFill>'+ fill_xml = _build_text_fill_xml(fill, fill_raw, opacity, ctx)+ outline_xml = _build_text_outline_xml(run)space_attr = ' xml:space="preserve"' if text != text.strip() or ' ' in text else ''return f'''<a:r><a:rPr lang="zh-CN" sz="{sz}"{b_attr}{i_attr}{u_attr}{strike_attr} dirty="0">+{outline_xml}{fill_xml}{effect_xml}<a:latin typeface="{_xml_escape(fonts['latin'])}"/>@@ -950,6 +996,9 @@ def convert_text(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:fill_raw = _get_attr(elem, 'fill', ctx) or '#000000'fill_color = parse_hex_color(fill_raw) or '000000'opacity = get_fill_opacity(elem, ctx)+ stroke_raw = _get_attr(elem, 'stroke', ctx) or ''+ stroke_width = _f(_get_attr(elem, 'stroke-width', ctx), 1.0)+ stroke_opacity = get_stroke_opacity(elem, ctx)font_style = _get_attr(elem, 'font-style', ctx) or ''text_decoration = _get_attr(elem, 'text-decoration', ctx) or ''@@ -964,6 +1013,9 @@ def convert_text(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:'font_style': font_style,'text_decoration': text_decoration,'opacity': opacity,+ 'stroke_raw': stroke_raw,+ 'stroke_width': stroke_width,+ 'stroke_opacity': stroke_opacity,}runs = _build_text_runs(elem, parent_attrs)