Bug 150263 - Misposition of combining diacritics (especially macrons) depending on font size
Summary: Misposition of combining diacritics (especially macrons) depending on font size
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.3.5.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Font-Rendering
  Show dependency treegraph
 
Reported: 2022-08-04 13:38 UTC by Cqoicebordel
Modified: 2022-08-30 12:15 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Lato at 16pt (81.81 KB, image/png)
2022-08-04 13:41 UTC, Cqoicebordel
Details
Lato at 18pt (21.44 KB, image/png)
2022-08-04 13:42 UTC, Cqoicebordel
Details
macron U+0304 and circumflex U+0302 combining diacritics various fonts and sizes (22.10 KB, application/vnd.oasis.opendocument.text)
2022-08-04 19:25 UTC, V Stuart Foote
Details
combining diacritics mispositioned relative to base glyph -- even Libertinus fonts (92.08 KB, image/png)
2022-08-04 20:15 UTC, V Stuart Foote
Details
still some bad rendering - Courier New and Times New Roman (36.97 KB, image/png)
2022-08-29 20:52 UTC, V Stuart Foote
Details
Noto Sans 12pt (8.43 KB, image/png)
2022-08-30 09:36 UTC, Cqoicebordel
Details
Noto Sans 13pt (8.27 KB, image/png)
2022-08-30 09:38 UTC, Cqoicebordel
Details
Noto Sans 16-24pt (411.27 KB, image/png)
2022-08-30 12:15 UTC, ⁨خالد حسني⁩
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cqoicebordel 2022-08-04 13:38:55 UTC
Description:
Diacritics, and especially macrons (¯) seems to be mispositionned, depending on font and font size. The glyph n̄ in particular often has a misplaced macron.

My first guess would be there is a rounding error on the vertical positioning. But it's not explaining the issue on the horizontal positioning on the 'n' (which may be explained because it's not usual to have a macron on it).
But in the end, _at least_, having the macrons on the vowels not being consistent is an issue.

