Qt 4.8
Public Functions | Static Public Functions | Public Variables | Static Public Variables | Private Functions | List of all members
QFontPrivate Class Reference

#include <qfont_p.h>

Public Functions

void alterCharForCapitalization (QChar &c) const
 
QFontEngineengineForScript (int script) const
 
 QFontPrivate ()
 
 QFontPrivate (const QFontPrivate &other)
 
void resolve (uint mask, const QFontPrivate *other)
 
QFont smallCapsFont () const
 
QFontPrivatesmallCapsFontPrivate () const
 
 ~QFontPrivate ()
 

Static Public Functions

static QFontPrivateget (const QFont &font)
 

Public Variables

uint capital: 3
 
int dpi
 
QFontEngineDataengineData
 
HDC hdc
 
uint kerning: 1
 
QFixed letterSpacing
 
bool letterSpacingIsAbsolute: 1
 
uint overline: 1
 
uint rawMode: 1
 
QAtomicInt ref
 
QFontDef request
 
QFontPrivatescFont
 
int screen
 
uint strikeOut: 1
 
uint underline: 1
 
QFixed wordSpacing
 

Static Public Variables

static int defaultEncodingID = -1
 

Private Functions

QFontPrivateoperator= (const QFontPrivate &)
 

Detailed Description

Definition at line 163 of file qfont_p.h.

Constructors and Destructors

◆ QFontPrivate() [1/2]

QFontPrivate::QFontPrivate ( )

Definition at line 245 of file qfont.cpp.

246  : engineData(0), dpi(qt_defaultDpi()), screen(0),
247  rawMode(false), underline(false), overline(false), strikeOut(false), kerning(true),
248  capital(0), letterSpacingIsAbsolute(false), scFont(0)
249 {
250 #ifdef Q_WS_X11
251  if (QX11Info::display())
253  else
254  screen = 0;
255 #endif
256 #ifdef Q_WS_WIN
257  hdc = 0;
258 #endif
259 }
bool letterSpacingIsAbsolute
Definition: qfont_p.h:193
static int appScreen()
Returns the number of the screen where the application is being displayed.
uint rawMode
Definition: qfont_p.h:187
uint overline
Definition: qfont_p.h:189
uint underline
Definition: qfont_p.h:188
uint capital
Definition: qfont_p.h:192
Q_GUI_EXPORT int qt_defaultDpi()
Definition: qfont.cpp:240
int screen
Definition: qfont_p.h:181
QFontPrivate * scFont
Definition: qfont_p.h:198
uint kerning
Definition: qfont_p.h:191
QFontEngineData * engineData
Definition: qfont_p.h:179
static Display * display()
Returns the default display for the application.
uint strikeOut
Definition: qfont_p.h:190

◆ QFontPrivate() [2/2]

QFontPrivate::QFontPrivate ( const QFontPrivate other)

Definition at line 261 of file qfont.cpp.

262  : request(other.request), engineData(0), dpi(other.dpi), screen(other.screen),
263  rawMode(other.rawMode), underline(other.underline), overline(other.overline),
264  strikeOut(other.strikeOut), kerning(other.kerning),
267  scFont(other.scFont)
268 {
269 #ifdef Q_WS_WIN
270  hdc = other.hdc;
271 #endif
272  if (scFont && scFont != this)
273  scFont->ref.ref();
274 }
bool letterSpacingIsAbsolute
Definition: qfont_p.h:193
bool ref()
Atomically increments the value of this QAtomicInt.
QFixed wordSpacing
Definition: qfont_p.h:196
uint rawMode
Definition: qfont_p.h:187
uint overline
Definition: qfont_p.h:189
uint underline
Definition: qfont_p.h:188
QFontDef request
Definition: qfont_p.h:178
uint capital
Definition: qfont_p.h:192
QFixed letterSpacing
Definition: qfont_p.h:195
int screen
Definition: qfont_p.h:181
QAtomicInt ref
Definition: qfont_p.h:177
QFontPrivate * scFont
Definition: qfont_p.h:198
uint kerning
Definition: qfont_p.h:191
QFontEngineData * engineData
Definition: qfont_p.h:179
uint strikeOut
Definition: qfont_p.h:190

