Text distances in Style editor

Previous topic - Next topic

LeXa

Hello,
Discovering Scribus, I'm working on a photography calendar.

I'm using the calendar wizard script to generate pages, so each 'day box' is a text frame. Associated with a style. Very powerful to change style on the whole document.
I'm trying to apply a margin on the number of the day in the top left but with a margin as the example below.

https://pasteboard.co/kgQFqAYvwYyH.png

But I can't find this option, 'Text distances', in the style editor. I don't want to have to replicate that on each  (many) Text frame...

Someone know how to proceed or a workaround ?

Cheers,


a.l.e

#1
Yes, we need frame styles!

As a workaround you can run this small script:

old_unit = scribus.getUnit()
scribus.setUnit(scribus.UNIT_MM)

TEXT_DISTANCE_LTRB = [0, 2, 1, 0] # mm

for page in range(1, scribus.pageCount() + 1):
  scribus.gotoPage(page)
  for item in scribus.getPageItems():
    if item[1] == 4 and scribus.getAllText(item[0]).isdigit():
      scribus.setTextDistances(*TEXT_DISTANCE_LTRB, item[0])

scribus.setUnit(old_unit)

Open your document, trigger "Script > Show console" and paste the script above in the upper part of the Script console.

The script will apply the distances defined in TEXT_DISTANCE_LTRB (left, top, right, bottom...) to each text frame in the document that only contains digits (in your case the frames with the dates)

There is no way to undo the changes, so if you're not happy with the result, you can run again the same script with different values or close the document without saving it.

P.S.: just tested: copy pasting from the snippet above seems to introduce unwanted characters. It might be safer to copy the script from https://github.com/aoloe/scribus-script-collection/blob/master/items-format/set-text-distance-in-calendar.py

utnik

#2
hi lexa

you're right. those options are missing in the 'style manager'.
but (as so often) with a hack you can do it anyway:
  • open the 'style manager'
  • select and open the style related to the numbers of the day
  • in 'properties' → 'tabs and indentation' you can define a right indent for your numbers
  • in 'character style' → 'advanced formatting' you can define a negative baseline offset.
hope that helps...

utnik

edit: while i was typing, ale gave a more advanced solution – you need to chose...