How to use specific font in Electron APP?


#1

For example, I want to use Google’s Open Sans font in my app, user may not have it installed in their own machine.

How can I achieve this?
Hope anyone can help.

Thank you in advance.


#2

This is not an Electron question. When you select a font on Google’s font repository, it gives you the code to include.


#3

yeah, I know it is more related to web font or something. But I want to know how to make it happen locally, or say offline.

I guess there is a more elegant way to do this. So I ask a question here.


#4

If you want it to function offline, then you download the font and include it with your code, using @font-face in your CSS. Electron does not have a special way of doing this.


#5

Ok, Thank you very much.


#6

One more thing. If you package Open Sans with your app, make sure to include a copy of the Apache License 2.0 and a comment in some prominent text file attributing the Open Sans font to Google. It’s probably not something anyone will give you trouble about, but it’s something you should do just to be thorough and safe.


#7

Thank you very much. I will do it as you say.


#8

According to this link in the Google Fonts attribution page, you don’t really have to include the license or attribute the fonts to the authors, although it is appreciated.