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

feat(confirm-ui): add language-aware font selectors

hugohe32afff5e8ae78
diff --git a/skills/ppt-master/scripts/confirm_ui/server.py b/skills/ppt-master/scripts/confirm_ui/server.py
index c8693cc7..9f89d8de 100644
--- a/skills/ppt-master/scripts/confirm_ui/server.py
+++ b/skills/ppt-master/scripts/confirm_ui/server.py
@@ -552,17 +552,86 @@ def _positive_number(value: object) -> bool:
return number > 0 and number != float('inf')
-def _typography_error(typography: object, label: str, *, require_sizes: bool) -> Optional[str]:
+def _is_english_language(language: object) -> bool:
+ """Return whether a recommendation language is an English locale."""
+ if not isinstance(language, str):
+ return False
+ normalized = language.strip().casefold().replace('_', '-')
+ return (
+ normalized == 'english'
+ or normalized == 'en'
+ or normalized.startswith('en-')
+ )
+
+
+def _recommendation_language(recommendations: dict) -> object:
+ """Return the deck's main language without conflating it with UI ``lang``."""
+ value = (
+ recommendations.get('primary_language')
+ or recommendations.get('content_language')
+ or recommendations.get('language')
+ )
+ if isinstance(value, dict):
+ return value.get('value') or value.get('id') or value.get('code') or ''
+ return value
+
+
+def _primary_language_error(recommendations: dict) -> Optional[str]:
+ """Require a content-language source of truth for the new staged flow."""
+ value = _recommendation_language(recommendations)
+ if not isinstance(value, str) or not value.strip():
+ return (
+ 'Stage 1 recommendations must declare a non-empty primary language; '
+ 'lang controls only the Confirm UI language'
+ )
+ return None
+
+
+def _typography_font_value(
+ font: dict,
+ field: str,
+ *,
+ english_primary: bool,
+) -> object:
+ """Return a canonical typography font value, accepting its language-aware alias."""
+ legacy_field = 'latin' if field == 'english' or english_primary else 'cjk'
+ value = font.get(field)
+ if not isinstance(value, str) or not value.strip():
+ value = font.get(legacy_field)
+ return value
+
+
+def _typography_error(
+ typography: object,
+ label: str,
+ *,
+ require_sizes: bool,
+ main_language: object = '',
+) -> Optional[str]:
"""Validate one complete user-facing typography recommendation or choice."""
if not isinstance(typography, dict):
return f'{label} must be an object'
+ english_primary = _is_english_language(main_language)
for role in ('heading', 'body'):
font = typography.get(role)
if not isinstance(font, dict):
return f'{label}.{role} must be an object'
- for field in ('cjk', 'latin', 'css'):
- if not isinstance(font.get(field), str) or not font[field].strip():
- return f'{label}.{role}.{field} must be non-empty'
+ fields = (('primary', 'latin' if english_primary else 'cjk'),)
+ if not english_primary:
+ fields += (('english', 'latin'),)
+ for field, legacy_field in fields:
+ value = _typography_font_value(
+ font,
+ field,
+ english_primary=english_primary,
+ )
+ if not isinstance(value, str) or not value.strip():
+ return (
+ f'{label}.{role}.{field} '
+ f'(or legacy {legacy_field}) must be non-empty'
+ )
+ if not isinstance(font.get('css'), str) or not font['css'].strip():
+ return f'{label}.{role}.css must be non-empty'
if not _positive_number(typography.get('body_size')):
return f'{label}.body_size must be a positive number'
if not require_sizes:
@@ -576,6 +645,72 @@ def _typography_error(typography: object, label: str, *, require_sizes: bool) ->
return None
+def _typography_signature(
+ typography: dict,
+ *,
+ main_language: object,
+) -> tuple[str, ...]:
+ """Return the language-relevant font choices that distinguish one candidate."""
+ english_primary = _is_english_language(main_language)
+ fields = ('primary',) if english_primary else ('primary', 'english')
+ values = []
+ for role in ('heading', 'body'):
+ font = typography[role]
+ for field in fields:
+ value = _typography_font_value(
+ font,
+ field,
+ english_primary=english_primary,
+ )
+ values.append(str(value).strip().casefold())
+ return tuple(values)
+
+
+def _typography_candidates_distinct_error(
+ candidates: list,
+ labels: list[str],
+ *,
+ main_language: object,
+) -> Optional[str]:
+ """Require every candidate to offer a different relevant font combination."""
+ fixed = [
+ isinstance(candidate, dict) and candidate.get('fixed') is True
+ for candidate in candidates
+ ]
+ if any(fixed):
+ if not all(fixed):
+ return 'typography.fixed must be true on every candidate or omitted'
+ signatures = [
+ _typography_signature(
+ candidate,
+ main_language=main_language,
+ )
+ for candidate in candidates
+ ]
+ if any(signature != signatures[0] for signature in signatures[1:]):
+ return 'fixed typography candidates must repeat the same font combination'
+ return None
+ seen = {}
+ for index, candidate in enumerate(candidates):
+ signature = _typography_signature(
+ candidate,
+ main_language=main_language,
+ )
+ if signature in seen:
+ previous = seen[signature]
+ combination = (
+ 'heading/body primary'
+ if _is_english_language(main_language)
+ else 'heading/body primary+english'
+ )
+ return (
+ f'{labels[index]} repeats {labels[previous]}; '
+ f'{combination} combinations must differ'
+ )
+ seen[signature] = index
+ return None
+
+
def _candidate_list(spec: object) -> list:
"""Return candidates from the current or legacy recommendation shape."""
if not isinstance(spec, dict):
@@ -586,13 +721,19 @@ def _candidate_list(spec: object) -> list:
return candidates if isinstance(candidates, list) else []
-def _stage2_design_directions_error(recommendations: dict) -> Optional[str]:
+def _stage2_design_directions_error(
+ recommendations: dict,
+ *,
+ main_language: object = '',
+) -> Optional[str]:
"""Require three complete coordinated Stage 2 design systems."""
+ main_language = main_language or _recommendation_language(recommendations)
directions = recommendations.get('design_directions')
if isinstance(directions, dict):
candidates = _candidate_list(directions)
if len(candidates) < 3:
return 'Stage 2 design_directions must include at least 3 candidates'
+ typography_candidates = []
for index, candidate in enumerate(candidates, start=1):
label = f'design_directions.candidates[{index - 1}]'
if not isinstance(candidate, dict):
@@ -609,16 +750,25 @@ def _stage2_design_directions_error(recommendations: dict) -> Optional[str]:
candidate.get('typography'),
f'{label}.typography',
require_sizes=False,
+ main_language=main_language,
)
if error:
return error
+ typography_candidates.append(candidate['typography'])
if _uses_ai_images(recommendations):
image_strategy = candidate.get('image_strategy')
if not isinstance(image_strategy, dict) or not str(
image_strategy.get('rendering') or ''
).strip():
return f'{label}.image_strategy.rendering must be non-empty'
- return None
+ return _typography_candidates_distinct_error(
+ typography_candidates,
+ [
+ f'design_directions.candidates[{index}].typography'
+ for index in range(len(typography_candidates))
+ ],
+ main_language=main_language,
+ )
# Legacy staged files remain readable, but they must still provide three
# complete color combinations and at least one complete typography choice.
@@ -632,14 +782,26 @@ def _stage2_design_directions_error(recommendations: dict) -> Optional[str]:
typography = _candidate_list(recommendations.get('typography'))
if not typography:
return 'Stage 2 recommendations must include typography candidates'
+ if main_language and len(typography) < 3:
+ return 'Stage 2 recommendations must include 3 typography candidates'
for index, candidate in enumerate(typography):
error = _typography_error(
candidate,
f'typography.candidates[{index}]',
require_sizes=False,
+ main_language=main_language,
)
if error:
return error
+ if main_language:
+ return _typography_candidates_distinct_error(
+ typography,
+ [
+ f'typography.candidates[{index}]'
+ for index in range(len(typography))
+ ],
+ main_language=main_language,
+ )
return None
@@ -703,7 +865,20 @@ def _submission_stage_error(
return 'legacy single-pass recommendations accept only a final submission'
return None
+ if rec_stage_number == 1:
+ language_error = _primary_language_error(recommendations)
+ if language_error:
+ return language_error
+
if rec_stage_number == 2:
+ try:
+ previous_result = _read_json_object(confirm_dir / RESULT_NAME)
+ except (OSError, json.JSONDecodeError, ValueError):
+ previous_result = {}
+ main_language = (
+ _recommendation_language(previous_result)
+ or _recommendation_language(recommendations)
+ )
recommendation_error = _template_stage2_error(
recommendations,
template_required=template_required,
@@ -713,7 +888,10 @@ def _submission_stage_error(
recommendation_error = _stage2_custom_candidates_error(recommendations)
if recommendation_error:
return recommendation_error
- recommendation_error = _stage2_design_directions_error(recommendations)
+ recommendation_error = _stage2_design_directions_error(
+ recommendations,
+ main_language=main_language,
+ )
if recommendation_error:
return recommendation_error
@@ -764,7 +942,11 @@ def _custom_selection_error(result: dict) -> Optional[str]:
return None
-def _stage2_solution_error(result: dict) -> Optional[str]:
+def _stage2_solution_error(
+ result: dict,
+ *,
+ main_language: object = '',
+) -> Optional[str]:
"""Reject a Stage 2/final payload with an incomplete design system."""
color = result.get('color')
color_error = _palette_error(color, 'color')
@@ -781,6 +963,7 @@ def _stage2_solution_error(result: dict) -> Optional[str]:
typography,
'typography',
require_sizes=True,
+ main_language=main_language,
)
if typography_error:
return typography_error
@@ -1014,6 +1197,9 @@ def _merge_confirmed_choices(data: dict, result_file: Path) -> None:
recommend = data.setdefault('recommend', {})
if not isinstance(recommend, dict):
recommend = data['recommend'] = {}
+ main_language = _recommendation_language(res)
+ if main_language:
+ data['primary_language'] = main_language
for key in _CONTRACT_RECOMMEND_KEYS:
if res.get(key) not in (None, ''):
recommend[key] = res[key]
@@ -1481,6 +1667,10 @@ def create_app(
rec_stage_number = _recommendation_stage(data)
if rec_stage_number >= 2 and result_file.exists():
_merge_confirmed_choices(data, result_file)
+ if rec_stage_number == 1:
+ language_error = _primary_language_error(data)
+ if language_error:
+ return jsonify({'error': language_error}), 409
if rec_stage_number == 2:
recommendation_error = _template_stage2_error(
data,
@@ -1550,8 +1740,27 @@ def create_app(
except (OSError, json.JSONDecodeError, ValueError):
rec_file = _active_recommendations_path(confirm_dir)
current_recommendations = {}
- if stage == 'stage2' or _recommendation_stage(current_recommendations) == 3:
- solution_error = _stage2_solution_error(result)
+ rec_stage_number = _recommendation_stage(current_recommendations)
+ previous_result = {}
+ if rec_stage_number >= 2:
+ try:
+ previous_result = _read_json_object(result_file)
+ except (OSError, json.JSONDecodeError, ValueError):
+ pass
+ main_language = (
+ _recommendation_language(previous_result)
+ or _recommendation_language(current_recommendations)
+ )
+ if rec_stage_number > 0:
+ if main_language:
+ result['primary_language'] = main_language
+ else:
+ result.pop('primary_language', None)
+ if stage == 'stage2' or rec_stage_number == 3:
+ solution_error = _stage2_solution_error(
+ result,
+ main_language=main_language,
+ )
if solution_error:
return jsonify({'error': solution_error}), 400
if stage not in {'stage1', 'stage2'}:
diff --git a/skills/ppt-master/scripts/confirm_ui/static/app.js b/skills/ppt-master/scripts/confirm_ui/static/app.js
index 1812fdba..273ebddb 100644
--- a/skills/ppt-master/scripts/confirm_ui/static/app.js
+++ b/skills/ppt-master/scripts/confirm_ui/static/app.js
@@ -104,6 +104,13 @@
proactive_narration_audio_desc: "Off by default. This raw choice does not rewrite the speaker-notes toggle; the Strategist resolves narration's effective notes dependency in the Design Spec.",
font_heading: "Heading",
font_body: "Body",
+ font_selection: "Font selection",
+ primary_language_font: "Primary-language font",
+ english_font: "English font",
+ font_picker_hint: "Choosing a recommendation fills these selectors. Changing any font marks the typography as customized.",
+ other_installed_font: "Other installed font…",
+ other_font_placeholder: "Exact installed font name",
+ customized: "Customized",
font_body_size: "Body baseline size",
font_body_size_hint: "All type sizes derive from this body baseline.",
body_size_unit_relation: "SVG px to PPT pt: 1px = 0.75pt.",
@@ -119,7 +126,7 @@
size_role_subtitle: "subtitle",
size_role_annotation: "annotation",
custom_typography: "Custom typography",
- custom_typography_repair: "Complete the four concrete font names to continue.",
+ custom_typography_repair: "Complete the concrete font names required for this project to continue.",
custom_color: "Custom color",
custom_color_placeholder: "Describe your colors in words, e.g. deep navy primary, warm orange accent, white background — or paste HEX values…",
role_background: "bg",
@@ -251,6 +258,13 @@
proactive_narration_audio_desc: "初期設定はオフです。この選択は発表者ノートの設定を書き換えません。ナレーションに必要なノートの有効状態は、ストラテジストが設計仕様で解決します。",
font_heading: "見出し",
font_body: "本文",
+ font_selection: "フォント選択",
+ primary_language_font: "主要言語のフォント",
+ english_font: "英語フォント",
+ font_picker_hint: "提案を選ぶと下の選択欄に反映されます。いずれかのフォントを変更するとカスタマイズ済みになります。",
+ other_installed_font: "その他のインストール済みフォント…",
+ other_font_placeholder: "インストール済みフォントの正確な名前",
+ customized: "カスタマイズ済み",
font_body_size: "本文の基準サイズ",
font_body_size_hint: "すべての文字サイズはこの本文基準から導出されます。",
body_size_unit_relation: "SVG px と PPT pt の換算:1px = 0.75pt。",
@@ -266,7 +280,7 @@
size_role_subtitle: "サブタイトル",
size_role_annotation: "注釈",
custom_typography: "カスタムタイポグラフィ",
- custom_typography_repair: "続行するには、4つの具体的な書体名を入力してください。",
+ custom_typography_repair: "続行するには、このプロジェクトに必要な具体的な書体名を入力してください。",
custom_color: "カスタム配色",
custom_color_placeholder: "配色を言葉で説明 — 例:濃紺をメインに暖色オレンジのアクセント、背景は白 — またはHEX値を貼り付け…",
role_background: "背景",
@@ -398,6 +412,13 @@
proactive_narration_audio_desc: "默认关闭。这里保留原始选择,不改写演讲者备注开关;策略师会在设计规范中解析旁白所需的最终备注状态。",
font_heading: "标题",
font_body: "正文",
+ font_selection: "字体选择",
+ primary_language_font: "主要语言字体",
+ english_font: "英文字体",
+ font_picker_hint: "选择推荐方案会同步下方字体;修改任一下拉或手动字体后会标记为已自定义。",
+ other_installed_font: "其他已安装字体…",
+ other_font_placeholder: "输入精确的已安装字体名称",
+ customized: "已自定义",
font_body_size: "正文基准字号",
font_body_size_hint: "所有字号按这个正文基准推导。",
body_size_unit_relation: "SVG px 与 PPT pt 的换算:1px = 0.75pt。",
@@ -413,7 +434,7 @@
size_role_subtitle: "副标题",
size_role_annotation: "注释",
custom_typography: "自定义字体方案",
- custom_typography_repair: "请补全四个具体字体名称后继续。",
+ custom_typography_repair: "请补全当前项目所需的具体字体名称后继续。",
custom_color: "自定义配色",
custom_color_placeholder: "用文字描述配色,如:深蓝主色、暖橙强调、白色背景——或直接粘贴 HEX 值…",
role_background: "背景",
@@ -1026,41 +1047,186 @@
return collect(c);
}
- function normTypography(c) {
- c = c || {};
- if (c.heading && typeof c.heading === "object" && c.body && typeof c.body === "object") {
- return Object.assign({}, c, {
- body_size: typographyBodySize(c),
- heading: Object.assign({}, c.heading, {
- sample_cjk: c.heading.sample_cjk || c.sample_heading || "",
- sample_latin: c.heading.sample_latin || c.sample_heading_latin || ""
- }),
- body: Object.assign({}, c.body, {
- sample_cjk: c.body.sample_cjk || c.sample_body || "",
- sample_latin: c.body.sample_latin || c.sample_body_latin || ""
- })
- });
+ function recommendationLanguage() {
+ // `lang` controls the Confirm UI language; it is not evidence of the
+ // deck's content language. New staged files carry `primary_language`.
+ var raw = REC && (REC.primary_language || REC.content_language || REC.language);
+ if (raw && typeof raw === "object") {
+ raw = raw.value || raw.id || raw.code || "";
}
- return {
- name: c.name || "",
- note: c.note || "",
- custom: c.custom || "",
- body_size: typographyBodySize(c),
- heading: {
- cjk: c.heading || "",
- latin: c.heading_latin || "",
- css: c.heading_css || "",
- sample_cjk: c.sample_heading || "",
- sample_latin: c.sample_heading_latin || ""
- },
- body: {
- cjk: c.body || "",
- latin: c.body_latin || "",
- css: c.body_css || "",
- sample_cjk: c.sample_body || "",
- sample_latin: c.sample_body_latin || ""
+ raw = String(raw || "und").trim().toLowerCase().replace(/_/g, "-");
+ if (raw === "english") return "en";
+ if (raw === "chinese") return "zh";
+ if (raw === "japanese") return "ja";
+ if (raw === "korean") return "ko";
+ return raw;
+ }
+
+ function isEnglishProject() {
+ return /^en(?:-|$)/.test(recommendationLanguage());
+ }
+
+ function stringList(value) {
+ if (Array.isArray(value)) return value.map(String);
+ if (value == null || value === "") return [];
+ return [String(value)];
+ }
+
+ function normalizedFontToken(value) {
+ return String(value || "").trim().toLowerCase().replace(/[_\s]+/g, "-");
+ }
+
+ function fontScriptTokens(language) {
+ var parts = normalizedFontToken(language).split("-");
+ var base = parts[0];
+ if (!base || base === "und") return [];
+ var explicitScript = parts.filter(function (part) {
+ return /^[a-z]{4}$/.test(part);
+ })[0];
+ if (explicitScript) return [explicitScript];
+ if (base === "en") return ["latin", "latn", "english"];
+ if (base === "zh") {
+ if (parts.indexOf("cn") >= 0 || parts.indexOf("sg") >= 0) {
+ return ["han", "hans", "cjk", "chinese", "zh"];
+ }
+ if (parts.indexOf("tw") >= 0 || parts.indexOf("hk") >= 0 ||
+ parts.indexOf("mo") >= 0) {
+ return ["han", "hant", "cjk", "chinese", "zh"];
}
+ return ["han", "hans", "cjk", "chinese", "zh"];
+ }
+ if (base === "ja") return ["han", "jpan", "kana", "hiragana", "katakana", "cjk", "japanese", "ja"];
+ if (base === "ko") return ["hangul", "kore", "han", "cjk", "korean", "ko"];
+ if (["ru", "uk", "bg", "sr", "mk"].indexOf(base) >= 0) return ["cyrl", "cyrillic"];
+ if (["ar", "fa", "ur"].indexOf(base) >= 0) return ["arab", "arabic"];
+ if (base === "he" || base === "iw") return ["hebr", "hebrew"];
+ if (base === "el") return ["grek", "greek"];
+ if (base === "th") return ["thai"];
+ if (base === "hi" || base === "mr" || base === "ne") return ["deva", "devanagari"];
+ // Most remaining presentation locales use Latin script. Locale metadata
+ // still wins before this fallback.
+ return ["latin", "latn"];
+ }
+
+ function fontSupportsLanguage(font, language) {
+ var target = normalizedFontToken(language);
+ var targetBase = target.split("-")[0];
+ var locales = stringList(font && font.locales).map(normalizedFontToken);
+ if (locales.some(function (locale) {
+ return locale === "*" || locale === target ||
+ (target !== targetBase && locale === targetBase);
+ })) return true;
+
+ var supportedScripts = stringList(font && font.scripts).map(normalizedFontToken);
+ var wantedScripts = fontScriptTokens(language);
+ if (supportedScripts.some(function (script) {
+ return wantedScripts.indexOf(script) >= 0;
+ })) return true;
+
+ // A catalog entry without language metadata remains usable. Once either
+ // metadata field is present, filtering follows it.
+ return !locales.length && !supportedScripts.length;
+ }
+
+ function fontCatalogEntries(field) {
+ var fonts = (CAT && Array.isArray(CAT.fonts)) ? CAT.fonts : [];
+ var language = field === "english" ? "en" : recommendationLanguage();
+ if (field === "primary" && language === "und") {
+ return fonts.filter(function (font) { return font && font.id; });
+ }
+ var matching = fonts.filter(function (font) {
+ return font && font.id && fontSupportsLanguage(font, language);
+ });
+ return matching;
+ }
+
+ function findFontCatalogEntry(id) {
+ var fonts = (CAT && Array.isArray(CAT.fonts)) ? CAT.fonts : [];
+ var target = String(id || "").trim().toLowerCase();
+ for (var i = 0; i < fonts.length; i += 1) {
+ if (String(fonts[i].id || "").trim().toLowerCase() === target) return fonts[i];
+ }
+ return null;
+ }
+
+ function derivedFontCss(font) {
+ var primary = findFontCatalogEntry(font && font.primary);
+ return String((primary && primary.css) || "sans-serif").trim() ||
+ "sans-serif";
+ }
+
+ function normalizedFontRole(font, samples) {
+ font = (font && typeof font === "object") ? Object.assign({}, font) : {};
+ samples = samples || {};
+ var primary = font.primary;
+ var english = font.english;
+ if (isEnglishProject()) {
+ primary = primary || font.latin || font.cjk || "";
+ english = "";
+ } else {
+ primary = primary || font.cjk || "";
+ english = english || font.latin || "";
+ }
+ font.primary = primary;
+ if (isEnglishProject()) delete font.english;
+ else font.english = english;
+ font.sample_primary = font.sample_primary ||
+ (isEnglishProject() ? font.sample_latin : font.sample_cjk) ||
+ samples.primary || "";
+ if (isEnglishProject()) {
+ delete font.sample_english;
+ } else {
+ font.sample_english = font.sample_english || font.sample_latin ||
+ samples.english || "";
+ }
+ delete font.cjk;
+ delete font.latin;
+ delete font.sample_cjk;
+ delete font.sample_latin;
+ if (!String(font.css || "").trim()) font.css = derivedFontCss(font);
+ return font;
+ }
+
+ function normTypography(c) {
+ c = c || {};
+ var normalized = Object.assign({}, c);
+ var objectShape = c.heading && typeof c.heading === "object" &&
+ c.body && typeof c.body === "object";
+ var heading = objectShape ? c.heading : {
+ primary: isEnglishProject() ? (c.heading_latin || c.heading || "") : (c.heading || ""),
+ english: isEnglishProject() ? "" : (c.heading_latin || ""),
+ css: c.heading_css || ""
+ };
+ var body = objectShape ? c.body : {
+ primary: isEnglishProject() ? (c.body_latin || c.body || "") : (c.body || ""),
+ english: isEnglishProject() ? "" : (c.body_latin || ""),
+ css: c.body_css || ""
};
+ normalized.name = c.name || "";
+ normalized.note = c.note || "";
+ normalized.custom = c.custom || "";
+ normalized.body_size = typographyBodySize(c);
+ normalized.heading = normalizedFontRole(heading, {
+ primary: isEnglishProject()
+ ? (c.sample_heading_latin || c.sample_heading || "")
+ : (c.sample_heading || ""),
+ english: c.sample_heading_latin || ""
+ });
+ normalized.body = normalizedFontRole(body, {
+ primary: isEnglishProject()
+ ? (c.sample_body_latin || c.sample_body || "")
+ : (c.sample_body || ""),
+ english: c.sample_body_latin || ""
+ });
+ delete normalized.heading_latin;
+ delete normalized.body_latin;
+ delete normalized.heading_css;
+ delete normalized.body_css;
+ delete normalized.sample_heading;
+ delete normalized.sample_heading_latin;
+ delete normalized.sample_body;
+ delete normalized.sample_body_latin;
+ return normalized;
}
function typographyBodySize(c) {
@@ -1642,7 +1808,14 @@
function normalizeTypographyForSubmit(payload) {
if (!payload.typography || typeof payload.typography !== "object") return;
- var typ = payload.typography;
+ var typ = normTypography(payload.typography);
+ payload.typography = typ;
+ if (isEnglishProject()) {
+ ["heading", "body"].forEach(function (role) {
+ delete typ[role].english;
+ delete typ[role].sample_english;
+ });
+ }
var body = parseFloat(typ.body_size);
if (!isFinite(body)) {
// Cleared / invalid body field — fall back so role sizes never submit
@@ -1812,7 +1985,9 @@
typography = normTypography(typography || {});
return ["heading", "body"].every(function (role) {
var font = typography[role] || {};
- return ["cjk", "latin", "css"].every(function (field) {
+ var fields = isEnglishProject() ? ["primary", "css"] :
+ ["primary", "english", "css"];
+ return fields.every(function (field) {
return !!String(font[field] || "").trim();
});
});
@@ -1823,22 +1998,66 @@
!typographyFamiliesComplete(STATE.typography));
}
- function sampleText(role, script) {
- if (role === "heading") return t(script === "latin" ? "preview_latin_title" : "preview_big_title");
- return t(script === "latin" ? "preview_latin_body" : "preview_body_intro");
+ function sampleText(role, field) {
+ var useEnglish = field === "english" || isEnglishProject();
+ if (role === "heading") {
+ return t(useEnglish ? "preview_latin_title" : "preview_big_title");
+ }
+ return t(useEnglish ? "preview_latin_body" : "preview_body_intro");
}
function fontSample(box, slot, css, role) {
var line = el("div", "font-sample-line");
- var cjk = el("span", "fs-cjk", sampleText(role, "cjk"));
- var lat = el("span", "fs-latin", sampleText(role, "latin"));
- var cjkStack = previewFontStack(slot.cjk, css);
- var latinStack = previewFontStack(slot.latin, css);
- if (cjkStack) cjk.style.fontFamily = cjkStack;
- if (latinStack) lat.style.fontFamily = latinStack;
- if (cjkStack) cjk.title = cjkStack;
- if (latinStack) lat.title = latinStack;
- line.appendChild(cjk); line.appendChild(lat); box.appendChild(line);
+ var primary = el("span", "fs-primary",
+ slot.sample_primary || sampleText(role, "primary"));
+ var primaryStack = previewFontStack(slot.primary, css);
+ if (primaryStack) primary.style.fontFamily = primaryStack;
+ if (primaryStack) primary.title = primaryStack;
+ line.appendChild(primary);
+ if (!isEnglishProject()) {
+ var english = el("span", "fs-english",
+ slot.sample_english || sampleText(role, "english"));
+ var englishStack = previewFontStack(slot.english, css);
+ if (englishStack) english.style.fontFamily = englishStack;
+ if (englishStack) english.title = englishStack;
+ line.appendChild(english);
+ }
+ box.appendChild(line);
+ }
+
+ function fontChoiceLabel(font) {
+ var label = localized(font, "label") || font.id;
+ if (String(label).toLowerCase() === String(font.id).toLowerCase()) {
+ return String(font.id);
+ }
+ return label + " · " + font.id;
+ }
+
+ function typographyFieldLabel(field) {
+ if (field === "english") return t("english_font");
+ return t("primary_language_font");
+ }
+
+ function typographyChoiceConfigs() {
+ var configs = [];
+ ["heading", "body"].forEach(function (role) {
+ configs.push([role, "primary"]);
+ if (!isEnglishProject()) configs.push([role, "english"]);
+ });
+ return configs;
+ }
+
+ function typographySignature(typography) {
+ typography = normTypography(typography || {});
+ var fields = isEnglishProject() ? ["primary"] : ["primary", "english"];
+ var values = [];
+ ["heading", "body"].forEach(function (role) {
+ fields.forEach(function (field) {
+ values.push(String((typography[role] || {})[field] || "")
+ .trim().toLowerCase());
+ });
+ });
+ return values.join("\u0000");
}
function renderTypography(host) {
@@ -1848,25 +2067,53 @@
setSectionNote(sec, t("custom_typography_repair"));
}
var grid = el("div", "font-grid");
- var customFields = el("div", "custom-typography-fields");
+ var customFields = el("div", "custom-typography-fields font-picker-fields");
var customInputs = {};
var customLegacyNote = el("div", "toggle-desc custom-typography-legacy");
+ var pickerHead = el("div", "font-picker-head");
+ pickerHead.appendChild(el("span", "subfield-label", t("font_selection")));
+ var customStatus = el("span", "font-custom-status", t("customized"));
+ pickerHead.appendChild(customStatus);
+ customFields.appendChild(pickerHead);
+ customFields.appendChild(el("div", "toggle-desc font-picker-hint", t("font_picker_hint")));
customFields.appendChild(customLegacyNote);
- customFields.style.display = "none";
function syncCustomInputs() {
var typography = STATE.typography || {};
customLegacyNote.textContent = String(typography.custom || "").trim();
customLegacyNote.style.display = customLegacyNote.textContent ? "block" : "none";
- ["heading", "body"].forEach(function (role) {
- var font = typography[role] || {};
- ["cjk", "latin"].forEach(function (script) {
- var input = customInputs[role + "_" + script];
- if (input) input.value = font[script] || "";
- });
+ customStatus.style.display = typography.name === "custom" ? "inline-flex" : "none";
+ typographyChoiceConfigs().forEach(function (config) {
+ var role = config[0], field = config[1];
+ var control = customInputs[role + "_" + field];
+ if (!control) return;
+ var value = String((typography[role] || {})[field] || "");
+ var matchingFont = control.options.filter(function (font) {
+ return String(font.id).toLowerCase() === value.toLowerCase();
+ })[0];
+ control.select.value = matchingFont ? matchingFont.id : "__other__";
+ control.other.value = matchingFont ? "" : value;
+ control.other.style.display = matchingFont ? "none" : "block";
});
}
+ function markCustomTypography() {
+ if (!STATE.typography) {
+ STATE.typography = { name: "custom", heading: {}, body: {} };
+ }
+ STATE.typography.name = "custom";
+ grid.querySelectorAll(".font-card").forEach(function (card) {
+ card.classList.remove("selected");
+ });
+ customCard.classList.add("selected");
+ customStatus.style.display = "inline-flex";
+ }
+
+ function updateRoleCss(role) {
+ if (!STATE.typography[role]) STATE.typography[role] = {};
+ STATE.typography[role].css = derivedFontCss(STATE.typography[role]);
+ }
+
function selectFont(idx) {
var c = normTypography(cands[idx] || {});
var prev = STATE.typography || {};
@@ -1881,37 +2128,23 @@
sizes: Object.assign({}, prev.sizes || {})
};
if (sizeInput) sizeInput.value = STATE.typography.body_size || "";
- customFields.style.display = "none";
grid.querySelectorAll(".font-card").forEach(function (card, i) { card.classList.toggle("selected", i === idx); });
+ syncCustomInputs();
refreshSizeInputs(); // fill any role with no value yet; never overwrites existing values
refreshStylePreview();
}
function selectCustomTypography() {
var prev = STATE.typography || {};
- var prevHeading = prev.heading || {};
- var prevBody = prev.body || {};
- STATE.typography = {
- name: "custom",
- heading: {
- cjk: prevHeading.cjk || "",
- latin: prevHeading.latin || "",
- css: prevHeading.css || "sans-serif"
- },
- body: {
- cjk: prevBody.cjk || "",
- latin: prevBody.latin || "",
- css: prevBody.css || "sans-serif"
- },
- body_size: prev.body_size || "",
- sizes: Object.assign({}, prev.sizes || {}) // switching font family must not drop sizes
- };
- if (prev.custom) STATE.typography.custom = prev.custom;
- grid.querySelectorAll(".font-card").forEach(function (card) { card.classList.remove("selected"); });
- customCard.classList.add("selected");
- customFields.style.display = "grid";
+ STATE.typography = normTypography(prev);
+ STATE.typography.name = "custom";
+ STATE.typography.body_size = prev.body_size || "";
+ // Switching font family must not drop any explicit size.
+ STATE.typography.sizes = Object.assign({}, prev.sizes || {});
+ markCustomTypography();
syncCustomInputs();
- customInputs.heading_cjk.focus();
+ var firstControl = customInputs.heading_primary;
+ if (firstControl) firstControl.select.focus();
refreshSizeInputs();
refreshStylePreview();
}
@@ -1922,8 +2155,13 @@
var card = el("div", "font-card");
var top = el("div", "font-card-head");
top.appendChild(el("span", "font-card-name", localized(c, "name") || (t("option_prefix") + " " + (idx + 1))));
- var meta = t("font_heading") + " " + t("cjk") + ":" + (head.cjk || "—") + " / " + t("latin") + ":" + (head.latin || "—")
- + " · " + t("font_body") + " " + t("cjk") + ":" + (body.cjk || "—") + " / " + t("latin") + ":" + (body.latin || "—");
+ var metaFields = isEnglishProject() ? ["primary"] : ["primary", "english"];
+ var meta = ["heading", "body"].map(function (role) {
+ var slot = role === "heading" ? head : body;
+ return t("font_" + role) + " " + metaFields.map(function (field) {
+ return typographyFieldLabel(field) + ": " + (slot[field] || "—");
+ }).join(" / ");
+ }).join(" · ");
top.appendChild(el("span", "font-card-meta", meta));
card.appendChild(top);
var hbox = el("div", "font-sample-heading-box"); fontSample(hbox, head, head.css, "heading"); card.appendChild(hbox);
@@ -1937,27 +2175,59 @@
customCard.addEventListener("click", selectCustomTypography);
grid.appendChild(customCard);
sec.appendChild(grid);
- [
- ["heading", "cjk", "Microsoft YaHei"],
- ["heading", "latin", "Arial"],
- ["body", "cjk", "Microsoft YaHei"],
- ["body", "latin", "Arial"]
- ].forEach(function (config) {
- var role = config[0], script = config[1];
+ typographyChoiceConfigs().forEach(function (config) {
+ var role = config[0], fieldName = config[1];
var field = el("label", "custom-typography-field");
- field.appendChild(el("span", "hex-cell-label", t("font_" + role) + " · " + t(script)));
- var input = el("input", "text-input");
+ field.appendChild(el("span", "hex-cell-label",
+ t("font_" + role) + " · " + typographyFieldLabel(fieldName)));
+ var options = fontCatalogEntries(fieldName);
+ var select = el("select", "font-select");
+ options.forEach(function (font) {
+ var option = document.createElement("option");
+ option.value = font.id;
+ option.textContent = fontChoiceLabel(font);
+ select.appendChild(option);
+ });
+ var otherOption = document.createElement("option");
+ otherOption.value = "__other__";
+ otherOption.textContent = t("other_installed_font");
+ select.appendChild(otherOption);
+ var input = el("input", "text-input other-font-input");
input.type = "text";
- input.placeholder = config[2];
+ input.placeholder = t("other_font_placeholder");
+ select.addEventListener("change", function () {
+ markCustomTypography();
+ if (!STATE.typography[role]) {
+ STATE.typography[role] = { css: "sans-serif" };
+ }
+ if (select.value === "__other__") {
+ input.value = "";
+ input.style.display = "block";
+ STATE.typography[role][fieldName] = "";
+ input.focus();
+ } else {
+ input.value = "";
+ input.style.display = "none";
+ STATE.typography[role][fieldName] = select.value;
+ }
+ updateRoleCss(role);
+ refreshStylePreview();
+ });
input.addEventListener("input", function () {
- if (!STATE.typography || STATE.typography.name !== "custom") return;
+ markCustomTypography();
if (!STATE.typography[role]) {
STATE.typography[role] = { css: "sans-serif" };
}
- STATE.typography[role][script] = input.value;
+ STATE.typography[role][fieldName] = input.value;
+ updateRoleCss(role);
refreshStylePreview();
});
- customInputs[role + "_" + script] = input;
+ customInputs[role + "_" + fieldName] = {
+ select: select,
+ other: input,
+ options: options
+ };
+ field.appendChild(select);
field.appendChild(input);
customFields.appendChild(field);
});
@@ -2089,17 +2359,20 @@
host.appendChild(sec);
var selIdx = -1;
+ var stateSignature = typographySignature(STATE.typography || {});
if (STATE.typography && STATE.typography.name !== "custom") cands.forEach(function (c, i) {
- if ((localized(c, "name") || c.name) === STATE.typography.name) selIdx = i;
+ var sameName = (localized(c, "name") || c.name) === STATE.typography.name;
+ if (sameName || typographySignature(c) === stateSignature) selIdx = i;
});
if (selIdx >= 0) selectFont(selIdx);
else if (STATE.typography && STATE.typography.name === "custom") {
["heading", "body"].forEach(function (role) {
if (!STATE.typography[role]) STATE.typography[role] = {};
- if (!STATE.typography[role].css) STATE.typography[role].css = "sans-serif";
+ if (!STATE.typography[role].css) updateRoleCss(role);
});
customCard.classList.add("selected");
- customFields.style.display = "grid";
+ syncCustomInputs();
+ } else {
syncCustomInputs();
}
}
@@ -2127,15 +2400,15 @@
var card = el("div", "style-preview-card");
var textcol = el("div", "sp-textcol");
var title = el("div", "sp-title");
- var titleCjk = el("span", "sp-title-cjk");
- var titleLat = el("span", "sp-title-lat");
- title.appendChild(titleCjk); title.appendChild(titleLat);
+ var titlePrimary = el("span", "sp-title-primary");
+ var titleEnglish = el("span", "sp-title-english");
+ title.appendChild(titlePrimary); title.appendChild(titleEnglish);
var bodyRow = el("div", "sp-body");
var accentBar = el("span", "sp-accent-bar");
var bodyWrap = el("div", "sp-body-wrap");
- var bodyCjk = el("span", "sp-body-cjk");
- var bodyLat = el("span", "sp-body-lat");
- bodyWrap.appendChild(bodyCjk); bodyWrap.appendChild(bodyLat);
+ var bodyPrimary = el("span", "sp-body-primary");
+ var bodyEnglish = el("span", "sp-body-english");
+ bodyWrap.appendChild(bodyPrimary); bodyWrap.appendChild(bodyEnglish);
bodyRow.appendChild(accentBar); bodyRow.appendChild(bodyWrap);
textcol.appendChild(title); textcol.appendChild(bodyRow);
var content = el("div", "sp-content");
@@ -2163,26 +2436,30 @@
// body_size is px everywhere — preview it directly, no conversion.
var rawSize = parseFloat(typ.body_size) || (isPptCanvas(STATE.canvas) ? 24 : 18);
var bodyPx = Math.max(12, Math.min(34, rawSize));
- var headStack = previewFontStack(head.cjk, head.css);
- var headLatStack = previewFontStack(head.latin, head.css);
- var bodyStack = previewFontStack(body.cjk, body.css);
- var bodyLatStack = previewFontStack(body.latin, body.css);
+ var headPrimaryStack = previewFontStack(head.primary, head.css);
+ var headEnglishStack = previewFontStack(head.english, head.css);
+ var bodyPrimaryStack = previewFontStack(body.primary, body.css);
+ var bodyEnglishStack = previewFontStack(body.english, body.css);
card.style.background = bg;
- titleCjk.textContent = t("preview_big_title");
- titleLat.textContent = t("preview_section_title");
+ titlePrimary.textContent = head.sample_primary ||
+ sampleText("heading", "primary");
+ titleEnglish.textContent = head.sample_english ||
+ sampleText("heading", "english");
title.style.color = pri;
title.style.fontSize = Math.round(bodyPx * 1.7) + "px";
- titleCjk.style.fontFamily = headStack || "";
- titleLat.style.fontFamily = headLatStack || "";
- // CJK and Latin previewed with their own stacks (mirrors the title
- // and the per-card font samples) so each script's font is visible.
- bodyCjk.textContent = t("preview_body_intro");
- bodyLat.textContent = "";
+ titlePrimary.style.fontFamily = headPrimaryStack || "";
+ titleEnglish.style.fontFamily = headEnglishStack || "";
+ bodyPrimary.textContent = body.sample_primary ||
+ sampleText("body", "primary");
+ bodyEnglish.textContent = body.sample_english ||
+ sampleText("body", "english");
bodyWrap.style.color = txt;
bodyWrap.style.fontSize = bodyPx + "px";
- bodyCjk.style.fontFamily = bodyStack || "";
- bodyLat.style.fontFamily = bodyLatStack || "";
+ bodyPrimary.style.fontFamily = bodyPrimaryStack || "";
+ bodyEnglish.style.fontFamily = bodyEnglishStack || "";
+ titleEnglish.style.display = isEnglishProject() ? "none" : "";
+ bodyEnglish.style.display = isEnglishProject() ? "none" : "";
accentBar.style.background = acc;
content.style.color = txt;
content.innerHTML = stylePreviewContentMarkup(STATE.icons);
@@ -2686,6 +2963,7 @@
}
function initStage1State() {
+ STATE.primary_language = recommendationLanguage();
STATE.canvas = pick("canvas", CAT.canvas);
STATE.audience = (REC.audience && REC.audience.value) || "";
STATE.communication_intent = (REC.communication_intent && REC.communication_intent.value) || "";
@@ -2801,7 +3079,7 @@
// ---- staged submit + next-stage transitions -------------------------
function communicationPayload() {
- return {
+ var payload = {
canvas: STATE.canvas,
audience: STATE.audience,
communication_intent: STATE.communication_intent,
@@ -2811,6 +3089,10 @@
artifact_afterlife: STATE.artifact_afterlife,
content_divergence: STATE.content_divergence
};
+ if (STATE.primary_language && STATE.primary_language !== "und") {
+ payload.primary_language = STATE.primary_language;
+ }
+ return payload;
}
function stage1Payload() {
diff --git a/skills/ppt-master/scripts/confirm_ui/static/catalogs.json b/skills/ppt-master/scripts/confirm_ui/static/catalogs.json
index b202d920..406d0b3e 100644
--- a/skills/ppt-master/scripts/confirm_ui/static/catalogs.json
+++ b/skills/ppt-master/scripts/confirm_ui/static/catalogs.json
@@ -1,5 +1,5 @@
{
- "_comment": "Enumerable (finite) option universe for the confirm page. Served by Flask static at /static/catalogs.json; the front-end prefers /api/catalogs when the server provides it. These fields list ALL options and the AI marks one as recommended via the active recommendation stage's `recommend` object. Open/generative fields (color, typography, generated-image style) are NOT here — the AI authors >=3 candidates each for those (creative recommendations always offer real choice). 'canvas' mirrors scripts/config.py CANVAS_FORMATS — keep in sync. User-facing catalog text supports label_zh/label_en/label_ja, desc_zh/desc_en/desc_ja, group_zh/group_en/group_ja.",
+ "_comment": "Enumerable (finite) option universe for the confirm page. Served by Flask static at /static/catalogs.json; the front-end prefers /api/catalogs when the server provides it. These fields list fixed options and the AI marks one as recommended via the active recommendation stage's `recommend` object. Color, coordinated typography recommendations, and generated-image style remain generative. `fonts` supplies the manual typography dropdowns outside those recommendations; users may still enter another installed font. 'canvas' mirrors scripts/config.py CANVAS_FORMATS — keep in sync. User-facing catalog text supports label_zh/label_en/label_ja, desc_zh/desc_en/desc_ja, group_zh/group_en/group_ja.",
"canvas": [
{
"id": "ppt169",
@@ -98,6 +98,260 @@
"use_ja": "印刷/PDF出力"
}
],
+ "fonts": [
+ {
+ "id": "Microsoft YaHei",
+ "label": "Microsoft YaHei",
+ "label_zh": "微软雅黑",
+ "label_en": "Microsoft YaHei",
+ "label_ja": "Microsoft YaHei",
+ "locales": ["zh-CN", "zh-SG", "zh-Hans"],
+ "scripts": ["Hans"],
+ "category": "sans-serif",
+ "css": "sans-serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "DengXian",
+ "label": "DengXian",
+ "label_zh": "等线",
+ "label_en": "DengXian",
+ "label_ja": "DengXian",
+ "locales": ["zh-CN", "zh-SG", "zh-Hans"],
+ "scripts": ["Hans"],
+ "category": "sans-serif",
+ "css": "sans-serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "SimHei",
+ "label": "SimHei",
+ "label_zh": "黑体",
+ "label_en": "SimHei",
+ "label_ja": "SimHei",
+ "locales": ["zh-CN", "zh-SG", "zh-Hans"],
+ "scripts": ["Hans"],
+ "category": "sans-serif",
+ "css": "sans-serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "SimSun",
+ "label": "SimSun",
+ "label_zh": "宋体",
+ "label_en": "SimSun",
+ "label_ja": "SimSun",
+ "locales": ["zh-CN", "zh-SG", "zh-Hans"],
+ "scripts": ["Hans"],
+ "category": "serif",
+ "css": "serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "FangSong",
+ "label": "FangSong",
+ "label_zh": "仿宋",
+ "label_en": "FangSong",
+ "label_ja": "FangSong",
+ "locales": ["zh-CN", "zh-SG", "zh-Hans"],
+ "scripts": ["Hans"],
+ "category": "serif",
+ "css": "serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "KaiTi",
+ "label": "KaiTi",
+ "label_zh": "楷体",
+ "label_en": "KaiTi",
+ "label_ja": "KaiTi",
+ "locales": ["zh-CN", "zh-SG", "zh-Hans"],
+ "scripts": ["Hans"],
+ "category": "calligraphic",
+ "css": "serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "Microsoft JhengHei",
+ "label": "Microsoft JhengHei",
+ "label_zh": "微软正黑体",
+ "label_en": "Microsoft JhengHei",
+ "label_ja": "Microsoft JhengHei",
+ "locales": ["zh-TW", "zh-HK", "zh-Hant"],
+ "scripts": ["Hant"],
+ "category": "sans-serif",
+ "css": "sans-serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "PMingLiU",
+ "label": "PMingLiU",
+ "label_zh": "新细明体",
+ "label_en": "PMingLiU",
+ "label_ja": "PMingLiU",
+ "locales": ["zh-TW", "zh-HK", "zh-Hant"],
+ "scripts": ["Hant"],
+ "category": "serif",
+ "css": "serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "Yu Gothic",
+ "label": "Yu Gothic",
+ "label_zh": "游哥特体",
+ "label_en": "Yu Gothic",
+ "label_ja": "游ゴシック",
+ "locales": ["ja-JP"],
+ "scripts": ["Jpan"],
+ "category": "sans-serif",
+ "css": "sans-serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "Meiryo",
+ "label": "Meiryo",
+ "label_zh": "Meiryo",
+ "label_en": "Meiryo",
+ "label_ja": "メイリオ",
+ "locales": ["ja-JP"],
+ "scripts": ["Jpan"],
+ "category": "sans-serif",
+ "css": "sans-serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "Yu Mincho",
+ "label": "Yu Mincho",
+ "label_zh": "游明朝体",
+ "label_en": "Yu Mincho",
+ "label_ja": "游明朝",
+ "locales": ["ja-JP"],
+ "scripts": ["Jpan"],
+ "category": "serif",
+ "css": "serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "Malgun Gothic",
+ "label": "Malgun Gothic",
+ "label_zh": "Malgun Gothic",
+ "label_en": "Malgun Gothic",
+ "label_ja": "Malgun Gothic",
+ "locales": ["ko-KR"],
+ "scripts": ["Kore"],
+ "category": "sans-serif",
+ "css": "sans-serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "Batang",
+ "label": "Batang",
+ "label_zh": "Batang",
+ "label_en": "Batang",
+ "label_ja": "Batang",
+ "locales": ["ko-KR"],
+ "scripts": ["Kore"],
+ "category": "serif",
+ "css": "serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "Aptos",
+ "label": "Aptos",
+ "label_zh": "Aptos",
+ "label_en": "Aptos",
+ "label_ja": "Aptos",
+ "locales": ["en", "und-Latn"],
+ "scripts": ["Latn"],
+ "category": "sans-serif",
+ "css": "sans-serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "Arial",
+ "label": "Arial",
+ "label_zh": "Arial",
+ "label_en": "Arial",
+ "label_ja": "Arial",
+ "locales": ["en", "und-Latn"],
+ "scripts": ["Latn"],
+ "category": "sans-serif",
+ "css": "sans-serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "Calibri",
+ "label": "Calibri",
+ "label_zh": "Calibri",
+ "label_en": "Calibri",
+ "label_ja": "Calibri",
+ "locales": ["en", "und-Latn"],
+ "scripts": ["Latn"],
+ "category": "sans-serif",
+ "css": "sans-serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "Segoe UI",
+ "label": "Segoe UI",
+ "label_zh": "Segoe UI",
+ "label_en": "Segoe UI",
+ "label_ja": "Segoe UI",
+ "locales": ["en", "und-Latn"],
+ "scripts": ["Latn"],
+ "category": "sans-serif",
+ "css": "sans-serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "Georgia",
+ "label": "Georgia",
+ "label_zh": "Georgia",
+ "label_en": "Georgia",
+ "label_ja": "Georgia",
+ "locales": ["en", "und-Latn"],
+ "scripts": ["Latn"],
+ "category": "serif",
+ "css": "serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "Times New Roman",
+ "label": "Times New Roman",
+ "label_zh": "Times New Roman",
+ "label_en": "Times New Roman",
+ "label_ja": "Times New Roman",
+ "locales": ["en", "und-Latn"],
+ "scripts": ["Latn"],
+ "category": "serif",
+ "css": "serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "Cambria",
+ "label": "Cambria",
+ "label_zh": "Cambria",
+ "label_en": "Cambria",
+ "label_ja": "Cambria",
+ "locales": ["en", "und-Latn"],
+ "scripts": ["Latn"],
+ "category": "serif",
+ "css": "serif",
+ "availability": "office-safe"
+ },
+ {
+ "id": "Consolas",
+ "label": "Consolas",
+ "label_zh": "Consolas",
+ "label_en": "Consolas",
+ "label_ja": "Consolas",
+ "locales": ["en", "und-Latn"],
+ "scripts": ["Latn"],
+ "category": "monospace",
+ "css": "monospace",
+ "availability": "office-safe"
+ }
+ ],
"modes": [
{
"id": "pyramid",
diff --git a/skills/ppt-master/scripts/confirm_ui/static/style.css b/skills/ppt-master/scripts/confirm_ui/static/style.css
index 3670b606..70fcf027 100644
--- a/skills/ppt-master/scripts/confirm_ui/static/style.css
+++ b/skills/ppt-master/scripts/confirm_ui/static/style.css
@@ -558,12 +558,43 @@ textarea.text-input { resize: vertical; line-height: 1.5; }
.font-sample-heading { font-size: 24px; font-weight: 700; line-height: 1.3; }
.font-sample-body { font-size: 14px; color: #333; margin-top: 4px; }
.custom-typography-fields {
+ display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 10px;
margin-top: 8px;
}
+.font-picker-head {
+ grid-column: 1 / -1;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 10px;
+}
+.font-picker-head .subfield-label { margin-bottom: 0; }
+.font-picker-hint { grid-column: 1 / -1; }
+.font-custom-status {
+ display: none;
+ align-items: center;
+ border-radius: 999px;
+ padding: 2px 8px;
+ background: var(--accent-soft);
+ color: var(--accent);
+ font-size: 11.5px;
+ font-weight: 650;
+}
.custom-typography-legacy { grid-column: 1 / -1; }
.custom-typography-field { display: flex; flex-direction: column; gap: 4px; }
+.font-select {
+ width: 100%;
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ padding: 9px 12px;
+ background: var(--card);
+ color: var(--ink);
+ font-size: 14px;
+}
+.font-select:focus { outline: none; border-color: var(--accent); }
+.other-font-input { margin-top: 2px; }
.custom-color-input { margin-top: 8px; min-height: 58px; resize: vertical; }
.image-strategy-custom-input { margin-top: 8px; min-height: 72px; resize: vertical; }
.image-usage-notes-input { min-height: 64px; resize: vertical; }
@@ -708,13 +739,13 @@ textarea.text-input { resize: vertical; line-height: 1.5; }
var(--card);
}
-/* ---- typography CJK / Latin previews ---- */
+/* ---- typography primary-language / English previews ---- */
.font-sample-line { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
-.font-sample-heading-box .fs-cjk { font-size: 24px; font-weight: 700; }
-.font-sample-heading-box .fs-latin { font-size: 22px; font-weight: 700; }
+.font-sample-heading-box .fs-primary { font-size: 24px; font-weight: 700; }
+.font-sample-heading-box .fs-english { font-size: 22px; font-weight: 700; }
.font-sample-body-box { margin-top: 6px; }
-.font-sample-body-box .fs-cjk,
-.font-sample-body-box .fs-latin { font-size: 14px; color: #333; }
+.font-sample-body-box .fs-primary,
+.font-sample-body-box .fs-english { font-size: 14px; color: #333; }
.font-card-meta { display: block; margin-top: 4px; }
/* ---- confirmed overlay ---- */
@@ -775,7 +806,7 @@ textarea.text-input { resize: vertical; line-height: 1.5; }
overflow: hidden;
text-overflow: ellipsis;
}
-.sp-title-lat { margin-left: 10px; opacity: 0.92; }
+.sp-title-english { margin-left: 10px; opacity: 0.92; }
.sp-body { display: flex; align-items: stretch; gap: 10px; margin-top: 6px; }
.sp-accent-bar { flex: 0 0 4px; border-radius: 2px; }
.sp-body-wrap {
@@ -786,7 +817,7 @@ textarea.text-input { resize: vertical; line-height: 1.5; }
overflow: hidden;
text-overflow: ellipsis;
}
-.sp-body-lat { margin-left: 10px; opacity: 0.92; }
+.sp-body-english { margin-left: 10px; opacity: 0.92; }
.sp-content {
display: grid;
gap: 10px;