• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Resource icon

Bitmap Fonts Scripts 1

Pokémon Essentials Version
v17.2 ➖
What does it do?
----------------------------------------
This script allows for writing clean text on sprites, for example in menus. The build-in method "pbDrawTextPositions" tends to make the text blurry due to anti-aliasing (I believe).

It uses png files that contains all needed characters to produce a clean text output, can work with line breaks, allows for shadows and colored text as well as the option to center horizontally and vertically.

This pack comes with a self-build converter to easily add new fonts and Power Clear in the size 20 and 36 as base fonts.

Honestly, I don't know if anyone else will find this helpfull, but I want to share nonetheless.


Installation:
----------------------------------------
1. Create a new script section called Bitmap_Font_Logic
2. Copy the content of the Bitmap_Font_Logic.txt file in that section

3. Create another script section called Bitmap_Font_Data
4. Copy the content of the Bitmap_Font_Data.txt in here

5. In your projects Graphics folder create a new folder called Fonts
6. Place the attached graphic files in here (DO NOT RENAME THEM)



How to use:
----------------------------------------
To display text you use it like this variable = BitmapText.new(text,posX,posY,viewport,font,size,color=nil,shadow=nil)
variable: is a variable to store the object, so you can use the update and dispose method on it
BitmapText.new: initializes a new BitmapText object
text: the text you want to display put between ""; write \n for a line break (example: "This is an example text \nAnd this is a new line")
posX: x coordinate of the upper left corner of where the text will begin; put in nil to center text horizontally
posY: y coordinate of the upper left corner of where the text will begin; put in nil to center text vertically
font: the font type you want to use presented as the global variable (as stored in Bitmap_Font_Data); put in nil to use default font ($PowerClear20)
size: the resize factor of the font; the base size depends on your graphic size (indicated by the number of the font name); default value is 1; may lead to cut off text and displaced text
color: reguluar ruby expression of a color; determines what color the text will be (example: Color.new(126,126,126) )
shadow: reguluar ruby expression of a color; determines the shadow color; leave out if no shadow is wanted



Other methods:
----------------------------------------
update(text): updates the drawn text if it has changed (usefull for text that changes every then and now); (example:variable.update("other text") )
dispose: disposes the written text (example: variable.dispose)


External Tools:
----------------------------------------
XML to Ruby Code converter (console application): turns an XML file into ready-to-use ruby code; use it to create the infos for new fonts
Font builder by andryblack: https://github.com/andryblack/fontbuilder/downloads



How to create own fonts:
----------------------------------------
1. get the TTF file for the font you want (not needed if the font is already installed on your computer)
2. open Font builder
3. on the font tab: select the font you want
4. set the size of the font (important!)
5. move to output tab and select a directory where you want to save the files
6. click "write font"
7. go to your output directory, you should seen an XML and a png file
8. open the png file and check the height if the image (you can also trim the height beforehand)
9. drag and drop the XML file on XML Character to Ruby Array.exe
10. the program will ask you several questions
11. as variable type put in $
12. set the Y starting position to 0 (unless you have reason to do otherwise)
13. enter the height that you checked in step 8
14. enter the width of the space character in pixels (this information cannot be created automaticall); default is 5
15. if wanted enter a custom name for your graphic file
16. you will see the output on the screen, a txt file containing the generated code will be saved and you got the option to copy the result to the clipboard
17. copy the generated code into the script section Bitmap_Font_Data
18. rename the png file to whatever it is you put in or name it just like the txt file
19. copy the file to Graphics/Fonts
20. Done! Your font can now be used!

Comparisson* (default write text method vs. btmap text):
----------------------------------------

Default:
capture008.png



Bitmap Text:
capture013.png



*parts of the images were blurred to keep the focus on the text while still showing the size

For questions and bug reports visit our Discord channel https://discord.gg/7msDPaN or post them here.
Credits
Code and XML to Ruby Code Converter: Hollow_Ego
Font builder by andryblack: https://github.com/andryblack/fontbuilder/downloads
Author
Hollow_Ego
Downloads
1,176
Views
1,255
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Hollow_Ego

Back
Top