mirror of
https://github.com/reactos/reactos.git
synced 2025-07-26 00:14:12 +00:00
[WIN32SS][FONT] Use HHEA table metrics if (fsSelection & 0x80) (#1093)
This PR will fix too tiny glyph rendering. CORE-15166
This commit is contained in:
parent
9c2a264d77
commit
88ddb37acb
1 changed files with 14 additions and 3 deletions
|
@ -3317,11 +3317,13 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
|
||||||
return FT_Request_Size(face, &req);
|
return FT_Request_Size(face, &req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See also: https://docs.microsoft.com/en-us/typography/opentype/spec/os2#fsselection */
|
||||||
|
#define FM_SEL_USE_TYPO_METRICS 0x80
|
||||||
if (lfHeight > 0)
|
if (lfHeight > 0)
|
||||||
{
|
{
|
||||||
/* case (A): lfHeight is positive */
|
/* case (A): lfHeight is positive */
|
||||||
Sum = pOS2->usWinAscent + pOS2->usWinDescent;
|
Sum = pOS2->usWinAscent + pOS2->usWinDescent;
|
||||||
if (Sum == 0)
|
if (Sum == 0 || (pOS2->fsSelection & FM_SEL_USE_TYPO_METRICS))
|
||||||
{
|
{
|
||||||
Ascent = pHori->Ascender;
|
Ascent = pHori->Ascender;
|
||||||
Descent = -pHori->Descender;
|
Descent = -pHori->Descender;
|
||||||
|
@ -3341,11 +3343,20 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
|
||||||
else if (lfHeight < 0)
|
else if (lfHeight < 0)
|
||||||
{
|
{
|
||||||
/* case (B): lfHeight is negative */
|
/* case (B): lfHeight is negative */
|
||||||
FontGDI->tmAscent = FT_MulDiv(-lfHeight, pOS2->usWinAscent, face->units_per_EM);
|
if (pOS2->fsSelection & FM_SEL_USE_TYPO_METRICS)
|
||||||
FontGDI->tmDescent = FT_MulDiv(-lfHeight, pOS2->usWinDescent, face->units_per_EM);
|
{
|
||||||
|
FontGDI->tmAscent = FT_MulDiv(-lfHeight, pHori->Ascender, face->units_per_EM);
|
||||||
|
FontGDI->tmDescent = FT_MulDiv(-lfHeight, -pHori->Descender, face->units_per_EM);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FontGDI->tmAscent = FT_MulDiv(-lfHeight, pOS2->usWinAscent, face->units_per_EM);
|
||||||
|
FontGDI->tmDescent = FT_MulDiv(-lfHeight, pOS2->usWinDescent, face->units_per_EM);
|
||||||
|
}
|
||||||
FontGDI->tmHeight = FontGDI->tmAscent + FontGDI->tmDescent;
|
FontGDI->tmHeight = FontGDI->tmAscent + FontGDI->tmDescent;
|
||||||
FontGDI->tmInternalLeading = FontGDI->tmHeight + lfHeight;
|
FontGDI->tmInternalLeading = FontGDI->tmHeight + lfHeight;
|
||||||
}
|
}
|
||||||
|
#undef FM_SEL_USE_TYPO_METRICS
|
||||||
|
|
||||||
FontGDI->EmHeight = FontGDI->tmHeight - FontGDI->tmInternalLeading;
|
FontGDI->EmHeight = FontGDI->tmHeight - FontGDI->tmInternalLeading;
|
||||||
FontGDI->EmHeight = max(FontGDI->EmHeight, 1);
|
FontGDI->EmHeight = max(FontGDI->EmHeight, 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue