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

ligatures in vscode #3

Closed
tobsn opened this issue Mar 5, 2024 · 19 comments
Closed

ligatures in vscode #3

tobsn opened this issue Mar 5, 2024 · 19 comments

Comments

@tobsn
Copy link

tobsn commented Mar 5, 2024

can't get them to work... any idea?

@mietzen
Copy link
Owner

mietzen commented Mar 5, 2024

Can you please be more specific? Which ligatures are you missing?

image

Or can't you get the font to work?

'JuliaMono Nerd Font Mono'
image

Also if you realy are missing ligatures I would suggest opening a ticket at https://github.com/cormullion/juliamono, I'm just the guy adding the Nerd part ;)

@mietzen
Copy link
Owner

mietzen commented Mar 7, 2024

Any feedback @tobsn?

@tobsn
Copy link
Author

tobsn commented Mar 7, 2024

sorry, busy week - I meant double/triple equals for example.
=== ==! etc.

They seem to not work with the latin version at least (which, why does this look so much better? :))

@mietzen
Copy link
Owner

mietzen commented Mar 7, 2024

sorry, busy week - I meant double/triple equals for example. === ==! etc.

They seem to not work with the latin version at least (which, why does this look so much better? :))

Sorry I still don't get what you mean, could you give me the Unicode code point, e.g. U+2261 and perhaps post a screenshot of the working ligature in another font vs. the non working in julia?

@tobsn
Copy link
Author

tobsn commented Mar 7, 2024

fira code:
ZuCcvKOzrNFWWl3U9eiySvFKvLnBx0fu
fDoAvbGgxet4Y1beOpzgdun9CZtqmZMQ

JuliaMonoLatin Nerd Font Mono:
eWw1Z6GE0MrEtfB4TIq1of1P5fsMLPlf

hope that helps

@mietzen
Copy link
Owner

mietzen commented Mar 7, 2024

I build with the --mono flag if I understand the fira code repo right there are no ligatures when using the mono type. I’ll look at it on the weekend.

@mietzen
Copy link
Owner

mietzen commented Mar 8, 2024

I build the font without the --mono flag:

font.zip includes:

JuliaMonoNerdFont-Bold.ttf
JuliaMonoNerdFont-Light.ttf
JuliaMonoNerdFont-Regular.ttf

Could you test if this fixes the issue? If so I'll update the release and from now on build with and without --mono.

Ok the Arrows work, but not the equal signs. That's confusing...

Edit: But the behaviour is the same for the unpatched font

@mietzen
Copy link
Owner

mietzen commented Mar 8, 2024

Ok as far as my understanding goes that is not a part that the NerdFontPatcher adds, the ligatures must be defined in the font itself. @tobsn and @cormullion please correct me if I'm wrong, otherwise I'll close this Issue.

Nevertheless it is always interesting to learn how unicode works 😉

I also will add the non --mono, see #5

@mietzen
Copy link
Owner

mietzen commented Mar 8, 2024

Ok I also found this repo: https://github.com/ToxicFrog/Ligaturizer

I'll try it later

@cormullion
Copy link

Don't use the "-Latin" fonts - they're stripped down "Latin-only" versions designed for quick loading.

Font Size
JuliaMono-RegularLatin.ttf 77108
JuliaMono-Regular.ttf 3147688

@cormullion
Copy link

fira code: ZuCcvKOzrNFWWl3U9eiySvFKvLnBx0fu fDoAvbGgxet4Y1beOpzgdun9CZtqmZMQ

JuliaMonoLatin Nerd Font Mono: eWw1Z6GE0MrEtfB4TIq1of1P5fsMLPlf

hope that helps

But I think you'll be disappointed, since only these 'ligatures' are provided:

Screenshot 2024-03-08 at 10 45 39

If you want ligatures, Fira Code is definitely the font for you. I think hiding the gaps between the equals signs, or replacing glyphs with others that look like completely different Unicode characters is poor design... :)

