How to support all characters?

Pfap

Member
To support all human characters that can be rendered with utf-8 do you need to include a font that has all of the characters in order for Gamemaker to render them? I know there are a lot of great free fonts and solutions and lately it seems Google has been trying to make the web more "open", does anybody know of a one size fits all way to be able to render ALL characters? Or do I need to include a font that has any character I want to support? And if so is there a way to do it based off of the users device? Like, what fonts do Apple devices natively support and how can I access them?

Edit:
Having trouble wrapping my head around how to support emojis, as entered from the users device. As in a user types an emoji at the end or beginning of their name, how to display the emoji as it appears on their keyboard. Also, having trouble supporting Japanese, Chinese and Korean languages.
 
Last edited:

pipebkOT

Member
@Pfap game maker fonts are bundled with your game as images so you don't need to worry about font compatibility with the target device, since is not using a font from the target device, instead is using a image font that you bundled with your game

I don't think that there is a font that support all languages characters so you need to have multiple fonts to support some languages

if you want to use japanese, korean and chinese characters you need to download them online, there are tons of webpages where you can download fonts in .ttf format, you need to open the ttf file and install the font in your computer, then go to your project on game maker studio 2 and create a new font resource and assign the font that you installed , so when you compile your game the font is bundle as a image.

you need to have a separate font resource for each language like, japanese_fnt, korean_fnt chinese_fnt (unless you find a font that has all characters )and you switch between which you will use:

Code:
global.language=os_get_language()

switch global.language
{
case "ko":
draw_set_font(korean_fnt)
break;
case "ja":
draw_set_font(japanese_fnt)
break;
case "es":
case "en":
case "pt":
draw_set_font(font1)
break;

there is another way to add a font to your project, by using font_add() but i don't recomend this because it consumes performance of the game because you are adding the font on the fly.


but all of this if it was a normal game, i don't know how it will be if you use virtual keyboards


i never seen a game where you could put emojis, the only games that use emojis use custom bundled and self coded emojis and not unicode

like this: :emojiname:





where the only way the player could put a emoji would that he know the emoji name and manually writing the :emojiname: instead of selecting it from the virtual keyboard
 
Last edited:

Pfap

Member
@Pfap game maker fonts are bundled with your game as images so you don't need to worry about font is compatibility with the target device, since is not using a font from the target device, instead is using a image font that you bundled with your game

I don't think that there is a font that support all languages characters so you need to have multiple fonts to support some languages

if you want to use japanese, korean and chinese characters you need to download them online, there are tons of webpages where you can download fonts in .ttf format, you need to open the ttf file and install the font in your computer, then go to your project on game maker studio 2 and create a new font resource and assign the font that you installed , so when you compile your game the font is bundle as a image.

you need to have a separate font resource for each language like, japanese_fnt, korean_fnt chinese_fnt (unless you find a font that has all characters )and you switch between which you will use:

Code:
global.language=os_get_language()

switch global.language
{
case "ko":
draw_set_font(korean_fnt)
break;
case "ja":
draw_set_font(japanese_fnt)
break;
case "es":
case "en":
case "pt":
draw_set_font(font1)
break;

there is another way to add a font to your project, by using font_add() but i don't recomend this because it consumes performance of the game because you are adding the font on the fly.


but all of this if it was a normal game, i don't know how it will be if you use virtual keyboards


i never seen a game where you could put emojis, the only games that use emojis use custom bundled and self coded emojis and not unicode

like:

:emojiname:



where the only way the player could put a emoji would that he know the emoji name and manually writing the :emojiname: instead of selecting it from the virtual keyboard

So, when you select a font from the resource tree Gamemaker picks from fonts installed on your machine? So, the drop down menu for fonts is populated with fonts installed on your machine? From the picture I uploaded of the select font drop down menu it looks like my machine has Arial, Arial Baltic, Arial Black, Arial CE, etc... Is that correct?





Also, the font_add() section of the manual seems to allude to the behavior I am looking for:
This function can be used to add a font to your game from those fonts that are installed on the system it is running on. You can define the size of the font (in points), as well as whether the font should be bold or italic, and you can also define the range of characters to include (for a full table of available characters and their UTF8 value see Font tables). The function returns an index value that should be stored in a variable as this will be needed in all further codes that refer to this font.

IMPORTANT! This function is not available with the Trial Licence of the product.
So, I guess I am asking is there a way I can find out what fonts the user has installed on their device?
 

Attachments

pipebkOT

Member
the drop down menu for fonts is populated with fonts installed on your machine? From the picture I uploaded of the select font drop down menu it looks like my machine has Arial, Arial Baltic, Arial Black, Arial CE, etc... Is that correct?
yes, the drop down fonts are populated with the fonts that are installed on your machine, once installed the asian fonts in your machine, they will appear in the drop down list of fonts

and in the compiling process the font is converted in a image and bundled into your game package



So, I guess I am asking is there a way I can find out what fonts the user has installed on their device?
its hard to tell since each device has its owns fonts installed, you could google search what fonts has the apple devices installed,

but for android since each phone has its own font installed by the phone maker to customize the android OS, its hard to tell.
 
So, when you select a font from the resource tree Gamemaker picks from fonts installed on your machine? So, the drop down menu for fonts is populated with fonts installed on your machine? From the picture I uploaded of the select font drop down menu it looks like my machine has Arial, Arial Baltic, Arial Black, Arial CE, etc... Is that correct?
Yes, exactly... Well, that's how it works in GMS1.4 anyway.

By the way, your Character Range appears to be set to 32-127 (aka Normal.) You may need to change that. While translating an HTML5 game from English to French: I noticed that letters with tildes weren't displaying properly. I changed the character range to 32-255 (aka ASCII) and that took care my problem. I think 1-255 would display all "web-safe" characters... but I suppose it depends on what font you're using. I don't know if this helps you with your current situation, but I figured I'd give my $0.02 regardless.

:squirrel:
best of luck!
 
Top