[Kde-cygwin-cvs] CVS: qt-3/src/kernel qfont_win.cpp,1.1.2.16.2.11,1.1.2.16.2.12 qfontdatabase_win.cp
Status: Inactive
Brought to you by:
habacker
From: Christian E. <che...@us...> - 2005-10-24 18:09:25
|
Update of /cvsroot/kde-cygwin/qt-3/src/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1343/src/kernel Modified Files: Tag: QT_WIN32_3_3_BRANCH qfont_win.cpp qfontdatabase_win.cpp Log Message: font loading should work now much better... Index: qfont_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/kernel/Attic/qfont_win.cpp,v retrieving revision 1.1.2.16.2.11 retrieving revision 1.1.2.16.2.12 diff -u -r1.1.2.16.2.11 -r1.1.2.16.2.12 --- qfont_win.cpp 1 Aug 2005 17:44:46 -0000 1.1.2.16.2.11 +++ qfont_win.cpp 24 Oct 2005 18:09:16 -0000 1.1.2.16.2.12 @@ -106,48 +106,26 @@ return qf; } -//333 -double qt_pixelSize( double pointSize, QPaintDevice *paintdevice, int scr ) -{ - if ( pointSize < 0 ) - return -1.; - - double result = pointSize; - if ( paintdevice && QPaintDeviceMetrics( paintdevice ).logicalDpiY() != 75 ) // ==75 -- never under Windows? - result *= QPaintDeviceMetrics( paintdevice ).logicalDpiY() / 72.; - - return result; -} - -//333 -double qt_pointSize( double pixelSize, QPaintDevice *paintdevice, int scr ) -{ - if ( pixelSize < 0 ) - return -1.; - - double result = pixelSize; - if ( paintdevice && QPaintDeviceMetrics( paintdevice ).logicalDpiY() != 75 ) - result *= 72. / QPaintDeviceMetrics( paintdevice ).logicalDpiY(); - - return result; -} - -//333 -static inline double pixelSize( const QFontDef &request, QPaintDevice *paintdevice, - int scr ) +static inline double pixelSize( const QFontDef &request, QPaintDevice *paintdevice ) { - return ( ( request.pointSize != -1 ) ? - qt_pixelSize( request.pointSize / 10., paintdevice, scr ) : - ( double ) request.pixelSize ); + double pSize; + int dpi = GetDeviceCaps(qt_display_dc(),LOGPIXELSY); + if (request.pointSize != -1) + pSize = request.pointSize * dpi/ 72.; + else + pSize = request.pixelSize; + return pSize / 10; } -//333 -static inline double pointSize( const QFontDef &request, QPaintDevice *paintdevice, - int scr ) +static inline double pointSize( const QFontDef &fd, QPaintDevice *paintdevice ) { - return ( ( request.pixelSize != -1 ) ? - qt_pointSize( request.pixelSize, paintdevice, scr ) * 10. : - ( double ) request.pointSize ); + double pSize; + int dpi = GetDeviceCaps(qt_display_dc(),LOGPIXELSY); + if (fd.pointSize < 0) + pSize = fd.pixelSize * 72. / ((float)dpi); + else + pSize = fd.pointSize; + return pSize / 10; } @@ -239,7 +217,9 @@ #endif // QT_CHECK_STATE QFontDef req = request; - req.pixelSize = qRound( pixelSize( req, paintdevice, screen ) ); + req.pixelSize = qRound( pixelSize( req, paintdevice ) ); + + // set the point size to 0 to get better caching req.pointSize = 0; if ( ! engineData ) { @@ -257,6 +237,9 @@ } } + // set it to the actual pointsize, so QFontInfo will do the right thing + req.pointSize = qRound( pointSize( request, paintdevice ) ); + // the cached engineData could have already loaded the engine we want if ( engineData->engines[ script ] ) return ; @@ -306,7 +289,7 @@ QStringList::ConstIterator it = family_list.begin(), end = family_list.end(); for ( ; ! engine && it != end; ++it ) { req.family = *it; - //qDebug("calling findFont with %s for %d",req.family.latin1(),script); + qDebug("calling findFont with %s for %d",req.family.latin1(),script); engine = QFontDatabase::findFont( script, this, req ); if ( engine ) { if ( engine->type() != QFontEngine::Box ) Index: qfontdatabase_win.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/qt-3/src/kernel/Attic/qfontdatabase_win.cpp,v retrieving revision 1.1.2.6.2.21 retrieving revision 1.1.2.6.2.22 diff -u -r1.1.2.6.2.21 -r1.1.2.6.2.22 --- qfontdatabase_win.cpp 9 Oct 2005 17:39:16 -0000 1.1.2.6.2.21 +++ qfontdatabase_win.cpp 24 Oct 2005 18:09:16 -0000 1.1.2.6.2.22 @@ -37,823 +37,30 @@ //#define QFONTDATABASE_ENABLE_QT4CODE -#ifndef QFONTDATABASE_ENABLE_QT4CODE - -#include <qplatformdefs.h> - -#include <qdatetime.h> -#include <qpaintdevicemetrics.h> - -#include "qt_windows.h" [...1835 lines suppressed...] - QtFontStyle *style) +static inline void load( const QString &family = QString::null, int script = -1 ) { - return Qt4::loadEngine(script, fp, - request, - family, foundry, - &Qt4::QtFontStyle(*style)); -} + return ; -void QFontDatabase::createDatabase() -{ - if ( db ) - return ; - initializeDb(); } -#endif \ No newline at end of file +#endif // QFONTDATABASE_ENABLE_QT4CODE |