Skip to content

[Feat]: Allow Custom Fonts Throught Env Vars #5246

Closed as not planned
Closed as not planned
@Sharpz7

Description

@Sharpz7

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 (#5238, #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);
  })();

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions