Qt 4.8
Classes | Functions
qfont_p.h File Reference
#include "QtGui/qfont.h"
#include "QtCore/qmap.h"
#include "QtCore/qobject.h"
#include <private/qunicodetables_p.h>
#include <QtGui/qfontdatabase.h>
#include "private/qfixed_p.h"

Go to the source code of this file.

Classes

class  QFontCache
 
struct  QFontCache::Engine
 
struct  QFontCache::Key
 
struct  QFontDef
 
class  QFontEngineData
 
class  QFontPrivate
 

Functions

Q_GUI_EXPORT int qt_defaultDpi ()
 
Q_GUI_EXPORT int qt_defaultDpiX ()
 
Q_GUI_EXPORT int qt_defaultDpiY ()
 

Function Documentation

◆ qt_defaultDpi()

Q_GUI_EXPORT int qt_defaultDpi ( )

Definition at line 240 of file qfont.cpp.

241 {
242  return qt_defaultDpiY();
243 }
Q_GUI_EXPORT int qt_defaultDpiY()
Definition: qfont.cpp:201

◆ qt_defaultDpiX()

Q_GUI_EXPORT int qt_defaultDpiX ( )

Definition at line 162 of file qfont.cpp.

Referenced by QPicture::exec(), QAlphaPaintEngine::flushAndInit(), QStaticTextPrivate::get(), QBlittablePixmapData::metric(), QRasterPixmapData::metric(), QPaintBuffer::metric(), QGLPixelBuffer::metric(), QPicture::metric(), QGLFramebufferObject::metric(), QGLPixmapData::metric(), QVGPixmapData::metric(), QMacQuartzPaintDevice::metric(), QPainterReplayer::process(), QFakeDevice::QFakeDevice(), and QPainterReplayer::setupTransform().

163 {
164  if (!qt_is_gui_used)
165  return 75;
166 
167  int dpi;
168 #ifdef Q_WS_X11
169  dpi = QX11Info::appDpiX();
170 #elif defined(Q_WS_WIN)
171  dpi = GetDeviceCaps(shared_dc(),LOGPIXELSX);
172 #elif defined(Q_WS_MAC)
173  extern float qt_mac_defaultDpi_x(); //qpaintdevice_mac.cpp
174  dpi = qt_mac_defaultDpi_x();
175 #elif defined(Q_WS_QWS)
176  if (!qt_screen)
177  return 72;
178  QScreen *screen = qt_screen;
179  const QList<QScreen*> subScreens = qt_screen->subScreens();
180  if (!subScreens.isEmpty())
181  screen = subScreens.at(0);
182  dpi = qRound(screen->width() / (screen->physicalWidth() / qreal(25.4)));
183 #elif defined(Q_WS_QPA)
184  QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
185  if (pi) {
186  QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0);
187  const QSize screenSize = screen->geometry().size();
188  const QSize physicalSize = screen->physicalSize();
189  dpi = qRound(screenSize.width() / (physicalSize.width() / qreal(25.4)));
190  } else {
191  //PI has not been initialised, or it is being initialised. Give a default dpi
192  dpi = 100;
193  }
194 #elif defined(Q_OS_SYMBIAN)
195  dpi = S60->defaultDpiX;
196 #endif // Q_WS_X11
197 
198  return dpi;
199 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
double qreal
Definition: qglobal.h:1193
The QPlatformScreen class provides an abstraction for visual displays.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
int width() const
Returns the logical width of the framebuffer in pixels.
Definition: qscreen_qws.h:227
int width() const
Returns the width.
Definition: qsize.h:126
static int appDpiX(int screen=-1)
Returns the horizontal resolution of the given screen in terms of the number of dots per inch...
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
virtual QRect geometry() const =0
Reimplement in subclass to return the pixel geometry of the screen.
virtual QSize physicalSize() const
Reimplement this function in subclass to return the physical size of the screen.
The QPlatformIntegration class is the entry for WindowSystem specific functionality.
float qt_mac_defaultDpi_x()
virtual QList< QScreen * > subScreens() const
Definition: qscreen_qws.h:283
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
HDC shared_dc()
bool qt_is_gui_used
int physicalWidth() const
Returns the physical width of the screen in millimeters.
Definition: qscreen_qws.h:290
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ qt_defaultDpiY()

Q_GUI_EXPORT int qt_defaultDpiY ( )

Definition at line 201 of file qfont.cpp.

Referenced by QTextEngine::calculateTabWidth(), QPaintBufferEngine::drawTextItem(), QPicture::exec(), QAlphaPaintEngine::flushAndInit(), QStaticTextPrivate::get(), QBlittablePixmapData::metric(), QRasterPixmapData::metric(), QPaintBuffer::metric(), QGLPixelBuffer::metric(), QPicture::metric(), QGLFramebufferObject::metric(), QGLPixmapData::metric(), QVGPixmapData::metric(), QMacQuartzPaintDevice::metric(), QFontDatabase::pointSizes(), QPainterReplayer::process(), QFakeDevice::QFakeDevice(), qt_defaultDpi(), qt_FcPatternToQFontDef(), QPainterReplayer::setupTransform(), QTextEngine::shapeText(), and QFontDatabase::smoothSizes().

202 {
203  if (!qt_is_gui_used)
204  return 75;
205 
206  int dpi;
207 #ifdef Q_WS_X11
208  dpi = QX11Info::appDpiY();
209 #elif defined(Q_WS_WIN)
210  dpi = GetDeviceCaps(shared_dc(),LOGPIXELSY);
211 #elif defined(Q_WS_MAC)
212  extern float qt_mac_defaultDpi_y(); //qpaintdevice_mac.cpp
213  dpi = qt_mac_defaultDpi_y();
214 #elif defined(Q_WS_QWS)
215  if (!qt_screen)
216  return 72;
217  QScreen *screen = qt_screen;
218  const QList<QScreen*> subScreens = qt_screen->subScreens();
219  if (!subScreens.isEmpty())
220  screen = subScreens.at(0);
221  dpi = qRound(screen->height() / (screen->physicalHeight() / qreal(25.4)));
222 #elif defined(Q_WS_QPA)
223  QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
224  if (pi) {
225  QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0);
226  const QSize screenSize = screen->geometry().size();
227  const QSize physicalSize = screen->physicalSize();
228  dpi = qRound(screenSize.height() / (physicalSize.height() / qreal(25.4)));
229  } else {
230  //PI has not been initialised, or it is being initialised. Give a default dpi
231  dpi = 100;
232  }
233 #elif defined(Q_OS_SYMBIAN)
234  dpi = S60->defaultDpiY;
235 #endif // Q_WS_X11
236 
237  return dpi;
238 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
int height() const
Returns the logical height of the framebuffer in pixels.
Definition: qscreen_qws.h:228
double qreal
Definition: qglobal.h:1193
int physicalHeight() const
Returns the physical height of the screen in millimeters.
Definition: qscreen_qws.h:291
The QPlatformScreen class provides an abstraction for visual displays.
float qt_mac_defaultDpi_y()
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
virtual QRect geometry() const =0
Reimplement in subclass to return the pixel geometry of the screen.
virtual QSize physicalSize() const
Reimplement this function in subclass to return the physical size of the screen.
The QPlatformIntegration class is the entry for WindowSystem specific functionality.
virtual QList< QScreen * > subScreens() const
Definition: qscreen_qws.h:283
int height() const
Returns the height.
Definition: qsize.h:129
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
HDC shared_dc()
bool qt_is_gui_used
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
static int appDpiY(int screen=-1)
Returns the vertical resolution of the given screen in terms of the number of dots per inch...