Source language: Translate to:

Google Fonts

General questions about NeoAppBuilder - our rapid application development tool for building HTML5, web and mobile apps.

Moderator: Neosoft Support

Google Fonts

Postby luishp » Sun Sep 06, 2015 10:23 am

With a small workaround I have been able to use Google Fonts on my NAB projects
I just add a code like this on Project->Properties->Styles

Code: Select all
  @font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 400;
  src: local('Oswald Regular'), local('Oswald-Regular'), url(https://fonts.gstatic.com/s/oswald/v10/pEobIV_lL25TKBpqVI_a2w.woff2) format('woff2');
}


In this case I can use the Oswald font as it is downloaded from Google Servers, but it is only shown on runtime and only in Chrome and Firefox.
If I use the JavaScript version on start-up App Event it works on all browsers but, again, only at runtime:

Code: Select all
BeginJS
WebFontConfig = {
    google: { families: [ 'Indie+Flower::latin' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })();
EndJS


Would be nice to have the possibility to select Google fonts to work with inside the NAB editor.
Luis Hernández - SinLios Soluciones Digitales
http://sinlios.com
User avatar
luishp
 
Posts: 357
Joined: Wed May 23, 2007 10:17 am
Location: Spain

Re: Google Fonts

Postby Neosoft Support » Mon Sep 07, 2015 2:03 pm

Internet Explorer doesn't support the woff2 font format, so you would need to include a fall back option in your @font-face css.

More info here:

http://www.w3schools.com/css/css3_fonts.asp

and about Google fonts specifically:

http://stackoverflow.com/questions/3694060/how-to-make-google-fonts-work-in-ie

Also, I would host the fonts on your own server if you can. Then if/when Google decides to change something your website will still work.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA


Return to General NeoAppBuilder Discussion

Who is online

Users browsing this forum: No registered users and 2 guests