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

Terminal not showing specified fontFamily #10112

Closed
dhirschfeld opened this issue Apr 17, 2021 · 9 comments
Closed

Terminal not showing specified fontFamily #10112

dhirschfeld opened this issue Apr 17, 2021 · 9 comments
Labels
status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.

Comments

@dhirschfeld
Copy link
Member

dhirschfeld commented Apr 17, 2021

Description

I've installed Fira Code in my Ubuntu 18.04 container and am trying to use it for the JupyterLab terminal with no success..

The font is recognised by fc-list:

image

...but when I specify it in my terminal config:

{
    "fontFamily": "FiraCode Nerd Font",
    "fontSize": 16
}

It results in something that looks like double-spaced Times New Roman:

image

...which seems to be what happens when JupyterLab doesn't recognise the specified font (e.g. if you specify "dsfafds" you get the same result.)

If I specify consolas (or a fallback to consolas) the font renders correctly:

image

I've pretty exhaustively tried all ways of specifying the name, including quotes and no quote with no joy.


  • Operating System and version:
  • Browser and version: chrome 89.0.4389.90
  • JupyterLab version: 3.0.14
@dhirschfeld
Copy link
Member Author

Has anyone actually gotten this to work with a user installed font?

Does anyone have any suggestions of how to debug this?

@dhirschfeld
Copy link
Member Author

xref: #6657

@dhirschfeld
Copy link
Member Author

If I run the container as root specifying "fontFamily": "FiraCode Nerd Font" works 🎉

image

...so it seems like a permission error :/

@dhirschfeld
Copy link
Member Author

I'm not sure running the container as root had any effect however what did work was installing the Fira Code font on the local users computer - i.e. it's not enough to just install the font in the JupyterLab container the user running JupyterLab also needs to have the font installed locally.

I'm not sure if there's a better way? Since this works though, I'll go ahead and close this...

@telamonian
Copy link
Member

@dhirschfeld Dumb question: did you try setting

"fontFamily": "Fira Code"

?

I've run into similar trouble in the past, and in my case it was always about using the wrong font-family name. I just now tested this, this value:

"fontFamily": "FiraCode"

or any nonsense value:

"fontFamily": "foobarlas89yu3"

gives the strange double spaced font shown in the OP, while:

"fontFamily": "Fira Code"

and

"fontFamily": "fira code"

both correctly display Fira Code. I think the caps thing is because my apple filesystem is case insensitive

@dhirschfeld
Copy link
Member Author

I think I tried all possible ways of specifying the Fira Code font name. I can double check...

@telamonian
Copy link
Member

telamonian commented May 6, 2021

I think I tried all possible ways

I assumed. But the alternative explanation seems to be that your container runtime is leaking font config. Which sounds both fantastical and awful

@dhirschfeld
Copy link
Member Author

Yeah - just tested all combos from a desktop without the Fira Code font installed and no joy.

@dhirschfeld
Copy link
Member Author

In case it matters, it's actually the Fira Code Nerd Font:
https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/FiraCode.zip

Which (IIUC) is a patched version of Fira Code to include symbols used by the https://starship.rs/ prompt.

But the alternative explanation seems to be that your container runtime is leaking font config. Which sounds both fantastical and awful!

😆 It seems strange to me that I have to install a font locally. It's a bit of a hassle, but I'm glad found a workaround. If someone figures out a better solution I'm all ears. AFAIK my container is just an ordinary Ubuntu container with Python/JupyterLab installed. The relevant config:

RUN mkdir -p /usr/share/fonts/truetype/firacode \
    && curl -sSL https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/FiraCode.zip -o ~/FiraCode.zip \
    && unzip ~/FiraCode.zip -d /usr/share/fonts/truetype/firacode/ \
    && find /usr/share/fonts/truetype/firacode/ -type f -name '*Windows*' -delete \
    && find /usr/share/fonts/truetype/firacode/ -type f -name '*otf' -delete \
    && fc-cache -fv \
    && chown -Rv 1000:1000 /usr/share/fonts/truetype/firacode \
    && rm -f ~/FiraCode.zip

@github-actions github-actions bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Nov 3, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

No branches or pull requests

2 participants