Problem
The text-run API is incomplete in three orthogonal directions. Run-level features: superscript/subscript (scanny/python-pptx#1045), strikethrough (#574, #339), highlight, baseline shift, character spacing (spc), and kerning (kern) are absent or partial. Layout features: text columns (numCol), vertical text (vert), per-run column-spacing — <a:bodyPr> round-trips them but no Python API exposes them. Auto-fit & overflow: TextFrame.fit_text exists but crashes on long words (#168, #416) and there is no overflow-detection API to query whether content fits before saving (#715, #936). Internationalization: RTL paragraphs (#751) are not supported, and the <a:latin>/<a:ea>/<a:cs> typeface trio means setting Font.name only fixes Latin script — Asian fonts and complex-script fonts cannot be set independently (#343, #768, #420).
Sub-features
Prior art
- Open PRs: scanny/python-pptx#1046 sub/superscript (lxrichert, clean). scanny/python-pptx#601 older sub/super. scanny/python-pptx#606 strikethrough (gtessa, recently active). scanny/python-pptx#112 older strike. scanny/python-pptx#1107 shrink_text_to_fit (BastienGimbert). scanny/python-pptx#1114 overflow detection (saggl, 1382 LOC tested). scanny/python-pptx#751 RTL paragraphs (comatan96). scanny/python-pptx#416 fit_text long-word crash fix.
- Forks:
- User issues this would close: #100, #114, #133, #134, #144, #168, #285, #339, #343, #378, #420, #485, #514, #525, #537, #563, #574, #675, #684, #710, #715, #720, #765, #768, #773, #830, #836, #884, #936, #969, #970, #1026, #1045.
- Already shipped in this fork (excluded): bullet/numbered lists on paragraphs (#100, #114, #655, #807).
- OOXML: DrawingML §21.1.2.3.7
<a:rPr> (u, strike=sngStrike/dblStrike, baseline, spc, kern), §21.1.2.1.1 <a:bodyPr> (numCol, colSpace, vert, rtlCol, anchor), §21.1.2.2.7 <a:pPr> (rtl), §21.1.2.3.5 <a:latin>/<a:ea>/<a:cs> typeface trio.
- Code paths:
src/pptx/text/text.py, src/pptx/text/fonts.py, src/pptx/oxml/text.py, src/pptx/text/layout.py (TextFitter).
Acceptance criteria
- 35+ unit tests + 10 behave scenarios across the sub-features.
TextFrame.will_overflow() correctly reports overflow status for content >= 110% of frame height across 3 sample fonts.
- A presentation authored with
Paragraph.rtl = True and Arabic text renders right-to-left in PowerPoint.
- East-Asian font set via
Font.east_asian = "MS Gothic" round-trips correctly.
- Backward compat: existing
Font.name continues setting only the Latin slot.
Effort: L
Largest text-API surface in the roadmap. Phase A: run-level (sub/super, strike, highlight). Phase B: typography + i18n (latin/ea/cs trio, RTL). Phase C: layout (columns, vertical) and overflow detection.
Problem
The text-run API is incomplete in three orthogonal directions. Run-level features: superscript/subscript (scanny/python-pptx#1045), strikethrough (#574, #339), highlight, baseline shift, character spacing (
spc), and kerning (kern) are absent or partial. Layout features: text columns (numCol), vertical text (vert), per-run column-spacing —<a:bodyPr>round-trips them but no Python API exposes them. Auto-fit & overflow:TextFrame.fit_textexists but crashes on long words (#168, #416) and there is no overflow-detection API to query whether content fits before saving (#715, #936). Internationalization: RTL paragraphs (#751) are not supported, and the<a:latin>/<a:ea>/<a:cs>typeface trio means settingFont.nameonly fixes Latin script — Asian fonts and complex-script fonts cannot be set independently (#343, #768, #420).Sub-features
Font.superscript/Font.subscript(boolean → emitsbaseline=percentage)Font.strikeenum (none / single / double)Font.highlightcolor setterFont.character_spacing(spc=) andFont.kerning(kern=)Font.latin/Font.east_asian/Font.complex_scriptsetters (existingFont.namecontinues setting only<a:latin>)TextFrame.columns = NandTextFrame.column_spacing(<a:bodyPr numCol= colSpace=>)TextFrame.text_directionenum (horizontal / vert / vert270 / wordArtVert / eaVert / mongolianVert)Paragraph.rtl = Truefor right-to-left text (Arabic, Hebrew, Persian)TextFrame.will_overflow()/TextFrame.overflow_info()returning a structured report (closes scanny/python-pptx#1114)TextFrame.shrink_text_to_fit()— eager font-size autofit without relying on PowerPoint to recompute on open (closes scanny/python-pptx#1107)fit_textlong-word crash (closes #168)Prior art
Force1ess/python-pptx— strikethrough at run + textframe-level font attrs.<a:rPr>(u, strike=sngStrike/dblStrike, baseline, spc, kern), §21.1.2.1.1<a:bodyPr>(numCol, colSpace, vert, rtlCol, anchor), §21.1.2.2.7<a:pPr>(rtl), §21.1.2.3.5<a:latin>/<a:ea>/<a:cs>typeface trio.src/pptx/text/text.py,src/pptx/text/fonts.py,src/pptx/oxml/text.py,src/pptx/text/layout.py(TextFitter).Acceptance criteria
TextFrame.will_overflow()correctly reports overflow status for content >= 110% of frame height across 3 sample fonts.Paragraph.rtl = Trueand Arabic text renders right-to-left in PowerPoint.Font.east_asian = "MS Gothic"round-trips correctly.Font.namecontinues setting only the Latin slot.Effort: L
Largest text-API surface in the roadmap. Phase A: run-level (sub/super, strike, highlight). Phase B: typography + i18n (latin/ea/cs trio, RTL). Phase C: layout (columns, vertical) and overflow detection.