This section illustrates you how to outline the font.
By outlining the font , we make the characters more stylish and impressive. We are providing you an example which outlines the text. The Font class represents fonts to render text in a visible way. The class FontRenderContext measures the text specified.
Following code defines the font:
|Font font = new Font("Monotype Corsiva", 2, 50);|
To give the graphical representation of styled character data, we have used the class TextLayout. The class AffineTransform provides the properties like translation, shearing, scaling, and rotation. The getBounds() method provides the boundaries displayed on the design surface. The method setClip(shape) sets the clipping of text specified as shape.
Following code outlines the string specified:
|Shape shape = text.getOutline(null);|
Here is the code of FontOutline.java
Output will be displayed as:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: October 8, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles