Author: tkreuzer
Date: Tue Mar 10 07:12:27 2009
New Revision: 39930
URL:
http://svn.reactos.org/svn/reactos?rev=39930&view=rev
Log:
Initial code for freetype font driver
Added:
trunk/reactos/dll/3rdparty/freetype/ftfd/ (with props)
trunk/reactos/dll/3rdparty/freetype/ftfd/enable.c (with props)
trunk/reactos/dll/3rdparty/freetype/ftfd/font.c (with props)
trunk/reactos/dll/3rdparty/freetype/ftfd/ftfd.h (with props)
trunk/reactos/dll/3rdparty/freetype/ftfd/glyph.c (with props)
Propchange: trunk/reactos/dll/3rdparty/freetype/ftfd/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Tue Mar 10 07:12:27 2009
@@ -1,0 +1,2 @@
+([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))?
+(\d+)
Propchange: trunk/reactos/dll/3rdparty/freetype/ftfd/
------------------------------------------------------------------------------
bugtraq:message = See issue #%BUGID% for more details.
Propchange: trunk/reactos/dll/3rdparty/freetype/ftfd/
------------------------------------------------------------------------------
bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: trunk/reactos/dll/3rdparty/freetype/ftfd/
------------------------------------------------------------------------------
tsvn:logminsize = 10
Added: trunk/reactos/dll/3rdparty/freetype/ftfd/enable.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/freetype/ftfd…
==============================================================================
--- trunk/reactos/dll/3rdparty/freetype/ftfd/enable.c (added)
+++ trunk/reactos/dll/3rdparty/freetype/ftfd/enable.c [iso-8859-1] Tue Mar 10 07:12:27
2009
@@ -1,0 +1,105 @@
+/*
+ * PROJECT: ReactOS win32 subsystem
+ * LICENSE: GPL - See COPYING in the top level directory
+ * PURPOSE: GDI font driver for bitmap fonts
+ * PROGRAMMER: Timo Kreuzer (timo.kreuzer(a)reactos.org)
+ */
+
+#include "ftfd.h"
+
+static DRVFN gadrvfn[] =
+{
+ {INDEX_DrvEnablePDEV, (PFN)FtfdEnablePDEV},
+ {INDEX_DrvCompletePDEV, (PFN)FtfdCompletePDEV},
+ {INDEX_DrvDisablePDEV, (PFN)FtfdDisablePDEV},
+ {INDEX_DrvLoadFontFile, (PFN)FtfdLoadFontFile},
+ {INDEX_DrvUnloadFontFile, (PFN)FtfdUnloadFontFile},
+ {INDEX_DrvQueryFontFile, (PFN)FtfdQueryFontFile},
+ {INDEX_DrvQueryFontCaps, (PFN)FtfdQueryFontCaps},
+ {INDEX_DrvQueryFontTree, (PFN)FtfdQueryFontTree},
+ {INDEX_DrvQueryFont, (PFN)FtfdQueryFont},
+ {INDEX_DrvFree, (PFN)FtfdFree},
+ {INDEX_DrvQueryGlyphAttrs, (PFN)FtfdQueryGlyphAttrs},
+ {INDEX_DrvQueryFontData, (PFN)FtfdQueryFontData},
+};
+
+FT_Library gftlibrary;
+
+
+BOOL
+APIENTRY
+FtfdEnableDriver(
+ ULONG iEngineVersion,
+ ULONG cj,
+ PDRVENABLEDATA pded)
+{
+ FT_Error fterror;
+
+ DbgPrint("FtfdEnableDriver()\n");
+
+ /* Check parameter */
+ if (cj < sizeof(DRVENABLEDATA))
+ {
+ return FALSE;
+ }
+
+ /* Initialize freetype library */
+ fterror = FT_Init_FreeType(&gftlibrary);
+ if (fterror)
+ {
+ DbgPrint("an error occurred during library initialization: %ld.\n",
fterror);
+ return FALSE;
+ }
+
+ /* Fill DRVENABLEDATA */
+ pded->c = sizeof(gadrvfn) / sizeof(DRVFN);
+ pded->pdrvfn = gadrvfn;
+ pded->iDriverVersion = DDI_DRIVER_VERSION_NT5;
+
+ /* Success */
+ return TRUE;
+}
+
+
+DHPDEV
+APIENTRY
+FtfdEnablePDEV(
+ IN DEVMODEW *pdm,
+ IN LPWSTR pwszLogAddress,
+ IN ULONG cPat,
+ OUT HSURF *phsurfPatterns,
+ IN ULONG cjCaps,
+ OUT ULONG *pdevcaps,
+ IN ULONG cjDevInfo,
+ OUT DEVINFO *pdi,
+ IN HDEV hdev,
+ IN LPWSTR pwszDeviceName,
+ IN HANDLE hDriver)
+{
+ DbgPrint("FtfdEnablePDEV(hdev=%p)\n", hdev);
+
+
+ /* Return a dummy DHPDEV */
+ return (PVOID)1;
+}
+
+
+VOID
+APIENTRY
+FtfdCompletePDEV(
+ IN DHPDEV dhpdev,
+ IN HDEV hdev)
+{
+ DbgPrint("FtfdCompletePDEV()\n");
+ /* Nothing to do */
+}
+
+
+VOID
+APIENTRY
+FtfdDisablePDEV(
+ IN DHPDEV dhpdev)
+{
+ DbgPrint("FtfdDisablePDEV()\n");
+ /* Nothing to do */
+}
Propchange: trunk/reactos/dll/3rdparty/freetype/ftfd/enable.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/3rdparty/freetype/ftfd/font.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/freetype/ftfd…
==============================================================================
--- trunk/reactos/dll/3rdparty/freetype/ftfd/font.c (added)
+++ trunk/reactos/dll/3rdparty/freetype/ftfd/font.c [iso-8859-1] Tue Mar 10 07:12:27 2009
@@ -1,0 +1,215 @@
+/*
+ * PROJECT: ReactOS win32 subsystem
+ * LICENSE: GPL - See COPYING in the top level directory
+ * PURPOSE: GDI font driver for bitmap fonts
+ * PROGRAMMER: Timo Kreuzer (timo.kreuzer(a)reactos.org)
+ */
+
+#include "ftfd.h"
+
+PVOID
+HackFixup(
+ PVOID pvView,
+ ULONG cjView)
+{
+ CHAR *pc;
+ CHAR c;
+
+ pc = EngAllocMem(0, cjView, 'tmp ');
+ memcpy(pc, pvView, cjView);
+
+ c = *pc;
+ *pc = 0;
+
+ return pc;
+}
+
+/** Public Interface **********************************************************/
+
+ULONG_PTR
+APIENTRY
+FtfdLoadFontFile(
+ ULONG cFiles,
+ ULONG_PTR *piFile,
+ PVOID *ppvView,
+ ULONG *pcjView,
+ DESIGNVECTOR *pdv,
+ ULONG ulLangID,
+ ULONG ulFastCheckSum)
+{
+ PVOID pvView;
+ ULONG cjView, i;
+ FT_Error fterror;
+ FT_Face ftface;
+ PFTFD_FILE pfile;
+
+ DbgPrint("FtfdLoadFontFile()\n");
+
+ /* Check parameters */
+ if (cFiles != 1)
+ {
+ DbgPrint("Only 1 File is allowed, got %ld!\n", cFiles);
+ return HFF_INVALID;
+ }
+
+ /* Map the font file */
+ if (!EngMapFontFileFD(*piFile, (PULONG*)&pvView, &cjView))
+ {
+ DbgPrint("Could not map font file!\n", cFiles);
+ return HFF_INVALID;
+ }
+
+ // HACK!!!
+ pvView = HackFixup(pvView, cjView);
+
+ /* Look for faces in the file */
+ for (i = 0; i < 100; i++)
+ {
+ fterror = FT_New_Memory_Face(gftlibrary, pvView, cjView, i, &ftface);
+ if (fterror)
+ {
+ DbgPrint("Error reading font file (error code: %u)\n", fterror);
+ break;
+ }
+ FT_Done_Face(ftface);
+ }
+
+ /* Check whether we succeeded finding a face */
+ if (i > 0)
+ {
+ pfile = EngAllocMem(0, sizeof(FTFD_FILE), 'dftF');
+ if (pfile)
+ {
+ pfile->cNumFaces = i;
+ pfile->iFile = *piFile;
+ pfile->pvView = pvView;
+ pfile->cjView = cjView;
+
+ DbgPrint("Success! Returning %ld faces\n", i);
+
+ return (ULONG_PTR)pfile;
+ }
+ }
+
+ DbgPrint("No faces found in file\n");
+
+ /* Unmap the file */
+ EngUnmapFontFileFD(*piFile);
+
+ /* Failure! */
+ return HFF_INVALID;
+
+}
+
+BOOL
+APIENTRY
+FtfdUnloadFontFile(
+ IN ULONG_PTR iFile)
+{
+ PFTFD_FILE pfile = (PFTFD_FILE)iFile;
+
+ DbgPrint("FtfdUnloadFontFile()\n");
+
+ // HACK!!!
+ EngFreeMem(pfile->pvView);
+
+ /* Free the memory that was allocated for the font */
+ EngFreeMem(pfile);
+
+ /* Unmap the font file */
+ EngUnmapFontFileFD(pfile->iFile);
+
+ return TRUE;
+}
+
+
+LONG
+APIENTRY
+FtfdQueryFontFile(
+ ULONG_PTR iFile,
+ ULONG ulMode,
+ ULONG cjBuf,
+ ULONG *pulBuf)
+{
+ PFTFD_FILE pfile = (PFTFD_FILE)iFile;
+
+ DbgPrint("FtfdQueryFontFile(ulMode=%ld)\n", ulMode);
+// DbgBreakPoint();
+
+ switch (ulMode)
+ {
+ case QFF_DESCRIPTION:
+ {
+ return 0;
+ }
+
+ case QFF_NUMFACES:
+ /* return the number of faces in the file */
+ return pfile->cNumFaces;
+
+ }
+
+ return FD_ERROR;
+}
+
+LONG
+APIENTRY
+FtfdQueryFontCaps(
+ ULONG culCaps,
+ ULONG *pulCaps)
+{
+ DbgPrint("BmfdQueryFontCaps()\n");
+
+ /* We need room for 2 ULONGs */
+ if (culCaps < 2)
+ {
+ return FD_ERROR;
+ }
+
+ /* We only support 1 bpp */
+ pulCaps[0] = 2;
+ pulCaps[1] = QC_1BIT;
+
+ return 2;
+}
+
+
+PVOID
+APIENTRY
+FtfdQueryFontTree(
+ DHPDEV dhpdev,
+ ULONG_PTR iFile,
+ ULONG iFace,
+ ULONG iMode,
+ ULONG_PTR *pid)
+{
+ return NULL;
+}
+
+PIFIMETRICS
+APIENTRY
+FtfdQueryFont(
+ IN DHPDEV dhpdev,
+ IN ULONG_PTR iFile,
+ IN ULONG iFace,
+ IN ULONG_PTR *pid)
+{
+ return 0;
+}
+
+
+VOID
+APIENTRY
+FtfdFree(
+ PVOID pv,
+ ULONG_PTR id)
+{
+ DbgPrint("FtfdFree()\n");
+ if (id)
+ {
+ EngFreeMem((PVOID)id);
+ }
+}
+
+
+
Propchange: trunk/reactos/dll/3rdparty/freetype/ftfd/font.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/3rdparty/freetype/ftfd/ftfd.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/freetype/ftfd…
==============================================================================
--- trunk/reactos/dll/3rdparty/freetype/ftfd/ftfd.h (added)
+++ trunk/reactos/dll/3rdparty/freetype/ftfd/ftfd.h [iso-8859-1] Tue Mar 10 07:12:27 2009
@@ -1,0 +1,136 @@
+/*
+ * PROJECT: ReactOS win32 subsystem
+ * LICENSE: GPL - See COPYING in the top level directory
+ * PURPOSE: GDI font driver for bitmap fonts
+ * PROGRAMMER: Timo Kreuzer (timo.kreuzer(a)reactos.org)
+ */
+
+#include <stdarg.h>
+#include <windef.h>
+#include <wingdi.h>
+#include <winddi.h>
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+extern FT_Library gftlibrary;
+
+/** Driver specific types *****************************************************/
+
+
+typedef struct
+{
+ PVOID pvView;
+ ULONG cjView;
+ ULONG_PTR iFile;
+ ULONG cNumFaces;
+} FTFD_FILE, *PFTFD_FILE;
+
+/** Function prototypes *******************************************************/
+
+ULONG
+DbgPrint(IN PCHAR Format, IN ...);
+
+static __inline__
+void
+DbgBreakPoint(void)
+{
+ asm volatile ("int $3");
+}
+
+DHPDEV
+APIENTRY
+FtfdEnablePDEV(
+ IN DEVMODEW *pdm,
+ IN LPWSTR pwszLogAddress,
+ IN ULONG cPat,
+ OUT HSURF *phsurfPatterns,
+ IN ULONG cjCaps,
+ OUT ULONG *pdevcaps,
+ IN ULONG cjDevInfo,
+ OUT DEVINFO *pdi,
+ IN HDEV hdev,
+ IN LPWSTR pwszDeviceName,
+ IN HANDLE hDriver);
+
+VOID
+APIENTRY
+FtfdCompletePDEV(
+ IN DHPDEV dhpdev,
+ IN HDEV hdev);
+
+VOID
+APIENTRY
+FtfdDisablePDEV(
+ IN DHPDEV dhpdev);
+
+ULONG_PTR
+APIENTRY
+FtfdLoadFontFile(
+ ULONG cFiles,
+ ULONG_PTR *piFile,
+ PVOID *ppvView,
+ ULONG *pcjView,
+ DESIGNVECTOR *pdv,
+ ULONG ulLangID,
+ ULONG ulFastCheckSum);
+
+BOOL
+APIENTRY
+FtfdUnloadFontFile(
+ IN ULONG_PTR iFile);
+
+LONG
+APIENTRY
+FtfdQueryFontFile(
+ ULONG_PTR iFile,
+ ULONG ulMode,
+ ULONG cjBuf,
+ ULONG *pulBuf);
+
+LONG
+APIENTRY
+FtfdQueryFontCaps(
+ ULONG culCaps,
+ ULONG *pulCaps);
+
+PVOID
+APIENTRY
+FtfdQueryFontTree(
+ DHPDEV dhpdev,
+ ULONG_PTR iFile,
+ ULONG iFace,
+ ULONG iMode,
+ ULONG_PTR *pid);
+
+PIFIMETRICS
+APIENTRY
+FtfdQueryFont(
+ IN DHPDEV dhpdev,
+ IN ULONG_PTR iFile,
+ IN ULONG iFace,
+ IN ULONG_PTR *pid);
+
+VOID
+APIENTRY
+FtfdFree(
+ PVOID pv,
+ ULONG_PTR id);
+
+PFD_GLYPHATTR
+APIENTRY
+FtfdQueryGlyphAttrs(
+ FONTOBJ *pfo,
+ ULONG iMode);
+
+LONG
+APIENTRY
+FtfdQueryFontData(
+ DHPDEV dhpdev,
+ FONTOBJ *pfo,
+ ULONG iMode,
+ HGLYPH hg,
+ OUT GLYPHDATA *pgd,
+ PVOID pv,
+ ULONG cjSize);
+
Propchange: trunk/reactos/dll/3rdparty/freetype/ftfd/ftfd.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/3rdparty/freetype/ftfd/glyph.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/freetype/ftfd…
==============================================================================
--- trunk/reactos/dll/3rdparty/freetype/ftfd/glyph.c (added)
+++ trunk/reactos/dll/3rdparty/freetype/ftfd/glyph.c [iso-8859-1] Tue Mar 10 07:12:27
2009
@@ -1,0 +1,34 @@
+/*
+ * PROJECT: ReactOS win32 subsystem
+ * LICENSE: GPL - See COPYING in the top level directory
+ * PURPOSE: GDI font driver for bitmap fonts
+ * PROGRAMMER: Timo Kreuzer (timo.kreuzer(a)reactos.org)
+ */
+
+#include "ftfd.h"
+
+
+/** Public Interface **********************************************************/
+
+PFD_GLYPHATTR
+APIENTRY
+FtfdQueryGlyphAttrs(
+ FONTOBJ *pfo,
+ ULONG iMode)
+{
+ return NULL;
+}
+
+LONG
+APIENTRY
+FtfdQueryFontData(
+ DHPDEV dhpdev,
+ FONTOBJ *pfo,
+ ULONG iMode,
+ HGLYPH hg,
+ OUT GLYPHDATA *pgd,
+ PVOID pv,
+ ULONG cjSize)
+{
+ return FD_ERROR;
+}
Propchange: trunk/reactos/dll/3rdparty/freetype/ftfd/glyph.c
------------------------------------------------------------------------------
svn:eol-style = native