sf.String Class Reference
sf.String defines a graphical 2D text, that can be drawn on screen.
Default constructor : String ()
Construct the string from an unicode or an ascii string : String(Text, Font=sf.Font.GetDefaultFont(), Size=30.)
Text : Text assigned to the string
Font : Font used to draw the string (SFML built-in font by default)
Size : Characters size (30 by default)
Attributes
Bold
Italic
Regular
Underlined
Methods
GetCenter()
Get the center of the object, in coordinates relative to the object.
Inherited
GetCharacterPos(Index)
Return the visual position (a tuple of two floats) of the Index-th character of the string, in coordinates relative to the string (note : translation, center, rotation and scale are not applied)
Index : Index of the character
GetColor()
Get the color of the object.
Inherited
GetFont()
Get the font used by the string.
GetPosition()
Get the position of the object.
Inherited
GetRect()
Get the string rectangle on screen.
GetRotation()
Get the orientation of the object.
Inherited
GetScale()
Get the scale of the object.
Inherited
GetSize()
Get the size of the characters.
GetStyle()
Get the style of the text.
GetText()
Get the text as an unicode string.
Move(OffsetX, OffsetY)
Move the object.
OffsetX : X offset
OffsetY : Y offset
Inherited
Rotate(Angle)
Rotate the object.
Angle : Angle of rotation, in degrees
Inherited
Scale(FactorX, FactorY)
Scale the object.
FactorX : Scaling factor on X (must be strictly positive)
FactorY : Scaling factor on Y (must be strictly positive)
Inherited
SetBlendMode(Mode)
Set the blending mode for the object. The default blend mode is sf.Blend.Alpha
Mode : New blending mode
Inherited
SetCenter(CenterX, CenterY)
Set the center of the object, in coordinates relative to the object.
CenterX : X coordinate of the center
CenterY : Y coordinate of the center
Inherited
SetColor(Color)
Set the color of the object.
Color : New color
Inherited
SetFont(Font)
Set the font of the string.
Font : font to use
SetPosition(X, Y)
Set the position of the object.
X : New X coordinate
Y : New Y coordinate
Inherited
SetRotation(Rotation)
Set the orientation of the object.
Rotation : Angle of rotation, in degrees
Inherited
SetScale(ScaleX, ScaleY)
Set the scale of the object.
ScaleX : New horizontal scale (must be strictly positive)
ScaleY : New vertical scale (must be strictly positive)
Inherited
SetScaleX(ScaleX)
Set the X scale factor of the object.
ScaleX : New horizontal scale (must be strictly positive)
Inherited
SetScaleY(ScaleY)
Set the Y scale factor of the object.
ScaleY : New vertical scale (must be strictly positive)
Inherited
SetSize(Size)
Set the size of the string.
Size : New size, in pixels
SetStyle(TextSize)
Set the style of the text. The default style is Regular.
TextSize : New text style, (combination of Style values)
SetText(UnicodeText) or SetText(Text, Encoding='utf8')
Set the text. Valid encodings are 'utf8', 'utf16' and 'utf32'.
Text : New text
SetX(X)
Set the X position of the object.
X : New X coordinate
Inherited
SetY(Y)
Set the Y position of the object.
Y : New Y coordinate
Inherited
TransformToGlobal(X, Y)
Transform a point from local coordinates into global coordinates (ie it applies the object's center, translation, rotation and scale to the point). Returns a tuple.
X : X coordinate of the point to transform
Y : Y coordinate of the point to transform
Inherited
TransformToLocal(X, Y)
Transform a point from global coordinates into local coordinates (ie it applies the inverse of object's center, translation, rotation and scale to the point). Returns a tuple.
X : X coordinate of the point to transform
Y : Y coordinate of the point to transform
Inherited