This site requires JavaScript, please enable it in your browser!
Greenfoot back
sqwuckies
sqwuckies wrote ...

2013/3/23

Fonts other than the default?

sqwuckies sqwuckies

2013/3/23

#
I don't know much about displaying text, however I am currently making a Pokemon battle scenario and it would be great if I could use a custom font for the text on the screen. So, my question is: without using a simple "text" image, how can I display text in a Greenfoot scenario using a custom font's filepath (probably inside the game's folder)?
danpost danpost

2013/3/23

#
I guess I am not sure what you mean because all text is displayed by use of images. I mean, how else can you display text. There are methods you can use to change the font type, style and size. It sounds to me, however, that you want to add your own character set and use it. Tell me I am wrong, please.
sqwuckies sqwuckies

2013/3/24

#
By 'image' I actually meant the use of a .png file to emulate real text. You are correct. I want to add a certain character set (not my own) and use it... is it impossible?
danpost danpost

2013/3/24

#
Not impossible, but could be tricky. You would have to create a one to one relationship between the standard character set and your new set. Then, you will have to apply each character used from your new set to an image, one by one, side by side, to create the text string. If the characters are not all the same width, you will have to keep track of where you need to draw the image of the characters on the main text image.
sqwuckies sqwuckies

2013/3/24

#
so what you're telling me is that "fonts" as we know them do not exist when using Greenfoot?
danpost danpost

2013/3/24

#
No (maybe I mis-understood you). There are fonts in Java and you can set the font (type, style, and size) for any GreenfootImage object using any of the standard fonts accessible through java. Please refer to the Font class API for more information.
sqwuckies sqwuckies

2013/3/24

#
Oh! That is very helpful, thank you. So other than the standard fonts accessible through Java, that's it?
danpost danpost

2013/3/24

#
I am not sure if you can access other font other than those accessible through Java; and if so, I would not know how to access them.
sqwuckies sqwuckies

2013/3/24

#
okay. thank you for your help!
You need to login to post a reply.