# create a text frame - my dimensions are in mm
textFrame = createText(20, 20, 180, 60 )
setText("set me to smallcaps", textFrame)
# safety first - deselect everything
selectText(0, 0, textFrame)
# this is blank - there are no features set on the frame
print("current features: " + getFontFeatures(textFrame))
# get the position of the text you want to change and select it
smallcapsPosition = getAllText(textFrame).find("me")
selectText(smallcapsPosition, 2 ,textFrame)
print("selected text: " + getText(textFrame))
# this sets features of the frame or currently selected text .. "+smcp" is smallcaps
setFontFeatures("+smcp", textFrame)
# set font features deselects the text! Reselect it so we can see what features were set
selectText(smallcapsPosition, 2,textFrame)
print("features on selection: " + getFontFeatures(textFrame))
current features: +dlig,+unic,+onum,+pnum,+frac,+ss01,+ss02,+ss03
Font Feature | Feature setting | Notes |
Common Ligatures | -clig | enabled by default, so negative switch |
Discretionary Ligatures | +dlig | depends on the font |
Default Capitals | (-smcp, -c2sc) | default setting, no explicit flags, assume you have to remove any others if set |
Small Capitals | +smcp | depends on the font |
Small Capitals from Capitals | +c2sc | depends on the font |
Unicase | +unic | ?? |
Default Numerals | (-lnum, -onum) | default setting is no flags, assume you have to remove any others if set |
Lining | +lnum | depends on the font |
Old Style | +onum | depends the font |
Default Numeral Width | (-pnum, -tnum) | default setting is no flags, assume you have to remove any others if set |
Proportional | +pnum | depends on the font |
Tabular | +tnum | depends on the font |
No Fractions | (-frac) | default setting, no flags, do not use fraction representations from the font |
Diagonal Fractions | +frac | use diagonal fraction representations from the font |
Stylistic Sets | +ss01 .. | numbered sets .. |