Thanks! Modifying the position of each glyph in the GlyphVector works perfectly! At first I didn't though that this was practical, because the GlyphVector seems to encode positions as Point2D: it seemed to me that the final position of each glyph was already encoded in there. But I poked around and apparently the default layout is purely linear: the Y value is always 0.
Best Regards, David Garnier Le ven 21/03/2003 � 04:14, David Kavanagh a �crit : > David, > I've spent a bit of time with text rendering in java2D. The glyph > spacing is really derived from font metrics (from the font file). Before > I go into a more complicated idea, have you tried turning on > Fractional_Metrics? They can give a more accurate character spacing > which is consistent at both load and high DPIs. > Something I used to override glyph spacing was to grab the GlyphVector, > analyze the character spacing and come up with a tweak value, then shift > each glyph using that value. Effectively, that is called "tracking". > Once you have the glyph vector, you could also do individual character > kerning, but it sounds like the tracking adjustment is what you are > after. Anyway, then you call Graphics2D.drawGlyphVector(). Something I > read someplace claimed that was faster at rendering text than calling > TextLayout.draw(). > > Hope this helps. > > David > > David Garnier wrote: > > >Hello, > >I'm using the TextStroke class to draw text on a path. It does work > >well, but it leaves too much space between glyphs, just enough to fit > >another character. I tried to track the problem down, to no avail. > > > >It seems to me that this kind of thing is computed by the GlyphVector, > >which is itself under the control of the FontRenderContext, through the > >Font and the GlyphMetric. However, these classes are almost only > >read-only. > > > >TextStroke uses its own FontRenderContext. I tried to replace this one > >from the one coming from the current Graphics2D, and it did slightly > >improve the rendering, but the spacing between glyphs is still > >identical. > > > >How can I solve this problem? I'm thinking that I'm looking for a way to > >enable the LIGATURE mode in the GlyphMetric object. > > > >Also, I can't use spaces in my text, any idea? > >Best Regards, > > > > > > =========================================================================== > 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". -- David Garnier <[EMAIL PROTECTED]>
signature.asc
Description: PGP signature
