Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Custom Fonts from Image File

Author
Message
jomajuga
12
Years of Service
User Offline
Joined: 7th Sep 2011
Location:
Posted: 3rd Apr 2012 04:43
Does anyone know what dimensions (width and height) are required in the image file for my fonts?

The point is that whenever I try a new font image within my game I don't get the letters but "pieces" of them... which obviously I want to fix.

Does anyone know how?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Apr 2012 11:43
You can use an image of any size but I would stick to 1024x1024 or under if you're publishing to mobile devices.

It is a complicated process but if you are intent on making your own fonts you will have to create a "subimages" text file to tell AppGameKit which letter is where.

I don't have the details for how the subimages file is laid out to hand. Can someone else shed a bit more light?

Otherwise there are some free font making utilities made by the community:
http://forum.thegamecreators.com/?m=forum_view&t=189225&b=41
http://forum.thegamecreators.com/?m=forum_view&t=184828&b=8

Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 3rd Apr 2012 22:20
The subimages file is a text file, named the same as the bitmap with " subimages" at the end, so if your image is called;
"font.png"

the subimages file would be;

"font subimages.txt"

Internally, there is a line for each character from 32 to 127.
each line is made up of five parameters seperated by a colon;
ascii value of the character
x coodinate
y coordinate
width
height.

Here's a sample of one I made earlier showing the first 8 characters;

This is for a fixed width font, each character is 64 wide by 96 high.

You can also stick other stuff in the same image (there's quite a bit of space left) and reference using custom names in the same way

You then access these with the loadSubImage() command.

If you don't want to go to the trouble, just use Hubdule's util (linked to by Baxslash above) , it handles fixed and variable width and creates the subimages file for you.
jomajuga
12
Years of Service
User Offline
Joined: 7th Sep 2011
Location:
Posted: 4th Apr 2012 05:37
Thank you all for your help.

Login to post a reply

Server time is: 2024-05-02 12:48:37
Your offset time is: 2024-05-02 12:48:37