What is strange is that your PDF displays as expected here (F39, KDE Plasma desktop while you seem to under Gnome, LO 7.6.2.1) though Okular warns me it found errors in the PDF which may then not be rendered correctly.
Your .odt display with a thin red line above “Heading”, linking the Area painting of the Heading 1 paragraph.
I tried to fool Writer by modifying the implicit character style defined in Heading 1: I added a border without padding. Border is coloured white.
Then it seems there are 2 bugs:
- there is a very thin line at bottom of paragraph, below the border
This thin line is hardly visible at 600% magnification but is really visible and annoying at common magnification, e.g. 80%.
- a much thicker line a top of paragraph above the border
This seems to be the same line as in your case, but since I added a thick border, the line was offset the same. The line keeps the same thickness when zoom factor changes.
I think this is a bug of “stick and interval” kind related to the way pixels are accessed. I remember that in the original Inside Macintosh (which is nearly 40 years old now) there was a chapter exposing the mathematical principles of QuickDraw. The coordinate system was not on the pixels but on infinitely thin lines between the pixels. This simplified considerably the issue and avoided many problems like the one you’re facing. There was no confusion between pixel and coordinate.
I am not sure this principle has been followed. At least from what I understand about GTK+ or Qt, this is not the case. Text in LO has its own rendering of which I have no technical knowledge. It looks like there is something like an (accidental?) offset adding its own idiosyncrasy here, though.
See my attempt to fix it in 15747891961790511-ajl.odt (11.3 KB)
Since it can’t be done, I tried to use the bug. In my second attempt, I draw a border around the paragraph and I tweaked the settings to make it look nearly symmetrical. But this looks weird.
Finally I found an acceptable workaround. Instead of requesting center alignment for text, I use tabstops: one in the center with center alignment and one to the right with right alignment. You now type your heading as Tab <the_heading> Tab
CAUTION! Typing an initial tab is very difficult because Heading n creates a list item (even when not numbered) and an initial Tab changes the list level. So type first a character to disable the feature et remove it afterwards.
Now we have some “real” text on both sides of the heading, be it a Tab character, and we can apply a character style to it. I created Highlight Red for that.
Study my patches to Heading 1-3 and the definition of Highlight Red. Adapt to your taste.