#include <windows.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>

int main(void) {
    LOGFONTA font;
    HFONT hf;
    HDC hdc;
    GLYPHMETRICS gm;
    MAT2 transform;

    memset(&font, 0, sizeof(font));
    memset(&transform, 0, sizeof(transform));
    transform.eM11.value = 1;
    transform.eM22.value = 1;

    strncpy(font.lfFaceName, "DejaVu Sans Condensed MB", sizeof(font.lfFaceName));
    font.lfHeight = 20;
    font.lfQuality = 2;
    font.lfPitchAndFamily = FF_DECORATIVE | FIXED_PITCH;
    hf = CreateFontIndirectA(&font);
    if(!hf) {
        printf("Create font failed ! %x\n", GetLastError());
        return 1;
    }
    hdc = CreateCompatibleDC(NULL);
    if(!hdc) {
        printf("Create DC failed ! %x\n", GetLastError());
        return 1;
    }
    SelectObject(hdc, hf);
    /* Now let the fun begin */
    DWORD sz = GetGlyphOutlineA(hdc, 'A', GGO_GRAY8_BITMAP, &gm, 0, 0, &transform);
    printf("gmBlackBoxY = %x with char='A'\n", gm.gmBlackBoxY);
    assert(gm.gmBlackBoxY != 0);
    sz = GetGlyphOutlineA(hdc, ' ', GGO_GRAY8_BITMAP, &gm, 0, 0, &transform);
    printf("gmBlackBoxY = %x with char=' '\n", gm.gmBlackBoxY);
    assert(gm.gmBlackBoxY != 0);
}
