Author: tkreuzer Date: Wed May 4 19:48:29 2011 New Revision: 51579
URL: http://svn.reactos.org/svn/reactos?rev=51579&view=rev Log: [GDI FONT DRIVER] Commit my first version of the font driver. current status: - It loads OpenType / Type1 files (couldn't test others) - It creates all neccessary structures for later management - It creates the glyphset (unicode->glyph handle translation) - it creates an IFIMETRICS structure, based on freetype info and TTF/OTF OS/2 table data, mostly complete
Added: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/opentype.c (with props) branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/todo.txt (with props) 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 branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/rosglue.c
Modified: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/... ============================================================================== --- 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] Wed May 4 19:48:29 2011 @@ -5,10 +5,11 @@
add_library(ftfd SHARED enable.c + file.c font.c glyph.c + opentype.c rosglue.c - sprintf.c ${CMAKE_CURRENT_BINARY_DIR}/ftfd.def)
set_entrypoint(ftfd FtfdEnableDriver@12)
Modified: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/enable.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/... ============================================================================== --- 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] Wed May 4 19:48:29 2011 @@ -1,7 +1,7 @@ /* * PROJECT: ReactOS win32 subsystem * LICENSE: GPL - See COPYING in the top level directory - * PURPOSE: GDI font driver for bitmap fonts + * PURPOSE: GDI font driver based on freetype * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) */
@@ -9,22 +9,28 @@
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}, + {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_DrvDestroyFont, (PFN)FtfdDestroyFont}, +// {INDEX_DrvFree, (PFN)FtfdFree}, + {INDEX_DrvQueryGlyphAttrs, (PFN)FtfdQueryGlyphAttrs}, + {INDEX_DrvQueryFontData, (PFN)FtfdQueryFontData}, + {INDEX_DrvQueryAdvanceWidths, (PFN)FtfdQueryAdvanceWidths}, + {INDEX_DrvQueryTrueTypeOutline, (PFN)FtfdQueryTrueTypeOutline}, + {INDEX_DrvQueryTrueTypeTable, (PFN)FtfdQueryTrueTypeTable}, + {INDEX_DrvEscape, (PFN)FtfdEscape}, + {INDEX_DrvFontManagement, (PFN)FtfdFontManagement}, + {INDEX_DrvGetTrueTypeFile, (PFN)FtfdGetTrueTypeFile}, };
FT_Library gftlibrary; -
BOOL APIENTRY @@ -33,7 +39,7 @@ ULONG cj, PDRVENABLEDATA pded) { - FT_Error fterror; + FT_Error fterror;
DbgPrint("FtfdEnableDriver()\n");
@@ -77,8 +83,6 @@ IN HANDLE hDriver) { DbgPrint("FtfdEnablePDEV(hdev=%p)\n", hdev); - __debugbreak(); -
/* Return a dummy DHPDEV */ return (PVOID)1; @@ -104,3 +108,19 @@ DbgPrint("FtfdDisablePDEV()\n"); /* Nothing to do */ } + +ULONG +APIENTRY +FtfdEscape( + SURFOBJ *pso, + ULONG iEsc, + ULONG cjIn, + PVOID pvIn, + ULONG cjOut, + PVOID pvOut) +{ + DbgPrint("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/... ============================================================================== --- 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] Wed May 4 19:48:29 2011 @@ -1,26 +1,438 @@ /* * PROJECT: ReactOS win32 subsystem * LICENSE: GPL - See COPYING in the top level directory - * PURPOSE: GDI font driver for bitmap fonts + * PURPOSE: GDI font driver based on freetype * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) */
#include "ftfd.h"
+FWORD +CalculateAveCharWidth( + FT_Face ftface) +{ + ULONG cGlyphs = 0, ulAccumCharWidth = 0; + WCHAR wc; + FT_UInt index; + FT_Error fterror; + + /* Loop all glyphs from 'a' to 'z' */ + for (wc = L'a'; wc <= L'z'; wc++) + { + /* Load the glyph into the glyph slot */ + fterror = FT_Load_Char(ftface, wc, FT_LOAD_NO_SCALE|FT_LOAD_NO_BITMAP); + if (fterror) goto allglyphs; + + /* Calculate accumulative char width */ + ulAccumCharWidth += ftface->glyph->metrics.width; + cGlyphs++; + } + goto done; + +allglyphs: + DbgPrint("using all glyphs\n"); + + /* Start over */ + ulAccumCharWidth = 0; + cGlyphs = 0; + + /* Loop all glyphs in the font */ + for (index = 0; index <= (UINT)ftface->num_glyphs; index++) + { + /* Load the glyph into the glyph slot */ + fterror = FT_Load_Glyph(ftface, index, FT_LOAD_NO_SCALE|FT_LOAD_NO_BITMAP); + if (fterror) continue; + + /* Calculate accumulative char width */ + ulAccumCharWidth += ftface->glyph->metrics.width; // fIXME: weighted + cGlyphs++; + } + +done: + return (FWORD)(ulAccumCharWidth / cGlyphs); +} + +BOOL +NTAPI +FtfdInitIfiMetrics( + PFTFD_FACE pface) +{ + PFTFD_IFIMETRICS pifiex; + PIFIMETRICS pifi; + FT_Face ftface; + ULONG i; + + DbgPrint("FtfdInitIfiMetrics()\n"); + + /* Get the freetype face pointer */ + ftface = pface->ftface; + + /* Fill IFIMETRICS */ + pifiex = &pface->ifiex; + pifi = &pface->ifiex.ifi; + pifi->cjThis = sizeof(FTFD_IFIMETRICS); + pifi->cjIfiExtra = 0; + + /* Set relative offsets */ + pifi->dpwszFamilyName = FIELD_OFFSET(FTFD_IFIMETRICS, awcFamilyName); + pifi->dpwszStyleName = FIELD_OFFSET(FTFD_IFIMETRICS, awcStyleName); + pifi->dpwszFaceName = FIELD_OFFSET(FTFD_IFIMETRICS, awcFaceName); + pifi->dpwszUniqueName = FIELD_OFFSET(FTFD_IFIMETRICS, awcUniqueName); + pifi->dpCharSets = FIELD_OFFSET(FTFD_IFIMETRICS, ajCharSet); + pifi->dpFontSim = 0; + + /* Charsets */ + pifi->jWinCharSet = ANSI_CHARSET; + pifiex->ajCharSet[0] = pifi->jWinCharSet; + for (i = 1; i < 16; i++) + { + pifiex->ajCharSet[i] = DEFAULT_CHARSET; + } + + 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; + if (pface->ulFontFormat == FMT_TYPE1) + pifi->flInfo |= FM_INFO_TECH_TYPE1; + if (pface->ulFontFormat == FMT_CFF) + pifi->flInfo |= FM_INFO_TECH_TYPE1 | FM_INFO_TECH_CFF; + if (pface->ulFontFormat == FMT_TRUETYPE) + pifi->flInfo |= FM_INFO_TECH_TRUETYPE; + else + pifi->flInfo |= FM_INFO_TECH_OUTLINE_NOT_TRUETYPE; + if (pface->cRuns > 1) + pifi->flInfo |= FM_INFO_NOT_CONTIGUOUS; + if (pface->ulFontFormat != FMT_FNT) + pifi->flInfo |= FM_INFO_RETURNS_OUTLINES | FM_INFO_ARB_XFORMS; + pifi->flInfo |= FM_INFO_RIGHT_HANDED; // FIXME: how to determine? + + /* Font style */ + pifi->fsSelection = FM_SEL_REGULAR; + pifi->usWinWeight = FW_REGULAR; + if (ftface->style_flags & FT_STYLE_FLAG_BOLD) + { + pifi->fsSelection &= ~FM_SEL_REGULAR; + pifi->fsSelection |= FM_SEL_BOLD; + pifi->usWinWeight = FW_BOLD; + } + if (ftface->style_flags & FT_STYLE_FLAG_ITALIC) + { + pifi->fsSelection &= ~FM_SEL_REGULAR; // ??? remove it? + pifi->fsSelection |= FM_SEL_ITALIC; + } + + pifi->fsType = 0; + + /* Font resolution */ + pifi->fwdUnitsPerEm = ftface->units_per_EM; + pifi->fwdLowestPPEm = 3; // FIXME + + /* Font metrics */ + pifi->fwdWinAscender = (ftface->ascender * 213) / 170; + pifi->fwdWinDescender = -(ftface->descender * 213) / 170; + pifi->fwdMacAscender = ftface->ascender; + pifi->fwdMacDescender = ftface->descender; + pifi->fwdMacLineGap = 0; + pifi->fwdAveCharWidth = 0; + pifi->fwdTypoAscender = pifi->fwdMacAscender; + pifi->fwdTypoDescender = pifi->fwdMacDescender; + pifi->fwdTypoLineGap = 0; + pifi->fwdMaxCharInc = ftface->max_advance_width; + pifi->fwdCapHeight = 0; + pifi->fwdXHeight = 0; + pifi->fwdSubscriptXSize = 0; + pifi->fwdSubscriptYSize = 0; + pifi->fwdSubscriptXOffset = 0; + pifi->fwdSubscriptYOffset = 0; + pifi->fwdSuperscriptXSize = 0; + pifi->fwdSuperscriptYSize = 0; + pifi->fwdSuperscriptXOffset = 0; + pifi->fwdSuperscriptYOffset = 0; + pifi->fwdUnderscoreSize = ftface->underline_thickness; + pifi->fwdUnderscorePosition = ftface->underline_position; // FIXME: off by 10 + pifi->fwdStrikeoutSize = pifi->fwdUnitsPerEm / 20; + pifi->fwdStrikeoutPosition = pifi->fwdUnitsPerEm / 4; + + pifi->ptlBaseline.x = 1; // FIXME + pifi->ptlBaseline.y = 0; // FIXME + pifi->ptlAspect.x = 0x3e9; // FIXME + pifi->ptlAspect.y = 0x3e9; // FIXME + pifi->ptlCaret.x = 0; // FIXME + pifi->ptlCaret.y = 1; // FIXME + + /* Set the biggest characters bounding box */ + pifi->rclFontBox.left = ftface->bbox.xMin; + pifi->rclFontBox.right = ftface->bbox.xMax; + pifi->rclFontBox.top = ftface->bbox.yMax; + pifi->rclFontBox.bottom = ftface->bbox.yMin; + + /* Special characters */ + pifi->chFirstChar = 0x00; + pifi->chLastChar = 0xff; + pifi->chDefaultChar = 0x20; + pifi->chBreakChar = 0x20; + //pifi->wcFirstChar = 0; + //pifi->wcLastChar = 0x00ff; + pifi->wcDefaultChar = 0x0020; + pifi->wcBreakChar = 0x0020; + + *(DWORD*)&pifi->achVendId = '0000'; + pifi->cKerningPairs = 0; + pifi->ulPanoseCulture = FM_PANOSE_CULTURE_LATIN; + + pifi->panose.bFamilyType = PAN_FAMILY_TEXT_DISPLAY; + pifi->panose.bSerifStyle = PAN_ANY; + pifi->panose.bWeight = PAN_ANY; + pifi->panose.bProportion = PAN_ANY; + pifi->panose.bContrast = PAN_ANY; + pifi->panose.bStrokeVariation = PAN_ANY; + pifi->panose.bArmStyle = PAN_ANY; + pifi->panose.bLetterform = PAN_ANY; + pifi->panose.bMidline = PAN_ANY; + pifi->panose.bXHeight = PAN_ANY; + + EngMultiByteToUnicodeN(pifiex->awcFamilyName, + LF_FACESIZE, + NULL, + ftface->family_name, + strnlen(ftface->family_name, MAX_PATH)); + + EngMultiByteToUnicodeN(pifiex->awcStyleName, + LF_FACESIZE, + NULL, + ftface->style_name, + strnlen(ftface->style_name, MAX_PATH)); + + EngMultiByteToUnicodeN(pifiex->awcFaceName, + LF_FACESIZE, + NULL, + ftface->family_name, + strnlen(ftface->family_name, MAX_PATH)); + + /* Use OS/2 TrueType or OpenType tables */ + OtfGetIfiMetrics(pface, pifi); + + if (pifi->fwdAveCharWidth == 0) + pifi->fwdAveCharWidth = CalculateAveCharWidth(ftface); + + /* Create a unique name */ + wcscpy(pifiex->awcUniqueName, L"1.000;ABCD;"); + wcsncat(pifiex->awcUniqueName, pifiex->awcFamilyName, LF_FACESIZE); + pifiex->awcUniqueName[0] = L'1'; // + version? + //pifiex->awcUniqueName[2] = L'0'; // + version? + EngMultiByteToUnicodeN(pifiex->awcUniqueName + 6, + 4, + NULL, + pifi->achVendId, + 4); + + DbgPrint("Finished with the ifi: %p\n", pifi); + __debugbreak(); + + return TRUE; +} + PVOID -HackFixup( - PVOID pvView, - ULONG cjView) -{ - CHAR *pc; - - pc = EngAllocMem(0, cjView, 'tmp '); - memcpy(pc, pvView, cjView); - - *pc = 0; - - return pc; -} +APIENTRY +FtfdInitGlyphSet( + PFTFD_FACE pface) +{ + FT_Face ftface = pface->ftface; + FD_GLYPHSET *pGlyphSet; + FT_UInt index; + ULONG i, j, cjSize; + HGLYPH * phglyphs; + WCHAR wcCurrent, wcPrev; + + DbgPrint("FtfdInitGlyphSet()\n"); + + /* Calculate FD_GLYPHSET size */ + cjSize = sizeof(FD_GLYPHSET) + (pface->cRuns - 1) * sizeof(WCRUN); + + /* Allocate the FD_GLYPHSET structure plus an array of HGLYPHs */ + pGlyphSet = EngAllocMem(0, cjSize + pface->cMappings * sizeof(HGLYPH), TAG_GLYPHSET); + if (!pGlyphSet) + { + DbgPrint("EngAllocMem() failed.\n"); + return NULL; + } + + /* Get a pointer to the HGLYPH array */ + phglyphs = (PHGLYPH)&pGlyphSet->awcrun[pface->cRuns]; + + /* Initialize FD_GLYPHSET */ + pGlyphSet->cjThis = cjSize; + pGlyphSet->flAccel = 0; + pGlyphSet->cGlyphsSupported = pface->cMappings; + pGlyphSet->cRuns = pface->cRuns; + + /* Loop through all character mappings */ + wcPrev = wcCurrent = (WCHAR)FT_Get_First_Char(ftface, &index); + for (i = 0, j = 0; i < pface->cMappings && index; i++) + { + /* Use index as glyph handle */ + phglyphs[i] = (HGLYPH)index; + + /* Check whether we can append the wchar to a run */ + if (wcCurrent == wcPrev + 1) + { + /* Append to current WCRUN */ + pGlyphSet->awcrun[j].cGlyphs++; + } + else + { + /* Add a new WCRUN */ + pGlyphSet->awcrun[j].wcLow = wcCurrent; + pGlyphSet->awcrun[j].cGlyphs = 1; + pGlyphSet->awcrun[j].phg = &phglyphs[i]; + j++; + //DbgPrint("adding new run i=%ld, j=%ld, wc=%x\n", i, j, wcCurrent); + } + + /* Get the next charcode and index */ + wcPrev = wcCurrent; + wcCurrent = (WCHAR)FT_Get_Next_Char(ftface, wcCurrent, &index); + } + + DbgPrint("Done with font tree, %d runs\n", pGlyphSet->cRuns); + pface->pGlyphSet = pGlyphSet; + return pGlyphSet; +} + +VOID +FtfdInitKerningPairs( + PFTFD_FACE pface) +{ + //DbgPrint("unimplemented\n"); +} + +static +ULONG +FtfdGetFontFormat(FT_Face ftface) +{ + const char *pstrFormat; + + /* FreeType only provides a string :-/ */ + pstrFormat = FT_Get_X11_Font_Format(ftface); + if (strcmp(pstrFormat, "TrueType") == 0) return FMT_TRUETYPE; + if (strcmp(pstrFormat, "Type 1") == 0) return FMT_TYPE1; + if (strcmp(pstrFormat, "CFF") == 0) return FMT_CFF; + if (strcmp(pstrFormat, "Windows FNT") == 0) return FMT_FNT; + if (strcmp(pstrFormat, "BDF") == 0) return FMT_BDF; + if (strcmp(pstrFormat, "PCF") == 0) return FMT_PCF; + if (strcmp(pstrFormat, "Type 42") == 0) return FMT_TYPE42; + if (strcmp(pstrFormat, "CID Type 1") == 0) return FMT_CIDTYPE1; + if (strcmp(pstrFormat, "PFR") == 0) return FMT_PFR; + return FMT_UNKNOWN; +} + +FtfdGetFileFormat( + PFTFD_FILE pfile) +{ + ULONG ulFontFormat = pfile->apface[0]->ulFontFormat; + + if (ulFontFormat == FMT_CFF) return FILEFMT_OTF; + if (ulFontFormat == FMT_FNT) return FILEFMT_FNT; + if (ulFontFormat == FMT_TRUETYPE) + { + if (*(DWORD*)pfile->pvView == 'OTTO') return FILEFMT_OTF; + return FILEFMT_TTF; + } + + __debugbreak(); + return 0; +} + +PFTFD_FACE +NTAPI +FtfdCreateFace( + PFTFD_FILE pfile, + FT_Face ftface) +{ + PFTFD_FACE pface; + FT_Error fterror; + ULONG ulAccumCharWidth = 0; + WCHAR wcCurrent, wcPrev; + FT_UInt index; + + pface = EngAllocMem(FL_ZERO_MEMORY, sizeof(FTFD_FACE), 'dftF'); + if (!pface) + { + DbgPrint("Couldn't allcate a face\n"); + return NULL; + } + + pface->pfile = pfile; + pface->ftface = ftface; + pface->cGlyphs = ftface->num_glyphs; + + /* Get the font format */ + pface->ulFontFormat = FtfdGetFontFormat(ftface); + + /* Load a unicode charmap */ + fterror = FT_Select_Charmap(ftface, FT_ENCODING_UNICODE); + if (fterror) + { + DbgPrint("ERROR: Could not load unicode charmap\n"); + return NULL; + } + + /* Start with 0 runs and 0 mappings */ + pface->cMappings = 0; + pface->cRuns = 0; + + /* Loop through all character mappings */ + wcPrev = wcCurrent = (WCHAR)FT_Get_First_Char(ftface, &index); + pface->ifiex.ifi.wcFirstChar = wcCurrent; + while (index) + { + /* Count the mapping */ + pface->cMappings++; + + /* If character is not subsequent, count a new run */ + if (wcCurrent != wcPrev + 1) pface->cRuns++; + wcPrev = wcCurrent; + + /* Get the next charcode and index */ + wcCurrent = (WCHAR)FT_Get_Next_Char(ftface, wcCurrent, &index); + } + + pface->ifiex.ifi.wcLastChar = wcPrev; + + /* Initialize IFIMETRICS */ + FtfdInitIfiMetrics(pface); + + /* Initialize glyphset */ + FtfdInitGlyphSet(pface); + + /* Initialize kerning pairs */ + FtfdInitKerningPairs(pface); + + return pface; +} + +static +VOID +FtfdDestroyFace( + PFTFD_FACE pface) +{ + /* Cleanup the freetype face */ + FT_Done_Face(pface->ftface); + + /* Free the glyphset structure */ + EngFreeMem(pface->pGlyphSet); + + /* Free the kerning pairs structure */ + if (pface->pKerningPairs) EngFreeMem(pface->pKerningPairs); + + /* Finally free the face structure */ + EngFreeMem(pface); +} +
/** Public Interface **********************************************************/
@@ -36,92 +448,178 @@ ULONG ulFastCheckSum) { PVOID pvView; - ULONG cjView, i; + ULONG cjView, cjSize, cNumFaces, i; FT_Error fterror; FT_Face ftface; - PFTFD_FILE pfile; - ULONG cjSize, cNumFaces; + PFTFD_FILE pfile = NULL;
DbgPrint("FtfdLoadFontFile()\n");
/* Check parameters */ if (cFiles != 1) { - DbgPrint("Only 1 File is allowed, got %ld!\n", cFiles); + DbgPrint("ERROR: 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"); + DbgPrint("ERROR: Could not map font file!\n"); return HFF_INVALID; }
- // HACK!!! - pvView = HackFixup(pvView, cjView); - + /* Load the first face */ fterror = FT_New_Memory_Face(gftlibrary, pvView, cjView, 0, &ftface); if (fterror) { - DbgPrint("No faces found in file\n"); - - /* Unmap the file */ - EngUnmapFontFileFD(*piFile); - /* Failure! */ - return HFF_INVALID; + DbgPrint("ERROR: No faces found in file\n"); + goto error; }
/* Get number of faces from the first face */ cNumFaces = ftface->num_faces;
- cjSize = sizeof(FTFD_FILE) + cNumFaces * sizeof(FT_Face); + /* Allocate the file structure */ + cjSize = sizeof(FTFD_FILE) + cNumFaces * sizeof(PVOID); pfile = EngAllocMem(0, cjSize, 'dftF'); if (!pfile) { - DbgPrint("EngAllocMem() failed.\n"); - - /* Unmap the file */ - EngUnmapFontFileFD(*piFile); - /* Failure! */ - return HFF_INVALID; - } - + DbgPrint("ERROR: EngAllocMem() failed.\n"); + goto error; + } + + /* Initialize the file structure */ pfile->cNumFaces = cNumFaces; pfile->iFile = *piFile; - pfile->pvView = pvView; - pfile->cjView = cjView; - - for (i = 0; i < pfile->cNumFaces; i++) - { - pfile->aftface[i] = ftface; - FT_Select_Charmap(ftface, FT_ENCODING_UNICODE); + pfile->pvView = *ppvView; + pfile->cjView = *pcjView; + pfile->ulFastCheckSum = ulFastCheckSum; + + /* Create a face */ + pfile->apface[0] = FtfdCreateFace(pfile, ftface); + if (!pfile->apface[0]) + { + DbgPrint("ERROR: FtfdCreateFace() failed.\n"); + goto error; + } + + /* Get the file format */ + pfile->ulFileFormat = FtfdGetFileFormat(pfile); + + /* Loop all additional faces in this file */ + for (i = 1; i < cNumFaces; i++) + { + /* Load the face */ + fterror = FT_New_Memory_Face(gftlibrary, *ppvView, *pcjView, i, &ftface); + if (fterror) + { + DbgPrint("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); - return (ULONG_PTR)pfile; + +error: + if (pfile) EngFreeMem(pfile); + + /* Unmap the file */ + EngUnmapFontFileFD(*piFile); + + /* Failure! */ + return HFF_INVALID; +} + +PIFIMETRICS +APIENTRY +FtfdQueryFont( + IN DHPDEV dhpdev, + IN ULONG_PTR diFile, + IN ULONG iFace, + IN ULONG_PTR *pid) +{ + PFTFD_FILE pfile = (PFTFD_FILE)diFile; + PFTFD_FACE pface = pfile->apface[iFace - 1]; + + DbgPrint("FtfdQueryFont()\n"); + + /* Validate parameters */ + if (iFace > pfile->cNumFaces || !pid) + { + DbgPrint("ERROR: iFace > pfile->cNumFaces || !pid\n"); + return NULL; + } + + /* Nothing to free */ + *pid = 0; + + /* Return pointer to the IFIMETRICS */ + return &pface->ifiex.ifi; +} + +PVOID +APIENTRY +FtfdQueryFontTree( + DHPDEV dhpdev, + ULONG_PTR diFile, + ULONG iFace, + ULONG iMode, + ULONG_PTR *pid) +{ + PFTFD_FILE pfile = (PFTFD_FILE)diFile; + PFTFD_FACE pface; + + DbgPrint("FtfdQueryFontTree(iMode=%ld)\n", iMode); + + /* Validate parameters */ + if (iFace > pfile->cNumFaces || !pid) + { + DbgPrint("ERROR: iFace > pfile->cNumFaces || !pid\n"); + return NULL; + } + + /* get pointer to the requested face */ + pface = pfile->apface[iFace - 1]; + + switch (iMode) + { + case QFT_GLYPHSET: + *pid = 0; + return pface->pGlyphSet; + + case QFT_KERNPAIRS: + *pid = 0; + return pface->pKerningPairs; + + default: + DbgPrint("ERROR: invalid iMode: %ld\n", iMode); + } + + return NULL; }
BOOL APIENTRY FtfdUnloadFontFile( - IN ULONG_PTR iFile) -{ - PFTFD_FILE pfile = (PFTFD_FILE)iFile; + IN ULONG_PTR diFile) +{ + PFTFD_FILE pfile = (PFTFD_FILE)diFile; ULONG i;
DbgPrint("FtfdUnloadFontFile()\n"); - - // HACK!!! - EngFreeMem(pfile->pvView);
/* Cleanup faces */ for (i = 0; i < pfile->cNumFaces; i++) { - FT_Done_Face(pfile->aftface[i]); + FtfdDestroyFace(pfile->apface[i]); }
/* Unmap the font file */ @@ -137,15 +635,14 @@ LONG APIENTRY FtfdQueryFontFile( - ULONG_PTR iFile, + ULONG_PTR diFile, ULONG ulMode, ULONG cjBuf, ULONG *pulBuf) { - PFTFD_FILE pfile = (PFTFD_FILE)iFile; + PFTFD_FILE pfile = (PFTFD_FILE)diFile;
DbgPrint("FtfdQueryFontFile(ulMode=%ld)\n", ulMode); -// __debugbreak();
switch (ulMode) { @@ -163,171 +660,6 @@ return FD_ERROR; }
- -PIFIMETRICS -APIENTRY -FtfdQueryFont( - IN DHPDEV dhpdev, - IN ULONG_PTR iFile, - IN ULONG iFace, - IN ULONG_PTR *pid) -{ - PFTFD_FILE pfile = (PFTFD_FILE)iFile; - PFTFD_IFIMETRICS pifiX; - PIFIMETRICS pifi; - FT_Face ftface; - FT_Error fterror; - ULONG i; - - DbgPrint("FtfdQueryFont()\n"); - - /* Validate parameters */ - if (iFace > pfile->cNumFaces || !pid) - { - DbgPrint("iFace > pfile->cNumFaces || !pid\n"); - return NULL; - } - - fterror = FT_New_Memory_Face(gftlibrary, - pfile->pvView, - pfile->cjView, - iFace - 1, - &ftface); - if (fterror) - { - DbgPrint("FT_New_Memory_Face failed\n"); - return NULL; - } - - /* Allocate the ifi metrics structure */ - pifiX = EngAllocMem(FL_ZERO_MEMORY, sizeof(FTFD_IFIMETRICS), TAG_IFIMETRICS); - if (!pifiX) - { - DbgPrint("EngAllocMem() failed.\n"); - FT_Done_Face(ftface); - return NULL; - } - - /* Fill IFIMETRICS */ - pifi = &pifiX->ifim; - pifi->cjThis = sizeof(FTFD_IFIMETRICS); - pifi->cjIfiExtra = 0; - - /* Relative offsets */ - pifi->dpwszFamilyName = FIELD_OFFSET(FTFD_IFIMETRICS, wszFamilyName); - pifi->dpwszStyleName = FIELD_OFFSET(FTFD_IFIMETRICS, wszStyleName); - pifi->dpwszFaceName = FIELD_OFFSET(FTFD_IFIMETRICS, wszFaceName); - pifi->dpwszUniqueName = FIELD_OFFSET(FTFD_IFIMETRICS, wszFaceName); - pifi->dpCharSets = FIELD_OFFSET(FTFD_IFIMETRICS, ajCharSet); - pifi->dpFontSim = 0; - - /* Charsets */ - pifi->jWinCharSet = ANSI_CHARSET; - pifiX->ajCharSet[0] = pifi->jWinCharSet; - for (i = 1; i < 16; i++) - { - pifiX->ajCharSet[i] = DEFAULT_CHARSET; - } - - pifi->lEmbedId = 0; - pifi->lItalicAngle = 0; - pifi->lCharBias = 0; - pifi->jWinPitchAndFamily = VARIABLE_PITCH | FF_DONTCARE; // FIXME - pifi->usWinWeight = FW_MEDIUM; // FIXME - pifi->flInfo = FM_INFO_TECH_TRUETYPE | FM_INFO_ARB_XFORMS | - FM_INFO_1BPP | FM_INFO_4BPP | - FM_INFO_RETURNS_OUTLINES | - FM_INFO_RETURNS_BITMAPS | - FM_INFO_RIGHT_HANDED; - pifi->fsSelection = 0; - pifi->fsType = 0; - - /* Font resolution */ - pifi->fwdUnitsPerEm = ftface->units_per_EM; - pifi->fwdLowestPPEm = 8; // FIXME - - /* Font metrics */ - pifi->fwdWinAscender = ftface->ascender; - pifi->fwdWinDescender = - ftface->descender; - pifi->fwdMacAscender = pifi->fwdWinAscender; - pifi->fwdMacDescender = - pifi->fwdWinDescender; - pifi->fwdMacLineGap = 0; - pifi->fwdTypoAscender = pifi->fwdWinAscender; - pifi->fwdTypoDescender = 0; // FIXME!!! - pifi->fwdWinDescender; - pifi->fwdTypoLineGap = 0; - pifi->fwdAveCharWidth = 1085; // FIXME - pifi->fwdMaxCharInc = ftface->max_advance_width; - pifi->fwdCapHeight = pifi->fwdUnitsPerEm / 2; - pifi->fwdXHeight = pifi->fwdUnitsPerEm / 4; - pifi->fwdSubscriptXSize = 0; - pifi->fwdSubscriptYSize = 0; - pifi->fwdSubscriptXOffset = 0; - pifi->fwdSubscriptYOffset = 0; - pifi->fwdSuperscriptXSize = 0; - pifi->fwdSuperscriptYSize = 0; - pifi->fwdSuperscriptXOffset = 0; - pifi->fwdSuperscriptYOffset = 0; - pifi->fwdUnderscoreSize = 1; - pifi->fwdUnderscorePosition = -1; - pifi->fwdStrikeoutSize = 1; - pifi->fwdStrikeoutPosition = pifi->fwdXHeight + 1; - - pifi->ptlBaseline.x = 1; - pifi->ptlBaseline.y = 0; - pifi->ptlAspect.x = 1; - pifi->ptlAspect.y = 1; - pifi->ptlCaret.x = 0; - pifi->ptlCaret.y = 1; - - /* Set the biggest characters bounding box */ - pifi->rclFontBox.left = ftface->bbox.xMin; - pifi->rclFontBox.right = ftface->bbox.xMax; - pifi->rclFontBox.top = ftface->bbox.yMax; - pifi->rclFontBox.bottom = ftface->bbox.yMin; - - /* Special characters */ - pifi->chFirstChar = 0x1c; // FIXME - pifi->chLastChar = 0x79; - pifi->chDefaultChar = 0x1d; - pifi->chBreakChar = 0x1e; - pifi->wcFirstChar = 0x1e; - pifi->wcLastChar = 0x79; - pifi->wcDefaultChar = 0x1d; - pifi->wcBreakChar = 0x1e; - - - *(DWORD*)&pifi->achVendId = 0x30303030; // FIXME - pifi->cKerningPairs = 0; - pifi->ulPanoseCulture = FM_PANOSE_CULTURE_LATIN; -// pifi->panose = panose; - - EngMultiByteToUnicodeN(pifiX->wszFamilyName, - LF_FACESIZE, - NULL, - ftface->family_name, - strnlen(ftface->family_name, MAX_PATH)); - - EngMultiByteToUnicodeN(pifiX->wszStyleName, - LF_FACESIZE, - NULL, - ftface->style_name, - strnlen(ftface->style_name, MAX_PATH)); - - EngMultiByteToUnicodeN(pifiX->wszFaceName, - LF_FACESIZE, - NULL, - ftface->family_name, - strnlen(ftface->family_name, MAX_PATH)); - - FT_Done_Face(ftface); - - DbgPrint("Finished with the ifi: %p\n", pifiX); - __debugbreak(); - - return pifi; -} - - LONG APIENTRY FtfdQueryFontCaps( @@ -342,138 +674,42 @@ return FD_ERROR; }
- /* We only support 1 bpp */ + /* We only support bitmaps for now */ pulCaps[0] = 2; - pulCaps[1] = QC_1BIT; + pulCaps[1] = QC_1BIT | QC_4BIT;
return 2; }
+LONG +APIENTRY +FtfdQueryTrueTypeTable( + ULONG_PTR diFile, + ULONG ulFont, + ULONG ulTag, + PTRDIFF dpStart, + ULONG cjBuf, + BYTE *pjBuf, + PBYTE *ppjTable, + ULONG *pcjTable) +{ + DbgPrint("FtfdQueryTrueTypeTable\n"); + __debugbreak(); + return FD_ERROR; +}
PVOID APIENTRY -FtfdQueryFontTree( - DHPDEV dhpdev, - ULONG_PTR iFile, - ULONG iFace, - ULONG iMode, - ULONG_PTR *pid) -{ - PFTFD_FILE pfile = (PFTFD_FILE)iFile; - FT_Face ftface; - FT_Error fterror; - FTFD_CHARPAIR *pcp; - FD_GLYPHSET *pGlyphSet; - FT_ULong charcode; - ULONG i, j, cGlyphs, cRuns, cjSize; - WCRUN *pwcrun; - HGLYPH * phglyphs; - - DbgPrint("FtfdQueryFontTree()\n"); - - fterror = FT_New_Memory_Face(gftlibrary, - pfile->pvView, - pfile->cjView, - iFace - 1, - &ftface); - if (fterror) - { - DbgPrint("FT_New_Memory_Face() failed.\n"); - return NULL; - } - - /* Get inital value for cGlyphs from ftface */ - cGlyphs = ftface->num_glyphs + 1; - - /* Allocate a buffer for the char codes and glyph indexes */ - pcp = EngAllocMem(0, cGlyphs * sizeof(FTFD_CHARPAIR), 'pcp '); - if (!pcp) - { - DbgPrint("EngAllocMem() failed.\n"); - return NULL; - } - - /* Gather char codes and indexes and count WCRUNs */ - pcp[0].code = FT_Get_First_Char(ftface, &pcp[0].index); - charcode = pcp[0].code; - for (i = 1, cRuns = 1; charcode && i < cGlyphs; i++) - { - charcode = FT_Get_Next_Char(ftface, charcode, &pcp[i].index); - DbgPrint("charcode=0x%lx, index=0x%lx\n", charcode, pcp[i].index); - pcp[i].code = charcode; - if (charcode != pcp[i - 1].code + 1) - { - cRuns++; - } - } - - /* Update cGlyphs to real value */ - cGlyphs = i - 1; - - /* Calculate FD_GLYPHSET size */ - cjSize = sizeof(FD_GLYPHSET) - + (cRuns - 1) * sizeof(WCRUN) - + cGlyphs * sizeof(HGLYPH); - - /* Allocate the FD_GLYPHSET structure */ - pGlyphSet = EngAllocMem(0, cjSize, TAG_GLYPHSET); - if (!pGlyphSet) - { - DbgPrint("EngAllocMem() failed.\n"); - return NULL; - } - - /* Initialize FD_GLYPHSET */ - pGlyphSet->cjThis = cjSize; - pGlyphSet->flAccel = 0; - pGlyphSet->cGlyphsSupported = cGlyphs; - pGlyphSet->cRuns = cRuns; - - /* Initialize 1st WCRUN */ - pwcrun = pGlyphSet->awcrun; - phglyphs = (PHGLYPH)&pGlyphSet->awcrun[cRuns]; - pwcrun[0].wcLow = pcp[0].code; - pwcrun[0].cGlyphs = 1; - pwcrun[0].phg = &phglyphs[0]; - phglyphs[0] = pcp[0].index; - -DbgPrint("pcp[0].index = 0x%lx\n", pcp[0].index); - - /* Walk through all supported chars */ - for (i = 1, j = 0; i < cGlyphs; i++) - { - /* Use glyph index as HGLYPH */ - phglyphs[i] = pcp[i].index; - - /* Check whether we can append the wchar to a run */ - if (pcp[i].code == pcp[i - 1].code + 1) - { - /* Append to current WCRUN */ - pwcrun[j].cGlyphs++; - } - else - { - /* Add a new WCRUN */ - DbgPrint("adding new run\n"); - j++; - pwcrun[j].wcLow = pcp[i].code; - pwcrun[j].cGlyphs = 1; - pwcrun[j].phg = &phglyphs[i]; - } - } - - /* Free the temporary buffer */ - EngFreeMem(pcp); - - /* Set *pid to the allocated structure for use in FtfdFree */ - *pid = (ULONG_PTR)pGlyphSet; - -DbgPrint("pGlyphSet=%p\n", pGlyphSet); -__debugbreak(); - - return pGlyphSet; -} - +FtfdGetTrueTypeFile( + ULONG_PTR diFile, + ULONG *pcj) +{ + DbgPrint("FtfdGetTrueTypeFile\n"); + __debugbreak(); + return 0; +} + +#if 0 // not needed atm VOID APIENTRY FtfdFree( @@ -481,11 +717,8 @@ ULONG_PTR id) { DbgPrint("FtfdFree()\n"); - if (id) - { - EngFreeMem((PVOID)id); - } -} - - - + 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/... ============================================================================== --- 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] Wed May 4 19:48:29 2011 @@ -11,7 +11,9 @@ #include <winddi.h>
#include <ft2build.h> -#include FT_FREETYPE_H +#include <freetype/ftadvanc.h> +#include <freetype/ftxf86.h> +#include FT_FREETYPE_H
extern FT_Library gftlibrary;
@@ -20,32 +22,74 @@
/** Driver specific types *****************************************************/
+typedef enum +{ + FMT_UNKNOWN, + FMT_TRUETYPE, + FMT_TYPE1, + FMT_CFF, + FMT_FNT, + FMT_BDF, + FMT_PCF, + FMT_TYPE42, + FMT_CIDTYPE1, + FMT_PFR +} FONT_FORMAT; + +typedef enum +{ + FILEFMT_TTF, + FILEFMT_OTF, + FILEFMT_FNT, +} FLE_FORMAT; + +//"Bold Italic Underline Strikeout" +#define MAX_STYLESIZE 35 typedef struct { - FT_UInt index; - FT_ULong code; -} FTFD_CHARPAIR; + IFIMETRICS ifi; + BYTE ajCharSet[16]; + FONTSIM fontsim; + WCHAR awcFamilyName[LF_FACESIZE]; + WCHAR awcFaceName[LF_FACESIZE]; + WCHAR awcStyleName[MAX_STYLESIZE]; + WCHAR awcUniqueName[LF_FACESIZE + 11]; +} FTFD_IFIMETRICS, *PFTFD_IFIMETRICS;
typedef struct +{ + struct _FTFD_FILE *pfile; + FT_Face ftface; + ULONG ulFontFormat; + ULONG cGlyphs; + ULONG cMappings; + ULONG cRuns; + FD_GLYPHSET *pGlyphSet; + FD_KERNINGPAIR *pKerningPairs; + FTFD_IFIMETRICS ifiex; +} FTFD_FACE, *PFTFD_FACE; + +typedef struct _FTFD_FILE { PVOID pvView; ULONG cjView; ULONG_PTR iFile; ULONG cNumFaces; - FT_Face aftface[1]; + ULONG ulFastCheckSum; + ULONG ulFileFormat; + PFTFD_FACE apface[1]; } FTFD_FILE, *PFTFD_FILE;
-//"Bold Italic Underline Strikeout" -#define MAX_STYLESIZE 35 typedef struct { - IFIMETRICS ifim; - BYTE ajCharSet[16]; - FONTSIM fontsim; - WCHAR wszFamilyName[LF_FACESIZE]; - WCHAR wszFaceName[LF_FACESIZE]; - WCHAR wszStyleName[MAX_STYLESIZE]; -} FTFD_IFIMETRICS, *PFTFD_IFIMETRICS; + FONTOBJ *pfo; + PFTFD_FILE pfile; + ULONG iFace; + FT_Face ftface; + HGLYPH hgSelected; + ULONG cjSelected; +} FTFD_FONT, *PFTFD_FONT; +
/** Function prototypes *******************************************************/
@@ -127,6 +171,11 @@
VOID APIENTRY +FtfdDestroyFont( + FONTOBJ *pfo); + +VOID +APIENTRY FtfdFree( PVOID pv, ULONG_PTR id); @@ -148,3 +197,68 @@ PVOID pv, ULONG cjSize);
+BOOL +APIENTRY +FtfdQueryAdvanceWidths( + DHPDEV dhpdev, + FONTOBJ *pfo, + ULONG iMode, + HGLYPH *phg, + PVOID pvWidths, + ULONG cGlyphs); + +LONG +APIENTRY +FtfdQueryTrueTypeOutline( + DHPDEV dhpdev, + FONTOBJ *pfo, + HGLYPH hglyph, + BOOL bMetricsOnly, + GLYPHDATA *pgldt, + ULONG cjBuf, + TTPOLYGONHEADER *ppoly); + +LONG +APIENTRY +FtfdQueryTrueTypeTable( + ULONG_PTR iFile, + ULONG ulFont, + ULONG ulTag, + PTRDIFF dpStart, + ULONG cjBuf, + BYTE *pjBuf, + PBYTE *ppjTable, + ULONG *pcjTable); + +ULONG +APIENTRY +FtfdEscape( + SURFOBJ *pso, + ULONG iEsc, + ULONG cjIn, + PVOID pvIn, + ULONG cjOut, + PVOID pvOut); + +ULONG +APIENTRY +FtfdFontManagement( + SURFOBJ *pso, + FONTOBJ *pfo, + ULONG iMode, + ULONG cjIn, + PVOID pvIn, + ULONG cjOut, + PVOID pvOut); + +PVOID +APIENTRY +FtfdGetTrueTypeFile( + ULONG_PTR iFile, + ULONG *pcj); + +VOID +NTAPI +OtfGetIfiMetrics( + PFTFD_FACE pface, + PIFIMETRICS pifi);
Modified: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/glyph.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/... ============================================================================== --- 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] Wed May 4 19:48:29 2011 @@ -1,23 +1,284 @@ /* * PROJECT: ReactOS win32 subsystem * LICENSE: GPL - See COPYING in the top level directory - * PURPOSE: GDI font driver for bitmap fonts + * PURPOSE: GDI font driver based on freetype * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) */
#include "ftfd.h"
+/** Private Interface *********************************************************/ + +#define GLYPHBITS_SIZE(cx, cy, bpp) \ + (FIELD_OFFSET(GLYPHBITS, aj) + ((((cx * bpp) + 31) >> 5) * cy * 4)) + +PFTFD_FONT +NTAPI +FtfdCreateFontInstance( + FONTOBJ *pfo) +{ + PFTFD_FILE pfile = (PFTFD_FILE)pfo->iFile; + PFTFD_FONT pfont; + XFORMOBJ* pxo; + FT_Error fterror; + FT_Face ftface; + + /* Allocate a font structure */ + pfont = EngAllocMem(0, sizeof(FTFD_FONT), 0); + if (!pfont) + { + return NULL; + } + + /* Set basic fields */ + pfont->pfo = pfo; + pfont->pfile = pfile; + pfont->iFace = pfo->iFace; + pfont->hgSelected = -1; + + /* Create a freetype face */ + fterror = FT_New_Memory_Face(gftlibrary, + pfile->pvView, + pfile->cjView, + pfo->iFace - 1, + &ftface); + if (fterror) + { + /* Failure! */ + DbgPrint("Error creating face\n"); + return NULL; + } + + pxo = FONTOBJ_pxoGetXform(pfo); + + fterror = FT_Set_Char_Size(ftface, + 0, + 16 * 64, + pfo->sizLogResPpi.cx, + pfo->sizLogResPpi.cy); + if (fterror) + { + /* Failure! */ + DbgPrint("Error setting face size\n"); + return NULL; + } + + /* Set non-orthogonal transformation */ + // FT_Set_Transform + + pfont->ftface = ftface; + + /* Set the pvProducer member of the fontobj */ + pfo->pvProducer = pfont; + return pfont; +} + +static +PFTFD_FONT +FtfdGetFontInstance( + FONTOBJ *pfo) +{ + PFTFD_FONT pfont = pfo->pvProducer; + + if (!pfont) + { + pfont = FtfdCreateFontInstance(pfo); + } + + /* Return the font instance */ + return pfont; +} + +#define FLOATL_1 0x3f800000 + +ULONG +NTAPI +FtfdQueryMaxExtents( + FONTOBJ *pfo, + PFD_DEVICEMETRICS pfddm, + ULONG cjSize) +{ + PFTFD_FONT pfont = FtfdGetFontInstance(pfo); + ULONG cjMaxWidth, cjMaxBitmapSize; + + DbgPrint("FtfdQueryMaxExtents\n"); + + if (pfddm) + { + if (cjSize < sizeof(FD_DEVICEMETRICS)) + { + /* Not enough space, fail */ + DbgPrint("ERROR: cjSize = %ld\n", cjSize); + return FD_ERROR; + } + + //xScale = pfont->xScale; + //yScale = pfont->yScale; + + /* Fill FD_DEVICEMETRICS */ + pfddm->flRealizedType = 0; + pfddm->pteBase.x = FLOATL_1; + pfddm->pteBase.y = 0; + pfddm->pteSide.x = 0; + pfddm->pteSide.y = FLOATL_1; + pfddm->ptlUnderline1.x = 0; + pfddm->ptlUnderline1.y = 1; + pfddm->ptlStrikeout.x = 0; + pfddm->ptlStrikeout.y = -4; + pfddm->ptlULThickness.x = 0; + pfddm->ptlULThickness.y = 1; + pfddm->ptlSOThickness.x = 0; + pfddm->ptlSOThickness.y = 1; + pfddm->lMinA = 0; + pfddm->lMinC = 0; + pfddm->lMinD = 0; + +#if 0 + if (pfont->ulAngle == 90 || pfont->ulAngle == 270) + { + pfddm->cxMax = xScale * GETVAL(pFontInfo->dfPixHeight); + pfddm->cyMax = yScale * GETVAL(pFontInfo->dfMaxWidth); + pfddm->fxMaxAscender = yScale * GETVAL(pFontInfo->dfAscent) << 4; + pfddm->fxMaxDescender = (pfddm->cyMax << 4) - pfddm->fxMaxAscender; + } + else + { + pfddm->cxMax = xScale * GETVAL(pFontInfo->dfMaxWidth); + pfddm->cyMax = yScale * GETVAL(pFontInfo->dfPixHeight); + pfddm->fxMaxAscender = yScale * GETVAL(pFontInfo->dfAscent) << 4; + pfddm->fxMaxDescender = (pfddm->cyMax << 4) - pfddm->fxMaxAscender; + } +#endif + + pfddm->lD = pfddm->cxMax; + + /* Calculate Width in bytes */ + cjMaxWidth = ((pfddm->cxMax + 7) >> 3); + + /* Calculate size of the bitmap, rounded to DWORDs */ + cjMaxBitmapSize = ((cjMaxWidth * pfddm->cyMax) + 3) & ~3; + + /* cjGlyphMax is the full size of the GLYPHBITS structure */ + pfddm->cjGlyphMax = FIELD_OFFSET(GLYPHBITS, aj) + cjMaxBitmapSize; + + /* NOTE: fdxQuantized and NonLinear... stay unchanged */ + } + + /* Return the size of the structure */ + return sizeof(FD_DEVICEMETRICS); +} + +static +BOOL +FtfdLoadGlyph( + PFTFD_FONT pfont, + HGLYPH hg, + ULONG iFormat) // 0 = bitmap, 1 = outline +{ + FT_Error fterror; + + /* Check if the glyph needs to be updated */ + if (pfont->hgSelected != hg) + { + /* Load the glypg into the freetype face slot */ + fterror = FT_Load_Glyph(pfont->ftface, hg, 0); + if (fterror) + { + DbgPrint("FtfdLoadGlyph: couldn't load glyph 0x%lx\n", hg); + pfont->hgSelected = -1; + return FALSE; + } + + /* Update the selected glyph */ + pfont->hgSelected = hg; + } + + return TRUE; +} + +static +VOID +FtfdQueryGlyphData( + FONTOBJ *pfo, + HGLYPH hg, + GLYPHDATA *pgd, + PVOID pvGlyphData) +{ + PFTFD_FONT pfont = pfo->pvProducer; + FT_GlyphSlot ftglyph = pfont->ftface->glyph; + +if (hg > 1) __debugbreak(); + + pgd->gdf.pgb = pvGlyphData; + pgd->hg = hg; + + if (1 /* layout horizontal */) + { + pgd->fxA = ftglyph->metrics.horiBearingX; + pgd->fxAB = pgd->fxA + ftglyph->metrics.width; + pgd->fxD = ftglyph->metrics.horiAdvance; + } + else + { + pgd->fxA = ftglyph->metrics.vertBearingX; + pgd->fxAB = pgd->fxA + ftglyph->metrics.height; + pgd->fxD = ftglyph->metrics.vertAdvance; + } + + pgd->fxInkTop = 0; + pgd->fxInkBottom = 0; + pgd->rclInk.left = ftglyph->bitmap_left; + pgd->rclInk.top = ftglyph->bitmap_top; + pgd->rclInk.right = pgd->rclInk.left + ftglyph->bitmap.width; + pgd->rclInk.bottom = pgd->rclInk.top + ftglyph->bitmap.rows; + + /* Make the bitmap at least 1x1 pixel */ + if (ftglyph->bitmap.width == 0) pgd->rclInk.right++; + if (ftglyph->bitmap.rows == 0) pgd->rclInk.bottom++; + + pgd->ptqD.x.LowPart = 0; + pgd->ptqD.x.HighPart = pgd->fxD; + pgd->ptqD.y.LowPart = 0; + pgd->ptqD.y.HighPart = 0; + //pgd->ptqD.x.QuadPart = 0; + //pgd->ptqD.y.QuadPart = 0; + + +if (hg > 1) __debugbreak(); + +} + +VOID +FtfdQueryGlyphBits( + FONTOBJ *pfo, + HGLYPH hg, + GLYPHBITS *pgb, + ULONG cjSize) +{ + PFTFD_FONT pfont = pfo->pvProducer; + FT_GlyphSlot ftglyph = pfont->ftface->glyph; + +if (hg > 1) __debugbreak(); + + pgb->ptlOrigin.x = 0; + pgb->ptlOrigin.y = 0; + pgb->sizlBitmap.cx = ftglyph->bitmap.width; + pgb->sizlBitmap.cy = ftglyph->bitmap.rows; + +if (hg > 1) __debugbreak(); +} + +VOID +FtfdQueryGlyphOutline( + FONTOBJ *pfo, + HGLYPH hg, + PATHOBJ *ppo, + ULONG cjSize) +{ + +}
/** Public Interface **********************************************************/ - -PFD_GLYPHATTR -APIENTRY -FtfdQueryGlyphAttrs( - FONTOBJ *pfo, - ULONG iMode) -{ - return NULL; -}
LONG APIENTRY @@ -30,5 +291,183 @@ PVOID pv, ULONG cjSize) { + PFTFD_FONT pfont = FtfdGetFontInstance(pfo); + + DbgPrint("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"); + + /* Load the requested glyph */ + if (!FtfdLoadGlyph(pfont, hg, 0)) return FD_ERROR; + + if (pgd) FtfdQueryGlyphData(pfo, hg, pgd, pv); + + + if (pv) + { + FtfdQueryGlyphBits(pfo, hg, pv, cjSize); + } + + /* Return the size for a 1bpp bitmap */ + return GLYPHBITS_SIZE(pfont->ftface->glyph->bitmap.width, + pfont->ftface->glyph->bitmap.rows, + 1); + + case QFD_GLYPHANDOUTLINE: + DbgPrint("QFD_GLYPHANDOUTLINE\n"); + + /* Load the requested glyph */ + if (!FtfdLoadGlyph(pfont, hg, 1)) return FD_ERROR; + + if (pgd) + { + FtfdQueryGlyphData(pfo, hg, pgd, pv); + } + + if (pv) + { + FtfdQueryGlyphOutline(pfo, hg, pv, cjSize); + } + break; + + case QFD_MAXEXTENTS: + return FtfdQueryMaxExtents(pfo, pv, cjSize); + + case QFD_TT_GRAY1_BITMAP: + DbgPrint("QFD_TT_GRAY1_BITMAP\n"); + break; + case QFD_TT_GRAY2_BITMAP: + DbgPrint("QFD_TT_GRAY2_BITMAP\n"); + break; + case QFD_TT_GRAY4_BITMAP: + DbgPrint("QFD_TT_GRAY4_BITMAP\n"); + break; + case QFD_TT_GRAY8_BITMAP: + DbgPrint("QFD_TT_GRAY8_BITMAP\n"); + break; + default: + DbgPrint("Impossible iMode value: %lx\n", iMode); + EngSetLastError(ERROR_INVALID_PARAMETER); + return FD_ERROR; + } + + __debugbreak(); + + return FD_ERROR; } + +PFD_GLYPHATTR +APIENTRY +FtfdQueryGlyphAttrs( + FONTOBJ *pfo, + ULONG iMode) +{ + DbgPrint("FtfdQueryGlyphAttrs\n"); + + /* Verify parameters */ + if (!pfo || iMode != FO_ATTR_MODE_ROTATE) + { + DbgPrint("ERROR: invalid parameters: %p, %ld\n", pfo, iMode); + return NULL; + } + + + + __debugbreak(); + return NULL; +} + +BOOL +APIENTRY +FtfdQueryAdvanceWidths( + DHPDEV dhpdev, + FONTOBJ *pfo, + ULONG iMode, + HGLYPH *phg, + PVOID pvWidths, + ULONG cGlyphs) +{ + PFTFD_FONT pfont = FtfdGetFontInstance(pfo); + PUSHORT pusWidths = pvWidths; + BOOL bResult = TRUE; + ULONG i, fl; + FT_Face ftface = pfont->ftface; + FT_Error fterror; + FT_Fixed advance; + + DbgPrint("FtfdQueryAdvanceWidths\n"); + + // FIXME: layout horizontal/vertical + fl = (iMode == QAW_GETEASYWIDTHS) ? FT_ADVANCE_FLAG_FAST_ONLY : 0; +// | (ftface->face_flags & FT_FACE_FLAG_VERTICAL) ? FT_LOAD_VERTICAL_LAYOUT : 0; +fl = 0; + + /* Loop all requested glyphs */ + for (i = 0; i < cGlyphs; i++) + { + /* Query advance width */ + 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", + phg[i], fl); + pusWidths[i] = 0xffff; + bResult = FALSE; + } + else + { + DbgPrint("Got advance width: hg=%lx, adv=%d\n", phg[i], advance >> 12); + pusWidths[i] = (USHORT)advance >> 12; + } + } + + //__debugbreak(); + return bResult; +} + +LONG +APIENTRY +FtfdQueryTrueTypeOutline( + DHPDEV dhpdev, + FONTOBJ *pfo, + HGLYPH hg, + BOOL bMetricsOnly, + GLYPHDATA *pgldt, + ULONG cjBuf, + TTPOLYGONHEADER *ppoly) +{ + DbgPrint("FtfdQueryTrueTypeOutline\n"); + __debugbreak(); + return 0; +} + +ULONG +APIENTRY +FtfdFontManagement( + SURFOBJ *pso, + FONTOBJ *pfo, + ULONG iMode, + ULONG cjIn, + PVOID pvIn, + ULONG cjOut, + PVOID pvOut) +{ + DbgPrint("FtfdFontManagement\n"); + __debugbreak(); + return 0; +} + +VOID +APIENTRY +FtfdDestroyFont( + FONTOBJ *pfo) +{ + DbgPrint("FtfdDestroyFont()\n"); + __debugbreak(); +} +
Added: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/opentype.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/... ============================================================================== --- branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/opentype.c (added) +++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/opentype.c [iso-8859-1] Wed May 4 19:48:29 2011 @@ -1,0 +1,308 @@ +/* + * 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 (timo.kreuzer@reactos.org) + * REFERENCES: http://www.microsoft.com/typography/otspec/ + * http://www.microsoft.com/typography/otspec/os2.htm + */ + +#include "ftfd.h" +#include <freetype/t1tables.h> + +#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 + { + 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> + +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; +} + +PVOID +OtfFindTable( + PVOID pvView, + ULONG cjView, + ULONG ulTag, + PULONG pulLength) +{ + POTF_FILE_HEADER pFileHeader = pvView; + ULONG i, ulOffset, ulLength, ulNumTables; + + /* 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; + } + + if (pulLength) *pulLength = ulLength; + return (PUCHAR)pvView + ulOffset; + } + } + + /* Not found */ + return NULL; +} + +BYTE +OtfGetWinFamily(BYTE jClassId, BYTE jSubclassId) +{ + BYTE jFamily = 0; + + switch (jClassId) + { + case 0: // Class ID = 0 No Classification + /* We rely on the already set value */ + 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 + jFamily = FF_SCRIPT; break; + + case 15: // Subclass ID = 15 : Miscellaneous + + default: // Subclass ID = 9-14 : (reserved for future use) + break; + } + case 2: // Class ID = 2 Transitional Serifs + case 3: // Class ID = 3 Modern Serifs + case 4: // Class ID = 4 Clarendon Serifs + case 5: // Class ID = 5 Slab Serifs + case 6: // Class ID = 6 (reserved for future use) + case 7: // Class ID = 7 Freeform Serifs + case 8: // Class ID = 8 Sans Serif + switch (jSubclassId) + { + case 15: // Subclass ID = 15 : Miscellaneous + jFamily = FF_SWISS | FF_ROMAN; break; + default: + break; + } + case 9: // Class ID = 9 Ornamentals + case 10: // Class ID = 10 Scripts + case 11: // Class ID = 11 (reserved for future use) + case 12: // Class ID = 12 Symbolic + case 13: // Class ID = 13 Reserved + case 14: // Class ID = 14 Reserved + break; + } +__debugbreak(); + return jFamily; +} + +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->flInfo; + pifi->fsSelection = SWAPW(pOs2->fsSelection); + pifi->fsType = SWAPW(pOs2->fsType); + //pifi->fwdUnitsPerEm; + //pifi->fwdLowestPPEm; + 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->fwdMaxCharInc; + 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); + //pifi->chFirstChar = (CHAR)pifi->wcFirstChar; // FIXME: convert + //pifi->chLastChar = (CHAR)pifi->wcLastChar; + pifi->chDefaultChar = (CHAR)pifi->wcDefaultChar; + pifi->chBreakChar = (CHAR)pifi->wcBreakChar; + //pifi->ptlBaseline; + //pifi->ptlAspect; + //pifi->ptlCaret; + //pifi->rclFontBox; + *(DWORD*)pifi->achVendId = *(DWORD*)pOs2->achVendID; + //pifi->cKerningPairs; + //pifi->ulPanoseCulture; + pifi->panose = *(PANOSE*)pOs2->panose; +} +
Propchange: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/opentype.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/rosglue.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/... ============================================================================== --- branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/rosglue.c [iso-8859-1] (original) +++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/rosglue.c [iso-8859-1] Wed May 4 19:48:29 2011 @@ -29,7 +29,7 @@ va_list args;
va_start(args, Format); - EngDebugPrint("ft2: ", (PCHAR)Format, args); + EngDebugPrint("ftfd: ", (PCHAR)Format, args); va_end(args); return 0; }
Added: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/todo.txt URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers/... ============================================================================== --- branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/todo.txt (added) +++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/todo.txt [iso-8859-1] Wed May 4 19:48:29 2011 @@ -1,0 +1,57 @@ + +Public interface: +------------------ +- FtfdEnableDriver: 100% done +- FtfdEnablePDEV: 100% done +- FtfdCompletePDEV: 100% done +- FtfdDisablePDEV: 100% done +- FtfdEscape: unimplemented, probably unneccessary +- FtfdLoadFontFile: 90% done + - handle DESIGNVECTOR +- FtfdQueryFont: 70% done, depends on FtfdInitIfiMetrics +- FtfdQueryFontTree: 70% done, depends on FtfdInitGlyphSet and FtfdInitKerningPairs +- FtfdUnloadFontFile: 100% done, depends on FtfdDestroyFace +- FtfdQueryFontFile: 50% + - implement QFF_DESCRIPTION, unimportant +- FtfdQueryFontCaps: 100% done +- FtfdQueryTrueTypeTable: unimplemented +- FtfdGetTrueTypeFile: unimplemented + +- FtfdQueryFontData: 10%, depends on FtfdLoadGlyph + - QFD_MAXEXTENTS: dependes on FtfdQueryMaxExtents + - QFD_GLYPHANDBITMAP: depends on FtfdQueryGlyphData, FtfdQueryGlyphBits + - QFD_GLYPHANDOUTLINE: depends on FtfdQueryGlyphData, FtfdQueryGlyphOutline + - provide an outline (not neccessary) + - QFD_TT_GRAY1_BITMAP +- FtfdQueryGlyphAttrs: unimplemented, later +- FtfdQueryAdvanceWidths: 90% done + - check possibility of FT_ADVANCE_FLAG_FAST_ONLY +- FtfdQueryTrueTypeOutline: unimplemented +- FtfdFontManagement: unimplemented, unneccessary +- FtfdDestroyFont: unimplemented, later + +internal interface +------------------- +- FtfdInitIfiMetrics: 70% done + - handle other font types then TTF/OTF + - fix fwdLowestPPEm, fwdMacLineGap, ptlBaseline, ptlAspect, ptlCaret + - cKerningPairs, ulPanoseCulture + - check fwdMacAscender, fwdMacDescender + +- FtfdInitGlyphSet: 100% done +- FtfdInitKerningPairs: unimplemented, later +- FtfdDestroyFace: 100% done + +- FtfdCreateFontInstance: 80% + - handle XFORM (create a matrix and set freetype xform) +- FtfdGetFontInstance: 100% done +- FtfdQueryMaxExtents: 10% done + +- FtfdLoadGlyph: 80% done + - hande accelerator flags for bitmap / outline +- FtfdQueryGlyphData: 50% done + - handle vertical layout + - handle fxInkTop, fxInkBottom, ptqD + +- FtfdQueryGlyphBits: 5% +- FtfdQueryGlyphOutline: unimplemented
Propchange: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/todo.txt ------------------------------------------------------------------------------ svn:eol-style = native