ReactOS 0.4.16-dev-981-g80eb313
main.c
Go to the documentation of this file.
1/*
2 *
3 * Copyright 2009 Austin English
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#include <stdarg.h>
21
22#include "windef.h"
23#include "winbase.h"
24#include "wingdi.h"
25#include "winreg.h"
26#include "t2embapi.h"
27#include "wine/debug.h"
28
30
32{
33 switch (fdwReason)
34 {
35#ifndef __REACTOS__
36 case DLL_WINE_PREATTACH:
37 return FALSE; /* prefer native version */
38#endif
41 break;
42 }
43
44 return TRUE;
45}
46
47LONG WINAPI TTLoadEmbeddedFont(HANDLE *phFontReference, ULONG ulFlags,
48 ULONG *pulPrivStatus, ULONG ulPrivs,
49 ULONG *pulStatus, READEMBEDPROC lpfnReadFromStream,
50 LPVOID lpvReadStream, LPWSTR szWinFamilyName,
51 LPSTR szMacFamilyName, TTLOADINFO *pTTLoadInfo)
52{
53 FIXME("(%p 0x%08x %p 0x%08x %p %p %p %s %s %p) stub\n", phFontReference,
54 ulFlags, pulPrivStatus, ulPrivs, pulStatus, lpfnReadFromStream,
55 lpvReadStream, debugstr_w(szWinFamilyName), szMacFamilyName,
56 pTTLoadInfo);
57
58 return E_API_NOTIMPL;
59}
60
61LONG WINAPI TTEmbedFont(HDC hDC, ULONG ulFlags, ULONG ulCharSet, ULONG *pulPrivStatus,
62 ULONG *pulStatus, WRITEEMBEDPROC lpfnWriteToStream, LPVOID lpvWriteStream,
63 USHORT *pusCharCodeSet, USHORT usCharCodeCount, USHORT usLanguage,
64 TTEMBEDINFO *pTTEmbedInfo)
65{
66 FIXME("(%p 0x%08x 0x%08x %p %p %p %p %p %u %u %p) stub\n", hDC,
67 ulFlags, ulCharSet, pulPrivStatus, pulStatus, lpfnWriteToStream,
68 lpvWriteStream, pusCharCodeSet, usCharCodeCount, usLanguage,
69 pTTEmbedInfo);
70
71 return E_API_NOTIMPL;
72}
73
75{
77 WORD fsType;
78
79 TRACE("(%p %p)\n", hDC, status);
80
81 if (!hDC)
82 return E_HDCINVALID;
83
84 otm.otmSize = sizeof(otm);
85 if (!GetOutlineTextMetricsW(hDC, otm.otmSize, &otm))
86 return E_NOTATRUETYPEFONT;
87
88 if (!status)
90
91 otm.otmfsType = (fsType = otm.otmfsType) & 0xf;
94 else if (otm.otmfsType & LICENSE_EDITABLE)
96 else if (otm.otmfsType & LICENSE_PREVIEWPRINT)
98 else if (otm.otmfsType & LICENSE_NOEMBEDDING)
100 else
101 {
102 WARN("unrecognized flags, %#x\n", otm.otmfsType);
104 }
105
106 TRACE("fsType 0x%04x, status %u\n", fsType, *status);
107 return E_NONE;
108}
109
111{
112 static const WCHAR exclusionlistW[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
113 'S','h','a','r','e','d',' ','T','o','o','l','s','\\','t','2','e','m','b','e','d',0};
114 DWORD index;
115 HKEY hkey;
116 LONG ret;
117
118 TRACE("(%s %p)\n", debugstr_a(facename), enabled);
119
120 if (!facename)
121 return E_FACENAMEINVALID;
122
123 if (!enabled)
124 return E_PBENABLEDINVALID;
125
126 *enabled = TRUE;
127 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, exclusionlistW, 0, GENERIC_READ, &hkey))
128 goto out;
129
130 *enabled = TRUE;
132 index = 0;
133 while (ret != ERROR_NO_MORE_ITEMS)
134 {
135 DWORD name_len, value_len, value, type;
137
138 name_len = ARRAY_SIZE(name);
139 value_len = sizeof(value);
140 ret = RegEnumValueA(hkey, index++, name, &name_len, NULL, &type, (BYTE*)&value, &value_len);
141 if (ret || type != REG_DWORD)
142 continue;
143
144 if (!lstrcmpiA(name, facename))
145 {
146 *enabled = !!value;
147 break;
148 }
149 }
150 RegCloseKey(hkey);
151
152out:
153 TRACE("embedding %s for %s\n", *enabled ? "enabled" : "disabled", debugstr_a(facename));
154 return E_NONE;
155}
156
158{
160 LONG ret;
161 UINT len;
162
163 TRACE("(%p %p)\n", hDC, enabled);
164
165 if (!hDC)
166 return E_HDCINVALID;
167
169 if (!len)
171
172 otm = HeapAlloc(GetProcessHeap(), 0, len);
173 if (!otm)
174 return E_NOFREEMEMORY;
175
178 HeapFree(GetProcessHeap(), 0, otm);
179 return ret;
180}
181
183{
184 FIXME("(%p 0x%08x %p) stub\n", hFontReference, flags, status);
185 return E_API_NOTIMPL;
186}
static HDC hDC
Definition: 3dtext.c:33
static DWORD const fdwReason
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define index(s, c)
Definition: various.h:29
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define LF_FACESIZE
Definition: dimm.idl:39
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
Definition: main.c:26
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegEnumValueA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpdwReserved, _Out_opt_ LPDWORD lpdwType, _Out_opt_ LPBYTE lpData, _Inout_opt_ LPDWORD lpcbData)
Definition: reg.c:2668
#define GetProcessHeap()
Definition: compat.h:736
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define HeapAlloc
Definition: compat.h:733
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define GENERIC_READ
Definition: compat.h:135
#define HeapFree(x, y, z)
Definition: compat.h:735
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4224
LONG WINAPI TTLoadEmbeddedFont(HANDLE *phFontReference, ULONG ulFlags, ULONG *pulPrivStatus, ULONG ulPrivs, ULONG *pulStatus, READEMBEDPROC lpfnReadFromStream, LPVOID lpvReadStream, LPWSTR szWinFamilyName, LPSTR szMacFamilyName, TTLOADINFO *pTTLoadInfo)
Definition: main.c:47
LONG WINAPI TTEmbedFont(HDC hDC, ULONG ulFlags, ULONG ulCharSet, ULONG *pulPrivStatus, ULONG *pulStatus, WRITEEMBEDPROC lpfnWriteToStream, LPVOID lpvWriteStream, USHORT *pusCharCodeSet, USHORT usCharCodeCount, USHORT usLanguage, TTEMBEDINFO *pTTEmbedInfo)
Definition: main.c:61
LONG WINAPI TTDeleteEmbeddedFont(HANDLE hFontReference, ULONG flags, ULONG *status)
Definition: main.c:182
LONG WINAPI TTGetEmbeddingType(HDC hDC, ULONG *status)
Definition: main.c:74
LONG WINAPI TTIsEmbeddingEnabledForFacename(LPCSTR facename, BOOL *enabled)
Definition: main.c:110
LONG WINAPI TTIsEmbeddingEnabled(HDC hDC, BOOL *enabled)
Definition: main.c:157
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
GLuint index
Definition: glext.h:6031
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
static IN DWORD IN LPVOID lpvReserved
static HDC
Definition: imagelist.c:88
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define REG_DWORD
Definition: sdbapi.c:596
#define TRACE(s)
Definition: solgame.cpp:4
Definition: name.c:39
Definition: ps.c:97
#define E_NOTATRUETYPEFONT
Definition: t2embapi.h:50
unsigned long(WINAPIV * READEMBEDPROC)(void *lpvReadStream, void *lpvBuffer, const unsigned long cbBuffer)
Definition: t2embapi.h:121
#define EMBED_INSTALLABLE
Definition: t2embapi.h:14
#define E_NONE
Definition: t2embapi.h:38
#define E_PERMISSIONSINVALID
Definition: t2embapi.h:87
#define E_API_NOTIMPL
Definition: t2embapi.h:41
#define LICENSE_INSTALLABLE
Definition: t2embapi.h:19
#define LICENSE_EDITABLE
Definition: t2embapi.h:23
#define E_ERRORACCESSINGFACENAME
Definition: t2embapi.h:52
#define LICENSE_NOEMBEDDING
Definition: t2embapi.h:21
#define E_HDCINVALID
Definition: t2embapi.h:47
#define E_NOFREEMEMORY
Definition: t2embapi.h:48
#define LICENSE_PREVIEWPRINT
Definition: t2embapi.h:22
#define EMBED_PREVIEWPRINT
Definition: t2embapi.h:12
unsigned long(WINAPIV * WRITEEMBEDPROC)(void *lpvWriteStream, const void *lpvBuffer, const unsigned long cbBuffer)
Definition: t2embapi.h:114
#define E_FACENAMEINVALID
Definition: t2embapi.h:83
#define EMBED_NOEMBEDDING
Definition: t2embapi.h:15
#define EMBED_EDITABLE
Definition: t2embapi.h:13
#define E_PBENABLEDINVALID
Definition: t2embapi.h:88
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:96
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
int ret
#define WINAPI
Definition: msvc.h:6
UINT WINAPI GetOutlineTextMetricsA(_In_ HDC hdc, _In_ UINT cjCopy, _Out_writes_bytes_opt_(cjCopy) LPOUTLINETEXTMETRICA potm)
UINT WINAPI GetOutlineTextMetricsW(_In_ HDC hdc, _In_ UINT cjCopy, _Out_writes_bytes_opt_(cjCopy) LPOUTLINETEXTMETRICW potm)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193