Commit c6703a99 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Michael Stefaniuc

t2embed: Implement TTIsEmbeddingEnabled().

Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org> (cherry picked from commit 0ea8c1d6) Signed-off-by: 's avatarMichael Stefaniuc <mstefani@winehq.org>
parent cc0b8336
......@@ -148,9 +148,27 @@ LONG WINAPI TTIsEmbeddingEnabledForFacename(LPCSTR facename, BOOL *enabled)
LONG WINAPI TTIsEmbeddingEnabled(HDC hDC, BOOL *enabled)
{
FIXME("(%p %p) stub\n", hDC, enabled);
if (enabled) *enabled = FALSE;
return E_API_NOTIMPL;
OUTLINETEXTMETRICA *otm;
LONG ret;
UINT len;
TRACE("(%p %p)\n", hDC, enabled);
if (!hDC)
return E_HDCINVALID;
len = GetOutlineTextMetricsA(hDC, 0, NULL);
if (!len)
return E_ERRORACCESSINGFACENAME;
otm = HeapAlloc(GetProcessHeap(), 0, len);
if (!otm)
return E_NOFREEMEMORY;
GetOutlineTextMetricsA(hDC, len, otm);
ret = TTIsEmbeddingEnabledForFacename(otm->otmpFaceName, enabled);
HeapFree(GetProcessHeap(), 0, otm);
return ret;
}
LONG WINAPI TTDeleteEmbeddedFont(HANDLE hFontReference, ULONG flags, ULONG *status)
......
......@@ -98,8 +98,53 @@ static void test_TTIsEmbeddingEnabledForFacename(void)
ok(status != 123, "got %d\n", status);
}
static void test_TTIsEmbeddingEnabled(void)
{
HFONT old_font, hfont;
LONG ret, status;
LOGFONTA logfont;
HDC hdc;
ret = TTIsEmbeddingEnabled(NULL, NULL);
ok(ret == E_HDCINVALID, "got %#x\n", ret);
status = 123;
ret = TTIsEmbeddingEnabled(NULL, &status);
ok(ret == E_HDCINVALID, "got %#x\n", ret);
ok(status == 123, "got %d\n", status);
hdc = CreateCompatibleDC(0);
ret = TTIsEmbeddingEnabled(hdc, NULL);
ok(ret == E_ERRORACCESSINGFACENAME, "got %#x\n", ret);
status = 123;
ret = TTIsEmbeddingEnabled(hdc, &status);
ok(ret == E_ERRORACCESSINGFACENAME, "got %#x\n", ret);
ok(status == 123, "got %u\n", status);
memset(&logfont, 0, sizeof(logfont));
logfont.lfHeight = 12;
logfont.lfWeight = FW_NORMAL;
strcpy(logfont.lfFaceName, "Tahoma");
hfont = CreateFontIndirectA(&logfont);
ok(hfont != NULL, "got %p\n", hfont);
old_font = SelectObject(hdc, hfont);
status = 123;
ret = TTIsEmbeddingEnabled(hdc, &status);
ok(ret == E_NONE, "got %#x\n", ret);
ok(status != 123, "got %u\n", status);
SelectObject(hdc, old_font);
DeleteObject(hfont);
DeleteDC(hdc);
}
START_TEST(t2embed)
{
test_TTGetEmbeddingType();
test_TTIsEmbeddingEnabledForFacename();
test_TTIsEmbeddingEnabled();
}
......@@ -40,8 +40,10 @@ extern "C" {
#define E_NONE __MSABI_LONG(0x0000)
#define E_API_NOTIMPL __MSABI_LONG(0x0001)
#define E_HDCINVALID __MSABI_LONG(0x0006)
#define E_NOFREEMEMORY __MSABI_LONG(0x0007)
#define E_NOTATRUETYPEFONT __MSABI_LONG(0x000a)
#define E_ERRORACCESSINGFONTDATA __MSABI_LONG(0x000c)
#define E_ERRORACCESSINGFACENAME __MSABI_LONG(0x000d)
#define E_FACENAMEINVALID __MSABI_LONG(0x0113)
#define E_PERMISSIONSINVALID __MSABI_LONG(0x0117)
#define E_PBENABLEDINVALID __MSABI_LONG(0x0118)
......@@ -75,6 +77,7 @@ LONG WINAPI TTDeleteEmbeddedFont(HANDLE,ULONG,ULONG*);
LONG WINAPI TTGetEmbeddingType(HDC, ULONG*);
LONG WINAPI TTIsEmbeddingEnabledForFacename(LPCSTR facename, BOOL *enabled);
LONG WINAPI TTIsEmbeddingEnabled(HDC hdc, BOOL *enabled);
#ifdef __cplusplus
}
......
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