[][src]Struct qt_gui::QGlyphRun

#[repr(C)]pub struct QGlyphRun { /* fields omitted */ }

The QGlyphRun class provides direct access to the internal glyphs in a font.

C++ class: QGlyphRun.

C++ documentation:

The QGlyphRun class provides direct access to the internal glyphs in a font.

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.

Methods

impl QGlyphRun[src]

pub unsafe fn bounding_rect(&self) -> CppBox<QRectF>[src]

Returns the smallest rectangle that contains all glyphs in this QGlyphRun. If a bounding rect has been set using setBoundingRect(), then this will be returned. Otherwise the bounding rect will be calculated based on the font metrics of the glyphs in the glyph run.

Calls C++ function: QRectF QGlyphRun::boundingRect() const.

C++ documentation:

Returns the smallest rectangle that contains all glyphs in this QGlyphRun. If a bounding rect has been set using setBoundingRect(), then this will be returned. Otherwise the bounding rect will be calculated based on the font metrics of the glyphs in the glyph run.

This function was introduced in Qt 5.0.

See also setBoundingRect().

pub unsafe fn clear(&self)[src]

Clears all data in the QGlyphRun object.

Calls C++ function: void QGlyphRun::clear().

C++ documentation:

Clears all data in the QGlyphRun object.

pub unsafe fn copy_from(
    &self,
    other: impl CastInto<Ref<QGlyphRun>>
) -> Ref<QGlyphRun>
[src]

Assigns other to this QGlyphRun object.

Calls C++ function: QGlyphRun& QGlyphRun::operator=(const QGlyphRun& other).

C++ documentation:

Assigns other to this QGlyphRun object.

pub unsafe fn flags(&self) -> QFlags<GlyphRunFlag>[src]

Returns the flags set for this QGlyphRun.

Calls C++ function: QFlags<QGlyphRun::GlyphRunFlag> QGlyphRun::flags() const.

C++ documentation:

Returns the flags set for this QGlyphRun.

This function was introduced in Qt 5.0.

See also setFlags(), setFlag(), and setFlag().

pub unsafe fn glyph_indexes(&self) -> CppBox<QVectorOfU32>[src]

Returns the glyph indexes for this QGlyphRun object.

Calls C++ function: QVector<quint32> QGlyphRun::glyphIndexes() const.

C++ documentation:

Returns the glyph indexes for this QGlyphRun object.

See also setGlyphIndexes() and setPositions().

pub unsafe fn is_empty(&self) -> bool[src]

Returns true if the QGlyphRun does not contain any glyphs.

Calls C++ function: bool QGlyphRun::isEmpty() const.

C++ documentation:

Returns true if the QGlyphRun does not contain any glyphs.

This function was introduced in Qt 5.0.

pub unsafe fn is_right_to_left(&self) -> bool[src]

Returns true if this QGlyphRun contains glyphs that are painted from the right to the left.

Calls C++ function: bool QGlyphRun::isRightToLeft() const.

C++ documentation:

Returns true if this QGlyphRun contains glyphs that are painted from the right to the left.

This function was introduced in Qt 5.0.

See also setRightToLeft() and flags().

pub unsafe fn new() -> CppBox<QGlyphRun>[src]

Constructs an empty QGlyphRun object.

Calls C++ function: [constructor] void QGlyphRun::QGlyphRun().

C++ documentation:

Constructs an empty QGlyphRun object.

pub unsafe fn new_copy(
    other: impl CastInto<Ref<QGlyphRun>>
) -> CppBox<QGlyphRun>
[src]

Constructs a QGlyphRun object which is a copy of other.

Calls C++ function: [constructor] void QGlyphRun::QGlyphRun(const QGlyphRun& other).

C++ documentation:

Constructs a QGlyphRun object which is a copy of other.

pub unsafe fn overline(&self) -> bool[src]

Returns true if this QGlyphRun should be painted with an overline decoration.

Calls C++ function: bool QGlyphRun::overline() const.

C++ documentation:

Returns true if this QGlyphRun should be painted with an overline decoration.

See also setOverline() and flags().

pub unsafe fn positions(&self) -> CppBox<QVectorOfQPointF>[src]

Returns the position of the edge of the baseline for each glyph in this set of glyph indexes.

Calls C++ function: QVector<QPointF> QGlyphRun::positions() const.

C++ documentation:

Returns the position of the edge of the baseline for each glyph in this set of glyph indexes.

See also setPositions().

pub unsafe fn raw_font(&self) -> CppBox<QRawFont>[src]

Returns the font selected for this QGlyphRun object.

