diff options
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qfont.cpp | 12 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase.cpp | 9 | ||||
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 1 | ||||
-rw-r--r-- | src/gui/text/qfontengine_p.h | 4 |
4 files changed, 18 insertions, 8 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 54fcbac308..a0cbd052e4 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1014,8 +1014,8 @@ void QFont::setStyle(Style style) } /*! - Returns the weight of the font which is one of the enumerated - values from \l{QFont::Weight}. + Returns the weight of the font, using the same scale as the + \l{QFont::Weight} enumeration. \sa setWeight(), Weight, QFontInfo */ @@ -1028,8 +1028,8 @@ int QFont::weight() const \enum QFont::Weight Qt uses a weighting scale from 0 to 99 similar to, but not the - same as, the scales used in Windows or CSS. A weight of 0 is - ultralight, whilst 99 will be extremely black. + same as, the scales used in Windows or CSS. A weight of 0 will be + thin, whilst 99 will be extremely black. This enum contains the predefined font weights: @@ -1041,8 +1041,8 @@ int QFont::weight() const */ /*! - Sets the weight the font to \a weight, which should be a value - from the \l QFont::Weight enumeration. + Sets the weight of the font to \a weight, using the scale defined by + \l QFont::Weight enumeration. \sa weight(), QFontInfo */ diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index dcd0521362..decf2fe121 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -91,9 +91,10 @@ static int getFontWeight(const QString &weightString) // order of "expense". // // A simple string test is the cheapest, so let's do that first. - if (s == QLatin1String("medium") || - s == QLatin1String("normal")) + if (s == QLatin1String("normal")) return QFont::Normal; + if (s == QLatin1String("medium")) + return qt_mediumFontWeight; if (s == QLatin1String("bold")) return QFont::Bold; if (s == QLatin1String("demibold") || s == QLatin1String("demi bold")) @@ -102,6 +103,10 @@ static int getFontWeight(const QString &weightString) return QFont::Black; if (s == QLatin1String("light")) return QFont::Light; + if (s == QLatin1String("thin")) + return qt_thinFontWeight; + if (s == QLatin1String("extralight")) + return qt_extralightFontWeight; // Next up, let's see if contains() matches: slightly more expensive, but // still fast enough. diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 062d2e5301..b44eb43be5 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1062,6 +1062,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, (format == Format_A8 ? (info.width + 3) & ~3 : info.width * 4)); glyph_buffer_size = pitch * info.height; glyph_buffer = new uchar[glyph_buffer_size]; + memset(glyph_buffer, 0, glyph_buffer_size); if (slot->format == FT_GLYPH_FORMAT_OUTLINE) { FT_Bitmap bitmap; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 8c40189ed2..50b1bb9e9d 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -78,6 +78,10 @@ enum HB_Compat_Error { typedef void (*qt_destroy_func_t) (void *user_data); typedef bool (*qt_get_font_table_func_t) (void *user_data, uint tag, uchar *buffer, uint *length); +const QFont::Weight qt_mediumFontWeight = static_cast<QFont::Weight>(57); +const QFont::Weight qt_extralightFontWeight = static_cast<QFont::Weight>(12); +const QFont::Weight qt_thinFontWeight = static_cast<QFont::Weight>(0); + class Q_GUI_EXPORT QFontEngine { public: |