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.