Magnum::Ui::TextProperties class new in Git master

Text properties.

Constructors, destructors, conversion operators

TextProperties()
Default constructor.
TextProperties(Text::Alignment alignment)
Construct with an alignment.
TextProperties(FontHandle font)
Construct with a font.
TextProperties(FontHandle font, Text::Alignment alignment)
Construct with a font and an alignment.
TextProperties(const TextProperties&) deleted
Copying is not allowed.
TextProperties(TextProperties&&) noexcept
Move constructor.

Public functions

auto operator=(const TextProperties&) -> TextProperties& deleted
Copying is not allowed.
auto operator=(TextProperties&&) -> TextProperties& noexcept
Move assignment.
auto alignment() const -> Containers::Optional<Text::Alignment>
Alignment.
auto setAlignment(const Containers::Optional<Text::Alignment>& alignment) & -> TextProperties&
Set alignment.
auto setAlignment(const Containers::Optional<Text::Alignment>& alignment) && -> TextProperties&&
auto font() const -> FontHandle
Font for the whole text.
auto setFont(FontHandle font) & -> TextProperties&
Set font for the whole text.
auto setFont(FontHandle font) && -> TextProperties&&
auto script() const -> Text::Script
Script for the whole text.
auto setScript(Text::Script script) & -> TextProperties&
Set script for the whole text.
auto setScript(Text::Script script) && -> TextProperties&&
auto language() const -> Containers::StringView
Language for the whole text.
auto setLanguage(Containers::StringView language) & -> TextProperties&
Set language for the whole text.
auto setLanguage(Containers::StringView language) && -> TextProperties&&
auto shapeDirection() const -> Text::ShapeDirection
Shaping direction for the whole text.
auto setShapeDirection(Text::ShapeDirection direction) & -> TextProperties&
Set shaping direction for the whole text.
auto setShapeDirection(Text::ShapeDirection direction) && -> TextProperties&&
auto layoutDirection() const -> Text::LayoutDirection
Layout direction.
auto setLayoutDirection(Text::LayoutDirection direction) & -> TextProperties&
Set layout direction.
auto setLayoutDirection(Text::LayoutDirection direction) && -> TextProperties&&
auto features() const -> Containers::ArrayView<const Text::FeatureRange>
Typographic features.
auto setFeatures(Containers::ArrayView<const Text::FeatureRange> features) & -> TextProperties&
Set typographic features.
auto setFeatures(Containers::ArrayView<const Text::FeatureRange> features) && -> TextProperties&&
auto setFeatures(std::initializer_list<Text::FeatureRange> features) & -> TextProperties&
auto setFeatures(std::initializer_list<Text::FeatureRange> features) && -> TextProperties&&

Function documentation

Magnum::Ui::TextProperties::TextProperties(Text::Alignment alignment)

Construct with an alignment.

Equivalent to constructing with TextProperties() and then calling setAlignment(). See its documentation for value restrictions.

Magnum::Ui::TextProperties::TextProperties(FontHandle font)

Construct with a font.

Equivalent to constructing with TextProperties() and then calling setFont().

Magnum::Ui::TextProperties::TextProperties(FontHandle font, Text::Alignment alignment)

Construct with a font and an alignment.

Equivalent to constructing with TextProperties() and then calling setFont() and setAlignment(). See documentation of the latter for value restrictions.

TextProperties& Magnum::Ui::TextProperties::setAlignment(const Containers::Optional<Text::Alignment>& alignment) &

Set alignment.

Returns Reference to self (for method chaining)

Default is Containers::NullOpt, i.e. an alignment specified by the style is used. If not Containers::NullOpt, expects that the alignment isn't *GlyphBounds as the implementation can only align based on font metrics and cursor position, not actual glyph bounds.

In addition to the behavior in particular Text::Alignment values, the aligned origin is then further offset respectively to the node the text is attached to. In particular:

  • *Left makes the horizontal origin aligned with node left side
  • *Right makes the horizontal origin aligned with node right side
  • *Center makes the horizontal origin aligned with horizontal node center, and additionally *Integral rounds the horizontal offset inside the node to whole units
  • *Top makes the vertical origin aligned with node top side
  • *Bottom makes the vertical origin aligned with node bottom side
  • *Line and *Middle makes the vertical origin aligned with vertical node center, and additionally *Integral rounds the vertical offset inside the node to whole units. The difference between the two is that multiple texts with different font metrics get their line positions matched with *Line, while *Middle makes the midpoint between font ascent and descent matched.

