Request information of the "setFontFeatures" function.

Previous topic - Next topic


Hi everyone and excuse my bad English.
I'm trying to use the SetFontFeatures function (Scribus 1.5.5svn) but without results.
The only documentation I found is that of the wiki ( I can't understand the correct syntax. I want to change the text track from my script.

I tried different syntaxes:
- setFontFeatures ("tracking = 5", myText)
- setFontFeatures (tracking = "5", myText)
- setFontFeatures ("tracking 5", myText)

the only syntax that returns no error is

- setFontFeatures ("tracking", myText)

but nothing changes, of course. :-D
Please, can someone write me an example of the function?


setFontFeatures ("fontfeature", ["name"])

Sets the font features of the text frame "name" to "fontfeature". If there is some text selected only the selected text is changed. If "name" is not given the currently selected item is used.

May throw ValueError if the font cannot be found.


new land for me... but i had a look at it...

"tracking" is not a font feature... font features are the ones listed in the text palette, under "font features" (ligatures, ...)

i did not know about that script for exporting the API... clever : - )

i used it to export the current API and the only way i've found for applying the tracking is by creating (and then applying) a character style...
depending on your goal it will be a usable solution or not...


thank you for the advice.
I will try this method. I have never used the createCharStyle function even if to get what I want, the listing will become very complex.
I currently use the function setTextScalingH (scale, ["name"]) and it satisfies me:

while (textOverflows (myText) == 1):
     if (y <81): break
     setTextScalingH (y, myText)
     y -= 1

I'd like to try using "tracking" together with "scalingH".
I probably don't translate well into my language what is written in English. From function "createCharStyle":

"features" [optional] -> nearer typographic details can be defined by a string that might contain the following phrases comma-seperated (without spaces!):

-> inherit
-> bold
tracking [optional] -> tracking of the text

Thanks and sorry the long post. If you feel it is impossible to do so, you also close this topic.


for that usage, creating a style is not a good way to go...

it's not very hard to add a new function to the API, it's just a bit tedious.

personally, i don't see it as a such important feature that i would now go and implement it, but you're welcome to make a patch and post it to ...

if you need help, just ask...


I had thought of that too, but I have to use this script even on a window version and I'm not very familiar with visual studio and Qt.
in truth, even for linux I would have some difficulties. I have never used cmaker or QT. it's certainly feasible but it takes too long for now.
Meanwhile I'm going crazy to understand why the function setProperties ("XorYpos", myobject)  move the objects of his choice!
but this is another topic.
tanks a lot


get/setFontFeatures are no longer part of newer Scribus versions (at least not in 1.5.x). Don't know though in which version they disappeared.


As indicated above - this is available in 1.5.x but not fully documented - the API method is there but it's not entirely clear how to use it.

I had the same question - and here's the scriptlet that I used to work out what's going on.
Simply create a new scribus document - open Scripter console - and run a script to interrogate 'features':

# 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))

The obvious question is... how do you know what values to use (+smcp)? :)

Simply select text frame manually and set the font features you want in the UI - and have the script spit the feature names out and you get something like this:
Quotecurrent features: +dlig,+unic,+onum,+pnum,+frac,+ss01,+ss02,+ss03

Discovered font feature flags:

Font FeatureFeature settingNotes
Common Ligatures-cligenabled by default, so negative switch
Discretionary Ligatures+dligdepends on the font
Default Capitals(-smcp, -c2sc)default setting, no explicit flags, assume you have to remove any others if set
Small Capitals+smcpdepends on the font
Small Capitals from Capitals+c2scdepends on the font
Default Numerals(-lnum, -onum)default setting is no flags, assume you have to remove any others if set
Lining+lnumdepends on the font
Old Style+onumdepends the font
Default Numeral Width(-pnum, -tnum)default setting is no flags, assume you have to remove any others if set
Proportional+pnumdepends on the font
Tabular+tnumdepends on the font
No Fractions(-frac)default setting, no flags, do not use fraction representations from the font
Diagonal Fractions+fracuse diagonal fraction representations from the font
Stylistic Sets+ss01 .. numbered sets ..