1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

GMS 2 Replace "▯" with something else

Discussion in 'Programming' started by Erikku901, Feb 13, 2019.

  1. Erikku901

    Erikku901 Member

    Joined:
    Feb 13, 2019
    Posts:
    10
    Hi all,
    Thanks for this amazing community. There is so much valuable info to find here.

    Anyway, I'm struggling with displaying text right now.
    We take names from another API and show them ingame, however when that name is in Arabic, Korean, Chinese or using some other characters that aren't in my font, it will show as ▯(the famous Unicode character 9647) on PC and it will just disappear on mobile.

    How can I change it so that it shows something else instead of ▯ on both PC and mobile?
    Example:
    Name:
    伊藤
    Shown now(PC):
    ▯▯
    Shown now (Mobile):

    How I want it to be shown:
    **

    Any suggestions would be greatly appreciated.
     
  2. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    7,138
    Personally, what I'd do is use sprite fonts and then substitute that character for another one in the sprite itself. With sprite fonts you can define exactly what characters are included by supplying a string with them in the order that they are shown in the sprite, so you simply add the ▯ character into the string and then make an image for it in the font sprite.

    https://docs2.yoyogames.com/index.h..._gml_reference/fonts/font_add_sprite_ext.html
     
  3. Erikku901

    Erikku901 Member

    Joined:
    Feb 13, 2019
    Posts:
    10
    Thank you for your reply.
    While it does work on PC. For some reason the whole ▯ character gets ignored on mobile.
    (I'm playing it through a browser in html5 btw)
    Couldn't seem to find anything about this in the manual either.
    Are these differences between mobile and PC known?
     
  4. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    7,138
    I honestly don't know whether this is just one of those differences between OS or whether it should consistently show the same symbol on all platforms. But like I say, if you want to be consistent and show the same symbol on all platforms, you should go with a sprite font. I would also suggest that you file a bug with the helpdesk, as at least you'll find out whether that's just the way it is or something that can be fixed!
     
    Erikku901 likes this.
  5. Erikku901

    Erikku901 Member

    Joined:
    Feb 13, 2019
    Posts:
    10
    Thank you.
    I'm already using a sprite font as you suggested.
    I'll file a bug report.
     
  6. Lonewolff

    Lonewolff Member

    Joined:
    Jan 8, 2018
    Posts:
    1,207
    I found the same thing when following the 'Space Rocks' you tube tutorials at the start of January.

    Where ever the new lines were added, if the text was tabbed for code formatting it inserted ▯▯ at the start of every line. Didn't matter what font I tried. Made the code look messy if the text was bunched up at character position 0.

    So I just went old school and manually formatted the draw_text calls.
     

Share This Page