Basic HTML version of Foils prepared 13 July 98

Foil 17 Centering n Strings

From Java Academy II:Intermediate Java NPAC/ECS Java Academy -- February to April 98. by Tom Scavo

The FontMetricsTest4 Applet
This is a straightforward generalization...
First, calculate the height of n strings : int height = n*stringHeight + (n - 1)*leading;
The y-position of the first string is once again: int y = (appletHeight - height )/2 + ascent; while the position of each subsequent string is: y += stringHeight + leading;



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 28 1998