Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #4935

Determining font letter center

From Fred <fred.l.kleinschmidt@gmail.com>
Newsgroups comp.lang.java.gui
Subject Determining font letter center
Date 2012-01-13 10:32 -0800
Organization http://groups.google.com
Message-ID <9ab7338e-e8e1-4e12-8d8e-43e6469d8215@s6g2000pbi.googlegroups.com> (permalink)

Show all headers | View raw


How can I find out how high a letter is when using a particular font?
I am trying to place the center of capital letters at a specific
location.

The javadoc for FontMetrics says that getAscent() returns the distance
from the font's baseline to the top of most alphanumeric characters,
but that doesn't seem to be true.

For example, Font( "Serif", 1, 32 ) (serif font, bold, 32-points, its
FontMetric getAscent returns 33, but the height of every capital
letter is 21 pixels.

I have also tried to use the strikethroughOffset, but that is not in
the center of capital letters either.

--
Fred K

Back to comp.lang.java.gui | Previous | NextNext in thread | Find similar


Thread

Determining font letter center Fred <fred.l.kleinschmidt@gmail.com> - 2012-01-13 10:32 -0800
  Re: Determining font letter center Jeff Higgins <jeff@invalid.invalid> - 2012-01-13 13:49 -0500
    Re: Determining font letter center Fred <fred.l.kleinschmidt@gmail.com> - 2012-01-13 11:58 -0800
  Re: Determining font letter center Roedy Green <see_website@mindprod.com.invalid> - 2012-01-14 01:28 -0800

csiph-web