Summary: | Impress autoresize font in slide don't work properly. | ||
---|---|---|---|
Product: | LibreOffice | Reporter: | Massimo Medolla <massimed> |
Component: | Impress | Assignee: | Not Assigned <libreoffice-bugs> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | sasha.libreoffice, varnagyzsombor, winddss |
Priority: | medium | ||
Version: | 3.6.2.2 release | ||
Hardware: | x86 (IA32) | ||
OS: | Linux (All) | ||
See Also: | https://bugs.freedesktop.org/show_bug.cgi?id=42134 | ||
Whiteboard: | |||
Crash report or crash signature: | Regression By: |
Description
Massimo Medolla
2012-11-07 20:21:45 UTC
There is a video file some show the problems. (In reply to comment #1) > There is a video file some show the problems. https://www.box.com/s/h39le9oszaxwwtpyq3ff See also: Bug 54434 - EDITING: auto-resizing textbox See also: Bug 56849 - EDITING: Auto Reduce font size during typing *** Bug 56849 has been marked as a duplicate of this bug. *** *** Bug 54434 has been marked as a duplicate of this bug. *** Still reproduce in upstream 4.0.0 beta. Some of different between the reproduce video, and more detail. 1. I can change the font size with a suitable font size number for the content object, after the "Autofit Text" made the font too small. 2. If I change the font size with a number which greater than the suitable number, it will be acceptable when you not leave the edit mode for the content object, but the font size will become unacceptable smaller after you leave the edit mode, and it will never back to suitable size if you enter the edit mode again. Mostly the root cause start in code: /core/chart2/source/tools/ReferenceSizeProvider.cxx continue investigate it. >
> 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 }
|