Author Topic: Request information of the "setFontFeatures" function.  (Read 242 times)

pice77

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
  • Scribus User
Request information of the "setFontFeatures" function.
« on: May 16, 2019, 12:51:06 pm »
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 (https://wiki.scribus.net/canvas/Automatic_Scripter_Commands_list). 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?

FUNCTION:
setFontFeatures

SYNTAX:
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.

a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1881
  • Karma: 26
    • the graphics lab
Re: Request information of the "setFontFeatures" function.
« Reply #1 on: May 16, 2019, 04:30:19 pm »
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...

pice77

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
  • Scribus User
Re: Request information of the "setFontFeatures" function.
« Reply #2 on: May 17, 2019, 01:27:30 pm »
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.

a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1881
  • Karma: 26
    • the graphics lab
Re: Request information of the "setFontFeatures" function.
« Reply #3 on: May 17, 2019, 06:36:43 pm »
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 https://bugs.scribus.net ...

if you need help, just ask...

pice77

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
  • Scribus User
Re: Request information of the "setFontFeatures" function.
« Reply #4 on: May 18, 2019, 12:19:15 pm »
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