GMS 2 Em Dash in Strings (SOLVED)

Fixer90

Member
I want to include em dashes in my strings, and not have them return as the default "▯." For example:
Code:
str = "The quick brown fox — who was very quick indeed — jumped over the lazy dog.";
returns as
Code:
"The quick brown fox ▯ who was very quick indeed ▯ jumped over the lazy dog."
I already tried changing the range of the font to ASCII 32-255.
 

Fixer90

Member
The em-dash is not included in the ASCII character set. You'll have to use Unicode. Its character code is U+2014.
I just tried using chr(2014), and it still returned the "▯" character, despite chr being a function that returns a string from the input Unicode number.
 

TsukaYuriko

🌠
Forum Staff
Moderator
Does the font you're using contain a glyph for this character? If not, the placeholder will be used.

That aside, the 2014 is in hex. That's 8212 in decimal.
 

Fixer90

Member
Does the font you're using contain a glyph for this character? If not, the placeholder will be used.

That aside, the 2014 is in hex. That's 8212 in decimal.
Unicode character codes are in hexadecimal. You should either use chr(8212) or chr(0x2014).
Didn't work for both Arial and Verdana. I'll try other fonts, but could it be out of the range? I'm still kinda new to character codes, Unicode, ASCII, how they relate, etc.
 
Didn't work for both Arial and Verdana. I'll try other fonts, but could it be out of the range? I'm still kinda new to character codes, Unicode, ASCII, how they relate, etc.
It's in both. What you need to do is add a new range in your font from 8212-8212. This will include just the em-dash. Then it should display properly when you try to draw it.
 
Top