t2embed: Fix embedding type resolution order.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8fbaeb3058
commit
8be1357bd5
|
@ -33,7 +33,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(t2embed);
|
|||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
|
||||
switch (fdwReason)
|
||||
{
|
||||
case DLL_WINE_PREATTACH:
|
||||
|
@ -89,14 +88,20 @@ LONG WINAPI TTGetEmbeddingType(HDC hDC, ULONG *status)
|
|||
if (!status)
|
||||
return E_PERMISSIONSINVALID;
|
||||
|
||||
otm.otmfsType &= 0xf;
|
||||
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;
|
||||
else if (otm.otmfsType & LICENSE_PREVIEWPRINT)
|
||||
*status = EMBED_PREVIEWPRINT;
|
||||
else if (otm.otmfsType & LICENSE_NOEMBEDDING)
|
||||
*status = EMBED_NOEMBEDDING;
|
||||
else
|
||||
{
|
||||
WARN("unrecognized flags, %#x\n", otm.otmfsType);
|
||||
*status = EMBED_INSTALLABLE;
|
||||
}
|
||||
|
||||
return E_NONE;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TESTDLL = t2embed.dll
|
||||
IMPORTS = gdi32 t2embed
|
||||
IMPORTS = user32 gdi32 t2embed
|
||||
|
||||
C_SRCS = \
|
||||
t2embed.c
|
||||
|
|
|
@ -19,10 +19,59 @@
|
|||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "t2embapi.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
static int CALLBACK enum_font_proc(ENUMLOGFONTEXA *enumlf, NEWTEXTMETRICEXA *ntm, DWORD type, LPARAM lParam)
|
||||
{
|
||||
OUTLINETEXTMETRICA otm;
|
||||
HDC hdc = GetDC(NULL);
|
||||
HFONT hfont, old_font;
|
||||
ULONG status;
|
||||
LONG ret;
|
||||
|
||||
hfont = CreateFontIndirectA(&enumlf->elfLogFont);
|
||||
old_font = SelectObject(hdc, hfont);
|
||||
|
||||
otm.otmSize = sizeof(otm);
|
||||
if (GetOutlineTextMetricsA(hdc, otm.otmSize, &otm))
|
||||
{
|
||||
ULONG expected = 0xffff;
|
||||
UINT fsType = otm.otmfsType & 0xf;
|
||||
|
||||
ret = TTGetEmbeddingType(hdc, &status);
|
||||
ok(ret == E_NONE, "got %d\n", ret);
|
||||
|
||||
if (fsType == LICENSE_INSTALLABLE)
|
||||
expected = EMBED_INSTALLABLE;
|
||||
else if (fsType & LICENSE_EDITABLE)
|
||||
expected = EMBED_EDITABLE;
|
||||
else if (fsType & LICENSE_PREVIEWPRINT)
|
||||
expected = EMBED_PREVIEWPRINT;
|
||||
else if (fsType & LICENSE_NOEMBEDDING)
|
||||
expected = EMBED_NOEMBEDDING;
|
||||
|
||||
ok(expected == status, "%s: status %d, expected %d, fsType %#x\n", enumlf->elfLogFont.lfFaceName, status,
|
||||
expected, otm.otmfsType);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = 0xdeadbeef;
|
||||
ret = TTGetEmbeddingType(hdc, &status);
|
||||
ok(ret == E_NOTATRUETYPEFONT, "%s: got %d\n", enumlf->elfLogFont.lfFaceName, ret);
|
||||
ok(status == 0xdeadbeef, "%s: got status %d\n", enumlf->elfLogFont.lfFaceName, status);
|
||||
}
|
||||
|
||||
SelectObject(hdc, old_font);
|
||||
DeleteObject(hfont);
|
||||
ReleaseDC(NULL, hdc);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void test_TTGetEmbeddingType(void)
|
||||
{
|
||||
HFONT hfont, old_font;
|
||||
|
@ -73,6 +122,12 @@ static void test_TTGetEmbeddingType(void)
|
|||
|
||||
SelectObject(hdc, old_font);
|
||||
DeleteObject(hfont);
|
||||
|
||||
/* repeat for all system fonts */
|
||||
logfont.lfCharSet = DEFAULT_CHARSET;
|
||||
logfont.lfFaceName[0] = 0;
|
||||
EnumFontFamiliesExA(hdc, &logfont, (FONTENUMPROCA)enum_font_proc, 0, 0);
|
||||
|
||||
DeleteDC(hdc);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue