summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfontdatabase_qws.cpp3
-rw-r--r--src/gui/text/qfontmetrics.cpp6
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.cpp64
-rw-r--r--src/gui/text/qrawfont.cpp56
-rw-r--r--src/gui/text/qtextdocument.cpp2
-rw-r--r--src/gui/text/qtextformat.cpp61
-rw-r--r--src/gui/text/qtextlayout.cpp2
7 files changed, 137 insertions, 57 deletions
diff --git a/src/gui/text/qfontdatabase_qws.cpp b/src/gui/text/qfontdatabase_qws.cpp
index c5a04f1700..c83e9297d9 100644
--- a/src/gui/text/qfontdatabase_qws.cpp
+++ b/src/gui/text/qfontdatabase_qws.cpp
@@ -759,9 +759,6 @@ bool QFontDatabase::supportsThreadedFontRendering()
return true;
}
-/*!
- \internal
-*/
QFontEngine *
QFontDatabase::findFont(int script, const QFontPrivate *fp,
const QFontDef &request)
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 195bd7891b..9e1646f046 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -1329,8 +1329,10 @@ bool QFontMetricsF::inFont(QChar ch) const
}
/*!
- Returns true if the character encoded in UCS-4/UTF-32 is a valid
- character in the font; otherwise returns false.
+ \fn bool QFontMetricsF::inFontUcs4(uint ch) const
+
+ Returns true if the character given by \a ch, encoded in UCS-4/UTF-32,
+ is a valid character in the font; otherwise returns false.
*/
bool QFontMetricsF::inFontUcs4(uint ucs4) const
{
diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp
index 6071c55ce2..7e829dbd3f 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.cpp
+++ b/src/gui/text/qplatformfontdatabase_qpa.cpp
@@ -51,6 +51,13 @@ extern void qt_registerFont(const QString &familyname, const QString &foundrynam
QFont::Style style, int stretch, bool antialiased,bool scalable, int pixelSize,
const QSupportedWritingSystems &writingSystems, void *hanlde);
+/*!
+ \fn void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *)
+
+ Registers the pre-rendered QPF2 font contained in the given \a dataArray.
+
+ \sa registerFont()
+*/
void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *handle)
{
if (dataArray.size() == 0)
@@ -88,6 +95,32 @@ void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *
}
}
+/*!
+ \fn void QPlatformFontDatabase::registerFont(const QString &familyName,
+ const QString &foundryName, QFont::Weight weight, QFont::Style style,
+ QFont::Stretch stretch, bool antialiased, bool scalable, int pixelSize,
+ const QSupportedWritingSystems &writingSystems, void *usrPtr)
+
+ Registers a font with the given set of attributes describing the font's
+ foundry, family name, style and stretch information, pixel size, and
+ supported writing systems. Additional information about whether the font
+ can be scaled and antialiased can also be provided.
+
+ The foundry name and font family are described by \a foundryName and
+ \a familyName. The font weight (light, normal, bold, etc.), style (normal,
+ oblique, italic) and stretch information (condensed, expanded, unstretched,
+ etc.) are specified by \a weight, \a style and \a stretch.
+
+ Some fonts can be antialiased and scaled; \a scalable and \a antialiased
+ can be set to true for fonts with these attributes. The intended pixel
+ size of non-scalable fonts is specified by \a pixelSize; this value will be
+ ignored for scalable fonts.
+
+ The writing systems supported by the font are specified by the
+ \a writingSystems argument.
+
+ \sa registerQPF2Font()
+*/
void QPlatformFontDatabase::registerFont(const QString &familyname, const QString &foundryname, QFont::Weight weight,
QFont::Style style, QFont::Stretch stretch, bool antialiased, bool scalable, int pixelSize,
const QSupportedWritingSystems &writingSystems, void *usrPtr)
@@ -206,7 +239,8 @@ void QPlatformFontDatabase::populateFontDatabase()
}
/*!
-
+ Returns the font engine that can be used to render the font described by
+ the font definition, \a fontDef, in the specified \a script.
*/
QFontEngine *QPlatformFontDatabase::fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle)
{
@@ -229,7 +263,8 @@ QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal
}
/*!
-
+ Returns a list of alternative fonts for the specified \a family and
+ \a style and \a script using the \a styleHint given.
*/
QStringList QPlatformFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const
{
@@ -241,8 +276,13 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString family, cons
}
/*!
- Adds an application font. Returns a list of family names, or an empty list if the font could
- not be added
+ Adds an application font described by the font contained supplied \a fontData
+ or using the font contained in the file referenced by \a fileName. Returns
+ a list of family names, or an empty list if the font could not be added.
+
+ \note The default implementation of this function does not add an application
+ font. Subclasses should reimplement this function to perform the necessary
+ loading and registration of fonts.
*/
QStringList QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
{
@@ -280,21 +320,23 @@ QString QPlatformFontDatabase::fontDir() const
/*!
\class QPlatformFontDatabase
- \brief The QPlatformFontDatabase makes it possible to customize how fonts are picked up, and
- and how they are rendered
+ \brief The QPlatformFontDatabase class makes it possible to customize how fonts
+ are discovered and how they are rendered
\ingroup painting
QPlatformFontDatabase is the superclass which is intended to let platform implementations use
native font handling.
- Qt has its internal fontdatabase which it uses to pick up available fonts. To be able
- to populate this database subclass this class, and reimplement populateFontDatabase().
+ Qt has its internal font database which it uses to discover available fonts on the
+ user's system. To be able to populate this database subclass this class, and
+ reimplement populateFontDatabase().
- Use the function registerFont to populate the internal fontdatabase.
+ Use the function registerFont() to populate the internal font database.
- Sometimes a specified font does not have the required glyphs, then the fallbackForFamily
- function is called.
+ Sometimes a specified font does not have the required glyphs; in such a case, the
+ fallbackForFamily() function is called automatically to find alternative font
+ families that can supply alternatives to the missing glyphs.
\sa QSupportedWritingSystems
*/
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index a6ec86e1c2..ec5cc18ef9 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -87,16 +87,16 @@ QT_BEGIN_NAMESPACE
QRawFont can be constructed in a number of ways:
\list
- \o \l It can be constructed by calling QTextLayout::glyphRuns() or QTextFragment::glyphRuns().
- The returned QGlyphRun objects will contain QRawFont objects which represent the actual
- fonts used to render each portion of the text.
- \o \l It can be constructed by passing a QFont object to QRawFont::fromFont(). The function
- will return a QRawFont object representing the font that will be selected as response to
- the QFont query and the selected writing system.
- \o \l It can be constructed by passing a file name or QByteArray directly to the QRawFont
- constructor, or by calling loadFromFile() or loadFromData(). In this case, the
- font will not be registered in QFontDatabase, and it will not be available as part of
- regular font selection.
+ \o It can be constructed by calling QTextLayout::glyphs() or QTextFragment::glyphs(). The
+ returned QGlyphs objects will contain QRawFont objects which represent the actual fonts
+ used to render each portion of the text.
+ \o It can be constructed by passing a QFont object to QRawFont::fromFont(). The function
+ will return a QRawFont object representing the font that will be selected as response to
+ the QFont query and the selected writing system.
+ \o It can be constructed by passing a file name or QByteArray directly to the QRawFont
+ constructor, or by calling loadFromFile() or loadFromData(). In this case, the
+ font will not be registered in QFontDatabase, and it will not be available as part of
+ regular font selection.
\endlist
QRawFont is considered local to the thread in which it is constructed (either using a
@@ -132,8 +132,9 @@ QRawFont::QRawFont()
}
/*!
- Constructs a QRawFont representing the font contained in the file referenced by \a fileName,
- with \a pixelSize size in pixels, and the selected \a hintingPreference.
+ Constructs a QRawFont representing the font contained in the file referenced
+ by \a fileName for the size (in pixels) given by \a pixelSize, and using the
+ hinting preference specified by \a hintingPreference.
\note The referenced file must contain a TrueType or OpenType font.
*/
@@ -146,7 +147,9 @@ QRawFont::QRawFont(const QString &fileName,
}
/*!
- Constructs a QRawFont representing the font contained in \a fontData.
+ Constructs a QRawFont representing the font contained in the supplied
+ \a fontData for the size (in pixels) given by \a pixelSize, and using the
+ hinting preference specified by \a hintingPreference.
\note The data must contain a TrueType or OpenType font.
*/
@@ -192,7 +195,9 @@ bool QRawFont::isValid() const
}
/*!
- Replaces the current QRawFont with the contents of the file references by \a fileName.
+ Replaces the current QRawFont with the contents of the file referenced
+ by \a fileName for the size (in pixels) given by \a pixelSize, and using the
+ hinting preference specified by \a hintingPreference.
The file must reference a TrueType or OpenType font.
@@ -208,7 +213,9 @@ void QRawFont::loadFromFile(const QString &fileName,
}
/*!
- Replaces the current QRawFont with the contents of \a fontData.
+ Replaces the current QRawFont with the font contained in the supplied
+ \a fontData for the size (in pixels) given by \a pixelSize, and using the
+ hinting preference specified by \a hintingPreference.
The \a fontData must contain a TrueType or OpenType font.
@@ -226,8 +233,9 @@ void QRawFont::loadFromData(const QByteArray &fontData,
}
/*!
- This function returns a rasterized image of the glyph at a given \a glyphIndex in the underlying
- font, if the QRawFont is valid, otherwise it will return an invalid QImage.
+ This function returns a rasterized image of the glyph at the given
+ \a glyphIndex in the underlying font, using the \a transform specified.
+ If the QRawFont is not valid, this function will return an invalid QImage.
If \a antialiasingType is set to QRawFont::SubPixelAntialiasing, then the resulting image will be
in QImage::Format_RGB32 and the RGB values of each pixel will represent the subpixel opacities of
@@ -435,11 +443,15 @@ int QRawFont::weight() const
}
/*!
- Converts a string of unicode points to glyph indexes using the CMAP table in the
- underlying font. Note that in cases where there are other tables in the font that affect the
- shaping of the text, the returned glyph indexes will not correctly represent the rendering
- of the text. To get the correctly shaped text, you can use QTextLayout to lay out and shape the
- text, and then call QTextLayout::glyphRuns() to get the set of glyph index list and QRawFont pairs.
+ Converts the string of unicode points given by \a text to glyph indexes
+ using the CMAP table in the underlying font, and returns a vector containing
+ the result.
+
+ Note that, in cases where there are other tables in the font that affect the
+ shaping of the text, the returned glyph indexes will not correctly represent
+ the rendering of the text. To get the correctly shaped text, you can use
+ QTextLayout to lay out and shape the text, then call QTextLayout::glyphs()
+ to get the set of glyph index list and QRawFont pairs.
\sa advancesForGlyphIndexes(), glyphIndexesForChars(), QGlyphRun, QTextLayout::glyphRuns(), QTextFragment::glyphRuns()
*/
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 74b1c69243..41b6fe24cf 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -600,7 +600,7 @@ Qt::CursorMoveStyle QTextDocument::defaultCursorMoveStyle() const
/*!
\since 4.8
- Set the default cursor movement style.
+ Sets the default cursor movement style to the given \a style.
*/
void QTextDocument::setDefaultCursorMoveStyle(Qt::CursorMoveStyle style)
{
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index a699568b6f..833414f79f 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -571,6 +571,8 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\value FontStyleHint Corresponds to the QFont::StyleHint property
\value FontStyleStrategy Corresponds to the QFont::StyleStrategy property
\value FontKerning Specifies whether the font has kerning turned on.
+ \value FontHintingPreference Controls the use of hinting according to values
+ of the QFont::HintingPreference enum.
\omitvalue FirstFontProperty
\omitvalue LastFontProperty
@@ -588,8 +590,13 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
List properties
- \value ListStyle
- \value ListIndent
+ \value ListStyle Specifies the style used for the items in a list,
+ described by values of the QTextListFormat::Style enum.
+ \value ListIndent Specifies the amount of indentation used for a list.
+ \value ListNumberPrefix Defines the text which is prepended to item numbers in
+ numeric lists.
+ \value ListNumberSuffix Defines the text which is appended to item numbers in
+ numeric lists.
Table and frame properties
@@ -1263,16 +1270,18 @@ bool QTextFormat::operator==(const QTextFormat &rhs) const
\value AlignNormal Adjacent characters are positioned in the standard
way for text in the writing system in use.
- \value AlignSuperScript Characters are placed above the baseline for
+ \value AlignSuperScript Characters are placed above the base line for
normal text.
- \value AlignSubScript Characters are placed below the baseline for
+ \value AlignSubScript Characters are placed below the base line for
normal text.
- \value AlignMiddle The center of the object is vertically aligned with the base line.
- Currently, this is only implemented for inline objects.
+ \value AlignMiddle The center of the object is vertically aligned with the
+ base line. Currently, this is only implemented for
+ inline objects.
\value AlignBottom The bottom edge of the object is vertically aligned with
the base line.
\value AlignTop The top edge of the object is vertically aligned with
the base line.
+ \value AlignBaseline The base lines of the characters are aligned.
*/
/*!
@@ -2136,8 +2145,9 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
\fn void QTextBlockFormat::setLineHeight(qreal height, int heightType)
\since 4.8
- This sets the line height for the paragraph to the value in height
- which is dependant on heightType, described by the LineHeightTypes enum.
+ Sets the line height for the paragraph to the value given by \a height
+ which is dependent on \a heightType in the way described by the
+ LineHeightTypes enum.
\sa LineHeightTypes, lineHeight(), lineHeightType()
*/
@@ -2147,11 +2157,16 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
\fn qreal QTextBlockFormat::lineHeight(qreal scriptLineHeight, qreal scaling) const
\since 4.8
- This returns what the height of the lines in the paragraph will be depending
- on the given height of the script line and the scaling. The value that is returned
- is also dependant on the given LineHeightType of the paragraph as well as the LineHeight
- setting that has been set for the paragraph. The scaling is needed for the heights
- that include a fixed number of pixels, to scale them appropriately for printing.
+ Returns the height of the lines in the paragraph based on the height of the
+ script line given by \a scriptLineHeight and the specified \a scaling
+ factor.
+
+ The value that is returned is also dependent on the given LineHeightType of
+ the paragraph as well as the LineHeight setting that has been set for the
+ paragraph.
+
+ The scaling is needed for heights that include a fixed number of pixels, to
+ scale them appropriately for printing.
\sa LineHeightTypes, setLineHeight(), lineHeightType()
*/
@@ -2237,6 +2252,13 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
numbering scheme used for items in the list. Note that lists that use the
decimal numbering scheme begin counting at 1 rather than 0.
+ Style properties can be set to further configure the appearance of list
+ items; for example, the ListNumberPrefix and ListNumberSuffix properties
+ can be used to customize the numbers used in an ordered list so that they
+ appear as (1), (2), (3), etc.:
+
+ \snippet doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp add a styled, ordered list
+
\sa QTextList
*/
@@ -2328,8 +2350,11 @@ QTextListFormat::QTextListFormat(const QTextFormat &fmt)
\fn void QTextListFormat::setNumberPrefix(const QString &numberPrefix)
\since 4.8
- Sets the list format's number prefix. This can be used with all
- sorted list types. It does not have any effect on unsorted list types.
+ Sets the list format's number prefix to the string specified by
+ \a numberPrefix. This can be used with all sorted list types. It does not
+ have any effect on unsorted list types.
+
+ The default prefix is an empty string.
\sa numberPrefix()
*/
@@ -2347,8 +2372,10 @@ QTextListFormat::QTextListFormat(const QTextFormat &fmt)
\fn void QTextListFormat::setNumberSuffix(const QString &numberSuffix)
\since 4.8
- Sets the list format's number suffix. This can be used with all
- sorted list types. It does not have any effect on unsorted list types.
+ Sets the list format's number suffix to the string specified by
+ \a numberSuffix. This can be used with all sorted list types. It does not
+ have any effect on unsorted list types.
+
The default suffix is ".".
\sa numberSuffix()
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 203886b0a8..c1bc846bd5 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -584,7 +584,7 @@ bool QTextLayout::cacheEnabled() const
this option is for widgets like QLineEdit or custom widgets without
a QTextDocument. Default value is Qt::LogicalMoveStyle.
- \sa setCursorMoveStyle()
+ \sa cursorMoveStyle()
*/
void QTextLayout::setCursorMoveStyle(Qt::CursorMoveStyle style)
{