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

Make ligatures "monospaced" and use complex character substitution #77

Open
IdreesInc opened this issue Dec 28, 2022 · 3 comments
Open
Labels
help wanted Extra attention is needed

Comments

@IdreesInc
Copy link
Owner

IdreesInc commented Dec 28, 2022

The ligature characters used in Monocraft replace multiple characters and so are bigger than the other characters in the font. This causes the font to not technically be classified as a monospaced font on Mac. Fonts like Hasklig and FiraCode use complex character substitution that replace the characters with ligature glyphs that go beyond the bounds and spacer characters to match the width of the original character set. I am not sure how to reproduce this in FontForge and it seems to be complicated, so any help on how to replace multiple characters (like "===") with other multiple characters (like "[SPACE][SPACE][LIG]") would be appreciated!

@IdreesInc IdreesInc changed the title Make Monocraft ligatures "monospaced" Make ligatures "monospaced" Dec 28, 2022
@IdreesInc IdreesInc assigned IdreesInc and unassigned IdreesInc Dec 28, 2022
@IdreesInc IdreesInc added the help wanted Extra attention is needed label Dec 28, 2022
@IdreesInc IdreesInc changed the title Make ligatures "monospaced" Make ligatures "monospaced" and use complex character substitution Dec 28, 2022
br3ndonland added a commit to br3ndonland/dotfiles that referenced this issue Oct 13, 2024
This commit will update `kitty.conf` to switch the font from Dank Mono
to Recursive (`Rec Mono Duotone`).

This commit is part of a switch from Dank Mono to Recursive.
Although Dank Mono does render in VSCode, it is not correctly monospaced
and therefore stopped working in some applications that have more strict
font requirements, like the terminal emulator kitty (kitty >=0.36).

https://www.recursive.design/
https://github.com/arrowtype/recursive
https://sw.kovidgoyal.net/kitty/changelog/
https://sw.kovidgoyal.net/kitty/faq/#kitty-is-not-able-to-use-my-favorite-font

Explanation from Dank Mono creator Phil Pluckthun via email:

> Some terminal applications require a specific monospace flag to be set
> in the font file that was only gaining traction after the font was
> released. Some also just don't support fonts with ligatures. In Dank
> Mono's case the specific flag that some applications require to select
> the font as a monospaced one simply isn't set, and a different, older
> one is set instead.

Related issues:

eigilnikolajsen/commit-mono#15
IdreesInc/Monocraft#26
IdreesInc/Monocraft#77
tonsky/FiraCode#1325
vercel/geist-font#33
br3ndonland added a commit to br3ndonland/dotfiles that referenced this issue Oct 13, 2024
This commit will update the README to document the switch from Dank Mono
to the Recursive font (`Rec Mono Duotone`).

Although Dank Mono does render in VSCode, it is not correctly monospaced
and therefore stopped working in some applications that have more strict
font requirements, like the terminal emulator kitty (kitty >=0.36).

https://www.recursive.design/
https://github.com/arrowtype/recursive
https://sw.kovidgoyal.net/kitty/changelog/
https://sw.kovidgoyal.net/kitty/faq/#kitty-is-not-able-to-use-my-favorite-font

Explanation from Dank Mono creator Phil Pluckthun via email:

> Some terminal applications require a specific monospace flag to be set
> in the font file that was only gaining traction after the font was
> released. Some also just don't support fonts with ligatures. In Dank
> Mono's case the specific flag that some applications require to select
> the font as a monospaced one simply isn't set, and a different, older
> one is set instead.

Related issues:

eigilnikolajsen/commit-mono#15
IdreesInc/Monocraft#26
IdreesInc/Monocraft#77
tonsky/FiraCode#1325
vercel/geist-font#33
@speelbarrow
Copy link

For anyone looking for a workaround, I seem to have stumbled upon one here:

Run FontForge.
Go to File > Open to load the font.
Go to Edit > Select > Glyphs with only References (while holding Shift).
Go to Edit > Select > Glyphs with only Splines (while holding Shift).
Go to Metrics > Set Width To: (insert value)* then select Center in Width.
Go to Field > Generate Fonts.
Generate.

Use the width automatically provided in the "Set Width To" dialog.

CAVEATS:

  • Cannot operate in bulk -- must manually go through each weight and do steps
  • Cannot merge the outputted .ttfs into one .ttc -- doing so stops this process from working

Attached is a zip file of all the weights after going through this process, should work if you're on macOS and need an actually monospaced font.

MonocraftMono.zip

@Dheatly23
Copy link
Contributor

@speelbarrow That doesn't work for ligatures though, because ligature character width must be the same as the entire substring width.

I'll see what i can do.

@speelbarrow
Copy link

speelbarrow commented Oct 20, 2024

@speelbarrow That doesn't work for ligatures though, ...

@Dheatly23 Okay, but, counterpoint: I tried it and they still work (sometimes)

Screenshot 2024-10-20 at 11 28 27 AM Neovide v0.13.3

Screenshot 2024-10-20 at 11 28 20 AM Kitty v0.36.4

Kitty has always been a bit weird about ligatures (in my experience, at least), so I'd take that second screenshot with a grain of salt as well. Obviously this is not a full solution to this issue, but perhaps it's a start? I'm by no means a font developer so I'll defer to the judgment of others on this one. Just thought I'd chime in with what I've already tried.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants