Font
paper-docx 0.2.0 API reference
Proxy object for parent of a <w:rPr> element and providing access to
character properties such as font name, font size, bold, and subscript.
Font(r: CT_R, parent: Any | None = None)Attributes
all_caps
attributeall_capsbool | NoneRead/write.
Causes text in this font to appear in capital letters.
bold
attributeboldbool | NoneRead/write.
Causes text in this font to appear in bold.
color
attributecolorA ColorFormat object providing a way to get and set the text color for this
font.
complex_script
attributecomplex_scriptbool | NoneRead/write tri-state value.
When True, causes the characters in the run to be treated as complex script
regardless of their Unicode values.
cs_bold
attributecs_boldbool | NoneRead/write tri-state value.
When True, causes the complex script characters in the run to be displayed in
bold typeface.
cs_italic
attributecs_italicbool | NoneRead/write tri-state value.
When True, causes the complex script characters in the run to be displayed in
italic typeface.
double_strike
attributedouble_strikebool | NoneRead/write tri-state value.
When True, causes the text in the run to appear with double strikethrough.
element
attributeelementThe lxml element proxied by this object.
emboss
attributeembossbool | NoneRead/write tri-state value.
When True, causes the text in the run to appear as if raised off the page in
relief.
hidden
attributehiddenbool | NoneRead/write tri-state value.
When True, causes the text in the run to be hidden from display, unless
applications settings force hidden text to be shown.
highlight_color
attributehighlight_colorWD_COLOR_INDEX | NoneColor of highlighing applied or None if not highlighted.
imprint
attributeimprintbool | NoneRead/write tri-state value.
When True, causes the text in the run to appear as if pressed into the page.
italic
attributeitalicbool | NoneRead/write tri-state value.
When True, causes the text of the run to appear in italics. None indicates
the effective value is inherited from the style hierarchy.
math
attributemathbool | NoneRead/write tri-state value.
When True, specifies this run contains WML that should be handled as though it
was Office Open XML Math.
name
attributenamestr | NoneThe typeface name for this Font.
Causes the text it controls to appear in the named font, if a matching font is
found. None indicates the typeface is inherited from the style hierarchy.
no_proof
attributeno_proofbool | NoneRead/write tri-state value.
When True, specifies that the contents of this run should not report any
errors when the document is scanned for spelling and grammar.
outline
attributeoutlinebool | NoneRead/write tri-state value.
When True causes the characters in the run to appear as if they have an
outline, by drawing a one pixel wide border around the inside and outside
borders of each character glyph.
part
attributepartXmlPartThe package part containing this object.
rtl
attributertlbool | NoneRead/write tri-state value.
When True causes the text in the run to have right-to-left characteristics.
shadow
attributeshadowbool | NoneRead/write tri-state value.
When True causes the text in the run to appear as if each character has a
shadow.
size
attributesizeLength | NoneFont height in English Metric Units (EMU).
None indicates the font size should be inherited from the style hierarchy.
Length is a subclass of int having properties for convenient conversion into
points or other length units. The :class:docx.shared.Pt class allows
convenient specification of point values::
font.size = Pt(24) font.size 304800 font.size.pt 24.0
small_caps
attributesmall_capsbool | NoneRead/write tri-state value.
When True causes the lowercase characters in the run to appear as capital
letters two points smaller than the font size specified for the run.
snap_to_grid
attributesnap_to_gridbool | NoneRead/write tri-state value.
When True causes the run to use the document grid characters per line settings
defined in the docGrid element when laying out the characters in this run.
spec_vanish
attributespec_vanishbool | NoneRead/write tri-state value.
When True, specifies that the given run shall always behave as if it is
hidden, even when hidden text is being displayed in the current document. The
property has a very narrow, specialized use related to the table of contents.
Consult the spec (§17.3.2.36) for more details.
strike
attributestrikebool | NoneRead/write tri-state value.
When True causes the text in the run to appear with a single horizontal line
through the center of the line.
subscript
attributesubscriptbool | NoneBoolean indicating whether the characters in this Font appear as subscript.
None indicates the subscript/subscript value is inherited from the style
hierarchy.
superscript
attributesuperscriptbool | NoneBoolean indicating whether the characters in this Font appear as
superscript.
None indicates the subscript/superscript value is inherited from the style
hierarchy.
underline
attributeunderlinebool | WD_UNDERLINE | NoneThe underline style for this Font.
The value is one of None, True, False, or a member of :ref:WdUnderline.
None indicates the font inherits its underline value from the style hierarchy.
False indicates no underline. True indicates single underline. The values
from :ref:WdUnderline are used to specify other outline styles such as double,
wavy, and dotted.
web_hidden
attributeweb_hiddenbool | NoneRead/write tri-state value.
When True, specifies that the contents of this run shall be hidden when the
document is displayed in web page view.