Polish characters

Started by Marcin K., Mon 16/09/2019 12:35:05

Previous topic - Next topic

Marcin K.

(This is my first cry for help here and sorry if the question is lame but I really read everything I could find here and still understand nothing. I'm learning AGS and so far had no bigger problems but this is something I stuck with.)

I import TTF with Polish characters but AGS doesn't see them. Could someone direct me to some step-by-step idiot-proof solution?

Crimson Wizard

Hello. Similar question is asked every now and then on forums. Here's the most recent thread I found: https://www.adventuregamestudio.co.uk/forums/index.php?topic=55838.0

Marcin K.

"letters".... I always search for "fonts" and "characters". Anyway: with a little help of someone who's better in technical English I finaly got the core of this problem, started to edit the font and have another problem. I can't locate ANSI "substitutes" of 4 characters. Instead of other Polish letters the some characters are displayed but for these 4 only some rectangles. Any idea how to locate the right ones?


cat

I did an experiment which had an unexpected outcome:

I used the newest AGS Beta7, created a new game with BASS template and replaced all the fonts with this font.
Then I changed the overhotspot text of the glowing orb to "ZaŠ¼óŠ‚Ã,,‡ gÃ,,â,,¢slÃ,,… jaŠºŠ„ ZAŠ»à“ŠÃ,,† GÃ,,˜ŠšLÃ,,„ JAŠ¹ŠÆ'" and added a player.Say with the same text to the orb interaction.

Now, the interesting thing is, for the player.Say, the text is displayed correctly, but the overhotspot text is complete garbage. So, I assume, this is not because of the font, but an AGS issue?

Crimson Wizard

Quote from: cat on Fri 27/09/2019 20:18:28
I used the newest AGS Beta7, created a new game with BASS template and replaced all the fonts with this font.
Then I changed the overhotspot text of the glowing orb to "ZaŠ¼óŠ‚Ã,,‡ gÃ,,â,,¢slÃ,,… jaŠºŠ„ ZAŠ»à“ŠÃ,,† GÃ,,˜ŠšLÃ,,„ JAŠ¹ŠÆ'" and added a player.Say with the same text to the orb interaction.

Now, the interesting thing is, for the player.Say, the text is displayed correctly, but the overhotspot text is complete garbage. So, I assume, this is not because of the font, but an AGS issue?

May I see the game please?

Marcin K.

Quote from: cat on Fri 27/09/2019 20:18:28
I did an experiment which had an unexpected outcome:

I used the newest AGS Beta7, created a new game with BASS template and replaced all the fonts with this font.
Then I changed the overhotspot text of the glowing orb to "ZaŠ¼óŠ‚Ã,,‡ gÃ,,â,,¢slÃ,,… jaŠºŠ„ ZAŠ»à“ŠÃ,,† GÃ,,˜ŠšLÃ,,„ JAŠ¹ŠÆ'" and added a player.Say with the same text to the orb interaction.

Now, the interesting thing is, for the player.Say, the text is displayed correctly, but the overhotspot text is complete garbage. So, I assume, this is not because of the font, but an AGS issue?

Now I'm even more puzzled.

Crimson Wizard

#6
AGS saves everything in ANSI. If you typed polish characters in the editor as unicode text, they are supposed to be converted to ANSI according to the current system locale. If system locale is not "Polish" these letters may become garbage.

The difference may depend on how different fields in the editor are keeping the text, how did you type or paste it in, and so forth.

These are suggestions on what may happen, but I cannot tell more without seeing the actual game (project or compiled) or knowing more details.

Marcin K.

#7
Quote from: Crimson Wizard on Sat 28/09/2019 10:01:17
AGS saves everything in ANSI. If you typed polish characters in the editor as unicode text, they are supposed to be converted to ANSI according to the current system locale. If system locale is not "Polish" these letters may become garbage.

The difference may depend on how different fields in the editor are keeping the text, how did you type or paste it in, and so forth.

These are suggestions on what may happen, but I cannot tell more without seeing the actual game (project or compiled) or knowing more details.

The fun part is that I have Polish system and Cat doesn't yet she does have (at least some of) the Polish characters and I don't. I could really live with this ANSI stuff and editing fonts if I'd only knew how to add those remaining letters (Š¹,Šº,Šš,Š›). My plan B is to copy them to some different character codes that I don't use anyway and simply write all Polish texts "wrong".

cat

#8
Sorry, I forgot to upload the test game.

Download

Marcin is right, my system is not Polish but English (UK) with German keyboard.
I copy/pasted the Polish text into the code editor for the player.Say() and into the description field in the properties of the hotspot.


Edit: Now that I recheck - the text in the property grid itself has changed to gibberish as well! But this didn't happen immediately, only after closing an reopening the editor.

Crimson Wizard

#9
Quote from: Marcin K. on Sat 28/09/2019 11:14:06
The fun part is that I have Polish system and Cat doesn't yet she does have (at least some of) the Polish characters and I don't. I could really live with this ANSI stuff and editing fonts if I'd only knew how to add those remaining letters (Š¹,Šº,Šš,Š›).

Could you clarify, you first say that you don't have Polish characters, and then about "remaining letters". So, you were able to make at least some letters work, or not at all?

I still was not sure what the remaining issue you have with your font, because I see these letters on your fontforge screenshot...

The point here is to make sure that  1) letter codes you have in the text match 2) same letter codes in the font, and both match ANSI codepage meant for Polish text (CP 1250).
ANSI codes are restricted to 0-255.

