Windows blackbox bug?

thehorseisbrownthehorseisbrown Posts: 3
edited November 12 in Font Technology

I initially posted this at stackoverflow and github but was advised that this might be a better place:

The problem is that values gmBlackBoxX and gmBlackBoxY are supposed to give the dimensions of the rectangle enclosing the glyph.  It seems like they are calculated before the hinting process takes place and this is a bug. Maybe you guys can tell me if it's something else.



  • Perhaps your rendering is using some later text rendering API, but the call you are using to get the bounding box is assuming GDI?

    Background: Windows has a ton of different rendering modes. Seems like the GLYPHMETRICS structure is a basic Win32 API listed here:

    This call exists in Windows 2000, which tells me that it is very old stuff. Certainly not part of any modern rendering stack. I imagine it must assume GDI rendering.

    Windows has several text modes, introduced over the years.
    • GDI without or without antialiasing (Windows 3.1 and later)
    • GDI+ does same basic text rendering as GDI, I think?
    • GDI ClearType (Windows XP and later): color subpixels in X, no anti-aliasing in Y
    • WPF ClearType (Windows Vista and later): color subpixels in X, anti-aliasing in Y
    • DirectWrite ClearType (Windows 8 and later): super-sampling (sub-pixel rendering) in X and Y, no color subpixels—arguably not really ClearType at all
  • You are right, I used the simplest thing I could find: DrawText() in GDI. I will most likely use DirectWrite and forget about these colored edges. You saved me a lot of time since I was about to try and fix ClearType's background sensitivity. Thank you so much!
Sign In or Register to comment.