equal
deleted
inserted
replaced
38 ** $QT_END_LICENSE$ |
38 ** $QT_END_LICENSE$ |
39 ** |
39 ** |
40 ****************************************************************************/ |
40 ****************************************************************************/ |
41 |
41 |
42 #include "qt_windows.h" |
42 #include "qt_windows.h" |
|
43 #include <qmath.h> |
43 #include <private/qapplication_p.h> |
44 #include <private/qapplication_p.h> |
44 #include "qfont_p.h" |
45 #include "qfont_p.h" |
45 #include "qfontengine_p.h" |
46 #include "qfontengine_p.h" |
46 #include "qpaintdevice.h" |
47 #include "qpaintdevice.h" |
47 #include "qlibrary.h" |
48 #include "qlibrary.h" |
668 break; |
669 break; |
669 default: |
670 default: |
670 break; |
671 break; |
671 } |
672 } |
672 |
673 |
673 lf.lfHeight = -request.pixelSize; |
674 lf.lfHeight = -qRound(request.pixelSize); |
674 lf.lfWidth = 0; |
675 lf.lfWidth = 0; |
675 lf.lfEscapement = 0; |
676 lf.lfEscapement = 0; |
676 lf.lfOrientation = 0; |
677 lf.lfOrientation = 0; |
677 if (desc->style->key.weight == 50) |
678 if (desc->style->key.weight == 50) |
678 lf.lfWeight = FW_DONTCARE; |
679 lf.lfWeight = FW_DONTCARE; |
897 blacklistedFamilies.append(desc.familyIndex); |
898 blacklistedFamilies.append(desc.familyIndex); |
898 } |
899 } |
899 return fe; |
900 return fe; |
900 } |
901 } |
901 |
902 |
902 |
|
903 void QFontDatabase::load(const QFontPrivate *d, int script) |
903 void QFontDatabase::load(const QFontPrivate *d, int script) |
904 { |
904 { |
905 // sanity checks |
905 // sanity checks |
906 if (!qApp) |
906 if (!qApp) |
907 qWarning("QFontDatabase::load: Must construct QApplication first"); |
907 qWarning("QFontDatabase::load: Must construct QApplication first"); |
908 Q_ASSERT(script >= 0 && script < QUnicodeTables::ScriptCount); |
908 Q_ASSERT(script >= 0 && script < QUnicodeTables::ScriptCount); |
909 |
909 |
910 // normalize the request to get better caching |
910 // normalize the request to get better caching |
911 QFontDef req = d->request; |
911 QFontDef req = d->request; |
912 if (req.pixelSize <= 0) |
912 if (req.pixelSize <= 0) |
913 req.pixelSize = qMax(1, qRound(req.pointSize * d->dpi / 72.)); |
913 req.pixelSize = qreal((req.pointSize * d->dpi) / 72.); |
914 req.pointSize = 0; |
914 if (req.pixelSize < 1) |
|
915 req.pixelSize = 1; |
915 if (req.weight == 0) |
916 if (req.weight == 0) |
916 req.weight = QFont::Normal; |
917 req.weight = QFont::Normal; |
917 if (req.stretch == 0) |
918 if (req.stretch == 0) |
918 req.stretch = 100; |
919 req.stretch = 100; |
919 |
920 |
926 return; |
927 return; |
927 |
928 |
928 QFontEngine *fe = QFontCache::instance()->findEngine(key); |
929 QFontEngine *fe = QFontCache::instance()->findEngine(key); |
929 |
930 |
930 // set it to the actual pointsize, so QFontInfo will do the right thing |
931 // set it to the actual pointsize, so QFontInfo will do the right thing |
931 req.pointSize = req.pixelSize*72./d->dpi; |
932 if (req.pointSize < 0) |
|
933 req.pointSize = req.pixelSize*72./d->dpi; |
932 |
934 |
933 if (!fe) { |
935 if (!fe) { |
934 if (qt_enable_test_font && req.family == QLatin1String("__Qt__Box__Engine__")) { |
936 if (qt_enable_test_font && req.family == QLatin1String("__Qt__Box__Engine__")) { |
935 fe = new QTestFontEngine(req.pixelSize); |
937 fe = new QTestFontEngine(req.pixelSize); |
936 fe->fontDef = req; |
938 fe->fontDef = req; |