Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: DBoyWheeler on Wed 18/07/2018 13:42:20

Title: My font... it's acting weird.
Post by: DBoyWheeler on Wed 18/07/2018 13:42:20
(I'm sure this is an advanced issue, but I won't object if this needs to be moved to "Beginner" stuff.)

Okay, I've been making up a custom font for a game project, as some of the characters have Norwegian names, and thus needing special characters.

So, I went to Calligraphr to make up special fonts.  I'd add them here if there were an option to.

But, instead of showing the special characters, like that ae diphthong, it just shows a box.

How do I get AGS to recognize special characters in a font?
Title: Re: My font... it's acting weird.
Post by: Crimson Wizard on Wed 18/07/2018 13:51:24
AGS is strictly ANSI program, which means that you can only use slots 0-255 in font. All other letters will be ignored.

If your game is primarily not in Norwegian language, but you simply want to use special letters in limited case, then the best solution IMHO is to choose some slots that are not used in your main font and put these letters there. Of course you will have to type these letters using original letters in your script.

If typing by hand is difficult (e.g. you position the letter in slot 255 and do not know what letter in your system locale's corresponds to it), you may try setting these letters programmatically using String.ReplaceCharAt(index, number_of_slot), or String.Format("Regular text and then special letter: %c", number_of_slot);
Title: Re: My font... it's acting weird.
Post by: Snarky on Wed 18/07/2018 14:05:19
The Norwegian letters are included in the most common ANSI codepages (which means: they're among the 256 characters that can be used in old-school strings). For example, in Windows-1252 (https://en.wikipedia.org/wiki/Windows-1252), you have:

Æ=198, æ=230, Ø=216, ø=248, Š=197, å=229

I would recommend starting with a TTF font that has the characters, testing that that works in AGS, and using the same slots for the characters in your own font. That way it should just work, I think.
Title: Re: My font... it's acting weird.
Post by: Cassiebsg on Wed 18/07/2018 16:24:36
Also, at least in Danish, you can replace the special letters with normal letters.
As in Æ = AE, Ø = OE and Š = AA ... But not sure Norwegian uses these exact matches... you might want to investigate that if you wish to save your self some trouble with special characters. The special characters are actually "new/modern" letters.
Title: Re: My font... it's acting weird.
Post by: DBoyWheeler on Wed 18/07/2018 17:17:08
Right.  I guess I'll have to see what substitutions I can make.  Thanks.
Title: Re: My font... it's acting weird.
Post by: Monsieur OUXX on Wed 25/07/2018 08:22:14
Reposting this : http://www.adventuregamestudio.co.uk/wiki/Fonts
The advice provided in previous posts is the right advice :
1) find a font (potentially TTF) that has all the characters (you can filter fonts on that criteria on free fonts sites).
2) convert it to bitmap, using any of the tools in the article. Keep only the relevant 256 characters and put them in the right slots, matching Windows-1252.
3) Import it into AGS, still using any of the methods from the article.