Release PPT workflow 0.7.2 with text and container constraints

This commit is contained in:
2026-10-13 10:24:51 +08:00
parent f932b1970d
commit c4efbed9b0
13 changed files with 114 additions and 10 deletions
+10 -4
View File
@@ -112,11 +112,17 @@ def finalize(path: Path, theme: dict, style: dict):
if ea is not None and len(fallbacks) == 1:
ea.set("typeface", next(iter(fallbacks)))
changed = True
# Weight is role metadata, not an inference that all titles bold.
# The compiler resolves source weight for every actual run;
# it emits b="1" for bold and omits b for regular. Materialize
# regular explicitly so a bold family/master cannot override it.
weights = {entry.get("weight_number") for entry in entries}
if len(weights) == 1 and None not in weights:
run.set("b", "1" if next(iter(weights)) >= 600 else "0")
changed = True
if run.get("b") is None:
if run.tag == "{" + NS["a"] + "}rPr":
run.set("b", "0")
changed = True
elif len(weights) == 1 and None not in weights:
run.set("b", "1" if next(iter(weights)) >= 600 else "0")
changed = True
if changed:
tree.write(str(part), encoding="utf-8", xml_declaration=True)
# A template's body size is its default at each nesting level. The author