Calls C++ function: QRawFont QGlyphRun::rawFont() const.

C++ documentation:

Returns the font selected for this QGlyphRun object.

See also setRawFont().

pub unsafe fn set_bounding_rect(
    &self,
    bounding_rect: impl CastInto<Ref<QRectF>>
)
[src]

Sets the bounding rect of the glyphs in this QGlyphRun to be boundingRect. This rectangle will be returned by boundingRect() unless it is empty, in which case the bounding rectangle of the glyphs in the glyph run will be returned instead.

Calls C++ function: void QGlyphRun::setBoundingRect(const QRectF& boundingRect).

C++ documentation:

Sets the bounding rect of the glyphs in this QGlyphRun to be boundingRect. This rectangle will be returned by boundingRect() unless it is empty, in which case the bounding rectangle of the glyphs in the glyph run will be returned instead.

Note: Unless you are implementing text shaping, you should not have to use this function. It is used specifically when the QGlyphRun should represent an area which is smaller than the area of the glyphs it contains. This could happen e.g. if the glyph run is retrieved by calling QTextLayout::glyphRuns() and the specified range only includes part of a ligature (where two or more characters are combined to a single glyph.) When this is the case, the bounding rect should only include the appropriate part of the ligature glyph, based on a calculation of the average width of the characters in the ligature.

In order to support such a case (an example is selections which should be drawn with a different color than the main text color), it is necessary to clip the painting mechanism to the rectangle returned from boundingRect() to avoid drawing the entire ligature glyph.

This function was introduced in Qt 5.0.

See also boundingRect().

pub unsafe fn set_flag_2a(&self, flag: GlyphRunFlag, enabled: bool)[src]

If enabled is true, then flag is enabled; otherwise, it is disabled.

Calls C++ function: void QGlyphRun::setFlag(QGlyphRun::GlyphRunFlag flag, bool enabled = …).

C++ documentation:

If enabled is true, then flag is enabled; otherwise, it is disabled.

This function was introduced in Qt 5.0.

See also flags() and setFlags().

pub unsafe fn set_flag_1a(&self, flag: GlyphRunFlag)[src]

If enabled is true, then flag is enabled; otherwise, it is disabled.

Calls C++ function: void QGlyphRun::setFlag(QGlyphRun::GlyphRunFlag flag).

C++ documentation:

If enabled is true, then flag is enabled; otherwise, it is disabled.

This function was introduced in Qt 5.0.

See also flags() and setFlags().

pub unsafe fn set_flags(&self, flags: QFlags<GlyphRunFlag>)[src]

Sets the flags of this QGlyphRun to flags.

Calls C++ function: void QGlyphRun::setFlags(QFlags<QGlyphRun::GlyphRunFlag> flags).

C++ documentation:

Sets the flags of this QGlyphRun to flags.

This function was introduced in Qt 5.0.

See also setFlag() and flags().

pub unsafe fn set_glyph_indexes(
    &self,
    glyph_indexes: impl CastInto<Ref<QVectorOfU32>>
)
[src]

Set the glyph indexes for this QGlyphRun object to glyphIndexes. The glyph indexes must be valid for the selected font.

Calls C++ function: void QGlyphRun::setGlyphIndexes(const QVector<quint32>& glyphIndexes).

C++ documentation:

Set the glyph indexes for this QGlyphRun object to glyphIndexes. The glyph indexes must be valid for the selected font.

See also glyphIndexes().

pub unsafe fn set_overline(&self, overline: bool)[src]

Indicates that this QGlyphRun should be painted with an overline decoration if overline is true. Otherwise the QGlyphRun should be painted with no overline decoration.

Calls C++ function: void QGlyphRun::setOverline(bool overline).

C++ documentation:

Indicates that this QGlyphRun should be painted with an overline decoration if overline is true. Otherwise the QGlyphRun should be painted with no overline decoration.

See also overline(), setFlag(), and setFlags().

pub unsafe fn set_positions(
    &self,
    positions: impl CastInto<Ref<QVectorOfQPointF>>
)
[src]

Sets the positions of the edge of the baseline for each glyph in this set of glyph indexes to positions.

Calls C++ function: void QGlyphRun::setPositions(const QVector<QPointF>& positions).

C++ documentation:

Sets the positions of the edge of the baseline for each glyph in this set of glyph indexes to positions.

See also positions().

pub unsafe fn set_raw_data(
    &self,
    glyph_index_array: *const u32,
    glyph_position_array: impl CastInto<Ptr<QPointF>>,
    size: c_int
)
[src]

