Struct sfml::graphics::Text [] [src]

pub struct Text<'s> { /* fields omitted */ }

Graphical text

Text is a drawable type that allows to easily display some text with custom style and color on a render target.

Methods

impl<'s> Text<'s>
[src]

Create a new text

Create a new text with initialized value

Default value for characterSize on SFML is 30.

Arguments

  • string - The string of the text
  • font - The font to display the Text
  • characterSize - The size of the Text

Set the string of a text

A text's string is empty by default.

Arguments

  • string - New string

Get the string of a text

Get the size of the characters

Return the size of the characters

Set the font of the text

The font argument refers to a texture that must exist as long as the text uses it. Indeed, the text doesn't store its own copy of the font, but rather keeps a pointer to the one that you passed to this function. If the font is destroyed and the text tries to use it, the behaviour is undefined.

font - New font

Set the style of a text

You can pass a combination of one or more styles, for example Bold | Italic. The default style is Regular.

Arguments

  • style - New style

Set the size of the characters of a text

The default size is 30.

Arguments

  • size - The new character size, in pixels

Get the style of a text

Return the current string style (see Style enum)

Get the font of a text If the text has no font attached, a None is returned. The returned pointer is const, which means that you can't modify the font when you retrieve it with this function.

Set the fill color of the text.

By default, the text's fill color is opaque white. Setting the fill color to a transparent color with an outline will cause the outline to be displayed in the fill area of the text.

Set the outline color of the text.

By default, the text's outline color is opaque black.

Set the thickness of the text's outline.

By default, the outline thickness is 0.

Be aware that using a negative value for the outline thickness will cause distorted rendering.

Returns the fill color of the text.

Returns the outline color of the text.

Returns the outline thickness of the text, in pixels.

Return the position of the index-th character in a text

This function computes the visual position of a character from its index in the string. The returned position is in global coordinates (translation, rotation, scale and origin are applied). If index is out of range, the position of the end of the string is returned.

Arguments

  • index - The index of the character

Return the position of the character

Get the local bounding rectangle of a text

The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.

Return the local bounding rectangle of the entity

Get the global bounding rectangle of a text

The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the text in the global 2D world's coordinate system.

Return the global bounding rectangle of the entity

Trait Implementations

impl<'s> Default for Text<'s>
[src]

Returns the "default value" for a type. Read more

impl<'s> Clone for Text<'s>
[src]

Return a new Text or panic! if there is not enough memory

Performs copy-assignment from source. Read more

impl<'s> Drawable for Text<'s>
[src]

Draw a drawable object into a RenderTarget

impl<'s> Transformable for Text<'s>
[src]

Sets the position of the object. Read more

Sets the position of the object. Read more

Set the orientation of the object. Read more

Sets the scale factors of the object. Read more

Sets the scale factors of the object. Read more

Sets the local origin of the object. Read more

Sets the local origin of the object. Read more

Gets the position of the object.

Gets the rotation of the object. Read more

Gets the current scale of the object.

Gets the local origin of the object.

Moves the object by a given offset. Read more

Moves the object by a given offset. Read more

Rotates the object. Read more

Scales the object. Read more

Scales the object. Read more

Gets the combined transform of the object.

Gets the inverse combined transform of the object.

impl<'s> Raw for Text<'s>
[src]

The raw representation of this type.

Acquires the raw representation of this type through &self.

impl<'s> Drop for Text<'s>
[src]

A method called when the value goes out of scope. Read more