deriveFont wont work after createFont

S

Sameer

Hello,
I created a font using a font file say font.ttf using the method
Font.createFont(int, InputStream).
The default point size for the created font is 1.
This can be verified by typing the font object to console.
It looks like..

java.awt.Font[family=Shivaji01,name=Shivaji01,style=plain,size=1]

Then I used the method deriveFont(int,float) on it and I had given a
sizeble point, still this method can not change the point size of the
font.
After deriveFont method used I am still getting on console as

java.awt.Font[family=Shivaji01,name=Shivaji01,style=plain,size=1]

I am using JDK1.5.0. Update 1.

Why is it so?
I have posted this question on many forums but coudn't get the answer.

Is this a bug?

Please help meee.

-Sameer
 
Joined
Feb 11, 2009
Messages
1
Reaction score
0
floating point argument

Hi Sameer,

Make sure you call deriveFont() with a floating point argument. If you provide an integer argument, it sets the style rather than the size.

Try:
Font biggerFont = font.deriveFont(20.0f);

instead of font.deriveFont(20);

I hope that helps!

Cheers,
Rikki
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top