You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Emacs is crashing when Inconsolata-VariableFont_wdth,wght.ttf is installed and I'm trying to understand why. This is what I know. We call FcFontList to obtain an FcFontSet, and then for each FcPattern in that list we produce a Lisp vector containing the attributes of the font, and that goes into the Emacs-specific font selection code. In particular, in order to populate the weight field in that vector, we call FcPatternGetInteger on the pattern, passing FC_WEIGHT as the second argument. For most fonts this yields an integer representing the weight.
When Inconsolata-VariableFont_wdth,wght.ttf is installed, the FcFontSet contains multiple FcPatterns corresponding to entries in that file. For most of these, FcPatternGetInteger with FC_WEIGHT yields an integer. But for some of them, it does not; FcPatternGetInteger (and FcPatternGetDouble) do not return the success value FcResultMatch. Emacs's font code assumes that there is a weight associated to every font, and so there is a crash.
One option to fix this is just to skip over entries in the FcFontSet for which FcPatternGetInteger is unable to return a weight. But is that the correct thing to do? I don't really understand these multi-weight .ttf files -- what does it mean if entries in them do not seem to have a weight at all?
Many thanks!
The text was updated successfully, but these errors were encountered:
This is probably a fontconfig issue - I've run into some oddities with widths, see https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/354 - but in those cases it's still returning a number, just not a number that corresponds to one of the named constants.
But I don't think I've seen any issues with weights.
I think all of the named instances in the font should be setting both width and weight. Note that the font files periodically have been rebuilt in this repository, but the commit that I recommend using (which correspond to the font version "3.001", which is what is currently published on Google Fonts) is 540ba91
It's possible that the versions currently available on main in this repository are broken in some way :/
Hello,
Emacs is crashing when Inconsolata-VariableFont_wdth,wght.ttf is installed and I'm trying to understand why. This is what I know. We call FcFontList to obtain an FcFontSet, and then for each FcPattern in that list we produce a Lisp vector containing the attributes of the font, and that goes into the Emacs-specific font selection code. In particular, in order to populate the weight field in that vector, we call FcPatternGetInteger on the pattern, passing FC_WEIGHT as the second argument. For most fonts this yields an integer representing the weight.
When Inconsolata-VariableFont_wdth,wght.ttf is installed, the FcFontSet contains multiple FcPatterns corresponding to entries in that file. For most of these, FcPatternGetInteger with FC_WEIGHT yields an integer. But for some of them, it does not; FcPatternGetInteger (and FcPatternGetDouble) do not return the success value FcResultMatch. Emacs's font code assumes that there is a weight associated to every font, and so there is a crash.
One option to fix this is just to skip over entries in the FcFontSet for which FcPatternGetInteger is unable to return a weight. But is that the correct thing to do? I don't really understand these multi-weight .ttf files -- what does it mean if entries in them do not seem to have a weight at all?
Many thanks!
The text was updated successfully, but these errors were encountered: