From 1dbd07d9d1cd323cf16274c11db01d6c704f809f Mon Sep 17 00:00:00 2001 From: "mkaply%us.ibm.com" Date: Wed, 4 Jul 2001 03:31:11 +0000 Subject: [PATCH] No bug - OS/2 only - font tweaks --- gfx/src/os2/nsDeviceContextOS2.cpp | 8 +++++--- gfx/src/os2/nsFontMetricsOS2.cpp | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gfx/src/os2/nsDeviceContextOS2.cpp b/gfx/src/os2/nsDeviceContextOS2.cpp index 51bc9b66bd7b..b4f2f506adc1 100644 --- a/gfx/src/os2/nsDeviceContextOS2.cpp +++ b/gfx/src/os2/nsDeviceContextOS2.cpp @@ -181,9 +181,11 @@ void nsDeviceContextOS2 :: CommonInit(HDC aDC) GFX (::DevQueryCaps(aDC, CAPS_FAMILY, CAPS_DEVICE_POLYSET_POINTS, alArray), FALSE); -// This change breaks opening and closing of sidebar -// mTwipsToPixels = (float)alArray [CAPS_VERTICAL_RESOLUTION] / (float)NS_METERS_TO_TWIPS (1); - mTwipsToPixels = ((float)alArray [CAPS_VERTICAL_FONT_RES]) / (float)NSIntPointsToTwips(72); +// It would seem that Mozilla basically requires that mTwipsToPixels = 1/15 and +// mPixelsToTwips = 15. Some side effects from not doing this are boxes drawing +// wrong and fonts coming out incorrect. +// mTwipsToPixels = ((float)alArray [CAPS_VERTICAL_FONT_RES]) / (float)NSIntPointsToTwips(72); + mTwipsToPixels = 1.0f / 15.0f; mPixelsToTwips = 1.0f / mTwipsToPixels; diff --git a/gfx/src/os2/nsFontMetricsOS2.cpp b/gfx/src/os2/nsFontMetricsOS2.cpp index 63f29ac9e349..7f1e65665ff3 100644 --- a/gfx/src/os2/nsFontMetricsOS2.cpp +++ b/gfx/src/os2/nsFontMetricsOS2.cpp @@ -833,8 +833,9 @@ HDC ps = NULL; // Note: are you confused by the block above, and thinking that app2twip // must be 1? Well, there's *no* guarantee that app units are // twips, despite whatever nscoord.h says! - int points = NSTwipsToFloorIntPoints( nscoord( mFont->size * app2twip * textZoom)); - fh->charbox.cx = MAKEFIXED( points * 20 * twip2dev, 0); + LONG lHeight = NSToIntRound(mFont->size * app2dev * textZoom); + int points = mFont->size/20; + fh->charbox.cx = MAKEFIXED(lHeight, 0); fh->charbox.cy = fh->charbox.cx; // 8) If we're using an image font, check it's available in the size @@ -848,7 +849,6 @@ HDC ps = NULL; long lFonts = 0; int i; PFONTMETRICS pMetrics = getMetrics( lFonts, fh->fattrs.szFacename, ps); - int curPoints = 0; for( i = 0; i < lFonts; i++) { if( !stricmp(fh->fattrs.szFacename, pMetrics[i].szFacename) &&