Paper Office
paper-docxAPI referencetext.font

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 | None

Read/write.

Causes text in this font to appear in capital letters.

bold

attributeboldbool | None

Read/write.

Causes text in this font to appear in bold.

color

attributecolor

A ColorFormat object providing a way to get and set the text color for this font.

complex_script

attributecomplex_scriptbool | None

Read/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 | None

Read/write tri-state value.

When True, causes the complex script characters in the run to be displayed in bold typeface.

cs_italic

attributecs_italicbool | None

Read/write tri-state value.

When True, causes the complex script characters in the run to be displayed in italic typeface.

double_strike

attributedouble_strikebool | None

Read/write tri-state value.

When True, causes the text in the run to appear with double strikethrough.

element

attributeelement

The lxml element proxied by this object.

emboss

attributeembossbool | None

Read/write tri-state value.

When True, causes the text in the run to appear as if raised off the page in relief.

hidden

attributehiddenbool | None

Read/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 | None

Color of highlighing applied or None if not highlighted.

imprint

attributeimprintbool | None

Read/write tri-state value.

When True, causes the text in the run to appear as if pressed into the page.

italic

attributeitalicbool | None

Read/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 | None

Read/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 | None

The 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 | None

Read/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 | None

Read/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

attributepartXmlPart

The package part containing this object.

rtl

attributertlbool | None

Read/write tri-state value.

When True causes the text in the run to have right-to-left characteristics.

shadow

attributeshadowbool | None

Read/write tri-state value.

When True causes the text in the run to appear as if each character has a shadow.

size

attributesizeLength | None

Font 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 | None

Read/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 | None

Read/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 | None

Read/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 | None

Read/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 | None

Boolean indicating whether the characters in this Font appear as subscript.

None indicates the subscript/subscript value is inherited from the style hierarchy.

superscript

attributesuperscriptbool | None

Boolean 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 | None

The 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 | None

Read/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.

On this page