Fix zoom in TQTextEdit

TQTextEdit::zoomIn / TQTextEdit::zoomOut does not work if the original
font had its size specified in pixels instead of points.
pointSize() returns 0 in such case.
pull/1/head
Waldo Bastian 10 years ago committed by Slávek Banko
parent 0cce3b0ec1
commit 9a892fcab0

@ -5774,7 +5774,12 @@ void TQTextEdit::setFont( const TQFont &f )
void TQTextEdit::zoomIn( int range ) void TQTextEdit::zoomIn( int range )
{ {
TQFont f( TQScrollView::font() ); TQFont f( TQScrollView::font() );
f.setPointSize( TQFontInfo(f).pointSize() + range ); TQFontInfo fi(f);
if (fi.pointSize() <= 0) {
f.setPixelSize( fi.pixelSize() + range );
} else {
f.setPointSize( fi.pointSize() + range );
}
setFont( f ); setFont( f );
} }
@ -5789,7 +5794,12 @@ void TQTextEdit::zoomIn( int range )
void TQTextEdit::zoomOut( int range ) void TQTextEdit::zoomOut( int range )
{ {
TQFont f( TQScrollView::font() ); TQFont f( TQScrollView::font() );
f.setPointSize( TQMAX( 1, TQFontInfo(f).pointSize() - range ) ); TQFontInfo fi(f);
if (fi.pointSize() <= 0) {
f.setPixelSize( TQMAX( 1, fi.pixelSize() - range ) );
} else {
f.setPointSize( TQMAX( 1, fi.pointSize() - range ) );
}
setFont( f ); setFont( f );
} }

Loading…
Cancel
Save