Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SiliconStudio.Paradox.Graphics.SpriteFont Class Reference

SpriteFont to use with SpriteBatch. See SpriteFont to learn how to use it. More...

Inheritance diagram for SiliconStudio.Paradox.Graphics.SpriteFont:
SiliconStudio.Core.ComponentBase SiliconStudio.Core.IComponent SiliconStudio.Core.ICollectorHolder SiliconStudio.Core.IReferencable SiliconStudio.Core.IReferencable

Classes

interface  IFontManager
 
struct  InternalDrawCommand
 Structure InternalDrawCommand used to pass parameters to InternalDrawGlyph
 
struct  InternalUIDrawCommand
 Structure InternalDrawCommand used to pass parameters to InternalDrawGlyph
 
struct  StringProxy
 

Public Member Functions

virtual float GetExtraSpacing (float fontSize)
 Get the value of the extra line spacing for the given font size. More...
 
virtual float GetExtraLineSpacing (float fontSize)
 Get the value of the extra character spacing for the given font size. More...
 
virtual float GetFontDefaultLineSpacing (float fontSize)
 Get the value of the font default line spacing for the given font size. More...
 
float GetTotalLineSpacing (float fontSize)
 Gets the value of the total line spacing (font default + user defined) in pixels for a given font size. More...
 
void PreGenerateGlyphs (string text, Vector2 size)
 Pre-generate synchronously the glyphs of the character needed to render the provided text at the provided size. More...
 
Vector2 MeasureString (string text)
 Returns the width and height of the provided text for the current font size Size More...
 
Vector2 MeasureString (StringBuilder text)
 Returns the width and height of the provided text for the current font size Size More...
 
Vector2 MeasureString (string text, float fontSize)
 Returns the width and height of the provided text for a given font size More...
 
Vector2 MeasureString (StringBuilder text, float fontSize)
 Returns the width and height of the provided text for a given font size More...
 
Vector2 MeasureString (string text, Vector2 fontSize)
 Returns the width and height of the provided text for a given font size More...
 
Vector2 MeasureString (StringBuilder text, Vector2 fontSize)
 Returns the width and height of the provided text for a given font size More...
 
Vector2 MeasureString (string text, ref Vector2 fontSize)
 Returns the width and height of the provided text for a given font size More...
 
Vector2 MeasureString (StringBuilder text, ref Vector2 fontSize)
 Returns the width and height of the provided text for a given font size More...
 
Vector2 MeasureString (string text, Vector2 fontSize, int length)
 Returns the width and height of the provided text for a given font size More...
 
Vector2 MeasureString (StringBuilder text, Vector2 fontSize, int length)
 Returns the width and height of the provided text for a given font size More...
 
Vector2 MeasureString (string text, ref Vector2 fontSize, int length)
 Returns the width and height of the provided text for a given font size More...
 
Vector2 MeasureString (StringBuilder text, ref Vector2 fontSize, int length)
 Returns the width and height of the provided text for a given font size More...
 
virtual bool IsCharPresent (char c)
 Checks whether the provided character is present in the character map of the current SpriteFont. More...
 
- Public Member Functions inherited from SiliconStudio.Core.ComponentBase
void Dispose ()
 
override string ToString ()
 

Static Public Attributes

static readonly Logger Logger = GlobalLogger.GetLogger("SpriteFont")
 

Protected Member Functions

 SpriteFont (FontSystem fontSystem, SpriteFontData fontData, bool isDynamic)
 
override void Destroy ()
 Disposes of object resources. More...
 
virtual float GetBaseOffsetY (float fontSize)
 Get the value of the base offset for the given font size. More...
 
virtual Glyph GetGlyph (char character, ref Vector2 fontSize, bool uploadGpuResources)
 Return the glyph associated to provided character at the given size. More...
 
- Protected Member Functions inherited from SiliconStudio.Core.ComponentBase
 ComponentBase ()
 Initializes a new instance of the ComponentBase class. More...
 
 ComponentBase (string name)
 Initializes a new instance of the ComponentBase class. More...
 
virtual void OnNameChanged ()
 Called when Name property was changed. More...
 

Protected Attributes

readonly FontSystem FontSystem
 The SiliconStudio.Paradox.Graphics.Font.FontSystem that is managing this sprite font. More...
 
SwizzleMode Swizzle
 
float BaseOffsetY
 
float DefaultLineSpacing
 
readonly Dictionary< int, float > KerningMap = new Dictionary<int, float>()
 

