Module: wine Branch: master Commit: b2fa21e4bb1178bb643df1a70cbac940a4371ef3 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b2fa21e4bb1178bb643df1a70c...
Author: Dmitry Timoshkov dmitry@codeweavers.com Date: Tue Jun 24 16:12:50 2008 +0900
gdi32: Scale outline font metrics.
---
dlls/gdi32/freetype.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index e185544..f9df27b 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -4921,6 +4921,55 @@ static void scale_font_metrics(const GdiFont *font, LPTEXTMETRICW ptm) #undef SCALE_Y }
+static void scale_outline_font_metrics(const GdiFont *font, OUTLINETEXTMETRICW *potm) +{ + double scale_x, scale_y; + + if (font->aveWidth) + { + scale_x = (double)font->aveWidth; + scale_x /= (double)font->potm->otmTextMetrics.tmAveCharWidth; + } + else + scale_x = font->scale_y; + + scale_x *= fabs(font->font_desc.matrix.eM11); + scale_y = font->scale_y * fabs(font->font_desc.matrix.eM22); + + scale_font_metrics(font, &potm->otmTextMetrics); + +#define SCALE_X(x) (x) = GDI_ROUND((double)(x) * (scale_x)) +#define SCALE_Y(y) (y) = GDI_ROUND((double)(y) * (scale_y)) + + SCALE_Y(potm->otmAscent); + SCALE_Y(potm->otmDescent); + SCALE_Y(potm->otmLineGap); + SCALE_Y(potm->otmsCapEmHeight); + SCALE_Y(potm->otmsXHeight); + SCALE_Y(potm->otmrcFontBox.top); + SCALE_Y(potm->otmrcFontBox.bottom); + SCALE_X(potm->otmrcFontBox.left); + SCALE_X(potm->otmrcFontBox.right); + SCALE_Y(potm->otmMacAscent); + SCALE_Y(potm->otmMacDescent); + SCALE_Y(potm->otmMacLineGap); + SCALE_X(potm->otmptSubscriptSize.x); + SCALE_Y(potm->otmptSubscriptSize.y); + SCALE_X(potm->otmptSubscriptOffset.x); + SCALE_Y(potm->otmptSubscriptOffset.y); + SCALE_X(potm->otmptSuperscriptSize.x); + SCALE_Y(potm->otmptSuperscriptSize.y); + SCALE_X(potm->otmptSuperscriptOffset.x); + SCALE_Y(potm->otmptSuperscriptOffset.y); + SCALE_Y(potm->otmsStrikeoutSize); + SCALE_Y(potm->otmsStrikeoutPosition); + SCALE_Y(potm->otmsUnderscoreSize); + SCALE_Y(potm->otmsUnderscorePosition); + +#undef SCALE_X +#undef SCALE_Y +} + /************************************************************* * WineEngGetTextMetrics * @@ -4977,7 +5026,7 @@ UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize, if(cbSize >= font->potm->otmSize) { memcpy(potm, font->potm, font->potm->otmSize); - scale_font_metrics(font, &potm->otmTextMetrics); + scale_outline_font_metrics(font, potm); } LeaveCriticalSection( &freetype_cs ); return font->potm->otmSize; @@ -5214,7 +5263,7 @@ UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize, if(potm && needed <= cbSize) { memcpy(potm, font->potm, font->potm->otmSize); - scale_font_metrics(font, &potm->otmTextMetrics); + scale_outline_font_metrics(font, potm); }
end: