How do I adapt text to my screen and add my own font

Get help using Construct 2

Post » Tue Oct 18, 2016 2:19 pm

Hello,

I'm here today to know how can i adapt my text to my screen, when try my game on Firefox, my texts was good, but on my phone the text is so big. It is possible to adapt the text with a box, or Text-box (I never use it and don't know how) or with event ?

And my 2nd question is, How do i add my own font on my project, i used a dafont that i had downloaded but when I export my game on my phone, the font used was Arial, so not mine..

Thanks for replies and if you have some questions, don't hesitate ! Good day ! ;)
B
10
S
4
G
2
Posts: 47
Reputation: 1,894

Post » Tue Oct 18, 2016 6:18 pm

Hi,
I can only really answer your 2nd question because I'm actually trying to get everything adapted to different screens aswell. Currently I'm trying something that I found in another thread here on the forum. That is, setting the font-size css property of the textbox to "1.5vh" . I have no idea if it works everywhere but it seems like it works on my devices.

To your 2nd question: I would use web fonts. Here https://fonts.google.com/ you can find many free web fonts. You just have to add the right url (for example this one: "https://fonts.googleapis.com/css?family=Bungee+Inline") to the web font property. If you have no internet connection this won't work though.
I hope this helps :)
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Tue Oct 18, 2016 6:47 pm

Thanks your reply ! :D

But my game will be an offline game, it is possible to add a .zip with my font in my file for Intel xdk and change some words to use my own font ?
B
10
S
4
G
2
Posts: 47
Reputation: 1,894

Post » Tue Oct 18, 2016 7:03 pm

I don't really know a way of changing the font for offline games. Actually I would be interested in seeing how that works too :D .
But maybe this thread quot-offline-quot-web-fonts_t74267 contains some valuable information for you. At least there is an explanation on how to import a css font into your game files.
If that doesn't work, you could try out Sprite Fonts. They will work online and offline :D.
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Tue Oct 18, 2016 7:21 pm

Sprite fonts ? A sprite with only text ? If yes, isnt too loud for the game ?
B
10
S
4
G
2
Posts: 47
Reputation: 1,894

Post » Tue Oct 18, 2016 8:20 pm

A Sprite Font is an object which contains an image of all characters of your font. Your game can use the image to write text just as the text object does.
Here is the manual entry: https://www.scirra.com/manual/166/sprite-font

I found this Sprite Font Generator: sprite-font-generator-v2_t8654
It should be able to convert the font that you already installed in a Sprite Font. :)
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Tue Oct 18, 2016 10:27 pm

So i create this event : "On touch.." set text to Sprite Font : Hi world

And it will work ?
B
10
S
4
G
2
Posts: 47
Reputation: 1,894

Post » Wed Oct 19, 2016 1:00 pm

No, you have to add the Sprite Font object just as any other plugin like the Text object into your project first.
Then you can either use the default font, which is loaded in the Sprite Font, or you can import a Sprite Font just like you import an image to the Sprite object (It is the same editor window). After that you have to set the right character width and height in the object's properties bar. You will get that information from the sprite font generator I found when you create your own sprite fonts.
When you are finished with these steps you should be able to just write your text in the text property or use the "set Text" action just like you do it with the Text object.
I hope this helps! :)
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Wed Oct 19, 2016 1:39 pm

Thanks, i'll try tonight, if i've some questions i'll come back here :p
B
10
S
4
G
2
Posts: 47
Reputation: 1,894

Post » Wed Oct 19, 2016 2:49 pm

Came here to say about sprite font too, it'll work for you.
Check some tutos on youtube, it's easy and great =P
English is not my native language. Sorry for any mistakes and feel free to correct me if needed.
B
14
S
5
G
3
Posts: 113
Reputation: 3,231

Next

Return to How do I....?

Who is online

Users browsing this forum: AllanR, Artcadev, Yahoo [Bot] and 13 guests