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:
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: Outlining the font
Post your Comment