Created attachment 136670 [details]
Character properties for Coelacanth font
There are fonts like Latin Modern(1) or the still in development Coelacanth(2) that offers "optical sizes"(3): variants of the font designed to be used for different point sizes (broader, less detailed for small point sizes, taller and with higher contrast for big headings).
This feature is governed by the "size" OpenType table. Systems like XeTeX automatically pick the right font file to be used on the appropriate size, but it seems that LibreOffice gets confused by that table: not only it do not switch between variants, it's not even possible to select which variant is being used as you can see on the attached screenshot. In fact Coelacanth consist of 37 font files tied together by the "size" OT feature, but LibO only offers a small and rather arbitrary selection.
Sounds relevant -> NEW
What do you think about that?
(In reply to Volga from comment #3)
> Hi Khaled,
> What do you think about that?
Patches are welcome.
This can be activated via Font Size parameter in Character dialog.
(In reply to Volga from comment #5)
> This can be activated via Font Size parameter in Character dialog.
No, it cannot be activated there. If on Writer I set some text on Latin Modern at 6pts and zoom in to 600% and then another text on Latin Modern but at 12pts and zoom in to 300% I get the same visual effect, while if I do that on XeTeX the result is completely different, as you can see on this screenshot
(to be precise, the screenshot was done with text on 10pts zoomed at 400% -top- and 5pts zoomed at 800% -bottom- but the idea is the same, and after all Writer does not allow 5pts text)
In the case of Latin Modern, Writer seems to always use the shape designed for 10pts, no matter which font size is selected.
So LibreOffice should add a function to handle "size" feature via font size option.
(In reply to Volga from comment #7)
> So LibreOffice should add a function to handle "size" feature via font size
No. When the "size" feature is enabled the font substitution should happen automatically based on the font size selected.
Each font has a range of sizes for which it should be used.
Coelacanth font family for example:
Coelacanth has Optical Size features
Design Size: 5.0
Range: 4.0 – 5.5
Design Size: 6.0
Range: 5.6 – 6.9
Design Size: 9.0
Range: 7.0 – 10.9
Design Size: 14.0
Range: 11.0 – 17.2
Design Size: 24.0
Range: 17.3 – 32.9
Design Size: 60.0
Range: 33.0 – 72.0
The actual font file used depends on the size the user selects.
If the user select 12pts as the size, the Regular font file will be used.
If the user select 18pts as the size, the Subhd font file will be used.
If the user select 48pts as the size, the Display font file will be used.
Apparently Harfbuzz does have this feature, but I did not see it anywhere in Pango the text rendering engine docs.
(In reply to RGB from comment #0)
> This feature is governed by the "size" OpenType table. Systems like XeTeX
> automatically pick the right font file to be used on the appropriate size,
> but it seems that LibreOffice gets confused by that table: not only it do
> not switch between variants, it's not even possible to select which variant
> is being used as you can see on the attached screenshot. In fact Coelacanth
> consist of 37 font files tied together by the "size" OT feature, but LibO
> only offers a small and rather arbitrary selection.
This inability to properly select the different font weights in a font family is a known problem.
That is why there is a "small and rather arbitrary selection" of the fonts installed.
Bug 69254 - Correct handling of font families (weight, style, stretches) on Mac
Bug 98596 - Correct handling of font families (weight, style, stretches) on Linux
Because of that problem it is doubtful this feature can be implemented.
That problem would have to be solved first.
For example in Coelacanth there are multiple weights for each optical size.
Which weight would be used would be random/broken like any other font family.
The same problem with most SemiBold fonts, even the ones included with LibreOffice.
Until LibreOffice can fix the font families problems, this feature has no chance.