Skip to content

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): width check reads inline hyperlink runs, calibrate adds a DIGITS rate and an outline note

hugohe32266d9762c29
diff --git a/skills/ppt-master/scripts/svg_quality/checker.py b/skills/ppt-master/scripts/svg_quality/checker.py
index d334a5d1..8a6dafbf 100644
--- a/skills/ppt-master/scripts/svg_quality/checker.py
+++ b/skills/ppt-master/scripts/svg_quality/checker.py
@@ -2816,7 +2816,10 @@ class SVGQualityChecker:
if element.text:
append_run(element, element.text, xml_space)
for child in list(element):
- if not cls._is_tspan(child):
+ # An inline hyperlink (``<a>`` wrapping ``<tspan>`` runs, the
+ # form native-hyperlinks.md requires) is a transparent style
+ # container: its runs are measured like any other inline run.
+ if not (cls._is_tspan(child) or _local_name(child) == 'a'):
return False
if any(child.get(name) is not None for name in ('x', 'y', 'dx', 'dy')):
return False
diff --git a/skills/ppt-master/scripts/text_measure.py b/skills/ppt-master/scripts/text_measure.py
index cd28038b..247dd0aa 100644
--- a/skills/ppt-master/scripts/text_measure.py
+++ b/skills/ppt-master/scripts/text_measure.py
@@ -44,6 +44,7 @@ _WEIGHTS = ('normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '
_CALIBRATION_CJK_SAMPLE = '天地玄黄宇宙洪荒日月盈昃辰宿列张寒来暑往'
_CALIBRATION_LATIN_SAMPLE = 'Clear Slides Make Big Ideas Easy to See.'
_CALIBRATION_CAPS_SAMPLE = 'CLEAR SLIDES MAKE BIG IDEAS EASY TO SEE.'
+_CALIBRATION_DIGITS_SAMPLE = '0123456789'
_CORE_CALIBRATION_ROLES = ('body', 'title', 'subtitle', 'annotation')
_SLIDE_HEADING_RE = re.compile(
r'^#{3,6}[ \t]+Slide[ \t]+([0-9]+|NN)\b.*$',
@@ -474,17 +475,20 @@ def _calibration_payload(
)
cjk_length = len(split_project_text_clusters(_CALIBRATION_CJK_SAMPLE))
latin_length = len(split_project_text_clusters(_CALIBRATION_LATIN_SAMPLE))
+ digits_length = len(split_project_text_clusters(_CALIBRATION_DIGITS_SAMPLE))
role_rows = {}
for name, family, size in roles:
cjk_width = measure_text(_CALIBRATION_CJK_SAMPLE, size=size, family=family)
latin_width = measure_text(_CALIBRATION_LATIN_SAMPLE, size=size, family=family)
caps_width = measure_text(_CALIBRATION_CAPS_SAMPLE, size=size, family=family)
+ digits_width = measure_text(_CALIBRATION_DIGITS_SAMPLE, size=size, family=family)
role_rows[name] = {
'family': family,
'size': size,
'cjk_chars_per_100px': round(100.0 * cjk_length / cjk_width, 1),
'latin_chars_per_100px': round(100.0 * latin_length / latin_width, 1),
'caps_chars_per_100px': round(100.0 * latin_length / caps_width, 1),
+ 'digits_chars_per_100px': round(100.0 * digits_length / digits_width, 1),
'longest_planned_line': longest[name],
}
return {
@@ -519,7 +523,7 @@ def _fallback_notes(
def _render_calibration_table(payload: dict[str, object], *, include_outline: bool) -> str:
role_rows = payload['roles']
assert isinstance(role_rows, dict)
- headers = ['role', 'family', 'size', 'CJK ≈chars/100px', 'Latin ≈chars/100px', 'CAPS ≈chars/100px']
+ headers = ['role', 'family', 'size', 'CJK ≈chars/100px', 'Latin ≈chars/100px', 'CAPS ≈chars/100px', 'DIGITS ≈chars/100px']
if include_outline:
headers.append('longest planned line (px, slide, text)')
lines = [
@@ -536,6 +540,7 @@ def _render_calibration_table(payload: dict[str, object], *, include_outline: bo
f'{raw_row["cjk_chars_per_100px"]:.1f}',
f'{raw_row["latin_chars_per_100px"]:.1f}',
f'{raw_row["caps_chars_per_100px"]:.1f}',
+ f'{raw_row["digits_chars_per_100px"]:.1f}',
]
if include_outline:
planned = raw_row['longest_planned_line']
@@ -549,14 +554,22 @@ def _render_calibration_table(payload: dict[str, object], *, include_outline: bo
lines.append(f'[NOTE] {note}')
lines.append(
'[NOTE] mixed line width ≈ (CJK chars ÷ CJK rate + other chars ÷ Latin '
- 'rate) × 100; spaces, digits, and punctuation count as Latin.'
+ 'rate) × 100; spaces and punctuation count as Latin, digits use the '
+ 'DIGITS rate.'
)
+ if include_outline:
+ lines.append(
+ '[NOTE] the longest planned line is the §IX wording; a line rewritten '
+ 'while authoring (an expanded title, a longer label) is re-estimated '
+ 'with the rates — the outline column does not cover it.'
+ )
lines.append(
'[NOTE] rates are sample averages measured with the checker\'s '
'estimator (headroom included); the checker measures each real line '
- 'glyph by glyph, so capital-heavy words (WebGPU, GDP) and wide letters '
- 'run wider than the Latin rate — use the CAPS rate for acronyms and '
- 'uppercase, and keep about 5% below any bounds width.'
+ 'glyph by glyph, so capital-heavy words (WebGPU, GDP), digits (1935, '
+ '83.2%) and wide letters run wider than the Latin rate — use the CAPS '
+ 'rate for acronyms and uppercase, the DIGITS rate for numbers, and keep '
+ 'about 5% below any bounds width.'
)
return '\n'.join(lines) + '\n'