Skip to content

PythonQt.QtGui.QGlyphRun

QGlyphRun

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

When Qt displays a string of text encoded in Unicode, it will first convert the Unicode points into a list of glyph indexes and a list of positions based on one or more fonts. The Unicode representation of the text and the QFont object will in this case serve as a convenient abstraction that hides the details of what actually takes place when displaying the text on-screen. For instance, by the time the text actually reaches the screen, it may be represented by a set of fonts in addition to the one specified by the user, e.g. in case the originally selected font did not support all the writing systems contained in the text.

Under certain circumstances, it can be useful as an application developer to have more low-level control over which glyphs in a specific font are drawn to the screen. This could for instance be the case in applications that use an external font engine and text shaper together with Qt. QGlyphRun provides an interface to the raw data needed to get text on the screen. It contains a list of glyph indexes, a position for each glyph and a font.

It is the user's responsibility to ensure that the selected font actually contains the provided glyph indexes.

QTextLayout::glyphRuns() or QTextFragment::glyphRuns() can be used to convert unicode encoded text into a list of QGlyphRun objects, and QPainter::drawGlyphRun() can be used to draw the glyphs.

Note: Please note that QRawFont is considered local to the thread in which it is constructed. This in turn means that a new QRawFont will have to be created and set on the QGlyphRun if it is moved to a different thread. If the QGlyphRun contains a reference to a QRawFont from a different thread than the current, it will not be possible to draw the glyphs using a QPainter, as the QRawFont is considered invalid and inaccessible in this case.

Source: https://doc.qt.io/archives/qt-5.15/qglyphrun.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
GlyphRunFlag attribute type Convert a number or string to an integer, or return 0 if no arguments are given.
GlyphRunFlags attribute type Convert a number or string to an integer, or return 0 if no arguments are given.
Overline attribute Any
RightToLeft attribute Any (shared captured text)
SplitLigature attribute Any
StrikeOut attribute Any
Underline attribute Any
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
boundingRect function (self) -> Any X.boundingRect() -> PythonQt.QtCore.QRectF
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
clear function (self) -> Any Clears all data in the [QGlyphRun](https://doc.qt.io/archives/qt-5.15/qglyphrun.html) object.
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
flags function (self) -> Any Returns the flags set for this [QGlyphRun](https://doc.qt.io/archives/qt-5.15/qglyphrun.html).
glyphIndexes function (self) -> tuple X.glyphIndexes() -> tuple
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
isEmpty function (self) -> bool X.isEmpty() -> bool
isRightToLeft function (self) -> bool X.isRightToLeft() -> bool
operator_assign function (self, other: Any) -> Any X.operator_assign(other) -> PythonQt.QtGui.QGlyphRun
overline function (self) -> bool X.overline() -> bool
positions function (self) -> tuple X.positions() -> tuple
rawFont function (self) -> Any X.rawFont() -> PythonQt.QtGui.QRawFont
setBoundingRect function (self, boundingRect: Any) -> Any Sets the bounding rect of the glyphs in this [QGlyphRun](https://doc.qt.io/archives/qt-5.15/qglyphrun.html) to be boundingRect.
setFlag function (self, arg0: flag, enabled: Any) -> Any X.setFlag(flag, enabled)
setFlags function (self, arg0: flags) -> Any Sets the flags of this [QGlyphRun](https://doc.qt.io/archives/qt-5.15/qglyphrun.html) to flags.
setGlyphIndexes function (self, glyphIndexes: Any) -> Any Set the glyph indexes for this [QGlyphRun](https://doc.qt.io/archives/qt-5.15/qglyphrun.html) object to glyphIndexes.
setOverline function (self, overline: Any) -> Any Indicates that this [QGlyphRun](https://doc.qt.io/archives/qt-5.15/qglyphrun.html) should be painted with an overline decoration if overline is true.
setPositions function (self, positions: Any) -> Any Sets the positions of the edge of the baseline for each glyph in this set of glyph indexes to positions.
setRawData function (self, glyphIndexArray: Any, glyphPositionArray: Any, size: Any) -> Any X.setRawData(glyphIndexArray, glyphPositionArray, size)
setRawFont function (self, rawFont: Any) -> Any Sets the font in which to look up the glyph indexes to the rawFont specified.
setRightToLeft function (self, on: Any) -> Any Indicates that this [QGlyphRun](https://doc.qt.io/archives/qt-5.15/qglyphrun.html) contains glyphs that should be ordered from the right to left if rightToLeft is true.
setStrikeOut function (self, strikeOut: Any) -> Any Indicates that this [QGlyphRun](https://doc.qt.io/archives/qt-5.15/qglyphrun.html) should be painted with an strike out decoration if strikeOut is true.
setUnderline function (self, underline: Any) -> Any Indicates that this [QGlyphRun](https://doc.qt.io/archives/qt-5.15/qglyphrun.html) should be painted with an underline decoration if underline is true.
strikeOut function (self) -> bool X.strikeOut() -> bool
swap function (self, other: Any) -> Any Swaps this glyph run instance with other.
underline function (self) -> bool X.underline() -> bool