Bug 108025 - Kerning problem for glyph with applied OpenType Feature
Summary: Kerning problem for glyph with applied OpenType Feature
Status: RESOLVED DUPLICATE of bug 61444
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.3.3.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Font-Rendering
  Show dependency treegraph
 
Reported: 2017-05-23 11:14 UTC by gluk
Modified: 2025-03-21 00:50 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Insert Special Character as Workaround - Does Not Work (514.23 KB, image/png)
2018-04-21 23:04 UTC, LibreTraining
Details
Document using feature ranges (10.08 KB, application/vnd.oasis.opendocument.text)
2018-04-23 14:06 UTC, Khaled Hosny
Details
PDF from the ODT above (16.75 KB, application/pdf)
2018-04-23 14:07 UTC, Khaled Hosny
Details
LinuxLibertineG-WATAR.odt: test document without and with ss05 Graphite feature only on capital "W" (8.54 KB, application/vnd.oasis.opendocument.text)
2025-03-20 19:09 UTC, László Németh
Details
watar_old.png: screenshot without the fix (missing kerning) (16.52 KB, image/png)
2025-03-20 19:10 UTC, László Németh
Details
watar_new.png: screenshot with fixed kerning (30.32 KB, image/png)
2025-03-20 19:11 UTC, László Németh
Details
LinuxLibertineG-WATAR_with_font.odt: [with embedded font] test document without and with ss05 Graphite feature only on capital "W" (3.02 MB, application/vnd.oasis.opendocument.text)
2025-03-21 00:38 UTC, László Németh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gluk 2017-05-23 11:14:52 UTC
Description:
program treat glyph with applied OpenType feature as separate block of text, and have problem with kerning. As example image:

http://www.glukfonts.pl/temp/LibreOfficeProblem.png

Kerning value between glyphs "A.init" and "W" exist in font.
With it, OpenType support is only partly useful.

Steps to Reproduce:
1.install FoglihtenNo07 font
2.type in document "AWATAR"
3.select "A"
4.change in font selection "FoglihtenNo07" to "FoglihtenNo07:init"


Actual Results:  
existing in font kerning value between "A.init" and "W" is missing

Expected Results:
existing in font kerning value between "A.init" and "W"


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Comment 1 Xisco Faulí 2017-05-24 08:35:25 UTC
Hello gluk,

Thanks for reporting this bugs. Some changes have been done recently related to the kerning: https://cgit.freedesktop.org/libreoffice/core/log/?qt=grep&q=kern

