On 05/14/2013 09:08 PM, amruginn-scribus at yahoo.com wrote:
> Hello,
>
> I've been searching the mailing list archives, and the interwebs, to identify
> a solution to my problem.
>
> I'm creating a PDF document using Scripter, with the script being generated
> from a C++ program. I'm creating a lot of table'd data, and eventually will
> be putting borders around the cells.
>
> With that in mind, I was using version 1.3.8 on a PCLinuxOS machine which was
> slower than the second machine I'm now trying to work on which is running
> Linux Mint (LMDE 2013.03) and 1.4.0 (I also grabbed 1.4.2.). The script works
> fine in both versions with the Linux Mint machine being faster, obviously.
>
> My dilemma is that I was using baseline offset of -15% for my text boxes
> which gave a nice vertical centering of sorts. (I read the posts and wiki
> entry regarding vertical centering and realize that shouldn't be managed in a
> DTP.) As well, baseline offset is something I can define in a Scribus
> Template document's character styles, and then use that style in my Scripter
> script.
>
> In the 1.3.8 version, the baseline offset works as desired, but when I move
> to 1.4.0 (and 1.4.2) the baseline offset needs to be a huge number to do
> anything, and then it goes beyond the size of the box. (Assume 8pt font, 10pt
> box, and baseline offset goes -60%, and the text doesn't show up.)
>
> I notice that the First Line Offset (maximum ascent, font ascent, or line
> spacing) sort of works if I use font ascent, unfortunately, that isn't
> something I can set in Scripter nor a character style. Therefore, it's not a
> practical solution for me.
>
> Is this a bug now, or was it a bug then, and not working as-designed? I'm
> also attempting to compile the recent (and eventually historical) source but
> I have some dependencies I haven't loaded, to see if I can either identify
> it, or add a solution for my needs.
>
>
Maybe I don't understand what you're doing, but it seems a rather clumsy
way to center vertically.
Here is a fragment from a script I wrote to center text vertically in a
frame by adjusting the Top text distance value. This is the logic part
that centers the text in the frame. It requires fixed linespacing to
work properly.
lines = scribus.getTextLines(textbox)
distances = scribus.getTextDistances(textbox)
linespace = scribus.getLineSpacing(textbox)
dimensions = scribus.getSize(textbox) # (width, height)
if (scribus.textOverflows(textbox, 1) > 0):
scribus.messageBox('User Error', "This frame is already
overflowing", scribus.ICON_WARNING, scribus.BUTTON_OK)
sys.exit(2)
newtopdist = (dimensions[1] - linespace * lines)/2
scribus.setTextDistances(distances[0],distances[1],newtopdist,distances[3],textbox)
scribus.moveObject(-4,0,textbox)
scribus.moveObject(4,0,textbox)
The last 2 lines compensate for a display problem in Scribus. If they're
not there you may not see the text shifted as it should. It's only a
display problem, since if you save your document and reload, you see the
text shifted. I also noted that if you move the frame, the text moves in
the display to where it should be, so the script has a built-in shift,
then unshift to manage the same thing.
Greg