mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 18:57:04 +00:00
[WIN32K]
* Revert part of 37148. One FontGDI is used for fonts with different sizes. Do not cache font metrics then and instead calculate them every time when needed. It fixes spacing in menus if some application uses default GUI font with size other than 11. See issue #4106 for more details. svn path=/trunk/; revision=51356
This commit is contained in:
parent
423497b1b2
commit
99c3b4ec57
2 changed files with 4 additions and 41 deletions
|
@ -88,9 +88,6 @@ typedef struct _FLOATGDI {
|
||||||
ULONG Dummy;
|
ULONG Dummy;
|
||||||
} FLOATGDI;
|
} FLOATGDI;
|
||||||
|
|
||||||
|
|
||||||
#define FDM_TYPE_TEXT_METRIC 0x80000000
|
|
||||||
|
|
||||||
typedef struct _FONTGDI {
|
typedef struct _FONTGDI {
|
||||||
FONTOBJ FontObj;
|
FONTOBJ FontObj;
|
||||||
ULONG iUnique;
|
ULONG iUnique;
|
||||||
|
@ -99,13 +96,11 @@ typedef struct _FONTGDI {
|
||||||
DHPDEV dhpdev;
|
DHPDEV dhpdev;
|
||||||
FT_Face face;
|
FT_Face face;
|
||||||
};
|
};
|
||||||
FLONG flRealizedType;
|
|
||||||
|
|
||||||
LONG lMaxNegA;
|
LONG lMaxNegA;
|
||||||
LONG lMaxNegC;
|
LONG lMaxNegC;
|
||||||
LONG lMinWidthD;
|
LONG lMinWidthD;
|
||||||
|
|
||||||
TEXTMETRICW TextMetric;
|
|
||||||
LPWSTR Filename;
|
LPWSTR Filename;
|
||||||
BYTE Underline;
|
BYTE Underline;
|
||||||
BYTE StrikeOut;
|
BYTE StrikeOut;
|
||||||
|
|
|
@ -302,9 +302,6 @@ IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics)
|
||||||
PSECTION_OBJECT SectionObject;
|
PSECTION_OBJECT SectionObject;
|
||||||
ULONG ViewSize = 0;
|
ULONG ViewSize = 0;
|
||||||
LARGE_INTEGER SectionSize;
|
LARGE_INTEGER SectionSize;
|
||||||
#if 0 // Wine code
|
|
||||||
FT_Fixed XScale, YScale;
|
|
||||||
#endif
|
|
||||||
UNICODE_STRING FontRegPath = RTL_CONSTANT_STRING(L"\\REGISTRY\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts");
|
UNICODE_STRING FontRegPath = RTL_CONSTANT_STRING(L"\\REGISTRY\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts");
|
||||||
|
|
||||||
/* Open the font file */
|
/* Open the font file */
|
||||||
|
@ -396,22 +393,6 @@ IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics)
|
||||||
FontGDI->Filename[FileName->Length / sizeof(WCHAR)] = L'\0';
|
FontGDI->Filename[FileName->Length / sizeof(WCHAR)] = L'\0';
|
||||||
FontGDI->face = Face;
|
FontGDI->face = Face;
|
||||||
|
|
||||||
/* FIXME: Complete text metrics */
|
|
||||||
#if 0 /* This (Wine) code doesn't seem to work correctly for us */
|
|
||||||
XScale = Face->size->metrics.x_scale;
|
|
||||||
YScale = Face->size->metrics.y_scale;
|
|
||||||
FontGDI->TextMetric.tmAscent = (FT_MulFix(Face->ascender, YScale) + 32) >> 6;
|
|
||||||
FontGDI->TextMetric.tmDescent = (FT_MulFix(Face->descender, YScale) + 32) >> 6;
|
|
||||||
FontGDI->TextMetric.tmHeight = (FT_MulFix(Face->ascender, YScale) -
|
|
||||||
FT_MulFix(Face->descender, YScale)) >> 6;
|
|
||||||
#else
|
|
||||||
FontGDI->TextMetric.tmAscent = (Face->size->metrics.ascender + 32) >> 6; /* units above baseline */
|
|
||||||
FontGDI->TextMetric.tmDescent = (32 - Face->size->metrics.descender) >> 6; /* units below baseline */
|
|
||||||
FontGDI->TextMetric.tmHeight = (Face->size->metrics.ascender - Face->size->metrics.descender) >> 6;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DPRINT("Font loaded: %s (%s)\n", Face->family_name, Face->style_name);
|
DPRINT("Font loaded: %s (%s)\n", Face->family_name, Face->style_name);
|
||||||
DPRINT("Num glyphs: %u\n", Face->num_glyphs);
|
DPRINT("Num glyphs: %u\n", Face->num_glyphs);
|
||||||
|
|
||||||
|
@ -856,14 +837,7 @@ IntGetOutlineTextMetrics(PFONTGDI FontGDI,
|
||||||
|
|
||||||
Otm->otmSize = Needed;
|
Otm->otmSize = Needed;
|
||||||
|
|
||||||
// FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, !Error ? &Win : 0);
|
FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, !Error ? &Win : 0);
|
||||||
if (!(FontGDI->flRealizedType & FDM_TYPE_TEXT_METRIC))
|
|
||||||
{
|
|
||||||
FillTM(&FontGDI->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
|
|
||||||
FontGDI->flRealizedType |= FDM_TYPE_TEXT_METRIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlCopyMemory(&Otm->otmTextMetrics, &FontGDI->TextMetric, sizeof(TEXTMETRICW));
|
|
||||||
|
|
||||||
Otm->otmFiller = 0;
|
Otm->otmFiller = 0;
|
||||||
RtlCopyMemory(&Otm->otmPanoseNumber, pOS2->panose, PANOSE_COUNT);
|
RtlCopyMemory(&Otm->otmPanoseNumber, pOS2->panose, PANOSE_COUNT);
|
||||||
|
@ -882,8 +856,8 @@ IntGetOutlineTextMetrics(PFONTGDI FontGDI,
|
||||||
Otm->otmrcFontBox.right = (FT_MulFix(FontGDI->face->bbox.xMax, XScale) + 32) >> 6;
|
Otm->otmrcFontBox.right = (FT_MulFix(FontGDI->face->bbox.xMax, XScale) + 32) >> 6;
|
||||||
Otm->otmrcFontBox.top = (FT_MulFix(FontGDI->face->bbox.yMax, YScale) + 32) >> 6;
|
Otm->otmrcFontBox.top = (FT_MulFix(FontGDI->face->bbox.yMax, YScale) + 32) >> 6;
|
||||||
Otm->otmrcFontBox.bottom = (FT_MulFix(FontGDI->face->bbox.yMin, YScale) + 32) >> 6;
|
Otm->otmrcFontBox.bottom = (FT_MulFix(FontGDI->face->bbox.yMin, YScale) + 32) >> 6;
|
||||||
Otm->otmMacAscent = FontGDI->TextMetric.tmAscent;
|
Otm->otmMacAscent = Otm->otmTextMetrics.tmAscent;
|
||||||
Otm->otmMacDescent = -FontGDI->TextMetric.tmDescent;
|
Otm->otmMacDescent = -Otm->otmTextMetrics.tmDescent;
|
||||||
Otm->otmMacLineGap = Otm->otmLineGap;
|
Otm->otmMacLineGap = Otm->otmLineGap;
|
||||||
Otm->otmusMinimumPPEM = 0; /* TT Header */
|
Otm->otmusMinimumPPEM = 0; /* TT Header */
|
||||||
Otm->otmptSubscriptSize.x = (FT_MulFix(pOS2->ySubscriptXSize, XScale) + 32) >> 6;
|
Otm->otmptSubscriptSize.x = (FT_MulFix(pOS2->ySubscriptXSize, XScale) + 32) >> 6;
|
||||||
|
@ -2512,13 +2486,8 @@ ftGdiGetTextMetricsW(
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
if (!(FontGDI->flRealizedType & FDM_TYPE_TEXT_METRIC))
|
FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
|
||||||
{
|
|
||||||
FillTM(&FontGDI->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
|
|
||||||
FontGDI->flRealizedType |= FDM_TYPE_TEXT_METRIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlCopyMemory(&ptmwi->TextMetric, &FontGDI->TextMetric, sizeof(TEXTMETRICW));
|
|
||||||
/* FIXME: Fill Diff member */
|
/* FIXME: Fill Diff member */
|
||||||
RtlZeroMemory(&ptmwi->Diff, sizeof(ptmwi->Diff));
|
RtlZeroMemory(&ptmwi->Diff, sizeof(ptmwi->Diff));
|
||||||
}
|
}
|
||||||
|
@ -2814,7 +2783,6 @@ TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
|
||||||
TextObj->Font->iUniq = 1; // Now it can be cached.
|
TextObj->Font->iUniq = 1; // Now it can be cached.
|
||||||
IntFontType(FontGdi);
|
IntFontType(FontGdi);
|
||||||
FontGdi->flType = TextObj->Font->flFontType;
|
FontGdi->flType = TextObj->Font->flFontType;
|
||||||
FontGdi->flRealizedType = 0;
|
|
||||||
FontGdi->Underline = TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfUnderline ? 0xff : 0;
|
FontGdi->Underline = TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfUnderline ? 0xff : 0;
|
||||||
FontGdi->StrikeOut = TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfStrikeOut ? 0xff : 0;
|
FontGdi->StrikeOut = TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfStrikeOut ? 0xff : 0;
|
||||||
TextObj->fl |= TEXTOBJECT_INIT;
|
TextObj->fl |= TEXTOBJECT_INIT;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue