2012-11-05 25 views
8

क्या java.awt.font का उपयोग करते समय अक्षर अंतर बढ़ाना संभव है? कुछ इस तरह:java.awt.font अक्षर अंतर

Font font = new Font("serif", Font.PLAIN, 21); 
//Increase the spacing - perhaps with deriveFont()? 

BufferedImage image = new BufferedImage(400, 600, BufferedImage.TYPE_INT_RGB); 
Graphics2D graphics = image.createGraphics(); 
graphics.setFont(font); 
graphics.drawString("testing",0,0); 

उत्तर

10

आप एक अद्यतन ट्रैकिंग विशेषता के साथ एक नया फ़ॉन्ट, प्राप्त कर सकते हैं:

Map<TextAttribute, Object> attributes = new HashMap<TextAttribute, Object>(); 
attributes.put(TextAttribute.TRACKING, 0.5); 
Font font2 = font.deriveFont(attributes); 
gr.setFont(font2); 
gr.drawString("testing",0,20); 
+0

धन्यवाद, कि चाल किया! – user1031054