Qt 4.8
Public Functions | Public Variables | List of all members
QFontDef Struct Reference

#include <qfont_p.h>

Public Functions

bool exactMatch (const QFontDef &other) const
 
bool operator< (const QFontDef &other) const
 
bool operator== (const QFontDef &other) const
 
 QFontDef ()
 

Public Variables

QString addStyle
 
QString family
 
uint fixedPitch: 1
 
uint fixedPitchComputed: 1
 
uint hintingPreference: 2
 
uint ignorePitch: 1
 
qreal pixelSize
 
qreal pointSize
 
int reserved: 14
 
uint stretch: 12
 
uint style: 2
 
uint styleHint: 8
 
QString styleName
 
uint styleStrategy: 16
 
uint weight: 7
 

Detailed Description

Definition at line 69 of file qfont_p.h.

Constructors and Destructors

◆ QFontDef()

QFontDef::QFontDef ( )
inline

Definition at line 71 of file qfont_p.h.

72  : pointSize(-1.0), pixelSize(-1),
74  weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(100),
76 #ifdef Q_WS_MAC
77  ,fixedPitchComputed(false)
78 #endif
79  {
80  }
uint fixedPitch
Definition: qfont_p.h:96
uint fixedPitchComputed
Definition: qfont_p.h:102
qreal pointSize
Definition: qfont_p.h:89
uint weight
Definition: qfont_p.h:95
uint ignorePitch
Definition: qfont_p.h:100
qreal pixelSize
Definition: qfont_p.h:90
uint style
Definition: qfont_p.h:97
uint stretch
Definition: qfont_p.h:98
uint hintingPreference
Definition: qfont_p.h:101
uint styleHint
Definition: qfont_p.h:93
uint styleStrategy
Definition: qfont_p.h:92

Functions

◆ exactMatch()

bool QFontDef::exactMatch ( const QFontDef other) const

Definition at line 102 of file qfont.cpp.

Referenced by QFontInfo::exactMatch(), and QFont::exactMatch().

103 {
104  /*
105  QFontDef comparison is more complicated than just simple
106  per-member comparisons.
107 
108  When comparing point/pixel sizes, either point or pixelsize
109  could be -1. in This case we have to compare the non negative
110  size value.
111 
112  This test will fail if the point-sizes differ by 1/2 point or
113  more or they do not round to the same value. We have to do this
114  since our API still uses 'int' point-sizes in the API, but store
115  deci-point-sizes internally.
116 
117  To compare the family members, we need to parse the font names
118  and compare the family/foundry strings separately. This allows
119  us to compare e.g. "Helvetica" and "Helvetica [Adobe]" with
120  positive results.
121  */
122  if (pixelSize != -1 && other.pixelSize != -1) {
123  if (pixelSize != other.pixelSize)
124  return false;
125  } else if (pointSize != -1 && other.pointSize != -1) {
126  if (pointSize != other.pointSize)
127  return false;
128  } else {
129  return false;
130  }
131 
132  if (!ignorePitch && !other.ignorePitch && fixedPitch != other.fixedPitch)
133  return false;
134 
135  if (stretch != 0 && other.stretch != 0 && stretch != other.stretch)
136  return false;
137 
138  QString this_family, this_foundry, other_family, other_foundry;
139  QFontDatabase::parseFontName(family, this_foundry, this_family);
140  QFontDatabase::parseFontName(other.family, other_foundry, other_family);
141 
142  this_family = QFontDatabase::resolveFontFamilyAlias(this_family);
143  other_family = QFontDatabase::resolveFontFamilyAlias(other_family);
144 
145  return (styleHint == other.styleHint
146  && styleStrategy == other.styleStrategy
147  && weight == other.weight
148  && style == other.style
149  && this_family == other_family
150  && (styleName.isEmpty() || other.styleName.isEmpty() || styleName == other.styleName)
151  && (this_foundry.isEmpty()
152  || other_foundry.isEmpty()
153  || this_foundry == other_foundry)
154 #ifdef Q_WS_X11
155  && addStyle == other.addStyle
156 #endif // Q_WS_X11
157  );
158 }
uint fixedPitch
Definition: qfont_p.h:96
qreal pointSize
Definition: qfont_p.h:89
static void parseFontName(const QString &name, QString &foundry, QString &family)
The QString class provides a Unicode character string.
Definition: qstring.h:83
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
uint weight
Definition: qfont_p.h:95
static QString resolveFontFamilyAlias(const QString &family)
uint ignorePitch
Definition: qfont_p.h:100
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
QString addStyle
Definition: qfont_p.h:86
QString family
Definition: qfont_p.h:82
uint styleHint
Definition: qfont_p.h:93
uint styleStrategy
Definition: qfont_p.h:92

◆ operator<()

bool QFontDef::operator< ( const QFontDef other) const
inline

Definition at line 123 of file qfont_p.h.

