You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Web: allow to use Fira Code in editor (Safari) #83294
feature-requestRequest for new features or functionalityfont-renderingFont rendering issuessafariIssues running VSCode in Web on SafariwebIssues related to running VSCode in the web
AFAIK that piece of code only executes on startup (to load the previous font metrics from local storage and avoid measuring the font and doing a sync layout in the startup phase). It is possible to change editor.fontFamily after the workbench startup, so that place would not be good.
I think we need an editor contribution that only executes on the web, on Safari, and which listens to editor option change events, and checks if the fontFamily is configured with a font that work on Safari or not... But how should we know the entire list of fonts that work on Safari?
I like that. We can possibly put this somewhere into our workbench specific overrides for the editor? E.g. when running in Safari, we do not allow a font family that is not in that set?
Hello! Sorry to bother. I want to know if there is a way to import font (embedded using base64, for example) to change the font in safari ? Using HTML <style> or a CSS file ?
The proper way to use Nerd Fonts in Safari is to serve them along with the client. I'm pretty sure browsers only load what they need (font-wise), so that would be an option, but requires changes on the server.
As a user, you'd need to achieve the same effect without access to the server (assuming you're not hosting VSCode yourself). It may be possible to use a browser extension to inject the font into the page, or just create a browser extension for injecting the font. IIUC, as long as the font is loaded by the page, referencing it will work.
Another option is to install VSCode locally and attach to a remote server. For example, GitHub Codespaces allows you to open the codespace using your local VSCode installation:
I'm using Iosevka Nerd Font with this approach (without any issues).
feature-requestRequest for new features or functionalityfont-renderingFont rendering issuessafariIssues running VSCode in Web on SafariwebIssues related to running VSCode in the web
Activity
bpasero commentedon Oct 28, 2019
//cc alexandrudima who I think knows why this happens
Maybe one workaround would be to at least not fallback to a serif-font when this happens but rather pick our default (if we can possibly detect that).
alexdima commentedon Oct 29, 2019
My theory is that this is blocked to prevent finger-printing via installed fonts...
I am not sure how the editor itself can validate this setting, because the editor can be embedded in pages which do contain Fira Code via CSS...
So I think we might need special editor.fontFamily Safari validation, but only in the workbench (not the standalone editor)...
bpasero commentedon Oct 29, 2019
Maybe somewhere here:
workbench#restoreFontInfoalexdima commentedon Oct 30, 2019
AFAIK that piece of code only executes on startup (to load the previous font metrics from local storage and avoid measuring the font and doing a sync layout in the startup phase). It is possible to change
editor.fontFamilyafter the workbench startup, so that place would not be good.I think we need an editor contribution that only executes on the web, on Safari, and which listens to editor option change events, and checks if the
fontFamilyis configured with a font that work on Safari or not... But how should we know the entire list of fonts that work on Safari?alexdima commentedon Oct 30, 2019
I have found this -- https://en.wikipedia.org/wiki/List_of_typefaces_included_with_macOS , should we ship with this list hard coded somewhere?
bpasero commentedon Oct 30, 2019
I like that. We can possibly put this somewhere into our workbench specific overrides for the editor? E.g. when running in Safari, we do not allow a font family that is not in that set?
Code pointer:
getConfigurationOverridesalexdima commentedon Oct 30, 2019
Benjamin Pasero (@bpasero) When you played with the CSS variant, did you experiment with using
localas asrc?https://stackoverflow.com/a/43502304
e.g.
alexdima commentedon Oct 30, 2019
Actually it looks like this is a known limitation, for example designers try to use Figma in the browser with their local fonts... and they need to install an app for that... -- https://help.figma.com/article/356-use-local-fonts-with-figma-font-helper
alexdima commentedon Oct 30, 2019
Yeah, I finally could find a definitive answer -- it is done to avoid fingerprinting -- https://stackoverflow.com/a/52805055
bpasero commentedon Nov 5, 2019
I actually think this is a fair workaround:
"editor.fontFamily": "Fira Code, Menlo, Monaco"It works nicely on Safari to fallback to Menlo.
[-]Web: cannot use Fira Code in editor (Safari)[/-][+]Web: allow to use Fira Code in editor (Safari)[/+]Mara-Li commentedon Jul 7, 2022
Hello! Sorry to bother. I want to know if there is a way to import font (embedded using base64, for example) to change the font in safari ? Using HTML
<style>or a CSS file ?Thank you :)!
oliverlabs commentedon Apr 27, 2023
Has anyone been able to work around this? Any Nerd Font in Safari seems to be blocked.
7ombie commentedon Feb 12, 2024
Safari removed the workarounds a while ago (see this StackOverflow question).
The proper way to use Nerd Fonts in Safari is to serve them along with the client. I'm pretty sure browsers only load what they need (font-wise), so that would be an option, but requires changes on the server.
As a user, you'd need to achieve the same effect without access to the server (assuming you're not hosting VSCode yourself). It may be possible to use a browser extension to inject the font into the page, or just create a browser extension for injecting the font. IIUC, as long as the font is loaded by the page, referencing it will work.
7ombie commentedon Feb 12, 2024
Another option is to install VSCode locally and attach to a remote server. For example, GitHub Codespaces allows you to open the codespace using your local VSCode installation:
I'm using Iosevka Nerd Font with this approach (without any issues).