https://bugs.freedesktop.org/show_bug.cgi?id=56851
--- Comment #8 from Flex Liu <wind...@gmail.com> --- > > Mostly the root cause start in code: > /core/chart2/source/tools/ReferenceSizeProvider.cxx Sorry, the root cause should be in code: /core/svx/source/svdraw/svdotext.cxx 1254 void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner ) const 1255 { 1256 const Size aShapeSize=GetSnapRect().GetSize(); 1257 ImpAutoFitText( rOutliner, 1258 Size(aShapeSize.Width()-GetTextLeftDistance()-GetTextRightDistance(), 1259 aShapeSize.Height()-GetTextUpperDistance()-GetTextLowerDistance()), 1260 IsVerticalWriting() ); 1261 } 1262 1263 void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner, const Size& rTextSize, bool bIsVerticalWriting ) 1264 { 1265 // EditEngine formatting is unstable enough for 1266 // line-breaking text that we need some more samples 1267 1268 // loop early-exits if we detect an already attained value 1269 sal_uInt16 nMinStretchX=0, nMinStretchY=0; 1270 sal_uInt16 aOldStretchXVals[]={0,0,0,0,0,0,0,0,0,0}; 1271 const size_t aStretchArySize=SAL_N_ELEMENTS(aOldStretchXVals); 1272 for(unsigned int i=0; i<aStretchArySize; ++i) 1273 { 1274 const Size aCurrTextSize = rOutliner.CalcTextSizeNTP(); 1275 double fFactor(1.0); 1276 if( bIsVerticalWriting ) 1277 fFactor = double(rTextSize.Width())/aCurrTextSize.Width(); 1278 else 1279 fFactor = double(rTextSize.Height())/aCurrTextSize.Height(); 1280 1281 sal_uInt16 nCurrStretchX, nCurrStretchY; 1282 rOutliner.GetGlobalCharStretching(nCurrStretchX, nCurrStretchY); 1283 1284 if (fFactor >= 1.0 ) 1285 { 1286 // resulting text area fits into available shape rect - 1287 // err on the larger stretching, to optimally fill area 1288 nMinStretchX = std::max(nMinStretchX,nCurrStretchX); 1289 nMinStretchY = std::max(nMinStretchY,nCurrStretchY); 1290 } 1291 1292 aOldStretchXVals[i] = nCurrStretchX; 1293 if( std::find(aOldStretchXVals, aOldStretchXVals+i, nCurrStretchX) != aOldStretchXVals+i ) 1294 break; // same value already attained once; algo is looping, exit 1295 1296 if (fFactor < 1.0 || (fFactor >= 1.0 && nCurrStretchX != 100)) 1297 { 1298 nCurrStretchX = sal::static_int_cast<sal_uInt16>(nCurrStretchX*fFactor); 1299 nCurrStretchY = sal::static_int_cast<sal_uInt16>(nCurrStretchY*fFactor); 1300 rOutliner.SetGlobalCharStretching(std::min(sal_uInt16(100),nCurrStretchX), 1301 std::min(sal_uInt16(100),nCurrStretchY)); 1302 OSL_TRACE("SdrTextObj::onEditOutlinerStatusEvent(): zoom is %d", nCurrStretchX); 1303 } 1304 } 1305 1306 OSL_TRACE("---- SdrTextObj::onEditOutlinerStatusEvent(): final zoom is %d ----", nMinStretchX); 1307 rOutliner.SetGlobalCharStretching(std::min(sal_uInt16(100),nMinStretchX), 1308 std::min(sal_uInt16(100),nMinStretchY)); 1309 } -- You are receiving this mail because: You are the assignee for the bug.
_______________________________________________ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs