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

Add JuliaMono as default font in VSCode #50

Open
heetbeet opened this issue Mar 29, 2021 · 10 comments
Open

Add JuliaMono as default font in VSCode #50

heetbeet opened this issue Mar 29, 2021 · 10 comments
Labels
enhancement New feature or request

Comments

@heetbeet
Copy link
Owner

heetbeet commented Mar 29, 2021

The idea is to download JuliaMono from: https://github.com/cormullion/juliamono/blob/master/juliamono-ttf.zip and add the .ttfs to packages\fonts.

Then before any VSCode launch, the following code can be adapted and run to ensure all fonts are temporary available to the system https://gist.github.com/Jaykul/d53a16ce5e7d50b13530acb4f98aaabd , for eg bin/activate-juliawin-fonts.ps1 with content:

add-type -name Session -namespace "" -member @"
[DllImport("gdi32.dll")]
public static extern int AddFontResource(string filePath);
"@

$null = foreach($font in Get-ChildItem -Path "$juliawin_packages\fonts" -Recurse -Include *.ttf, *.otg) {
    [Session]::AddFontResource($font.FullName)
}

On the VSCode side we should add JuliaMono in the font setting, (over here, https://github.com/heetbeet/juliawin/blob/main/userdata/.vscode/data/user-data/User/settings.json ), similarly to this guide https://dev.to/thegeoffstevens/vs-code-settings-you-should-customize-5e75 but replacing Fira with Juliamono:

"editor.fontFamily": "Fira Code"
"editor.fontLigatures": true
@RoyiAvital
Copy link

Does it mean the Font will be added only for the session of VS Code?
What happens if VS Code crashes?
Or is it added for as long as the kernel (Windows Kernel) session is a live?

@heetbeet
Copy link
Owner Author

This .ps1 script allows the fonts to be added to Windows's font cache without installing it. It is accessible by any program until the next reboot (for the duration of the current Windows Kernel).

Ideally I would have have wanted the font to only be active for the duration of the VSCode session and only accessible to VSCode. This, however, it not possible as far as I know.

@heetbeet
Copy link
Owner Author

Hmm it seems like the font is added permanantly to the user's fonts. This is a bit rude and not ideal.

@heetbeet
Copy link
Owner Author

@RoyiAvital
Copy link

Is the attachment a solution for this or the permanent addition?

@heetbeet
Copy link
Owner Author

The attachment is a solution for portably adding the fonts to the current windows session. I'm still not sure if it's a good idea since every Windows app will reflect the fonts until the next reboot.

@RoyiAvital
Copy link

RoyiAvital commented Sep 28, 2022

Maybe have a documented option for Opt In?

@heetbeet
Copy link
Owner Author

Yes, like maybe an env variable (that can now be set in startup.cmd).
Like set JULIAWIN_JULIAMONO_FONTS=true

@RoyiAvital
Copy link

Yep, that would be great. Once it is there, let me know, I will document it in the Wiki page.

@RoyiAvital
Copy link

Any chance to have this in the 1.9.x version?

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

No branches or pull requests

2 participants