ReactOS 0.4.17-dev-972-gd004b2c
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
31LONG WINAPI TTLoadEmbeddedFont(HANDLE *phFontReference, ULONG ulFlags,
32 ULONG *pulPrivStatus, ULONG ulPrivs,
33 ULONG *pulStatus, READEMBEDPROC lpfnReadFromStream,
34 LPVOID lpvReadStream, LPWSTR szWinFamilyName,
35 LPSTR szMacFamilyName, TTLOADINFO *pTTLoadInfo)
36{
37 FIXME("%p, %#lx, %p, %lu, %p, %p, %p, %s, %s, %p stub\n", phFontReference,
38 ulFlags, pulPrivStatus, ulPrivs, pulStatus, lpfnReadFromStream,
39 lpvReadStream, debugstr_w(szWinFamilyName), szMacFamilyName,
40 pTTLoadInfo);
41
42 return E_API_NOTIMPL;
43}
44
45LONG WINAPI TTEmbedFont(HDC hDC, ULONG ulFlags, ULONG ulCharSet, ULONG *pulPrivStatus,
46 ULONG *pulStatus, WRITEEMBEDPROC lpfnWriteToStream, LPVOID lpvWriteStream,
47 USHORT *pusCharCodeSet, USHORT usCharCodeCount, USHORT usLanguage,
48 TTEMBEDINFO *pTTEmbedInfo)
49{
50 FIXME("%p, %#lx, %lu, %p, %p, %p, %p, %p, %u, %u, %p stub\n", hDC,
51 ulFlags, ulCharSet, pulPrivStatus, pulStatus, lpfnWriteToStream,
52 lpvWriteStream, pusCharCodeSet, usCharCodeCount, usLanguage,
53 pTTEmbedInfo);
54
55 return E_API_NOTIMPL;
56}
57
59{
61 WORD fsType;
62
63 TRACE("(%p %p)\n", hDC, status);
64
65 if (!hDC)
66 return E_HDCINVALID;
67
68 otm.otmSize = sizeof(otm);
69 if (!GetOutlineTextMetricsW(hDC, otm.otmSize, &otm))
70 return E_NOTATRUETYPEFONT;
71
72 if (!status)
74
75 otm.otmfsType = (fsType = otm.otmfsType) & 0xf;
78 else if (otm.otmfsType & LICENSE_EDITABLE)
80 else if (otm.otmfsType & LICENSE_PREVIEWPRINT)
82 else if (otm.otmfsType & LICENSE_NOEMBEDDING)
84 else
85 {
86 WARN("unrecognized flags, %#x\n", otm.otmfsType);
88 }
89
90 TRACE("fsType 0x%04x, status %lu\n", fsType, *status);
91 return E_NONE;
92}
93
95{
97 HKEY hkey;
98 LONG ret;
99
100 TRACE("(%s %p)\n", debugstr_a(facename), enabled);
101
102 if (!facename)
103 return E_FACENAMEINVALID;
104
105 if (!enabled)
106 return E_PBENABLEDINVALID;
107
108 *enabled = TRUE;
109 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Shared Tools\\t2embed", 0, GENERIC_READ, &hkey))
110 goto out;
111
112 *enabled = TRUE;
114 index = 0;
115 while (ret != ERROR_NO_MORE_ITEMS)
116 {
117 DWORD name_len, value_len, value, type;
119
120 name_len = ARRAY_SIZE(name);
121 value_len = sizeof(value);
122 ret = RegEnumValueA(hkey, index++, name, &name_len, NULL, &type, (BYTE*)&value, &value_len);
123 if (ret || type != REG_DWORD)
124 continue;
125
126 if (!lstrcmpiA(name, facename))
127 {
128 *enabled = !!value;
129 break;
130 }
131 }
132 RegCloseKey(hkey);
133
134out:
135 TRACE("embedding %s for %s\n", *enabled ? "enabled" : "disabled", debugstr_a(facename));
136 return E_NONE;
137}
138
140{
142 LONG ret;
143 UINT len;
144
145 TRACE("(%p %p)\n", hDC, enabled);
146
147 if (!hDC)
148 return E_HDCINVALID;
149
151 if (!len)
153
154 otm = HeapAlloc(GetProcessHeap(), 0, len);
155 if (!otm)
156 return E_NOFREEMEMORY;
157
160 HeapFree(GetProcessHeap(), 0, otm);
161 return ret;
162}
163
165{
166 FIXME("%p, %#lx, %p stub\n", hFontReference, flags, status);
167 return E_API_NOTIMPL;
168}
static HDC hDC
Definition: 3dtext.c:33
#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
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 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
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4133
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:31
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:45
LONG WINAPI TTDeleteEmbeddedFont(HANDLE hFontReference, ULONG flags, ULONG *status)
Definition: main.c:164
LONG WINAPI TTGetEmbeddingType(HDC hDC, ULONG *status)
Definition: main.c:58
LONG WINAPI TTIsEmbeddingEnabledForFacename(LPCSTR facename, BOOL *enabled)
Definition: main.c:94
LONG WINAPI TTIsEmbeddingEnabled(HDC hDC, BOOL *enabled)
Definition: main.c:139
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
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
unsigned int UINT
Definition: sysinfo.c:13
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
static HDC
Definition: imagelist.c:88
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
char CHAR
Definition: pedump.c:57
#define REG_DWORD
Definition: sdbapi.c:615
#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
const char * LPCSTR
Definition: typedefs.h:52
uint16_t * LPWSTR
Definition: typedefs.h:56
char * LPSTR
Definition: typedefs.h:51
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:64
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#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
unsigned char BYTE
Definition: xxhash.c:193