124  {
125  if (pixelSize != other.pixelSize) return pixelSize < other.pixelSize;
126  if (weight != other.weight) return weight < other.weight;
127  if (style != other.style) return style < other.style;
128  if (stretch != other.stretch) return stretch < other.stretch;
129  if (styleHint != other.styleHint) return styleHint < other.styleHint;
130  if (styleStrategy != other.styleStrategy) return styleStrategy < other.styleStrategy;
131  if (family != other.family) return family < other.family;
132  if (!styleName.isEmpty() && !other.styleName.isEmpty() && styleName != other.styleName)
133  return styleName < other.styleName;
135 
136 #ifdef Q_WS_X11
137  if (addStyle != other.addStyle) return addStyle < other.addStyle;
138 #endif // Q_WS_X11
139 
140  if (ignorePitch != other.ignorePitch) return ignorePitch < other.ignorePitch;
141  if (fixedPitch != other.fixedPitch) return fixedPitch < other.fixedPitch;
142  return false;
143  }
uint fixedPitch
Definition: qfont_p.h:96
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
uint weight
Definition: qfont_p.h:95
uint ignorePitch
Definition: qfont_p.h:100
qreal pixelSize
Definition: qfont_p.h:90
uint style
Definition: qfont_p.h:97
QString styleName
Definition: qfont_p.h:83
if(void) toggleToolbarShown
uint stretch
Definition: qfont_p.h:98
QString addStyle
Definition: qfont_p.h:86
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

◆ operator==()

bool QFontDef::operator== ( const QFontDef other) const
inline

Definition at line 106 of file qfont_p.h.

107  {
108  return pixelSize == other.pixelSize
109  && weight == other.weight
110  && style == other.style
111  && stretch == other.stretch
112  && styleHint == other.styleHint
113  && styleStrategy == other.styleStrategy
114  && ignorePitch == other.ignorePitch && fixedPitch == other.fixedPitch
115  && family == other.family
116  && (styleName.isEmpty() || other.styleName.isEmpty() || styleName == other.styleName)
118 #ifdef Q_WS_X11
119  && addStyle == other.addStyle
120 #endif
121  ;
122  }
uint fixedPitch
Definition: qfont_p.h:96
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
uint weight
Definition: qfont_p.h:95
uint ignorePitch
Definition: qfont_p.h:100
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
QString addStyle
Definition: qfont_p.h:86
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

Properties

◆ addStyle

QString QFontDef::addStyle

◆ family

QString QFontDef::family

◆ fixedPitch

uint QFontDef::fixedPitch

◆ fixedPitchComputed

uint QFontDef::fixedPitchComputed

Definition at line 102 of file qfont_p.h.

Referenced by QFontInfo::fixedPitch().

◆ hintingPreference

uint QFontDef::hintingPreference

◆ ignorePitch

uint QFontDef::ignorePitch

◆ pixelSize

qreal QFontDef::pixelSize

Definition at line 90 of file qfont_p.h.

Referenced by QFontEngineDirectWrite::addGlyphsToPath(), QFontEngineDirectWrite::alphaMapBoundingBox(), QFontEngineDirectWrite::cloneWithSize(), QFontEngineWin::cloneWithSize(), QFontEngineX11FT::cloneWithSize(), QFontEngineFT::cloneWithSize(), QFreetypeFace::computeSize(), QFontEngineMac::draw(), QPainter::drawGlyphRun(), QGL2PaintEngineEx::drawStaticTextItem(), QGL2PaintEngineEx::drawTextItem(), QPdfEnginePrivate::drawTextItem(), QPdfBaseEnginePrivate::drawTextItem(), engineForPattern(), exactMatch(), findEncoding(), QFontDatabase::findFont(), QCoreTextFontDatabase::fontEngine(), QFontEngine::harfbuzzFont(), QFontEngineMac::imageForGlyph(), QFontEngineDirectWrite::imageForGlyph(), initFontInfo(), QFontEngine::lineThickness(), QFontDatabase::load(), QFontEngineMultiFT::loadEngine(), loadEngine(), loadSingleEngine(), loadWin(), QFontDatabase::loadXlfd(), QFontEngineQPF::lockFace(), operator<(), QFont::operator<(), operator==(), QFontInfo::pixelSize(), pixelSize(), QRawFont::pixelSize(), QFont::pixelSize(), QRawFontPrivate::platformLoadFromData(), pointSize(), QFont::QFont(), QFontEngineDirectWrite::QFontEngineDirectWrite(), QFontEngineMacMulti::QFontEngineMacMulti(), QFontEngineQPF::QFontEngineQPF(), qt_addPatternProps(), qt_FcPatternToQFontDef(), qt_fillFontDef(), qt_mac_pixelsize(), qt_mac_pointsize(), registerFont(), releaseFontData(), QFontPrivate::resolve(), resolveGdi32(), QFont::setPixelSize(), QFont::setPointSize(), QFont::setPointSizeF(), QRasterPaintEngine::supportsTransformations(), and QFontSubset::toTruetype().

◆ pointSize

qreal QFontDef::pointSize

◆ reserved

int QFontDef::reserved

Definition at line 103 of file qfont_p.h.

◆ stretch

uint QFontDef::stretch

◆ style

uint QFontDef::style

◆ styleHint

uint QFontDef::styleHint

◆ styleName

QString QFontDef::styleName

◆ styleStrategy

uint QFontDef::styleStrategy

◆ weight

uint QFontDef::weight

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