code-server icon indicating copy to clipboard operation
code-server copied to clipboard

[Feat]: Allow Custom Fonts Throught Env Vars

Open Sharpz7 opened this issue 3 years ago • 1 comments

What is your suggestion?

Allow web-fonts to be added through a Enviromental Variable, or multiple by using commas

Why do you want this feature?

I-Pads, Chromebook and Phone users would greatly benifit from this feature, as adding fonts on these devices is tricky. Also using code-server on public/school computers means that custom fonts cannot be installed, so web fonts would solve this to.

Are there any workarounds to get this functionality today?

Yes, see https://github.com/tuanpham-dev/code-server-font-patch (https://github.com/coder/code-server/discussions/5238, https://github.com/coder/code-server/issues/1374)

Are you interested in submitting a PR for this?

I would need a bit of help on implementing it most optimally, but the way I see it is that you would use Googles Web Font Loader to install fonts. Maybe a more custom model could be used but at a bare minimum this would work.

WebFontConfig = {
    google: { families: [ 'Work+Sans:semibold', 'Roboto' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })();

Sharpz7 avatar Jun 07 '22 15:06 Sharpz7

Thanks for opening this! Let's let the code-server community vote on this and then we can discuss whether or not we should implement it.

jsjoeio avatar Jun 09 '22 15:06 jsjoeio