How do I import a Georgian font into AGS 4?

Started by Tarnos12, Fri 21/02/2025 07:12:55

Previous topic - Next topic

Tarnos12

Hello,

I am trying to import a Georgian font which from what I've read is "Cyrrilic" font that should be supported by ttf(256 max characters)
But when I import any of the fonts I found so far, they are not usable(sometimes some of the characters look good, but most of them are squares or some other weird characters)

This is the font I tried just now:
https://fonts.google.com/selection?query=Georgian&lang=ka_Geor&script=Geor

Those are the results:(from some of the fonts)
https://gyazo.com/6c5928a68b4bda4d0b56e4edb66a5d20

The game by default is set to use UTF-8 for Text.

What am I missing and how can I import the font properly?

This is meant to be used with in game translation where I can change the game language from English to Georgian.
But if it's necessary I am fine with making a separate build for each language.

Thanks!
Game Developer - AGS/Unity and more
Hire me at: https://www.fiverr.com/tarnos
Portfolio: https://tarnos.carrd.co/

Crimson Wizard

#1
With the Unicode support there's no difference what the translation language is, the rules for fonts is all the same. The Font's layout and game/translation text format should match each other. Following things matter:

1. Is the Font unicode-compatible, and not, for example, ANSI-125x.
2. What is your translation's encoding: how TRS file is saved, and what is set as Encoding option in TRS.
3. How do you assign these fonts in case of language change. Do you use translation settings, or script this (and how)?
https://adventuregamestudio.github.io/ags-manual/Translations.html#additional-options

Checking the font preview is useless currently, as it only displays first 256 characters, but in Unicode fonts the letters may occupy slot indexes of 1000+.
Do you check results by font preview only, or by testing the game too?
Please give links to actual fonts that you used, I don't want to check any random fonts on that page and guess which did not work for you.

EDIT: btw, I don't think that Georgian language uses Cyrillic letters.


Crimson Wizard

Quote from: Khris on Fri 21/02/2025 10:58:29For reference, here's the font: https://fonts.google.com/noto/specimen/Noto+Sans+Georgian

Well, I quickly tried this, and it works, if I translate few lines and assign font for translation properly.

Tarnos12

#4
Quote from: Crimson Wizard on Fri 21/02/2025 07:24:02With the Unicode support there's no difference what the translation language is, the rules for fonts is all the same. The Font's layout and game/translation text format should match each other. Following things matter:

1. Is the Font unicode-compatible, and not, for example, ANSI-125x.
2. What is your translation's encoding: how TRS file is saved, and what is set as Encoding option in TRS.
3. How do you assign these fonts in case of language change. Do you use translation settings, or script this (and how)?
https://adventuregamestudio.github.io/ags-manual/Translations.html#additional-options

Checking the font preview is useless currently, as it only displays first 256 characters, but in Unicode fonts the letters may occupy slot indexes of 1000+.
Do you check results by font preview only, or by testing the game too?
Please give links to actual fonts that you used, I don't want to check any random fonts on that page and guess which did not work for you.

EDIT: btw, I don't think that Georgian language uses Cyrillic letters.

I will try again! I mostly used preview(but not only) so this might be the issue :D

EDIT: That actually worked!, I just need to figure out how to change font for the GUI, but I assume that's done manually with a loop?
Game Developer - AGS/Unity and more
Hire me at: https://www.fiverr.com/tarnos
Portfolio: https://tarnos.carrd.co/

Crimson Wizard

Quote from: Tarnos12 on Fri 21/02/2025 22:42:20EDIT: That actually worked!, I just need to figure out how to change font for the GUI, but I assume that's done manually with a loop?

There's a typical script snippet that does this:
Code: ags

int ReplaceTranslatedFont(int old_font)
{
    // switch depending on the original font here
    // and return a new font depending on current translation
}

function ReplaceGUIFonts()
{
    for (int i = 0; i < Game.GUICount; i++)
    {
        GUI* g = gui[i];
        for (int j = 0; j < g.ControlCount; j++)
        {
            GUIControl* c = g.Controls[j];
            Button* btn = c.AsButton;
            Label* lbl = c.AsLabel;
            ListBox* lbox = c.AsListBox;
            TextBox* tbox = c.AsTextBox;
            if (btn != null)
                btn.Font = ReplaceTranslatedFont(btn.Font);
            else if (lbl != null)
                lbl.Font = ReplaceTranslatedFont(lbl.Font);
            else if (lbox != null)
                lbox.Font = ReplaceTranslatedFont(lbox.Font);
            else if (tbox != null)
                tbox.Font = ReplaceTranslatedFont(tbox.Font);
        }
    }
}

