Commit 34002d4c authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

gdi32: Add a partial implementation of GdiRealizationInfo.

parent ed9c7396
......@@ -348,7 +348,7 @@ HFONT WINAPI CreateFontIndirectW( const LOGFONTW *plf )
if (!(fontPtr = GDI_AllocObject( sizeof(FONTOBJ), FONT_MAGIC, (HGDIOBJ *)&hFont,
&font_funcs ))) return 0;
memcpy( &fontPtr->logfont, plf, sizeof(LOGFONTW) );
fontPtr->logfont = *plf;
TRACE("(%d %d %d %d %x %d %x %d %d) %s %s %s %s => %p\n",
plf->lfHeight, plf->lfWidth,
......@@ -2536,7 +2536,7 @@ BOOL WINAPI TranslateCharsetInfo(
return FALSE;
}
if (index >= MAXTCIINDEX || FONT_tci[index].ciCharset == DEFAULT_CHARSET) return FALSE;
memcpy(lpCs, &FONT_tci[index], sizeof(CHARSETINFO));
*lpCs = FONT_tci[index];
return TRUE;
}
......@@ -3209,3 +3209,30 @@ BOOL WINAPI FontIsLinked(HDC hdc)
TRACE("returning %d\n", ret);
return ret;
}
/*************************************************************
* GdiRealizationInfo (GDI32.@)
*
* Returns a structure that contains some font information.
*/
typedef struct
{
DWORD flags; /* 1 for bitmap fonts, 3 for scalable fonts */
DWORD unknown1; /* keeps incrementing - num of fonts that have been created or selected into a dc ?? */
DWORD unknown2; /* fixed for a given font - looks like it could be the order of the face in the font list or the order
in which the face was first rendered. */
} realization_info_t;
BOOL WINAPI GdiRealizationInfo(HDC hdc, realization_info_t *info)
{
UINT otm_size;
FIXME("(%p, %p): stub!\n", hdc, info);
info->flags = 1;
otm_size = GetOutlineTextMetricsW(hdc, 0, NULL);
if(otm_size) info->flags |= 2; /* scalable */
info->unknown1 = -1;
info->unknown2 = -1;
return TRUE;
}
......@@ -206,7 +206,7 @@
# @ stub GdiProcessSetup
# @ stub GdiQueryFonts
# @ stub GdiQueryTable
# @ stub GdiRealizationInfo
@ stdcall GdiRealizationInfo(long ptr)
# @ stub GdiReleaseDC
@ stub GdiReleaseLocalDC
# @ stub GdiResetDCEMF
......
......@@ -38,6 +38,7 @@ BOOL (WINAPI *pGetCharABCWidthsW)(HDC hdc, UINT first, UINT last, LPABC abc);
DWORD (WINAPI *pGetFontUnicodeRanges)(HDC hdc, LPGLYPHSET lpgs);
DWORD (WINAPI *pGetGlyphIndicesA)(HDC hdc, LPCSTR lpstr, INT count, LPWORD pgi, DWORD flags);
DWORD (WINAPI *pGetGlyphIndicesW)(HDC hdc, LPCWSTR lpstr, INT count, LPWORD pgi, DWORD flags);
BOOL (WINAPI *pGdiRealizationInfo)(HDC hdc, DWORD *);
static HMODULE hgdi32 = 0;
......@@ -51,6 +52,7 @@ static void init(void)
pGetFontUnicodeRanges = (void *)GetProcAddress(hgdi32, "GetFontUnicodeRanges");
pGetGlyphIndicesA = (void *)GetProcAddress(hgdi32, "GetGlyphIndicesA");
pGetGlyphIndicesW = (void *)GetProcAddress(hgdi32, "GetGlyphIndicesW");
pGdiRealizationInfo = (void *)GetProcAddress(hgdi32, "GdiRealizationInfo");
}
static INT CALLBACK is_truetype_font_installed_proc(const LOGFONT *elf, const TEXTMETRIC *ntm, DWORD type, LPARAM lParam)
......@@ -1745,6 +1747,53 @@ static void test_nonexistent_font(void)
ReleaseDC(0, hdc);
}
static void test_GdiRealizationInfo(void)
{
HDC hdc;
DWORD info[4];
BOOL r;
HFONT hfont, hfont_old;
LOGFONTA lf;
if(!pGdiRealizationInfo)
{
skip("GdiRealizationInfo not available\n");
return;
}
hdc = GetDC(0);
memset(info, 0xcc, sizeof(info));
r = pGdiRealizationInfo(hdc, info);
ok(r != 0, "ret 0\n");
ok(info[0] == 1, "info[0] = %x for the system font\n", info[0]);
ok(info[3] == 0xcccccccc, "structure longer than 3 dwords");
if (!is_truetype_font_installed("Arial"))
{
skip("skipping GdiRealizationInfo with truetype font\n");
goto end;
}
memset(&lf, 0, sizeof(lf));
strcpy(lf.lfFaceName, "Arial");
lf.lfHeight = 20;
lf.lfWeight = FW_NORMAL;
hfont = CreateFontIndirectA(&lf);
hfont_old = SelectObject(hdc, hfont);
memset(info, 0xcc, sizeof(info));
r = pGdiRealizationInfo(hdc, info);
ok(r != 0, "ret 0\n");
ok(info[0] == 3, "info[0] = %x for arial\n", info[0]);
ok(info[3] == 0xcccccccc, "structure longer than 3 dwords");
DeleteObject(SelectObject(hdc, hfont_old));
end:
ReleaseDC(0, hdc);
}
START_TEST(font)
{
init();
......@@ -1778,4 +1827,5 @@ START_TEST(font)
else
skip("Arial Black or Symbol/Wingdings is not installed\n");
test_GetTextMetrics();
test_GdiRealizationInfo();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment