48 #include <private/qunicodetables_p.h> 64 int tabStops,
int *tabArray,
int tabArrayLen,
190 int screen = info ? info->
screen() : 0;
192 const int screen = 0;
194 if (font.
d->
dpi != dpi || font.
d->
screen != screen ) {
564 return width(text, len, 0);
574 len = (len < 0) ? pos :
qMin(pos, len);
575 }
else if (len < 0) {
587 glyphs.resize(numGlyphs);
593 for (
int i = 0; i < numGlyphs; ++i)
594 width += glyphs.advances_x[i];
668 if (pos < 0 || pos > (
int)text.
length())
677 int from =
qMax(0, pos - 8);
836 while (tabArray[tabArrayLen])
944 QString portion = _text.
mid(posA, posB - posA);
945 if (
size(flags, portion).
width() <= width)
950 _text = _text.
mid(posA);
989 return pos > 0 ? pos : 1;
1071 :
d(fontMetrics.
d.
data())
1125 int screen = info ? info->
screen() : 0;
1127 const int screen = 0;
1129 if (font.
d->
dpi != dpi || font.
d->
screen != screen ) {
1178 return d == other.
d;
1191 return d == other.
d;
1492 int len = (pos != -1) ? pos : text.
length();
1495 layout.ignoreBidi =
true;
1497 return layout.width(0, len).toReal();
1575 layout.ignoreBidi =
true;
1677 int tabStops,
int *tabArray)
const 1679 int tabArrayLen = 0;
1681 while (tabArray[tabArrayLen])
1754 layout.ignoreBidi =
true;
1786 QString portion = _text.
mid(posA, posB - posA);
1787 if (
size(flags, portion).
width() <= width)
1792 _text = _text.
mid(posA);
The QPainter class performs low-level painting on widgets and other paint devices.
virtual QFixed lineThickness() const
QRect toAlignedRect() const
Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle...
QFontMetricsF(const QFont &)
Constructs a font metrics object for font.
virtual qreal minRightBearing() const
qreal maxWidth() const
Returns the width of the widest character in the font.
virtual QFixed averageCharWidth() const
int width(const QString &, int len=-1) const
Returns the width in pixels of the first len characters of text.
bool inFontUcs4(uint ucs4) const
Returns true if the given character encoded in UCS-4/UTF-32 is a valid character in the font; otherwi...
QExplicitlySharedDataPointer< QFontPrivate > d
static mach_timebase_info_data_t info
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
The QFontMetrics class provides font metrics information.
QString elidedText(Qt::TextElideMode mode, const QFixed &width, int flags=0) const
#define QT_END_NAMESPACE
This macro expands to.
int leading() const
Returns the leading of the font.
qreal ascent() const
Returns the ascent of the font.
int maxWidth() const
Returns the width of the widest character in the font.
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int descent() const
Returns the descent of the font.
qreal descent() const
Returns the descent of the font.
int rightBearing(QChar) const
Returns the right bearing of character ch in the font.
int length() const
Returns the number of characters in this string.
friend class QFontPrivate
~QFontMetricsF()
Destroys the font metrics object and frees all allocated resources.
QRect tightBoundingRect(const QString &text) const
Returns a tight bounding rectangle around the characters in the string specified by text...
int strikeOutPos() const
Returns the distance from the base line to where the strikeout line should be drawn.
QRectF tightBoundingRect(const QString &text) const
Returns a tight bounding rectangle around the characters in the string specified by text...
qreal minRightBearing() const
Returns the minimum right bearing of the font.
QSizeF size(int flags, const QString &str, int tabstops=0, int *tabarray=0) const
Returns the size in pixels of the characters in the given text.
The QString class provides a Unicode character string.
qreal lineSpacing() const
Returns the distance from one base line to the next.
static QFixed fromReal(qreal r)
int minLeftBearing() const
Returns the minimum left bearing of the font.
qreal averageCharWidth() const
Returns the average width of glyphs in the font.
virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const =0
QFontPrivate * smallCapsFontPrivate() const
qreal rightBearing(QChar) const
Returns the right bearing of character ch in the font.
virtual Type type() const =0
~QFontMetrics()
Destroys the font metrics object and frees all allocated resources.
The QSizeF class defines the size of a two-dimensional object using floating point precision...
The QChar class provides a 16-bit Unicode character.
QChar * data()
Returns a pointer to the data stored in the QString.
static QString fromRawData(const QChar *, int size)
Constructs a QString that uses the first size Unicode characters in the array unicode.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags=0) const
If the string text is wider than width, returns an elided version of the string (i.
Category category() const
Returns the character's category.
bool isLower() const
Returns true if the character is a lowercase letter, i.
int minRightBearing() const
Returns the minimum right bearing of the font.
virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing=0, qreal *rightBearing=0)
int ascent() const
Returns the ascent of the font.
QRect boundingRect(QChar) const
Returns the rectangle that is covered by ink if character ch were to be drawn at the origin of the co...
virtual qreal maxCharWidth() const =0
QFontMetricsF & operator=(const QFontMetricsF &)
Assigns the font metrics fm to this font metrics object.
T * data() const
Returns a pointer to the shared data object.
int leftBearing(QChar) const
Returns the left bearing of character ch in the font.
int averageCharWidth() const
Returns the average width of glyphs in the font.
const Q_GUI_EXPORT QX11Info * qt_x11Info(const QPaintDevice *pd)
Returns the QX11Info structure for the pd paint device.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
bool operator==(const QFontMetrics &other)
Returns true if other is equal to this object; otherwise returns false.
QRectF boundingRect(const QString &string) const
Returns the bounding rectangle of the characters in the string specified by text. ...
QSize size(int flags, const QString &str, int tabstops=0, int *tabarray=0) const
Returns the size in pixels of text.
const QChar * unicode() const
Returns a '\0'-terminated Unicode representation of the string.
bool inFontUcs4(uint ucs4) const
Returns true if the character given by ch, encoded in UCS-4/UTF-32, is a valid character in the font;...
QFontMetrics(const QFont &)
Constructs a font metrics object for font.
virtual bool canRender(const QChar *string, int len)=0
QSize size() const
Returns the size of the rectangle.
virtual QFixed ascent() const =0
virtual QFixed descent() const =0
qreal height() const
Returns the height of the font.
static const char * data(const QByteArray &arr)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
bool inFont(QChar) const
Returns true if character ch is a valid character in the font; otherwise returns false.
bool inFont(QChar) const
Returns true if character ch is a valid character in the font; otherwise returns false.
int lineWidth() const
Returns the width of the underline and strikeout lines, adjusted for the point size of the font...
qreal minLeftBearing() const
Returns the minimum left bearing of the font.
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs)=0
int xHeight() const
Returns the 'x' height of the font.
int charWidth(const QString &str, int pos) const
Returns the width of the character at position pos in the string text.
QFontMetrics & operator=(const QFontMetrics &)
Assigns the font metrics fm.
virtual qreal minLeftBearing() const
Q_CORE_EXPORT int QT_FASTCALL script(uint ucs4)
virtual QFixed xHeight() const
QFontEngine * engineForScript(int script) const
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
#define Q_ASSERT_X(cond, where, what)
The QX11Info class provides information about the X display configuration.
qreal leading() const
Returns the leading of the font.
The QFont class specifies a font used for drawing text.
Q_GUI_EXPORT int qt_defaultDpi()
int underlinePos() const
Returns the distance from the base line to where an underscore should be drawn.
int overlinePos() const
Returns the distance from the base line to where an overline should be drawn.
qreal lineWidth() const
Returns the width of the underline and strikeout lines, adjusted for the point size of the font...
QExplicitlySharedDataPointer< QFontPrivate > d
qreal underlinePos() const
Returns the distance from the base line to where an underscore should be drawn.
The QRect class defines a rectangle in the plane using integer precision.
QSizeF size() const
Returns the size of the rectangle.
bool operator==(const QFontMetricsF &other)
Returns true if the font metrics are equal to the other font metrics; otherwise returns false...
int lineSpacing() const
Returns the distance from one base line to the next.
The QFontMetricsF class provides font metrics information.
The QSize class defines the size of a two-dimensional object using integer point precision.
qreal xHeight() const
Returns the 'x' height of the font.
qreal width(const QString &string) const
Returns the width in pixels of the characters in the given text.
void qt_format_text(const QFont &font, const QRectF &_r, int tf, const QString &text, QRectF *brect, int tabStops, int *tabArray, int tabArrayLen, QPainter *painter)
int height() const
Returns the height of the font.
void alterCharForCapitalization(QChar &c) const
qreal leftBearing(QChar) const
Returns the left bearing of character ch in the font.
qreal strikeOutPos() const
Returns the distance from the base line to where the strikeout line should be drawn.
QString elidedText(const QString &text, Qt::TextElideMode mode, qreal width, int flags=0) const
If the string text is wider than width, returns an elided version of the string (i.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
const QX11Info * qt_x11Info(const QPaintDevice *pd)
Q_DECL_CONSTEXPR int qRound(qreal d)
virtual QFixed underlinePosition() const
QExplicitlySharedDataPointer< QFontPrivate > d
virtual QFixed leading() const =0
qreal overlinePos() const
Returns the distance from the base line to where an overline should be drawn.
int screen() const
Returns the number of the screen currently in use.
static qreal toReal(Register *reg, int type, bool *ok=0)
static QString fromUcs4(const uint *, int size=-1)
Returns a QString initialized with the first size characters of the Unicode string unicode (ISO-10646...