Obtaining kerning information

Posted by chadb on Stack Overflow See other posts from Stack Overflow or by chadb
Published on 2012-04-10T03:38:42Z Indexed on 2012/04/10 5:29 UTC
Read the original article Hit count: 143

Filed under:
|
|
|

How can I obtain kerning information for GDI to then use in GetKerningPairs? The documentation states that

The number of pairs in the lpkrnpair array. If the font has more than nNumPairs kerning pairs, the function returns an error.

However, I do not know how many pairs to pass in, and I don't see a way to query for it.

EDIT I tried to do the following, however, it still gave me 0.

Font* myFont = new Font(L"Times New Roman", 10);
Bitmap* bitmap = new Bitmap(256, 256, PixelFormat32bppARGB);
Graphics* g = new Graphics(bitmap);

SelectObject(g->GetHDC(), myFont);
//DWORD numberOfKerningPairs = GetKerningPairs( g->GetHDC(), -1, NULL );
DWORD numberOfKerningPairs = GetKerningPairs( g->GetHDC(), INT_MAX, NULL );

© Stack Overflow or respective owner

Related posts about c++

Related posts about gdi+