3 * Copyright 2009 Austin English
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.
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.
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
27 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(t2embed
);
31 LONG 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
)
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
,
45 LONG 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
)
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
,
58 LONG WINAPI
TTGetEmbeddingType(HDC hDC
, ULONG
*status
)
60 OUTLINETEXTMETRICW otm
;
63 TRACE("(%p %p)\n", hDC
, status
);
68 otm
.otmSize
= sizeof(otm
);
69 if (!GetOutlineTextMetricsW(hDC
, otm
.otmSize
, &otm
))
70 return E_NOTATRUETYPEFONT
;
73 return E_PERMISSIONSINVALID
;
75 otm
.otmfsType
= (fsType
= otm
.otmfsType
) & 0xf;
76 if (otm
.otmfsType
== LICENSE_INSTALLABLE
)
77 *status
= EMBED_INSTALLABLE
;
78 else if (otm
.otmfsType
& LICENSE_EDITABLE
)
79 *status
= EMBED_EDITABLE
;
80 else if (otm
.otmfsType
& LICENSE_PREVIEWPRINT
)
81 *status
= EMBED_PREVIEWPRINT
;
82 else if (otm
.otmfsType
& LICENSE_NOEMBEDDING
)
83 *status
= EMBED_NOEMBEDDING
;
86 WARN("unrecognized flags, %#x\n", otm
.otmfsType
);
87 *status
= EMBED_INSTALLABLE
;
90 TRACE("fsType 0x%04x, status %lu\n", fsType
, *status
);
94 LONG WINAPI
TTIsEmbeddingEnabledForFacename(LPCSTR facename
, BOOL
*enabled
)
100 TRACE("(%s %p)\n", debugstr_a(facename
), enabled
);
103 return E_FACENAMEINVALID
;
106 return E_PBENABLEDINVALID
;
109 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
, L
"Software\\Microsoft\\Shared Tools\\t2embed", 0, GENERIC_READ
, &hkey
))
115 while (ret
!= ERROR_NO_MORE_ITEMS
)
117 DWORD name_len
, value_len
, value
, type
;
118 CHAR name
[LF_FACESIZE
];
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
)
126 if (!lstrcmpiA(name
, facename
))
135 TRACE("embedding %s for %s\n", *enabled
? "enabled" : "disabled", debugstr_a(facename
));
139 LONG WINAPI
TTIsEmbeddingEnabled(HDC hDC
, BOOL
*enabled
)
141 OUTLINETEXTMETRICA
*otm
;
145 TRACE("(%p %p)\n", hDC
, enabled
);
150 len
= GetOutlineTextMetricsA(hDC
, 0, NULL
);
152 return E_ERRORACCESSINGFACENAME
;
154 otm
= HeapAlloc(GetProcessHeap(), 0, len
);
156 return E_NOFREEMEMORY
;
158 GetOutlineTextMetricsA(hDC
, len
, otm
);
159 ret
= TTIsEmbeddingEnabledForFacename((LPCSTR
)otm
+ (ULONG_PTR
)otm
->otmpFaceName
, enabled
);
160 HeapFree(GetProcessHeap(), 0, otm
);
164 LONG WINAPI
TTDeleteEmbeddedFont(HANDLE hFontReference
, ULONG flags
, ULONG
*status
)
166 FIXME("%p, %#lx, %p stub\n", hFontReference
, flags
, status
);
167 return E_API_NOTIMPL
;