Author: tkreuzer
Date: Sat May  7 13:36:02 2011
New Revision: 51618

URL: http://svn.reactos.org/svn/reactos?rev=51618&view=rev
Log:
[GDI FONT DRIVER]
- Make use of debugging macros (TRACE, WARN, ASSERT)
- Handle unaligned data in the TrueType tables (arm for example doesn't like 
accessing unaligned data)
- Handle ulFont in FtfdQueryTrueTypeTable
- some interface cleanup

Added:
    branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.c
      - copied, changed from r51589, 
branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/opentype.c
    branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.h   (with 
props)
Removed:
    branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/opentype.c
Modified:
    branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/CMakeLists.txt
    branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/enable.c
    branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/font.c
    branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/ftfd.h
    branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/glyph.c

Modified: 
branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/CMakeLists.txt?rev=51618&r1=51617&r2=51618&view=diff
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/CMakeLists.txt 
[iso-8859-1] (original)
+++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/CMakeLists.txt 
[iso-8859-1] Sat May  7 13:36:02 2011
@@ -7,7 +7,7 @@
     enable.c
     font.c
     glyph.c
-    opentype.c
+    tttables.c
     rosglue.c
     ${CMAKE_CURRENT_BINARY_DIR}/ftfd.def)
 

Modified: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/enable.c
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/enable.c?rev=51618&r1=51617&r2=51618&view=diff
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/enable.c 
[iso-8859-1] (original)
+++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/enable.c 
[iso-8859-1] Sat May  7 13:36:02 2011
@@ -41,7 +41,7 @@
 {
     FT_Error fterror;
 
-    DbgPrint("FtfdEnableDriver()\n");
+    TRACE("FtfdEnableDriver()\n");
 
     /* Check parameter */
     if (cj < sizeof(DRVENABLEDATA))
@@ -53,7 +53,7 @@
     fterror = FT_Init_FreeType(&gftlibrary);
     if (fterror)
     {
-        DbgPrint("an error occurred during library initialization: %ld.\n", 
fterror);
+        WARN("Failed to initialize freetype library: %ld.\n", fterror);
         return FALSE;
     }
 
@@ -82,7 +82,7 @@
     IN LPWSTR pwszDeviceName,
     IN HANDLE hDriver)
 {
-    DbgPrint("FtfdEnablePDEV(hdev=%p)\n", hdev);
+    TRACE("FtfdEnablePDEV(hdev=%p)\n", hdev);
 
     /* Return a dummy DHPDEV */
     return (PVOID)1;
@@ -95,7 +95,7 @@
     IN DHPDEV dhpdev,
     IN HDEV hdev)
 {
-    DbgPrint("FtfdCompletePDEV()\n");
+    TRACE("FtfdCompletePDEV()\n");
     /* Nothing to do */
 }
 
@@ -105,7 +105,7 @@
 FtfdDisablePDEV(
     IN DHPDEV dhpdev)
 {
-    DbgPrint("FtfdDisablePDEV()\n");
+    TRACE("FtfdDisablePDEV()\n");
     /* Nothing to do */
 }
 
@@ -119,7 +119,7 @@
     ULONG cjOut,
     PVOID pvOut)
 {
-    DbgPrint("FtfdEscape\n");
+    TRACE("FtfdEscape\n");
     __debugbreak();
     return 0;
 }

Modified: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/font.c
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/font.c?rev=51618&r1=51617&r2=51618&view=diff
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/font.c 
[iso-8859-1] (original)
+++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/font.c 
[iso-8859-1] Sat May  7 13:36:02 2011
@@ -30,7 +30,7 @@
     goto done;
 
 allglyphs:
-    DbgPrint("using all glyphs\n");
+    TRACE("using all glyphs\n");
 
     /* Start over */
     ulAccumCharWidth = 0;
@@ -60,9 +60,11 @@
     PFTFD_IFIMETRICS pifiex;
     PIFIMETRICS pifi;
     FT_Face ftface;
+    FT_Error fterror;
+    PS_FontInfoRec fontinfo;
     ULONG i;
 
-    DbgPrint("FtfdInitIfiMetrics()\n");
+    TRACE("FtfdInitIfiMetrics()\n");
 
     /* Get the freetype face pointer */
     ftface = pface->ftface;
@@ -90,9 +92,7 @@
     }
 
     pifi->lEmbedId = 0;
-    pifi->lItalicAngle = 0;
     pifi->lCharBias = 0;
-    pifi->jWinPitchAndFamily = 0; // FIXME: generic way to get this?
 
     /* Set flags */
     pifi->flInfo = FM_INFO_RETURNS_BITMAPS | FM_INFO_1BPP | FM_INFO_4BPP;
@@ -138,9 +138,9 @@
     pifi->fwdMacDescender = ftface->descender;
     pifi->fwdMacLineGap = 0;
     pifi->fwdAveCharWidth = 0;
-    pifi->fwdTypoAscender = pifi->fwdMacAscender;
-    pifi->fwdTypoDescender = pifi->fwdMacDescender;
-    pifi->fwdTypoLineGap = 0;
+    pifi->fwdTypoAscender = ftface->ascender;
+    pifi->fwdTypoDescender = ftface->descender;
+    pifi->fwdTypoLineGap = ftface->units_per_EM / 10;
     pifi->fwdMaxCharInc = ftface->max_advance_width;
     pifi->fwdCapHeight = 0;
     pifi->fwdXHeight = 0;
@@ -195,6 +195,26 @@
     pifi->panose.bMidline = PAN_ANY;
     pifi->panose.bXHeight = PAN_ANY;
 
+    /* Try to get type1 info from freetype */
+    fterror = FT_Get_PS_Font_Info(pface->ftface, &fontinfo);
+    if (fterror == 0)
+    {
+        /* Set italic angle */
+        pifi->lItalicAngle = fontinfo.italic_angle;
+
+        /* Set pitch */
+        if (fontinfo.is_fixed_pitch)
+            pifi->jWinPitchAndFamily = FIXED_PITCH;
+        else
+            pifi->jWinPitchAndFamily = VARIABLE_PITCH;
+    }
+    else
+    {
+        /* Set fallback values */
+        pifi->lItalicAngle = 0;
+        pifi->jWinPitchAndFamily = 0;
+    }
+
     EngMultiByteToUnicodeN(pifiex->awcFamilyName,
                            LF_FACESIZE,
                            NULL,
@@ -214,7 +234,7 @@
                            strnlen(ftface->family_name, MAX_PATH));
 
     /* Use OS/2 TrueType or OpenType tables */
-    OtfGetIfiMetrics(pface, pifi);
+    FtfdGetWinMetrics(pface, pifi);
 
     if (pifi->fwdAveCharWidth == 0)
         pifi->fwdAveCharWidth = CalculateAveCharWidth(ftface);
@@ -231,7 +251,7 @@
                            4);
 
 
-    DbgPrint("Finished with the ifi: %p\n", pifi);
+    TRACE("Finished with the ifi: %p\n", pifi);
     //__debugbreak();
 
     return TRUE;
@@ -249,7 +269,7 @@
     HGLYPH * phglyphs;
     WCHAR wcCurrent, wcPrev;
 
-    DbgPrint("FtfdInitGlyphSet()\n");
+    TRACE("FtfdInitGlyphSet()\n");
 
     /* Calculate FD_GLYPHSET size (incl. HGLYPH array!) */
     cjSize = FIELD_OFFSET(FD_GLYPHSET, awcrun)
@@ -260,7 +280,7 @@
     pGlyphSet = EngAllocMem(0, cjSize, TAG_GLYPHSET);
     if (!pGlyphSet)
     {
-        DbgPrint("EngAllocMem() failed.\n");
+        WARN("EngAllocMem() failed.\n");
         return NULL;
     }
 
@@ -293,7 +313,7 @@
             pGlyphSet->awcrun[cRuns - 1].wcLow = wcCurrent;
             pGlyphSet->awcrun[cRuns - 1].cGlyphs = 1;
             pGlyphSet->awcrun[cRuns - 1].phg = &phglyphs[i];
-            //DbgPrint("adding new run i=%ld, cRuns=%ld, wc=%x\n", i, cRuns, 
wcCurrent);
+            //TRACE("adding new run i=%ld, cRuns=%ld, wc=%x\n", i, cRuns, 
wcCurrent);
         }
 
         /* Get the next charcode and index */
@@ -301,7 +321,7 @@
         wcCurrent = (WCHAR)FT_Get_Next_Char(ftface, wcCurrent, &index);
     }
 
-    DbgPrint("Done with font tree, %d runs\n", pGlyphSet->cRuns);
+    TRACE("Done with font tree, %d runs\n", pGlyphSet->cRuns);
     pface->pGlyphSet = pGlyphSet;
     return pGlyphSet;
 }
@@ -310,7 +330,7 @@
 FtfdInitKerningPairs(
     PFTFD_FACE pface)
 {
-    //DbgPrint("unimplemented\n");
+    //WARN("unimplemented\n");
 }
 
 static