Note that :
* That bug has been reported to me by a linguist who needed a clean display of macrons, but this report is based on my machine. All that to say, I'm not alone, and there is a use case for it.
* It has been reported in Impress too (but I haven't tested that).

Steps to Reproduce:
1. Type the string "ān̄ōū"
2. Change the font to Lato, or DejaVu Sans, or Arial (I only tested those)
3. Vary the font size between 10pt to 20pt (usually), by integer increment.

Actual Results:
The macrons are not at the same heights, and that can vary with font size (⇒ The higher macron at 10pt can be the lowest at 14pt).
On the 'n' the macron can be, depending on the font, too much on the right.

Expected Results:
Every macron should be at the same height, and horizontally centered on each char.


Reproducible: Always


User Profile Reset: No



Additional Info:
Screenshots : https://twitter.com/Cqoicebordel/status/1554938974694670338

Version : 
Version: 7.3.5.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Ubuntu package version: 1:7.3.5~rc2-0ubuntu0.20.04.1~lo1
Calc: threaded
Comment 1 Cqoicebordel 2022-08-04 13:41:41 UTC
Created attachment 181583 [details]
Lato at 16pt
Comment 2 Cqoicebordel 2022-08-04 13:42:12 UTC
Created attachment 181584 [details]
Lato at 18pt
Comment 3 V Stuart Foote 2022-08-04 18:51:28 UTC
Please check if a font with known good metrics (i.e. something from Libertinus [1]) behaves on your os/GPU combo. Couold be a hinting issue, or more likely (especially with known good metrics) another dependency on bug 103322

=-ref-=
[1] https://github.com/alerque/libertinus
Comment 4 V Stuart Foote 2022-08-04 19:17:17 UTC
And, do see a issue (of bad metrics & font hinting) in Dejavu Sans and Arial but especially obvious in Courier New.  Those all are internal font issues--not anything that LO can correct.

Simply need to use a font with good metrics.
Comment 5 V Stuart Foote 2022-08-04 19:25:22 UTC
Created attachment 181613 [details]
macron U+0304 and circumflex U+0302 combining diacritics various fonts and sizes

simple test doc -- known good of Libertinus Serif versus some fonts with poor font mettics and handling of combining diacritics e.g. Dejavu Sans, Arial, Courier New, Times New roman.
Comment 6 Cqoicebordel 2022-08-04 19:28:24 UTC
Same issue with Libertinus 7.040 font, Sans and Serif (haven't tested the others flavors).
Comment 7 V Stuart Foote 2022-08-04 20:15:22 UTC
Created attachment 181618 [details]
combining diacritics mispositioned relative to base glyph -- even Libertinus fonts

Yes if I zoom the canvas in to %300 the heights for the combined U+0304 macron look to vary by quite a bit. Even with know good metrics of Libertinus Serif and Libertinus Sans.

Confirmed. Recent build of master against 7.5.0
Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 5df1bb4b1b222be00d25097660c4ee33542896ea
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL
Comment 8 V Stuart Foote 2022-08-04 20:18:00 UTC
guess this will end up dependent on a solution of bug 103322
Comment 9 Cqoicebordel 2022-08-04 20:26:45 UTC
Yes, I haven't said it before, but it depends on font size, but also on zoom.
Just playing with ctrl+wheel makes the macrons go up and down (relative to the others).
Comment 10 ⁨خالد حسني⁩ 2022-08-23 18:47:16 UTC
I can not reproduce this on macOS with LibreOffice 7.4.
Comment 11 V Stuart Foote 2022-08-29 20:52:35 UTC
Created attachment 182080 [details]
still some bad rendering - Courier New and Times New Roman

@Khaled, wait could you take a look at test doc attachment 181613 [details] 

The Courier New and Tiems New Roman are both rendered poorly (on Windows builds at least) as in this screen clip of recent master. Is that going to be a font metrics issue now that Caoláns positioning tweak is in?
Comment 12 ⁨خالد حسني⁩ 2022-08-29 20:59:34 UTC
(In reply to V Stuart Foote from comment #11)
> Created attachment 182080 [details]
> still some bad rendering - Courier New and Times New Roman
> 
> @Khaled, wait could you take a look at test doc attachment 181613 [details] 
> 
> The Courier New and Tiems New Roman are both rendered poorly (on Windows
> builds at least) as in this screen clip of recent master. Is that going to
> be a font metrics issue now that Caoláns positioning tweak is in?

These are font issues and I can reproduce elsewhere. Courier New fails to position the accents over “n” and Times New Roman positions them slightly higher over it than the other lowercase letters.
Comment 13 V Stuart Foote 2022-08-29 21:14:22 UTC
(In reply to خالد حسني from comment #12)
> These are font issues and I can reproduce elsewhere. Courier New fails to
> position the accents over “n” and Times New Roman positions them slightly
> higher over it than the other lowercase letters.

Fair enough. Though note even Libertinus has a slight misallignment, but I'd kind of agree we're doing OK on the VCL canvas.
Comment 14 Cqoicebordel 2022-08-29 21:31:52 UTC
The bug is still present here, on 7.4, with Libertinus Sans and Serif, with macrons.
Comment 15 ⁨خالد حسني⁩ 2022-08-29 22:52:27 UTC
(In reply to Cqoicebordel from comment #14)
> The bug is still present here, on 7.4, with Libertinus Sans and Serif, with
> macrons.

Macron over “n” is slightly higher in Libertinus Serif, and slightly lower and two the right in Libertinus Sans, and both are font issue.
Comment 16 Cqoicebordel 2022-08-29 23:07:46 UTC
So, is there a font that works out there ?
Comment 17 ⁨خالد حسني⁩ 2022-08-29 23:18:26 UTC
There are plenty of fonts that look good, the free ones I tested: DejaVu Sans, DejaVu Serif, Inter, Lato, Montserrat, Noto Sans, Noto Serif, Source Sans Pro, Source Serif Pro, Gentium Basic, Gentium Book Basic, Gentium Plus.
Comment 18 V Stuart Foote 2022-08-29 23:41:24 UTC
And *any* of the Libertinus family. They really are rather well done ;-)

And, I'd work with master against 7.5, not a 7.4 build (even its nightly), to see the state of things.
Comment 19 ⁨خالد حسني⁩ 2022-08-30 02:47:09 UTC
(In reply to V Stuart Foote from comment #18)
> And *any* of the Libertinus family. They really are rather well done ;-)

Bugs in FLOSS fonts should be reported to their respective repositories and it will hopefully get fixed.
Comment 20 Cqoicebordel 2022-08-30 09:36:08 UTC
Created attachment 182093 [details]
Noto Sans 12pt
Comment 21 Cqoicebordel 2022-08-30 09:38:28 UTC
Created attachment 182094 [details]
Noto Sans 13pt

I'm sorry to be a PITA, but from my side, it doesn't look like it's fixed, nor is a font issue.

If you look at the last two screenshot I uploaded, the position of the macron change on the 'n' depending on the font size. Which is the name of this bug :)
Comment 22 V Stuart Foote 2022-08-30 09:53:56 UTC
Font metrics are used to control the combining placement calculated for a particular font point size.

Distinct from effect of Zooming the canvas in and out as for comment 9 and having the combining glyphs dance.

The later behaves now, while the former is really dependent on what the font defines. Zooming attachment 181613 [details] with master build the diacritics remain as calculated. That's what we want, and then accept we can't control the variations faulty font metrics cause.
Comment 23 Cqoicebordel 2022-08-30 10:24:33 UTC
I trust you it works on master then. I only tested on 7.4, and I'll wait on 7.5 to see it and test it.

Thanks for the help.
Comment 24 ⁨خالد حسني⁩ 2022-08-30 12:15:39 UTC
Created attachment 182099 [details]
Noto Sans 16-24pt

I don’t see any of the displacement you are seeing, testing with 7.4.0.3. Either different font versions, or it is OS/DPI dependent. If someone else can reproduce, please re-open.