Properties

IReadOnlyList< Texture2DTextures [get, set]
 
float Size [get, set]
 Gets the font size (resp. the default font size) for static fonts (resp. for dynamic fonts) in pixels. More...
 
char DefaultCharacter [get, set]
 Gets or sets the default character for the font. More...
 
bool IgnoreUnkownCharacters [get, set]
 Completely skips characters that are not in the map. More...
 
float ExtraSpacing [get, set]
 Gets or sets extra spacing (in pixels) between the characters for the current font Size. This value is scaled during the draw in the case of dynamic fonts. Use GetExtraSpacing to get the value of the extra spacing for a given font size. More...
 
float ExtraLineSpacing [get, set]
 Gets or sets the extra line spacing (in pixels) to add to the default font line spacing for the current font Size. This value will be scaled during the draw in the case of dynamic fonts. Use GetExtraLineSpacing to get the value of the extra spacing for a given font size. More...
 
bool IsDynamic [get, set]
 Gets a boolean indicating if the current font is dynamic or not. More...
 
- Properties inherited from SiliconStudio.Core.ComponentBase
long Id [get, set]
 
string Name [get, set]
 Gets or sets the name of this component. More...
 
bool IsDisposed [get, set]
 Has the component been disposed or not yet. More...
 
- Properties inherited from SiliconStudio.Core.IComponent
long Id [get]
 Gets the id of this component. More...
 
string Name [get]
 Gets the name of this component. More...
 
- Properties inherited from SiliconStudio.Core.IReferencable
int ReferenceCount [get]
 Gets the reference count of this instance. More...
 
- Properties inherited from SiliconStudio.Core.ICollectorHolder
ObjectCollector Collector [get]
 Gets the collector. More...
 

Additional Inherited Members

- Public Attributes inherited from SiliconStudio.Core.ComponentBase
PropertyContainer Tags
 Gets the attached properties to this component. More...
 

Detailed Description

SpriteFont to use with SpriteBatch. See SpriteFont to learn how to use it.

Definition at line 26 of file SpriteFont.cs.

Constructor & Destructor Documentation

SiliconStudio.Paradox.Graphics.SpriteFont.SpriteFont ( FontSystem  fontSystem,
SpriteFontData  fontData,
bool  isDynamic 
)
protected

Definition at line 94 of file SpriteFont.cs.

Member Function Documentation

override void SiliconStudio.Paradox.Graphics.SpriteFont.Destroy ( )
protectedvirtual

Disposes of object resources.

Reimplemented from SiliconStudio.Core.ComponentBase.

Definition at line 110 of file SpriteFont.cs.

virtual float SiliconStudio.Paradox.Graphics.SpriteFont.GetBaseOffsetY ( float  fontSize)
protectedvirtual

Get the value of the base offset for the given font size.

Parameters
fontSizeThe font size in pixels
Returns
The value of the base offset

Definition at line 158 of file SpriteFont.cs.

virtual float SiliconStudio.Paradox.Graphics.SpriteFont.GetExtraLineSpacing ( float  fontSize)
virtual

Get the value of the extra character spacing for the given font size.

Parameters
fontSizeThe font size in pixels
Returns
The value of the character spacing

Definition at line 138 of file SpriteFont.cs.

virtual float SiliconStudio.Paradox.Graphics.SpriteFont.GetExtraSpacing ( float  fontSize)
virtual

Get the value of the extra line spacing for the given font size.

Parameters
fontSizeThe font size in pixels
Returns
The value of the character spacing

Definition at line 128 of file SpriteFont.cs.

virtual float SiliconStudio.Paradox.Graphics.SpriteFont.GetFontDefaultLineSpacing ( float  fontSize)
virtual

Get the value of the font default line spacing for the given font size.

Parameters
fontSizeThe font size in pixels
Returns
The value of the default line spacing

Definition at line 148 of file SpriteFont.cs.

virtual Glyph SiliconStudio.Paradox.Graphics.SpriteFont.GetGlyph ( char  character,
ref Vector2  fontSize,
bool  uploadGpuResources 
)
protectedvirtual

Return the glyph associated to provided character at the given size.

Parameters
characterThe character we want the glyph of
fontSizeThe font size in pixel
uploadGpuResourcesIndicate if the GPU resource should be uploaded or not.
Returns
The glyph corresponding to the request or null if not existing

Definition at line 425 of file SpriteFont.cs.

