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: data label points follow show flags; Japanese decks get Japanese EA faces and kinsoku; URL documents honour --no-images and meta refresh
hugohe325a9984e91e2
diff --git a/skills/ppt-master/references/plan-core.md b/skills/ppt-master/references/plan-core.mdindex 71c31075..50bbd8e3 100644--- a/skills/ppt-master/references/plan-core.md+++ b/skills/ppt-master/references/plan-core.md@@ -163,7 +163,7 @@ python3 skills/ppt-master/scripts/visualization_recall.py validate \**Family selection**: user/template typography is authoritative. Delivery target: an explicit user/template target first, otherwise Windows Microsoft PowerPoint (owner: [`shared-standards-core.md`](./shared-standards-core.md) §4.1) — the authoring host's installed fonts never select a face; name concrete faces installed or approved on that target; at most four families; a brand/web face leads only after user-confirmed installation, otherwise export a safe face and keep it as a Design Spec reference (fonts are not embedded; CSS tails are preview aids, not PowerPoint fallbacks). Avoid near-equivalent splits (YaHei↔PingFang, SimSun↔Songti, Arial↔Helvetica↔Segoe UI, Times↔Times New Roman). Fonts in one deck form contrast (different family, weight, or proportion) or concord (one family throughout); across the direction set include both a concord and a contrast pairing unless the user or template fixes the stack, and never default to title = body without a reason.-**Reference — PPT-safe faces (recall, not a whitelist; one concrete named face per script — a stack carries at most one Latin face and one CJK face and never a fallback list of alternatives, because export takes the first named face of each script)**: CJK sans `Microsoft YaHei` / `SimHei`, CJK serif `SimSun` / `FangSong` / `KaiTi` (their macOS counterparts `PingFang SC` / `Heiti SC` / `Songti SC` are preview aliases, never the named face), Latin sans `Arial` / `Calibri` / `Segoe UI` / `Verdana` / `Trebuchet MS`, Latin serif `Times New Roman` / `Georgia` / `Cambria` / `Palatino` / `Garamond` (`Georgia` sets old-style figures whose digits sit at different heights — a hero-number or data role needs lining figures: `Times New Roman`, `Cambria`, or any listed sans or mono), mono `Consolas` / `Courier New`, display `Impact` / `Arial Black`. Let the locked style's character pick the axis and lead the title — `Microsoft YaHei` / `Arial` are the neutral members, never the automatic lead; a neutral sans title where the style asks for character is the failure to avoid. Non-pre-installed directions — retro/pixel Press Start 2P / VT323, rounded Nunito / Quicksand / OPPO Sans (safe substitute `Trebuchet MS` / `Verdana`), modern web Inter / HarmonyOS Sans / Source Han, calligraphic 隶书 / 华文行楷 / 华文新魏 (safe substitute `KaiTi` / `FangSong`, titles only), brand faces — need target installation or stay Design Spec references.+**Reference — PPT-safe faces (recall, not a whitelist; one concrete named face per script — a stack carries at most one Latin face and one CJK face and never a fallback list of alternatives, because export takes the first named face of each script)**: CJK sans `Microsoft YaHei` / `SimHei`, CJK serif `SimSun` / `FangSong` / `KaiTi` (their macOS counterparts `PingFang SC` / `Heiti SC` / `Songti SC` are preview aliases, never the named face), Japanese sans `Yu Gothic` / `Meiryo`, Japanese serif `Yu Mincho` (a Japanese deck on a Chinese face takes Chinese glyph forms), Latin sans `Arial` / `Calibri` / `Segoe UI` / `Verdana` / `Trebuchet MS`, Latin serif `Times New Roman` / `Georgia` / `Cambria` / `Palatino` / `Garamond` (`Georgia` sets old-style figures whose digits sit at different heights — a hero-number or data role needs lining figures: `Times New Roman`, `Cambria`, or any listed sans or mono), mono `Consolas` / `Courier New`, display `Impact` / `Arial Black`. Let the locked style's character pick the axis and lead the title — `Microsoft YaHei` / `Arial` are the neutral members, never the automatic lead; a neutral sans title where the style asks for character is the failure to avoid. Non-pre-installed directions — retro/pixel Press Start 2P / VT323, rounded Nunito / Quicksand / OPPO Sans (safe substitute `Trebuchet MS` / `Verdana`), modern web Inter / HarmonyOS Sans / Source Han, calligraphic 隶书 / 华文行楷 / 华文新魏 (safe substitute `KaiTi` / `FangSong`, titles only), brand faces — need target installation or stay Design Spec references.**Role extension after confirmation**: while composing the roster, add a lowercase snake_case role with an exact stack only for a recurring role that materially needs a different family (`annotation`, `footer`, `footnote`, `data`, `emphasis`, `quote`, `code`), coherent with the confirmed heading/body system and locked style; one-off garnish stays omitted and Default names any added role in one compact `Role rationale` line in §IV.diff --git a/skills/ppt-master/scripts/compact_svg_styles.py b/skills/ppt-master/scripts/compact_svg_styles.pyindex ca8d447b..cd0fd18c 100644--- a/skills/ppt-master/scripts/compact_svg_styles.py+++ b/skills/ppt-master/scripts/compact_svg_styles.py@@ -142,6 +142,11 @@ def _local_name(name: object) -> str:return name.rsplit("}", 1)[-1] if isinstance(name, str) else ""+def _is_preset_atom(element: ET.Element) -> bool:+ """Return whether an element is a helper-owned authored preset group."""+ return isinstance(element.tag, str) and authored_preset_encoding(element) is not None++def is_canonical_presentation_value(value: str,*,@@ -342,7 +347,7 @@ def _promote_common_group_defaults("""Factor proven direct-child repetition into an existing SVG group."""if (_local_name(element.tag) in _DEFINITION_SUBTREES- or authored_preset_encoding(element)+ or _is_preset_atom(element)):returnfor child in element:@@ -363,7 +368,7 @@ def _promote_common_group_defaults(return# Helper-owned preset atoms keep their paint local; the preset contract# rejects paint that only arrives from an ancestor group.- if any(authored_preset_encoding(child) for child in children):+ if any(_is_preset_atom(child) for child in children):returnelement_styles = _style_declarations(element.get("style"))@@ -414,7 +419,7 @@ def _remove_redundant_inherited_styles() -> None:if (_local_name(element.tag) in _DEFINITION_SUBTREES- or authored_preset_encoding(element)+ or _is_preset_atom(element)):returndeclarations = _style_declarations(element.get("style"))diff --git a/skills/ppt-master/scripts/docs/native-data.md b/skills/ppt-master/scripts/docs/native-data.mdindex b50b9393..5f11f6ce 100644--- a/skills/ppt-master/scripts/docs/native-data.md+++ b/skills/ppt-master/scripts/docs/native-data.md@@ -32,7 +32,7 @@ Cells accept `text`, `fill`, `fill_opacity`, `color`, `align`; no cell-level `foChart payloads carry no `schema` key: the marker's `data-pptx-replace-with` value selects the chart schema, and an invented key is rejected.- **Category charts** — `column`, `bar`, `line`, `area`, `pie`, `doughnut`, `pieOfPie`, `barOfPie`, `radar`: `categories` plus `series[].values`. Column, bar, line, and area values may be `null` for a gap (the workbook cell stays blank, the cache omits the point, `dispBlanksAs` is `gap`; at least one value per series is a number) — a fallback that breaks one line into segments is two series of the same colour with `null` outside their segment. Pie-family charts take exactly one series with per-slice colors; `hole_size` is doughnut-only, integer `10..90`, default `75`; no rotation field. Column/bar may set `series[].point_colors` (camelCase `pointColors` is read-compatible; length = values). Bar categories run top-down in payload order — the exporter reverses the category axis and moves the value-axis crossing so the value axis keeps its declared position; `axes.category.reverse: false` restores PowerPoint's bottom-up order (column charts stay left-to-right unless `reverse: true`). Bar/column spacing: root `gap_width` (`0..500`, the empty slot share as a percentage of one bar; PowerPoint default `150`) and clustered `overlap` (`-100..100`, the share of one bar the next series covers, negative for a gap); SVG-first export reads both from the fallback bars inside `plot_area` when the payload omits them, JSON-first uses the defaults.-- **Line markers** — `line_style: "lineMarker"` draws a circle at every point in the series colour; `marker_size` (root or per series, SVG px diameter, `2..72` pt after `×0.75`) sizes it. `series[].point_colors` on a line series marks single points: a colour draws that point's marker in that colour, `null` leaves it bare (with `line_style: "line"` only the coloured points carry markers), so an emphasised endpoint is `[null, …, "#C8102E"]`. Area series draw no markers; a line with markers over a fill is a `combo`. `data_labels` (column, bar, line, and area plots only, combo plots of those types included; pie-family, radar, scatter/bubble, stock, and ChartEx charts reject it — show their values through companion `notes`) is `true` or an object with `show_value`, `position`, `number_format`, `font_size`, `font_family`, `bold`, `color`, per-point `colors`, and `points` (zero-based `idx` plus optional overrides); positions: clustered column/bar `outside_end` / `inside_end` / `inside_base` / `center`, stacked `inside_end` / `inside_base` / `center`, line `above` / `center` / `best_fit`, area none. Set `data_labels.number_format` to match the fallback (the parity gate reads `0`, `0.0`, `0.00`, `#,##0`, `#,##0.0`, their `%` forms — which scale the value by 100 — and a quoted literal prefix/suffix such as `"$"#,##0` or `0.0"%"`; other codes match only the literal value)'s rendered value labels.+- **Line markers** — `line_style: "lineMarker"` draws a circle at every point in the series colour; `marker_size` (root or per series, SVG px diameter, `2..72` pt after `×0.75`) sizes it. `series[].point_colors` on a line series marks single points: a colour draws that point's marker in that colour, `null` leaves it bare (with `line_style: "line"` only the coloured points carry markers), so an emphasised endpoint is `[null, …, "#C8102E"]`. Area series draw no markers; a line with markers over a fill is a `combo`. `data_labels` (column, bar, line, and area plots only, combo plots of those types included; pie-family, radar, scatter/bubble, stock, and ChartEx charts reject it — show their values through companion `notes`) is `true` or an object with `show_value`, `position`, `number_format`, `font_size`, `font_family`, `bold`, `color`, per-point `colors`, and `points` (zero-based `idx` plus optional overrides — with an explicit `show_*` flag every point keeps its label and `delete: true` hides one; without one only the listed points are labeled); positions: clustered column/bar `outside_end` / `inside_end` / `inside_base` / `center`, stacked `inside_end` / `inside_base` / `center`, line `above` / `center` / `best_fit`, area none. Set `data_labels.number_format` to match the fallback (the parity gate reads `0`, `0.0`, `0.00`, `#,##0`, `#,##0.0`, their `%` forms — which scale the value by 100 — and a quoted literal prefix/suffix such as `"$"#,##0` or `0.0"%"`; other codes match only the literal value)'s rendered value labels.- **Combo** — shared `categories` plus `plots[]` (`type: "column" | "line" | "area"`, own `series`, optional `axis: "secondary"`, optionally own `categories` / `category_numeric` when caches genuinely differ, and `series_indices` for imported identity — same-length unique non-negative integers forming one contiguous `0..N-1` range across plots) or typed `series[]` with per-series `type` / `axis` (adjacent compatible series share a plot). Area series may set `fill_opacity` (`0..1`; `fillOpacity` read-compatible); a line plot with `area_fill: true` exports as an area chart; line/area series may set `line_width` in SVG px (`lineWidth` read-compatible); column plots take `gap_width` / `overlap`, line plots `line_style` / `marker_size`. An area series is a fill without an outline; `line_width` adds a same-colour outline around the whole region (baseline included), so a fallback that strokes only the top edge — or draws markers on it — is an area plot under a line plot with the same values. Export layers areas below columns and lines.- **Axes** — classic `axes` is a closed object of `category`, `value`, `secondary_category`, `secondary_value`, each with only `kind` (`text` / `date` / `value`), `position`, `visible`, `label_position` (`next_to` / `none` / `low` / `high`), `number_format`, `minimum`, `maximum`, `major_unit` (value axes), `reverse`, `major_gridlines`, `tick_marks` (`none` default / `out` / `in` / `cross`), tick-label `color` / `font_family` / `font_size` (SVG px) when one axis's labels differ from the chart-wide text style, and on value axes `cross_between` (`between` — points sit between ticks, the default written explicitly because renderers disagree when it is absent — or `mid_category` — the first point sits on the axis edge; SVG-first line/area export reads it from where the fallback line starts inside `plot_area`); single-plot `bar` takes `category` left/right and `value` bottom/top; pie-family rejects `axes`. For single-plot category charts, `kind: "date"` is supported only by `area`. Stock dates follow the separate Stock contract below. `position` is honoured through the axis crossing (`top` / `right` cross at the far category, and a reversed crossing axis swaps the ends). `scatter` / `bubble` use `x` and `y` roles only (`kind: "value"`; `x.position` bottom/top, `y.position` left/right) with the same fields. Logarithmic scales, minor units/gridlines, crossing values, display units, and tick skipping are unsupported.- **XY** — `scatter` and `bubble` use `series[].x` + `series[].y` (`bubble` adds one `series[].size` / `sizes` per point), or `series[].points` as `[x, y]` / `[x, y, size]` tuples or `{x, y, size}` objects.diff --git a/skills/ppt-master/scripts/image_gen.py b/skills/ppt-master/scripts/image_gen.pyindex 07859243..7507f138 100644--- a/skills/ppt-master/scripts/image_gen.py+++ b/skills/ppt-master/scripts/image_gen.py@@ -50,6 +50,7 @@ import concurrent.futuresimport jsonimport osimport re+import statimport sysimport tempfileimport threading@@ -848,6 +849,12 @@ def load_manifest(path: str) -> dict:def save_manifest(path: str, data: dict) -> None:"""Atomically write manifest back to disk (tmp file + rename)."""target = Path(path)+ try:+ mode = stat.S_IMODE(target.stat().st_mode)+ except FileNotFoundError:+ umask = os.umask(0)+ os.umask(umask)+ mode = 0o666 & ~umaskfd, tmp_path = tempfile.mkstemp(prefix=target.stem + ".",suffix=".tmp",@@ -857,6 +864,8 @@ def save_manifest(path: str, data: dict) -> None:with os.fdopen(fd, "w", encoding="utf-8") as f:json.dump(data, f, ensure_ascii=False, indent=2)f.write("\n")+ # mkstemp creates 0600; keep the manifest's own permissions.+ os.chmod(tmp_path, mode)os.replace(tmp_path, target)except Exception:try:diff --git a/skills/ppt-master/scripts/source_to_md/pdf_to_md.py b/skills/ppt-master/scripts/source_to_md/pdf_to_md.pyindex 4ce7b74a..ec7a588d 100644--- a/skills/ppt-master/scripts/source_to_md/pdf_to_md.py+++ b/skills/ppt-master/scripts/source_to_md/pdf_to_md.py@@ -13,6 +13,7 @@ import jsonimport osimport reimport sys+import unicodedatafrom pathlib import Pathfrom collections import Counter@@ -333,6 +334,17 @@ def detect_headers_footers(doc: fitz.Document, threshold_ratio: float = 0.6) ->return noise_texts+def join_wrapped_text(head: str, tail: str) -> str:+ """Join two wrapped PDF lines; a break between wide CJK characters is no space."""+ if (+ head and tail+ and unicodedata.east_asian_width(head[-1]) in {"W", "F"}+ and unicodedata.east_asian_width(tail[0]) in {"W", "F"}+ ):+ return head + tail+ return f"{head} {tail}"++def merge_adjacent_headings(elements: list) -> list:"""Merge adjacent same-level short headings.@@ -381,7 +393,7 @@ def merge_adjacent_headings(elements: list) -> list:break# Merge- title_text += " " + next_text+ title_text = join_wrapped_text(title_text, next_text)j += 1# Create merged element@@ -1610,7 +1622,7 @@ def extract_pdf_to_markdown(breakif not should_merge_lines({"content": merged_content, "is_heading": False, "is_list": False}, next_el):break- merged_content += " " + next_el["content"]+ merged_content = join_wrapped_text(merged_content, next_el["content"])j += 1merged_elements.append({"type": 0,diff --git a/skills/ppt-master/scripts/source_to_md/web_to_md.py b/skills/ppt-master/scripts/source_to_md/web_to_md.pyindex 96c28e25..e3f5e979 100644--- a/skills/ppt-master/scripts/source_to_md/web_to_md.py+++ b/skills/ppt-master/scripts/source_to_md/web_to_md.py@@ -998,6 +998,7 @@ def remote_document_suffix(url: str, content_type: str, head: bytes) -> str | Nodef _convert_remote_document(url: str, body: bytes, suffix: str, output_file: str | None,+ download_images: bool = True,) -> tuple[bool, str, str | None, str | None]:"""Save a downloaded document beside its Markdown and run its own converter."""stem = os.path.splitext(os.path.basename(urlparse(url).path))[0]@@ -1012,7 +1013,10 @@ def _convert_remote_document(f.write(body)print(f" [OK] Document: {len(body)} bytes saved to {local_path}")- route = build_conversion_command(local_path, output_path)+ route = build_conversion_command(+ local_path, output_path,+ pdf_image_mode=None if download_images else "none",+ )print(f" [>>] {route.script_name} {local_path}")sys.stdout.flush()rc = subprocess.run(route.command).returncode@@ -1021,11 +1025,26 @@ def _convert_remote_document(return True, url, None, output_path+_META_REFRESH_RE = re.compile(+ r"^\s*(\d+(?:\.\d+)?)\s*[;,]\s*url\s*=\s*['\"]?([^'\"]+)", re.IGNORECASE)+++def _meta_refresh_target(soup: BeautifulSoup, base_url: str) -> str | None:+ """Return the http(s) target of an immediate `<meta http-equiv="refresh">`."""+ meta = soup.find("meta", attrs={"http-equiv": re.compile(r"^refresh$", re.IGNORECASE)})+ match = _META_REFRESH_RE.match(meta.get("content", "")) if meta else None+ if not match or float(match.group(1)) > 5:+ return None+ target = urljoin(base_url, match.group(2).strip())+ return target if urlparse(target).scheme in {"http", "https"} else None++def process_url(url: str,output_file: str | None = None,*,download_images: bool = True,+ _refresh_hops: int = 0,) -> tuple[bool, str, str | None, str | None]:"""Fetch, convert, and save one web page as Markdown.@@ -1039,13 +1058,23 @@ def process_url(suffix = remote_document_suffix(url, response.headers.get("Content-Type", ""), response.content[:8])if suffix:- return _convert_remote_document(url, response.content, suffix, output_file)+ return _convert_remote_document(+ url, response.content, suffix, output_file, download_images,+ )html, page_url = _decode_response_text(response), response.urlif is_plain_text_document(url, html):return _save_plain_text_document(url, html, output_file)soup = BeautifulSoup(html, 'html.parser')base = soup.find('base', href=True)base_url = urljoin(page_url, base['href']) if base else page_url+ refresh_url = _meta_refresh_target(soup, base_url)+ if refresh_url and refresh_url != page_url and _refresh_hops < 3:+ print(f" [>>] Meta refresh: {refresh_url}")+ ok, _, error, saved = process_url(+ refresh_url, output_file,+ download_images=download_images, _refresh_hops=_refresh_hops + 1,+ )+ return ok, url, error, saved# Extract Metadatametadata = extract_metadata(soup, url)@@ -1084,6 +1113,12 @@ def process_url(# Note: We pass the element to our traversal functionmarkdown_text = simple_html_to_markdown_traversal(content_div, base_url)print(f" [OK] Content: {len(markdown_text)} chars")+ warnings = []+ if not markdown_text.strip():+ warnings.append(+ "no readable body text extracted; the page may render its "+ "content with scripts or link to it elsewhere")+ print(f" [WARN] {warnings[0]}")# Construct contentfinal_output = []@@ -1115,6 +1150,7 @@ def process_url(converter="web_to_md.py",conversion_type="web",asset_dir=image_dir if image_count else None,+ warnings=warnings,)print(f" [OK] Saved: {output_path}")diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.pyindex d25ade5b..d4644252 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.py@@ -2962,7 +2962,10 @@ def _build_run_properties_xml(spc_attr = _letter_spacing_to_drawingml_spc(letter_spacing_px)baseline_attr = f' baseline="{baseline_shift}"' if baseline_shift else ''- fonts = parse_font_family(ff) if ff else default_fonts+ fonts = (+ parse_font_family(ff, ctx.primary_language if ctx is not None else None)+ if ff else default_fonts+ )run_fonts = ({'latin': fixed_font_family,@@ -3182,7 +3185,7 @@ def convert_text(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:else:letter_spacing_px = 0.0- fonts = parse_font_family(font_family_str)+ fonts = parse_font_family(font_family_str, ctx.primary_language)parent_attrs: dict[str, Any] = {'fill': fill_color,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 f4837c2f..c9c07cc5 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@@ -147,8 +147,8 @@ def infer_master_text_style_spec()-def _font_face(font_family: str) -> ThemeFontFace:- fonts = parse_font_family(font_family)+def _font_face(font_family: str, language: str | None = None) -> ThemeFontFace:+ fonts = parse_font_family(font_family, language)return ThemeFontFace(latin=fonts["latin"],ea=fonts["ea"],@@ -177,7 +177,10 @@ def _typography_rows(lock_path: Path) -> dict[str, str]:return rows-def load_theme_font_spec(project_path: Path) -> ThemeFontSpec | None:+def load_theme_font_spec(+ project_path: Path,+ language: str | None = None,+) -> ThemeFontSpec | None:"""Load major/minor theme fonts from ``spec_lock.md`` typography rows."""lock_path = project_path / "spec_lock.md"if not lock_path.is_file():@@ -189,8 +192,8 @@ def load_theme_font_spec(project_path: Path) -> ThemeFontSpec | None:if not major_family or not minor_family:return Nonereturn ThemeFontSpec(- major=_font_face(major_family),- minor=_font_face(minor_family),+ major=_font_face(major_family, language),+ minor=_font_face(minor_family, language),major_family=major_family,minor_family=minor_family,)diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.pyindex 74d3a72a..9f8db3db 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py@@ -3191,7 +3191,41 @@ def get_effective_filter_id(elem: ET.Element, ctx: ConvertContext) -> str | None# Font parsing# ----------------------------------------------------------------------------def parse_font_family(font_family_str: str) -> dict[str, str]:+# Windows EA faces for decks whose primary language is not Simplified Chinese:+# (sans, serif) by BCP-47 language/script prefix.+_EA_DEFAULTS_BY_LANGUAGE = (+ (('ja',), ('Yu Gothic', 'Yu Mincho')),+ (('ko',), ('Malgun Gothic', 'Batang')),+ (('zh-hant', 'zh-tw', 'zh-hk', 'zh-mo'), ('Microsoft JhengHei', 'PMingLiU')),+)+# macOS Japanese faces map to Japanese Windows faces, not to Chinese ones.+_JA_FONT_FALLBACK_WIN = {+ 'Hiragino Sans': 'Yu Gothic',+ 'Hiragino Kaku Gothic ProN': 'Yu Gothic',+ 'Hiragino Kaku Gothic Pro': 'Yu Gothic',+ 'Hiragino Mincho ProN': 'Yu Mincho',+ 'Hiragino Mincho Pro': 'Yu Mincho',+}+++def _language_is(language: str | None, prefix: str) -> bool:+ """Return whether a BCP-47 tag equals or starts with one subtag prefix."""+ tag = (language or '').lower()+ return tag == prefix or tag.startswith(prefix + '-')+++def _ea_default(language: str | None, serif: bool) -> str:+ """Return the Windows EA fallback face for one deck language."""+ for prefixes, faces in _EA_DEFAULTS_BY_LANGUAGE:+ if any(_language_is(language, prefix) for prefix in prefixes):+ return faces[1] if serif else faces[0]+ return 'SimSun' if serif else 'Microsoft YaHei'+++def parse_font_family(+ font_family_str: str,+ language: str | None = None,+) -> dict[str, str]:"""Parse CSS font-family into latin/ea typeface names.Prioritizes Windows-available fonts since PPTX is primarily opened on@@ -3199,9 +3233,13 @@ def parse_font_family(font_family_str: str) -> dict[str, str]:first named Latin face fills ``latin`` and the first named CJK face fills``ea``; a CJK face also serves ``latin`` when no named Latin face exists,and a generic family fills ``latin`` only when it precedes every named face.+ ``language`` (the deck's BCP-47 primary language) picks the EA fallback+ when the stack names no CJK face, so Japanese text never lands on a+ Chinese face."""+ is_japanese = _language_is(language, 'ja')if not font_family_str:- return {'latin': 'Segoe UI', 'ea': 'Microsoft YaHei'}+ return {'latin': 'Segoe UI', 'ea': _ea_default(language, False)}fonts = [f.strip().strip("'\"") for f in font_family_str.split(',')]latin_font = None@@ -3218,7 +3256,9 @@ def parse_font_family(font_family_str: str) -> dict[str, str]:latin_font = GENERIC_FONT_MAP[font]continue- win_font = FONT_FALLBACK_WIN.get(font, font)+ win_font = (+ _JA_FONT_FALLBACK_WIN.get(font) if is_japanese else None+ ) or FONT_FALLBACK_WIN.get(font, font)if font in EA_FONTS:ea_font = ea_font or win_fontelse:@@ -3232,7 +3272,7 @@ def parse_font_family(font_family_str: str) -> dict[str, str]:# EA must always be a CJK-capable fontif not ea_font:- ea_font = 'SimSun' if final_latin in _SERIF_LATIN else 'Microsoft YaHei'+ ea_font = _ea_default(language, final_latin in _SERIF_LATIN)return {'latin': final_latin, 'ea': ea_font}diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_data.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_data.pyindex 0af00ef5..894df889 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_data.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_data.py@@ -130,6 +130,17 @@ def _chart_data_labels(raise RuntimeError("Native PPTX chart data_labels.points color must be a color")+ if (+ point_items+ and not data_labels_show_unlisted(config)+ and all(item.get("delete") is True for item in point_items)+ ):+ raise RuntimeError(+ "Native PPTX chart data_labels.points lists the labels to show; "+ "every listed point is delete: true, so no label remains. List the "+ "points to label, or set show_value: true so unlisted points keep "+ "their labels and delete entries hide single points"+ )colors = _chart_list(_first_present(config.get("colors"),@@ -169,6 +180,24 @@ def _chart_data_labels(return config+def data_labels_show_unlisted(config: dict[str, Any]) -> bool:+ """Return whether points absent from ``points`` keep the series label.++ An explicit truthy ``show_*`` flag makes ``points`` a list of overrides,+ as in OOXML and the PPTX importer; without one ``points`` lists the only+ labels shown.+ """+ return any(+ _chart_bool(_first_present(*(config.get(key) for key in aliases)), False)+ for aliases in (+ ("show_value", "showValue", "value"),+ ("show_category", "showCategory", "category"),+ ("show_series", "showSeries", "series"),+ ("show_percent", "showPercent", "percent"),+ )+ )++def _data_label_point_items(config: dict[str, Any],chart_type: str,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 a95ec1b5..4209c851 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@@ -347,10 +347,10 @@ def _major_gridlines_xml(color: str | None) -> str:return f'<c:majorGridlines>{_chart_line_sp_pr_xml(color, width=6350)}</c:majorGridlines>'-def _font_face_xml(font_face: str | None) -> str:+def _font_face_xml(font_face: str | None, language: str | None = None) -> str:if not font_face:return ""- fonts = parse_font_family(font_face)+ fonts = parse_font_family(font_face, language)latin_font = _xml_escape(fonts["latin"])ea_font = _xml_escape(fonts["ea"])return (@@ -378,7 +378,7 @@ def _chart_tx_pr_xml(return (f"<c:txPr><a:bodyPr/><a:lstStyle/><a:p><a:pPr{rtl_attr}>"f'<a:defRPr lang="{resolved_language}" sz="{font_size}"{bold_attr}>'- f'{fill_xml}{_font_face_xml(font_face)}</a:defRPr>'+ f'{fill_xml}{_font_face_xml(font_face, language)}</a:defRPr>'f'</a:pPr><a:endParaRPr lang="{resolved_language}"/></a:p></c:txPr>')@@ -472,7 +472,7 @@ def _axis_title_xml("<c:title><c:tx><c:rich><a:bodyPr/><a:lstStyle/>"f'<a:p><a:pPr{rtl_attr}/><a:r><a:rPr lang="{lang}" 'f'sz="{_chart_text_entry_font_size(item, font_size)}">'- f"{fill_xml}{_font_face_xml(_chart_text_entry_font_face(item, font_face))}"+ f"{fill_xml}{_font_face_xml(_chart_text_entry_font_face(item, font_face), primary_language)}"f"{run_rtl}</a:rPr>"f"<a:t>{_xml_escape(text)}</a:t></a:r></a:p>""</c:rich></c:tx><c:layout/><c:overlay val=\"0\"/></c:title>"@@ -1424,7 +1424,7 @@ def _text_box_xml(lang = detect_text_lang(text, ctx.primary_language)run_rtl = '<a:rtl val="1"/>' if text_has_rtl_characters(text) else ''run_properties_xml = (- f'{fill_xml}{_font_face_xml(font_face)}'+ f'{fill_xml}{_font_face_xml(font_face, ctx.primary_language)}'f'{run_rtl}')rtl_attr = (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 fcfa1ae1..ee97c6b5 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@@ -23,6 +23,7 @@ from .chart_data import (_data_label_position,_data_label_point_items,_data_labels_config,+ data_labels_show_unlisted,)from .chart_style import (_alpha_xml,@@ -231,7 +232,7 @@ def _data_label_custom_text_xml(run_rtl = '<a:rtl val="1"/>' if text_has_rtl_characters(line) else ""paragraphs.append(f'<a:p><a:pPr{rtl_attr}/><a:r><a:rPr lang="{lang}" '- f'sz="{font_size}"{bold_attr}>{fill_xml}{_font_face_xml(font_face)}'+ f'sz="{font_size}"{bold_attr}>{fill_xml}{_font_face_xml(font_face, language)}'f'{run_rtl}</a:rPr><a:t>{_xml_escape(line)}</a:t></a:r></a:p>')return (@@ -296,11 +297,13 @@ def _data_labels_xml()if point_items:selected_items = {int(item["idx"]): item for item in point_items}+ show_unlisted = data_labels_show_unlisted(config)point_label_xml = ""for idx in range(point_count):item = selected_items.get(idx)if item is None:- point_label_xml += f'<c:dLbl><c:idx val="{idx}"/><c:delete val="1"/></c:dLbl>'+ if not show_unlisted:+ point_label_xml += f'<c:dLbl><c:idx val="{idx}"/><c:delete val="1"/></c:dLbl>'continueif item.get("delete") is True:point_label_xml += f'<c:dLbl><c:idx val="{idx}"/><c:delete val="1"/></c:dLbl>'@@ -355,7 +358,11 @@ def _data_labels_xml(f"{_data_label_flags_xml({**config, **item})}""</c:dLbl>")- return f"<c:dLbls>{point_label_xml}{leader_lines_xml}</c:dLbls>"+ series_label_xml = ""+ if show_unlisted:+ position_xml = f'<c:dLblPos val="{position}"/>' if position else ""+ series_label_xml = f"{num_fmt_xml}{tx_pr_xml}{position_xml}{flags_xml}"+ return f"<c:dLbls>{point_label_xml}{series_label_xml}{leader_lines_xml}</c:dLbls>"label_colors = [_clean_hex(item, "#404040")@@ -620,7 +627,7 @@ def _chart_title_paragraph_xml(run_rtl = '<a:rtl val="1"/>' if text_has_rtl_characters(text) else ''return (f'<a:p><a:pPr{rtl_attr}/><a:r><a:rPr lang="{lang}" '- f'sz="{font_size}">{fill_xml}{_font_face_xml(font_face)}'+ f'sz="{font_size}">{fill_xml}{_font_face_xml(font_face, primary_language)}'f'{run_rtl}</a:rPr>'f"<a:t>{_xml_escape(text)}</a:t></a:r></a:p>")diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.pyindex 4e51558c..297698fc 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py@@ -88,7 +88,7 @@ def _table_text_run(f'<a:cs typeface="{escaped_face}"/>')else:- font_xml = _font_face_xml(font_face)+ font_xml = _font_face_xml(font_face, default_language)outline_xml = ""if outline is not None and outline.style == "solid":assert outline.color is not None and outline.width is not Nonediff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.pyindex b93651f2..51d20113 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py@@ -2490,7 +2490,7 @@ Recorded narration:and not lockless_export):try:- theme_font_spec = load_theme_font_spec(project_path)+ theme_font_spec = load_theme_font_spec(project_path, primary_language)master_text_style_spec = load_master_text_style_spec(project_path)theme_color_spec = load_theme_color_spec(project_path)except (ThemeFontError, ThemeColorError) as exc:diff --git a/skills/ppt-master/scripts/tests/test_dogfood_leaves_fixes.py b/skills/ppt-master/scripts/tests/test_dogfood_leaves_fixes.pyindex 8001dc82..b4022a79 100644--- a/skills/ppt-master/scripts/tests/test_dogfood_leaves_fixes.py+++ b/skills/ppt-master/scripts/tests/test_dogfood_leaves_fixes.py@@ -34,6 +34,10 @@ from compact_svg_styles import compact_svg_style_tree # noqa: E402from pptx_to_svg.preset_authoring import validate_authored_preset_tree # noqa: E402from pptx_ooxml.analyzer import _classify_page_type # noqa: E402from beautify_identity import _theme_font_refs # noqa: E402+from svg_to_pptx.native_objects.chart_data import _chart_data_labels # noqa: E402+from svg_to_pptx.native_objects.chart_xml import _data_labels_xml # noqa: E402+from svg_to_pptx.drawingml.utils import parse_font_family # noqa: E402+import text_measure # noqa: E402PDF_URL = "https://www.example.gov/content/pkg/report/pdf/report.pdf"@@ -225,6 +229,15 @@ class PresetPaintCompactionTests(unittest.TestCase):self.assertEqual(preset.get("fill"), "#004B20")self.assertEqual(validate_authored_preset_tree(root), [])+ def test_comment_nodes_do_not_crash(self) -> None:+ parser = ET.XMLParser(target=ET.TreeBuilder(insert_comments=True))+ root = ET.fromstring(+ self.SVG.replace('<rect ', '<!-- chart-plot-area --><rect ', 1),+ parser=parser,+ )+ compact_svg_style_tree(root)+ self.assertEqual(validate_authored_preset_tree(root), [])+class BeautifyIntakeTests(unittest.TestCase):def test_prose_mentioning_part_stays_content(self) -> None:@@ -245,6 +258,49 @@ class BeautifyIntakeTests(unittest.TestCase):self.assertEqual(refs["+mj-lt"], "Verdana")+class DataLabelPointTests(unittest.TestCase):+ @staticmethod+ def _xml(config: dict) -> str:+ return _data_labels_xml(+ config, chart_type="column", grouping="clustered", point_count=4,+ font_size=1400, default_color="#000000", default_font_face=None,+ )++ def test_show_flag_makes_points_overrides(self) -> None:+ xml = self._xml({"show_value": True, "points": [{"idx": 2, "delete": True}]})+ self.assertEqual(xml.count('<c:delete val="1"/>'), 1)+ self.assertIn('<c:showVal val="1"/><c:showCatName', xml.split("</c:dLbl>")[-1])++ def test_points_without_flag_list_the_only_labels(self) -> None:+ xml = self._xml({"points": [{"idx": 3}]})+ self.assertEqual(xml.count('<c:delete val="1"/>'), 3)++ def test_all_deleted_points_are_refused(self) -> None:+ with self.assertRaisesRegex(RuntimeError, "no label remains"):+ _chart_data_labels(+ {"data_labels": {"points": [{"idx": 1, "delete": True}]}},+ "column", "clustered", 4,+ )+++class JapaneseTypographyTests(unittest.TestCase):+ def test_small_kana_and_long_vowel_never_open_a_line(self) -> None:+ units = text_measure._protected_units("スーパーっゃ・")+ self.assertTrue(all(unit[0] not in "ーっゃ・" for unit in units))++ def test_wrapped_pdf_lines_join_without_space_between_cjk(self) -> None:+ self.assertEqual(pdf_to_md.join_wrapped_text("約68億", "人ものお客様"), "約68億人ものお客様")+ self.assertEqual(pdf_to_md.join_wrapped_text("新幹", "線"), "新幹線")+ self.assertEqual(pdf_to_md.join_wrapped_text("the high", "speed"), "the high speed")++ def test_ea_fallback_follows_deck_language(self) -> None:+ self.assertEqual(parse_font_family("'Georgia', serif", "ja-JP")["ea"], "Yu Mincho")+ self.assertEqual(parse_font_family("Arial", "ja")["ea"], "Yu Gothic")+ self.assertEqual(parse_font_family("'Hiragino Sans'", "ja-JP")["latin"], "Yu Gothic")+ self.assertEqual(parse_font_family("Arial", "zh-CN")["ea"], "Microsoft YaHei")+ self.assertEqual(parse_font_family("Arial")["ea"], "Microsoft YaHei")++class SlideSizeTypeTests(unittest.TestCase):def test_standard_ratios_keep_their_token(self) -> None:self.assertEqual(_slide_size_type(12192000, 6858000), "screen16x9")diff --git a/skills/ppt-master/scripts/text_measure.py b/skills/ppt-master/scripts/text_measure.pyindex 28dd236d..a4476603 100644--- a/skills/ppt-master/scripts/text_measure.py+++ b/skills/ppt-master/scripts/text_measure.py@@ -38,6 +38,12 @@ from svg_to_pptx.drawingml.utils import split_project_text_clusters # noqa: E40_CLOSING_PUNCTUATION = frozenset(',.;:!?)]}、,。;:!?)》」』】”’')_OPENING_PUNCTUATION = frozenset('([{(《「『【“‘')+# Japanese line-start prohibitions beyond punctuation: small kana, the long+# vowel mark, iteration marks, and the middle dot never open a line.+_NO_LINE_START = _CLOSING_PUNCTUATION | frozenset(+ 'ぁぃぅぇぉっゃゅょゎゕゖァィゥェォッャュョヮヵヶㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ'+ 'ー々ゝゞヽヾ・'+)_PREFERRED_BREAK_PUNCTUATION = frozenset(',。;:')# A CJK clause break is preferred over the greedy break only while it keeps# this share of the greedy line; below it the punctuation break would leave a@@ -175,7 +181,7 @@ def _protected_units(text: str) -> list[str]:for unit in units:content = unit.lstrip()if protected and (- content[0] in _CLOSING_PUNCTUATION+ content[0] in _NO_LINE_STARTor protected[-1].rstrip()[-1] in _OPENING_PUNCTUATION):protected[-1] += unit