Import font into the project

Get help using Construct 2

Post » Thu Nov 29, 2012 10:59 am

Hello everyone,

I've been trying to import a font into my capx file so that when I upload the game on facebook or make exe file the font would be set from the game itself (and not Windows fonts or webfonts hosted somewhere).
I am not sure whether this is possible or not, according to this tutorial: http://www.scirra.com/tutorials/237/how-to-use-your-own-web-fonts/page-1/comments-1#comments it should be. But maybe I misunderstood it. I set up my game according to this tutorial and the font show ok as long as I have the file in my Windows Fonts. If I remove it from there or try it from another computer which doesn't have it, it shows the default font instead of the one I set.
Can someone please tell me if it is possible to NOT be depended on what's in the windows fonts folder? Also the hosted webfont is not a good option either since if I make an exe file and want to play offline, it still won't show.

thanks in advance!
B
6
S
1
Posts: 32
Reputation: 789

Post » Thu Nov 29, 2012 11:33 am

The only solution right now is to make the font a sprite , That's what I do
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Thu Nov 29, 2012 5:12 pm

I thought all you had to do was create a sub folder in your project called "fonts" and stick your TTF font in there for it to reference properly.
B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Sat Dec 01, 2012 10:12 am

yeah, I thought about making it a sprite, but the problem is that it's a counter type. One counts time another counts points (in 1000s) so you can imagine that sprite option is not feasible here. All the rest of writings I have are in sprite for that particular reason but these counters are different story.

In the tutorial I mentioned it says to import the .woff font and css file into "files" directory. Can you please elaborate on your solution justifun? or maybe post an example capx?
B
6
S
1
Posts: 32
Reputation: 789

Post » Sat Dec 01, 2012 1:20 pm

Try The SpriteFont Plugin !
In the plugin section ...
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Sat Dec 01, 2012 3:12 pm

I followed the tutorial and it worked perfectly. Even easier is to use a font provided by google: http://www.google.com/webfonts
I will look like this: http://di/m3qm
7Soul2012-12-01 15:13:29
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134

Post » Sat Dec 01, 2012 3:33 pm

I had the same issue, but managed to event a counter system using sprites. Not hard at all really. Here's a capture of it.

https://www.dropbox.com/s/ss4hp0ftdgmpv0m/scoresprite.PNG

I tried the sprite font plugin, but it didn't work with CocoonJS.
Tobye2012-12-01 15:39:52
B
27
S
8
G
5
Posts: 429
Reputation: 6,902

Post » Mon Dec 03, 2012 2:24 am

Thanks for the picture Tobye, It looks easier than I imagined but it still would be wonderful if the solution I'm asking for existed

7Soul, you mean even if you take the font out of your windows FONTS folder and use the css/font import solution it still shows up? have you tried it this way? With me, the solution provided in that tutorial works only in case I have the font in my windows FONTS folder
B
6
S
1
Posts: 32
Reputation: 789

Post » Mon Dec 03, 2012 5:06 am

[QUOTE=Tobye]I tried the sprite font plugin, but it didn't work with CocoonJS.
[/QUOTE]

R0J0hound made a nice .capx example of how to implement sprite font into your games without the need for a plugin here:

http://www.scirra.com/forum/suggestionsprite-font_topic44315_post277605.html#277605

Iv used this method, and it works quite well with CocoonJS.
B
50
S
11
G
8
Posts: 479
Reputation: 9,911

Post » Mon Dec 03, 2012 5:49 am

@Wink thanks mate! This should come in very handy.
B
27
S
8
G
5
Posts: 429
Reputation: 6,902

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 0 guests