◆ ~QFontPrivate()

QFontPrivate::~QFontPrivate ( )

Definition at line 276 of file qfont.cpp.

277 {
278  if (engineData)
279  engineData->ref.deref();
280  engineData = 0;
281  if (scFont && scFont != this)
282  scFont->ref.deref();
283  scFont = 0;
284 }
bool deref()
Atomically decrements the value of this QAtomicInt.
QAtomicInt ref
Definition: qfont_p.h:152
QAtomicInt ref
Definition: qfont_p.h:177
QFontPrivate * scFont
Definition: qfont_p.h:198
QFontEngineData * engineData
Definition: qfont_p.h:179

Functions

◆ alterCharForCapitalization()

void QFontPrivate::alterCharForCapitalization ( QChar c) const

Definition at line 309 of file qfont.cpp.

Referenced by QFontMetrics::boundingRect(), QFontMetricsF::boundingRect(), QFontMetrics::charWidth(), QFontMetrics::leftBearing(), QFontMetricsF::leftBearing(), QFontMetrics::rightBearing(), QFontMetricsF::rightBearing(), QFontMetrics::width(), and QFontMetricsF::width().

309  {
310  switch (capital) {
311  case QFont::AllUppercase:
312  case QFont::SmallCaps:
313  c = c.toUpper();
314  break;
315  case QFont::AllLowercase:
316  c = c.toLower();
317  break;
318  case QFont::MixedCase:
319  break;
320  }
321 }
uint capital
Definition: qfont_p.h:192
QChar toUpper() const
Returns the uppercase equivalent if the character is lowercase or titlecase; otherwise returns the ch...
Definition: qchar.cpp:1287
QChar toLower() const
Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the ch...
Definition: qchar.cpp:1239

◆ engineForScript()

QFontEngine * QFontPrivate::engineForScript ( int  script) const

Definition at line 294 of file qfont.cpp.

Referenced by QPainterPath::addText(), QFontMetrics::ascent(), QFontMetricsF::ascent(), QFontMetrics::averageCharWidth(), QFontMetricsF::averageCharWidth(), QFontMetrics::boundingRect(), QFontMetricsF::boundingRect(), QFontMetrics::charWidth(), QFontMetrics::descent(), QFontMetricsF::descent(), QTextLine::draw(), QTextEngine::elidedText(), QFontInfo::exactMatch(), QFont::exactMatch(), QFontInfo::family(), QFontInfo::fixedPitch(), QTextEngine::fontEngine(), QFont::freetypeFace(), QRawFont::fromFont(), QTextLine::glyphs(), QFont::handle(), QFontMetrics::height(), QFontMetricsF::height(), QFontMetrics::inFont(), QFontMetricsF::inFont(), QFontMetrics::inFontUcs4(), QFontMetricsF::inFontUcs4(), QFontInfo::italic(), QFontMetrics::leading(), QFontMetricsF::leading(), QFontMetrics::leftBearing(), QFontMetricsF::leftBearing(), QFontMetrics::lineSpacing(), QFontMetricsF::lineSpacing(), QFontMetrics::lineWidth(), QFontMetricsF::lineWidth(), QFont::macFontID(), QFontMetrics::maxWidth(), QFontMetricsF::maxWidth(), QFontMetrics::minLeftBearing(), QFontMetricsF::minLeftBearing(), QFontMetrics::minRightBearing(), QFontMetricsF::minRightBearing(), QFontInfo::pixelSize(), QFontInfo::pointSize(), pointSize(), QFontInfo::pointSizeF(), QPainterReplayer::process(), qgl_use_font(), qt_x11_set_fallback_font_family(), QTextItemInt::QTextItemInt(), QFontMetrics::rightBearing(), QFontMetricsF::rightBearing(), QScriptLine::setDefaultHeight(), QFontDialogPrivate::setFont(), QFontInfo::style(), QFontInfo::styleHint(), QFontInfo::styleName(), QFontMetrics::underlinePos(), QFontMetricsF::underlinePos(), QFontInfo::weight(), QFontMetrics::width(), QFontMetricsF::width(), QFontMetrics::xHeight(), and QFontMetricsF::xHeight().

