Scribusoid

Author Topic: First line vertical alignment  (Read 2941 times)

Dracos

  • Newbie
  • *
  • Posts: 16
  • Karma: 0
  • Scribus User
First line vertical alignment
« on: July 31, 2016, 11:51:09 pm »
I'm working on a document that has a couple dozen tables.  The majority of these text frames are sized to fit one line of text, and contain either a number, a few characters, or a word or two.

All these frames are copies of each other, differing only in width and fill color.  Same character style, internal text distances (.5mm all around), and stroke.

I have a few frames where the only content is a lower case letter that does not ascend above the x height ("p", "c", "w", in particular).

Scribus shifts the line upward so that the top of the glyph hits the boundary.  I can work around this by increasing the top text difference, but that doesn't seem to be the correct solution.  I expect if I had an accented uppercase glyph such as "A grave" the line would be pushed down.

The last column of the "Pence" row in the screenshot demonstrates the issue.  Compare the positioning of "pp" with the rest of that column.  They're all using Arial/9pt.

Is there a way to maintain baseline alignment within a frame, regardless of what the highest glyph height is?  These text frames will have no alignment relation to anything outside the group they're in.  The groups are generally positioned at one or more margins.

GarryP

  • Hero Member
  • *****
  • Posts: 1600
  • Karma: 25
  • Scribus User
Re: First line vertical alignment
« Reply #1 on: August 01, 2016, 03:40:59 pm »
Dracos, this has been discussed a few times and has been an "active issue" for quite some time.

This thread might be a useful read: http://forums.scribus.net/index.php/topic,2110.0.html

Essentially, there's currently no way to force Scribus to put the base of all the characters within different frames on the same horizontal other than using the baseline grid, which will then give you other problems for this sort of thing (for instance, moving the group of frames around the page).

Have you tried making your tables in LibreOffice Calc and exporting them for import into Scribus? (Export it as PDF and put the PDF into an image frame.) You might find that it gives you more control over your tables. A bit more work initially but less time messing around with formatting. The attached - very simple - example only took a few minutes to create.

a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
  • Karma: 26
    • the graphics lab
Re: First line vertical alignment
« Reply #2 on: August 01, 2016, 06:02:37 pm »
well, using a fixed lined height should also do...
or setting each first line offset as the font's ascent... but i would not do that.

there might still be bugs in the first line height, but in the long term it should work :-)

Dracos

  • Newbie
  • *
  • Posts: 16
  • Karma: 0
  • Scribus User
Re: First line vertical alignment
« Reply #3 on: August 02, 2016, 09:01:08 am »
Essentially, there's currently no way to force Scribus to put the base of all the characters within different frames on the same horizontal other than using the baseline grid, which will then give you other problems for this sort of thing (for instance, moving the group of frames around the page).

I don't want to align the text from frame to frame, I can align the frames to each other just fine.  I want the frames to behave consistently with regard to character height and line positioning.  It would seem Scribus cannot position a baseline without a preceding one to offset from.  Surely a font metric should be used for this, cap height or some such?

I also have issues with Scribus correctly scaling imported elements: Simple SVGs made in Inkscape using the same unit as my document sometimes arrive about 17% smaller than they should, IIRC.  I'm sure importing tables from Calc would be a new set of problems, although I haven't tried it yet.


Nermander

  • Hero Member
  • *****
  • Posts: 1280
  • Karma: 17
Re: First line vertical alignment
« Reply #4 on: August 02, 2016, 09:24:38 am »
Are you (as suggested) using a fixed line spacing in the example?

GarryP

  • Hero Member
  • *****
  • Posts: 1600
  • Karma: 25
  • Scribus User
Re: First line vertical alignment
« Reply #5 on: August 02, 2016, 11:23:33 am »
Dracos: I'd suggest that, in this instance, you do want to align the base of the text across different frames. That's the problem you're seeing. It's just that there's an underlying problem with the positioning of the base of the first lines. Maybe I just didn't explain myself properly. Scribus should work the way you think it should work but it doesn't. That's the problem.

For the SVG issue it's best to start a new thread (attaching examples if possible). Otherwise it's going to get messy in here with two very different things being discussed in the same place.

a.l.e and Nermander: Fixed Line Spacing doesn't have any effect on where the base of the glyphs are for the first line of text in a text frame (as already discussed in the linked thread above). Fixed Line Spacing simply doesn't "work" for the first line of text. Just try it. Add a text frame, set it to Fixed Line Spacing, double-click and type an "a" then type an "O". The base of the text moves down to accommodate the taller "O" character. That, to me, is not Fixed Line Spacing; it's Fixed for lines below the first one and Automatic for the first. It's a mix. I don't know how else to explain why this is counter-intuitive (or just plain wrong).

Dracos

  • Newbie
  • *
  • Posts: 16
  • Karma: 0
  • Scribus User
Re: First line vertical alignment
« Reply #6 on: August 03, 2016, 03:36:33 am »
Dracos: I'd suggest that, in this instance, you do want to align the base of the text across different frames. That's the problem you're seeing. It's just that there's an underlying problem with the positioning of the base of the first lines. Maybe I just didn't explain myself properly. Scribus should work the way you think it should work but it doesn't. That's the problem.

Actually, I don't want to align to baseline grid, because the baseline grid is global for everything in the page and it would wreck my tables: the frames in these tables vary in font face/font size... the column heads and caption are part of the table.  If a group could establish its own baseline grid, I'd be able to use that (with a bit of deeper nesting).

