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(native_objects): inherit native chart typography from fallback
hugohe3e20c43675d3e
diff --git a/skills/ppt-master/references/executor-base.md b/skills/ppt-master/references/executor-base.mdindex be51027d..55a7146c 100644--- a/skills/ppt-master/references/executor-base.md+++ b/skills/ppt-master/references/executor-base.md@@ -234,7 +234,7 @@ grep "chart-plot-area" <project_path>/svg_output/<current_page>.svg- Native chrome: write axis titles or `show_legend: true` only when the fallback visibly renders them inside the native chart's replacement scope. Write `name` (page-semantic, e.g. `p03-revenue-chart`) and explicit `x`/`y`/`width`/`height` read from the drawn plot area; omission is the fallback — the exporter then infers the frame from the drawn fallback geometry.- Value-axis labels: when the fallback keeps category labels but intentionally omits numeric value-axis tick labels, set `show_value_axis_labels: false`.- Freeform chart text: transcribe center labels, source notes, and other in-chart annotations as companion `caption` / `note` / `notes` entries with explicit slide-coordinate bounds; do not rely on fallback `<text>` children to survive native export.-- Native chart typography mirrors the SVG fallback. Copy the fallback's shared chart font into `style.font_family` and visible chart text sizes into the matching metadata fields (`title_font_size`, `subtitle_font_size`, `axis_font_size`, `note_font_size`, etc.); when a visible chart title, subtitle, or axis title needs its own size/color/font, write that field as an object with `text`, `font_size`, `font_family`, and `color`. Use `axis_title_font_size`, `legend_font_size`, or companion per-entry `font_size` only when the fallback visibly uses a separate size. If a fallback role has no explicit size, use the compact three-tier chart defaults from [shared-standards.md](shared-standards.md).+- Native chart typography mirrors the SVG fallback. Copy the fallback's shared chart font into `style.font_family` and visible chart text sizes into the matching metadata fields (`title_font_size`, `subtitle_font_size`, `axis_font_size`, `note_font_size`, etc.) when role sizes differ; if omitted, the exporter infers shared font family and base chart text size from visible fallback text inside the native marker. When a visible chart title, subtitle, or axis title needs its own size/color/font, write that field as an object with `text`, `font_size`, `font_family`, and `color`. Use `axis_title_font_size`, `legend_font_size`, or companion per-entry `font_size` only when the fallback visibly uses a separate size. If a fallback role has no explicit size, use the compact three-tier chart defaults from [shared-standards.md](shared-standards.md).- Native table typography mirrors the SVG fallback. Write `style.font_family` and `style.font_size` from the visible table text; use `header_font_size` or per-cell `font_size` only when the fallback visibly does so. If the fallback has no explicit table font, fall back to the deck body family and locked body size from `spec_lock.md typography`.- The marker group's transform stays translate/scale only (no rotate / matrix / skew).- Visual parity is not a goal: the SVG drawing remains the designed visual; the native object is a data-editable counterpart with PowerPoint-default styling that users restyle by hand after export. Never simplify the SVG design to match what a native object could show.diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.mdindex b8a90040..844641c6 100644--- a/skills/ppt-master/references/shared-standards.md+++ b/skills/ppt-master/references/shared-standards.md@@ -799,7 +799,10 @@ match fallback `stroke-width`.fallback. Copy fallback chart text sizes into metadata using the same px-styleunit as SVG text (`1px = 0.75pt`). Put the shared visible chart font in`style.font_family`, and override local chart text objects or `data_labels`-with `font_family` only when the fallback visibly differs. Typical mappings are chart title+with `font_family` only when the fallback visibly differs. If omitted, the+exporter infers the shared font family and base chart text size from visible+fallback text inside the native marker, but explicit metadata remains the+stable contract when roles differ. Typical mappings are chart title(`title_font_size`), chart subtitle (`subtitle_font_size`), chart labels(`axis_font_size`, shared by axis titles / ticks / legend unless the fallbackdiffers), and notes (`note_font_size`). Use `axis_title_font_size`,diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/__init__.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/__init__.pyindex fc0a37c8..4549bcb1 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/__init__.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/__init__.py@@ -117,6 +117,7 @@ def _build_native_chart(elem: ET.Element, ctx: ConvertContext, payload: dict[strpayload,chart_rels_id="rId1",chart_data=chart_data,+ inherited_styles=ctx.inherited_styles,)ctx.package_files[chart_rels_part] = _chart_rels_xml(f"../embeddings/{workbook_name}")if chart_data["kind"] == "xy":@@ -139,8 +140,8 @@ def _build_native_chart(elem: ET.Element, ctx: ConvertContext, payload: dict[str</a:graphicData></a:graphic></p:graphicFrame>'''- text_sizes = _chart_text_sizes(payload)- chart_style = _classic_chart_style(payload, elem)+ text_sizes = _chart_text_sizes(payload, elem, ctx.inherited_styles)+ chart_style = _classic_chart_style(payload, elem, ctx.inherited_styles)companion_xml = _chart_companion_text_xml(ctx,payload,diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_style.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_style.pyindex 0a49df07..7460d214 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_style.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_style.py@@ -6,7 +6,7 @@ from typing import Anyfrom xml.etree import ElementTree as ETfrom ..drawingml.context import ConvertContext-from ..drawingml.utils import detect_text_lang, px_to_emu, _xml_escape+from ..drawingml.utils import detect_text_lang, parse_font_family, px_to_emu, _xml_escapefrom .chart_data import _DEFAULT_CHART_COLORSfrom .marker_common import (_bool_attr,@@ -21,10 +21,12 @@ from .marker_common import (_font_size_hpt,_hex_or_none,_inferred_chart_background,+ _local_tag,_maybe_number,_most_common_color,_number,_relative_luminance,+ _style_attr,)@@ -50,14 +52,76 @@ def _chart_style_color(return _hex_or_none(raw) or default-def _classic_chart_style(payload: dict[str, Any], elem: ET.Element) -> dict[str, str | None]:+def _fallback_text_attr_values(+ elem: ET.Element,+ attr: str,+ inherited_value: str | None = None,+) -> list[str]:+ tag = _local_tag(elem)+ if tag == "metadata" or tag in {"defs", "clipPath", "mask", "filter", "style"}:+ return []+ if elem.get("display") == "none" or elem.get("visibility") == "hidden":+ return []++ own_value = _style_attr(elem, attr)+ next_value = own_value if own_value is not None else inherited_value+ values: list[str] = []+ if tag in {"text", "tspan"} and next_value:+ values.append(str(next_value).strip())+ for child in elem:+ values.extend(_fallback_text_attr_values(child, attr, next_value))+ return values+++def _most_common_value(values: list[str]) -> str | None:+ if not values:+ return None+ counts: dict[str, int] = {}+ for value in values:+ counts[value] = counts.get(value, 0) + 1+ return max(counts.items(), key=lambda item: item[1])[0]+++def _most_common_font_size(values: list[str]) -> str | None:+ if not values:+ return None+ counts: dict[str, int] = {}+ for value in values:+ counts[value] = counts.get(value, 0) + 1+ max_count = max(counts.values())+ candidates = [value for value, count in counts.items() if count == max_count]+ numeric_candidates = [+ (float(value), value)+ for value in candidates+ if _maybe_number(value) is not None+ ]+ if numeric_candidates:+ return min(numeric_candidates, key=lambda item: item[0])[1]+ return candidates[0]+++def _classic_chart_style(+ payload: dict[str, Any],+ elem: ET.Element,+ inherited_styles: dict[str, str] | None = None,+) -> dict[str, str | None]:+ inherited_styles = inherited_styles or {}fallback_background = _inferred_chart_background(elem)- text_color = _most_common_color(_fallback_text_colors(elem)) or "404040"- stroke_colors = _fallback_stroke_colors(elem)+ text_color = _most_common_color(+ _fallback_text_colors(elem, inherited_styles.get("fill"))+ ) or "404040"+ stroke_colors = _fallback_stroke_colors(elem, inherited_styles.get("stroke"))darkest_stroke = min(stroke_colors, key=_relative_luminance) if stroke_colors else Nonelightest_stroke = max(stroke_colors, key=_relative_luminance) if stroke_colors else Noneraw_font_face = _chart_style_value(payload, "font_family", "fontFamily", "font_face", "fontFace")- font_face = str(raw_font_face).strip() if raw_font_face is not None else None+ fallback_font_face = _most_common_value(+ _fallback_text_attr_values(+ elem,+ "font-family",+ inherited_styles.get("font-family"),+ )+ )+ font_face = str(raw_font_face).strip() if raw_font_face is not None else fallback_font_faceaxis_color = darkest_stroke or text_colorgrid_color = (lightest_stroke@@ -104,8 +168,23 @@ def _classic_chart_style(payload: dict[str, Any], elem: ET.Element) -> dict[str,}-def _chart_text_sizes(payload: dict[str, Any]) -> dict[str, int]:+def _chart_text_sizes(+ payload: dict[str, Any],+ elem: ET.Element | None = None,+ inherited_styles: dict[str, str] | None = None,+) -> dict[str, int]:style = payload.get("style") if isinstance(payload.get("style"), dict) else {}+ inherited_styles = inherited_styles or {}+ fallback_font_size = (+ _most_common_font_size(+ _fallback_text_attr_values(+ elem,+ "font-size",+ inherited_styles.get("font-size"),+ )+ )+ if elem is not None else None+ )base_raw = _first_present(payload.get("font_size"),payload.get("chart_font_size"),@@ -113,6 +192,7 @@ def _chart_text_sizes(payload: dict[str, Any]) -> dict[str, int]:style.get("font_size"),style.get("chart_font_size"),style.get("chartFontSize"),+ fallback_font_size,)axis_raw = _first_present(payload.get("axis_font_size"),@@ -201,8 +281,10 @@ def _major_gridlines_xml(color: str | None) -> str:def _font_face_xml(font_face: str | None) -> str:if not font_face:return ""- clean_font = _xml_escape(font_face)- return f'<a:latin typeface="{clean_font}"/><a:ea typeface="{clean_font}"/>'+ fonts = parse_font_family(font_face)+ latin_font = _xml_escape(fonts["latin"])+ ea_font = _xml_escape(fonts["ea"])+ return f'<a:latin typeface="{latin_font}"/><a:ea typeface="{ea_font}"/>'def _chart_tx_pr_xml(@@ -355,6 +437,7 @@ def _text_box_xml(color: str | None,align: str = "l",bold: bool = False,+ font_face: str | None = None,) -> str:shape_id = ctx.next_id()align_key = _compact_key(align)@@ -390,7 +473,7 @@ def _text_box_xml(<a:bodyPr wrap="square" lIns="0" tIns="0" rIns="0" bIns="0" anchor="t" anchorCtr="0"/><a:lstStyle/><a:p><a:pPr algn="{algn}"/>-<a:r><a:rPr lang="{lang}" sz="{font_size}"{bold_attr}>{fill_xml}</a:rPr><a:t>{_xml_escape(text)}</a:t></a:r>+<a:r><a:rPr lang="{lang}" sz="{font_size}"{bold_attr}>{fill_xml}{_font_face_xml(font_face)}</a:rPr><a:t>{_xml_escape(text)}</a:t></a:r></a:p></p:txBody></p:sp>'''@@ -462,6 +545,7 @@ def _chart_companion_text_xml(font_size = note_font_sizecolor = _hex_or_none(item.get("color")) or chart_style.get("text_color")+ font_face = _chart_text_entry_font_face(item, chart_style.get("font_face"))align = str(item.get("align") or ("ctr" if role == "title" else "l"))bold = bool(item.get("bold", role == "title"))has_box = all(_maybe_number(item.get(key)) is not None for key in ("x", "y", "width", "height"))@@ -493,5 +577,6 @@ def _chart_companion_text_xml(color=color,align=align,bold=bold,+ font_face=font_face,))return "".join(parts)diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.pyindex f560e1b3..faececa0 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.py@@ -1140,6 +1140,7 @@ def _chart_xml(*,chart_rels_id: str,chart_data: dict[str, Any],+ inherited_styles: dict[str, str] | None = None,) -> bytes:style = payload.get("style") if isinstance(payload.get("style"), dict) else {}colors = (@@ -1147,9 +1148,9 @@ def _chart_xml(if isinstance(style.get("colors"), list)else [])- text_sizes = _chart_text_sizes(payload)+ text_sizes = _chart_text_sizes(payload, elem, inherited_styles)axis_titles = _axis_titles(payload)- chart_style = _classic_chart_style(payload, elem)+ chart_style = _classic_chart_style(payload, elem, inherited_styles)plot_xml = _chart_plot_xml(chart_data,colors,