295 {
300  // throw out engineData that came from a different thread
301  engineData->ref.deref();
302  engineData = 0;
303  }
307 }
#define QT_FONT_ENGINE_FROM_DATA(data, script)
Definition: qfont.cpp:291
QFontCache * fontCache
Definition: qfont_p.h:153
static void load(const QFontPrivate *d, int script)
Loads a QFontEngine for the specified script that matches the QFontDef request member variable...
static QFontCache * instance()
Definition: qfont.cpp:2919
bool deref()
Atomically decrements the value of this QAtomicInt.
QAtomicInt ref
Definition: qfont_p.h:152
Q_CORE_EXPORT int QT_FASTCALL script(uint ucs4)
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101
QMutex * qt_fontdatabase_mutex()
QFontEngineData * engineData
Definition: qfont_p.h:179

◆ get()

static QFontPrivate* QFontPrivate::get ( const QFont font)
inlinestatic

Definition at line 202 of file qfont_p.h.

Referenced by QRawFont::fromFont(), and QPainterReplayer::process().

203  {
204  return font.d.data();
205  }
T * data() const
Returns a pointer to the shared data object.
Definition: qshareddata.h:145
QExplicitlySharedDataPointer< QFontPrivate > d
Definition: qfont.h:343

◆ operator=()

QFontPrivate& QFontPrivate::operator= ( const QFontPrivate )
inlineprivate

Definition at line 209 of file qfont_p.h.

209 { return *this; }

◆ resolve()

void QFontPrivate::resolve ( uint  mask,
const QFontPrivate other 
)

Definition at line 340 of file qfont.cpp.

Referenced by QFont::resolve().

341 {
342  Q_ASSERT(other != 0);
343 
344  dpi = other->dpi;
345 
346  if ((mask & QFont::AllPropertiesResolved) == QFont::AllPropertiesResolved) return;
347 
348  // assign the unset-bits with the set-bits of the other font def
349  if (! (mask & QFont::FamilyResolved))
350  request.family = other->request.family;
351 
352  if (! (mask & QFont::StyleNameResolved))
354 
355  if (! (mask & QFont::SizeResolved)) {
358  }
359 
360  if (! (mask & QFont::StyleHintResolved))
362 
363  if (! (mask & QFont::StyleStrategyResolved))
365 
366  if (! (mask & QFont::WeightResolved))
367  request.weight = other->request.weight;
368 
369  if (! (mask & QFont::StyleResolved))
370  request.style = other->request.style;
371 
372  if (! (mask & QFont::FixedPitchResolved))
374 
375  if (! (mask & QFont::StretchResolved))
376  request.stretch = other->request.stretch;
377 
378  if (! (mask & QFont::HintingPreferenceResolved))
380 
381  if (! (mask & QFont::UnderlineResolved))
382  underline = other->underline;
383 
384  if (! (mask & QFont::OverlineResolved))
385  overline = other->overline;
386 
387  if (! (mask & QFont::StrikeOutResolved))
388  strikeOut = other->strikeOut;
389 
390  if (! (mask & QFont::KerningResolved))
391  kerning = other->kerning;
392 
393  if (! (mask & QFont::LetterSpacingResolved)) {
394  letterSpacing = other->letterSpacing;
396  }
397  if (! (mask & QFont::WordSpacingResolved))
398  wordSpacing = other->wordSpacing;
399  if (! (mask & QFont::CapitalizationResolved))
400  capital = other->capital;
401 }
uint fixedPitch
Definition: qfont_p.h:96
bool letterSpacingIsAbsolute
Definition: qfont_p.h:193
qreal pointSize
Definition: qfont_p.h:89
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QFixed wordSpacing
Definition: qfont_p.h:196
uint overline
Definition: qfont_p.h:189
uint underline
Definition: qfont_p.h:188
QFontDef request
Definition: qfont_p.h:178
uint capital
Definition: qfont_p.h:192
uint weight
Definition: qfont_p.h:95
QFixed letterSpacing
Definition: qfont_p.h:195
qreal pixelSize
Definition: qfont_p.h:90
uint style
Definition: qfont_p.h:97
QString styleName
Definition: qfont_p.h:83
uint stretch
Definition: qfont_p.h:98
uint kerning
Definition: qfont_p.h:191
QString family
Definition: qfont_p.h:82
uint hintingPreference
Definition: qfont_p.h:101
uint styleHint
Definition: qfont_p.h:93
uint styleStrategy
Definition: qfont_p.h:92
uint strikeOut
Definition: qfont_p.h:190

