Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

text metrics and anti-aliasing

12 views
Skip to first unread message

Dave Calkins

unread,
Mar 13, 2010, 8:53:01 PM3/13/10
to
I created a font and selected it into a DC. I then called GetGlyphOutline
with uFormat == GGO_METRICS to get the GLYPHMETRICS for the glyph.

The GLYPHMETRICS provides the blackbox width and height. In testing, I
noticed the values it was providing for the glyph seemed to be too small. I
rendered the glyph to a bitmap and then zoomed in and compared the glyph to
the metrics being returned. The blackbox width and height as indicated in
GLYPHMETRICS was too small.

I then realized that by default I was getting anti-aliasing when rendering
the text. So I disabled anti-aliasing (by setting the LOGFONT lfQuality
variable to NONANTIALIASED_QUALITY when loading the font).

I repeated the test and this time the blackbox width and height matched the
rendered glyph exactly.

My conclusion is that the values in GLYPHMETRICS assume no anti-aliasing.
The problem is, I need to render anti-aliased text and want to know the
blackbox size.

How can I compute the "as rendered" blackbox size which will include
anti-aliasing?

0 new messages