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


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

Re: Determining font letter center

From Jeff Higgins <jeff@invalid.invalid>
Newsgroups comp.lang.java.gui
Subject Re: Determining font letter center
Date 2012-01-13 13:49 -0500
Organization A noiseless patient Spider
Message-ID <jepttd$3k9$1@dont-email.me> (permalink)
References <9ab7338e-e8e1-4e12-8d8e-43e6469d8215@s6g2000pbi.googlegroups.com>

Show all headers | View raw


On 01/13/2012 01:32 PM, Fred wrote:
> 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.
>
This may help.
<http://explodingpixels.wordpress.com/2009/01/29/drawing-text-about-its-visual-center/>

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next 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