Could you please try to reproduce it with a master build from http://dev-builds.libreoffice.org/daily/master/ ?
You can install it alongsidethe standard version.
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the master build
Comment 2 gluk 2017-05-24 11:37:59 UTC
(In reply to Xisco Faulí from comment #1)
> Hello gluk,
> 
> Thanks for reporting this bugs. Some changes have been done recently related
> to the kerning:
> https://cgit.freedesktop.org/libreoffice/core/log/?qt=grep&q=kern
> 
> Could you please try to reproduce it with a master build from
> http://dev-builds.libreoffice.org/daily/master/ ?
> You can install it alongsidethe standard version.
> I have set the bug's status to 'NEEDINFO'. Please change it back to
> 'UNCONFIRMED' if the bug is still present in the master build

Hello,
unfortunately,
I have tested it with:

master~2017-05-24_00.41.30_LibreOfficeDev_5.5.0.0.alpha0_Linux_x86-64

and bug is still present.

gluk
Comment 3 Buovjaga 2017-06-04 10:31:38 UTC
Repro with http://www.glukfonts.pl/font.php?font=FoglihtenNo07

Arch Linux 64-bit, KDE Plasma 5
Version: 5.5.0.0.alpha0+
Build ID: c855400e9686ddd8bcba5691393f839f6f52c966
CPU threads: 8; OS: Linux 4.11; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on June 2nd 2017
Comment 4 Khaled Hosny 2018-02-01 18:41:17 UTC
Currently setting font feature to a font name amounts to switching to a different font, so kerning and other OpenType features will be broken across the boundary.
Comment 5 LibreTraining 2018-04-21 23:04:44 UTC
Created attachment 141529 [details]
Insert Special Character as Workaround - Does Not Work

I assumed directly inserting the character should work as a workaround because that would still be the same font.
It did not work.

This appears to point to a larger OpenType kerning issue.

The attached image shows tests in LibreOffice and other applications.
The alternate A character has been inserted directly.
Some applications do the kerning right, some do it wrong.

LibreOffice 6.0.3.2 - Wrong
Word 2016 - Wrong
InDesign 2018 - Right
Scribus 1.5.4 SVN - Wrong
GIMP 2.8 - Right
Inkscape 9.92.2 - Right
FontCreator - Right

FontCreator does not show a specific kerning pair(s) for that alternate character.
It appears it is coming from the class.

It appears that GIMP, Inkscape, and InDesign read this properly and kern the characters properly.

Should I enter this in the tracker as a separate issue?
Comment 6 Khaled Hosny 2018-04-22 08:11:58 UTC
A work around is to use to apply the feature to the whole word, but use indexes to select the range of characters to apply to. Eg. “Foo Serif:ss01[1]” or “Foo Serif:ss01[1:5]”, the indexes count from the start of the paragraph, though (IIRC, please test).
Comment 7 LibreTraining 2018-04-22 20:38:44 UTC
(In reply to Khaled Hosny from comment #6)
> A work around is to use to apply the feature to the whole word, but use
> indexes to select the range of characters to apply to. Eg. “Foo
> Serif:ss01[1]” or “Foo Serif:ss01[1:5]”, the indexes count from the start of
> the paragraph, though (IIRC, please test).

Sounded promising, but it does not work.

Tried:

FoglihtenNo07:init[1]
FoglihtenNo07:init[:1]
FoglihtenNo07:init[1:2]

As soon as you add anything to init nothing happens.
Shows the original text.
Comment 8 Khaled Hosny 2018-04-23 14:06:45 UTC
Created attachment 141562 [details]
Document using feature ranges

Here is a document that works for me.
Comment 9 Khaled Hosny 2018-04-23 14:07:35 UTC
Created attachment 141563 [details]
PDF from the ODT above
Comment 10 LibreTraining 2018-04-23 20:08:37 UTC
(In reply to Khaled Hosny from comment #8)
> Created attachment 141562 [details]
> Document using feature ranges
> 
> Here is a document that works for me.

I see. 
I assumed the count was from where I applied the edited font name.
Missed the "from beginning of paragraph" part.

Odd that the first letter is 0, not 1.


Something is still off with the kerning of inserted special characters.
And characters directly entered via ALT codes.
It works with some manual intervention, but not as expected.
I will post a separate bug about that.
Comment 11 QA Administrators 2019-04-24 02:49:26 UTC Comment hidden (noise)
Comment 12 QA Administrators 2021-04-24 04:09:15 UTC Comment hidden (noise)
Comment 13 QA Administrators 2023-04-25 03:23:38 UTC Comment hidden (noise, obsolete)
Comment 14 László Németh 2025-03-20 19:06:33 UTC
It seems, fixed by Jonathan Clark in Bug 61444, see the attached screenshots and test document.

*** This bug has been marked as a duplicate of bug 61444 ***
Comment 15 László Németh 2025-03-20 19:09:17 UTC
Created attachment 199923 [details]
LinuxLibertineG-WATAR.odt: test document without and with ss05 Graphite feature only on capital "W"

Linux Libertine G font used in the test document: https://numbertext.org/linux/
Comment 16 László Németh 2025-03-20 19:10:12 UTC
Created attachment 199924 [details]
watar_old.png: screenshot without the fix (missing kerning)
Comment 17 László Németh 2025-03-20 19:11:08 UTC
Created attachment 199925 [details]
watar_new.png: screenshot with fixed kerning
Comment 18 Eyal Rozenberg 2025-03-20 21:00:38 UTC
(In reply to László Németh from comment #14)

The best fixes are the ones you get for free by fixing something else :-)
Comment 19 László Németh 2025-03-21 00:38:41 UTC
Created attachment 199932 [details]
LinuxLibertineG-WATAR_with_font.odt: [with embedded font] test document without and with ss05 Graphite feature only on capital "W"
Comment 20 László Németh 2025-03-21 00:50:05 UTC
(In reply to Eyal Rozenberg from comment #18)
> (In reply to László Németh from comment #14)
> 
> The best fixes are the ones you get for free by fixing something else :-)

Sometimes we need something really encouraging! :) It's no coincidence that Jonathan was talking about this fix in Brussels: https://fosdem.org/2025/schedule/event/fosdem-2025-4103-languages-and-libreoffice/

P.S. I've attached a test file with embedded fonts, too:

https://bugs.documentfoundation.org/attachment.cgi?id=199932