1. mst
  2. ooo340

Commits

ihi  committed 9017946

CWS-TOOLING: integrate CWS aw067_DEV300
2009-03-24 11:47:28 +0100 aw r269933 : #i100489# added missing support for proportional font scaling and DXArray preparation
2009-03-24 11:42:59 +0100 aw r269932 : #i100424# corrected handling of font scaling in renderer and tooling

  • Participants
  • Parent commits 1e46c5f
  • Branches default

Comments (0)

Files changed (3)

File drawinglayer/source/primitive2d/textlayoutdevice.cxx

View file
  • Ignore whitespace
 			aRetval.SetOutline(rFontAttributes.getOutline());
 
 #ifdef WIN32
-            if(nWidth != nHeight)
+			// #100424# use higher precision
+            if(!basegfx::fTools::equal(fFontScaleX, fFontScaleY))
 			{
                 // #i92757#
                 // Removed the relative calculation with GetFontMetric() usage again. On

File drawinglayer/source/processor2d/vclprocessor2d.cxx

View file
  • Ignore whitespace
 
                     if(!basegfx::fTools::equal(aScale.getX(), aScale.getY()))
                     {
-                        // #i96581# font stretching is needed; examine how big the difference between X and Y scaling is
-                        const double fPercent(fabs(1.0 - (aScale.getX() / aScale.getY())));
-                        static double fMaximumAcceptedPercent(0.05);
-                        static bool bForceAdaption(false);
+						// #100424# We have a hint on FontScaling here. To decide a look
+						// at the pure font's scale is needed, since e.g. SC uses unequally scaled 
+						// MapModes (was: #i96581#, but use available full precision from primitive 
+						// now). aTranslate and fShearX can be reused since no longer needed.
+						basegfx::B2DVector aFontScale;
+						double fFontRotate;
+						rTextCandidate.getTextTransform().decompose(aFontScale, aTranslate, fFontRotate, fShearX);
 
-                        if(bForceAdaption || fPercent > fMaximumAcceptedPercent)
-                        {
-                            // #i96581# Need to adapt to a FontStretching bigger than acceptable maximum.
-                            // Get font's real width using FontMetric and adapt font to stretched
-                            // font
-                            const FontMetric aFontMetric(mpOutputDevice->GetFontMetric(aFont));
-                            const double fRealFontWidth(aFontMetric.GetWidth());
-
+						if(!basegfx::fTools::equal(aFontScale.getX(), aFontScale.getY()))
+						{
+							// indeed a FontScaling. Set at Font. Use the combined scale
+							// and rotate here
                             aFont = primitive2d::getVclFontFromFontAttributes(
                                 rTextCandidate.getFontAttributes(), 
-                                fRealFontWidth, 
+                                aScale.getX(), 
                                 aScale.getY(), 
                                 fRotate, 
                                 *mpOutputDevice);
-                        }
-                        else
-                        {
-                            // #i96581# less than allowed maximum (probably SC's generated MapModes). React
-                            // pragmatically by ignoring the stretching up to this point
-                        }
+						}
                     }
 
 					// handle additional font attributes

File svx/source/svdraw/svdotextdecomposition.cxx

View file
  • Ignore whitespace
                 false));
 			basegfx::B2DHomMatrix aNewTransform;
 
-			// add font scale to new transform
+			// #i100489# need extra scale factor for DXArray which collects all scalings
+			// which are needed to get the DXArray to unit coordinates
+			double fDXArrayScaleFactor(aSize.getX());
+
+            // add font scale to new transform
 			aNewTransform.scale(aSize.getX(), aSize.getY());
 
 			// look for proportional font scaling, evtl scale accordingly
 			{
 				const double fFactor(rInfo.mrFont.GetPropr() / 100.0);
 				aNewTransform.scale(fFactor, fFactor);
+
+				// #i100489# proportional font scaling influences the DXArray,
+				// add to factor
+				fDXArrayScaleFactor *= fFactor;
 			}
 
 			// apply font rotate
 
 			if(!bDisableTextArray && rInfo.mpDXArray && rInfo.mnTextLen)
 			{
-				const double fScaleFactor(basegfx::fTools::equalZero(aSize.getX()) ? 1.0 : 1.0 / aSize.getX());
+				// #i100489# use fDXArrayScaleFactor here
+				const double fScaleFactor(basegfx::fTools::equalZero(fDXArrayScaleFactor) ? 1.0 : 1.0 / fDXArrayScaleFactor);
 				aDXArray.reserve(rInfo.mnTextLen);
 
 				for(xub_StrLen a(0); a < rInfo.mnTextLen; a++)