Skip to main content

Animating text

1 reply [Last post]
Anonymous

Hi,

I'm basically animating a text string by both paning and zooming on it over multiple images/frames. I have starting and ending positions, starting and ending scale factors, a duration, and a frame rate. I interpolate linearly to determine each frame's text position and size and apply a corresponding transform on a Graphics2D object before drawing the text (for each frame).

My issue is that a zoom on text is not smooth at all since the text glyphs actually change as size increases. So as the zoom increases, letters jitter.

I have tried various approaches, including setting the fractional metrics hint. I would be satisfied with scaling a fixed text shape using nearest neighbor, ie. I don't need to increase a font's resolution/point size as I zoom in. But I'm not sure how to do this.

Note that I actually also use a background image under the text that is also paned and zoomed.

Thanks
Marc

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
dougfelt
Offline
Joined: 2003-07-17

Hmmm, no reply to this. Probably too late for you, but...

Java text rendering 'merges' the font and graphics transforms when computing the glyph outlines, so this is difficult to achieve.

Using GlyphVector or TextLayout will let you fix the glyph positions, though the glyph images will still change (outline hinting will still be applied for the combined transform before rendering, rather than using the original outline hinted to the original metrics).

Converting the text to an outline will handle this (though the general outline rasterizer is different than the text rasterizer at small point sizes, and it may not look as good at small point sizes). The outline can be transformed and scaled ok, with no changes in glyph shapes or positions.

Doug