Fonts within a theme?


#1

I did some research here and can’t seem to find the easiest way to include a font inside a theme. It seems that most references to fonts within themes are actually packages.

I tried to @font-face it using the atom:// resource protocol found in other threads, to no avail.

I’d appreciate any help on this.


#2

You can use fonts with @font-face. Check my ui theme isotope for an example on how to do it. Example:

@font-face {
  font-family: 'Cantarell';
  font-weight: 400;
  font-style: normal;
  src: url('atom://isotope-ui/resources/cantarell/cantarell.woff');
}

Be careful with fonts in the editor though, webkit postpones loading the fonts which screws up measurements and cursor alignment. It cannot be solved reliably. Also, people like having their personal favourite font for coding.


#3

Your second solution sounds better to me, I’m just going to exclude the font from the theme completely.

The issue was just bugging me. :smiley: