intel / intel-one-mono

Intel One Mono font repository
SIL Open Font License 1.1
9.26k stars 314 forks source link

Compressed kerning with trailing backtick #3

Closed omenos closed 1 year ago

omenos commented 1 year ago

It would seem that text wrapped in backticks will have compressed kerning when the character is an alphabetic symbol. For example, this is how the following text is rendered:

This is an example of `alphabetic trailing backtick`, while this is a `non-alpha backtick!`.

image

riklus commented 1 year ago

I have this same issue too.

Schermata 2023-05-13 alle 6 33 21 PM
Cecile-Lebleu commented 1 year ago

Same here. I noticed it doesn't happen with all themes, for example, not with the Noctis collection of themes. Screenshot 2023-05-13 at 1 17 22 PM Screenshot 2023-05-13 at 1 17 09 PM

arjpar commented 1 year ago

I also have the same issue.

moyogo commented 1 year ago

The dead marks feature in the feature code should be removed. This is a bad practice and makes the font unusable for programming languages, markup languages and language orthographies that use those ASCII marks.

slice commented 1 year ago

I found a workaround.

In short, you have to disable the ccmp OpenType feature. You can do this in CSS by using e.g. font-feature-settings: "ccmp" 0;:

image

Compare this to how it looks by default (incorrect):

image

This also works fine in other software that lets you customize which OpenType features are active. One such example is kitty, a terminal emulator:

image

Notice how the comment renders correctly.

I stumbled across this by using the TTX tool from fonttools to crudely rip through the font files, which lets me poke around in some XML (representational of the original font) to find out what could be causing this. I'm no type designer, but there appears to be some kind of glyph substitution machinery that is supposed to be used with other language systems, but appears to be (inadvertently?) enabled by default in Latin. I don't understand this completely, so take this explanation with a grain of salt. Here is some related TTX:

<Lookup index="18">
  <LookupType value="1"/>
  <LookupFlag value="0"/>
  <!-- SubTableCount=1 -->
  <SingleSubst index="0">
    <Substitution in="acute" out="uni0301"/>
    <Substitution in="breve" out="uni0306"/>
    <Substitution in="caron" out="uni030C"/>
    <Substitution in="cedilla" out="uni0327"/>
    <Substitution in="circumflex" out="uni0302"/>
    <Substitution in="dieresis" out="uni0308"/>
    <Substitution in="dotaccent" out="uni0307"/>
    <Substitution in="grave" out="uni0300"/>
    <Substitution in="hungarumlaut" out="uni030B"/>
    <Substitution in="macron" out="uni0304"/>
    <Substitution in="ogonek" out="uni0328"/>
    <Substitution in="ring" out="uni030A"/>
    <Substitution in="tilde" out="uni0303"/>
    <Substitution in="uni02CD" out="uni0331"/>
    <Substitution in="uniA788" out="uni032D"/>
  </SingleSubst>
</Lookup>

As evident in the sample above, this behavior occurs not only for grave (`), but also for others such as dieresis (¨); it gets substituted with its combining form, merging it with the previous character (in certain scenarios).

Is this supposed to simplify the insertion of accented characters in languages such as Catalan? I'm not sure. I'm also unsure as to what the intended fix is; I don't know much about professional font authoring and what the correct semantics are here, so I'll leave the proper fix to the designers.

slice commented 1 year ago

Addendum: the README says this (with added formatting, because the linebreaks don't render correctly on GitHub):

Language Support: ccmp, mark and locl features ensure correct display across a wide range of languages. These are usually activated by default. We recommend setting the language tag/setting in your software to the desired language for best results.

So this appears to be an intentional feature of the font, albeit misfiring. Surrounding a word with grave characters is fairly prevalent in Markdown, code, and technical prose in general, and it's incorrect to substitute the glyph with a combining one in these cases. Probably a bug.

elliotwesoff commented 1 year ago

+1. The trailing backtick doesn't show up at all for me in neovim v0.9

ipuustin commented 1 year ago

Adding this line to settings.json in Visual Studio Code seems to work around the issue (at least for me):

"editor.fontLigatures": "'ccmp' off",
arjpar commented 1 year ago

Should be fixed with the latest release (1.2.0)

omenos commented 1 year ago

Verifying this is fixed in 1.2.0, thanks for the update!