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(svg-to-pptx): reject invalid text sizes before packaging
hugohe31793859682d0
diff --git a/skills/ppt-master/references/executor-base.md b/skills/ppt-master/references/executor-base.mdindex c8cca775..273c1940 100644--- a/skills/ppt-master/references/executor-base.md+++ b/skills/ppt-master/references/executor-base.md@@ -108,6 +108,8 @@ This section applies only to deck/layout template routes. `page_layouts` selects**Composite proxy fallback**: A genuinely composite region may use a direct `<g data-pptx-placeholder="object" data-pptx-placeholder-binding="proxy">` with positive bounds. Its visible group remains Slide-local and export creates one hidden transparent matching placeholder proxy. This downgrade is valid only for `object`; do not use it for an ordinary title, body, picture, chart, table, or media slot.+**Forbidden — dummy carriers**: Never satisfy a carrier slot with tiny text, near-transparent glyphs, background-colored punctuation, or other fake content. Leave an intentionally blank text carrier empty/whitespace-only—the exporter emits a legal invisible U+200B run—or use the composite `object` proxy contract. If `strict` prototype binding cannot represent the completed composition, surface the mismatch; select a compatible prototype or create an explicit adaptive Layout instead of hiding the conflict.+**Zero-slot Layout**: A Layout may have no slot groups. Covers, posters, and fixed visual pages still declare their named Master/Layout and fixed atoms. Do not manufacture a full-page `object` slot or empty `utility` identity.**Mandatory — per-page slot coverage**: On every mapped page, declare a slot for each standard role the page actually has: the page heading as `title`, a cover tagline as `subtitle`, the page number as `slide-number`, running footer text as `footer`, a hero / content image as `picture`, and a body block already authored as one merged text frame as `body`. A page shipping zero slots exports a Layout with no insertable placeholders — valid only for a genuinely fixed composition (see Zero-slot Layout above), never as the deck-wide default. Pages sharing one layout key ship the same slot set.diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.mdindex 0fd9503d..b242e3e3 100644--- a/skills/ppt-master/references/shared-standards.md+++ b/skills/ppt-master/references/shared-standards.md@@ -1513,7 +1513,9 @@ when separate frames are the required result.**Blank text carrier**: Leave a marked text carrier empty or whitespace-onlywhen the placeholder must remain visually blank. Export materializes oneinvisible U+200B run so the carrier still becomes a native PowerPoint text-shape. Do not insert a dummy dash or hide a visible glyph with background paint.+shape. Do not insert a dummy dash, shrink text below the DrawingML 1pt minimum,+or hide a visible glyph with opacity/background paint; those workarounds either+leak content or produce a PPTX that PowerPoint repairs.`title` is normally type-matched without an index in reconstructed layouts; ifan imported source title explicitly has one, preserve that exact index. Everydiff --git a/skills/ppt-master/references/strategist.md b/skills/ppt-master/references/strategist.mdindex ae49e58e..7cc93acd 100644--- a/skills/ppt-master/references/strategist.md+++ b/skills/ppt-master/references/strategist.md@@ -855,7 +855,7 @@ This is what makes the axis meaningful: a `presentation` deck and a `text` deck- **Closing impact (only when the deck closes)**: the deck's last page is its final visual contract — the strongest impression after the cover. When the deck genuinely lands on a conclusion / call-to-action / final-takeaway page, give it a `Closing impact` line in §IX: name the one thing the audience should leave with (a distilled takeaway, a forward call, a memorable restatement of the core claim) + one composition that delivers it — never a generic "Thank you" / contact-only slide or a centered-title reprise of the cover. **Do NOT invent a closing page to satisfy this** — the filler-page ban above still holds; apply it only to the page where the deck actually resolves. Same exemptions as the cover: skip on template / beautify / template-fill preservation paths.- **pptx_structure is mandatory**: Free-design and brand-only routes write `mode: flat`. Deck/layout template routes write `mode: structured` plus `template_adherence: strict|adaptive`. Do not write legacy `baseline`, `template`, `preserve`, `layout_strategy`, or Layout-kind rows into a new project.- **Flat-route boundary**: With `mode: flat`, omit `pptx_masters`, `pptx_layouts`, `page_pptx_layouts`, and `page_layouts`. Do not plan native Master/Layout families or reusable placeholder slots. Every generated SVG object remains Slide-local: omit root Master/Layout identity, `data-pptx-layer`, and `data-pptx-placeholder*` metadata. Export materializes one clean project-owned Master plus one Blank Layout from the current color/typography lock, removes stock content placeholders/Layout inventory, and retains only the standard date/footer/slide-number capability hooks.- - **Master roster (deck/layout templates only)**: Write one `pptx_masters` row per Master as `<master_key>: <picker name>` and copy the restored prototype roster. Master visuals are root-level atomic elements and may never be `<g>`.+ - **Master roster (deck/layout templates only)**: Write one `pptx_masters` row per Master as `<master_key>: <picker name>` and copy the restored prototype roster. Keys use 1–64 ASCII letters, digits, dots, underscores, or hyphens, start with a letter/digit, and contain no spaces; human-readable spaces belong only in `<picker name>`. Master visuals are root-level atomic elements and may never be `<g>`.- **pptx_layouts (deck/layout template reusable roster)**: Write every unique reusable Layout once as `<layout_key>: <master_key> | <PowerPoint layout name> | <prototype source>`. Copy the installed template roster with `template:<basename>` sources, including Layouts no generated page currently uses. A genuinely new adaptive Layout uses its first generated `P<NN>` as the source. Reuse a key only when fixed Layout atoms plus slot ids/types/indices/bounds/binding modes are identical. Name authored keys after composition (`timeline-spine`, `kpi-band-trio`, `content-image-right`), never after page topic. A Layout may intentionally have zero slots; never manufacture an empty `utility` kind or full-page fake slot.- **page_pptx_layouts (deck/layout template page assignment)**: Write exactly one `P<NN>: <layout_key>` row per generated page. The key must exist in `pptx_layouts`; Master and picker name are inherited from that unique definition. **Self-check before writing the section**: compare distinct assigned keys against distinct compositions in §IX. Distinct compositions collapsing into a handful of role-only keys means pages were clustered by topic label; one shared skeleton splitting into topic-specific keys means pages were split by content wording. Both misstate the roster.- **Slot planning (deck/layout templates only)**: Each reusable slot is a direct root `<g id>` with `data-pptx-placeholder`, positive design-zone bounds, and exactly one compatible direct carrier. Bounds come from the intended safe area, column, panel inset, or media frame—not sample text ink. A genuinely composite region may use only the explicit `object` + `proxy` downgrade.diff --git a/skills/ppt-master/scripts/svg_quality_checker.py b/skills/ppt-master/scripts/svg_quality_checker.pyindex d408b492..2666e702 100644--- a/skills/ppt-master/scripts/svg_quality_checker.py+++ b/skills/ppt-master/scripts/svg_quality_checker.py@@ -54,7 +54,10 @@ else:try:from svg_to_pptx.drawingml.utils import (+ DRAWINGML_TEXT_FONT_SIZE_MAX as _DRAWINGML_TEXT_FONT_SIZE_MAX,+ DRAWINGML_TEXT_FONT_SIZE_MIN as _DRAWINGML_TEXT_FONT_SIZE_MIN,IDENTITY_MATRIX as _IDENTITY_MATRIX,+ font_px_to_hpt as _font_px_to_hpt,matrix_multiply as _matrix_multiply,parse_transform_matrix as _parse_transform_matrix,parse_font_family as _parse_export_font_family,@@ -65,7 +68,10 @@ try:validate_dml_shape_matrix as _validate_dml_shape_matrix,)except ImportError:+ _DRAWINGML_TEXT_FONT_SIZE_MAX = None+ _DRAWINGML_TEXT_FONT_SIZE_MIN = None_IDENTITY_MATRIX = None+ _font_px_to_hpt = None_matrix_multiply = None_parse_transform_matrix = None_parse_export_font_family = None@@ -2106,12 +2112,19 @@ class SVGQualityChecker:returnunsupported = set()+ drawingml_out_of_range = set()compatible_noncanonical = set()for raw in values:parsed_px = _parse_export_length(raw, math.nan, font_size=16)if not math.isfinite(parsed_px) or parsed_px < 0:unsupported.add(raw)continue+ if _font_px_to_hpt is not None:+ try:+ _font_px_to_hpt(parsed_px)+ except ValueError:+ drawingml_out_of_range.add(raw)+ continueif not canonical_re.fullmatch(raw):compatible_noncanonical.add(raw)@@ -2125,6 +2138,20 @@ class SVGQualityChecker:"non-negative SVG length supported by svg_to_pptx.")+ if drawingml_out_of_range:+ shown_values = sorted(drawingml_out_of_range)+ shown = ', '.join(shown_values[:5])+ more = len(shown_values) - 5+ suffix = f" (+{more} more)" if more > 0 else ""+ result['errors'].append(+ f"font-size value(s) {shown}{suffix} are outside the DrawingML "+ f"range sz={_DRAWINGML_TEXT_FONT_SIZE_MIN}.."+ f"{_DRAWINGML_TEXT_FONT_SIZE_MAX} (1..4000pt); PowerPoint would "+ "repair the exported file. Do not use tiny transparent text as "+ "a placeholder carrier: leave a text carrier blank or use the "+ "composite object proxy contract."+ )+if compatible_noncanonical:shown_values = sorted(compatible_noncanonical)shown = ', '.join(shown_values[:5])diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/theme_fonts.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/theme_fonts.pyindex 4e00da36..97497863 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/theme_fonts.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/theme_fonts.py@@ -2,21 +2,18 @@from __future__ import annotations-import mathimport refrom dataclasses import dataclassfrom pathlib import Pathfrom xml.etree import ElementTree as ET-from .utils import FONT_PX_TO_HUNDREDTHS_PT, font_px_to_hpt, parse_font_family+from .utils import font_px_to_hpt, parse_font_familyDML_NS = "http://schemas.openxmlformats.org/drawingml/2006/main"PML_NS = "http://schemas.openxmlformats.org/presentationml/2006/main"_LOCK_ROW_RE = re.compile(r"^-\s+([A-Za-z0-9_]+)\s*:\s*(.+?)\s*$")_CJK_THEME_SCRIPTS = frozenset({"Hans", "Hant", "Jpan", "Hang"})-_TEXT_FONT_SIZE_MIN = 100-_TEXT_FONT_SIZE_MAX = 400_000class ThemeFontError(RuntimeError):@@ -121,17 +118,13 @@ def _font_size_hpt(raw: str, field: str) -> int:raise ThemeFontError(f"spec_lock.md typography {field} must be a numeric px value: {raw!r}") from exc- scaled = px * FONT_PX_TO_HUNDREDTHS_PT- if not math.isfinite(scaled):- raise ThemeFontError(- f"spec_lock.md typography {field} must be finite: {raw!r}"- )- size = font_px_to_hpt(px)- if not _TEXT_FONT_SIZE_MIN <= size <= _TEXT_FONT_SIZE_MAX:+ try:+ size = font_px_to_hpt(px)+ except ValueError as exc:raise ThemeFontError(f"spec_lock.md typography {field} is outside the PowerPoint "f"font-size range: {raw!r}"- )+ ) from excreturn sizediff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.pyindex 340287be..ddd2fcfd 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py@@ -20,6 +20,8 @@ XLINK_NS = 'http://www.w3.org/1999/xlink'EMU_PER_PX = 9525 # 1 SVG px = 9525 EMU (96 DPI)FONT_PX_TO_HUNDREDTHS_PT = 75 # 1px = 0.75pt -> 75 hundredths-of-a-point+DRAWINGML_TEXT_FONT_SIZE_MIN = 100+DRAWINGML_TEXT_FONT_SIZE_MAX = 400_000ANGLE_UNIT = 60000 # DrawingML angle: 60000ths of a degree# SVG attributes inheritable from parent <g>@@ -149,8 +151,24 @@ def px_to_emu(px: float) -> int:def font_px_to_hpt(font_size_px: float) -> int:- """Convert SVG px to DrawingML hundredths-of-a-point at 0.1pt precision."""- return int(round(font_size_px * FONT_PX_TO_HUNDREDTHS_PT / 10.0)) * 10+ """Convert one legal SVG font size to DrawingML hundredths-of-a-point."""+ try:+ px = float(font_size_px)+ except (TypeError, ValueError, OverflowError) as exc:+ raise ValueError(+ f"SVG font-size must be numeric, got {font_size_px!r}"+ ) from exc+ scaled = px * FONT_PX_TO_HUNDREDTHS_PT+ if not math.isfinite(scaled):+ raise ValueError(f"SVG font-size must be finite, got {font_size_px!r}")+ size = int(round(scaled / 10.0)) * 10+ if not DRAWINGML_TEXT_FONT_SIZE_MIN <= size <= DRAWINGML_TEXT_FONT_SIZE_MAX:+ raise ValueError(+ f"SVG font-size {font_size_px!r}px converts to DrawingML sz={size}; "+ f"expected {DRAWINGML_TEXT_FONT_SIZE_MIN}.."+ f"{DRAWINGML_TEXT_FONT_SIZE_MAX} (1..4000pt)"+ )+ return sizedef _f(val: str | None, default: float = 0.0) -> float:diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.pyindex afaf7ca3..27d246fc 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py@@ -12,7 +12,6 @@ from xml.etree import ElementTree as ETfrom ..drawingml.context import ConvertContext, IDENTITY_MATRIXfrom ..drawingml.utils import (EMU_PER_PX,- FONT_PX_TO_HUNDREDTHS_PT,ctx_h,ctx_w,ctx_x,@@ -40,8 +39,6 @@ _NATIVE_KINDS = {"table", "chart"}_POWERPOINT_COORD_MIN = -(2**31)_POWERPOINT_COORD_MAX = 2**31 - 1_POWERPOINT_LINE_WIDTH_MAX = 20116800-_TEXT_FONT_SIZE_MIN = 100-_TEXT_FONT_SIZE_MAX = 400000_NATIVE_TRANSFORM_OPERATION_RE = re.compile(r"([A-Za-z]+)\s*\(([^()]*)\)")_NATIVE_TRANSFORM_SEPARATOR_RE = re.compile(r"\s*,?\s*")_NATIVE_TRANSFORM_ARGS_RE = re.compile(@@ -825,13 +822,10 @@ def _font_size_hpt(value: Any, default_px: int = 18) -> int:px = float(raw)except (TypeError, ValueError, OverflowError):return None- scaled = px * FONT_PX_TO_HUNDREDTHS_PT- if not math.isfinite(scaled):- return None- size = font_px_to_hpt(px)- if not _TEXT_FONT_SIZE_MIN <= size <= _TEXT_FONT_SIZE_MAX:+ try:+ return font_px_to_hpt(px)+ except ValueError:return None- return sizereturn convert(value) or convert(default_px) or 1350diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/template_structure.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/template_structure.pyindex 957317c8..cc7ed8bf 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/template_structure.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/template_structure.py@@ -1484,10 +1484,18 @@ def parse_template_slide()else:if len(visual_children) != 1 or len(carrier_children) != 1:+ composite_hint = (+ " For composite object content, declare "+ "data-pptx-placeholder-binding='proxy' in the prototype "+ "and page, or create an adaptive Layout; never add a tiny "+ "or transparent dummy carrier."+ if placeholder == "object" else ""+ )raise TemplateStructureError(f"{svg_path.name}: carrier placeholder {element_id!r} must ""contain exactly one visual direct child and mark it "- "data-pptx-placeholder-carrier='true'"+ "data-pptx-placeholder-carrier='true'."+ f"{composite_hint}")carrier = carrier_children[0]placeholder_carrier_tag = _local_tag(carrier)