Author: tkreuzer
Date: Mon May 16 11:50:43 2011
New Revision: 51777
URL:
http://svn.reactos.org/svn/reactos?rev=51777&view=rev
Log:
[GDI FONT DRIVER]
- Calculate fxMaxAscender and fxMaxDescender of FD_DEVICEMETRICS from usWinAscender /
usWinDescender in the OS/2 table of the font, instead of from the bounding box. This fixes
problems with overwritten lines in fontview
- a little cleanup
Modified:
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/todo.txt
branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.h
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] Mon May
16 11:50:43 2011
@@ -145,17 +145,6 @@
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;
-
/* Try to get OS/2 TrueType or OpenType metrics */
if (!FtfdGetWinMetrics(pface, pifi))
{
@@ -183,7 +172,6 @@
pifi->fwdTypoAscender = ftface->ascender;
pifi->fwdTypoDescender = ftface->descender;
pifi->fwdTypoLineGap = ftface->units_per_EM / 10;
- pifi->fwdAveCharWidth = 0;
pifi->fwdCapHeight = 0;
pifi->fwdXHeight = 0;
pifi->fwdSubscriptXSize = 0;
@@ -199,6 +187,17 @@
/* Special characters (first and last char are already enumerated) */
pifi->wcDefaultChar = 0x0020;
pifi->wcBreakChar = 0x0020;
+
+ 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;
*(DWORD*)&pifi->achVendId = '0000';
}
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] Mon May
16 11:50:43 2011
@@ -143,7 +143,7 @@
FTFD_DEVICEMETRICS metrics;
POINTEF ptefBase;
POINTEF ptefSide;
- ULONG xScale;
+ SIZEL sizlScale;
HGLYPH hgSelected;
ULONG cjSelected;
UCHAR jBpp;
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] Mon May
16 11:50:43 2011
@@ -154,13 +154,15 @@
* multiply with 64. */
FLOATOBJ_MulLong(&efScaleX, 64 * pface->ifiex.ifi.fwdUnitsPerEm * 72);
FLOATOBJ_DivLong(&efScaleX, pfo->sizLogResPpi.cx);
+ pfont->sizlScale.cx = FLOATOBJ_GetLong(&efScaleX);
FLOATOBJ_MulLong(&efScaleY, 64 * pface->ifiex.ifi.fwdUnitsPerEm * 72);
FLOATOBJ_DivLong(&efScaleY, pfo->sizLogResPpi.cy);
+ pfont->sizlScale.cy = FLOATOBJ_GetLong(&efScaleY);
/* Set the x and y character size for the font */
fterror = FT_Set_Char_Size(ftface,
- FLOATOBJ_GetLong(&efScaleX),
- FLOATOBJ_GetLong(&efScaleY),
+ pfont->sizlScale.cx,
+ pfont->sizlScale.cy,
pfo->sizLogResPpi.cx,
pfo->sizLogResPpi.cy);
if (fterror)
@@ -219,9 +221,9 @@
/* Prepare required coordinates in font space */
pmetrics = &pfont->metrics;
pmetrics->ptfxMaxAscender.x = 0;
- pmetrics->ptfxMaxAscender.y = ftface->bbox.yMax << 4; // FIXME: not
exact
+ pmetrics->ptfxMaxAscender.y = pface->ifiex.ifi.fwdWinAscender << 4;
pmetrics->ptfxMaxDescender.x = 0;
- pmetrics->ptfxMaxDescender.y = -ftface->bbox.yMin << 4; // FIXME: not
exact
+ pmetrics->ptfxMaxDescender.y = pface->ifiex.ifi.fwdWinDescender << 4;
pmetrics->ptlUnderline1.x = 0;
pmetrics->ptlUnderline1.y = -pface->ifiex.ifi.fwdUnderscorePosition;
pmetrics->ptlStrikeout.x = 0;
@@ -245,7 +247,8 @@
if (pmetrics->ptlULThickness.y <= 0) pmetrics->ptlULThickness.y = 1;
if (pmetrics->ptlSOThickness.y <= 0) pmetrics->ptlSOThickness.y = 1;
- //TRACE("Created font of size %ld (%ld)\n", yScale, (yScale+32)/64);
+ TRACE("Created font of size %ld (%ld)\n",
+ pfont->sizlScale.cy, (pfont->sizlScale.cy+32)/64);
//__debugbreak();
/* Set the pvProducer member of the fontobj */
@@ -339,6 +342,8 @@
pfddm->lMinD = 0;
}
+ TRACE("pfddm->fxMaxAscender=%ld, yScale=%ld, height=%ld\n",
+ pfddm->fxMaxAscender, pfont->sizlScale.cy,
(pfont->sizlScale.cy+32)/64);
//__debugbreak();
/* Return the size of the structure */
@@ -400,14 +405,18 @@
pgd->fxAB = pgd->fxA + ftglyph->metrics.height;
}
+ /* D is the glyph advance width */
pgd->fxD = ftglyph->advance.x / 4; // should be projected on the x-axis
- pgd->fxInkBottom = 0;
- pgd->fxInkTop = pgd->fxInkBottom + (ftglyph->bitmap.rows << 4);
+ /* This is the box in which the bitmap fits */
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;
+
+ /* FIX representation of bitmap top and bottom */
+ pgd->fxInkBottom = (-pgd->rclInk.bottom) << 4;
+ pgd->fxInkTop = pgd->rclInk.top << 4;
/* Make the bitmap at least 1x1 pixel */
if (ftglyph->bitmap.width == 0) pgd->rclInk.right++;
@@ -418,8 +427,6 @@
pgd->ptqD.x.HighPart = 0;
pgd->ptqD.y.LowPart = 0;
pgd->ptqD.y.HighPart = 0;
- //pgd->ptqD.x.QuadPart = 0;
- //pgd->ptqD.y.QuadPart = 0;
//__debugbreak();
}
@@ -441,7 +448,6 @@
ULONG ulRows, ulDstDelta, ulSrcDelta;
PBYTE pjDstLine, pjSrcLine;
-
pjDstLine = pjDest;
ulDstDelta = (ftbitmap->width*4 + 7) / 8;
@@ -505,9 +511,9 @@
else
FtfdCopyBitmap1Bpp(pgb->aj, &ftglyph->bitmap);
- 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, pfont->jBpp));
+ //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,
pfont->jBpp));
}
@@ -554,8 +560,8 @@
{
PFTFD_FONT pfont = FtfdGetFontInstance(pfo);
- TRACE("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)
{
Modified: 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 [iso-8859-1]
(original)
+++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/todo.txt [iso-8859-1] Mon May
16 11:50:43 2011
@@ -31,21 +31,21 @@
internal interface
-------------------
-- FtfdInitIfiMetrics: 70% done
+- FtfdInitIfiMetrics: 80% done
- handle other font types than TTF/OTF
- fix fwdLowestPPEm, fwdMacLineGap, ptlBaseline, ptlAspect, ptlCaret
- cKerningPairs from atmfd is bigger, ulPanoseCulture
- check fwdMacAscender, fwdMacDescender
- Check jWinPitchandFamily (from OS/2 table, Apolonia: 0,0->0x12)
- - chLastChar: hardcoded 0xff ?
- fix fwdUnderscorePosition
- FtfdInitGlyphSet: 100% done
-- FtfdInitKerningPairs: unimplemented, later
+- FtfdInitKerningPairs: 90% done
+ - Should we do complete glyph -> unicode expansion?
+
- FtfdDestroyFace: 100% done
-- FtfdCreateFontInstance: 90%
- - handle XFORM (create a matrix and set freetype xform)
+- FtfdCreateFontInstance: 95%
- FtfdGetFontInstance: 100% done
- FtfdQueryMaxExtents: 90% done
Modified: branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.h
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/drivers…
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.h [iso-8859-1]
(original)
+++ branches/GSoC_2011/GdiFontDriver/drivers/video/font/ftfd/tttables.h [iso-8859-1] Mon
May 16 11:50:43 2011
@@ -44,6 +44,27 @@
TT_TABLE_ENTRY aTableEntries[1];
} TT_FILE_HEADER, *PTT_FILE_HEADER;
+
+typedef struct _TT_TABLE_HEAD
+{
+ ULONG ulVersion;
+ ULONG fontRevision;
+ ULONG checkSumAdjustment;
+ ULONG magicNumber;
+ USHORT flags;
+ USHORT unitsPerEm;
+ ULONGLONG created;
+ ULONGLONG modified;
+ SHORT xMin;
+ SHORT yMin;
+ SHORT xMax;
+ SHORT yMax;
+ USHORT macStyle;
+ USHORT lowestRecPPEM;
+ SHORT fontDirectionHint;
+ SHORT indexToLocFormat;
+ SHORT glyphDataFormat;
+} TT_TABLE_HEAD, *PTT_TABLE_HEAD;
typedef struct _TT_OS2_DATA
{