@@ -354,6 +374,7 @@
 NTAPI
 FtfdCreateFace(
     PFTFD_FILE pfile,
+    ULONG iFace,
     FT_Face ftface)
 {
     PFTFD_FACE pface;
@@ -365,11 +386,12 @@
     pface = EngAllocMem(FL_ZERO_MEMORY, sizeof(FTFD_FACE), 'dftF');
     if (!pface)
     {
-        DbgPrint("Couldn't allcate a face\n");
+        WARN("Couldn't allcate a face\n");
         return NULL;
     }
 
     pface->pfile = pfile;
+    pface->iFace = iFace;
     pface->ftface = ftface;
     pface->cGlyphs = ftface->num_glyphs;
 
@@ -380,7 +402,7 @@
     fterror = FT_Select_Charmap(ftface, FT_ENCODING_UNICODE);
     if (fterror)
     {
-        DbgPrint("ERROR: Could not load unicode charmap\n");
+        WARN("Could not load unicode charmap\n");
         return NULL;
     }
 
@@ -456,19 +478,19 @@
     FT_Face ftface;
     PFTFD_FILE pfile = NULL;
 
-    DbgPrint("FtfdLoadFontFile()\n");
+    TRACE("FtfdLoadFontFile()\n");
 
     /* Check parameters */
     if (cFiles != 1)
     {
-        DbgPrint("ERROR: Only 1 File is allowed, got %ld!\n", cFiles);
+        WARN("Only 1 File is allowed, got %ld!\n", cFiles);
         return HFF_INVALID;
     }
 
     /* Map the font file */
     if (!EngMapFontFileFD(*piFile, (PULONG*)&pvView, &cjView))
     {
-        DbgPrint("ERROR: Could not map font file!\n");
+        WARN("Could not map font file!\n");
         return HFF_INVALID;
     }
 
@@ -477,7 +499,7 @@
     if (fterror)
     {
         /* Failure! */
-        DbgPrint("ERROR: No faces found in file\n");
+        WARN("No faces found in file\n");
         goto error;
     }
 
@@ -490,7 +512,7 @@
     if (!pfile)
     {
         /* Failure! */
-        DbgPrint("ERROR: EngAllocMem() failed.\n");
+        WARN("EngAllocMem() failed.\n");
         goto error;
     }
 
@@ -502,10 +524,10 @@
     pfile->ulFastCheckSum = ulFastCheckSum;
 
     /* Create a face */
-    pfile->apface[0] = FtfdCreateFace(pfile, ftface);
+    pfile->apface[0] = FtfdCreateFace(pfile, 1, ftface);
     if (!pfile->apface[0])
     {
-        DbgPrint("ERROR: FtfdCreateFace() failed.\n");
+        WARN("FtfdCreateFace() failed.\n");
         goto error;
     }
 
@@ -519,16 +541,16 @@
         fterror = FT_New_Memory_Face(gftlibrary, *ppvView, *pcjView, i, 
&ftface);
         if (fterror)
         {
-            DbgPrint("error\n");
+            WARN("error\n");
             __debugbreak();
             goto error;
         }
 
         /* Store the face in the file structure */
-        pfile->apface[i] = FtfdCreateFace(pfile, ftface);
-    }
-
-    DbgPrint("Success! Returning %ld faces\n", cNumFaces);
+        pfile->apface[i] = FtfdCreateFace(pfile, i + 1, ftface);
+    }
+
+    TRACE("Success! Returning %ld faces\n", cNumFaces);
     return (ULONG_PTR)pfile;
 
 error:
@@ -552,12 +574,12 @@
     PFTFD_FILE pfile = (PFTFD_FILE)diFile;
     PFTFD_FACE pface = pfile->apface[iFace - 1];
 
-    DbgPrint("FtfdQueryFont()\n");
+    TRACE("FtfdQueryFont()\n");
 
     /* Validate parameters */
     if (iFace > pfile->cNumFaces || !pid)
     {
-        DbgPrint("ERROR: iFace > pfile->cNumFaces || !pid\n");
+        WARN("iFace > pfile->cNumFaces || !pid\n");
         return NULL;
     }
 
@@ -580,12 +602,12 @@
     PFTFD_FILE pfile = (PFTFD_FILE)diFile;
     PFTFD_FACE pface;
 
-    DbgPrint("FtfdQueryFontTree(iMode=%ld)\n", iMode);
+    TRACE("FtfdQueryFontTree(iMode=%ld)\n", iMode);
 
     /* Validate parameters */
     if (iFace > pfile->cNumFaces || !pid)
     {
-        DbgPrint("ERROR: iFace > pfile->cNumFaces || !pid\n");
+        WARN("iFace > pfile->cNumFaces || !pid\n");
         return NULL;
     }
 
@@ -603,7 +625,7 @@
             return pface->pKerningPairs;
 
         default:
-            DbgPrint("ERROR: invalid iMode: %ld\n", iMode);
+            WARN("Invalid iMode: %ld\n", iMode);
     }
 
     return NULL;
@@ -617,7 +639,7 @@
     PFTFD_FILE pfile = (PFTFD_FILE)diFile;
     ULONG i;
 
-    DbgPrint("FtfdUnloadFontFile()\n");
+    TRACE("FtfdUnloadFontFile()\n");
 
     /* Cleanup faces */
     for (i = 0; i < pfile->cNumFaces; i++)
@@ -633,7 +655,6 @@
 
     return TRUE;
 }
-
 
 LONG
 APIENTRY
@@ -645,7 +666,7 @@
 {
     PFTFD_FILE pfile = (PFTFD_FILE)diFile;
 
-    DbgPrint("FtfdQueryFontFile(ulMode=%ld)\n", ulMode);
+    TRACE("FtfdQueryFontFile(ulMode=%ld)\n", ulMode);
 
     switch (ulMode)
     {
@@ -669,7 +690,7 @@
     ULONG culCaps,
     ULONG *pulCaps)
 {
-    DbgPrint("FtfdQueryFontCaps()\n");
+    TRACE("FtfdQueryFontCaps()\n");
 
     /* We need room for 2 ULONGs */
     if (culCaps < 2)
@@ -684,101 +705,6 @@
     return 2;
 }
 
-LONG
-APIENTRY
-FtfdQueryTrueTypeTable(
-    ULONG_PTR diFile,
-    ULONG ulFont,
-    ULONG ulTag,
-    PTRDIFF dpStart,
-    ULONG cjBuf,
-    BYTE *pjBuf,
-    PBYTE *ppjTable,
-    ULONG *pcjTable)
-{
-    PFTFD_FILE pfile = (PFTFD_FILE)diFile;
-    PBYTE pjTable;
-    ULONG cjTable;
-
-    DbgPrint("FtfdQueryTrueTypeTable\n");
-
-    /* Check if this file supports TrueType tables */
-    if (pfile->ulFileFormat != FILEFMT_TTF &&
-        pfile->ulFileFormat != FILEFMT_OTF)
-    {
-        DbgPrint("File format doesn't support true type tables\n");
-        return FD_ERROR;
-    }
-
-    // FIXME: handle ulFont
-
-    /* Check if the whole file is requested */
-    if (ulTag == 0)
-    {
-        /* Requested the whole file */
-        pjTable = pfile->pvView;
-        cjTable = pfile->cjView;
-    }
-    else
-    {
-        /* Search for the table */
-        pjTable = OtfFindTable(pfile->pvView, pfile->cjView, ulTag, &cjTable);
-        if (!pjTable)
-        {
-            DbgPrint("Couldn't find table '%.4s'\n", (char*)&ulTag);
-            return FD_ERROR;
-        }
-    }
-
-    /* Return requested pointers */
-    if (ppjTable) *ppjTable = pjTable;
-    if (pcjTable) *pcjTable = cjTable;
-
-    /* Check if we shall copy data */
-    if (pjBuf)
-    {
-        /* Check if the offset is inside the table */
-        if (dpStart < 0 || (ULONG_PTR)dpStart >= cjTable)
-        {
-            DbgPrint("dpStart outside the table: %p\n", dpStart);
-            return FD_ERROR;
-        }
-
-        /* Don't copy beyond the table end */
-        cjTable -= dpStart;
-
-        /* Don't copy more then the buffer can hold */
-        if (cjBuf < cjTable) cjTable = cjBuf;
-
-        /* Copy the data to the buffer */
-        RtlCopyMemory(pjBuf, pjTable + dpStart, cjTable);
-    }
-
-    return cjTable;
-}
-
-PVOID
-APIENTRY
-FtfdGetTrueTypeFile(
-    ULONG_PTR diFile,
-    ULONG *pcj)
-{
-    PFTFD_FILE pfile = (PFTFD_FILE)diFile;
-
-    DbgPrint("FtfdGetTrueTypeFile\n");
-
-    /* Check if this file is TrueType */
-    if (pfile->ulFileFormat != FILEFMT_TTF &&
-        pfile->ulFileFormat != FILEFMT_OTF)
-    {
-        DbgPrint("File format is not TrueType or Opentype\n");
-        return NULL;
-    }
-
-    /* Return the pointer and size */
-    if (pcj) *pcj = pfile->cjView;
-    return pfile->pvView;
-}
 
 #if 0 // not needed atm
 VOID
@@ -787,7 +713,7 @@
     PVOID pv,
     ULONG_PTR id)
 {
-    DbgPrint("FtfdFree()\n");
+    TRACE("FtfdFree()\n");
     EngFreeMem(pv);
 }
 #endif

