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 & InitPython
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.
- This section has 7 entries; this is one of them.
- See the full section index: TextRange
Other entries in this section
- rng.SizeFont size in points, not doc.Unit.
- rng.Bold / .Italic / .UnderlineBold, italic, underline. Booleans.
- rng.CharSpacingCharacter spacing percentage. More precise than setting it on the Stor
- rng.FillText fill, same as a shape's Fill.
- rng.OutlineText outline. This is the core of the yellow-text-with-black-edge look
- rng.CaseCase conversion (all caps, small caps and so on).