"Offline" web fonts?

0 favourites
  • 7 posts
From the Asset Store
Web Monetization
$7.50 USD
50% off
Easily add web monetization to your game and start earning money from supporting visitors.
  • Hi all,

    I'm working on a desktop game, exported with awesominium, a game that has a LOT of dialogue in it. I want to use a custom font for the game but I'm really running into some road blocks trying to do that.

    Bitmap fonts are out of the question, the Spritefont plugin creates multiple cached textures of each text instance, so that just isn't realistic when it comes to performance. Especially in a game that has 50+ text instances on each layout. I may as well just create static .png files of each dialogue in photoshop >.<

    Web fonts are also a no go, I can't force players into a game that requires an always on internet connection just to download a single font.

    *sigh* This is getting quite depressing actually.

    Then I saw this: ruel.me/blog/2011/02/03/using-google-fonts-locally

    If I'm reading that right, I understand I can download a custom font, but basically "fake" it as a web font, even though it's stored locally.

    Would that work? I'm not able to test this myself as I won't be able to get in front of Construct for the next few days. I hope it does, I'm out of options here =

    Any ideas?

    Thanks for listening to me ramble...

  • You could bundle the font you want with the game, but most games just use images for fonts. You'd just use a photo editing software, type in what you wanted in a font on your computer, and export it as an image.

  • Okay, it's easy xD

    In your Files Folder, import the font that you want to use, I suggest to convert it to woff and also a font.css file.

    The font.css must contain the following code:

    {

    font-family: '[name]';

    font-style: normal;

    font-weight: 400;

    src: local('[name]'), url('[file]') format('woff');

    }

    After you imported those 2 files, in the event sheet, add the "Set Web Font" action, (On Layout Start > [Your text obj] > Set Web Font )

    Family name: [the name you used in your font.css file]

    CSS URL: "font.css"

  • And that will work completely offline? Wow. It's confusing to me though, if I can just import a font, why do I need a .css sheet at all?

    Oh well...

    Thanks a lot Wildmedia, I'll try this out when I get home tomorrow!

  • I think this tutorial would apply: scirra.com/tutorials/237/how-to-use-your-own-web-fonts

  • Kazan, If you want to use the game only on your PC you don't need a CSS, but the game will be played by people who don't have the font installed, so the CSS will tell the browser how to render the font, and where he can find the font. If you use my method, you won't need google fake fonts, or whatever is called because the font will pe placed inside your game data, please tell me if you managed to solve your problem. xD

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • using web fonts. still didn´t work. On the web, it´s fine. But on IOS device preview, it´s not working

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)