Author: tkreuzer Date: Sun May 29 14:23:37 2011 New Revision: 51994
URL: http://svn.reactos.org/svn/reactos?rev=51994&view=rev Log: [WIN32K] - Finish implementation of EngLoadFontFile and EngLoadFontFileFD except checksum support - Fix a typo noticed by Amine
Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fntdrvsup.c branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fontrsrc.c branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/textmetric.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/subsyste... ============================================================================== --- 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] Sun May 29 14:23:37 2011 @@ -58,9 +58,9 @@ gbAttachedCSRSS = FALSE; }
- -ULONG_PTR -FONTDEV_LoadFontFile( +static +HFF +FONTDEV_hffLoadFontFile( PFONTDEV pfntdev, ULONG cFiles, ULONG_PTR *piFile, @@ -88,56 +88,70 @@
}
-#if 0 +HFF +NTAPI EngLoadFontFileFD( - PPFF ppff, + ULONG cFiles, + PULONG_PTR piFiles, + DESIGNVECTOR *pdv, + ULONG ulCheckSum, + HDEV *phdev) { KAPC_STATE ApcState; - ULONG_PTR aiFile[FD_MAX_FILES]; PVOID apvView[FD_MAX_FILES]; ULONG acjView[FD_MAX_FILES]; - ULONG ulLangID = 0; + ULONG i, ulLangID = 0; + PFONTDEV pfntdev; + PLIST_ENTRY ple; HFF hff = 0;
/* Loop all files */ - for (i = 0; i < ppff->cFiles; i++) - { - /* Setup the file array */ - aiFile[i] = (ULONG_PTR)ppff->ppfv[i]; - + for (i = 0; i < cFiles; i++) + { /* Map the font file */ - bResult = EngMapFontFileFD(aiFile[i], &apvView[i], &acjView[i]); + if (!EngMapFontFileFD(piFiles[i], (PULONG*)&apvView[i], &acjView[i])) + { + ASSERT(FALSE); + } }
/* Attach to CSRSS */ AttachCSRSS(&ApcState);
+ /* Acquire font friver list lock */ + EngAcquireSemaphore(ghsemFontDriver); + /* Loop all installed font drivers */ - for (pfntdev = gleFontDriverList.Flink; - pfntdev != &gleFontDriverList; - pfntdev = pfntdev->leLink.Flink) - { + for (ple = gleFontDriverList.Flink; + ple != &gleFontDriverList; + ple = ple->Flink) + { + pfntdev = CONTAINING_RECORD(ple, FONTDEV, leLink); + /* Try to load the font file */ - hff = FONTDEV_LoadFontFile(pfntdev, - cFiles, - aiFile, - apvView, - acjView, - pdv, - ulLangID, - ppff->ulCheckSum); + hff = FONTDEV_hffLoadFontFile(pfntdev, + cFiles, + piFiles, + apvView, + acjView, + pdv, + ulLangID, + ulCheckSum); if (hff) { - ppff->hff = hff; + *phdev = (HDEV)pfntdev; break; } }
+ /* Release font friver list lock */ + EngReleaseSemaphore(ghsemFontDriver); + /* Detach from CSRSS */ - DetachCSRSS(&ApcState) - -} -#endif + DetachCSRSS(&ApcState); + + return hff; +}
BOOL EngLoadFontDriver(
Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fontrsrc.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyste... ============================================================================== --- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fontrsrc.c [iso-8859-1] (original) +++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fontrsrc.c [iso-8859-1] Sun May 29 14:23:37 2011 @@ -32,7 +32,7 @@ for (i = 0; i < cFiles; i++) { /* Check if the files match */ - if (pffv[i] != ppff->ppfv[i]) return FALSE; + if (pffv[i] != ppff->apffv[i]) return FALSE; }
return TRUE; @@ -41,13 +41,16 @@ PPFF NTAPI EngLoadFontFile( + IN ULONG cFiles, IN PWCHAR apwszFiles[], - IN ULONG cFiles) + IN DESIGNVECTOR *pdv) { PFONTFILEVIEW apffv[FD_MAX_FILES]; PLIST_ENTRY ple; - PPFF ppff; - ULONG i, cjSize; + PPFF ppff = NULL; + ULONG i, cjSize, ulChecksum = 0; + HDEV hdev; + HFF hff;
/* Loop the files */ for (i = 0; i < cFiles; i++) @@ -79,8 +82,17 @@ } }
+ /* Load the font with any of the font drivers */ + hff = EngLoadFontFileFD(cFiles, (PULONG_PTR)apffv, pdv, ulChecksum, &hdev); + if (!hff) + { + DPRINT1("File format is not supported by any font driver\n"); + while (i--) EngFreeModule(apffv[i]); + goto leave; + } + /* Allocate a new PFF */ - cjSize = sizeof(PFF) + cFiles * sizeof(PVOID); + cjSize = sizeof(PFF); ppff = EngAllocMem(0, cjSize, 'ffpG'); if (!ppff) { @@ -89,10 +101,11 @@
ppff->sizeofThis = cjSize; ppff->cFiles = cFiles; - ppff->ppfv = (PVOID)(ppff + 1); + ppff->hdev = hdev; + ppff->hff = hff;
/* Copy the FONTFILEVIEWs */ - for (i = 0; i < cFiles; i++) ppff->ppfv[i] = apffv[i]; + for (i = 0; i < cFiles; i++) ppff->apffv[i] = apffv[i];
/* Insert the PFF into the list */ InsertTailList(&glePFFList, &ppff->leLink); @@ -186,8 +199,10 @@ INT iRes = 0;
/* Check parameters */ - if (cFiles > FD_MAX_FILES || cwc < 3 || cwc > FD_MAX_FILES * MAX_PATH) - { + if (cFiles == 0 || cFiles > FD_MAX_FILES || + cwc < 6 || cwc > FD_MAX_FILES * MAX_PATH) + { + EngSetLastError(ERROR_INVALID_PARAMETER); return 0; }
@@ -195,6 +210,7 @@ pvBuffer = EngAllocMem(0, (cwc + 1) * sizeof(WCHAR), 'pmTG'); if (!pvBuffer) { + EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); return 0; }
Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/textmetric.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyste... ============================================================================== --- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/textmetric.c [iso-8859-1] (original) +++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/textmetric.c [iso-8859-1] Sun May 29 14:23:37 2011 @@ -59,7 +59,7 @@
/* Unlock the DC and return */ DC_UnlockDc(pdc); - return bResult;; + return bResult; }
W32KAPI
Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/font.h URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyste... ============================================================================== --- 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] Sun May 29 14:23:37 2011 @@ -36,8 +36,8 @@ struct _PFT *pPFT; ULONG ulCheckSum; ULONG cFonts; - PFONTFILEVIEW *ppfv; void *pPvtDataHead; + PFONTFILEVIEW apffv[FD_MAX_FILES]; } PFF, *PPFF;
typedef struct _PFE @@ -206,7 +206,6 @@ }
- HFONT NTAPI GreHfontCreate( @@ -216,3 +215,15 @@ IN FLONG fl, IN PVOID pvCliData);
+PRFONT +NTAPI +DC_prfnt(PDC pdc); + +HFF +NTAPI +EngLoadFontFileFD( + ULONG cFiles, + PULONG_PTR piFiles, + DESIGNVECTOR *pdv, + ULONG ulCheckSum, + HDEV *phdev);