- Timestamp:
- Aug 21, 2009, 3:34:10 AM (16 years ago)
- Location:
- trunk/src/gui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qwidget_pm.cpp
r123 r124 1920 1920 int QWidget::metric(PaintDeviceMetric m) const 1921 1921 { 1922 // @todo implement 1923 return 0; 1922 Q_D(const QWidget); 1923 LONG val; 1924 if (m == PdmWidth) { 1925 val = data->crect.width(); 1926 } else if (m == PdmHeight) { 1927 val = data->crect.height(); 1928 } else { 1929 HDC hdc = GpiQueryDevice(qt_display_ps()); 1930 switch (m) { 1931 case PdmDpiX: 1932 case PdmPhysicalDpiX: 1933 if (d->extra && d->extra->customDpiX) 1934 val = d->extra->customDpiX; 1935 else if (d->parent) 1936 val = static_cast<QWidget *>(d->parent)->metric(m); 1937 else 1938 DevQueryCaps(hdc, CAPS_HORIZONTAL_FONT_RES, 1, &val); 1939 break; 1940 case PdmDpiY: 1941 case PdmPhysicalDpiY: 1942 if (d->extra && d->extra->customDpiY) 1943 val = d->extra->customDpiY; 1944 else if (d->parent) 1945 val = static_cast<QWidget *>(d->parent)->metric(m); 1946 else 1947 DevQueryCaps(hdc, CAPS_VERTICAL_FONT_RES, 1, &val); 1948 break; 1949 case PdmWidthMM: 1950 DevQueryCaps(hdc, CAPS_HORIZONTAL_RESOLUTION, 1, &val); 1951 val = data->crect.width() * 1000 / val; 1952 break; 1953 case PdmHeightMM: 1954 DevQueryCaps(hdc, CAPS_VERTICAL_RESOLUTION, 1, &val); 1955 val = data->crect.height() * 1000 / val; 1956 break; 1957 case PdmNumColors: 1958 DevQueryCaps(hdc, CAPS_COLORS, 1, &val); 1959 break; 1960 case PdmDepth: 1961 LONG colorInfo[2]; 1962 DevQueryCaps(hdc, CAPS_COLOR_PLANES, 2, colorInfo); 1963 val = colorInfo[0] * colorInfo[1]; 1964 break; 1965 default: 1966 val = 0; 1967 qWarning("QWidget::metric: Invalid metric command"); 1968 } 1969 } 1970 return val; 1924 1971 } 1925 1972 -
trunk/src/gui/text/qfont.cpp
r2 r124 66 66 #include <private/qt_x11_p.h> 67 67 #endif 68 69 70 71 68 72 #ifdef Q_WS_QWS 69 73 #include "qscreen_qws.h" … … 159 163 #elif defined(Q_WS_WIN) 160 164 dpi = GetDeviceCaps(shared_dc(),LOGPIXELSX); 165 166 167 168 169 170 161 171 #elif defined(Q_WS_MAC) 162 172 extern float qt_mac_defaultDpi_x(); //qpaintdevice_mac.cpp … … 185 195 #elif defined(Q_WS_WIN) 186 196 dpi = GetDeviceCaps(shared_dc(),LOGPIXELSY); 197 198 199 200 201 202 187 203 #elif defined(Q_WS_MAC) 188 204 extern float qt_mac_defaultDpi_y(); //qpaintdevice_mac.cpp -
trunk/src/gui/text/qfontdatabase.cpp
r95 r124 815 815 #endif 816 816 817 #if defined(Q_WS_X11) || defined(Q_WS_WIN) 817 #if defined(Q_WS_X11) || defined(Q_WS_WIN) 818 818 static void getEngineData(const QFontPrivate *d, const QFontCache::Key &key) 819 819 { -
trunk/src/gui/text/qfontdatabase_pm.cpp
r95 r124 63 63 void QFontDatabase::load(const QFontPrivate *d, int script) 64 64 { 65 // @todo implement 65 Q_ASSERT(script >= 0 && script < QUnicodeTables::ScriptCount); 66 67 // normalize the request to get better caching 68 QFontDef req = d->request; 69 if (req.pixelSize <= 0) 70 req.pixelSize = qMax(1, qRound(req.pointSize * d->dpi / 72.)); 71 req.pointSize = 0; 72 if (req.weight == 0) 73 req.weight = QFont::Normal; 74 if (req.stretch == 0) 75 req.stretch = 100; 76 77 QFontCache::Key key(req, d->rawMode ? QUnicodeTables::Common : script, d->screen); 78 if (!d->engineData) 79 getEngineData(d, key); 80 81 // the cached engineData could have already loaded the engine we want 82 if (d->engineData->engines[script]) 83 return; 84 85 // set it to the actual pointsize, so QFontInfo will do the right thing 86 req.pointSize = req.pixelSize * 72. / d->dpi; 87 88 QFontEngine *fe = QFontCache::instance()->findEngine(key); 89 90 if (!fe) { 91 if (qt_enable_test_font && req.family == QLatin1String("__Qt__Box__Engine__")) { 92 fe = new QTestFontEngine(req.pixelSize); 93 fe->fontDef = req; 94 } else { 95 // @todo initializeDb() and stuff, get the engine 96 } 97 if (!fe) { 98 fe = new QFontEngineBox(req.pixelSize); 99 fe->fontDef = QFontDef(); 100 } 101 } 102 if (fe->symbol || (d->request.styleStrategy & QFont::NoFontMerging)) { 103 for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) { 104 if (!d->engineData->engines[i]) { 105 d->engineData->engines[i] = fe; 106 fe->ref.ref(); 107 } 108 } 109 } else { 110 d->engineData->engines[script] = fe; 111 fe->ref.ref(); 112 } 113 QFontCache::instance()->insertEngine(key, fe); 66 114 } 67 115 -
trunk/src/gui/text/qfontengine_p.h
r95 r124 165 165 virtual void doKerning(QGlyphLayout *, QTextEngine::ShaperFlags) const; 166 166 167 #if !defined(Q_WS_X11) && !defined(Q_WS_WIN) && !defined(Q_WS_ MAC)167 #if !defined(Q_WS_X11) && !defined(Q_WS_WIN) && !defined(Q_WS_MAC) 168 168 virtual void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si) = 0; 169 169 #endif
Note:
See TracChangeset
for help on using the changeset viewer.