TextProperties&& Magnum::Ui::TextProperties::setAlignment(const Containers::Optional<Text::Alignment>& alignment) &&

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

TextProperties& Magnum::Ui::TextProperties::setFont(FontHandle font) &

Set font for the whole text.

Returns Reference to self (for method chaining)

Default is FontHandle::Null, i.e. the default font for given style is used.

TextProperties&& Magnum::Ui::TextProperties::setFont(FontHandle font) &&

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

TextProperties& Magnum::Ui::TextProperties::setScript(Text::Script script) &

Set script for the whole text.

Returns Reference to self (for method chaining)

Default is Text::Script::Unspecified, i.e. the font shaper may attempt to guess the script from the input text. See the documentation of Text::AbstractShaper for more information about how script, language and direction setting affects the shaped text.

TextProperties&& Magnum::Ui::TextProperties::setScript(Text::Script script) &&

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Containers::StringView Magnum::Ui::TextProperties::language() const

Language for the whole text.

The returned view is only guaranteed to be valid for as long as the TextProperties instance is alive, or until setLanguage() is called.

TextProperties& Magnum::Ui::TextProperties::setLanguage(Containers::StringView language) &

Set language for the whole text.

Returns Reference to self (for method chaining)

The language is expected to be a BCP 47 language tag, either just the base tag such as "en" or "cs" alone, or further differentiating with a region subtag like for example "en-US" vs "en-GB", at most 15 bytes long.

Default is an empty string, i.e. the font shaper may attempt to guess the language from the input text. See the documentation of Text::AbstractShaper for more information about how script, language and direction setting affects the shaped text.

TextProperties&& Magnum::Ui::TextProperties::setLanguage(Containers::StringView language) &&

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

TextProperties& Magnum::Ui::TextProperties::setShapeDirection(Text::ShapeDirection direction) &

Set shaping direction for the whole text.

Returns Reference to self (for method chaining)

Default is Text::ShapeDirection::Unspecified, i.e. the font shaper may attempt to guess the direction from the input text. See the documentation of Text::AbstractShaper for more information about how script, language and direction setting affects the shaped text.

TextProperties&& Magnum::Ui::TextProperties::setShapeDirection(Text::ShapeDirection direction) &&

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

TextProperties& Magnum::Ui::TextProperties::setLayoutDirection(Text::LayoutDirection direction) &

Set layout direction.

Returns Reference to self (for method chaining)

Default is Text::LayoutDirection::HorizontalTopToBottom. Unlike shape direction, script, language and font properties, which may be different for different parts of the text, the layout direction is always for the whole text.

TextProperties&& Magnum::Ui::TextProperties::setLayoutDirection(Text::LayoutDirection direction) &&

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Containers::ArrayView<const Text::FeatureRange> Magnum::Ui::TextProperties::features() const

Typographic features.

The returned view is only guaranteed to be valid for as long as the TextProperties instance is alive.

TextProperties& Magnum::Ui::TextProperties::setFeatures(Containers::ArrayView<const Text::FeatureRange> features) &

Set typographic features.

Returns Reference to self (for method chaining)

By default no features are explicitly set, relying on features supplied by the style, if any, and then default behavior of a particular font file and a font plugin. A copy of features is made internally, is appended to features coming from the style and subsequently passed to Text::AbstractShaper::shape(). See its documentation for details and information about various constraints.

TextProperties&& Magnum::Ui::TextProperties::setFeatures(Containers::ArrayView<const Text::FeatureRange> features) &&

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

TextProperties& Magnum::Ui::TextProperties::setFeatures(std::initializer_list<Text::FeatureRange> features) &

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

TextProperties&& Magnum::Ui::TextProperties::setFeatures(std::initializer_list<Text::FeatureRange> features) &&

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.