Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compressed kerning with trailing backtick #3

Closed
omenos opened this issue May 13, 2023 · 10 comments
Closed

Compressed kerning with trailing backtick #3

omenos opened this issue May 13, 2023 · 10 comments

Comments

@omenos
Copy link

omenos commented May 13, 2023

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
Copy link

riklus commented May 13, 2023

I have this same issue too.
Schermata 2023-05-13 alle 6 33 21 PM

@Cecile-Lebleu
Copy link

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
Copy link

arjpar commented May 14, 2023

I also have the same issue.

@moyogo
Copy link

moyogo commented May 14, 2023

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
Copy link

slice commented May 15, 2023

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
Copy link

slice commented May 15, 2023

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
Copy link

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

@ipuustin
Copy link

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
Copy link

arjpar commented May 19, 2023

Should be fixed with the latest release (1.2.0)

@omenos
Copy link
Author

omenos commented May 19, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants