telm
By:
telm

Can't load font on droplet

February 4, 2017 361 views
DigitalOcean Ubuntu 16.04

Hello guys,

I'm trying to install SF font from Apple on my Droplet.

I've placed the font in 3 places, just in case:

/usr/share/fonts/
/usr/local/share/fonts/
~/.fonts/

Then in my .css I have:

font-family: 'SF UI Display Regular';

Which works fine in my Mac.

Any suggestions please?

2 Answers

Have you installed a desktop environment on your droplet? Which .css file are you referring to?

@telm

Unless you're referencing the location of the font in your CSS file, font-family isn't going to work as it normally would in a local environment (i.e on a Mac or Windows machine).

In your CSS file, you'll need to define @font-face and provide a direct or relative path to the font file before it can be used.

This should be placed above any references to the font in question (i.e. at the top of the CSS file).

i.e.

@font-face {
    font-family: 'SF UI Display Regular';
    font-style: normal;
    font-weight: 400;
    src: local('/path/to/font.ext');
}

You would need to change /path/to/font.ext to the direct or relative path to the associated file.

Have another answer? Share your knowledge.