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

Public Functions

 QtFontFoundry (const QString &n)
 
QtFontStylestyle (const QtFontStyle::Key &, const QString &=QString(), bool=false)
 
 ~QtFontFoundry ()
 

Public Variables

int count
 
QString name
 
QtFontStyle ** styles
 

Detailed Description

Definition at line 344 of file qfontdatabase.cpp.

Constructors and Destructors

◆ QtFontFoundry()

QtFontFoundry::QtFontFoundry ( const QString n)
inline

Definition at line 346 of file qfontdatabase.cpp.

346 : name(n), count(0), styles(0) {}
QtFontStyle ** styles

◆ ~QtFontFoundry()

QtFontFoundry::~QtFontFoundry ( )
inline

Definition at line 347 of file qfontdatabase.cpp.

347  {
348  while (count--)
349  delete styles[count];
350  free(styles);
351  }
QtFontStyle ** styles

Functions

◆ style()

QtFontStyle * QtFontFoundry::style ( const QtFontStyle::Key key,
const QString styleName = QString(),
bool  create = false 
)

Definition at line 360 of file qfontdatabase.cpp.

Referenced by QFontDatabasePrivate::addFont(), addFontToDatabase(), QFontDatabase::bold(), QFontDatabase::font(), initializeDb(), QFontDatabase::italic(), loadFontConfig(), loadXlfds(), QFontDatabase::pointSizes(), qt_registerFont(), QFontDatabase::smoothSizes(), QFontDatabase::styles(), and QFontDatabase::weight().

361 {
362  int pos = 0;
363  for (; pos < count; pos++) {
364  bool hasStyleName = !styleName.isEmpty(); // search styleName first if available
365  if (hasStyleName && !styles[pos]->styleName.isEmpty()) {
366  if (styles[pos]->styleName == styleName)
367  return styles[pos];
368  } else {
369  if (styles[pos]->key == key)
370  return styles[pos];
371  }
372  }
373  if (!create)
374  return 0;
375 
376  // qDebug("adding key (weight=%d, style=%d, stretch=%d) at %d", key.weight, key.style, key.stretch, pos);
377  if (!(count % 8)) {
378  QtFontStyle **newStyles = (QtFontStyle **)
379  realloc(styles, (((count+8) >> 3) << 3) * sizeof(QtFontStyle *));
380  Q_CHECK_PTR(newStyles);
381  styles = newStyles;
382  }
383 
384  QtFontStyle *style = new QtFontStyle(key);
385  style->styleName = styleName;
386  styles[pos] = style;
387  count++;
388  return styles[pos];
389 }
QtFontStyle * style(const QtFontStyle::Key &, const QString &=QString(), bool=false)
QtFontStyle ** styles
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
#define Q_CHECK_PTR(p)
Definition: qglobal.h:1853
QString styleName

Properties

◆ count

int QtFontFoundry::count

◆ name

QString QtFontFoundry::name

◆ styles

QtFontStyle** QtFontFoundry::styles

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