mirror of
https://github.com/reactos/reactos.git
synced 2024-12-01 23:43:32 +08: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
@ -3317,11 +3317,13 @@ 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 */
|
||||
#define FM_SEL_USE_TYPO_METRICS 0x80
|
||||
if (lfHeight > 0)
|
||||
{
|
||||
/* case (A): lfHeight is positive */
|
||||
Sum = pOS2->usWinAscent + pOS2->usWinDescent;
|
||||
if (Sum == 0)
|
||||
if (Sum == 0 || (pOS2->fsSelection & FM_SEL_USE_TYPO_METRICS))
|
||||
{
|
||||
Ascent = pHori->Ascender;
|
||||
Descent = -pHori->Descender;
|
||||
@ -3341,11 +3343,20 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
|
||||
else if (lfHeight < 0)
|
||||
{
|
||||
/* case (B): lfHeight is negative */
|
||||
FontGDI->tmAscent = FT_MulDiv(-lfHeight, pOS2->usWinAscent, face->units_per_EM);
|
||||
FontGDI->tmDescent = FT_MulDiv(-lfHeight, pOS2->usWinDescent, face->units_per_EM);
|
||||
if (pOS2->fsSelection & FM_SEL_USE_TYPO_METRICS)
|
||||
{
|
||||
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->tmInternalLeading = FontGDI->tmHeight + lfHeight;
|
||||
}
|
||||
#undef FM_SEL_USE_TYPO_METRICS
|
||||
|
||||
FontGDI->EmHeight = FontGDI->tmHeight - FontGDI->tmInternalLeading;
|
||||
FontGDI->EmHeight = max(FontGDI->EmHeight, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user