OSDN Git Service

remove unused QtFontStyle members
authorIvailo Monev <xakepa10@laimg.moc>
Sat, 27 Jun 2020 14:59:15 +0000 (14:59 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Sat, 27 Jun 2020 14:59:15 +0000 (14:59 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/gui/text/qfontdatabase.cpp
src/gui/text/qfontdatabase_x11_p.h

index 947f8af..2b284f1 100644 (file)
@@ -189,18 +189,13 @@ struct QtFontStyle
     };
 
     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--;
@@ -211,17 +206,11 @@ struct QtFontStyle
     }
 
     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);
 };
 
@@ -673,20 +662,11 @@ unsigned int bestFoundry(unsigned int score, int styleStrategy,
             }
         }
 
-        // 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) {
@@ -721,15 +701,7 @@ unsigned int bestFoundry(unsigned int score, int styleStrategy,
                 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
@@ -1083,30 +1055,6 @@ bool QFontDatabase::isFixedPitch(const QString &family,
 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;
 }
 
index d23bf67..c59b54a 100644 (file)
@@ -784,15 +784,10 @@ static void initializeFontDb()
             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) {