Tarnos12

That looks good, similar to what I did but better :D

Btw, is there a requirement to see the font properly on a built game on Windows?

Someone else is trying the game and they can't see GUI font, but speech font works fine.
But when I test it, everything works.
Game Developer - AGS/Unity and more
Hire me at: https://www.fiverr.com/tarnos
Portfolio: https://tarnos.carrd.co/

Crimson Wizard

Quote from: Tarnos12 on Sun 23/02/2025 01:08:23Btw, is there a requirement to see the font properly on a built game on Windows?

Someone else is trying the game and they can't see GUI font, but speech font works fine.
But when I test it, everything works.

Please give more details.
How are the fonts imported.
How is GUI font set.
How do you run the game, which config settings do you use.
How do they run the game, which config settings do they use.
Double check that you test same compiled version of the game.

Tarnos12

Quote from: Crimson Wizard on Sun 23/02/2025 06:34:29
Quote from: Tarnos12 on Sun 23/02/2025 01:08:23Btw, is there a requirement to see the font properly on a built game on Windows?

Someone else is trying the game and they can't see GUI font, but speech font works fine.
But when I test it, everything works.

Please give more details.
How are the fonts imported.
How is GUI font set.
How do you run the game, which config settings do you use.
How do they run the game, which config settings do they use.
Double check that you test same compiled version of the game.

Not sure what are the options on importing fonts.
We just use the link above with TTF font.
I just right click and import the font then right click again to create a font.
Then changed it's size multiplier and used auto outline.

GUI font is changed with this:
Code: ags
function Button3_OnClick(GUIControl *control, MouseButton button)
{
    Game.ChangeTranslation("Georgian");
    for(int i = 0; i < Game.GUICount; i++)
    {
        GUI*guiTest = gui[i];
        
        for(int j = 0; j < guiTest.ControlCount; j++)
        {
            Button *button = guiTest.Controls[j].AsButton;
            Label *label = guiTest.Controls[j].AsLabel;
            if(button != null) button.Font = eFontFont3;
            if(label != null) label.Font = eFontFont3;
        }
    }
}

Config settings are default, the game is run with game.exe(not the setup.exe)
I am not sure which config settings could be changed and where.
Game Developer - AGS/Unity and more
Hire me at: https://www.fiverr.com/tarnos
Portfolio: https://tarnos.carrd.co/

Crimson Wizard

#9
@Tarnos12 I don't see any reason why would anything work differently for other people with this script.

QuoteI am not sure which config settings could be changed and where.

I meant translation choice, for example. But if you have new translation set on a button press in game, then this is less important.

Tarnos12

Quote from: Crimson Wizard on Mon 24/02/2025 10:01:54@Tarnos12 I don't see any reason why would anything work differently for other people with this script.

QuoteI am not sure which config settings could be changed and where.

I meant translation choice, for example. But if you have new translation set on a button press in game, then this is less important.

Yes it's on a button press, because I don't know how I can automate GUI translation without a script.
if there is a way to do that then I'd rather have 2 separate builds/translation in game config.
Game Developer - AGS/Unity and more
Hire me at: https://www.fiverr.com/tarnos
Portfolio: https://tarnos.carrd.co/

Crimson Wizard

Quote from: Tarnos12 on Mon 24/02/2025 10:23:28Yes it's on a button press, because I don't know how I can automate GUI translation without a script.

You can detect game translation in game_start, and change fonts there.

I don't understand what do you mean with "2 separate builds" though.

Tarnos12

Quote from: Crimson Wizard on Mon 24/02/2025 10:46:45
Quote from: Tarnos12 on Mon 24/02/2025 10:23:28Yes it's on a button press, because I don't know how I can automate GUI translation without a script.

You can detect game translation in game_start, and change fonts there.

I don't understand what do you mean with "2 separate builds" though.

Ah that was the idea to manually change translation of GUI and make it's own build.
That was a last resort if nothing else worked(not that it would make a difference after I did some work on that)

I will look into detecting the game translation then and see if that works.
No idea why the other person couldn't see GUI translation, afaik it doesn't require installing any fonts on the system.
Game Developer - AGS/Unity and more
Hire me at: https://www.fiverr.com/tarnos
Portfolio: https://tarnos.carrd.co/

SMF spam blocked by CleanTalk