Sets the glyph indexes and positions of this QGlyphRun to use the first size elements in the arrays glyphIndexArray and glyphPositionArray. The data is not copied. The caller must guarantee that the arrays are not deleted as long as this QGlyphRun and any copies of it exists.

Calls C++ function: void QGlyphRun::setRawData(const quint32* glyphIndexArray, const QPointF* glyphPositionArray, int size).

C++ documentation:

Sets the glyph indexes and positions of this QGlyphRun to use the first size elements in the arrays glyphIndexArray and glyphPositionArray. The data is not copied. The caller must guarantee that the arrays are not deleted as long as this QGlyphRun and any copies of it exists.

See also setGlyphIndexes() and setPositions().

pub unsafe fn set_raw_font(&self, raw_font: impl CastInto<Ref<QRawFont>>)[src]

Sets the font in which to look up the glyph indexes to the rawFont specified.

Calls C++ function: void QGlyphRun::setRawFont(const QRawFont& rawFont).

C++ documentation:

Sets the font in which to look up the glyph indexes to the rawFont specified.

See also rawFont() and setGlyphIndexes().

pub unsafe fn set_right_to_left(&self, on: bool)[src]

Indicates that this QGlyphRun contains glyphs that should be ordered from the right to left if rightToLeft is true. Otherwise the order of the glyphs is assumed to be left to right.

Calls C++ function: void QGlyphRun::setRightToLeft(bool on).

C++ documentation:

Indicates that this QGlyphRun contains glyphs that should be ordered from the right to left if rightToLeft is true. Otherwise the order of the glyphs is assumed to be left to right.

This function was introduced in Qt 5.0.

See also isRightToLeft(), setFlag(), and setFlags().

pub unsafe fn set_strike_out(&self, strike_out: bool)[src]

Indicates that this QGlyphRun should be painted with an strike out decoration if strikeOut is true. Otherwise the QGlyphRun should be painted with no strike out decoration.

Calls C++ function: void QGlyphRun::setStrikeOut(bool strikeOut).

C++ documentation:

Indicates that this QGlyphRun should be painted with an strike out decoration if strikeOut is true. Otherwise the QGlyphRun should be painted with no strike out decoration.

See also strikeOut(), setFlag(), and setFlags().

pub unsafe fn set_underline(&self, underline: bool)[src]

Indicates that this QGlyphRun should be painted with an underline decoration if underline is true. Otherwise the QGlyphRun should be painted with no underline decoration.

Calls C++ function: void QGlyphRun::setUnderline(bool underline).

C++ documentation:

Indicates that this QGlyphRun should be painted with an underline decoration if underline is true. Otherwise the QGlyphRun should be painted with no underline decoration.

See also underline(), setFlag(), and setFlags().

pub unsafe fn strike_out(&self) -> bool[src]

Returns true if this QGlyphRun should be painted with a strike out decoration.

Calls C++ function: bool QGlyphRun::strikeOut() const.

C++ documentation:

Returns true if this QGlyphRun should be painted with a strike out decoration.

See also setStrikeOut() and flags().

pub unsafe fn swap(&self, other: impl CastInto<Ref<QGlyphRun>>)[src]

Swaps this glyph run instance with other. This function is very fast and never fails.

Calls C++ function: void QGlyphRun::swap(QGlyphRun& other).

C++ documentation:

Swaps this glyph run instance with other. This function is very fast and never fails.

This function was introduced in Qt 5.0.

pub unsafe fn underline(&self) -> bool[src]

Returns true if this QGlyphRun should be painted with an underline decoration.

Calls C++ function: bool QGlyphRun::underline() const.

C++ documentation:

Returns true if this QGlyphRun should be painted with an underline decoration.

See also setUnderline() and flags().

Trait Implementations

impl CppDeletable for QGlyphRun[src]

unsafe fn delete(&self)[src]

Destroys the QGlyphRun.

Calls C++ function: [destructor] void QGlyphRun::~QGlyphRun().

C++ documentation:

Destroys the QGlyphRun.

impl PartialEq<Ref<QGlyphRun>> for QGlyphRun[src]

fn eq(&self, other: &Ref<QGlyphRun>) -> bool[src]

Compares other to this QGlyphRun object. Returns true if the list of glyph indexes, the list of positions and the font are all equal, otherwise returns false.

Calls C++ function: bool QGlyphRun::operator==(const QGlyphRun& other) const.

C++ documentation:

Compares other to this QGlyphRun object. Returns true if the list of glyph indexes, the list of positions and the font are all equal, otherwise returns false.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.