On Thu, Sep 26, 2019 at 09:17:03AM -0500, Zebediah Figura wrote:
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index b57effd349d..ccae09edc19 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -7189,6 +7189,51 @@ static void test_GetCharWidthInfo(void) ReleaseDC(NULL, hdc); }
+static int CALLBACK get_char_width_proc(const LOGFONTA *lf, + const TEXTMETRICA *tm, DWORD type, LPARAM ctx) +{ + HFONT font = CreateFontIndirectA(lf); + HDC dc = GetDC(NULL); + const char c = 'm'; + ABCFLOAT abcf; + int i, i32; + BOOL ret; + float f; + ABC abc; + + SelectObject(dc, font); + + ret = GetCharWidthFloatA(dc, c, c, &f); + ok(ret, "%s: GetCharWidthFloat() failed\n", lf->lfFaceName); + ret = GetCharWidth32A(dc, c, c, &i32); + ok(ret, "%s: GetCharWidth32A() failed\n", lf->lfFaceName); + ret = GetCharWidthA(dc, c, c, &i); + ok(ret, "%s: GetCharWidthA() failed\n", lf->lfFaceName); + ok(i == i32, "%s: mismatched widths %d/%d\n", lf->lfFaceName, i, i32); + ok((float)i / 16.0f == f, "%s: mismatched widths %d/%.8e\n", lf->lfFaceName, i, f); +
This factor of sixteen is strange. Is it perhaps possible that the selected font has a ppem of sixteen and that GetCharWidthFloat() returns widths as a fraction of the em square width? Huw.