mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[0.4.11][WIN32SS] Fix some regressions of font rendering / font placement
This commit deals with the following tickets: CORE-14994 "Spotify 1.0.29.92 has no icons on the buttons" which regressed by 0.4.10-dev-466-g35f62fc5ba
CORE-15166 "Media Player Classic HomeCinema MPC HC 1.7.13 'elapsed time' in status bar uses incredibly tiny font" which regressed by 0.4.10-dev-466-g35f62fc5ba
CORE-15303 "Firefox 28 does not longer show the checkmarks in the menubar" which regressed by 0.4.10-dev-466-g35f62fc5ba
CORE-16125 "Marlett, the 'top-right-closing-x' drawing regressed" which regressed in master by 0.4.13-dev-110-g19fc9415bf
(in older releases by different commits) --------------- The fix that manages to fix them all is a backport of the code-base that evolved up to 0.4.12-release-24-g4572c75. This was the source of porting. *Before* the fix I found the following state for 0.4.11-release-39-gdeae917 by testing: CORE-14994 ok CORE-15166 ok CORE-15303 ok CORE-16125 affected *Before* the fix I found the following state for 0.4.10-release-48-g72a4ecb by testing: CORE-14994 affected CORE-15166 affected CORE-15303 affected CORE-16125 ok So the before-state was kind of exclusive-OR. *After* the fix all of the mentioned tickets are fixed for releases/0.4.10 and releases/0.4.11 Ftr: 0.4.12-release-24-g4572c75 had all 4 tickets fixed, because it did receive the needed patches beforehand. 0.4.9-release-56-g9be0765 had all 4 tickets fixed, because it was never hit yet by the guilty commits in master branch. It does not heavily need those fixes yet therefore. And last but not least, the backport to releases/0.4.10 will also inherently contain the fix for CORE-15331 "[WIN32SS][FONT] Fix NEWTEXTMETRIC.ntmCellHeight value" (which was already fixed in initial releases/0.4.11) In sum this backport contains the following commits (at least): 0.4.13-dev-483-g641a0ea99b
(#1670) CORE-14994 == 0.4.12-RC-38-gd5c85cd
0.4.13-dev-110-g19fc9415bf
(#1535) CORE-15303 == 0.4.12-RC-16-ge1ac9dc
0.4.12-RC-43-g6f651b6ec5
CORE-16125 (please note, that this is an interim solution and NOT yet the final master-fix of 0.4.13-dev-699-gb8383b4
which would have fixed that as well) 0.4.11-dev-914-g88ddb37acb
(#1093) CORE-15166 0.4.11-dev-656-g7f679a116b
(#1010) CORE-15331 Porting any of those fixes on its own is dangerous, only their combination leads to tolerable results.
This commit is contained in:
parent
deae917e9b
commit
f32c82eda7
3 changed files with 21 additions and 19 deletions
|
@ -1781,21 +1781,17 @@ FillTMEx(TEXTMETRICW *TM, PFONTGDI FontGDI,
|
|||
return;
|
||||
}
|
||||
|
||||
if (pOS2->usWinAscent + pOS2->usWinDescent == 0)
|
||||
if ((FT_Short)pOS2->usWinAscent + (FT_Short)pOS2->usWinDescent == 0)
|
||||
{
|
||||
Ascent = pHori->Ascender;
|
||||
Descent = -pHori->Descender;
|
||||
}
|
||||
else
|
||||
{
|
||||
Ascent = pOS2->usWinAscent;
|
||||
Descent = pOS2->usWinDescent;
|
||||
Ascent = (FT_Short)pOS2->usWinAscent;
|
||||
Descent = (FT_Short)pOS2->usWinDescent;
|
||||
}
|
||||
|
||||
if (FontGDI->Magic != FONTGDI_MAGIC)
|
||||
{
|
||||
IntRequestFontSize(NULL, FontGDI, 0, 0);
|
||||
}
|
||||
TM->tmAscent = FontGDI->tmAscent;
|
||||
TM->tmDescent = FontGDI->tmDescent;
|
||||
TM->tmHeight = TM->tmAscent + TM->tmDescent;
|
||||
|
@ -2562,7 +2558,7 @@ FontFamilyFillInfo(PFONTFAMILYINFO Info, LPCWSTR FaceName,
|
|||
}
|
||||
|
||||
Ntm->ntmSizeEM = Otm->otmEMSquare;
|
||||
Ntm->ntmCellHeight = pOS2->usWinAscent + pOS2->usWinDescent;
|
||||
Ntm->ntmCellHeight = (FT_Short)pOS2->usWinAscent + (FT_Short)pOS2->usWinDescent;
|
||||
Ntm->ntmAvgWidth = 0;
|
||||
|
||||
ExFreePoolWithTag(Otm, GDITAG_TEXT);
|
||||
|
@ -3217,12 +3213,20 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
|
|||
return FT_Request_Size(face, &req);
|
||||
}
|
||||
|
||||
/* See also: https://docs.microsoft.com/en-us/typography/opentype/spec/os2#fsselection */
|
||||
/*
|
||||
* NOTE: We cast TT_OS2.usWinAscent and TT_OS2.usWinDescent to signed FT_Short.
|
||||
* Why? See: https://docs.microsoft.com/en-us/typography/opentype/spec/os2#uswindescent
|
||||
*
|
||||
* > usWinDescent is "usually" a positive value ...
|
||||
*
|
||||
* We can read it as "not always". See CORE-14994.
|
||||
* See also: https://docs.microsoft.com/en-us/typography/opentype/spec/os2#fsselection
|
||||
*/
|
||||
#define FM_SEL_USE_TYPO_METRICS 0x80
|
||||
if (lfHeight > 0)
|
||||
{
|
||||
/* case (A): lfHeight is positive */
|
||||
Sum = pOS2->usWinAscent + pOS2->usWinDescent;
|
||||
Sum = (FT_Short)pOS2->usWinAscent + (FT_Short)pOS2->usWinDescent;
|
||||
if (Sum == 0 || (pOS2->fsSelection & FM_SEL_USE_TYPO_METRICS))
|
||||
{
|
||||
Ascent = pHori->Ascender;
|
||||
|
@ -3231,8 +3235,8 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
|
|||
}
|
||||
else
|
||||
{
|
||||
Ascent = pOS2->usWinAscent;
|
||||
Descent = pOS2->usWinDescent;
|
||||
Ascent = (FT_Short)pOS2->usWinAscent;
|
||||
Descent = (FT_Short)pOS2->usWinDescent;
|
||||
}
|
||||
|
||||
FontGDI->tmAscent = FT_MulDiv(lfHeight, Ascent, Sum);
|
||||
|
@ -3250,8 +3254,8 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
|
|||
}
|
||||
else
|
||||
{
|
||||
FontGDI->tmAscent = FT_MulDiv(-lfHeight, pOS2->usWinAscent, face->units_per_EM);
|
||||
FontGDI->tmDescent = FT_MulDiv(-lfHeight, pOS2->usWinDescent, face->units_per_EM);
|
||||
FontGDI->tmAscent = FT_MulDiv(-lfHeight, (FT_Short)pOS2->usWinAscent, face->units_per_EM);
|
||||
FontGDI->tmDescent = FT_MulDiv(-lfHeight, (FT_Short)pOS2->usWinDescent, face->units_per_EM);
|
||||
}
|
||||
FontGDI->tmHeight = FontGDI->tmAscent + FontGDI->tmDescent;
|
||||
FontGDI->tmInternalLeading = FontGDI->tmHeight + lfHeight;
|
||||
|
@ -3263,10 +3267,7 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
|
|||
FontGDI->EmHeight = min(FontGDI->EmHeight, USHORT_MAX);
|
||||
FontGDI->Magic = FONTGDI_MAGIC;
|
||||
|
||||
if (lfHeight > 0)
|
||||
EmHeight64 = (FontGDI->EmHeight << 6) + 31;
|
||||
else
|
||||
EmHeight64 = (FontGDI->EmHeight << 6);
|
||||
EmHeight64 = (FontGDI->EmHeight << 6);
|
||||
|
||||
req.type = FT_SIZE_REQUEST_TYPE_NOMINAL;
|
||||
req.width = 0;
|
||||
|
|
|
@ -820,7 +820,7 @@ BOOL FASTCALL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
|
|||
lf.lfWidth = 0;
|
||||
lf.lfWeight = FW_NORMAL;
|
||||
lf.lfCharSet = DEFAULT_CHARSET;
|
||||
lf.lfQuality = NONANTIALIASED_QUALITY;
|
||||
lf.lfQuality = ANTIALIASED_QUALITY;
|
||||
RtlCopyMemory(lf.lfFaceName, L"Marlett", sizeof(L"Marlett"));
|
||||
hFont = GreCreateFontIndirectW(&lf);
|
||||
/* save font and text color */
|
||||
|
|
|
@ -842,6 +842,7 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
|
|||
lf.lfWidth = 0;
|
||||
lf.lfWeight = FW_NORMAL;
|
||||
lf.lfCharSet = DEFAULT_CHARSET;
|
||||
lf.lfQuality = ANTIALIASED_QUALITY;
|
||||
lstrcpy(lf.lfFaceName, TEXT("Marlett"));
|
||||
hFont = CreateFontIndirect(&lf);
|
||||
/* save font and text color */
|
||||
|
|
Loading…
Reference in a new issue