Forums

OverviewV-Play 1 SupportCustom fonts on Android › Reply To: Custom fonts on Android

OverviewV-Play 1 SupportCustom fonts on Android › Reply To: Custom fonts on Android
#4505

Saims

Hi,

I didn’t want to open a new thread, cause I have the same issue, but the fix doesn’t work for me, so I post it here.

My fontloader in the main.qml looks like this:

FontLoader {
        id: fontloaderfont
        source: "fonts/galascript.ttf"

        Component.onCompleted: {
            if(system.platform === System.Android){
                name = "Galascript Sans"
            }
        }
    }

and I use the fontload e.g. like this:

Text {
    id: text
    font.pixelSize: 10
    color: "white"
    font.family: fontloaderfont.name
}

 

The code works perfectly fine on the PC, whereas on Android the default-font is used.
Unfortunately I couldn’t test it on iOS, but there the previously used font worked in general, but some text wasn’t displayed (e.g. “Package 1” was “Package “, “Restart” was “Restar “)

I also tried to remove the onComplete again in the FontLoader, but after doing that, the app wouldn’t even start on Android!

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support