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(scripts): fallback-placed chart companions anchor to the bottom so tall fonts move text up, not onto the plot
hugohe3fab747123117
diff --git a/skills/ppt-master/scripts/docs/native-data.md b/skills/ppt-master/scripts/docs/native-data.mdindex 5920b332..8efebb3a 100644--- a/skills/ppt-master/scripts/docs/native-data.md+++ b/skills/ppt-master/scripts/docs/native-data.md@@ -40,4 +40,4 @@ Cells accept `text`, `fill`, `fill_opacity`, `color`, `align` (`l` / `ctr` / `r`## §2 Chart chrome, typography, and color-SVG-first metadata matches the fallback chrome; JSON-first owns it. Metadata sizes use SVG px (`1px = 0.75pt`); `style.font_family` and `title_font_size`, `subtitle_font_size`, `axis_font_size`, `axis_title_font_size`, `legend_font_size`, `note_font_size` are required only when native must preserve typography an SVG-first fallback cannot supply unambiguously (JSON-first never infers from its preview). A string or unbounded-object `title` becomes native `c:title` (`subtitle` line two); a title object with complete `x`, `y`, `width`, `height` becomes a companion text box (partial bounds or `subtitle` fail); `name` names the object; `title`, `subtitle`, and axis-title objects accept `text`, `font_size`, `font_family`, `color`; the checker rejects SVG-first title/axis text absent from the fallback. Axis titles are explicit via `axis_titles` (`category`, `value`, `x`, `y`, `secondary_value`) or the root aliases `category_axis_title`, `value_axis_title`, `x_axis_title`, `y_axis_title`, `secondary_value_axis_title`; `show_value_axis_labels: false` hides numeric tick labels (e.g. a radar without radial coordinates); native legends are opt-in via `show_legend: true` and `legend_position` (`bottom` default; `top` / `left` / `right`). SVG-first parity reads the fallback literally — `style.axis_color` is the dominant stroke among elements whose id or class names `axis`, `style.grid_color` the dominant stroke among those naming `grid` / `gridline`, and a role with no labeled stroke falls back to the marker's dominant stroke (axis and grid lines in different colors need those labels or one steals the other's dominant); bar/column fills that are not a series or point colour, line-chart circles with no `lineMarker` / `point_colors` (or in a colour neither carries), translucent area fills without `fill_opacity`, a stroked line or markers over a single-type area, and a bar/column fallback whose first and last category labels contradict the resolved `axes.category.reverse` are each reported; numbers match in written form (`286.20` ≠ `286.2`; a payload `73.0` is stored as `73` and renders as `73` under General, so a fallback that shows `73.0` needs `number_format: "0.0"`; a `number_format` on `data_labels` or an axis makes its rendered form, such as `28.0` for `0.0`, an accepted variant), and marker text that is not a category, data label, axis label, or legend entry needs a companion entry. Companion text (`caption`, `source`, `note`, `notes`, `footnote`, `footnotes`) exports as editable text boxes — strings or objects with `text`, `x`, `y`, `width`, `height` (slide coordinates), `font_size`, `color`, `align`, `bold`; use it for captions, sources, center labels, and annotations, and `data_labels` for point values. On an SVG-first marker a companion whose text appears exactly once in the fallback is placed from that `<text>`: the box top sits one em above its baseline, `text-anchor` decides which edge `x` names and the paragraph alignment, and the payload keeps only `width` — so a `y` copied from the SVG baseline does not push the box onto the plot. JSON-first and unmatched companions use the payload box. `style.colors` sets series colors (treemap/sunburst tile palette in order); the exporter writes explicit chart-area fill, plot-area fill, axis, gridline, and label colors (SVG-first infers them from the largest panel `<rect>`, text, and strokes; JSON-first from JSON or stable defaults), overridable under `style` with `chart_area_fill`, `plot_area_fill`, `text_color`, `axis_color`, `grid_color` (`"none"` for transparent); generated payloads use uppercase `#RRGGBB`, with `#RGB`, `rgb()`, and CSS names normalized. Negative bars keep the series fill. The final checker reports every SVG-first parity finding as a warning tagged `(blocks --native-charts-and-tables export)`; that export refuses the same findings as errors, so clear them before exporting the native variant.+SVG-first metadata matches the fallback chrome; JSON-first owns it. Metadata sizes use SVG px (`1px = 0.75pt`); `style.font_family` and `title_font_size`, `subtitle_font_size`, `axis_font_size`, `axis_title_font_size`, `legend_font_size`, `note_font_size` are required only when native must preserve typography an SVG-first fallback cannot supply unambiguously (JSON-first never infers from its preview). A string or unbounded-object `title` becomes native `c:title` (`subtitle` line two); a title object with complete `x`, `y`, `width`, `height` becomes a companion text box (partial bounds or `subtitle` fail); `name` names the object; `title`, `subtitle`, and axis-title objects accept `text`, `font_size`, `font_family`, `color`; the checker rejects SVG-first title/axis text absent from the fallback. Axis titles are explicit via `axis_titles` (`category`, `value`, `x`, `y`, `secondary_value`) or the root aliases `category_axis_title`, `value_axis_title`, `x_axis_title`, `y_axis_title`, `secondary_value_axis_title`; `show_value_axis_labels: false` hides numeric tick labels (e.g. a radar without radial coordinates); native legends are opt-in via `show_legend: true` and `legend_position` (`bottom` default; `top` / `left` / `right`). SVG-first parity reads the fallback literally — `style.axis_color` is the dominant stroke among elements whose id or class names `axis`, `style.grid_color` the dominant stroke among those naming `grid` / `gridline`, and a role with no labeled stroke falls back to the marker's dominant stroke (axis and grid lines in different colors need those labels or one steals the other's dominant); bar/column fills that are not a series or point colour, line-chart circles with no `lineMarker` / `point_colors` (or in a colour neither carries), translucent area fills without `fill_opacity`, a stroked line or markers over a single-type area, and a bar/column fallback whose first and last category labels contradict the resolved `axes.category.reverse` are each reported; numbers match in written form (`286.20` ≠ `286.2`; a payload `73.0` is stored as `73` and renders as `73` under General, so a fallback that shows `73.0` needs `number_format: "0.0"`; a `number_format` on `data_labels` or an axis makes its rendered form, such as `28.0` for `0.0`, an accepted variant), and marker text that is not a category, data label, axis label, or legend entry needs a companion entry. Companion text (`caption`, `source`, `note`, `notes`, `footnote`, `footnotes`) exports as editable text boxes — strings or objects with `text`, `x`, `y`, `width`, `height` (slide coordinates), `font_size`, `color`, `align`, `bold`; use it for captions, sources, center labels, and annotations, and `data_labels` for point values. On an SVG-first marker a companion whose text appears exactly once in the fallback is placed from that `<text>`: the box is bottom-anchored with its bottom edge a quarter em under that baseline (so the glyph bottom lands where the SVG drew it whatever ascent the viewer's font has), `text-anchor` decides which edge `x` names and the paragraph alignment, and the payload keeps only `width` — so a `y` copied from the SVG baseline does not push the box onto the plot. JSON-first and unmatched companions use the payload box. `style.colors` sets series colors (treemap/sunburst tile palette in order); the exporter writes explicit chart-area fill, plot-area fill, axis, gridline, and label colors (SVG-first infers them from the largest panel `<rect>`, text, and strokes; JSON-first from JSON or stable defaults), overridable under `style` with `chart_area_fill`, `plot_area_fill`, `text_color`, `axis_color`, `grid_color` (`"none"` for transparent); generated payloads use uppercase `#RRGGBB`, with `#RGB`, `rgb()`, and CSS names normalized. Negative bars keep the series fill. The final checker reports every SVG-first parity finding as a warning tagged `(blocks --native-charts-and-tables export)`; that export refuses the same findings as errors, so clear them before exporting the native variant.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 a3c3041a..50c08a0c 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@@ -1395,6 +1395,7 @@ def _text_box_xml(align: str = "l",bold: bool = False,font_face: str | None = None,+ anchor: str = "t",) -> str:shape_id = ctx.next_id()align_key = _compact_key(align)@@ -1437,7 +1438,7 @@ def _text_box_xml(<a:ln><a:noFill/></a:ln></p:spPr><p:txBody>-<a:bodyPr wrap="square" lIns="0" tIns="0" rIns="0" bIns="0" anchor="t" anchorCtr="0"/>+<a:bodyPr wrap="square" lIns="0" tIns="0" rIns="0" bIns="0" anchor="{anchor}" anchorCtr="0"/><a:lstStyle/><a:p><a:pPr algn="{algn}"{rtl_attr}/><a:r><a:rPr lang="{lang}" sz="{font_size}"{bold_attr}>{run_properties_xml}</a:rPr><a:t>{_xml_escape(text)}</a:t></a:r>@@ -1549,10 +1550,11 @@ def _chart_companion_shapes("""Build editable companion text with its resolved slide-space bounds.With an SVG-first ``fallback``, a companion whose text appears exactly- once in the fallback takes that text's position: the box top sits one- em above the baseline and the anchor decides which edge ``x`` names,- so a payload ``y`` copied from the SVG baseline cannot land the box on- the plot.+ once in the fallback takes that text's position. The box is bottom+ anchored with its bottom edge a quarter em under the SVG baseline, so+ the glyph bottom lands where the SVG drew it whatever ascent the+ renderer's font has (a taller face moves the text up, never down onto+ the plot); ``text-anchor`` decides which edge ``x`` names."""if _chart_title_is_bounded(payload):include_title = True@@ -1608,6 +1610,7 @@ def _chart_companion_shapes(ext_cx = chart_ext_cxext_cy = px_to_emu(16)below_index += 1+ anchor = "t"matches = [record for record in fallback_textsif record.text == _normalized_fallback_text(text)@@ -1622,9 +1625,11 @@ def _chart_companion_shapes("middle": anchor_x - width_px / 2,"end": anchor_x - width_px,}.get(record.anchor, anchor_x)+ bottom_px = baseline_y + font_px * 0.25off_x = _powerpoint_emu_value(px_to_emu(left_px), "companion text x")- off_y = _powerpoint_emu_value(px_to_emu(baseline_y - font_px), "companion text y")- ext_cy = px_to_emu(font_px * 1.5)+ off_y = _powerpoint_emu_value(px_to_emu(bottom_px - font_px * 1.6), "companion text y")+ ext_cy = px_to_emu(font_px * 1.6)+ anchor = "b"align = {"middle": "ctr", "end": "r"}.get(record.anchor, "l")text_xml = _text_box_xml(ctx,@@ -1639,6 +1644,7 @@ def _chart_companion_shapes(align=align,bold=bold,font_face=font_face,+ anchor=anchor,)shapes.append(ShapeResult(xml=text_xml,diff --git a/skills/ppt-master/scripts/tests/test_native_chart_fidelity.py b/skills/ppt-master/scripts/tests/test_native_chart_fidelity.pyindex 21a41470..93b87ca2 100644--- a/skills/ppt-master/scripts/tests/test_native_chart_fidelity.py+++ b/skills/ppt-master/scripts/tests/test_native_chart_fidelity.py@@ -329,9 +329,15 @@ class CompanionPlacementTests(unittest.TestCase):resource_root=Path(tmp),native_objects=True,)+ from svg_to_pptx.drawingml.utils import px_to_emu+note = slide_xml[slide_xml.index("Chart Note"):]off_y = int(re.search(r'<a:off x="\d+" y="(\d+)"/>', note).group(1))- self.assertEqual(off_y, 102 * 9525) # baseline 120px minus one 18px em+ ext_cy = int(re.search(r'<a:ext cx="\d+" cy="(\d+)"/>', note).group(1))+ # bottom edge = baseline 120px + 0.25em; box 1.6em tall, bottom anchored+ self.assertEqual(off_y + ext_cy, px_to_emu(120 + 18 * 0.25))+ self.assertEqual(ext_cy, px_to_emu(18 * 1.6))+ self.assertIn('anchor="b"', note[:note.index("</a:bodyPr>") + 1] if "</a:bodyPr>" in note else note[:900])if __name__ == "__main__":