Home/ Reference/ TextRange

rng.Font

Font name, read/write. Always read it back after writing (see the warning in the previous section).

Signature

rng.Font

Notes

Font name, read/write. Always read it back after writing (see the warning in the previous section).

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
import time

shape = app.ActiveSelectionRange(1)
ca = shape.Text.Story.Characters.All      # ca : the whole character range

ca.Font = "Source Han Sans Bold"
time.sleep(0.3)                            # give the font time to actually apply
print("Font read back: ", ca.Font)                # always read back; a wrong name raises nothing

About this section: TextRange

TextRange — character ranges inside a text object.

Other entries in this section