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

JuliaMono's '>' #61

Closed
fredrikekre opened this issue Oct 10, 2020 · 13 comments
Closed

JuliaMono's '>' #61

fredrikekre opened this issue Oct 10, 2020 · 13 comments
Labels

Comments

@fredrikekre
Copy link

This is what <> looks like in my terminal:
Screenshot from 2020-10-10 20-38-37
but it looks correct in e.g. SublimeText and elsewhere. This is on Ubuntu (16.04) with the standard terminal.

Ps. I just installed JuliaMono and it looks great for everything else, thanks!

@cormullion
Copy link
Owner

Can't reproduce on Ubuntu here...

If you could find the font, get Info, and tell me what the copyright string says, that might be helpful as a first step.

Otherwise, ¯\_(ツ)_/¯ ...

@fredrikekre
Copy link
Author

Sorry, not sure what information you were asking for.

@cormullion
Copy link
Owner

If you find the font file that you're using (I don't know where you put it), click on it, a window pops up and says at the top right [Info | Installed]. In Info, you should be able to see come information strings, such as Copyright...

@fredrikekre
Copy link
Author

Ah okay, thanks.

Name: JuliaMono
Style: Regular
Type: TrueType font
Version: 0.018; ttfautohint (v1.8)
Copyright: Copyright © 2020 by cormullion 2020-10-08 12:29:46

The terminal is GNOME Terminal version 3.18.3-1ubuntu1.

@cormullion
Copy link
Owner

That's more or less what I have here (GNOME terminal 3.28.2) - so the problem is only on your setup, somehow. I can't do any troubleshooting on Linux, so I'll just have to leave this issue open as unresolved. Is it a problem for you in Julia too?

@fredrikekre
Copy link
Author

Yea, looks like that no matter the application in the terminal (julia, vim etc). If you have any further tips on how to debug this I am happy to try.

The character I see is the ligature version for => I guess? Is there a way to prune the font files from any such ligature variants?

@cormullion
Copy link
Owner

You're picking up a glyph that used by the ligature for =>, but the Gnome terminal doesn't support ligatures as far as I know. There's no Unicode value for that glyph, so I've no idea what's it's doing grabbing that...

To be honest, a lot of the problems people have with fonts are due to problems with terminal software. If you look at tonsky's repo (eg tonsky/FiraCode#162) there are many examples where fonts are rendered incorrectly and the likely suspect is the terminal. Of course, the authors of terminal software will say it's a problem with the font...

The places where fonts tend to work without errors most often are the browsers - so much work has gone into text display. And even they have problems...

So one possible way out is to strip out the ligatures from the file. Here's my first attempt at making a version that has no ligatures or alternates.

JuliaMono-RegularPlain-20201011-1239.ttf.zip

If you try it out, watch out for font caching - it can be difficult to persuade an OS to let go of a font and update it...

@fredrikekre
Copy link
Author

Thanks.

So one possible way out is to strip out the ligatures from the file. Here's my first attempt at making a version that has no ligatures or alternates.

Yea, this version works (perhaps that is obvious since the problematic glyphs are not included 🙂 ). Would it be possible to distribute the font without alternates like this? Otherwise, is there a tool I can run myself on the font to strip out alternates?

@cormullion
Copy link
Owner

I can add this to the build process so that it's automatically added to the repo. So, like the Latin versions, there could be a RegularPlain and BoldPlain version. For now, you could try pyftsubset -- OpenType font subsetter and optimizer -- from https://github.com/fonttools/fonttools. But I don't want to spend more time than I absolutely have to on fonts... :) 🤣

@knuesel
Copy link
Collaborator

knuesel commented Oct 11, 2020

I can reproduce the problem in gnome-terminal on Ubuntu 16.04. But Ubuntu 16.04 is ancient (I used a Docker image to reproduce the bug). It works fine on Ubuntu 20.04 (gnome-terminal 3.36.2).

@fredrikekre
Copy link
Author

Thanks. Good to know! I know I should upgrade...

@stale
Copy link

stale bot commented Oct 18, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!

@stale stale bot added the stale label Oct 18, 2020
@stale stale bot closed this as completed Oct 25, 2020
@fredrikekre
Copy link
Author

For reference, this is what I am using to (succesfully) strip the font from any ligatures and such:

$ cat Dockerfile 
FROM python
RUN pip install fonttools
COPY run.sh /scripts/
ENTRYPOINT ["/scripts/run.sh"]

$ cat run.sh 
#!/bin/bash
set -euo pipefail

VERSION="${1-}"

mkdir -p /juliamono-source
mkdir -p /juliamono-output
mkdir -p /juliamono

# Download release version
curl -L "https://github.com/cormullion/juliamono/releases/download/v${VERSION}/JuliaMono.tar.gz" | tar -xzvC /juliamono-source

# Strip glyphs
for f in /juliamono-source/*.ttf
do
    pyftsubset "$f" '*' --output-file=/juliamono-output/$(basename "$f")  --layout-features-=calt,liga
done

# Pack it up
tar -C /juliamono-output -czvf /juliamono/JuliaMono-${VERSION}.tar.gz $(ls /juliamono-output)

$ cat Makefile 
.PHONY: image strip
VERSION := 0.021
image:
        docker build -t juliamono-strip:latest .

strip:
        docker run --rm -v ${PWD}:/juliamono juliamono-strip:latest "${VERSION}"

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

No branches or pull requests

3 participants