Here is an improved version :
//-------------------------------------------------------------------------
import java.awt.*;
import java.awt.font.*;
import java.awt.geom.*;
import javax.swing.*;
public class FontOutline extends JFrame {
public static void main( String[] args ){
JFrame f = new FontOutline();
f.setSize( 300,200 );
f.setVisible(true);
}
public void paint( Graphics g ){
Font font = getFont();
System.out.println( font );
FontRenderContext renderContext = new FontRenderContext( null, true, true );
String str = "abc";
g.drawString( str, 10, 100 );
GlyphVector glyph = font.createGlyphVector( renderContext, str );
for ( int i = 0; i < glyph.getNumGlyphs(); i++ ) {
System.out.println( "character ["+ str.charAt(i) +"]" );
GeneralPath path = new GeneralPath( glyph.getOutline() );
PathIterator iter = path.getPathIterator(null);
while( iter.isDone() == false ){
showSegment( iter );
iter.next();
}
}
}
private void showSegment( PathIterator i ){
double[] xy = new double[6];
int type = i.currentSegment( xy );
switch( type ){
case PathIterator.SEG_MOVETO:
System.out.println( "move to " + xy[0] +"," + xy[1] );
break;
case PathIterator.SEG_LINETO:
System.out.println( "line to " + xy[0] +"," + xy[1] );
break;
case PathIterator.SEG_QUADTO:
System.out.println( "quad to " + xy[0] +"," + xy[1] +";"+ xy[2] +","+ xy[3] );
break;
case PathIterator.SEG_CUBICTO:
System.out.println( "cubic to " + xy[0] +"," + xy[1] +";"+ xy[2] +","+ xy[3]
+":"+ xy[4] +","+ xy[5] );
break;
case PathIterator.SEG_CLOSE:
System.out.println( "close" );
break;
}
}
}
//-------------------------------------------------------------------------
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".