@mietzen
Copy link
Owner

mietzen commented Mar 8, 2024

Ok I also found this repo: https://github.com/ToxicFrog/Ligaturizer

I'll try it later

image

I was able to build a font with working ligatures for the equal signs, but it's a pain in the ***. The Ligaturizer scripts is buggy and only works with:

  • JuliaMono-Bold.ttf
  • JuliaMono-BoldItalic.ttf
  • JuliaMono-Regular.ttf
  • JuliaMono-RegularItalic.ttf

all other files look like this:

LigaJuliaMonoSemiBold-SemiBold.ttf and the font name is Liga JuliaMono Semibold Semibold

There is a Issue in the repo, but without a fix: ToxicFrog/Ligaturizer#53

Also the script uses a old version (3.1) of fira code, updating to a newer version is not possible because fira code switched to otf.

I will not integrate this into the workflows. But if you want to reproduce it, this is the script I used:

apt install python3-fontforge -y

git clone https://github.com/cormullion/juliamono

mkdir -p juliamono_ligaturized
mkdir -p juliamono-nerd-font/font/ligaturized/mono

git clone https://github.com/ToxicFrog/Ligaturizer --recurse-submodules

cd Ligaturizer

declare -a file_list=("JuliaMono-Bold.ttf" "JuliaMono-BoldItalic.ttf" "JuliaMono-Regular.ttf" "JuliaMono-RegularItalic.ttf")

for filename in "${file_list[@]}"; do
    echo $filename
    fontforge -lang py -script ligaturize.py ../juliamono/${filename} \
        --output-dir='../juliamono_ligaturized'
done

cd ..

docker run --rm -v `pwd`/juliamono_ligaturized:/in -v `pwd`/juliamono-nerd-font/font/ligaturized:/out nerdfonts/patcher --complete --careful
docker run --rm -v `pwd`/juliamono_ligaturized:/in -v `pwd`/juliamono-nerd-font/font/ligaturized/mono:/out nerdfonts/patcher --complete --careful --mono

From my point of view there are two solutions is one solution:

  • Someone does a complete rewrite of https://github.com/ToxicFrog/Ligaturizer, fixes the bugs and finds a way to use the otf fonts or there is a bug free and maintained alternative I overlooked, then I may consider integrating it
  • @cormullion integrates the ligatures in JuliaMono

Edit: Missed @cormullion reply... down to one solution

@mietzen mietzen closed this as completed Mar 8, 2024
@mietzen
Copy link
Owner

mietzen commented Mar 8, 2024

Forgot to upload the .zip:

ligaturized.zip

But if you need updates or more / newer ligatures of fira you have to build them yourself or use fira code

@cormullion
Copy link

Thanks for all your hard work @mietzen!

I follow the issues on Fira Code' github repo. Ligatures are a continuing source of issues, problems, and additional work, and I don't regret my decision to not start down that path (even if I was funded 🤣).

@tobsn
Copy link
Author

tobsn commented Mar 11, 2024

@mietzen that works great yes!

You think you could rerun it again with Latin?
JuliaMonoLatin Nerd Font Mono

If not that's okay :)

@mietzen
Copy link
Owner

mietzen commented Mar 11, 2024

@tobsn I already delete the files sorry, also I think the Ligaturizer script had some troubles with the latin font as well

@cormullion
Copy link

@mietzen that works great yes!

You think you could rerun it again with Latin? JuliaMonoLatin Nerd Font Mono

Out of interest, why do you want the Latin? You could always remove unwanted features with https://mutsuntsai.github.io/fontfreeze/ ...

@tobsn
Copy link
Author

tobsn commented Mar 11, 2024

hLIRioG6DVeqdc7vaPw8b3VNifPepfA0
qAE4Jn8g36o9mKtJFOS90cfKs6bQv2AN

because Latin looks a lot better :)

Edit: Oh wait... Latin is the same as not Mono?

@cormullion
Copy link

#3 (comment)

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

3 participants