Why does the text size change when testing game?

Hello,

I am a gdevelop beginner,
I am working on some very basic point-and-click user interface. I started to lay out the design or the title screen just to get myself familiar with making basic buttons work, but I’ve already run into a problem.
The problem I am having is the text size changes from what I am seeing on my workspace to when I test the game.
Note only the text on the button is shrunk, the text on the title is part of the PNG image so it stays the same size.

See below for screenshots:


I tried to reproduce that outcome, but I wasn’t able to and it works just fine. Maybe you could just add the text to the image itself, though it removes the dynamic aspect of it; but for sure you will be able to manage it properly and even if the image gets resized you won’t be having a hard time to change it since its on the image itself.

In case you are using a custom font, my guess would be that in the preview the font isn’t loaded.
The problem is that GDevelop does not preload fonts at the moment so in case you want to use a custom font in the very first scene, it won’t be loaded by the time the text is rendered on the screen. So what you need to do is preload the font by displaying a text in the very first scene, it doesn’t need to do anything just have a text object using the custom font in the first scene when the game starts and just move on to the menu scene straight away. This way you can force GDevelop to preload the font before rendering the text in the menu.

Take a look at the custom font example bundled with GDevelop:
editor.gdevelop-app.com/?projec … ustom-font

Note that, if you open the above example in Firefox, the text object may be not visible in the editor due to a problem with the online editor and firefox, so make sure you open the example in Chrome or use the desktop version of GD.

Thanks so much for your help. Yes this is a custom font and I suspected that was somehow part of the problem too.

OK, this will sound stupid, but I’ve tried adding a new scene, however I can’t add any scenes BEFORE the current scene. I can only add scenes after the scene and there’s no way to drag the scenes across each other to rearrange them like you can with layers. I guess I could put a line of code in to make the blank scene load first but surely there must be a simple way to choose which order my scenes are in?

To move a scene, right-click on it in the left panel and choose move up or move down.

Yes I see that that’s how its supposed to work… but here are the only options I get when right clicking on a scene:
Edit Rename Delete Cut Copy

I feel like my Gdevelop UI is different from the tutorials I find online. They are saying to do stuff that just doesn’t appear on my screen even when I click the exact same spots that I’m supposed to…

The latest version does have the move up and down options now. You can download it from here:
github.com/4ian/GDevelop/releases

Always make sure to create a backup of your project before opening it with a new version just in case something goes wrong…

Great thanks. The button now works. However when I load the game in debugger, although both scenes load in the correct order, the second scene with the text still displays small.
Are there any other possible reasons as to why this might be?

I can’t think of anything else.
Someone else had a similar problem when running the game on different resolutions, it is a known problem with the way Pixi.js render text and the solution was to resize the text by taking in to account the resolution but I don’t think it is the problem here, the only time I experienced this problem in preview if the custom font didn’t load as it does effect the size of the text.

I don’t know what else could be :confused:
Are you certain the font is loaded in the preview?
Try a different font that looks totally different. Maybe the one from the example I linked.

It shrinks even when I use the font arial or times new roman.

I created a first scene before the title scene, just a blank scene with a text object with the font “text” in it. Whether I change both of the fonts to the custom font, or change them both to arial font, the text always shrinks significantly (both in the loading scene and on the title scene). Basically all of my text shrinks any time I preview a scene or preview the whole game in debug mode.

So frustrating! Lol

I even tried putting a scene event saying “change size of text to 80” and regardless of what text size I put in, the text remains tiny

The only way I can reproduce your problem if the font does not exist but then it is also doesn’t load in the editor. Not sure what is happening there but I’m pretty sure it is something with the font. Try a font from
fonts.google.com/
All fonts are free.
Make sure in the first scene you have a text object added to the scene that is using the font and move on to the menu scene from there. It must work.

Thanks for the advice.

Just to update, I have done more troubleshooting since my last message.
The problem is isolated to any time I specify any kind of font to be displayed under a text object. It doesn’t matter whether I use the custom font, or whether I specify a common font like “arial” or “cambria”. Once I tell it to be any kind of font, the sizing bug becomes active. If I don’t tell it what font to be, it displays the default font, and everything works perfectly fine.
I tried asking the discord group as well and one of the mods is trying to help, but they also aren’t sure what’s going on.

If anybody has any other thoughts, I would love to hear it!

Does the custom font example works for you?
If the example works, could you share your project so we could try?
If not even the example works for you, then it must be a bug somewhere that cause not to load custom fonts on certain systems or permission in the system.

Thanks for your response.

The custom font example does not work. Under no circumstance, as long as I specify a font in the “font” section of the text object property window, will a font be displayed in a size other than the tiny size I showed in the screen captures.

If I create a new project, create a text object, and put the properties of the object to “font: arial” or “font: (any font)”, the font will display at the correct size on my developer screen.

If I test the scene using debugger, firefox, or google chrome (same for all of them), the font will display tiny once the scene has been rendered.

If I do the thing where I put a scene first with the same font, and then go to a second scene with the same font (as instructed to in the “example”), I have the same problem and the text displays tiny once it is rendered.

If I do NOT specify any font, ie I leave the “font” field blank in the text object’s properties, the size that I select will display correctly in the scene once it is tested.

Basically, the only way I can have ANY text load at a font size other than the tiny font size, is to leave the “font” field blank and let GDevelop use its default font. Then everything works the way it is supposed to.

I realize that this is a unique problem and other people aren’t having the same problem. I am happy to share my project… what is the best way to do that?

You can upload your project directly to the forum or to cloud storage like Google Drive and share a link here or in pm.
But most likely all I can do is to confirm it works for me as the example does.

The only thing I can recommend is to make sure you and GDevelop do have read and write permission on the system you are using and in case you are on Windows make sure your AV did not put GDevelop in to a quarantine or sandbox or any isolated, virtual environment.

If you are certain you and GD has the right permissions and there is no conflict with you AV and not even the example works for you then probably the best to report it as a bug here:
github.com/4ian/GDevelop/issues