Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Bitmap Fonts

843807Jun 18 2009 — edited Jun 19 2009
Hi All,

I'm trying to conver ttf to bitmap image. So i try
 try{
	Font f = Font.createFont( Font.TRUETYPE_FONT, new File("arial.ttf")); //Create font from ttf
					 
	Font tDerivedFont = f.deriveFont( 20f );				
	g.setFont(tDerivedFont);
	GlyphVector gv = tDerivedFont.createGlyphVector(aFontRenderContext, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
	g2.drawGlyphVector(gv, 10, 60); //This works fine
        
       //what i hope to get is some thing like
	ImageIO.write(someBufferedImage, "bmp", new File("test.bmp"));
		
  catch ( FontFormatException tEx )
  {
	tEx.printStackTrace();
  }
	catch ( IOException tEx )
  {
	tEx.printStackTrace();
  }
help please

Thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 17 2009
Added on Jun 18 2009
8 comments
449 views