Truetype font not working

Started by AnasAbdin, Tue 27/03/2018 17:03:42

Previous topic - Next topic

AnasAbdin

Hi all,

I'm toying with translations now and I managed to get a true type font with accented letters and all, I imported the TTF to the engine and all the characters appeared at the "Selected font settings" tab.

However, in the editor, any special letter appears as a question mark ( ? ). I thought it was an editor thing, and that when the game is running it won't be like this. But I was wrong.

Note that when I label a button in the properties grid on the right side of a GUI, I can see the special letter (not in the GUI, just the properties grid).

Welp!

AGS Build 3.4.1.12
v3.4.1, January 2018
res 640*400*32

Crimson Wizard

#1
Ok, this was answered like 100 times on forums.
First of all, please make sure you read the wiki page about font limitations in AGS: http://www.adventuregamestudio.co.uk/wiki/Fonts

To sum up again -

AGS engine is a ANSI program, it does not support Unicode. This means that only first 256 slots in the font are used.
All the letters that you are going to use in the game must fit into the first 256 slots, no exceptions.

Usual TTF fonts are Unicode fonts, and the extended letters are usually occupying higher slots, like 500-something and higher.
You need special ANSI-compatible fonts.

How to find what kind of font you need. If you know the language, search for "*Language name* ANSI codepage" to find the number of code page associated with that language. You would need a font compatible with that codepage.
You may also refer to this list: https://en.wikipedia.org/wiki/Code_page#Windows_emulation_code_pages
Such fonts may either be found in the web or made by hand with some font editor, for example by copying letters from unicode slots onto corresponding ANSI slots.


At last, but not least, all texts in the editor, as well as TRS files are saved as ANSI. When doing so, they use your current system locale to know how to convert letters you typed in the editor window (fields, script). If you have wrong locale (not matching language) you may as well loose some letters. Ideally translation should be done having matching locale set on your system (even if temporarily).

AnasAbdin

Thanks Crimson Wizard, sorry to bother you for the 101 time :-[
I did perform a search on the forum for the problem. I wasn't lucky to find something.
I also read Monsieur OUXX wiki page before anything. I even got the font from a link from the wiki page (no more than 256 slots).

Anywho, I think I found the problem here thanks to you. I played with the locale settings and got it working. It was weird for me because all my applications support the special characters.
My new concern here, does this mean the special characters won't display if the game is running on a machine that doesn't have the locale settings set properly?

Crimson Wizard

#3
Quote from: AnasAbdin on Wed 28/03/2018 04:53:22
Anywho, I think I found the problem here thanks to you. I played with the locale settings and got it working. It was weird for me because all my applications support the special characters.

Yes, sorry, I had a moment of dumbness and could not clearly understand your problem description, so decided to explain everything from the beginning again.

Yes, all modern applications support special characters, and AGS Editor on its own is a unicode program that supports them, but as I said, when it compiles the game all of unicode support gets lost, and all letters are converted into ANSI. So you have to use these locale tricks.

PS. Guess this this information has to be added to wiki page too.


Quote from: AnasAbdin on Wed 28/03/2018 04:53:22
My new concern here, does this mean the special characters won't display if the game is running on a machine that doesn't have the locale settings set properly?

They will display similarily in game because letters are saved as codes and your font matches these codes. Since the saved text and font in game stays the same, the looks will be the same everywhere.

The problem is usually with the game editing: if you work in a team, and load up a project with text containing extended characters written in different locale, then it may get screwed actually. This is very annoying, and also the reason why it is better to keep all translated (non-english) text in the TRS files so that you don't edit and save it in wrong locale by mistake.

SMF spam blocked by CleanTalk