Modified: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/ftfd.h
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/ftfd.h?rev=51618&r1=51617&r2=51618&view=diff
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/ftfd.h 
[iso-8859-1] (original)
+++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/ftfd.h 
[iso-8859-1] Sat May  7 13:36:02 2011
@@ -11,14 +11,32 @@
 #include <winddi.h>
 
 #include <ft2build.h>
+#include FT_FREETYPE_H
 #include <freetype/ftadvanc.h>
 #include <freetype/ftxf86.h>
-#include FT_FREETYPE_H
+#include <freetype/t1tables.h>
 
 extern FT_Library gftlibrary;
 
 #define TAG_GLYPHSET 'GlSt'
 #define TAG_IFIMETRICS 'Ifim'
+
+#if 1// DBG
+#define ASSERT(x) \
+    if(!(x)) \
+    { \
+        DbgPrint("Assertion '%s' failed at %s:%i\n", #x, __FILE__, __LINE__); \
+        __debugbreak(); \
+    }
+#define TRACE DbgPrint
+#define WARN DbgPrint
+#define FATAL DbgPrint
+#else
+#define ASSERT(x)
+#define TRACE(...)
+#define WARN(...)
+#define FATAL(...)
+#endif
 
 /** Driver specific types 
*****************************************************/
 
@@ -60,6 +78,7 @@
 {
     struct _FTFD_FILE *pfile;
     FT_Face ftface;
+    ULONG iFace;
     ULONG ulFontFormat;
     ULONG cGlyphs;
     ULONG cMappings;
@@ -276,16 +295,19 @@
     ULONG_PTR iFile,
     ULONG *pcj);
 
-VOID
+/* Private interface */
+
+PVOID
 NTAPI
-OtfGetIfiMetrics(
+FtfdFindTrueTypeTable(
+    PVOID pvView,
+    ULONG cjView,
+    ULONG iFace,
+    ULONG ulTag,
+    PULONG pulLength);
+
+VOID
+NTAPI
+FtfdGetWinMetrics(
     PFTFD_FACE pface,
     PIFIMETRICS pifi);
-
-PVOID
-NTAPI
-OtfFindTable(
-    PVOID pvView,
-    ULONG cjView,
-    ULONG ulTag,
-    PULONG pulLength);

Modified: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/glyph.c
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/glyph.c?rev=51618&r1=51617&r2=51618&view=diff
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/glyph.c 
[iso-8859-1] (original)
+++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/glyph.c 
[iso-8859-1] Sat May  7 13:36:02 2011
@@ -58,7 +58,7 @@
     if (fterror)
     {
         /* Failure! */
-        DbgPrint("Error creating face\n");
+        WARN("Error creating face\n");
         EngFreeMem(pfont);
         return NULL;
     }
@@ -127,7 +127,7 @@
         if (fterror)
         {
             /* Failure! */
-            DbgPrint("Error setting face size\n");
+            WARN("Error setting face size\n");
             return NULL;
         }
 
@@ -167,7 +167,7 @@
     if (pmetrics->ptlULThickness.y <= 0) pmetrics->ptlULThickness.y = 1;
     if (pmetrics->ptlSOThickness.y <= 0) pmetrics->ptlSOThickness.y = 1;
 
-DbgPrint("Created font with %ld (%ld)\n", yScale, (yScale+32)/64);
+TRACE("Created font with %ld (%ld)\n", yScale, (yScale+32)/64);
 //__debugbreak();
 
     /* Set the pvProducer member of the fontobj */
@@ -203,14 +203,14 @@
     FT_Face ftface = pfont->ftface;
     XFORMOBJ *pxo;
 
-    DbgPrint("FtfdQueryMaxExtents\n");
+    TRACE("FtfdQueryMaxExtents\n");
 
     if (pfddm)
     {
         if (cjSize < sizeof(FD_DEVICEMETRICS))
         {
             /* Not enough space, fail */
-            DbgPrint("ERROR: cjSize = %ld\n", cjSize);
+            WARN("cjSize = %ld\n", cjSize);
             return FD_ERROR;
         }
 
@@ -283,7 +283,7 @@
         fterror = FT_Load_Glyph(pfont->ftface, hg, 0);
         if (fterror)
         {
-            DbgPrint("FtfdLoadGlyph: couldn't load glyph 0x%lx\n", hg);
+            WARN("Couldn't load glyph 0x%lx\n", hg);
             pfont->hgSelected = -1;
             return FALSE;
         }
@@ -400,7 +400,7 @@
     cjBitmapSize = BITMAP_SIZE(pgb->sizlBitmap.cx, pgb->sizlBitmap.cy, 4);
     if (cjBitmapSize + FIELD_OFFSET(GLYPHBITS, aj) > cjSize)
     {
-        DbgPrint("ERROR: buffer too small, got %ld, need %ld\n",
+        WARN("Buffer too small, got %ld, need %ld\n",
                  cjSize, cjBitmapSize + FIELD_OFFSET(GLYPHBITS, aj));
         __debugbreak();
         return;
@@ -411,9 +411,9 @@
 
     //RtlCopyMemory(pgb->aj, ftglyph->bitmap.buffer, cjBitmapSize);
 
-    DbgPrint("QueryGlyphBits hg=%lx, (%ld,%ld) cjSize=%ld, need %ld\n",
-             hg, pgb->sizlBitmap.cx, pgb->sizlBitmap.cy, cjSize,
-             GLYPHBITS_SIZE(pgb->sizlBitmap.cx, pgb->sizlBitmap.cy, 4));
+    TRACE("QueryGlyphBits hg=%lx, (%ld,%ld) cjSize=%ld, need %ld\n",
+          hg, pgb->sizlBitmap.cx, pgb->sizlBitmap.cy, cjSize,
+          GLYPHBITS_SIZE(pgb->sizlBitmap.cx, pgb->sizlBitmap.cy, 4));
 
 }
 
@@ -436,7 +436,7 @@
     fterror = FT_Render_Glyph(pfont->ftface->glyph, FT_RENDER_MODE_NORMAL);
     if (fterror)
     {
-        DbgPrint("cound't render glyph\n");
+        WARN("Cound't render glyph\n");
         return FALSE;
     }
 
@@ -458,13 +458,13 @@
 {
     PFTFD_FONT pfont = FtfdGetFontInstance(pfo);
 
-    DbgPrint("FtfdQueryFontData, iMode=%ld, hg=%lx, pgd=%p, pv=%p, 
cjSize=%ld\n",
-             iMode, hg, pgd, pv, cjSize);
+    TRACE("FtfdQueryFontData, iMode=%ld, hg=%lx, pgd=%p, pv=%p, cjSize=%ld\n",
+          iMode, hg, pgd, pv, cjSize);
 
     switch (iMode)
     {
         case QFD_GLYPHANDBITMAP:
-            DbgPrint("QFD_GLYPHANDBITMAP\n");
+            TRACE("QFD_GLYPHANDBITMAP\n");
 
             /* Load the requested glyph */
             if (!FtfdLoadGlyph(pfont, hg, 0)) return FD_ERROR;
@@ -485,7 +485,7 @@
                                   4);
 
         case QFD_GLYPHANDOUTLINE:
-            DbgPrint("QFD_GLYPHANDOUTLINE\n");
+            TRACE("QFD_GLYPHANDOUTLINE\n");
 
             /* Load the requested glyph */
             if (!FtfdLoadGlyph(pfont, hg, 1)) return FD_ERROR;
@@ -505,19 +505,19 @@
             return FtfdQueryMaxExtents(pfo, pv, cjSize);
 
         case QFD_TT_GRAY1_BITMAP:
-            DbgPrint("QFD_TT_GRAY1_BITMAP\n");
+            TRACE("QFD_TT_GRAY1_BITMAP\n");
             break;
         case QFD_TT_GRAY2_BITMAP:
-            DbgPrint("QFD_TT_GRAY2_BITMAP\n");
+            TRACE("QFD_TT_GRAY2_BITMAP\n");
             break;
         case QFD_TT_GRAY4_BITMAP:
-            DbgPrint("QFD_TT_GRAY4_BITMAP\n");
+            TRACE("QFD_TT_GRAY4_BITMAP\n");
             break;
         case QFD_TT_GRAY8_BITMAP:
-            DbgPrint("QFD_TT_GRAY8_BITMAP\n");
+            TRACE("QFD_TT_GRAY8_BITMAP\n");
             break;
         default:
-            DbgPrint("ERROR: Invalid iMode value: %lx\n", iMode);
+            WARN("Invalid iMode value: %lx\n", iMode);
             EngSetLastError(ERROR_INVALID_PARAMETER);
             return FD_ERROR;
     }
@@ -534,12 +534,12 @@
     FONTOBJ *pfo,
     ULONG iMode)
 {
-    DbgPrint("FtfdQueryGlyphAttrs\n");
+    TRACE("FtfdQueryGlyphAttrs\n");
 
     /* Verify parameters */
     if (!pfo || iMode != FO_ATTR_MODE_ROTATE)
     {
-        DbgPrint("ERROR: invalid parameters: %p, %ld\n", pfo, iMode);
+        WARN("Invalid parameters: %p, %ld\n", pfo, iMode);
         return NULL;
     }
 
@@ -567,7 +567,7 @@
     FT_Error fterror;
     FT_Fixed advance;
 
-    DbgPrint("FtfdQueryAdvanceWidths\n");
+    TRACE("FtfdQueryAdvanceWidths\n");
 
     // FIXME: layout horizontal/vertical
     fl = (iMode == QAW_GETEASYWIDTHS) ? FT_ADVANCE_FLAG_FAST_ONLY : 0;
@@ -581,7 +581,7 @@
         fterror = FT_Get_Advance(ftface, (FT_UInt)phg[i], fl, &advance);
         if (fterror || advance > 0x0FFFF000)
         {
-            DbgPrint("ERROR: failed to query advance width hg=%lx, fl=0x%lx\n",
+            WARN("Failed to query advance width hg=%lx, fl=0x%lx\n",
                      phg[i], fl);
             pusWidths[i] = 0xffff;
             bResult = FALSE;
@@ -590,7 +590,7 @@
         {
             /* Transform from 16.16 points to 28.4 pixels */
             pusWidths[i] = (USHORT)((advance * 72 / pfo->sizLogResPpi.cx) >> 
12);
-            //DbgPrint("Got advance width: hg=%lx, adv=%lx->%ld\n", phg[i], 
advance, pt.x);
+            //TRACE("Got advance width: hg=%lx, adv=%lx->%ld\n", phg[i], 
advance, pt.x);
         }
     }
 
@@ -609,7 +609,7 @@
     ULONG cjBuf,
     TTPOLYGONHEADER *ppoly)
 {
-    DbgPrint("FtfdQueryTrueTypeOutline\n");
+    TRACE("FtfdQueryTrueTypeOutline\n");
     __debugbreak();
     return 0;
 }
@@ -625,7 +625,7 @@
     ULONG cjOut,
     PVOID pvOut)
 {
-    DbgPrint("FtfdFontManagement\n");
+    TRACE("FtfdFontManagement\n");
     __debugbreak();
     return 0;
 }
@@ -635,7 +635,7 @@
 FtfdDestroyFont(
     FONTOBJ *pfo)
 {
-    DbgPrint("FtfdDestroyFont()\n");
+    TRACE("FtfdDestroyFont()\n");
     __debugbreak();
 }
 

Removed: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/opentype.c
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/opentype.c?rev=51617&view=auto
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/opentype.c 
[iso-8859-1] (original)
+++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/opentype.c 
(removed)
@@ -1,440 +1,0 @@
-/*
- * PROJECT:         ReactOS win32 subsystem
- * LICENSE:         GPL - See COPYING in the top level directory
- * PURPOSE:         OpenType support for GDI font driver based on freetype
- * PROGRAMMER:      Timo Kreuzer ([email protected])
- * REFERENCES:      http://www.microsoft.com/typography/otspec/
- *                  http://www.microsoft.com/typography/otspec/os2.htm
- */
-
-#include "ftfd.h"
-#include <freetype/t1tables.h>
-
-// FIXME: we can have unaligned memory access, use:
-#define GETW(px) = (((PUCHAR)px)[1] | ((PUCHAR)px)[0] << 8)
-#define GETD(px) = (GETW((PUCHAR)px + 2) | GETW(px) << 16)
-
-#define SWAPW(x) _byteswap_ushort(x)
-#define SWAPD(x) _byteswap_ulong(x)
-
-typedef struct _OTF_TABLE_ENTRY
-{
-    ULONG ulTag;
-    ULONG ulCheckSum;
-    ULONG ulOffset;
-    ULONG ulLength;
-} OTF_TABLE_ENTRY, *POTF_TABLE_ENTRY;
-
-typedef struct _OTF_FILE_HEADER
-{
-    ULONG ulIdentifier;
-    USHORT usNumTables;
-    USHORT usSearchRange;
-    USHORT usEntrySelector;
-    USHORT usRangeshift;
-
-    OTF_TABLE_ENTRY aTableEntries[1];
-
-} OTF_FILE_HEADER, *POTF_FILE_HEADER;
-
-#include <pshpack1.h>
-typedef struct _OTF_OS2_DATA
-{
-    USHORT     version; //     0x0004
-    SHORT      xAvgCharWidth;
-    USHORT     usWeightClass;
-    USHORT     usWidthClass;
-    USHORT     fsType;
-    SHORT      ySubscriptXSize;
-    SHORT      ySubscriptYSize;
-    SHORT      ySubscriptXOffset;
-    SHORT      ySubscriptYOffset;
-    SHORT      ySuperscriptXSize;
-    SHORT      ySuperscriptYSize;
-    SHORT      ySuperscriptXOffset;
-    SHORT      ySuperscriptYOffset;
-    SHORT      yStrikeoutSize;
-    SHORT      yStrikeoutPosition;
-    union // 0x30
-    {
-        struct
-        {
-            BYTE jClassId;
-            BYTE jSubClassId;
-        };
-        SHORT  sFamilyClass;
-    };
-    BYTE       panose[10];
-    ULONG      ulUnicodeRange1; //     Bits 0-31
-    ULONG      ulUnicodeRange2; //     Bits 32-63
-    ULONG      ulUnicodeRange3; //     Bits 64-95
-    ULONG      ulUnicodeRange4; //     Bits 96-127
-    CHAR       achVendID[4];
-    USHORT     fsSelection;
-    USHORT     usFirstCharIndex;
-    USHORT     usLastCharIndex;
-    SHORT      sTypoAscender;
-    SHORT      sTypoDescender;
-    SHORT      sTypoLineGap;
-    USHORT     usWinAscent;
-    USHORT     usWinDescent;
-    ULONG      ulCodePageRange1; //    Bits 0-31
-    ULONG      ulCodePageRange2; //    Bits 32-63
-    SHORT      sxHeight;
-    SHORT      sCapHeight;
-    USHORT     usDefaultChar;
-    USHORT     usBreakChar;
-    USHORT     usMaxContext;
-} OTF_OS2_DATA, *POTF_OS2_DATA;
-#include <poppack.h>
-
-ULONG
-CalcTableChecksum(PVOID pvTable, ULONG cjTable)
-{
-    PULONG pul = pvTable, pulEnd;
-    ULONG ulCheckSum = 0L;
-
-    pulEnd = (PULONG)pvTable + (cjTable + 3) / sizeof(ULONG);
-
-    while (pul < pulEnd) ulCheckSum += SWAPD(*pul++);
-
-    return ulCheckSum;
-}
-
-BOOL
-OtfGetType1FontInfo(
-    PFTFD_FACE pface,
-    PIFIMETRICS pifi)
-{
-    FT_Error fterror;
-    PS_FontInfoRec fontinfo;
-
-    fterror = FT_Get_PS_Font_Info(pface->ftface, &fontinfo);
-    if (fterror)
-    {
-        DbgPrint("ERROR: Failed to retrieve font info\n");
-        return FALSE;
-    }
-
-    /* Try to find the font weight */
-    if (strncpy(fontinfo.weight, "Normal", 7) == 0)
-        pifi->usWinWeight = FW_NORMAL;
-    // else if (..)
-    else
-        pifi->usWinWeight = FW_REGULAR;
-
-    pifi->lItalicAngle = fontinfo.italic_angle;
-
-    /* Clear lower 2 bits and set FIXED_PITCH or VARIABLE_PITCH */
-    pifi->jWinPitchAndFamily &= ~3;
-    if (fontinfo.is_fixed_pitch)
-        pifi->jWinPitchAndFamily |= FIXED_PITCH;
-    else
-        pifi->jWinPitchAndFamily |= VARIABLE_PITCH;
-
-    return TRUE;
-}
-
-/*! \name OtfFindTable
- *  \brief Searches for a specific table in TrueType and OpenType font files
- *  \param pvView - The address where the font file is mapped
- *  \param vjView - Size of the mapped font file
- *  \param ulTag - Identifier tag of the table to search
- *  \param pulLength - Pointer to an ULONG that recieves the table length,
- *                     Can be NULL;
- *  \return Pointer to the table if successful, NULL if unsuccessful.
- */
-PVOID
-NTAPI
-OtfFindTable(
-    PVOID pvView,
-    ULONG cjView,
-    ULONG ulTag,
-    PULONG pulLength)
-{
-    POTF_FILE_HEADER pFileHeader = pvView;
-    ULONG i, ulOffset, ulLength, ulNumTables, ulCheckSum;
-
-    /* Verify the file header */
-    if (pFileHeader->ulIdentifier != 'OTTO' &&
-        pFileHeader->ulIdentifier != 'fctt' &&
-        pFileHeader->ulIdentifier != 0x00000100)
-    {
-        DbgPrint("ERROR: Couldn't verify identifier: 0x%lx\n",
-                 pFileHeader->ulIdentifier);
-        return NULL;
-    }
-
-    /* Check if number of tables is ok */
-    ulNumTables = SWAPW(pFileHeader->usNumTables);
-    ulLength = ulNumTables * sizeof(OTF_TABLE_ENTRY);
-    if (ulLength + sizeof(OTF_FILE_HEADER) > cjView)
-    {
-        DbgPrint("ERROR: Too many tables (%ld)\n", ulNumTables);
-        return NULL;
-    }
-
-    /* Loop all tables */
-    for (i = 0; i < ulNumTables; i++)
-    {
-        /* Compare the tag */
-        if (pFileHeader->aTableEntries[i].ulTag == ulTag)
-        {
-            /* Get table offset and length */
-            ulOffset = SWAPD(pFileHeader->aTableEntries[i].ulOffset);
-            ulLength = SWAPD(pFileHeader->aTableEntries[i].ulLength);
-
-            /* Check if this is inside the file */
-            if (ulOffset + ulLength > cjView ||
-                ulOffset + ulLength < ulOffset)
-            {
-                DbgPrint("invalid table entry. %ld, %ld \n", ulOffset, 
ulLength);
-                return NULL;
-            }
-
-            ulCheckSum = CalcTableChecksum((PUCHAR)pvView + ulOffset, 
ulLength);
-            if (ulCheckSum != SWAPD(pFileHeader->aTableEntries[i].ulCheckSum))
-            {
-                DbgPrint("Checksum mitmatch! %ld, %ld \n", ulOffset, ulLength);
-                return NULL;
-            }
-
-            if (pulLength) *pulLength = ulLength;
-            return (PUCHAR)pvView + ulOffset;
-        }
-    }
-
-    /* Not found */
-    return NULL;
-}
-
-/*! \name OtfGetWinFamily
- *  \brief Translates IBM font class IDs into a Windows family bitfield
- *  \param jClassId
- *  \param jSubclassId
- *  \ref http://www.microsoft.com/typography/otspec/ibmfc.htm
- */
-BYTE
-OtfGetWinFamily(BYTE jClassId, BYTE jSubclassId)
-{
-    switch (jClassId)
-    {
-        case 0: // Class ID = 0 No Classification
-            break;
-
-        case 1: // Class ID = 1 Oldstyle Serifs
-            switch (jSubclassId)
-            {
-                case 0: // Subclass ID = 0 : No Classification
-                case 1: // Subclass ID = 1 : IBM Rounded Legibility
-                case 2: // Subclass ID = 2 : Garalde
-                case 3: // Subclass ID = 3 : Venetian
-                case 4: // Subclass ID = 4 : Modified Venetian
-                case 5: // Subclass ID = 5 : Dutch Modern
-                case 6: // Subclass ID = 6 : Dutch Traditional
-                case 7: // Subclass ID = 7 : Contemporary
-                case 8: // Subclass ID = 8 : Calligraphic
-                case 15: // Subclass ID = 15 : Miscellaneous
-                default: // Subclass ID = 9-14 : (reserved for future use)
-                    break;
-            }
-
-        case 2: // Class ID = 2 Transitional Serifs
-            switch (jSubclassId)
-            {
-                case 15: return FF_ROMAN; // 15: Miscellaneous
-                case 0: // Subclass ID = 0 : No Classification
-                case 1: // Subclass ID = 1 : Direct Line
-                case 2: // Subclass ID = 2 : Script
-                default: // Subclass ID = 3-14 : (reserved for future use)
-                    break;
-            }
-
-        case 3: // Class ID = 3 Modern Serifs
-            switch (jSubclassId)
-            {
-                case 0: // Subclass ID = 0 : No Classification
-                case 1: // Subclass ID = 1 : Italian
-                case 2: // Subclass ID = 2 : Script
-                case 15: // Subclass ID = 15 : Miscellaneous
-                default: // Subclass ID = 3-14 : (reserved for future use)
-                    break;
-            }
-
-        case 4: // Class ID = 4 Clarendon Serifs
-            switch (jSubclassId)
-            {
-                case 0: // Subclass ID = 0 : No Classification
-                case 1: // Subclass ID = 1 : Clarendon
-                case 2: // Subclass ID = 2 : Modern
-                case 3: // Subclass ID = 3 : Traditional
-                case 4: // Subclass ID = 4 : Newspaper
-                case 5: // Subclass ID = 5 : Stub Serif
-                case 6: // Subclass ID = 6 : Monotone
-                case 7: // Subclass ID = 7 : Typewriter
-                case 15: // Subclass ID = 15 : Miscellaneous
-                default: // Subclass ID = 8-14: (reserved for future use)
-                    break;
-            }
-
-        case 5: // Class ID = 5 Slab Serifs
-            switch (jSubclassId)
-            {
-                case 0: // Subclass ID = 0 : No Classification
-                case 1: // Subclass ID = 1 : Monotone
-                case 2: // Subclass ID = 2 : Humanist
-                case 3: // Subclass ID = 3 : Geometric
-                case 4: // Subclass ID = 4 : Swiss
-                case 5: // Subclass ID = 5 : Typewriter
-                case 15: // Subclass ID = 15 : Miscellaneous
-                default: // Subclass ID = 6-14 : (reserved for future use)
-                    break;
-            }
-
-        case 7: // Class ID = 7 Freeform Serifs
-            switch (jSubclassId)
-            {
-                case 0: // Subclass ID = 0 : No Classification
-                case 1: // Subclass ID = 1 : Modern
-                case 15: // Subclass ID = 15 : Miscellaneous
-                default: // Subclass ID = 2-14 : (reserved for future use)
-                    break;
-            }
-
-        case 8: // Class ID = 8 Sans Serif
-            switch (jSubclassId)
-            {
-                case 0: return FF_SWISS; // 0: No Classification
-                case 5: return FF_SWISS; // 5: Neo-grotesque Gothic
-                case 15: return FF_SWISS|FF_ROMAN; // 15: Miscellaneous
-
-                case 1: // Subclass ID = 1 : IBM Neo-grotesque Gothic
-                case 2: // Subclass ID = 2 : Humanist
-                case 3: // Subclass ID = 3 : Low-x Round Geometric
-                case 4: // Subclass ID = 4 : High-x Round Geometric
-                case 6: // Subclass ID = 6 : Modified Neo-grotesque Gothic
-                case 9: // Subclass ID = 9 : Typewriter Gothic
-                case 10: // Subclass ID = 10 : Matrix
-                default: // Subclass ID = 7-8, 11-14 : (reserved for future 
use)
-                    break;
-            }
-
-        case 9: // Class ID = 9 Ornamentals
-            switch (jSubclassId)
-            {
-                case 0: // Subclass ID = 0 : No Classification
-                case 1: // Subclass ID = 1 : Engraver
-                case 2: // Subclass ID = 2 : Black Letter
-                case 3: // Subclass ID = 3 : Decorative
-                case 4: // Subclass ID = 4 : Three Dimensional
-                case 15: // Subclass ID = 15 : Miscellaneous
-                default: // Subclass ID = 5-14 : (reserved for future use)
-                    break;
-            }
-
-        case 10: // Class ID = 10 Scripts
-            switch (jSubclassId)
-            {
-                case 0: // Subclass ID = 0 : No Classification
-                case 1: // Subclass ID = 1 : Uncial
-                case 2: // Subclass ID = 2 : Brush Joined
-                case 3: // Subclass ID = 3 : Formal Joined
-                case 4: // Subclass ID = 4 : Monotone Joined
-                case 5: // Subclass ID = 5 : Calligraphic
-                case 6: // Subclass ID = 6 : Brush Unjoined
-                case 7: // Subclass ID = 7 : Formal Unjoined
-                case 8: // Subclass ID = 8 : Monotone Unjoined
-                case 15: // Subclass ID = 15 : Miscellaneous
-                default: // Subclass ID = 9-14 : (reserved for future use)
-                    break;
-            }
-
-        case 12: // Class ID = 12 Symbolic
-            switch (jSubclassId)
-            {
-                case 0: // Subclass ID = 0 : No Classification
-                case 3: // Subclass ID = 3 : Mixed Serif
-                case 6: // Subclass ID = 6 : Oldstyle Serif
-                case 7: // Subclass ID = 7 : Neo-grotesque Sans Serif
-                case 15: // Subclass ID = 15 : Miscellaneous
-                default: // Subclass ID = 1-2,4-5,8-14  : (reserved for future 
use)
-                    break;
-            }
-
-        case 13: // Class ID = 13 Reserved
-        case 14: // Class ID = 14 Reserved
-        default: // Class ID = 6,11 (reserved for future use)
-            break;
-    }
-
-__debugbreak();
-    return 0;
-}
-
-VOID
-NTAPI
-OtfGetIfiMetrics(
-    PFTFD_FACE pface,
-    PIFIMETRICS pifi)
-{
-    PFTFD_FILE pfile = pface->pfile;
-    PVOID pvView = pfile->pvView;
-    POTF_OS2_DATA pOs2;
-
-    /* Try to get type 1 info */
-    OtfGetType1FontInfo(pface, pifi);
-
-    /* Get the OS/2 table for the face */
-    // FIXME: get the right table for the face, when multiple faces
-    pOs2 = OtfFindTable(pvView, pfile->cjView, '2/SO', NULL);
-    if (!pOs2)
-    {
-        DbgPrint("Couldn't find OS/2 table\n");
-        return;
-    }
-
-    //pifi->lEmbedId;
-    //pifi->lItalicAngle;
-    //pifi->lCharBias;
-    //pifi->jWinCharSet;
-    pifi->jWinPitchAndFamily &= 3;
-    pifi->jWinPitchAndFamily |= OtfGetWinFamily(pOs2->jClassId, 
pOs2->jSubClassId);
-    pifi->usWinWeight = SWAPW(pOs2->usWeightClass);
-    pifi->fsSelection = SWAPW(pOs2->fsSelection);
-    pifi->fsType = SWAPW(pOs2->fsType);
-    pifi->fwdWinAscender = SWAPW(pOs2->usWinAscent);
-    pifi->fwdWinDescender = SWAPW(pOs2->usWinDescent);
-    //pifi->fwdMacAscender;
-    //pifi->fwdMacDescender;
-    //pifi->fwdMacLineGap;
-    pifi->fwdTypoAscender = SWAPW(pOs2->sTypoAscender);
-    pifi->fwdTypoDescender = SWAPW(pOs2->sTypoDescender);
-    pifi->fwdTypoLineGap = SWAPW(pOs2->sTypoLineGap);
-    pifi->fwdAveCharWidth = SWAPW(pOs2->xAvgCharWidth);
-    pifi->fwdCapHeight = SWAPW(pOs2->sCapHeight);
-    pifi->fwdXHeight = SWAPW(pOs2->sxHeight);
-    pifi->fwdSubscriptXSize = SWAPW(pOs2->ySubscriptXSize);
-    pifi->fwdSubscriptYSize = SWAPW(pOs2->ySubscriptYSize);
-    pifi->fwdSubscriptXOffset = SWAPW(pOs2->ySubscriptXOffset);
-    pifi->fwdSubscriptYOffset = SWAPW(pOs2->ySubscriptYOffset);
-    pifi->fwdSuperscriptXSize = SWAPW(pOs2->ySuperscriptXSize);
-    pifi->fwdSuperscriptYSize = SWAPW(pOs2->ySuperscriptYSize);
-    pifi->fwdSuperscriptXOffset = SWAPW(pOs2->ySuperscriptXOffset);
-    pifi->fwdSuperscriptYOffset = SWAPW(pOs2->ySuperscriptYOffset);
-    //pifi->fwdUnderscoreSize;
-    //pifi->fwdUnderscorePosition;
-    pifi->fwdStrikeoutSize = SWAPW(pOs2->yStrikeoutSize);
-    pifi->fwdStrikeoutPosition = SWAPW(pOs2->yStrikeoutPosition);
-    pifi->wcFirstChar = SWAPW(pOs2->usFirstCharIndex);
-    pifi->wcLastChar = SWAPW(pOs2->usLastCharIndex);
-    pifi->wcDefaultChar = SWAPW(pOs2->usDefaultChar);
-    pifi->wcBreakChar = SWAPW(pOs2->usBreakChar);
-    *(DWORD*)pifi->achVendId = *(DWORD*)pOs2->achVendID;
-    //pifi->ulPanoseCulture;
-    pifi->panose = *(PANOSE*)pOs2->panose;
-
-    /* Convert the special characters from unicode to ansi */
-    EngUnicodeToMultiByteN(&pifi->chFirstChar, 4, NULL, &pifi->wcFirstChar, 3);
-
-}
-

