Weird (TEXT) problem on (android). is it a bug in gdevelop5?

So today i tested my game on a device and all the text objects are ( out of place - bigger )
so i made the event :-
At the beginning of the scene > Do = 30 to the size of the text (whatever)
But didn’t work .
The weird thing here is that the text looks in place with the right size in another device …
so how is the text changing in different devices … I need it to be equal for all and look the same .

So how can you do that?

Did you try with custom font or you are using the default font of the text object? My guess would be that it is caused by the font. At least normally this is the cause.
Try a custom font from here

Download one, copy to the project directory and enter it name in the font place and it is going to use the same font on all devices which should solve the problem I guess.
Same font => Same size => Same position

I use the one within Gdevelop 5 … I think this might be it … i will try to download a font and i will let you know if it worked or not … thank you a lot for your help .

I’m sorry but the font isn’t in the program … i downloaded it and put it where the project is but when i write the name of it in the font place it’s not there . what now ?

It is not going to be shown because GDevelop IDE does not add the font automatically to the resources and at the moment there is no way to add it manually. Just enter the name and it should work in the IDE at least.

In preview and exported game it may not going work though because GDevelop does not preload the font before launching the game or the preview and at the time you display a text, the font may be not loaded yet. To work around this, add an empty scene as the first scene and display a text there using the font and do nothing but move on to the next scene immediately, the user doesn’t even need to see this screen. It is to preload the font only. Ideally, we should be able to add resources to GD manually to work around this, but at the moment it is not possible.

I have just uploaded an example, take a look (on the bottom):

I fixed it . fonts are loading just perfectly . what i did wrong is that i didn’t put (.TTF) at the end of the font’s name .
Yeah i feel dump now but it’s OK … it’s a part of learning .

Alright so in a couple of days i will try it on the device i was taking about that it was changing the font’s (size . place . etc) and i will let you know if it works or not .

ddabrahim didn’t work after testing the mobile again … the font is bigger and out of place … what should i do now ?
Take a look at the pictures you’ll get what i mean .

The text size can be also effected by screen resolution which might be the problem on your side too if the resolution is different.
What you can try is change the text size manually according to the resolution of the device.
For example, when you change the size of the text using event just enter
Size = 20 / atan2(SceneWindowHeight(),SceneWindowWidth())

ddabrahim just wrote that event …
And test it again on my device and the text place is a little off now
Then on the other device it’s still the same … way off it’s original place

I don’t know what’s going on really with that ?
I hope you got another solution for this .

I think it a bug with Pixi.js that is used for rendering in GDevelop.
Pixi.js is not very good at scaling sprites and text on different resolutions. There are solution though but it does require JavaScript.
One thing you can try if it only a little off, to make sure the text is positioned on an integer value like 100,100 and not on a float value like 100.5 because then the rendered is trying to compensate and the result is stretched text and sprite.
Would be nice to have a comment on this from someone who digging the source of GDevelop and Pixi.js but unfortunately most of those people are not reading the forum :laughing:

Maybe your best option for now is to deal with it, make the text size big enough to work however it rendered on the screen and hopefully it will be fixed in the future or a have a comment on this from a dev :frowning:

You can also try to export with Cocos2D, but keep that in mind, Cocos2D is experimental it may going to cause more problems than it solve but it may just going to fix your problem with the text.

Ok what is the solution ? i have notepad ++ and i think i can fix it … but if i know what is the code and where to put it .

The thing is the game has a score … and it’s so important … but if it’s changing in size like that … maybe when someone try it out on their device the text might be even bigger than what you saw … it will a game breaking thing …
please if you know the code and how to do it . i would be so grateful .

I wish i could deal with it but it’s not possible this time :frowning: