David:
I'm mystified by the image you sent. What locale/jvm are you using? How are
you positioning the text on the paths?
The code you included looks like it could work, but you can save yourself a bit
of trouble.
First off, Font.createGlyphVector _always_ creates a glyphvector using default
layout, whether you explicitly call performDefaultLayout or not. Unfortunately,
as performDefaultLayout is spec'd, it doesn't do the right thing for complex
text. There's generally little reason to ever call it. Commenting it out is
ok, but leaving it in wouldn't change anything.
Since in a glyphvector with default layout the positions are all the position +
advance of the previous glyph, you don't need to get the glyph metrics. You can
already determine the advance from examining the positions. note you can get
the position after the last glyph-- e.g. gv.getGlyphPosition(gv.getNumGlyphs())
works-- so you can get the advance of the last glyph as well.
If you're implementing fixed tracking in x then all you need to do is:
GlyphVector gv = font.createGlyphVector(...);
final float xdelta = -.3; // for example
float xoffset = delta;
for (int i = 1, e = gv.getNumGlyphs(); i <= e; ++i, xoffset += xdelta) {
Point2D pt = gv.getGlyphPosition(i);
pt.setLocation(pt.getX() + xoffset, pt.getY());
gv.setGlyphPosition(i, pt);
}
BTW, 'sansserif' is a logical font whose components depend on the platform, jvm,
and locale you're running in. To really know what font you're manipulating, you
should instantiate a physical font that you know is on the platform.
GraphicsEnvironment.getAvailableFontFamilyNames() or getAllFonts can help with
this if you need to do it programatically.
Looks like the RFE you need is really text-on-a-path for TextLayout and
GlyphVector. Those aren't going to make it for the next release (unless a lot
of people with fistfuls of money scream really loud). There are RFE's filed for
text on a path that you can vote for-- see 4696265, 4688788, 4700724.
Doug
===========================================================================
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".