Home/ Reference/ Pitfalls

Text.FontProperties swallows the font size

Setting Size through it does nothing. In batch code you have to go through Story.Characters.All.

Symptom

Text.FontProperties swallows the font size

Notes

Setting Size through it does nothing. In batch code you have to go through Story.Characters.All.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
shape = app.ActiveSelectionRange(1)

# wrong: setting the size through FontProperties is swallowed silently
# shape.Text.FontProperties.Size = 85        <- no effect, no error

# right: go through Story.Characters.All
ca = shape.Text.Story.Characters.All
ca.Font = "Source Han Sans Bold"
ca.Size = 85
print("Set: ", ca.Font, ca.Size)

About this section: Pitfalls

Pitfalls — errors that fail without raising.

Other entries in this section