Author: jimtabor
Date: Sat Nov 1 19:57:17 2008
New Revision: 37146
URL:
http://svn.reactos.org/svn/reactos?rev=37146&view=rev
Log:
- Update FONTGDI and TEXTOBJ. Added support for FT WinFNT. Fixed FillTM so it can pass
underline and strike out support.
Modified:
trunk/reactos/subsystems/win32/win32k/eng/objects.h
trunk/reactos/subsystems/win32/win32k/include/text.h
trunk/reactos/subsystems/win32/win32k/objects/font.c
trunk/reactos/subsystems/win32/win32k/objects/freetype.c
Modified: trunk/reactos/subsystems/win32/win32k/eng/objects.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/objects.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/objects.h [iso-8859-1] Sat Nov 1 19:57:17
2008
@@ -68,11 +68,17 @@
} FLOATGDI;
typedef struct _FONTGDI {
- FONTOBJ FontObj;
+ FONTOBJ FontObj;
- LPWSTR Filename;
- FT_Face face;
+ LONG lMaxNegA;
+ LONG lMaxNegC;
+ LONG lMinWidthD;
+
TEXTMETRICW TextMetric;
+ LPWSTR Filename;
+ FT_Face face;
+ BYTE Underline;
+ BYTE StrikeOut;
} FONTGDI, *PFONTGDI;
typedef struct _PATHGDI {
Modified: trunk/reactos/subsystems/win32/win32k/include/text.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/text.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/text.h [iso-8859-1] Sat Nov 1 19:57:17
2008
@@ -60,10 +60,11 @@
/* Header for all gdi objects in the handle table.
Do not (re)move this. */
BASEOBJECT BaseObject;
-
+ LFTYPE lft;
+ FLONG fl;
ENUMLOGFONTEXDVW logfont; //LOGFONTW logfont;
- FONTOBJ *Font;
- BOOLEAN Initialized; /* Don't reinitialize for each DC */
+ FONTOBJ *Font;
+ BOOLEAN Initialized; /* Don't reinitialize for each DC */
} TEXTOBJ, *PTEXTOBJ;
/* Internal interface */
Modified: trunk/reactos/subsystems/win32/win32k/objects/font.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/font.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/font.c [iso-8859-1] Sat Nov 1 19:57:17
2008
@@ -340,6 +340,8 @@
}
hNewFont = TextObj->BaseObject.hHmgr;
+ TextObj->lft = cjElfw;
+ TextObj->fl = fl;
RtlCopyMemory (&TextObj->logfont, &SafeLogfont, sizeof(ENUMLOGFONTEXDVW));
if (SafeLogfont.elfEnumLogfontEx.elfLogFont.lfEscapement !=
Modified: trunk/reactos/subsystems/win32/win32k/objects/freetype.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/freetype.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/freetype.c [iso-8859-1] Sat Nov 1
19:57:17 2008
@@ -557,15 +557,41 @@
static void FASTCALL
-FillTM(TEXTMETRICW *TM, FT_Face Face, TT_OS2 *pOS2, TT_HoriHeader *pHori)
+FillTM(TEXTMETRICW *TM, PFONTGDI FontGDI, TT_OS2 *pOS2, TT_HoriHeader *pHori,
FT_WinFNT_HeaderRec *pWin)
{
FT_Fixed XScale, YScale;
int Ascent, Descent;
+ FT_Face Face = FontGDI->face;
XScale = Face->size->metrics.x_scale;
YScale = Face->size->metrics.y_scale;
- if (0 == pOS2->usWinAscent + pOS2->usWinDescent)
+ if (pWin)
+ {
+ TM->tmHeight = pWin->pixel_height;
+ TM->tmAscent = pWin->ascent;
+ TM->tmDescent = TM->tmHeight - TM->tmAscent;
+ TM->tmInternalLeading = pWin->internal_leading;
+ TM->tmExternalLeading = pWin->external_leading;
+ TM->tmAveCharWidth = pWin->avg_width;
+ TM->tmMaxCharWidth = pWin->max_width;
+ TM->tmWeight = pWin->weight;
+ TM->tmOverhang = 0;
+ TM->tmDigitizedAspectX = pWin->horizontal_resolution;
+ TM->tmDigitizedAspectY = pWin->vertical_resolution;
+ TM->tmFirstChar = pWin->first_char;
+ TM->tmLastChar = pWin->last_char;
+ TM->tmDefaultChar = pWin->default_char + pWin->first_char;
+ TM->tmBreakChar = pWin->break_char + pWin->first_char;
+ TM->tmItalic = pWin->italic;
+ TM->tmUnderlined = FontGDI->Underline;
+ TM->tmStruckOut = FontGDI->StrikeOut;
+ TM->tmPitchAndFamily = pWin->pitch_and_family;
+ TM->tmCharSet = pWin->charset;
+ return;
+ }
+
+ if (0 == pOS2->usWinAscent + pOS2->usWinDescent)
{
Ascent = pHori->Ascender;
Descent = -pHori->Descender;
@@ -613,8 +639,8 @@
TM->tmDefaultChar = pOS2->usDefaultChar;
TM->tmBreakChar = L'\0' != pOS2->usBreakChar ? pOS2->usBreakChar :
' ';
TM->tmItalic = (Face->style_flags & FT_STYLE_FLAG_ITALIC) ? 255 : 0;
- TM->tmUnderlined = 0; /* entry in OS2 table */
- TM->tmStruckOut = 0; /* entry in OS2 table */
+ TM->tmUnderlined = FontGDI->Underline;
+ TM->tmStruckOut = FontGDI->StrikeOut;
/* Yes TPMF_FIXED_PITCH is correct; braindead api */
if (! FT_IS_FIXED_WIDTH(Face))
@@ -676,7 +702,8 @@
*
*/
INT FASTCALL
-IntGetOutlineTextMetrics(PFONTGDI FontGDI, UINT Size,
+IntGetOutlineTextMetrics(PFONTGDI FontGDI,
+ UINT Size,
OUTLINETEXTMETRICW *Otm)
{
unsigned Needed;
@@ -686,6 +713,8 @@
FT_Fixed XScale, YScale;
ANSI_STRING FamilyNameA, StyleNameA;
UNICODE_STRING FamilyNameW, StyleNameW, Regular;
+ FT_WinFNT_HeaderRec Win;
+ FT_Error Error;
char *Cp;
Needed = sizeof(OUTLINETEXTMETRICW);
@@ -751,9 +780,11 @@
pPost = FT_Get_Sfnt_Table(FontGDI->face, ft_sfnt_post); /* we can live with this
failing */
+ Error = FT_Get_WinFNT_Header(FontGDI->face , &Win);
+
Otm->otmSize = Needed;
- FillTM(&Otm->otmTextMetrics, FontGDI->face, pOS2, pHori);
+ FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, !Error ? &Win : 0);
Otm->otmFiller = 0;
memcpy(&Otm->otmPanoseNumber, pOS2->panose, PANOSE_COUNT);
@@ -2450,10 +2481,9 @@
if (DefChar == 0xffff && FT_IS_SFNT(face))
{
TT_OS2 *pOS2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2);
- Buffer[i] = (pOS2->usDefaultChar ? FT_Get_Char_Index(face,
pOS2->usDefaultChar) : 0);
+ DefChar = (pOS2->usDefaultChar ? FT_Get_Char_Index(face,
pOS2->usDefaultChar) : 0);
}
- else
- Buffer[i] = DefChar;
+ Buffer[i] = DefChar;
}
}
@@ -2475,7 +2505,7 @@
_SEH_END;
ErrorRet:
- ExFreePool(Buffer);
+ ExFreePoolWithTag(Buffer, TAG_GDITEXT);
if (NT_SUCCESS(Status)) return cwc;
SetLastWin32Error(Status);
return GDI_ERROR;
@@ -3527,6 +3557,7 @@
FT_Face Face;
TT_OS2 *pOS2;
TT_HoriHeader *pHori;
+ FT_WinFNT_HeaderRec Win;
ULONG Error;
NTSTATUS Status = STATUS_SUCCESS;
@@ -3584,11 +3615,13 @@
Status = STATUS_INTERNAL_ERROR;
}
+ Error = FT_Get_WinFNT_Header(FontGDI->face , &Win);
+
IntUnLockFreeType;
if (NT_SUCCESS(Status))
{
- FillTM(&ptmwi->TextMetric, FontGDI->face, pOS2, pHori);
+ FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win :
0);
}
}
TEXTOBJ_UnlockText(TextObj);
@@ -3849,7 +3882,6 @@
&TextObj->logfont.elfEnumLogfontEx.elfLogFont,
&FaceName,
&FontListHead);
IntUnLockGlobalFonts;
-
if (NULL == TextObj->Font)
{
DPRINT1("Requested font %S not found, no fonts loaded at all\n",
@@ -3858,6 +3890,10 @@
}
else
{
+ PFONTGDI FontGdi = ObjToGDI(TextObj->Font, FONT);
+ TextObj->Font->iUniq = 1; // Now it can be cached.
+ FontGdi->Underline = TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfUnderline
? 0xff : 0;
+ FontGdi->StrikeOut = TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfStrikeOut
? 0xff : 0;
TextObj->Initialized = TRUE;
Status = STATUS_SUCCESS;
}