[scribus] SCRIPT : Using different Fonts in the same text frame

Victor / tokiop tor at tokiop.com
Sat Feb 25 11:15:25 UTC 2017


Hi Gael,

an example to set some characters' font :

frame = "TextFrame"
scribus.insertText("hello bold world", -1, frame)
scribus.selectText(6, 4, frame)
scribus.setFont("Liberation Sans Bold")


to set the current paragraph's style, and create it if it
doesn't exist :

frame = "TextFrame"
stylename = "MyParaStyle"
scribus.insertText("hello world", -1, frame)
try:
	scribus.setStyle(stylename, frame)
except scribus.NotFoundError:
	scribus.createParagraphStyle(stylename)
	scribus.setStyle(stylename, frame)


An instructive and complete example for styling via scripts :
https://wiki.scribus.net/canvas/Automatic_story_formatting

The full scripter api is available in :
Scribus > Help > Scribus Manual > For Developers > Scripter API

Have fun ! :)

Victor


On 25/02/2017 01:27, Gael Grissonnanche wrote:
> Hi everyone,
> 
>  
> 
> I was wondering if it was possible to make a script that would use different
> Fonts in the same text frame? I haven't found support on the web for it,
> besides I am wondering if createParagraphe Style has this purpose, but I
> cannot find help with that neither.
> 
>  
> 
> That you very much for yours,
> 
>  
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.scribus.net/pipermail/scribus/attachments/20170225/2befa2fb/attachment.html>
> ___
> Scribus Mailing List: scribus at lists.scribus.net
> Edit your options or unsubscribe:
> http://lists.scribus.net/mailman/listinfo/scribus
> See also:
> http://wiki.scribus.net
> http://forums.scribus.net
> 



More information about the scribus mailing list