The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.awt.font  [5 examples]

e654. Getting the Shape from the Outline of Text

    Shape getTextShape(Graphics2D g2d, String str, Font font) {
        FontRenderContext frc = g2d.getFontRenderContext();
        TextLayout tl = new TextLayout(str, font, frc);
        return tl.getOutline(null);
    }

 Related Examples
e651. Listing All Available Font Families
e652. Getting the Font Faces for a Font Family
e653. Drawing a Paragraph of Text
e655. Drawing Text with Mixed Styles


© 2002 Addison-Wesley.