Copied: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.c 
(from r51589, 
branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/opentype.c)
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.c?p2=branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.c&p1=branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/opentype.c&r1=51589&r2=51618&rev=51618&view=diff
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/opentype.c 
[iso-8859-1] (original)
+++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.c 
[iso-8859-1] Sat May  7 13:36:02 2011
@@ -8,169 +8,98 @@
  */
 
 #include "ftfd.h"
-#include <freetype/t1tables.h>
-
-// FIXME: we can have unaligned memory access, use:
-#define GETW(px) = (((PUCHAR)px)[1] | ((PUCHAR)px)[0] << 8)
-#define GETD(px) = (GETW((PUCHAR)px + 2) | GETW(px) << 16)
-
-#define SWAPW(x) _byteswap_ushort(x)
-#define SWAPD(x) _byteswap_ulong(x)
-
-typedef struct _OTF_TABLE_ENTRY
-{
-    ULONG ulTag;
-    ULONG ulCheckSum;
-    ULONG ulOffset;
-    ULONG ulLength;
-} OTF_TABLE_ENTRY, *POTF_TABLE_ENTRY;
-
-typedef struct _OTF_FILE_HEADER
-{
-    ULONG ulIdentifier;
-    USHORT usNumTables;
-    USHORT usSearchRange;
-    USHORT usEntrySelector;
-    USHORT usRangeshift;
-
-    OTF_TABLE_ENTRY aTableEntries[1];
-
-} OTF_FILE_HEADER, *POTF_FILE_HEADER;
-
-#include <pshpack1.h>
-typedef struct _OTF_OS2_DATA
-{
-    USHORT     version; //     0x0004
-    SHORT      xAvgCharWidth;
-    USHORT     usWeightClass;
-    USHORT     usWidthClass;
-    USHORT     fsType;
-    SHORT      ySubscriptXSize;
-    SHORT      ySubscriptYSize;
-    SHORT      ySubscriptXOffset;
-    SHORT      ySubscriptYOffset;
-    SHORT      ySuperscriptXSize;
-    SHORT      ySuperscriptYSize;
-    SHORT      ySuperscriptXOffset;
-    SHORT      ySuperscriptYOffset;
-    SHORT      yStrikeoutSize;
-    SHORT      yStrikeoutPosition;
-    union // 0x30
-    {
-        struct
-        {
-            BYTE jClassId;
-            BYTE jSubClassId;
-        };
-        SHORT  sFamilyClass;
-    };
-    BYTE       panose[10];
-    ULONG      ulUnicodeRange1; //     Bits 0-31
-    ULONG      ulUnicodeRange2; //     Bits 32-63
-    ULONG      ulUnicodeRange3; //     Bits 64-95
-    ULONG      ulUnicodeRange4; //     Bits 96-127
-    CHAR       achVendID[4];
-    USHORT     fsSelection;
-    USHORT     usFirstCharIndex;
-    USHORT     usLastCharIndex;
-    SHORT      sTypoAscender;
-    SHORT      sTypoDescender;
-    SHORT      sTypoLineGap;
-    USHORT     usWinAscent;
-    USHORT     usWinDescent;
-    ULONG      ulCodePageRange1; //    Bits 0-31
-    ULONG      ulCodePageRange2; //    Bits 32-63
-    SHORT      sxHeight;
-    SHORT      sCapHeight;
-    USHORT     usDefaultChar;
-    USHORT     usBreakChar;
-    USHORT     usMaxContext;
-} OTF_OS2_DATA, *POTF_OS2_DATA;
-#include <poppack.h>
-
+#include "tttables.h"
+
+ULONG test_GETD(PVOID pv)
+{
+    PUSHORT pus = pv;
+    return (ULONG)_byteswap_ushort(pus[0]) << 16 | _byteswap_ushort(pus[1]);
+}
+
+static
 ULONG
 CalcTableChecksum(PVOID pvTable, ULONG cjTable)
 {
     PULONG pul = pvTable, pulEnd;
     ULONG ulCheckSum = 0L;
+    ASSERT(!((ULONG_PTR)pvTable & 3));
 
     pulEnd = (PULONG)pvTable + (cjTable + 3) / sizeof(ULONG);
 
-    while (pul < pulEnd) ulCheckSum += SWAPD(*pul++);
+    while (pul < pulEnd) ulCheckSum += GETD(pul++);
 
     return ulCheckSum;
 }
 
