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

2019/1/10

Predicting text bounds

Zamoht Zamoht

2019/1/10

#
Is it possible to use FontMetrics to predict the size of drawn strings and still make it available on the gallery? If not, is there any other way to make these calculations, that are allowed by the gallery?
danpost danpost

2019/1/10

#
Zamoht wrote...
Is it possible to use FontMetrics to predict the size of drawn strings and still make it available on the gallery? If not, is there any other way to make these calculations, that are allowed by the gallery?
Please give details on what you want to do, by example
Zamoht Zamoht

2019/1/10

#
I want to draw a string let's use "Hello World". This string should be drawn using a font of choice, for this example let it be "Arial" size 24. I would like to know the width and the height of this drawn string, so I can use a GreenfootImage with the correct size. For further use I would like to implement automatic line breaking for longer strings.
danpost danpost

2019/1/10

#
Zamoht wrote...
I want to draw a string let's use "Hello World". This string should be drawn using a font of choice, for this example let it be "Arial" size 24. I would like to know the width and the height of this drawn string, so I can use a GreenfootImage with the correct size. For further use I would like to implement automatic line breaking for longer strings.
You know -- I would like to know how also -- without using any of the AWT package. I have a TextImage Support Class scenario which will not work in javascript translation.
Zamoht Zamoht

2019/1/11

#
I did look at your TextImage solution, which works very well with AWT, but well AWT seems to be the solution and the problem at the same time.
You need to login to post a reply.