Fixed line spacing and first line of a page

Hi,
I’m using Writer (LibreOffice 24.8.5) on Windows 10.

I have noticed that the first line of every page does not respect the vertical space specified in the fixed line spacing and instead uses a vertical space that depends on the font and font size.

I have searched this forum and found another user reporting this behavior:

When I set line spacing to fixed, my expectation is that every line in the paragraph will be vertically spaced as specified, including the first line of the page.

In the following example I have set a display grid to show you where each line should land. The grid rows are spaced 12pt, starting from the page top margin. The paragraph style has a fixed line spacing of 12pt. As you can see, the first line is vertically spaced from the page top margin less than 12pt, while the other lines/paragraphs are using the correct vertical line spacing.

To show you that the issue is only in the first line of the page, I have created a paragraph style for the first line that uses above paragraph spacing to correct the vertical line spacing. As you can see, every line now matches the grid.

Note that this paragraph style is a workaround and not the solution for controlling vertical line spacing. As you can see in the image below, as soon as a long paragraph breaks into a new page, the first line of the new page uses again less than 12pt from the page top margin.

Note that I’m aware of the page line-spacing (register-true) feature, but finding a method to align every line to a grid is not my point. I chose the above example because it’s the simplest way I could think of to illustrate the issue. I’m not interested in aligning every line to a grid. I’m interested in having control of vertical line spacing.

Now to the questions:

Is there a specific reason why the first line of each page doesn’t follow the vertical line spacing specified in fixed line spacing? If this is unintended behavior, what’s the proper channel to suggest a change or report this as a bug?"

Please edit your question to elaborate more on the expected result. Describe the spacing above and below the paragraph. Tell which line spacing you want to define. What is your expectation at top of page?

The various options in the dialog correspond to different computing modes (which parameter is modified in the font metrics). So, for the time being, don’t focus on this choice; explain the typographical look you want to achieve.

As usual, don’t omit OS name, LO version and save format.

As you suggested, I have tried to improve the post. Please let me know if my point is more clear now.

Creating a “contextual style” is usually a bad idea, akin to direct formatting. It will play dirty tricks on your back sooner or later.

In your case, this is the special paragraph style for the first paragraph in the page. When you edit your text, the “first” paragraph will not necessarily remain the same.

What I don’t understand is the rationale to lock the base line to some grid. Have you any publishing constraint, like printing on specific stationery with pre-printed lines and you need precise alignment?

Regarding the various spacing options, here are my observations (as a user, not a developer):

  • Proportional: seems to apply a magnifying factor to the whole line height in the font metrics
  • Leading: leaves glyph height unchanged but replaces separating space between lines
  • Fixed: replaces the full height (glyph+leading)

They override line height given by the font metrics. What you did not take into account is that line height is not counted from baseline. Line height is very schematically the sum of ascent, x-height and descent for the glyph proper plus leading between line. Origin of heights is at baseline. That is, you are offset relative to the start of usable area. Also, leading is used only between lines, not on first line.

You also have a confusion between paragraph and character levels. Font metrics defines a bounding box for a glyph (with leading separating bounding boxes in successive lines). These glyph boxes are rendered inside the paragraph bounding box. Spacing is added above and below according to paragraph style. Spacing above offsets the bounding box downwards, but this happens only at start of paragraph. If your paragraph spans a page limit, spacing above will not be added because the break occurred in the middle of the paragraph.

The only way I know to align lines on a grid is registering (now labelled "page spacing in “recent” Writer releases). It requires two settings to work as expected.

  • page style: the feature must be enabled in the page style(s) and a paragraph style is set as a reference to define the grid
  • paragraph style(s): registering, aka page-spacing, is enabled in every paragraph style to align on the grid

Registering has a “quantizing effect”: paragraph line height is forced to grid distance and spacing between paragraphs is rounded above to the nearest quantum. So, exercise caution when constraining several paragraph styles: their effective lineheight and spacing will be slightly different from what is shown in the dialog.

You can also mix registered and non-registered text/styles in a page but this’ll probably result in a clumsy look with erratic spacing at transitions.

Hi ajlittoz,
thank you for the detailed reply.

I agree that creating a paragraph style specifically for the first line of the page is a bad idea. I edited again the first post to make more clear why in my example I created it.

I chose the example because it was the simplest way I could think of to illustrate the issue. I’m not interested in aligning every line to a grid. I’m interested in having control of vertical line spacing.

I think your observations make sense. The way I see it, Fixed is the only option users have for manually controlling line spacing. The other options set the line spacing automatically based on what the font specifies or semi-automatically by mixing what the font specifies with a user-defined value. My issue with the current implementation is that Fixed gives manual control of line spacing for every line, except the first line of the page!

I understand, that’s one of the reasons why the paragraph style specific for the first line of the page is not a solution to the issue.

Yes, this can be a solution to the specific case of someone who needs to align lines on a grid, but it’s not a solution to someone who needs to control vertical line spacing of every line.