-BOOL
-OtfGetType1FontInfo(
-    PFTFD_FACE pface,
-    PIFIMETRICS pifi)
-{
-    FT_Error fterror;
-    PS_FontInfoRec fontinfo;
-
-    fterror = FT_Get_PS_Font_Info(pface->ftface, &fontinfo);
-    if (fterror)
-    {
-        DbgPrint("ERROR: Failed to retrieve font info\n");
-        return FALSE;
-    }
-
-    /* Try to find the font weight */
-    if (strncpy(fontinfo.weight, "Normal", 7) == 0)
-        pifi->usWinWeight = FW_NORMAL;
-    // else if (..)
-    else
-        pifi->usWinWeight = FW_REGULAR;
-
-    pifi->lItalicAngle = fontinfo.italic_angle;
-
-    /* Clear lower 2 bits and set FIXED_PITCH or VARIABLE_PITCH */
-    pifi->jWinPitchAndFamily &= ~3;
-    if (fontinfo.is_fixed_pitch)
-        pifi->jWinPitchAndFamily |= FIXED_PITCH;
-    else
-        pifi->jWinPitchAndFamily |= VARIABLE_PITCH;
-
-    return TRUE;
-}
-
-/*! \name OtfFindTable
+/*! \name FtfdFindTrueTypeTable
  *  \brief Searches for a specific table in TrueType and OpenType font files
  *  \param pvView - The address where the font file is mapped
- *  \param vjView - Size of the mapped font file
+ *  \param cjView - Size of the mapped font file
+ *  \param iFace - 1-based index of the font in the font file.
  *  \param ulTag - Identifier tag of the table to search
  *  \param pulLength - Pointer to an ULONG that recieves the table length,
- *                     Can be NULL;
+ *                     Can be NULL.
  *  \return Pointer to the table if successful, NULL if unsuccessful.
  */
 PVOID
 NTAPI
