[Problem Solved!] CocoonJS fonts on Android/iOS

Discussion and feedback on Construct 2

Post » Fri May 24, 2013 5:19 am

Hi there, everybody.

Yesterday a kind friend of mine helped test my game (I'll put it on the Scirra Arcade as soon as it's ready, see attached screenshot!) and I noticed a small thing (maybe a bug?) about the Construct 2/CocoonJS font compatibility, which is:

* The font name you use in the 'Event Sheet' of any layout of your game/application must be written in small caps only - somehow the Android version of CocoonJS will sort out Caps in the font filename, but not the iOS version, and the result will be the iPhone/iPad defaulting to the Arial-like system font.

As further help, the steps needed to use any font you wish on Android/iPhone apps through CocoonJS are:

1) Put the font file (for example "Font Name.ttf") in the Files folder of your project (you can do it directly from Construct 2 'Projects' Tab)

2) In the Event Sheets of your project use the function 'Sent Font Face to...' on any of your Text objects, and set the font name to the 'font name' you adopted. No need to put the '.ttf' in there, but it has to be written in small caps, or it won't work on iPhones.

3) Compile on Construct 2, and test on CocoonJS Launcher

4) Be merry! ^_^

B
2
Posts: 3
Reputation: 181

Post » Fri May 24, 2013 5:32 am

Thanks for sharing :). I notice you're referring to 'Set Font Face' and not 'Set Web Font'. Out of curiosity, does CocoonJS only support 'Set Font Face' and not webfonts? I'm asking because I'd like to know what's required for best portability. Say, I'm exporting to HTML5, then I'd use webfonts, but if I want to export to CocoonJS then I'll need to modify all 'Set Web Font' to 'Set Font Face'?
B
21
S
5
G
5
Posts: 58
Reputation: 5,232

Post » Fri May 24, 2013 5:48 am

Hi Soybean! I still didn't try the Web Fonts functionality, and frankly think that it's a risk to "outsource" a part of your code to a remote server location, which does rely on your users always having an Internet connection and the server not having a downtime.

Most fonts will not take more than 50k-100k, so it's better to just put it into the project file.

If you're still adamant to use Web Fonts, I think Ashley did a very good tutorial about implementing them. ^___^
B
2
Posts: 3
Reputation: 181

Post » Fri May 24, 2013 7:12 am

Yeah, fortunately you can also 'embed' WebFonts in the same way as importing TTF files. So no need to access internet to use the webfonts. Another good thing is, beside webfont formats (.eot, .svg, .woff), there is also .ttf included in webfont kits so I guess now is just: does CocoonJS work well if we use 'Set Web Font' instead of 'Set Font Face'. :)soybean2013-05-24 07:13:45
B
21
S
5
G
5
Posts: 58
Reputation: 5,232

Post » Fri May 24, 2013 7:19 am

That's cool stuff, bro. Construct 2 rocks! ^___^
B
2
Posts: 3
Reputation: 181

Post » Sun Jul 14, 2013 10:22 pm

Nice post... I did not even know you could implement a font in your project till I saw your post, how does it work exactly?
B
9
S
4
G
1
Posts: 102
Reputation: 2,274

Post » Thu Aug 22, 2013 9:11 pm

Thx for sharing! :D
B
6
Posts: 9
Reputation: 456

Post » Fri Aug 23, 2013 12:45 am

B
201
S
52
G
30
Posts: 897
Reputation: 36,621

Post » Sat Aug 24, 2013 3:22 pm

Thanks @Samuele. This helped me a lot!
B
11
S
3
Posts: 224
Reputation: 2,028

Post » Thu Dec 19, 2013 8:35 pm

Should this solution also work on preview? Because I followed the steps, but the small default font still shows on the iOS device...
B
4
Posts: 4
Reputation: 208

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 11 guests