[Solved] How do I embed fonts in Android?

Using a custom font which renders fine in the preview but once I compile to an Android app, the font’s isn’t there.

Without more details, it might be difficult to help you. I use actually 3 differents custom fonts in my project swamp, and i don’t have any problem on the android builds.

Try maybe to make a second project with a custom font and try the android export to see if the same thing happens.

I dont think it could be font related but who knows… Can you send the font (or font link), then i’ll test it on my own.

Oh right the details :grinning:

I added a bbtext… The custom text widget thing. And I picked a font that I have locally installed on my system. Renders fine in preview… Which is not surprising.

But it doesn’t seem to be auto importing into the project. When I go to resources, the font is not there. So I guess the real question is how do I add a custom font to the project?

Update: this looks like either I’m not adding the font correctly or it’s a bug. As per the Resources page, “Resources are automatically added to your project whenever you add an image, a font… to an object.”

Update2: looks like a bug in the BBText. Steps to repo:

  1. Add a font to a Text widget. Notice that the font is added to the Resources
  2. Add a BBText widget. Use the font from #1.
  3. Build the Android APK.
  4. Notice how the Text widget uses the font but not the BBText

Ok, it seems it’s related to BBText objects.

BUT, i’ve just created a new project to try to reproduce your issue and i can’t : my two objects are displaying the right custom font… No issue with BBText for me with android build.
What is your android version ? I tested on android 6.0.

Did you tried to use another font ?

How do you change the font ? In the parameter of the object ? Or in the events ?

Also FYI, BBText font is not custom until recently, in beta89. While I haven’t tested it, can you try updating your gdevelop editor and trying again?

Alternatively, the regular Text object reliably embeds font in the exported project, so if you don’t need BBText features you can try that.

Upgraded yesterday to v 5.0.0-beta89 and noticed in the README that it has improved fonts in BBText. And sure enough using the latest version did the trick.

BBText now imports custom fonts properly!

3 Likes