};
QtFontStyle(const Key &k)
- : key(k), bitmapScalable(false), smoothScalable(false),
+ : key(k), smoothScalable(false),
count(0), pixelSizes(0)
{
-#if defined(Q_WS_X11)
- weightName = setwidthName = 0;
-#endif // Q_WS_X11
}
~QtFontStyle() {
#ifdef Q_WS_X11
- delete [] weightName;
- delete [] setwidthName;
while (count) {
// bitfield count-- in while condition does not work correctly in mwccsym2
count--;
}
Key key;
- bool bitmapScalable : 1;
- bool smoothScalable : 1;
- signed int count : 30;
+ bool smoothScalable;
+ int count;
QtFontSize *pixelSizes;
QString styleName;
-#ifdef Q_WS_X11
- const char *weightName;
- const char *setwidthName;
-#endif // Q_WS_X11
-
QtFontSize *pixelSize(unsigned short size, bool = false);
};
}
}
- // 3. see if we have a bitmap scalable font
- if (!size && style->bitmapScalable && (styleStrategy & QFont::PreferMatch)) {
- size = style->pixelSize(0);
- if (size) {
- FM_DEBUG(" found bitmap scalable font (%d pixels)", pixelSize);
- px = pixelSize;
- }
- }
-
#ifdef Q_WS_X11
QtFontEncoding *encoding = 0;
#endif
- // 4. find closest size match
+ // 3. find closest size match
if (! size) {
unsigned int distance = ~0u;
for (int x = 0; x < style->count; ++x) {
continue;
}
- if (style->bitmapScalable && ! (styleStrategy & QFont::PreferQuality) &&
- (distance * 10 / pixelSize) >= 2) {
- // the closest size is not close enough, go ahead and
- // use a bitmap scaled font
- size = style->pixelSize(0);
- px = pixelSize;
- } else {
- px = size->pixelSize;
- }
+ px = size->pixelSize;
}
#ifdef Q_WS_X11
bool QFontDatabase::isBitmapScalable(const QString &family,
const QString &style) const
{
- QString familyName, foundryName;
- parseFontName(family, foundryName, familyName);
-
- QMutexLocker locker(fontDatabaseMutex());
-
- createDatabase();
-
- QtFontStyle::Key styleKey(style);
-
- QtFontFamily *f = d->family(familyName);
- if (!f) return false;
-
- for (int j = 0; j < f->count; j++) {
- QtFontFoundry *foundry = f->foundries[j];
- if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
- for (int k = 0; k < foundry->count; k++)
- if ((style.isEmpty() ||
- foundry->styles[k]->styleName == style ||
- foundry->styles[k]->key == styleKey)
- && foundry->styles[k]->bitmapScalable && !foundry->styles[k]->smoothScalable) {
- return true;
- }
- }
- }
return false;
}
FD_DEBUG("\t\t'%s'", foundry->name.toLatin1().constData());
for (int s = 0; s < foundry->count; s++) {
QtFontStyle *style = foundry->styles[s];
- FD_DEBUG("\t\t\tstyle: style=%d weight=%d (%s)\n"
- "\t\t\tstretch=%d (%s)",
- style->key.style, style->key.weight,
- style->weightName, style->key.stretch,
- style->setwidthName ? style->setwidthName : "nil");
+ FD_DEBUG("\t\t\tstyle: style=%d weight=%d stretch=%d",
+ style->key.style, style->key.weight, style->key.stretch);
if (style->smoothScalable)
FD_DEBUG("\t\t\t\tsmooth scalable");
- else if (style->bitmapScalable)
- FD_DEBUG("\t\t\t\tbitmap scalable");
if (style->pixelSizes) {
qDebug("\t\t\t\t%d pixel sizes", style->count);
for (int z = 0; z < style->count; ++z) {