[Scribus] Automatic font size?

Thomas R. Koll tomk32
Mon Mar 7 23:27:18 CET 2005


On Sun, Mar 06, 2005 at 12:07:24PM -0500, Gregory Pittman wrote:
> Frank Cox wrote:
> 
> >Would it be possible to add a feature to automatically re-size fonts
> >to match the available space in a text box?
> >
> >That way, one could create a box of the size required, input the text,
> >then say "fit to box" and the font would automatically change size to
> >fill the box.
> > 
> >
> This has long been a desire and topic of discussion, but thus far 
> remains a backburner item. Suffice it to say that it is more complicated 
> than it seems.
> 
> If we could get a handle on what happens to create the little overfull 
> widget, it would be possible to write a script to do what you are asking 
> for.

I'd suggest to use Python and cycle on the font size (increasing it)
until getTextOverflow(textbox) doesn't return 0 anymore.
Oh, I see, the function's not in the CVS yet.
See http://bugs.scribus.net/view.php?id=1741 for my patch.

And here's the (untested) script:

step = 1
textbox = getSelectedObject() // shoulda check that somehow...
fontsize = getFontSize(textbox)
while (getTextOverrun(textbox) == 0):
      fontsize = fontsize + step
      setFontSize(fontsize, textbox)
while (getTextOverrun(textbox) != 0):
      fontsize = fontsize - step     
      setFontsize(fontsize, texbox)


ciao, tom
-- 
== Weblinks ==
* http://verlag.tomk32.de/ - WikiReader Digest als Print-Ausgabe
* http://de.wikipedia.org/wiki/Benutzer:TomK32
* http://www.hammererlehen.de - Urlaub in Berchtesgaden




More information about the scribus mailing list