1) is solved by saving the text in ANSI encoding while you have Polish as a system locale (the actual setting is called something like "System locale for non-unicode programs" in Windows. There are numerous intrsuctions in the internet about this, for example: https://www.digitalcitizen.life/changing-display-language-used-non-unicode-programs
You do not have to have "Polish" computer for this :), you may as well install this locale on any system, and switch temporarily while you are working on Polish translation, then switch back to yours.

2) is solved by getting ANSI-compatible Polish font, or making one yourself. Latter could be done by copying letters into proper slots in a font editing program (just you tried above). These slots should correspond to the ANSI codepage table here: https://en.wikipedia.org/wiki/Windows-1250#Character_set

Searching the table, letter 'Š¹' must be in slot 179, and so on. So the remaining task is now in finding same letter in the original font for copy (or drawing yourself if you're desperate...)


I will check the cat's game now, because I am also curious how that worked.



cat

To clarify:
For player.Say I see ALL Polish characters, for overhotspot I see NONE of the special characters, only the regular ASCII ones.

Crimson Wizard

#11
Cat, what locale do you have on your computer? When I opened your project the player.Say line has turned into: "ZazÃ'Æ'lc gesla jazn ZAZУLC GESLA JAZN".

If you have like German (or Austrian? idk how this works) locale, that could maybe explain how this may have worked, because that locale may have some letters synced with Polish one.

Regarding hotspot's description, that may be AGS does not save it same way as scripts, converting using system locale. Maybe it converts to some universal locale instead, or even ASCII, I will check out if I find time.

cat

#12
Quote from: Crimson Wizard on Sat 28/09/2019 20:35:15
Cat, what locale do you have on your computer? When I opened your project the player.Say line has turned into: "ZazÃ'Æ'lc gesla jazn ZAZУLC GESLA JAZN".

If you have like German (or Austrian? idk how this works) locale, that could maybe explain how this may have worked, because that locale may have some letters synced with Polish one.

Regarding hotspot's description, that may be AGS does not save it same way as scripts, converting using system locale. Maybe it converts to some universal locale instead, or even ASCII, I will check out if I find time.

Not sure what locale means. My Windows 10 display language is English (UK) and I use the German keyboard and date formatting settings. None of the German and Polish special characters have anything in common.

Now that you mention it - my player.Say line has changed as well! I didn't notice because I thought those ticks and marks on the characters didn't show because they were lost when converting the font to pixel, but actually the text was changed!

No matter what characters the font is able to display, the source code definitely shouldn't be changed.
So, at the moment, it looks like both mess up: the code editor and the property grid, but each in their own weird way.


When I create games, I write it all in English and only do the German translation later via translation files. Might be worth checking if this is a viable solution?

Crimson Wizard

#13
I keep saying this, the Editor saves everything in ANSI, according to current locale. This means that script will also be changed if you had it in one locale first and then opened project in another. This problem  can be solved by changing AGS in one of two ways:

1) add project setting that determines which locale to save project files in, to keep things consistent and not rely on current system locale. (In this case all editor fields and script editor must input text in unicode probably)
2) upgrade AGS to support unicode.


In any case, like I've been saying before, the only reliable way to write Polish text in AGS at the moment is to have Polish system locale set. Any other actions will lead to weird stuff happening. I guess it all can be explained from technical perspective, but frankly do not see the reason to spend time on researching this, because it won't solve the problem anyway.

Marcin K.

Quote from: Crimson Wizard on Sat 28/09/2019 21:00:36
1) add project setting that determines which locale to save project files in, to keep things consistent and not rely on current system locale. (In this case all editor fields and script editor must input text in unicode probably)

I'll try to find someone who will translate this to human language for me.

Crimson Wizard

#15
Quote from: Marcin K. on Sat 28/09/2019 21:10:24
Quote from: Crimson Wizard on Sat 28/09/2019 21:00:36
1) add project setting that determines which locale to save project files in, to keep things consistent and not rely on current system locale. (In this case all editor fields and script editor must input text in unicode probably)

I'll try to find someone who will translate this to human language for me.

I was speaking of a new feature that could be added to AGS, but that is not something a user could do! (not without changing program code, that is)

This thread has too much confusion and misunderstanding.

I gave the general way to make polish text work in a comment above: https://www.adventuregamestudio.co.uk/forums/index.php?topic=57465.msg636611202#msg636611202

cat

Seems I cannot help here. Sorry that I caused even more confusion.

Crimson Wizard

@cat, I checked the font in your game, it seems to be actually Unicode code, not ANSI font suitable for Polish translation in AGS.

The ANSI font should have all necessary characters within 0-255 numbers, but your font has some letters outside of that range.

Crimson Wizard

Until AGS won't support Unicode properly, I think this site would benefit from example fonts made for each ANSI codepage: Cyrillic, Polish, and so on. It seems like every person who gets in this situation begins making their own. Idk if there are any resources available in the internet...

Crimson Wizard

#19
Here's the FontForge project and a font with Polish letters on correct places: https://www.dropbox.com/s/a1itoycblwaceln/test-polish-fonts.zip?dl=0
Note that I could miss few letters, for example "Ã,,†" character. But it's just a matter of finding them in unicode slots and copying into ANSI ones.
I was using the previously mentioned chart to copy letters into ANSI slots: https://en.wikipedia.org/wiki/Windows-1250#Character_set

Here's the demo game:
https://www.dropbox.com/s/0vzztpvx5548cug/test-polish.zip?dl=0

You will see Polish text when you "Look at" main character.

Note again that I had to change my system locale to Polish in order to keep and correctly save Polish text in script.

SMF spam blocked by CleanTalk