Misalignement at right margin in libreoffice with linux libertine G with hanging punctuation turned on

Amongst the interesting features of Linux Libertine G font, there is one called: hanging punctuation. But it seems that either Linux Libertine G either Libreoffice have some bugs with this, since when I apply this feature,

Linux Libertine G:hang=1

I get misalignements at right margin (as in pictures attached where the last e of scorge and the last e of risoluzione, are not aligned on the same position). I attach a sample odt file with font embedded and a PDF version. are you able to reproduce?

hanging_punctuation_bug_libertine_g.pdf (54.7 KB)

https://www.dropbox.com/scl/fi/26ks548hk40jd2b2lsrhh/linux_libertine_bug_in_hanging_punctuation.odt?rlkey=50cwyr6ozjk2hgx6qrh0a1ezo&st=m1773qu7&dl=1


detail

same screenshot with formatting marks

OS name, LO version?

added, but unfortunately it is everything fine from this point

You seem to be under obsolete software: LO 7.0.x (where the 0 indicates an early-adopter version) and Linux 4.9. We are now at 24.8 (with a change of numbering between 7.6 and 24.2 = YY.MM) and Linux is already 6.12.x.

Updating may fix the issue.

I could not reproduce because I would need to install Libertine in my OS and also it_IT hyphenation rules.

if you pay attention to what I wrote, you’ll learn that I uploaded a sample document in odt format on dropbox, that has the Linux Libertine G EMBEDDED in itself

Yes, it is embedded but Writer does not handle it. Despite the embedding, the font is shown italics in the font control and a substitute is used. The OS font renderer can’t fetch it from a file; it requires to be installed in the OS. I don’t know which font is substituted (Writer does not report it) and the problem does not occur. In addition, I forced en_US on all text to activate (faulty) hyphenation but there is no hanging hyphens in the ersatz font.

So, it is useless embedding the fonts?

No, it allows to export correctly the shapes to PDF but justification is computed on what is installed (accessible from the font renderer). When the font is not installed, you get a “distorted” final “object”: glyph shapes are those you expect but position may not be the intended one when metrics are too different. And in the case of advanced feature like hang, it is completely ignored by the substituted font if it has no equivalent. So print the intended shapes at slightly offset positions; PDF uses the intended font but with the same offsets.

You are guaranteed exact positioning result only when the font is effectively installed where the font renderer can grab it.

I think it is worth an enhancement request on Bugzilla as I fear this has not been foreseen.

PS: I just opened your document as a zip archive to have a look at how fonts are embedded and see if I could extract them. To my surprise, there is no Libertine font. The embedded ones are DejaVu Sans, Liberation Sans, Liberation Serif and NewComputerModernMath (or rather several fragments of these). So, my argumentation about need of installation may be wrong.

I think this hanging punctuation is implemented by a trick of the font, not LibreOffice. If I turn off Hanging Punctuation in the only place a setting appears, in the paragraph style under Asian Typography (it isn’t using Asian text so It shouldn’t affect anything anyway), then the document continues to keep the hanging punctuation.
.
I notice also that opening quotation marks are not completely outside the margin, also creating a jagged effect, although less than without any hanging punctuation.
.
InDesign applies hanging punctuation with any font, not just with enabled ones so I am pretty sure that LibreOffice isn’t doing it. Nevertheless, it is better than not being able to have hanging punctuation, thanks for the tip

Do you think so? Writer manages hyphenation: it then inserts an hyphen after breaking the word. To compute position, it queries the font for the width of all glyphs, including the hyphen. I can’t see how the font makes a difference between a “normal” hyphen and a “word-break” hyphen when queried, unless 1) there is a flag describing hyphen usage context, or 2) the full word fragment length is computed by the font (which then sees a suffix hyphen).
This question is the mirror of my ignorance about modern font technology. Pardon me if I am completely dumb.

I am pretty sure. I also tested in 6.4.7.2 and there was still hanging punctuation.
In Default paragraph style > Font > Font Features, here is a screenshot of the features.
Oddly, the two hanging choices have crossed meanings, all punctuation choice gives only inserted hyphen.
LinuxLibertineGHangingPunctuation