Author: tkreuzer
Date: Wed Sep 5 23:32:37 2007
New Revision: 28883
URL:
http://svn.reactos.org/svn/reactos?rev=28883&view=rev
Log:
New implementation of EnumFontFamiliesExW, based on NtGdiEnumFontXxx, does not work on
ros, because those apis are not implemented yet, but it works on Windows XP.
Modified:
trunk/reactos/dll/win32/gdi32/objects/font.c
Modified: trunk/reactos/dll/win32/gdi32/objects/font.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/fo…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/font.c (original)
+++ trunk/reactos/dll/win32/gdi32/objects/font.c Wed Sep 5 23:32:37 2007
@@ -1310,6 +1310,70 @@
#endif
}
-
-
-
+#define EfdFontFamilies 3
+
+INT
+STDCALL
+NewEnumFontFamiliesExW(
+ HDC hDC,
+ LPLOGFONTW lpLogfont,
+ FONTENUMPROCW lpEnumFontFamExProcW,
+ LPARAM lParam,
+ DWORD dwFlags)
+{
+ ULONG_PTR idEnum, ulCount, ulSize;
+ PENUMFONTDATAW pEfdw;
+ PBYTE pBuffer;
+ PBYTE pMax;
+ INT ret = 1;
+
+ idEnum = NtGdiEnumFontOpen(hDC,
+ EfdFontFamilies,
+ 0,
+ LF_FACESIZE,
+ lpLogfont->lfFaceName,
+ lpLogfont->lfCharSet,
+ &ulCount);
+ if (idEnum == 0)
+ {
+ return 0;
+ }
+ if (ulCount == 0)
+ {
+ NtGdiEnumFontClose(idEnum);
+ return 0;
+ }
+
+ pBuffer = HeapAlloc(GetProcessHeap(), 0, ulCount);
+ if (pBuffer == NULL)
+ {
+ NtGdiEnumFontClose(idEnum);
+ return 0;
+ }
+ pMax = pBuffer + ulCount;
+
+ if (!NtGdiEnumFontChunk(hDC, idEnum, ulCount, &ulSize, (PVOID)pBuffer))
+ {
+ HeapFree(GetProcessHeap(), 0, pBuffer);
+ NtGdiEnumFontClose(idEnum);
+ return 0;
+ }
+
+ /* Iterate through the structures */
+ for (pEfdw = (PENUMFONTDATAW)pBuffer;
+ (PBYTE)pEfdw < pMax && pEfdw->cbSize != 0 && ret != 0;
+ pEfdw = (PENUMFONTDATAW)((PBYTE)pEfdw + pEfdw->cbSize))
+ {
+ ENUMLOGFONTEXW *pElfew = &pEfdw->efdi.elfex;
+ NEWTEXTMETRICEXW *pNtmew = (NEWTEXTMETRICEXW*)((PBYTE)&pEfdw->efdi +
pEfdw->efdi.cbSize + sizeof(DWORD)); // FIXME
+ DWORD dwFontType = pEfdw->efdi.dwFontType;
+ ret = lpEnumFontFamExProcW(pElfew, pNtmew, dwFontType, lParam);
+ }
+
+ HeapFree(GetProcessHeap(), 0, pBuffer);
+ NtGdiEnumFontClose(idEnum);
+
+ return ret;
+}
+
+