• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

WebFonts for HTML5

J

jadegames

Guest
Hi, I am completely unable to use WebFonts for HTML5 games I create. I know it's possible, the documentations says it is http://docs.yoyogames.com/source/dadiospice/002_reference/game assets/fonts/font_add.html but I am unable to get it to work.

I did a quick search on this forum and the search "Web Font" yielded 0 results so I believe I've done my due diligence by looking on the forum to see if this question had been asked first.

I've disabled WebGL and put all the Web Font formats into a folder and added it to the Included Files section. Then I run the following

Font0 = font_add( '1/Daughter.woff', 80, false, false, 32, 128);
draw_set_font(Font0);

But Font0 shows a very small number that looks nothing like my font, I believe it has reverted to the default of Aerial. There are no errors in the debug mode logs or on the browser console either.

Has anyone managed to use Web Fonts with HTML5 before successfully? I know I can add the font via the font section and import one that way, but I had the goal for a future project of using Google Noto so I would have one font to rule them all.
 

chmod777

Member
Hi,

I've made a try. Actually, it should be possible to load TTF fonts only, but it is broken due to obfuscation issues.
Maybe a work around would be to load your font in your HTML file directly (so a .woff file would be fine) and then call it by its name with the font_add function. EDIT : just tried, and it worked.

index.html :
@font-face {
font-family: "Daughter";
src: url("mygame/Daughter.woff");
}

<p style="font:'Daughter'"></p> (otherwise the browser won't load the file)

In your game:
Font0 = font_add("Daughter", 80, false, false, 32, 128)
 
Last edited:
B

BJDGAMES

Guest
honestly this is a bit frustrating. I took a lot of effort creating my own font because gamemaker gives you this warning that you are not allowed to copy existing fonts.
So now I finally got my own font, and now the code is not working when I use the to HTML5 converter.

Honestly, this is not what I expect when buying a product, especially not because i had to pay for this HTML5 converter.
Personally, I`m a programmer. (like more of you are in a fulltime job i guess) and this is something I could not deliver to my customers at work..

So please gamemaker, when you sell stuff. Make sure it works.. I`m not happy about this.
 

klys

Member
honestly this is a bit frustrating. I took a lot of effort creating my own font because gamemaker gives you this warning that you are not allowed to copy existing fonts.
So now I finally got my own font, and now the code is not working when I use the to HTML5 converter.

Honestly, this is not what I expect when buying a product, especially not because i had to pay for this HTML5 converter.
Personally, I`m a programmer. (like more of you are in a fulltime job i guess) and this is something I could not deliver to my customers at work..

So please gamemaker, when you sell stuff. Make sure it works.. I`m not happy about this.
If you are really a programmer, you should be able to solve any software problem and not posting a kid rage quit message.

However game maker studio is a little buggy and you need to understand how its work to avoid tipical pitfalls.

To solve a problem in GMS i do as follow:
* Clean Cache
* Read documentation (REPEAT this untill you really understand what it REALLY means)
* Search on Google

In VERY wierd cases:
* Restart the IDE
* Restart Windows
* Reinstall the IDE

If i am not able to solve the problem before of in deep testing i come here to post my problem.

If you need to be fast, if the time is killing you: i recommend to use a tool you know better than GMS.

If not, try harder, and never surrender, because then you will be able to solve you problem, no matter what is it!
 
Top