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
smallFont=TTFont.new({"retro.ttf","cyrillic.ttf"},33,chrs,3) |
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:
TTFont.new({"retro.ttf","cyrillic.ttf"},size,chrs,smotthing)
or
TTFont.new({{name="retro.ttf",sizeMult=1.0},{name="cyrillic.ttf",sizeMult=1.2}},size,chrs,smoothing)
This makes things 100x easier when dealing with translations and multiple fonts.
Thanks to
@hgy29 for implementing this amazing idea (mine!
)
Comments
Likes: SinisterSoft, MoKaLux
Try this:
https://deluxepixel.com
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!