[RMXP] Script that allows you to load fonts as spritesheets like in GameMaker Studio?

Andrea87Sky

Just a random musician, eventer and spriter.
Veteran
Joined
Aug 30, 2017
Messages
119
Reaction score
1
First Language
Italian
Primarily Uses
RMXP
Bump, I'm still searching for a method.
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
279
Reaction score
105
First Language
English
Primarily Uses
RMXP
I am only aware of this script by poccil:

The example files are broken, but the idea is you put all the characters horizontally next to each other in the graphic, then create a .TXT file defining the start and width of the glyph.

Then I think you're good to go with just setting the font name prior to the draw_text call, e.g.
Code:
self.contents.font.name = 'my_bitmap_font'
 

Andrea87Sky

Just a random musician, eventer and spriter.
Veteran
Joined
Aug 30, 2017
Messages
119
Reaction score
1
First Language
Italian
Primarily Uses
RMXP
I am only aware of this script by poccil:

The example files are broken, but the idea is you put all the characters horizontally next to each other in the graphic, then create a .TXT file defining the start and width of the glyph.

Then I think you're good to go with just setting the font name prior to the draw_text call, e.g.
Code:
self.contents.font.name = 'my_bitmap_font'
Thank you, but can you maybe please show me how the text file should be? Because I have no idea of what to write for specify the start and the witdh.
 

Zeriab

Huggins!
Veteran
Joined
Mar 20, 2012
Messages
1,268
Reaction score
1,417
First Language
English
Primarily Uses
RMXP
Is it just the text or is it everything that is blurry?
 

Andrea87Sky

Just a random musician, eventer and spriter.
Veteran
Joined
Aug 30, 2017
Messages
119
Reaction score
1
First Language
Italian
Primarily Uses
RMXP
Is it just the text or is it everything that is blurry?
Only full-screen mode (or any screen resize methods) and text, but to be honest I want this system for making who plays my game to not be forced to download a .ttf file for using the custom font, many of them don't even do that or know that and they play the game with Arial (which is orribile since it's not a pixel font in a pixel game).
 
Last edited:

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
279
Reaction score
105
First Language
English
Primarily Uses
RMXP
Attached screenshot of an example another user gave me. Both the bitmap graphic and the text file are named the same and placed inside the Pictures folder. This font only has numbers (and a forward slash) in it, so this is a minor example. Because all the characters are on a single row, this means all your glyphs will share the same height.

Looking at the text file, the first entry is
Code:
0,0,0,24
As the website explains, the first field indicates the character this glyph will replace (so every '0' will be replaced with the bitmap '0' graphic).
The second field is the left-most x-coordinate of the glyph, which for this being the first glyph in the sheet should be 0.
The third field kind of indicates how much of a shift the glyph should have. Normally this value matches the above, but for some cases you might want to make it larger (move left) or smaller (move right). For example, if you take a look at glyph '2', changing the 42 to a 46 will move it left 4 pixels when rendered in-game.
Fourth field indicates the width of the glyph. So in this example the '0' has a width of 24 pixels.

Repeat the process for each glyph thereafter.
 

Attachments

Andrea87Sky

Just a random musician, eventer and spriter.
Veteran
Joined
Aug 30, 2017
Messages
119
Reaction score
1
First Language
Italian
Primarily Uses
RMXP
Attached screenshot of an example another user gave me. Both the bitmap graphic and the text file are named the same and placed inside the Pictures folder. This font only has numbers (and a forward slash) in it, so this is a minor example. Because all the characters are on a single row, this means all your glyphs will share the same height.

Looking at the text file, the first entry is
Code:
0,0,0,24
As the website explains, the first field indicates the character this glyph will replace (so every '0' will be replaced with the bitmap '0' graphic).
The second field is the left-most x-coordinate of the glyph, which for this being the first glyph in the sheet should be 0.
The third field kind of indicates how much of a shift the glyph should have. Normally this value matches the above, but for some cases you might want to make it larger (move left) or smaller (move right). For example, if you take a look at glyph '2', changing the 42 to a 46 will move it left 4 pixels when rendered in-game.
Fourth field indicates the width of the glyph. So in this example the '0' has a width of 24 pixels.

Repeat the process for each glyph thereafter.
Ok, thank you so much. I spent this entire day making it, and it works. The only problem though is that when a long character is at the end of a line, it cuts or half of it renders on the next line instead, I have no idea of why this happends (I use UMS). Another problem is, how do I specify the space? I tried to do like " ,cords,cords,width" but it doesn't work, and if i don't do it, the characters just appear all attached.

If you want to check, I can send you in private the file and the image of the font.

EDIT: Fixed both problems.
 
Last edited:

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
279
Reaction score
105
First Language
English
Primarily Uses
RMXP
As the instructions say:
Code:
(If the character includes a space or is
# any one of: # , "   then the character must be
# in quotation marks.   To specify a quotation mark,
# put a backslash before it, like this: "\"" )
which would mean you would do
Code:
" ",cords,cords,width
Note it also mentions about a fifth field:
Code:
# The fifth field, which is optional, specifies the X
# coordinate of where this character ends and the next
# character begins, relative to the beginning of the bitmap
# font image.   If not specified, this field is equal
# to the sum of fields 1 and 3.
# Space glyph (notice the quotes)
" ",0,0,0,6
If you still can't get anything to work right, then yes, I would need the bitmap.
 

Andrea87Sky

Just a random musician, eventer and spriter.
Veteran
Joined
Aug 30, 2017
Messages
119
Reaction score
1
First Language
Italian
Primarily Uses
RMXP
As the instructions say:
Code:
(If the character includes a space or is
# any one of: # , "   then the character must be
# in quotation marks.   To specify a quotation mark,
# put a backslash before it, like this: "\"" )
which would mean you would do
Code:
" ",cords,cords,width
Note it also mentions about a fifth field:
Code:
# The fifth field, which is optional, specifies the X
# coordinate of where this character ends and the next
# character begins, relative to the beginning of the bitmap
# font image.   If not specified, this field is equal
# to the sum of fields 1 and 3.
# Space glyph (notice the quotes)
" ",0,0,0,6
If you still can't get anything to work right, then yes, I would need the bitmap.
It worked! Thank you so much!
Also, for the cut long letters problem of earlier, it was just a coords problem (I had to redo all the coords calculation from 0 sadly, but now it works).
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Why is there so much month left at the end of money? D=
Hello humans! How goes your day in this journey of living? I hope it is good, for I am human like you, and I am feeling great! Worship the altar.
Sand is basically small rocks

Forum statistics

Threads
105,613
Messages
1,014,989
Members
137,278
Latest member
SolarOfHearts
Top