float SiliconStudio.Paradox.Graphics.SpriteFont.GetTotalLineSpacing ( float  fontSize)

Gets the value of the total line spacing (font default + user defined) in pixels for a given font size.

Line spacing is the distance between the base lines of two consecutive lines of text (blank space as well as characters' height are thus included).

Definition at line 167 of file SpriteFont.cs.

virtual bool SiliconStudio.Paradox.Graphics.SpriteFont.IsCharPresent ( char  c)
virtual

Checks whether the provided character is present in the character map of the current SpriteFont.

Parameters
cThe character to check.
Returns
true if the c is present in the character map, false - otherwise.

Definition at line 413 of file SpriteFont.cs.

Vector2 SiliconStudio.Paradox.Graphics.SpriteFont.MeasureString ( string  text)

Returns the width and height of the provided text for the current font size Size

Parameters
textThe string to measure.
Returns
Vector2.

Definition at line 264 of file SpriteFont.cs.

References SiliconStudio.Core.Mathematics.Vector2.Length().

Vector2 SiliconStudio.Paradox.Graphics.SpriteFont.MeasureString ( StringBuilder  text)

Returns the width and height of the provided text for the current font size Size

Parameters
textThe string to measure.
Returns
Vector2.

Definition at line 274 of file SpriteFont.cs.

References SiliconStudio.Core.Mathematics.Vector2.Length().

Vector2 SiliconStudio.Paradox.Graphics.SpriteFont.MeasureString ( string  text,
float  fontSize 
)

Returns the width and height of the provided text for a given font size

Parameters
textThe string to measure.
fontSizeThe size of the font (ignored in the case of static fonts)
Returns
Vector2.

Definition at line 285 of file SpriteFont.cs.

References SiliconStudio.Core.Mathematics.Vector2.Length().

Vector2 SiliconStudio.Paradox.Graphics.SpriteFont.MeasureString ( StringBuilder  text,
float  fontSize 
)

Returns the width and height of the provided text for a given font size

Parameters
textThe string to measure.
fontSizeThe size of the font (ignored in the case of static fonts)
Returns
Vector2.

Definition at line 296 of file SpriteFont.cs.

References SiliconStudio.Core.Mathematics.Vector2.Length().

Vector2 SiliconStudio.Paradox.Graphics.SpriteFont.MeasureString ( string  text,
Vector2  fontSize 
)

Returns the width and height of the provided text for a given font size

Parameters
textThe string to measure.
fontSizeThe size of the font (ignored in the case of static fonts)
Returns
Vector2.

Definition at line 307 of file SpriteFont.cs.

References SiliconStudio.Core.Mathematics.Vector2.Length().

Vector2 SiliconStudio.Paradox.Graphics.SpriteFont.MeasureString ( StringBuilder  text,
Vector2  fontSize 
)

Returns the width and height of the provided text for a given font size

Parameters
textThe string to measure.
fontSizeThe size of the font (ignored in the case of static fonts)
Returns
Vector2.

Definition at line 318 of file SpriteFont.cs.

References SiliconStudio.Core.Mathematics.Vector2.Length().

Vector2 SiliconStudio.Paradox.Graphics.SpriteFont.MeasureString ( string  text,
ref Vector2  fontSize 
)

Returns the width and height of the provided text for a given font size

Parameters
textThe string to measure.
fontSizeThe size of the font (ignored in the case of static fonts)
Returns
Vector2.

Definition at line 329 of file SpriteFont.cs.

Vector2 SiliconStudio.Paradox.Graphics.SpriteFont.MeasureString ( StringBuilder  text,
ref Vector2  fontSize 
)

Returns the width and height of the provided text for a given font size

Parameters
textThe string to measure.
fontSizeThe size of the font (ignored in the case of static fonts)
Returns
Vector2.

Definition at line 340 of file SpriteFont.cs.

Vector2 SiliconStudio.Paradox.Graphics.SpriteFont.MeasureString ( string  text,
Vector2  fontSize,
int  length 
)

Returns the width and height of the provided text for a given font size

Parameters
textThe string to measure.
fontSizeThe size of the font (ignored in the case of static fonts)
lengthThe length of the string to measure
Returns
Vector2.

Definition at line 352 of file SpriteFont.cs.

Vector2 SiliconStudio.Paradox.Graphics.SpriteFont.MeasureString ( StringBuilder  text,
Vector2  fontSize,
int  length 
)

Returns the width and height of the provided text for a given font size

Parameters
textThe string to measure.
fontSizeThe size of the font (ignored in the case of static fonts)
lengthThe length of the string to measure
Returns
Vector2.

Definition at line 364 of file SpriteFont.cs.

Vector2 SiliconStudio.Paradox.Graphics.SpriteFont.MeasureString ( string  text,
ref Vector2  fontSize,
int  length 
)

Returns the width and height of the provided text for a given font size

Parameters
textThe string to measure.
fontSizeThe size of the font (ignored in the case of static fonts)
lengthThe length of the string to measure
Returns
Vector2.

Definition at line 376 of file SpriteFont.cs.

Vector2 SiliconStudio.Paradox.Graphics.SpriteFont.MeasureString ( StringBuilder  text,
ref Vector2  fontSize,
int  length 
)

Returns the width and height of the provided text for a given font size

Parameters
textThe string to measure.
fontSizeThe size of the font (ignored in the case of static fonts)
lengthThe length of the string to measure
Returns
Vector2.

Definition at line 392 of file SpriteFont.cs.

void SiliconStudio.Paradox.Graphics.SpriteFont.PreGenerateGlyphs ( string  text,
Vector2  size 
)

Pre-generate synchronously the glyphs of the character needed to render the provided text at the provided size.

Parameters
textThe text containing the characters to pre-generate
sizeThe size of the font

Definition at line 189 of file SpriteFont.cs.

Member Data Documentation

float SiliconStudio.Paradox.Graphics.SpriteFont.BaseOffsetY
protected

Definition at line 53 of file SpriteFont.cs.

float SiliconStudio.Paradox.Graphics.SpriteFont.DefaultLineSpacing
protected

Definition at line 54 of file SpriteFont.cs.

readonly FontSystem SiliconStudio.Paradox.Graphics.SpriteFont.FontSystem
protected

The SiliconStudio.Paradox.Graphics.Font.FontSystem that is managing this sprite font.

Definition at line 33 of file SpriteFont.cs.

readonly Dictionary<int, float> SiliconStudio.Paradox.Graphics.SpriteFont.KerningMap = new Dictionary<int, float>()
protected

Definition at line 55 of file SpriteFont.cs.

readonly Logger SiliconStudio.Paradox.Graphics.SpriteFont.Logger = GlobalLogger.GetLogger("SpriteFont")
static

Definition at line 51 of file SpriteFont.cs.

SwizzleMode SiliconStudio.Paradox.Graphics.SpriteFont.Swizzle
protected

Definition at line 52 of file SpriteFont.cs.

Property Documentation

char SiliconStudio.Paradox.Graphics.SpriteFont.DefaultCharacter
getset

Gets or sets the default character for the font.

Definition at line 67 of file SpriteFont.cs.

float SiliconStudio.Paradox.Graphics.SpriteFont.ExtraLineSpacing
getset

Gets or sets the extra line spacing (in pixels) to add to the default font line spacing for the current font Size. This value will be scaled during the draw in the case of dynamic fonts. Use GetExtraLineSpacing to get the value of the extra spacing for a given font size.

Line spacing is the distance between the base lines of two consecutive lines of text (blank space as well as characters' height are thus included).

Definition at line 87 of file SpriteFont.cs.

float SiliconStudio.Paradox.Graphics.SpriteFont.ExtraSpacing
getset

Gets or sets extra spacing (in pixels) between the characters for the current font Size. This value is scaled during the draw in the case of dynamic fonts. Use GetExtraSpacing to get the value of the extra spacing for a given font size.

Definition at line 79 of file SpriteFont.cs.

bool SiliconStudio.Paradox.Graphics.SpriteFont.IgnoreUnkownCharacters
getset

Completely skips characters that are not in the map.

Definition at line 72 of file SpriteFont.cs.

bool SiliconStudio.Paradox.Graphics.SpriteFont.IsDynamic
getset

Gets a boolean indicating if the current font is dynamic or not.

Definition at line 92 of file SpriteFont.cs.

float SiliconStudio.Paradox.Graphics.SpriteFont.Size
getset

Gets the font size (resp. the default font size) for static fonts (resp. for dynamic fonts) in pixels.

Definition at line 62 of file SpriteFont.cs.

Referenced by SiliconStudio.Paradox.Graphics.SpriteBatch.MeasureString().

IReadOnlyList<Texture2D> SiliconStudio.Paradox.Graphics.SpriteFont.Textures
getset

Definition at line 57 of file SpriteFont.cs.


The documentation for this class was generated from the following file: