"Offline" web fonts?

Get help using Construct 2

Post » Thu Sep 27, 2012 7:44 am

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: http://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...
B
13
S
6
G
5
Posts: 74
Reputation: 3,991

Post » Thu Sep 27, 2012 7:22 pm

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.
B
7
Posts: 19
Reputation: 778

Post » Thu Sep 27, 2012 9:29 pm

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-face {
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"

B
15
S
3
G
2
Posts: 42
Reputation: 2,412

Post » Thu Sep 27, 2012 10:13 pm

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!
B
13
S
6
G
5
Posts: 74
Reputation: 3,991

Post » Fri Sep 28, 2012 12:36 am

I think this tutorial would apply: http://www.scirra.com/tutorials/237/how-to-use-your-own-web-fonts
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Fri Sep 28, 2012 12:37 am

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

wildmedia2012-09-28 00:57:38
B
15
S
3
G
2
Posts: 42
Reputation: 2,412

Post » Tue Apr 21, 2015 1:41 pm

using web fonts. still didn´t work. On the web, it´s fine. But on IOS device preview, it´s not working
B
5
Posts: 27
Reputation: 275


Return to How do I....?

Who is online

Users browsing this forum: MarkThomas and 0 guests