[ros-diffs] [tkreuzer] 56062: [WIN32K] Implement NtGdiGetFontData / PFE_ulQueryTrueTypeTable

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Tue Mar 6 15:03:29 UTC 2012


Author: tkreuzer
Date: Tue Mar  6 15:03:28 2012
New Revision: 56062

URL: http://svn.reactos.org/svn/reactos?rev=56062&view=rev
Log:
[WIN32K]
Implement NtGdiGetFontData /  PFE_ulQueryTrueTypeTable

Modified:
    branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fntdrvsup.c
    branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fontdata.c
    branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/font.h

Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fntdrvsup.c
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fntdrvsup.c?rev=56062&r1=56061&r2=56062&view=diff
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fntdrvsup.c [iso-8859-1] (original)
+++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fntdrvsup.c [iso-8859-1] Tue Mar  6 15:03:28 2012
@@ -49,22 +49,6 @@
     ASSERT(gbAttachedCSRSS);
     KeUnstackDetachProcess(pApcState);
     gbAttachedCSRSS = FALSE;
-}
-
-VOID
-NTAPI
-RFONT_vInitDeviceMetrics(
-    PRFONT prfnt)
-{
-    PPDEVOBJ ppdev = (PPDEVOBJ)prfnt->hdevProducer;
-
-    ppdev->pldev->pfn.QueryFontData(prfnt->dhpdev,
-                                    &prfnt->fobj,
-                                    QFD_MAXEXTENTS,
-                                    -1,
-                                    NULL,
-                                    &prfnt->fddm,
-                                    sizeof(FD_DEVICEMETRICS));
 }
 
 static
@@ -113,6 +97,40 @@
     //ppfe->aiFamilyName[];
 
 }
+
+ULONG
+NTAPI
+PFE_ulQueryTrueTypeTable(
+    PPFE ppfe,
+    ULONG ulTableTag,
+    PTRDIFF dpStart,
+    ULONG cjBuffer,
+    PVOID pvBuffer)
+{
+    PPDEVOBJ ppdev = (PDEVOBJ*)ppfe->pPFF->hdev;
+    KAPC_STATE ApcState;
+    ULONG ulResult;
+
+    /* Attach to CSRSS */
+    AttachCSRSS(&ApcState);
+
+    /* Call the driver to copy the requested data */
+    ulResult = ppdev->pfn.QueryTrueTypeTable(ppfe->pPFF->hff,
+                                             ppfe->iFont,
+                                             ulTableTag,
+                                             dpStart,
+                                             cjBuffer,
+                                             pvBuffer,
+                                             NULL,
+                                             NULL);
+
+    /* Detach from CSRSS */
+    DetachCSRSS(&ApcState);
+
+    /* Return the result */
+    return ulResult;
+}
+
 
 static
 VOID

Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fontdata.c
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fontdata.c?rev=56062&r1=56061&r2=56062&view=diff
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fontdata.c [iso-8859-1] (original)
+++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fontdata.c [iso-8859-1] Tue Mar  6 15:03:28 2012
@@ -18,11 +18,75 @@
     IN HDC hdc,
     IN DWORD dwTable,
     IN DWORD dwOffset,
-    OUT OPTIONAL PVOID pvBuf,
-    IN ULONG cjBuf)
-{
-    ASSERT(FALSE);
-    return 0;
+    OUT OPTIONAL PVOID pvBuffer,
+    IN ULONG cjBuffer)
+{
+    PDC pdc;
+    PRFONT prfnt;
+    PVOID pvTempBuffer;
+    ULONG ulResult;
+
+    /* Check if the caller provides a buffer */
+    if (cjBuffer)
+    {
+        /* Must have a buffer */
+        if (!pvBuffer) return GDI_ERROR;
+
+        /* Allocate a temp buffer */
+        pvTempBuffer = ExAllocatePoolWithTag(PagedPool, cjBuffer, GDITAG_TEMP);
+        if (!pvTempBuffer)
+        {
+            return GDI_ERROR;
+        }
+    }
+    else
+    {
+        /* Don't provide a buffer */
+        pvTempBuffer = NULL;
+    }
+
+    /* Lock the DC */
+    pdc = DC_LockDc(hdc);
+    if (!pdc)
+    {
+        ulResult = GDI_ERROR;
+        goto leave;
+    }
+
+    /* Get the RFONT from the DC */
+    prfnt = DC_prfnt(pdc);
+
+    /* Query the table data */
+    ulResult = PFE_ulQueryTrueTypeTable(prfnt->ppfe,
+                                        dwTable,
+                                        dwOffset,
+                                        cjBuffer,
+                                        pvTempBuffer);
+
+    /* Copy the data back, if requested */
+    if (cjBuffer && (ulResult != GDI_ERROR))
+    {
+        _SEH2_TRY
+        {
+            /* Probe and copy the data */
+            ProbeForWrite(pvBuffer, cjBuffer, 1);
+            RtlCopyMemory(pvBuffer, pvTempBuffer, cjBuffer);
+        }
+        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+        {
+            ulResult = GDI_ERROR;
+        }
+        _SEH2_END;
+    }
+
+    /* Unlock the DC */
+    DC_UnlockDc(pdc);
+
+leave:
+    /* Free the temp buffer */
+    if (pvTempBuffer) ExFreePoolWithTag(pvTempBuffer, GDITAG_TEMP);
+
+    return ulResult;
 }
 
 W32KAPI

Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/font.h
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/font.h?rev=56062&r1=56061&r2=56062&view=diff
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/font.h [iso-8859-1] (original)
+++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/font.h [iso-8859-1] Tue Mar  6 15:03:28 2012
@@ -392,6 +392,12 @@
 NTAPI
 LFONT_ppfe(PLFONT plfnt);
 
+PRFONT
+NTAPI
+LFONT_prfntFindLinkedRFONT(
+    _In_ PLFONT plfnt,
+    _In_ PMATRIX pmxWorldToDevice);
+
 VOID
 NTAPI
 UpcaseString(
@@ -403,6 +409,15 @@
 NTAPI
 CalculateNameHash(
     PWSTR pwszName);
+
+ULONG
+NTAPI
+PFE_ulQueryTrueTypeTable(
+    PPFE ppfe,
+    ULONG ulTableTag,
+    PTRDIFF dpStart,
+    ULONG cjBuffer,
+    PVOID pvBuffer);
 
 BOOL
 NTAPI




More information about the Ros-diffs mailing list