-OtfFindTable(
+FtfdFindTrueTypeTable(
     PVOID pvView,
     ULONG cjView,
+    ULONG ulFont,
     ULONG ulTag,
     PULONG pulLength)
 {
-    POTF_FILE_HEADER pFileHeader = pvView;
+    POTF_FILE_HEADER pFontHeader;
+    PTT_COLLECTION pCollection;
     ULONG i, ulOffset, ulLength, ulNumTables, ulCheckSum;
-
-    /* Verify the file header */
-    if (pFileHeader->ulIdentifier != 'OTTO' &&
-        pFileHeader->ulIdentifier != 'fctt' &&
-        pFileHeader->ulIdentifier != 0x00000100)
-    {
-        DbgPrint("ERROR: Couldn't verify identifier: 0x%lx\n",
-                 pFileHeader->ulIdentifier);
+    ASSERT(ulFont > 0);
+
+    /* Check if this is a font collection */
+    pCollection = pvView;
+    if (pCollection->ulTTCTag == 'fctt')
+    {
+        /* Check if we have enough fonts in the file */
+        if (ulFont > GETD(&pCollection->ulNumFonts))
+        {
+            WARN("ulFont too big: %ld\n", ulFont);
+            return NULL;
+        }
+
+        /* Get the offset of the font we want */
+        ulOffset = GETD(&pCollection->aulOffsetTable[ulFont - 1]);
+        if (ulOffset >= cjView)
+        {
+            WARN("Font %ld is not inside the mapped region\n", ulFont);
+            return NULL;
+        }
+
+        /* Update the font position and remaining view size */
+        pvView = (PUCHAR)pvView + ulOffset;
+        cjView -= ulOffset;
+    }
+    else if (ulFont > 1)
+    {
+        // Shouldn't happen
+        __debugbreak();
+    }
+
+    /* Verify the font header */
+    pFontHeader = pvView;
+    if (pFontHeader->ulIdentifier != 'OTTO' &&
+        pFontHeader->ulIdentifier != 0x00000100)
+    {
+        WARN("Bad font header: 0x%lx\n",
+                 pFontHeader->ulIdentifier);
         return NULL;
     }
 
     /* Check if number of tables is ok */
-    ulNumTables = SWAPW(pFileHeader->usNumTables);
+    ulNumTables = GETW(&pFontHeader->usNumTables);
     ulLength = ulNumTables * sizeof(OTF_TABLE_ENTRY);
     if (ulLength + sizeof(OTF_FILE_HEADER) > cjView)
     {
-        DbgPrint("ERROR: Too many tables (%ld)\n", ulNumTables);
+        WARN("Too many tables (%ld)\n", ulNumTables);
         return NULL;
     }
 
@@ -178,27 +107,29 @@
     for (i = 0; i < ulNumTables; i++)
     {
         /* Compare the tag */
-        if (pFileHeader->aTableEntries[i].ulTag == ulTag)
+        if (pFontHeader->aTableEntries[i].ulTag == ulTag)
         {
             /* Get table offset and length */
-            ulOffset = SWAPD(pFileHeader->aTableEntries[i].ulOffset);
-            ulLength = SWAPD(pFileHeader->aTableEntries[i].ulLength);
+            ulOffset = GETD(&pFontHeader->aTableEntries[i].ulOffset);
+            ulLength = GETD(&pFontHeader->aTableEntries[i].ulLength);
 
             /* Check if this is inside the file */
             if (ulOffset + ulLength > cjView ||
                 ulOffset + ulLength < ulOffset)
             {
-                DbgPrint("invalid table entry. %ld, %ld \n", ulOffset, 
ulLength);
+                WARN("Invalid table entry. %ld, %ld \n", ulOffset, ulLength);
                 return NULL;
             }
 
+            /* Check the table's checksum */
             ulCheckSum = CalcTableChecksum((PUCHAR)pvView + ulOffset, 
ulLength);
-            if (ulCheckSum != SWAPD(pFileHeader->aTableEntries[i].ulCheckSum))
-            {
-                DbgPrint("Checksum mitmatch! %ld, %ld \n", ulOffset, ulLength);
+            if (ulCheckSum != GETD(&pFontHeader->aTableEntries[i].ulCheckSum))
+            {
+                WARN("Checksum mitmatch! %ld, %ld \n", ulOffset, ulLength);
                 return NULL;
             }
 
+            /* Return size and pointer to the table */
             if (pulLength) *pulLength = ulLength;
             return (PUCHAR)pvView + ulOffset;
         }
@@ -208,14 +139,15 @@
     return NULL;
 }
 
-/*! \name OtfGetWinFamily
+/*! \name GetWinFamily
  *  \brief Translates IBM font class IDs into a Windows family bitfield
  *  \param jClassId
  *  \param jSubclassId
  *  \ref http://www.microsoft.com/typography/otspec/ibmfc.htm
  */
+static
 BYTE
-OtfGetWinFamily(BYTE jClassId, BYTE jSubclassId)
+GetWinFamily(BYTE jClassId, BYTE jSubclassId)
 {
     switch (jClassId)
     {
@@ -373,7 +305,7 @@
 
 VOID
 NTAPI
-OtfGetIfiMetrics(
+FtfdGetWinMetrics(
     PFTFD_FACE pface,
     PIFIMETRICS pifi)
 {
@@ -381,15 +313,12 @@
     PVOID pvView = pfile->pvView;
     POTF_OS2_DATA pOs2;
 
-    /* Try to get type 1 info */
-    OtfGetType1FontInfo(pface, pifi);
-
     /* Get the OS/2 table for the face */
     // FIXME: get the right table for the face, when multiple faces
-    pOs2 = OtfFindTable(pvView, pfile->cjView, '2/SO', NULL);
+    pOs2 = FtfdFindTrueTypeTable(pvView, pfile->cjView, pface->iFace, '2/SO', 
NULL);
     if (!pOs2)
     {
-        DbgPrint("Couldn't find OS/2 table\n");
+        WARN("Couldn't find OS/2 table\n");
         return;
     }
 
@@ -398,37 +327,37 @@
     //pifi->lCharBias;
     //pifi->jWinCharSet;
     pifi->jWinPitchAndFamily &= 3;
-    pifi->jWinPitchAndFamily |= OtfGetWinFamily(pOs2->jClassId, 
pOs2->jSubClassId);
-    pifi->usWinWeight = SWAPW(pOs2->usWeightClass);
-    pifi->fsSelection = SWAPW(pOs2->fsSelection);
-    pifi->fsType = SWAPW(pOs2->fsType);
-    pifi->fwdWinAscender = SWAPW(pOs2->usWinAscent);
-    pifi->fwdWinDescender = SWAPW(pOs2->usWinDescent);
+    pifi->jWinPitchAndFamily |= GetWinFamily(pOs2->jClassId, 
pOs2->jSubClassId);
+    pifi->usWinWeight = GETW(&pOs2->usWeightClass);
+    pifi->fsSelection = GETW(&pOs2->fsSelection);
+    pifi->fsType = GETW(&pOs2->fsType);
+    pifi->fwdWinAscender = GETW(&pOs2->usWinAscent);
+    pifi->fwdWinDescender = GETW(&pOs2->usWinDescent);
     //pifi->fwdMacAscender;
     //pifi->fwdMacDescender;
     //pifi->fwdMacLineGap;
-    pifi->fwdTypoAscender = SWAPW(pOs2->sTypoAscender);
-    pifi->fwdTypoDescender = SWAPW(pOs2->sTypoDescender);
-    pifi->fwdTypoLineGap = SWAPW(pOs2->sTypoLineGap);
-    pifi->fwdAveCharWidth = SWAPW(pOs2->xAvgCharWidth);
-    pifi->fwdCapHeight = SWAPW(pOs2->sCapHeight);
-    pifi->fwdXHeight = SWAPW(pOs2->sxHeight);
-    pifi->fwdSubscriptXSize = SWAPW(pOs2->ySubscriptXSize);
-    pifi->fwdSubscriptYSize = SWAPW(pOs2->ySubscriptYSize);
-    pifi->fwdSubscriptXOffset = SWAPW(pOs2->ySubscriptXOffset);
-    pifi->fwdSubscriptYOffset = SWAPW(pOs2->ySubscriptYOffset);
-    pifi->fwdSuperscriptXSize = SWAPW(pOs2->ySuperscriptXSize);
-    pifi->fwdSuperscriptYSize = SWAPW(pOs2->ySuperscriptYSize);
-    pifi->fwdSuperscriptXOffset = SWAPW(pOs2->ySuperscriptXOffset);
-    pifi->fwdSuperscriptYOffset = SWAPW(pOs2->ySuperscriptYOffset);
+    pifi->fwdTypoAscender = GETW(&pOs2->sTypoAscender);
+    pifi->fwdTypoDescender = GETW(&pOs2->sTypoDescender);
+    pifi->fwdTypoLineGap = GETW(&pOs2->sTypoLineGap);
+    pifi->fwdAveCharWidth = GETW(&pOs2->xAvgCharWidth);
+    pifi->fwdCapHeight = GETW(&pOs2->sCapHeight);
+    pifi->fwdXHeight = GETW(&pOs2->sxHeight);
+    pifi->fwdSubscriptXSize = GETW(&pOs2->ySubscriptXSize);
+    pifi->fwdSubscriptYSize = GETW(&pOs2->ySubscriptYSize);
+    pifi->fwdSubscriptXOffset = GETW(&pOs2->ySubscriptXOffset);
+    pifi->fwdSubscriptYOffset = GETW(&pOs2->ySubscriptYOffset);
+    pifi->fwdSuperscriptXSize = GETW(&pOs2->ySuperscriptXSize);
+    pifi->fwdSuperscriptYSize = GETW(&pOs2->ySuperscriptYSize);
+    pifi->fwdSuperscriptXOffset = GETW(&pOs2->ySuperscriptXOffset);
+    pifi->fwdSuperscriptYOffset = GETW(&pOs2->ySuperscriptYOffset);
     //pifi->fwdUnderscoreSize;
     //pifi->fwdUnderscorePosition;
-    pifi->fwdStrikeoutSize = SWAPW(pOs2->yStrikeoutSize);
-    pifi->fwdStrikeoutPosition = SWAPW(pOs2->yStrikeoutPosition);
-    pifi->wcFirstChar = SWAPW(pOs2->usFirstCharIndex);
-    pifi->wcLastChar = SWAPW(pOs2->usLastCharIndex);
-    pifi->wcDefaultChar = SWAPW(pOs2->usDefaultChar);
-    pifi->wcBreakChar = SWAPW(pOs2->usBreakChar);
+    pifi->fwdStrikeoutSize = GETW(&pOs2->yStrikeoutSize);
+    pifi->fwdStrikeoutPosition = GETW(&pOs2->yStrikeoutPosition);
+    pifi->wcFirstChar = GETW(&pOs2->usFirstCharIndex);
+    pifi->wcLastChar = GETW(&pOs2->usLastCharIndex);
+    pifi->wcDefaultChar = GETW(&pOs2->usDefaultChar);
+    pifi->wcBreakChar = GETW(&pOs2->usBreakChar);
     *(DWORD*)pifi->achVendId = *(DWORD*)pOs2->achVendID;
     //pifi->ulPanoseCulture;
     pifi->panose = *(PANOSE*)pOs2->panose;
@@ -438,3 +367,104 @@
 
 }
 
+
+/** Public Interface 
**********************************************************/
+
+LONG
+APIENTRY
+FtfdQueryTrueTypeTable(
+    ULONG_PTR diFile,
+    ULONG ulFont,
+    ULONG ulTag,
+    PTRDIFF dpStart,
+    ULONG cjBuf,
+    BYTE *pjBuf,
+    PBYTE *ppjTable,
+    ULONG *pcjTable)
+{
+    PFTFD_FILE pfile = (PFTFD_FILE)diFile;
+    PBYTE pjTable;
+    ULONG cjTable;
+
+    TRACE("FtfdQueryTrueTypeTable\n");
+
+    /* Check if this file supports TrueType tables */
+    if (pfile->ulFileFormat != FILEFMT_TTF &&
+        pfile->ulFileFormat != FILEFMT_OTF)
+    {
+        WARN("File format doesn't support true type tables\n");
+        return FD_ERROR;
+    }
+
+    /* Check if the whole file is requested */
+    if (ulTag == 0)
+    {
+        /* Requested the whole file */
+        pjTable = pfile->pvView;
+        cjTable = pfile->cjView;
+    }
+    else
+    {
+        /* Search for the table */
+        pjTable = FtfdFindTrueTypeTable(pfile->pvView,
+                                        pfile->cjView,
+                                        ulFont,
+                                        ulTag,
+                                        &cjTable);
+        if (!pjTable)
+        {
+            WARN("Couldn't find table '%.4s'\n", (char*)&ulTag);
+            return FD_ERROR;
+        }
+    }
+
+    /* Return requested pointers */
+    if (ppjTable) *ppjTable = pjTable;
+    if (pcjTable) *pcjTable = cjTable;
+
+    /* Check if we shall copy data */
+    if (pjBuf)
+    {
+        /* Check if the offset is inside the table */
+        if (dpStart < 0 || (ULONG_PTR)dpStart >= cjTable)
+        {
+            WARN("dpStart outside the table: %p\n", dpStart);
+            return FD_ERROR;
+        }
+
+        /* Don't copy beyond the table end */
+        cjTable -= dpStart;
+
+        /* Don't copy more then the buffer can hold */
+        if (cjBuf < cjTable) cjTable = cjBuf;
+
+        /* Copy the data to the buffer */
+        RtlCopyMemory(pjBuf, pjTable + dpStart, cjTable);
+    }
+
+    return cjTable;
+}
+
+PVOID
+APIENTRY
+FtfdGetTrueTypeFile(
+    ULONG_PTR diFile,
+    ULONG *pcj)
+{
+    PFTFD_FILE pfile = (PFTFD_FILE)diFile;
+
+    TRACE("FtfdGetTrueTypeFile\n");
+
+    /* Check if this file is TrueType */
+    if (pfile->ulFileFormat != FILEFMT_TTF &&
+        pfile->ulFileFormat != FILEFMT_OTF)
+    {
+        WARN("File format is not TrueType or Opentype\n");
+        return NULL;
+    }
+
+    /* Return the pointer and size */
+    if (pcj) *pcj = pfile->cjView;
+    return pfile->pvView;
+}
+

Added: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.h
URL: 
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.h?rev=51618&view=auto
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.h (added)
+++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.h 
[iso-8859-1] Sat May  7 13:36:02 2011
@@ -1,0 +1,95 @@
+
+/* We need these to access unaligned big endian data */
+FORCEINLINE
+USHORT GETW(PVOID pv)
+{
+    PBYTE pj = pv;
+    return (((USHORT)pj[0]) << 8) | ((USHORT)pj[1]);
+}
+
+FORCEINLINE
+ULONG GETD(PVOID pv)
+{
+    PBYTE pj = pv;
+    return (((ULONG)pj[0]) << 24) | (((ULONG)pj[1]) << 16) |
+           (((ULONG)pj[2]) << 8) | ((ULONG)pj[3]);
+}
+
+typedef struct _TT_COLLECTION
+{
+    ULONG ulTTCTag;
+    ULONG ulVersion;
+    ULONG ulNumFonts;
+    ULONG aulOffsetTable[1];
+} TT_COLLECTION, *PTT_COLLECTION;
+
+typedef struct _OTF_TABLE_ENTRY
+{
+    ULONG ulTag;
+    ULONG ulCheckSum;
+    ULONG ulOffset;
+    ULONG ulLength;
+} OTF_TABLE_ENTRY, *POTF_TABLE_ENTRY;
+
+typedef struct _OTF_FILE_HEADER
+{
+    ULONG ulIdentifier;
+    USHORT usNumTables;
+    USHORT usSearchRange;
+    USHORT usEntrySelector;
+    USHORT usRangeshift;
+
+    OTF_TABLE_ENTRY aTableEntries[1];
+
+} OTF_FILE_HEADER, *POTF_FILE_HEADER;
+
+#include <pshpack1.h>
+typedef struct _OTF_OS2_DATA
+{
+    USHORT     version; //     0x0004
+    SHORT      xAvgCharWidth;
+    USHORT     usWeightClass;
+    USHORT     usWidthClass;
+    USHORT     fsType;
+    SHORT      ySubscriptXSize;
+    SHORT      ySubscriptYSize;
+    SHORT      ySubscriptXOffset;
+    SHORT      ySubscriptYOffset;
+    SHORT      ySuperscriptXSize;
+    SHORT      ySuperscriptYSize;
+    SHORT      ySuperscriptXOffset;
+    SHORT      ySuperscriptYOffset;
+    SHORT      yStrikeoutSize;
+    SHORT      yStrikeoutPosition;
+    union // 0x30
+    {
+        struct
+        {
+            BYTE jClassId;
+            BYTE jSubClassId;
+        };
+        SHORT  sFamilyClass;
+    };
+    BYTE       panose[10];
+    ULONG      ulUnicodeRange1; //     Bits 0-31
+    ULONG      ulUnicodeRange2; //     Bits 32-63
+    ULONG      ulUnicodeRange3; //     Bits 64-95
+    ULONG      ulUnicodeRange4; //     Bits 96-127
+    CHAR       achVendID[4];
+    USHORT     fsSelection;
+    USHORT     usFirstCharIndex;
+    USHORT     usLastCharIndex;
+    SHORT      sTypoAscender;
+    SHORT      sTypoDescender;
+    SHORT      sTypoLineGap;
+    USHORT     usWinAscent;
+    USHORT     usWinDescent;
+    ULONG      ulCodePageRange1; //    Bits 0-31
+    ULONG      ulCodePageRange2; //    Bits 32-63
+    SHORT      sxHeight;
+    SHORT      sCapHeight;
+    USHORT     usDefaultChar;
+    USHORT     usBreakChar;
+    USHORT     usMaxContext;
+} OTF_OS2_DATA, *POTF_OS2_DATA;
+#include <poppack.h>

Propchange: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.h
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to