Jump to content


Photo

symbols as font


  • Please log in to reply
5 replies to this topic

#1 tomasart

tomasart

    GMC Member

  • GMC Member
  • 201 posts

Posted 09 August 2012 - 02:06 PM

I need to put 2 symbols as font there are not in the ansi table. Hoy can a do it with only this 2 simbols and haw can i call it later in my draw_text?
  • 0

#2 dannyjenn

dannyjenn

    GMC Member

  • GMC Member
  • 2233 posts
  • Version:Mac

Posted 09 August 2012 - 02:20 PM

It's impossible... it's a limitation to GameMaker (unless there's some sort of DLL that can do it... I don't know). GameMaker only supports the ANSI (or is it ASCII?) characters.
The easiest thing to do would be to substitue an unused ANSI charcter for whatever character you need. If you're using a font then you'd need some font editing software... if you're using a sprite font then changing it is simple. So for example, if you wanted "√(x)" you could make frame 0 the square root symbol "√", then when you go to make the string do chr(0)+"(x)"
The other option is to use sprites, but not with GameMaker's built-in "sprite font" / draw_text()... instead write your own script to draw the text using sprites. This would allow practically limitless characters.
  • 0

#3 Mercerenies

Mercerenies

    Koopa King

  • GMC Member
  • 646 posts
  • Version:GM:Studio

Posted 09 August 2012 - 02:22 PM

It's impossible... it's a limitation to GameMaker (unless there's some sort of DLL that can do it... I don't know). GameMaker only supports the ANSI (or is it ASCII?) characters.
The easiest thing to do would be to substitue an unused ANSI charcter for whatever character you need. If you're using a font then you'd need some font editing software... if you're using a sprite font then changing it is simple. So for example, if you wanted "√(x)" you could make frame 0 the square root symbol "√", then when you go to make the string do chr(0)+"(x)"
The other option is to use sprites, but not with GameMaker's built-in "sprite font" / draw_text()... instead write your own script to draw the text using sprites. This would allow practically limitless characters.

I'd like to add that it's probably a bad idea to use the null character (ASCII 0x00) for that. I don't know if it makes a difference in GM, but in many other languages, the null character has significance internally in strings that should not be tampered with. For instance, in C/C++, placing a null character in a string terminates the string immediately.
  • 0

#4 tomasart

tomasart

    GMC Member

  • GMC Member
  • 201 posts

Posted 09 August 2012 - 02:29 PM

It's impossible... it's a limitation to GameMaker (unless there's some sort of DLL that can do it... I don't know). GameMaker only supports the ANSI (or is it ASCII?) characters.
The easiest thing to do would be to substitue an unused ANSI charcter for whatever character you need. If you're using a font then you'd need some font editing software... if you're using a sprite font then changing it is simple. So for example, if you wanted "√(x)" you could make frame 0 the square root symbol "√", then when you go to make the string do chr(0)+"(x)"
The other option is to use sprites, but not with GameMaker's built-in "sprite font" / draw_text()... instead write your own script to draw the text using sprites. This would allow practically limitless characters.


hey dannyjenn, nice to see you again hepling me.

I thing your solution is what i want.

1. I create a sprite font with only this 2 simbols
2. then i can call it with chr(0) adn chr(1) ??????
  • 0

#5 tomasart

tomasart

    GMC Member

  • GMC Member
  • 201 posts

Posted 09 August 2012 - 03:21 PM

edit: not work

Edited by tomasart, 09 August 2012 - 03:23 PM.

  • 0

#6 dannyjenn

dannyjenn

    GMC Member

  • GMC Member
  • 2233 posts
  • Version:Mac

Posted 09 August 2012 - 07:19 PM

I'd like to add that it's probably a bad idea to use the null character (ASCII 0x00) for that. I don't know if it makes a difference in GM, but in many other languages, the null character has significance internally in strings that should not be tampered with. For instance, in C/C++, placing a null character in a string terminates the string immediately.

I see... didn't realize that. Also I believe that chr(10) and chr(13) are treated as newline characters in GameMaker so you shouldn't use those unless you're writing your own script to display them.



hey dannyjenn, nice to see you again hepling me.

I thing your solution is what i want.

1. I create a sprite font with only this 2 simbols
2. then i can call it with chr(0) adn chr(1) ??????

Your normal font is a sprite font, right?
What I do is make my sprite font exactly 128 frames long (so that " " is on frame 32, "!" is on frame 33, etc.) and then there'll be 32 characters before the " " that haven't been used for anything (they're normally non-printing characters). If what Mercenaries said applies to GameMaker then you might want to be careful but I've never had a problem (except you can't use chr(10) and chr(13) because GameMaker handles them as newline characters)
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users