diff --git a/win32ss/gdi/eng/engobjects.h b/win32ss/gdi/eng/engobjects.h index dc579664e6..2e7bdba59a 100644 --- a/win32ss/gdi/eng/engobjects.h +++ b/win32ss/gdi/eng/engobjects.h @@ -159,7 +159,6 @@ typedef struct _FONTGDI { LONG tmAscent; LONG tmDescent; LONG tmInternalLeading; - LONG EmHeight; LONG Magic; } FONTGDI, *PFONTGDI; diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c index 854085d01e..de2964bb79 100644 --- a/win32ss/gdi/ntgdi/freetype.c +++ b/win32ss/gdi/ntgdi/freetype.c @@ -3219,7 +3219,8 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight) TT_OS2 *pOS2; TT_HoriHeader *pHori; FT_WinFNT_HeaderRec WinFNT; - LONG Ascent, Descent, Sum, EmHeight64; + LONG Ascent, Descent, Sum, tmInternalLeading; + LONG tmAscent64, tmDescent64, tmHeight64, EmHeight64; lfWidth = abs(lfWidth); if (lfHeight == 0) @@ -3256,14 +3257,14 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight) FontGDI->tmAscent = WinFNT.ascent; FontGDI->tmDescent = FontGDI->tmHeight - FontGDI->tmAscent; FontGDI->tmInternalLeading = WinFNT.internal_leading; - FontGDI->EmHeight = FontGDI->tmHeight - FontGDI->tmInternalLeading; - FontGDI->EmHeight = max(FontGDI->EmHeight, 1); - FontGDI->EmHeight = min(FontGDI->EmHeight, USHORT_MAX); + EmHeight64 = (FontGDI->tmHeight - FontGDI->tmInternalLeading) * 64; + EmHeight64 = max(EmHeight64, 1); + EmHeight64 = min(EmHeight64, USHORT_MAX); FontGDI->Magic = FONTGDI_MAGIC; req.type = FT_SIZE_REQUEST_TYPE_NOMINAL; req.width = 0; - req.height = (FT_Long)(FontGDI->EmHeight << 6); + req.height = EmHeight64; req.horiResolution = 0; req.vertResolution = 0; return FT_Request_Size(face, &req); @@ -3295,36 +3296,38 @@ IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight) Descent = (FT_Short)pOS2->usWinDescent; } - FontGDI->tmAscent = FT_MulDiv(lfHeight, Ascent, Sum); - FontGDI->tmDescent = FT_MulDiv(lfHeight, Descent, Sum); - FontGDI->tmHeight = FontGDI->tmAscent + FontGDI->tmDescent; - FontGDI->tmInternalLeading = FontGDI->tmHeight - FT_MulDiv(lfHeight, face->units_per_EM, Sum); + tmAscent64 = FT_MulDiv(lfHeight * 64, Ascent, Sum); + tmDescent64 = FT_MulDiv(lfHeight * 64, Descent, Sum); + tmHeight64 = tmAscent64 + tmDescent64; + tmInternalLeading = (tmHeight64 >> 6) - FT_MulDiv(lfHeight, face->units_per_EM, Sum); } else if (lfHeight < 0) { /* case (B): lfHeight is negative */ 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); + tmAscent64 = FT_MulDiv(-lfHeight * 64, pHori->Ascender, face->units_per_EM); + tmDescent64 = FT_MulDiv(-lfHeight * 64, -pHori->Descender, face->units_per_EM); } else { - 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); + tmAscent64 = FT_MulDiv(-lfHeight * 64, (FT_Short)pOS2->usWinAscent, face->units_per_EM); + tmDescent64 = FT_MulDiv(-lfHeight * 64, (FT_Short)pOS2->usWinDescent, face->units_per_EM); } - FontGDI->tmHeight = FontGDI->tmAscent + FontGDI->tmDescent; - FontGDI->tmInternalLeading = FontGDI->tmHeight + lfHeight; + tmHeight64 = tmAscent64 + tmDescent64; + tmInternalLeading = (tmHeight64 >> 6) + lfHeight; } #undef FM_SEL_USE_TYPO_METRICS - FontGDI->EmHeight = FontGDI->tmHeight - FontGDI->tmInternalLeading; - FontGDI->EmHeight = max(FontGDI->EmHeight, 1); - FontGDI->EmHeight = min(FontGDI->EmHeight, USHORT_MAX); + FontGDI->tmAscent = (tmAscent64 >> 6); + FontGDI->tmDescent = (tmDescent64 >> 6); + FontGDI->tmHeight = (tmHeight64 >> 6); + FontGDI->tmInternalLeading = tmInternalLeading; + EmHeight64 = tmHeight64 - (tmInternalLeading * 64); + EmHeight64 = max(EmHeight64, 1); + EmHeight64 = min(EmHeight64, USHORT_MAX); FontGDI->Magic = FONTGDI_MAGIC; - EmHeight64 = (FontGDI->EmHeight << 6); - req.type = FT_SIZE_REQUEST_TYPE_NOMINAL; req.width = 0; req.height = EmHeight64; diff --git a/win32ss/user/ntuser/draw.c b/win32ss/user/ntuser/draw.c index f648287c55..4a5fe09637 100644 --- a/win32ss/user/ntuser/draw.c +++ b/win32ss/user/ntuser/draw.c @@ -804,10 +804,7 @@ BOOL FASTCALL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags) IntDrawRectEdge(dc,r,(uFlags&DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT | BF_MIDDLE | BF_SOFT); RtlZeroMemory(&lf, sizeof(LOGFONTW)); UITOOLS_MakeSquareRect(r, &myr); - myr.left += 1; - myr.top += 1; - myr.right -= 1; - myr.bottom -= 1; + RECTL_vInflateRect(&myr, -2, -2); if(uFlags & DFCS_PUSHED) RECTL_vOffsetRect(&myr,1,1); lf.lfHeight = myr.bottom - myr.top;