t2embed: Implement TTGetEmbeddingType().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-03-30 13:00:26 +03:00 committed by Alexandre Julliard
parent 5bec183195
commit 12fbfe838c
7 changed files with 122 additions and 5 deletions

3
configure vendored
View File

@ -17969,7 +17969,8 @@ wine_fn_config_dll svrapi enable_svrapi
wine_fn_config_dll sxs enable_sxs implib
wine_fn_config_test dlls/sxs/tests sxs_test
wine_fn_config_dll system.drv16 enable_win16
wine_fn_config_dll t2embed enable_t2embed
wine_fn_config_dll t2embed enable_t2embed implib
wine_fn_config_test dlls/t2embed/tests t2embed_test
wine_fn_config_dll tapi32 enable_tapi32 implib
wine_fn_config_dll taskschd enable_taskschd clean
wine_fn_config_test dlls/taskschd/tests taskschd_test

View File

@ -3266,7 +3266,8 @@ WINE_CONFIG_DLL(svrapi)
WINE_CONFIG_DLL(sxs,,[implib])
WINE_CONFIG_TEST(dlls/sxs/tests)
WINE_CONFIG_DLL(system.drv16,enable_win16)
WINE_CONFIG_DLL(t2embed)
WINE_CONFIG_DLL(t2embed,,[implib])
WINE_CONFIG_TEST(dlls/t2embed/tests)
WINE_CONFIG_DLL(tapi32,,[implib])
WINE_CONFIG_DLL(taskschd,,[clean])
WINE_CONFIG_TEST(dlls/taskschd/tests)

View File

@ -1,4 +1,6 @@
MODULE = t2embed.dll
IMPORTLIB = t2embed
IMPORTS = gdi32
C_SRCS = \
main.c

View File

@ -24,6 +24,7 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "t2embapi.h"
#include "wine/debug.h"
@ -73,9 +74,30 @@ LONG WINAPI TTEmbedFont(HDC hDC, ULONG ulFlags, ULONG ulCharSet, ULONG *pulPrivS
LONG WINAPI TTGetEmbeddingType(HDC hDC, ULONG *status)
{
FIXME("(%p %p) stub\n", hDC, status);
if (status) *status = EMBED_NOEMBEDDING;
return E_API_NOTIMPL;
OUTLINETEXTMETRICW otm;
TRACE("(%p %p)\n", hDC, status);
if (!hDC)
return E_HDCINVALID;
otm.otmSize = sizeof(otm);
if (!GetOutlineTextMetricsW(hDC, otm.otmSize, &otm))
return E_NOTATRUETYPEFONT;
if (!status)
return E_PERMISSIONSINVALID;
if (otm.otmfsType == LICENSE_INSTALLABLE)
*status = EMBED_INSTALLABLE;
else if (otm.otmfsType & LICENSE_NOEMBEDDING)
*status = EMBED_NOEMBEDDING;
else if (otm.otmfsType & LICENSE_PREVIEWPRINT)
*status = EMBED_PREVIEWPRINT;
else if (otm.otmfsType & LICENSE_EDITABLE)
*status = EMBED_EDITABLE;
return E_NONE;
}
LONG WINAPI TTIsEmbeddingEnabled(HDC hDC, BOOL *enabled)

View File

@ -0,0 +1,5 @@
TESTDLL = t2embed.dll
IMPORTS = gdi32 t2embed
C_SRCS = \
t2embed.c

View File

@ -0,0 +1,82 @@
/*
* Copyright 2016 Nikolay Sivov for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "windef.h"
#include "wingdi.h"
#include "t2embapi.h"
#include "wine/test.h"
static void test_TTGetEmbeddingType(void)
{
HFONT hfont, old_font;
LOGFONTA logfont;
ULONG status;
LONG ret;
HDC hdc;
ret = TTGetEmbeddingType(NULL, NULL);
ok(ret == E_HDCINVALID, "got %d\n", ret);
status = 0xdeadbeef;
ret = TTGetEmbeddingType(NULL, &status);
ok(ret == E_HDCINVALID, "got %#x\n", ret);
ok(status == 0xdeadbeef, "got %u\n", status);
status = 0xdeadbeef;
ret = TTGetEmbeddingType((HDC)0xdeadbeef, &status);
ok(ret == E_NOTATRUETYPEFONT || broken(ret == E_ERRORACCESSINGFONTDATA) /* xp, vista */, "got %#x\n", ret);
ok(status == 0xdeadbeef, "got %u\n", status);
hdc = CreateCompatibleDC(0);
ret = TTGetEmbeddingType(hdc, NULL);
ok(ret == E_NOTATRUETYPEFONT, "got %#x\n", ret);
status = 0xdeadbeef;
ret = TTGetEmbeddingType(hdc, &status);
ok(ret == E_NOTATRUETYPEFONT, "got %#x\n", ret);
ok(status == 0xdeadbeef, "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 = 0;
ret = TTGetEmbeddingType(hdc, &status);
ok(ret == E_NONE, "got %#x\n", ret);
ok(status != 0, "got %u\n", status);
ret = TTGetEmbeddingType(hdc, NULL);
ok(ret == E_PERMISSIONSINVALID, "got %#x\n", ret);
SelectObject(hdc, old_font);
DeleteObject(hfont);
DeleteDC(hdc);
}
START_TEST(t2embed)
{
test_TTGetEmbeddingType();
}

View File

@ -39,6 +39,10 @@ extern "C" {
/* Possible return values. */
#define E_NONE __MSABI_LONG(0x0000)
#define E_API_NOTIMPL __MSABI_LONG(0x0001)
#define E_HDCINVALID __MSABI_LONG(0x0006)
#define E_NOTATRUETYPEFONT __MSABI_LONG(0x000a)
#define E_ERRORACCESSINGFONTDATA __MSABI_LONG(0x000c)
#define E_PERMISSIONSINVALID __MSABI_LONG(0x0117)
typedef ULONG (WINAPIV * READEMBEDPROC)(void*,void*,ULONG);
typedef ULONG (WINAPIV * WRITEEMBEDPROC)(void*,void*,ULONG);