Jump to content

Embedding Font?


Secretmapper
 Share

Recommended Posts

Forgive me if it is in the examples/or docs somewhere (trust me, I looked ;)) but I can't find anything about embedding (actual) fonts.

 

I know that we can embed bitmap fonts, but how can we use actual tff/woff files for example? Is this something that can be done by using css (font-family)? Or is this a limitation of HTML5?

 

The reason I need to use actual fonts is for styling (fill, stroke, etc) since I need different styles for the same font.

 

Thanks!

Link to comment
Share on other sites

Yes I meant injecting the custom face font in the css, e.g like?

@font-face {  font-family: 'custom';  src: url('url-to-font');}

from js? Granted it would be easy to just add it myself (just four lines) but if it's possible it might be great to work with a consistent api (i.e. the loader adds that bit of css itself).

 

Once again, I'm not really that experienced though, so I may just be spouting wrong things :D I hope I'm not taking too much of your time :)

Link to comment
Share on other sites

Yes I meant injecting the custom face font in the css, e.g like?

@font-face {  font-family: 'custom';  src: url('url-to-font');}

from js? Granted it would be easy to just add it myself (just four lines) but if it's possible it might be great to work with a consistent api (i.e. the loader adds that bit of css itself).

 

Once again, I'm not really that experienced though, so I may just be spouting wrong things :D I hope I'm not taking too much of your time :)

 

yes that would work. I just tried the simple 

<link href='http://fonts.googleapis.com/css?family=Londrina+Solid' rel='stylesheet' type='text/css'>

then use it

this.game.add.text(0, 0, 'text here', { font: '20px Londrina Solid', fill: '#663300', align: 'center' }); 
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...