summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/text/qfont.cpp140
-rw-r--r--src/gui/text/qfont.h18
-rw-r--r--src/gui/text/qfontinfo.h3
-rw-r--r--src/gui/text/qfontmetrics.cpp217
-rw-r--r--src/gui/text/qfontmetrics.h42
-rw-r--r--tests/auto/gui/text/qfont/tst_qfont.cpp17
6 files changed, 1 insertions, 436 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index cb87cfa09b..5972a80d51 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -1634,31 +1634,6 @@ QFont::Capitalization QFont::capitalization() const
return static_cast<QFont::Capitalization> (d->capital);
}
-#if QT_DEPRECATED_SINCE(5, 5)
-/*!
- \fn void QFont::setRawMode(bool enable)
- \deprecated
-
- If \a enable is true, turns raw mode on; otherwise turns raw mode
- off. This function only has an effect under X11.
-
- If raw mode is enabled, Qt will search for an X font with a
- complete font name matching the family name, ignoring all other
- values set for the QFont. If the font name matches several fonts,
- Qt will use the first font returned by X. QFontInfo \e cannot be
- used to fetch information about a QFont using raw mode (it will
- return the values set in the QFont for all parameters, including
- the family name).
-
- \warning Enabling raw mode has no effect since Qt 5.0.
-
- \sa rawMode()
-*/
-void QFont::setRawMode(bool)
-{
-}
-#endif
-
/*!
Returns \c true if a window system font exactly matching the settings
of this font is available.
@@ -1770,21 +1745,6 @@ bool QFont::isCopyOf(const QFont & f) const
return d == f.d;
}
-#if QT_DEPRECATED_SINCE(5, 5)
-/*!
- \deprecated
-
- Returns \c true if raw mode is used for font name matching; otherwise
- returns \c false.
-
- \sa setRawMode()
-*/
-bool QFont::rawMode() const
-{
- return false;
-}
-#endif
-
/*!
Returns a new QFont that has attributes copied from \a other that
have not been previously set on this font.
@@ -1920,14 +1880,6 @@ void QFont::removeSubstitutions(const QString &familyName)
}
/*!
- \fn void QFont::removeSubstitution(const QString &familyName)
-
- \obsolete
-
- This function is deprecated. Use removeSubstitutions() instead.
-*/
-
-/*!
Returns a sorted list of substituted family names.
\sa insertSubstitution(), removeSubstitution(), substitute()
@@ -2010,45 +1962,6 @@ static void set_extended_font_bits(quint8 bits, QFontPrivate *f)
}
#endif
-#if QT_DEPRECATED_SINCE(5, 3)
-/*!
- \fn QString QFont::rawName() const
- \deprecated
-
- Returns the name of the font within the underlying window system.
-
- On X11, this function will return an empty string.
-
- Using the return value of this function is usually \e not \e
- portable.
-
- \sa setRawName()
-*/
-QString QFont::rawName() const
-{
- return QLatin1String("unknown");
-}
-
-/*!
- \fn void QFont::setRawName(const QString &name)
- \deprecated
-
- Sets a font by its system specific name.
-
- A font set with setRawName() is still a full-featured QFont. It can
- be queried (for example with italic()) or modified (for example with
- setItalic()) and is therefore also suitable for rendering rich text.
-
- If Qt's internal font database cannot resolve the raw name, the
- font becomes a raw font with \a name as its family.
-
- \sa rawName(), setFamily()
-*/
-void QFont::setRawName(const QString &)
-{
-}
-#endif
-
/*!
Returns the font's key, a textual representation of a font. It is
typically used as the key for a cache or dictionary of fonts.
@@ -2180,22 +2093,6 @@ void QFont::cacheStatistics()
{
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \fn QString QFont::lastResortFamily() const
-
- \obsolete
-
- This function is deprecated and is not in use by the font
- selection algorithm in Qt 5. It always returns "helvetica".
-
- \sa lastResortFont()
-*/
-QString QFont::lastResortFamily() const
-{
- return QStringLiteral("helvetica");
-}
-#endif
extern QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style,
QFont::StyleHint styleHint, QChar::Script script);
@@ -2217,24 +2114,6 @@ QString QFont::defaultFamily() const
return QString();
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \fn QString QFont::lastResortFont() const
-
- \obsolete
-
- Deprecated function. Since Qt 5.0, this is not used by the font selection algorithm. For
- compatibility it remains in the API, but will always return the same value as lastResortFamily().
-*/
-QString QFont::lastResortFont() const
-{
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- return lastResortFamily();
-QT_WARNING_POP
-}
-#endif
-
/*!
\since 5.13
@@ -2740,25 +2619,6 @@ QFont::StyleHint QFontInfo::styleHint() const
return (QFont::StyleHint) engine->fontDef.styleHint;
}
-#if QT_DEPRECATED_SINCE(5, 5)
-/*!
- \deprecated
-
- Returns \c true if the font is a raw mode font; otherwise returns
- false.
-
- If it is a raw mode font, all other functions in QFontInfo will
- return the same values set in the QFont, regardless of the font
- actually used.
-
- \sa QFont::rawMode()
-*/
-bool QFontInfo::rawMode() const
-{
- return false;
-}
-#endif
-
/*!
Returns \c true if the matched window system font is exactly the same
as the one specified by the font; otherwise returns \c false.
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 6317613b67..06a71e93a9 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -249,11 +249,6 @@ public:
void setHintingPreference(HintingPreference hintingPreference);
HintingPreference hintingPreference() const;
-#if QT_DEPRECATED_SINCE(5, 5)
- bool rawMode() const;
- void setRawMode(bool);
-#endif
-
// dupicated from QFontInfo
bool exactMatch() const;
@@ -266,12 +261,6 @@ public:
inline QFont &operator=(QFont &&other) noexcept
{ qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); return *this; }
-#if QT_DEPRECATED_SINCE(5, 3)
- // needed for X11
- QT_DEPRECATED void setRawName(const QString &);
- QT_DEPRECATED QString rawName() const;
-#endif
-
QString key() const;
QString toString() const;
@@ -283,18 +272,11 @@ public:
static void insertSubstitution(const QString&, const QString &);
static void insertSubstitutions(const QString&, const QStringList &);
static void removeSubstitutions(const QString &);
-#if QT_DEPRECATED_SINCE(5, 0)
- static QT_DEPRECATED void removeSubstitution(const QString &family) { removeSubstitutions(family); }
-#endif
static void initialize();
static void cleanup();
static void cacheStatistics();
QString defaultFamily() const;
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED QString lastResortFamily() const;
- QT_DEPRECATED QString lastResortFont() const;
-#endif
QFont resolve(const QFont &) const;
inline uint resolve() const { return resolve_mask; }
diff --git a/src/gui/text/qfontinfo.h b/src/gui/text/qfontinfo.h
index f5e05775b4..dfdac221cb 100644
--- a/src/gui/text/qfontinfo.h
+++ b/src/gui/text/qfontinfo.h
@@ -72,9 +72,6 @@ public:
bool strikeOut() const;
bool fixedPitch() const;
QFont::StyleHint styleHint() const;
-#if QT_DEPRECATED_SINCE(5, 5)
- bool rawMode() const;
-#endif
bool exactMatch() const;
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 73fcc4bc78..8f3aa62842 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -170,19 +170,7 @@ QFontMetrics::QFontMetrics(const QFont &font)
passed in the constructor at the time it is created, and is not
updated if the font's attributes are changed later.
*/
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-/*!
- \fn QFontMetrics::QFontMetrics(const QFont &font, QPaintDevice *paintdevice)
- \obsolete
- Identical to QFontMetrics::QFontMetrics(const QFont &font, const QPaintDevice *paintdevice)
-*/
-
-
-QFontMetrics::QFontMetrics(const QFont &font, QPaintDevice *paintdevice)
-#else
QFontMetrics::QFontMetrics(const QFont &font, const QPaintDevice *paintdevice)
-#endif
{
const int dpi = paintdevice ? paintdevice->logicalDpiY() : qt_defaultDpi();
if (font.d->dpi != dpi) {
@@ -522,93 +510,6 @@ int QFontMetrics::rightBearing(QChar ch) const
return qRound(rb);
}
-#if QT_DEPRECATED_SINCE(5, 11)
-/*!
- Returns the width in pixels of the first \a len characters of \a
- text. If \a len is negative (the default), the entire string is
- used.
-
- Note that this value is \e not equal to boundingRect().width();
- boundingRect() returns a rectangle describing the pixels this
- string will cover whereas width() returns the distance to where
- the next string should be drawn.
-
- \deprecated in Qt 5.11. Use horizontalAdvance() instead.
-
- \sa boundingRect(), horizontalAdvance()
-*/
-int QFontMetrics::width(const QString &text, int len) const
-{
- return horizontalAdvance(text, len);
-}
-
-/*!
- \internal
-*/
-int QFontMetrics::width(const QString &text, int len, int flags) const
-{
-#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- if (flags & Qt::TextBypassShaping) {
- int pos = text.indexOf(QLatin1Char('\x9c'));
- if (pos != -1) {
- len = (len < 0) ? pos : qMin(pos, len);
- } else if (len < 0) {
- len = text.length();
- }
- if (len == 0)
- return 0;
-
- // Skip complex shaping, only use advances
- int numGlyphs = len;
- QVarLengthGlyphLayoutArray glyphs(numGlyphs);
- QFontEngine *engine = d->engineForScript(QChar::Script_Common);
- if (!engine->stringToCMap(text.data(), len, &glyphs, &numGlyphs, { }))
- Q_UNREACHABLE();
-
- QFixed width;
- for (int i = 0; i < numGlyphs; ++i)
- width += glyphs.advances[i];
- return qRound(width);
- }
-#else
- Q_UNUSED(flags)
-#endif
-
- return horizontalAdvance(text, len);
-}
-
-/*!
- \overload
-
- \image bearings.png Bearings
-
- Returns the logical width of character \a ch in pixels. This is a
- distance appropriate for drawing a subsequent character after \a
- ch.
-
- Some of the metrics are described in the image to the right. The
- central dark rectangles cover the logical width() of each
- character. The outer pale rectangles cover the leftBearing() and
- rightBearing() of each character. Notice that the bearings of "f"
- in this particular font are both negative, while the bearings of
- "o" are both positive.
-
- \deprecated in Qt 5.11. Use horizontalAdvance() instead.
-
- \warning This function will produce incorrect results for Arabic
- characters or non-spacing marks in the middle of a string, as the
- glyph shaping and positioning of marks that happens when
- processing strings cannot be taken into account. When implementing
- an interactive text control, use QTextLayout instead.
-
- \sa boundingRect(), horizontalAdvance()
-*/
-int QFontMetrics::width(QChar ch) const
-{
- return horizontalAdvance(ch);
-}
-#endif // QT_DEPRECATED_SINCE(5, 11)
-
/*!
Returns the horizontal advance in pixels of the first \a len characters of \a
text. If \a len is negative (the default), the entire string is
@@ -689,61 +590,6 @@ int QFontMetrics::horizontalAdvance(QChar ch) const
return qRound(advance);
}
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
-/*! \obsolete
-
- Returns the width of the character at position \a pos in the
- string \a text.
-
- The whole string is needed, as the glyph drawn may change
- depending on the context (the letter before and after the current
- one) for some languages (e.g. Arabic).
-
- This function also takes non spacing marks and ligatures into
- account.
-*/
-int QFontMetrics::charWidth(const QString &text, int pos) const
-{
- int width = 0;
- if (pos < 0 || pos > (int)text.length())
- return width;
-
- QChar ch = text.at(pos);
- const int script = ch.script();
- if (script != QChar::Script_Common) {
- // complex script shaping. Have to do some hard work
- int from = qMax(0, pos - 8);
- int to = qMin(text.length(), pos + 8);
- QString cstr = QString::fromRawData(text.unicode() + from, to - from);
- QStackTextEngine layout(cstr, QFont(d.data()));
- layout.ignoreBidi = true;
- layout.itemize();
- width = qRound(layout.width(pos-from, 1));
- } else if (ch.category() != QChar::Mark_NonSpacing) {
- QFontEngine *engine;
- if (d->capital == QFont::SmallCaps && ch.isLower())
- engine = d->smallCapsFontPrivate()->engineForScript(script);
- else
- engine = d->engineForScript(script);
- Q_ASSERT(engine != nullptr);
-
- d->alterCharForCapitalization(ch);
-
- glyph_t glyph = engine->glyphIndex(ch.unicode());
- QFixed advance;
-
- QGlyphLayout glyphs;
- glyphs.numGlyphs = 1;
- glyphs.glyphs = &glyph;
- glyphs.advances = &advance;
- engine->recalcAdvances(&glyphs, { });
-
- width = qRound(advance);
- }
- return width;
-}
-#endif
-
/*!
Returns the bounding rectangle of the characters in the string
specified by \a text. The bounding rectangle always covers at least
@@ -1163,20 +1009,7 @@ QFontMetricsF::QFontMetricsF(const QFont &font)
passed in the constructor at the time it is created, and is not
updated if the font's attributes are changed later.
*/
-
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-/*!
- \fn QFontMetricsF::QFontMetricsF(const QFont &font, QPaintDevice *paintdevice)
- \obsolete
- Identical to QFontMetricsF::QFontMetricsF(const QFont &font, const QPaintDevice *paintdevice)
-*/
-
-
-QFontMetricsF::QFontMetricsF(const QFont &font, QPaintDevice *paintdevice)
-#else
QFontMetricsF::QFontMetricsF(const QFont &font, const QPaintDevice *paintdevice)
-#endif
{
int dpi = paintdevice ? paintdevice->logicalDpiY() : qt_defaultDpi();
if (font.d->dpi != dpi) {
@@ -1496,56 +1329,6 @@ qreal QFontMetricsF::rightBearing(QChar ch) const
}
-#if QT_DEPRECATED_SINCE(5, 11)
-/*!
- Returns the width in pixels of the characters in the given \a text.
-
- Note that this value is \e not equal to the width returned by
- boundingRect().width() because boundingRect() returns a rectangle
- describing the pixels this string will cover whereas width()
- returns the distance to where the next string should be drawn.
-
- \deprecated in Qt 5.11. Use horizontalAdvance() instead.
-
- \sa boundingRect(), horizontalAdvance()
-*/
-qreal QFontMetricsF::width(const QString &text) const
-{
- return horizontalAdvance(text);
-}
-
-/*!
- \overload
-
- \image bearings.png Bearings
-
- Returns the logical width of character \a ch in pixels. This is a
- distance appropriate for drawing a subsequent character after \a
- ch.
-
- Some of the metrics are described in the image to the right. The
- central dark rectangles cover the logical width() of each
- character. The outer pale rectangles cover the leftBearing() and
- rightBearing() of each character. Notice that the bearings of "f"
- in this particular font are both negative, while the bearings of
- "o" are both positive.
-
- \deprecated in Qt 5.11. Use horizontalAdvance() instead.
-
- \warning This function will produce incorrect results for Arabic
- characters or non-spacing marks in the middle of a string, as the
- glyph shaping and positioning of marks that happens when
- processing strings cannot be taken into account. When implementing
- an interactive text control, use QTextLayout instead.
-
- \sa boundingRect(), horizontalAdvance()
-*/
-qreal QFontMetricsF::width(QChar ch) const
-{
- return horizontalAdvance(ch);
-}
-#endif
-
/*!
Returns the horizontal advance in pixels of the first \a length characters of \a
text. If \a length is negative (the default), the entire string is
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index 8e1b043b55..097d40bf8d 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -55,19 +55,7 @@ class Q_GUI_EXPORT QFontMetrics
{
public:
explicit QFontMetrics(const QFont &);
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- QFontMetrics(const QFont &font, QPaintDevice *pd);
-#ifndef Q_QDOC
- // the template is necessary to make QFontMetrics(font,nullptr) and QFontMetrics(font,NULL)
- // not ambiguous. Implementation detail that should not be documented.
- template<char = 0>
-#endif
- QFontMetrics(const QFont &font, const QPaintDevice *pd)
- : QFontMetrics(font, const_cast<QPaintDevice*>(pd))
- {}
-#else
QFontMetrics(const QFont &font, const QPaintDevice *pd);
-#endif
QFontMetrics(const QFontMetrics &);
~QFontMetrics();
@@ -97,22 +85,9 @@ public:
int leftBearing(QChar) const;
int rightBearing(QChar) const;
-#if QT_DEPRECATED_SINCE(5, 11)
- QT_DEPRECATED_X("Use QFontMetrics::horizontalAdvance")
- int width(const QString &, int len = -1) const;
- QT_DEPRECATED_X("Use QFontMetrics::horizontalAdvance")
- int width(const QString &, int len, int flags) const;
- QT_DEPRECATED_X("Use QFontMetrics::horizontalAdvance")
- int width(QChar) const;
-#endif
-
int horizontalAdvance(const QString &, int len = -1) const;
int horizontalAdvance(QChar) const;
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
- QT_DEPRECATED int charWidth(const QString &str, int pos) const;
-#endif
-
QRect boundingRect(QChar) const;
QRect boundingRect(const QString &text) const;
@@ -149,19 +124,7 @@ class Q_GUI_EXPORT QFontMetricsF
{
public:
explicit QFontMetricsF(const QFont &font);
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- QFontMetricsF(const QFont &font, QPaintDevice *pd);
-#ifndef Q_QDOC
- // the template is necessary to make QFontMetrics(font,nullptr) and QFontMetrics(font,NULL)
- // not ambiguous. Implementation detail that should not be documented.
- template<char = 0>
-#endif
- QFontMetricsF(const QFont &font, const QPaintDevice *pd)
- : QFontMetricsF(font, const_cast<QPaintDevice*>(pd))
- {}
-#else
QFontMetricsF(const QFont &font, const QPaintDevice *pd);
-#endif
QFontMetricsF(const QFontMetrics &);
QFontMetricsF(const QFontMetricsF &);
~QFontMetricsF();
@@ -192,11 +155,6 @@ public:
qreal leftBearing(QChar) const;
qreal rightBearing(QChar) const;
-#if QT_DEPRECATED_SINCE(5, 11)
- qreal width(const QString &string) const;
- qreal width(QChar) const;
-#endif
-
qreal horizontalAdvance(const QString &string, int length = -1) const;
qreal horizontalAdvance(QChar) const;
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp
index 2d72eef459..0217c04788 100644
--- a/tests/auto/gui/text/qfont/tst_qfont.cpp
+++ b/tests/auto/gui/text/qfont/tst_qfont.cpp
@@ -58,9 +58,7 @@ private slots:
void insertAndRemoveSubstitutions();
void serialize_data();
void serialize();
-#if QT_DEPRECATED_SINCE(5, 13)
- void lastResortFont();
-#endif
+
void styleName();
void defaultFamily_data();
void defaultFamily();
@@ -501,19 +499,6 @@ void tst_QFont::serialize()
}
}
-#if QT_DEPRECATED_SINCE(5, 13)
-// QFont::lastResortFont() may abort with qFatal() on QWS/QPA
-// if absolutely no font is found. Just as ducumented for QFont::lastResortFont().
-// This happens on our CI machines which run QWS autotests.
-// ### fixme: Check platforms
-void tst_QFont::lastResortFont()
-{
- QSKIP("QFont::lastResortFont() may abort with qFatal() on QPA, QTBUG-22325");
- QFont font;
- QVERIFY(!font.lastResortFont().isEmpty());
-}
-#endif
-
void tst_QFont::styleName()
{
#if !defined(Q_OS_MAC)