I did confirm that making paragraph+character styles for these frames, with fixed line spacing, did not solve the first line positioning issue.

As I feared, Scribus offers no actual solutions for this issue, only long-detour workarounds (make tables in other software).

a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
  • Karma: 26
    • the graphics lab
Re: First line vertical alignment
« Reply #7 on: August 03, 2016, 11:20:36 am »
garry, it does work, but you have to pick "line spacing" in the "first line offset" sub tab.

dracos, you're free to work in the way that best suits for you.

but you seem to be mixing up very different issues and are not really willing to explore the solutions that are provided to you.
the first line mismatch you're facing has little to nothing specific to tables and is rather related to a wrong default chosen by the scribus programmers.
it's not trivial to find a good alternative behavior and i think we could need somebody going through the line spacing and suggest a better global behavior.

anyway in the specific case you're showing, i would avoid putting lines in that table, it looks very busy. and simply use tabs for alignment.

tables in scribus are an unfinished tool.
it can be handy in some cases (and i've seen very nice tables done in scribus!) but -- if possible -- you should avoid using them in most cases.

GarryP

  • Hero Member
  • *****
  • Posts: 1600
  • Karma: 25
  • Scribus User
Re: First line vertical alignment
« Reply #8 on: August 03, 2016, 11:44:26 am »
Dracos: I didn't say that you wanted to "align to the baseline grid", I had already said that that was not what you wanted. I said that you wanted to align the base of the text across different frames. By this I meant that you wanted the base - bottom, underside, underneath, lowest part (not including descenders) - of the text in one frame to be at the same level - y-position, vertical location - as the base of the text in other frames.

This might sound like something that the baseline grid does, and it is in a way, but it's a different thing taken from a different stance. The baseline grid allows for such alignment across the whole document but what you want is a similar alignment but only across certain frames. There is a subtle difference but the two things should not be confused.

Once the function of the baseline grid is understood it makes sense that there is only one baseline grid for the whole document as it keeps lines of text aligned across frames and pages. However, there have been some explanations of good reasons why more than one could be useful.

For example, if a publication uses different body text fonts/sizes on different pages it could be reasonably argued that you would need a different baseline grid for each situation as the size of the text - and therefore the line height - might not be the same. Aligning text across frames is a similar situation.

Therefore, it can be argued that having only one baseline grid is not versatile enough. It would be better if the user could define multiple baseline grids (or whatever they might be called), each one to be used for a specific situation. (Maybe have one baseline grid for the document but also allow other similar alignment "tools" for specific situations.)

On the other hand, it can also be argued that having multiple baseline grids could be confusing, especially for beginners who could start defining a baseline grid for every page if they don't know what they're doing.

Tables have been a bit of a pain to use in Scribus since they were introduced. I've heard that the next version will have a better implementation of tables but I've no idea how much better that will be. While tables remain badly implemented it will only add fuel to the opinions of people who say that Scribus isn't any good for basic DTP. They would be missing some major positives but, in this specific instance, they would have a reasonable argument. If you've got to go to a different piece of software to create tables that are anything more than basic groups of text frames then there's something wrong.

a.l.e: Thanks for pointing out the "First Line Offset" settings. I've probably seen that tab thousands of times but I've never actually used it so I just kept ignoring it. A quick experiment shows that it does indeed work as you suggest so that's probably a fix for Dracos and other users who have had similar problems. I'm really going to have to try hard to remember it's there.

I'd certainly agree that the default for this setting is wrong. Most reasonable users would not expect to have to go into another tab and change a setting to make fixed line spacing work in the same way as most other software works. I know Scribus does it's own thing from time to time but if Scribus doesn't - by default - do something that all word processors, and even all text editors, do by default then it really should change.

I'll add a note about "First Line Offset" to the other known related thread in case it helps someone.

Dracos

  • Newbie
  • *
  • Posts: 16
  • Karma: 0
  • Scribus User
Re: First line vertical alignment
« Reply #9 on: August 03, 2016, 09:14:25 pm »
you have to pick "line spacing" in the "first line offset" sub tab.

Choosing Font Ascent in that tab (which I'd never noticed before) behaves as I originally expected after changing the Top/Bottom text distances back to 0.00.  Maximum Ascent is indeed a terrible, horrible, no-good, very bad default.

I know those tables are not the prettiest, but they serve their purpose for now.  Tables should exist structurally, but tables are hard.

Now that this is solved for a few representative frames, what's the quickest way to apply these changes to the other ~3600?  Munge the XML externally with a script?  Last week I swapped fonts using Perl one-liners.

Dracos

  • Newbie
  • *
  • Posts: 16
  • Karma: 0
  • Scribus User
Re: First line vertical alignment
« Reply #10 on: August 03, 2016, 09:19:14 pm »
PS: It seems to me that the settings in the First Line Offset tab should also be in the Style Manager.  Perhaps it's been added in the 1.5 branch, I'm still using 1.4.6.

a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
  • Karma: 26
    • the graphics lab
Re: First line vertical alignment
« Reply #11 on: August 03, 2016, 10:57:22 pm »
the best way to do it?

enhance the scribus scripter to expose the first line offset options...

looks like some simple c++ code, copy paste from existing code...

perling through the .sla is for sur also possible.