◆ smallCapsFont()

QFont QFontPrivate::smallCapsFont ( ) const
inline

Definition at line 199 of file qfont_p.h.

Referenced by QTextEngine::font().

199 { return QFont(smallCapsFontPrivate()); }
QFontPrivate * smallCapsFontPrivate() const
Definition: qfont.cpp:323
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64

◆ smallCapsFontPrivate()

QFontPrivate * QFontPrivate::smallCapsFontPrivate ( ) const

Definition at line 323 of file qfont.cpp.

Referenced by QFontMetrics::boundingRect(), QFontMetricsF::boundingRect(), QFontMetrics::charWidth(), QTextEngine::fontEngine(), QFontMetrics::leftBearing(), QFontMetricsF::leftBearing(), QFontMetrics::rightBearing(), QFontMetricsF::rightBearing(), QFontMetrics::width(), QFontMetricsF::width(), QFontMetrics::xHeight(), and QFontMetricsF::xHeight().

324 {
325  if (scFont)
326  return scFont;
327  QFont font(const_cast<QFontPrivate *>(this));
328  qreal pointSize = font.pointSizeF();
329  if (pointSize > 0)
330  font.setPointSizeF(pointSize * .7);
331  else
332  font.setPixelSize((font.pixelSize() * 7 + 5) / 10);
333  scFont = font.d.data();
334  if (scFont != this)
335  scFont->ref.ref();
336  return scFont;
337 }
double qreal
Definition: qglobal.h:1193
bool ref()
Atomically increments the value of this QAtomicInt.
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
QAtomicInt ref
Definition: qfont_p.h:177
QFontPrivate * scFont
Definition: qfont_p.h:198
static float pointSize(const QFontDef &fd, int dpi)
Definition: qfont_win.cpp:90

Properties

◆ capital

uint QFontPrivate::capital

◆ defaultEncodingID

int QFontPrivate::defaultEncodingID = -1
static

Definition at line 167 of file qfont_p.h.

Referenced by findEncoding(), and qt_x11_set_fallback_font_family().

◆ dpi

int QFontPrivate::dpi

◆ engineData

QFontEngineData* QFontPrivate::engineData
mutable

◆ hdc

HDC QFontPrivate::hdc

Definition at line 184 of file qfont_p.h.

Referenced by loadWin(), QFont::QFont(), and QFontPrivate().

◆ kerning

uint QFontPrivate::kerning

◆ letterSpacing

QFixed QFontPrivate::letterSpacing

◆ letterSpacingIsAbsolute

bool QFontPrivate::letterSpacingIsAbsolute

◆ overline

uint QFontPrivate::overline

◆ rawMode

uint QFontPrivate::rawMode

◆ ref

QAtomicInt QFontPrivate::ref

Definition at line 177 of file qfont_p.h.

Referenced by QFont::detach(), QFontPrivate(), smallCapsFontPrivate(), and ~QFontPrivate().

◆ request

QFontDef QFontPrivate::request

◆ scFont

QFontPrivate* QFontPrivate::scFont
mutable

Definition at line 198 of file qfont_p.h.

Referenced by QFont::detach(), QFontPrivate(), smallCapsFontPrivate(), and ~QFontPrivate().

◆ screen

int QFontPrivate::screen

◆ strikeOut

uint QFontPrivate::strikeOut

◆ underline

uint QFontPrivate::underline

◆ wordSpacing

QFixed QFontPrivate::wordSpacing

The documentation for this class was generated from the following files: