Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Multi-font fonts ! - Gideros Forum

Multi-font fonts !

SinisterSoftSinisterSoft Maintainer
edited September 2017 in Code snippets
When programming a game you need to pick the right font that matches your game, now 99% this is great if all you need is text in your own language. But a problem arises when you need to translate your game into multiple languages - the characters tend to be missing from the font you picked.

So the dilemma is you either have to change the font in your game to a different font that supports a larger variety of characters, or you have to have multiple fonts and load a particular font depending on the language.

Gideros (2017.9+) now has a better solution - Multi-font fonts!

Here is an example:
local chrs=" !$%&'()*,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]_`abcdefghijklmnopqrstuvwxyz£ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ¥¢¿¡«»ČčĎďĚěıŇňŒœŘřŠšŤťŮůŸŽž"..'"'
chrs=chrs.."ъяшертыуиопющэасдфгчйкльжзхцвбнм"  -- some extra Cyrillic characters not present in my normal font
What will happen is that if the character exists in the first font then it will be used, else the 2nd font will be used and so on.

Attached is a screenshot of what this looks like.

This is the syntax:




This makes things 100x easier when dealing with translations and multiple fonts.

Thanks to @hgy29 for implementing this amazing idea (mine! ;) )
+1 -1 (+8 / -0 ) Share on Facebook


  • Very cool!!

    Likes: SinisterSoft

    +1 -1 (+1 / -0 ) Share on Facebook
  • After this, I am getting invalid font size error randomly. Do you have any idea? @Sinistersoft
  • SinisterSoftSinisterSoft Maintainer
    edited October 2017
    When you create the font?

    Try this:
    Notice the "" rather than 'chrs'. That will create characters as and when they are needed, plus it will use multiple textures if the fonts don't fit within the single texture. It's still fast as the texture information is cached.
Sign In or Register to comment.