[scribus] First Line Offset
Gregory Pittman
gpittman at iglou.com
Fri Feb 2 20:02:02 UTC 2018
On 02/02/2018 01:35 PM, ZASKE Martin wrote:
> I know exactly what you are talking about.
>
> When I made an entire book in 2017, I used a power-editor and went into
> the XML and used some search and replace to change all First Line
> Offsets. In our case I was lucky and could change ALL of them, so
> setting it up only took a few minutes.
>
>
> You should look out inside the document.sla for a
>
>
> <PAGEOBJECT blablabla settings with your <StoryText> your stuff here
>
> In the list of settings, look for FLOP.
>
> I have marked the FLOP (maybe First Line Offset Property) in the example
> below and you got the same options as in the GUI, starting with 0
> (Maximum Ascent) so FLOP="2" should give you "Line spacing".
>
>
> If you are comfortable with this type of mild hacking, you can get a lot
> done in Scribus. Scribus is stable with such editing, I never had
> unexpected side-effects so far. I would just recommend to close the
> document in Scribus, while you edit the .sla file and to pull a
> back-up-copy every time before you hack the XML.
>
>
Here is something that occurred to me as a workaround for this issue:
using the top distance as a proxy for the first line offset.
If you were starting a document from scratch, you can go to File >
Preferences > Item Tools (Text tab), and set the Top distance to the
equivalent of 5 points (assuming 12-point text). This is equivalent to
what you would see with First Line Offset in Line Spacing mode.
What if you've already made your document? Well, unlike First Line
Offset, Top distance is scriptable. So here is a simple script to do
this. Just select a frame and run the script.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
© 2018 by Gregory Pittman
settopdistance.py
USAGE
Select a text frame, run script.
"""
import scribus
textbox = scribus.getSelectedObject()
units = scribus.getUnit()
scribus.setUnit(scribus.UNIT_POINTS)
scribus.setRedraw(False)
distances = scribus.getTextDistances(textbox)
linespace = scribus.getLineSpacing(textbox)
scribus.setTextDistances(distances[0],distances[1],5.00,distances[3],textbox)
scribus.moveObject(-4,0,textbox)
scribus.moveObject(4,0,textbox)
scribus.setUnit(units)
scribus.setRedraw(True)
Notice in the fifth line from the bottom the distance is hard coded, and
this can be changed or you could set up a valueDialog with a default of
5.00 -- note that input from a valueDialog is always a string, so you
would need to convert to float. Even if your page units aren't points,
this works because I change the page units to points, then change back
to what they were before.
Look at the fourth and third lines from the bottom...what are these?! It
turns out if you don't have these, the top distance is set, but the
document doesn't show the text shifted (just a display issue). Since I
found out on the main canvas that if you move the frame slightly, then
move it back, you then see the change. I just added these two lines to
move the frame, then move it back, and it works!
The line beginning with 'linespace =' is an unused variable, but could
be used to calculate a top distance, but you would have to experiment to
see what works (is it 5/12 of the linespacing?).
You can also modify the script to get all the text frames in a document,
then perform this on every one...this takes a lot more lines to
accomplish, since you have to get all the objects, then sift through
them for the text frames. Also note that if you run this after selecting
another kind of frame, it will look like you've destroyed your document
-- the frames go blank. Just save your document and reload, and you'll
be back where you were.
Greg
More information about the scribus
mailing list