font
font
¶
Custom element classes related to run properties (font).
CT_Color
¶
CT_Fonts
¶
Bases: BaseOxmlElement
<w:rFonts> element.
Specifies typeface name for the various language types. The four independent slots —
w:ascii, w:hAnsi, w:eastAsia and w:cs — are chosen between per character by
Word, according to the script the character belongs to.
CT_Highlight
¶
CT_Shd
¶
Bases: BaseOxmlElement
w:shd element, specifying the shading (background fill) behind content.
One class serves w:rPr, w:pPr, w:tcPr and w:tblPr; the element is identical
in all four.
w:val is the required attribute in the schema, naming the pattern drawn over the
background. It is modelled as optional so a w:shd written without it — which this
library itself did before 2.0.0 — reads as None rather than raising. Everything
written from here carries an explicit w:val.
It is deliberately not given a descriptor default; OptionalAttribute removes
an attribute assigned its default value, which would drop the w:val this class
exists to start writing.
CT_TextScale
¶
CT_HpsMeasure
¶
CT_RPr
¶
Bases: BaseOxmlElement
<w:rPr> element, containing the properties for a run.
highlight_val
property
writable
¶
highlight_val: WD_COLOR_INDEX | None
Value of ./w:highlight/@val.
Specifies font's highlight color, or None if the text is not highlighted.
rFonts_ascii
property
writable
¶
The value of w:rFonts/@w:ascii or None if not present.
Represents the assigned typeface name. The rFonts element also specifies other special-case typeface names; this method handles the case where just the common name is required.
rFonts_hAnsi
property
writable
¶
The value of w:rFonts/@w:hAnsi or None if not present.
rFonts_eastAsia
property
writable
¶
The value of w:rFonts/@w:eastAsia or None if not present.
The typeface Word uses for East Asian characters in the run.
rFonts_cs
property
writable
¶
The value of w:rFonts/@w:cs or None if not present.
The typeface Word uses for complex-script characters in the run.
rFonts_hint
property
writable
¶
rFonts_hint: WD_FONT_HINT | None
The value of w:rFonts/@w:hint or None if not present.
rFonts_asciiTheme
property
writable
¶
The value of w:rFonts/@w:asciiTheme or None if not present.
Names a theme typeface slot, like "minorHAnsi", resolved against the theme part rather than naming a font directly.
rFonts_hAnsiTheme
property
writable
¶
The value of w:rFonts/@w:hAnsiTheme or None if not present.
shd_fill
property
writable
¶
shd_fill: RGBColor | str | None
Value of ./w:shd/@w:fill, or None when there is none.
None both when there is no w:shd at all and when it carries a pattern but no
fill, which is valid — <w:shd w:val="pct25" w:color="FF0000"/> for instance.
shd_val
property
writable
¶
shd_val: WD_SHADING_PATTERN | None
The w:shd/@w:val shading pattern, or None when no shading is applied.
shd_color
property
writable
¶
shd_color: RGBColor | str | None
Value of ./w:shd/@w:color, the pattern foreground, or None.
w_val
property
writable
¶
Value of ./w:w/@w:val, the character scale percentage.
None when no explicit scaling is applied and the value is inherited.
style
property
writable
¶
String in ./w:rStyle/@val, or None if w:rStyle is not present.
subscript
property
writable
¶
True if ./w:vertAlign/@w:val is "subscript".
False if w:vertAlign/@w:val contains any other value. None if
w:vertAlign is not present.
superscript
property
writable
¶
True if w:vertAlign/@w:val is 'superscript'.
False if w:vertAlign/@w:val contains any other value. None if
w:vertAlign is not present.
szCs_val
property
writable
¶
szCs_val: Length | None
The value of w:szCs/@w:val or None if not present.
This is the font size applied to complex-script text, which Word tracks
separately from w:sz.
u_val
property
writable
¶
u_val: WD_UNDERLINE | None
Value of w:u/@val, or None if not present.
Values WD_UNDERLINE.SINGLE and WD_UNDERLINE.NONE are mapped to True and
False respectively.