Bug 1954716 - Fonts not used correctly
Summary: Fonts not used correctly
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: fontconfig
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Akira TAGOH
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-28 16:32 UTC by barbarahduarte
Modified: 2022-12-08 06:48 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-12-08 06:48:16 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
LibreOffice with all three fonts displayed in regular, italic and bold face. (111.11 KB, image/png)
2021-04-28 16:32 UTC, barbarahduarte
no flags Details

Description barbarahduarte 2021-04-28 16:32:13 UTC
Created attachment 1776799 [details]
LibreOffice with all three fonts displayed in regular, italic and bold face.

I have installed some company-provided fonts for use in presentations etc.:

 $ ls /usr/share/fonts/neo-sans-intel/
NeoSansIntel-Italic.ttf       NeoSansIntel-MediumItalic.ttf
NeoSansIntel-LightItalic.ttf  NeoSansIntel-Medium.ttf
NeoSansIntel-Light.ttf        NeoSansIntel.ttf

In LibreOffice I have a choice of three separate fonts: Neo Sans Intel, Neo Sans Intel Medium, and Neo Sans Intel Light.

For each of those three, the italic version of the font (from the separate TTF file) is used. I can tell by the tail on the 'f' character. For bold text, however, an 'emboldening' algorithm seems to be used instead of using the appropriate separate font file.

In GNOME font selection dialogs, I see just one 'Neo Sans Intel' family, with a choice of 8 styles. I'll ignore the italic versions since those do actually seem to work as expected, so there are four weights listed:
 - Light (== Neo Sans Intel Light) 
 - Regular (== Neo Sans Intel Medium)
 - Medium (== Neo Sans Intel Medium)
 - Bold (== Neo Sans Intel Medium + emboldening algorithm?)

I *don't* seem to have an option in GNOME which will just use the straight 'Neo Sans Intel' font.

So both seem to be getting it wrong, in different ways. Or perhaps there's something wrong with the fonts themselves?

Comment 1 Nicolas Mailhot 2021-04-28 17:31:29 UTC
If you ask:


1. LibreOffice is definitely wrong because it tries to force fonts to fit in the regular/italic/bold/bold italic model, which has not been true in font formats for decades. It should display a single font family with the real font face names instead of relying on legacy compatibility metadata layers (which are increasingly unreliable because who cares the world has moved on)


2. The GNOME font selector is usually more correct, but also suffers from attempts to make things up instead of relying on Opentype face names, making a mess more often than not (but less often that LibreOffice). Also it does not understand font faces split over multiple files.


3. font files are often buggy because font authors do weird things in legacy compatibility metadata layers to fix misbehaviours in legacy windows apps that do not understand modern font faces (breaking things for apps like Libreoffice that take the result at face value). Again, from the font maker point of view who cares, legacy metadata layers are for legacy apps, no modern app should try to interpret those, the weird things are only tested in legacy windows apps.



If you want to sort this mess, run

fc-scan -f \
 "%{family[0]};%{style[0]};%{fullname[0]};%{width};%{weight};%{slant};%{fontversion};%{file}\n" \
 /usr/share/fonts/neo-sans-intel/ | sort -t ';' -k1,1d -k4,4n -k5,5n -k6,6n -k2,2d -k7,7dr \
 | uniq | column --separator ';' -t



If the font metadata is sane you should see Neo Sans Intel in the first column, the real font face names (Regular, Italic, Medium, Medium Italic, Light, Light Italic) in the second column, and sensible width weight and slant values in the  4th to 6th columns



If that is not the case the font files are buggy, and you need to either get their metadata fixed or declare overrides at the fontconfig level

(see https://docs.fedoraproject.org/en-US/packaging-guidelines/FontsPolicy)



Once the fontconfig output is sane everything else is an application (Libre Office, Gnome Font selector, etc) bug. Usually due to someone not understanding the OpenType font model and trying to shove font files into a simplistic regular/bold/italic/bold italic one face per file deprecated legacy model.

Comment 2 Nicolas Mailhot 2021-04-28 17:36:35 UTC
BTW Bold is not the same as Medium, there is no more reason to expect Medium to be used when asking a Bold Regular, than expecting Regular to be used when asking a Bold Light. Since your font family does not provide any Bold weight using the Bold button is open to interpretations.

Comment 3 Nicolas Mailhot 2021-04-28 17:42:25 UTC
Of course some font makers DO expect apps to understand Bold when they use some other hipster designation. It works in their Apple apps (and they did not test anything else).

What can I say, you want apps to understand Bold you state Bold in the face name, simple easy, stupid and reliable.

Comment 4 Matthias Clasen 2021-04-28 18:41:14 UTC
> 2. The GNOME font selector is usually more correct, but also suffers from attempts to make things up instead of relying on Opentype face names, making a mess more often than not (but less often that LibreOffice). Also it does not understand font faces split over multiple files.

The gnome font selector is not in the business of understanding how font faces are split over files. It shows the fonts that fontconfig tells us about

Comment 5 Nicolas Mailhot 2021-04-28 20:00:27 UTC
Exactly, it has no business of understanding how font faces are split over files, it should display one entry per face detected by fontconfig, and let fontconfig handle the assembling, instead of duplicating entries for the same face when it is split over multiple files.

Comment 6 davidtomasi 2021-04-29 17:14:06 UTC
https://www.clinicaderecuperacao.net.br/

Comment 7 Ben Cotton 2021-08-10 13:00:02 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 35 development cycle.
Changing version to 35.

Comment 8 Ben Cotton 2022-11-29 16:56:04 UTC
This message is a reminder that Fedora Linux 35 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '35'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 35 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 9 Akira TAGOH 2022-12-08 06:48:16 UTC
You could work around if you write some fontconfig config to modify family/style to drop extra names and keep "Neo Sans Intel" only in family and proper names in style. but it can't be done automatically. this is a known task in upstream and we don't want to keep track of this here.


Note You need to log in before you can comment on or make changes to this bug.