How to use specific font in Electron APP?


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.


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


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.


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.


Ok, Thank you very much.


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.


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


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.