This class manages rendering text to the screen.
Public Member Functions | |
TextRenderingProperty (Element element) | |
Creates a new text rendering property. Note that this must not be called directly. Set content: instead; if you're doing that from a tag, take a look at BR. More... | |
int | LetterCount () |
Gets how many letters are being rendered. More... | |
void | SetDimensions () |
Recomputes the space size and inner height of the parent element. More... | |
float | StandardSpaceSize () |
The base space size for this text. More... | |
override void | SetOverlayColour (Color colour) |
Called to apply the given colour overlay to this property. More... | |
void | FontLoaded (DynamicFont font) |
Called when an -face font fully loads. More... | |
void | SetText () |
Loads the character array (PowerUI.Css.TextRenderingProperty.Characters) from the text string. More... | |
override void | Paint () |
Called when a paint event occurs. Paint events don't relocate the whole UI so are quick and efficient. More... | |
int | LetterIndex (int widthOffset) |
Gets the letter at the given local position in pixels. More... | |
float | GetPositionOf (int letterID) |
Gets the horizontal position in pixels of the numbered letter. More... | |
float | LocalPositionOf (int letterID) |
Gets the horizontal position in pixels of the numbered letter relative to this element. More... | |
override string | ToString () |
Text3D | Get3D (float scale, Color colour, ref float left, ref float top) |
Gets a 3D representation of this text. More... | |
void | GetExtrudeCounts (out int vertCount, out int triCount, float scale) |
How many verts/ tris must be used to render this text in 3D? More... | |
void | GetExtrude (Text3D text, int vertIndex, int triIndex, int vertCount, int triCount, float scale, ref float left, ref float top) |
Get the verts/ tris/ uv of this in 3D. More... | |
Public Member Functions inherited from PowerUI.Css.DisplayableProperty | |
DisplayableProperty (Element element) | |
Creates a new displayable property for the given element. More... | |
void | SetVisibility (bool visible) |
Call this when the visibility of this property as a whole changes. More... | |
void | SetOverlayColour () |
Sets the overlay colour from the elements colour overlay property. More... | |
void | ColourChanged () |
Call this when any colour of this property has changed. More... | |
virtual void | OnBatchDestroy () |
Called when the isolation batch for this property gets removed. More... | |
void | Change (string property, Value newValue) |
Called when a named css property changes. More... | |
void | ClearBlocks () |
Clears all mesh blocks that this property has allocated. More... | |
void | WentOffScreen () |
Vector3 | MapPX (float x, float y, float z) |
Maps the given pixel location to a world location. More... | |
void | Render () |
Make this property visible by forcing it to redraw. More... | |
void | RequestPaint () |
Requests for a paint event to occur. Note that paint events are more efficient than a layout as they only refresh the mesh colours and uvs rather than the whole mesh. More... | |
void | RequestLayout () |
Requests for a layout event to occur. Note that paint events are more efficient than a layout as they only refresh the mesh colours and uvs rather than the whole mesh. More... | |
MeshBlock | Add () |
Allocates a new mesh block for this property to use. Mesh blocks are the core of how PowerUI displays content. More... | |
void | Transform (Transformation topTransform) |
Transforms all the blocks that this property has allocated. Note that transformations are a post process. More... | |
void | ApplyTransform () |
Applies any transforms (rotate,scale etc) now. Note that tranforms are post-processes so they are very fast and mostly done by paint events. More... | |
void | Isolate () |
Isolates this property from the rest of the UI such that it can have a custom mesh/shader/texture etc. More... | |
void | Include () |
Reverses PowerUI.Css.DisplayableProperty.Isolate by re-including this property in the main UI batch. More... | |
bool | IsIsolated () |
Checks if this is an isolated property - that's one which is seperate and takes its own drawcall. More... | |
void | SetupBatch (TextureAtlas graphics, TextureAtlas font) |
AtlasLocation | RequireImage (AtlasEntity image) |
Public Attributes | |
int | Weight =400 |
Font weight (boldness). 400 is regular. More... | |
bool | Italic |
True if the text should be italic. More... | |
string | Text |
The string to render. Note that this is parsed into PowerUI.Css.TextRenderingProperty.Characters. More... | |
int | FontSize |
The size of the font in pixels. More... | |
float | SpaceSize |
How wide a space should be in pixels. More... | |
Color | BaseColour |
The colour that the font should be without the colour overlay. More... | |
Color | FontColour |
The base colour combined with the colour overlay. More... | |
float | Ascender =1f |
The ascender for the font with the current gap applied. More... | |
float | LineGap =0.2f |
The gap to apply around lines as an em value. More... | |
bool | AllWhitespace |
True if all characters are whitespaces. No batches will be generated. More... | |
float | LetterSpacing |
Additional spacing to apply around letters. More... | |
TextDecorationInfo | TextLine |
How and where a line should be drawn if at all (e.g. underline, overline etc.) More... | |
DynamicFont | FontToDraw |
The font to use when rendering. More... | |
int | EndPunctuationCount |
The number of punctiation characters at the end of the word. More... | |
int | StartPunctuationCount |
The number of punctiation characters at the start of the word. More... | |
Glyph[] | Characters |
The set of characters to render. Note that the characters are shared globally. More... | |
Text3D | Text3D |
The computed 3D extruded text, if there is any. More... | |
float | Extrude |
How far this text is being extruded. More... | |
Public Attributes inherited from PowerUI.Css.DisplayableProperty | |
bool | Visible |
True if this is currently visible on screen. More... | |
bool | Changed |
True if this property has changed its appearance. More... | |
bool | Isolated |
True if this property is isolated and has a seperate mesh and material from everything else. More... | |
int | BlockCount |
The number of mesh blocks that this property has allocated. More... | |
Element | Element |
The parent element that this is a property of. More... | |
MeshBlock | FirstBlock |
The first mesh block that this property has allocated. This is the head of a linked list. More... | |
bool | GotBatchAlready |
Only applies to Isolated properties. Set to true when this property has allocated a UIBatch on the current layout. More... | |
Protected Member Functions | |
override void | NowOffScreen () |
Called when this element goes off screen (or is removed from the DOM). More... | |
override bool | NowOnScreen () |
Called when this element goes on screen. More... | |
override void | Layout () |
Called when a layout event occurs. Layout events relocate the whole UI so should be used less frequently than a paint event. More... | |
Protected Member Functions inherited from PowerUI.Css.DisplayableProperty | |
virtual void | OnChange (string property, Value newValue) |
Called when a named css property changes. More... | |
Properties | |
int | EndSpaceSize [get] |
The width in pixels of the last whitespace of this element, if it's got one. More... | |
Properties inherited from PowerUI.Css.DisplayableProperty | |
bool | Paintable [get] |
Checks if this property can be repainted. More... | |
Private Member Functions | |
void | DrawInvertCharacter (int index, ref float left, float top, Renderman renderer, float zIndex, BoxRegion screenRegion) |
Draws a character with x-inverted UV's. Used for rendering e.g. "1 < 2" in right-to-left. More... | |
void | DrawCharacter (int index, ref float left, float top, Renderman renderer, float zIndex, BoxRegion screenRegion) |
Draws a character and advances the pen onwards. More... | |
Private Attributes | |
float | ScaleFactor |
A scale factor converting the SDF rasters to FontSize units tall. More... | |
float[] | Kerning |
Kern values for this text, if it has any. Created only if it's needed. More... | |
|
inline |
Creates a new text rendering property. Note that this must not be called directly. Set content: instead; if you're doing that from a tag, take a look at BR.
element | The element that this is rendering text for. |
|
inlineprivate |
Draws a character and advances the pen onwards.
|
inlineprivate |
Draws a character with x-inverted UV's. Used for rendering e.g. "1 < 2" in right-to-left.
|
inline |
Called when an -face font fully loads.
|
inline |
Gets a 3D representation of this text.
|
inline |
Get the verts/ tris/ uv of this in 3D.
|
inline |
How many verts/ tris must be used to render this text in 3D?
|
inline |
Gets the horizontal position in pixels of the numbered letter.
letterID | The letter to get. |
|
inlineprotectedvirtual |
Called when a layout event occurs. Layout events relocate the whole UI so should be used less frequently than a paint event.
Reimplemented from PowerUI.Css.DisplayableProperty.
|
inline |
Gets how many letters are being rendered.
|
inline |
Gets the letter at the given local position in pixels.
widthOffset | The position in pixels from the left of this element. |
|
inline |
Gets the horizontal position in pixels of the numbered letter relative to this element.
letterID | The letter to get. |
|
inlineprotectedvirtual |
Called when this element goes off screen (or is removed from the DOM).
Reimplemented from PowerUI.Css.DisplayableProperty.
|
inlineprotectedvirtual |
Called when this element goes on screen.
Reimplemented from PowerUI.Css.DisplayableProperty.
|
inlinevirtual |
Called when a paint event occurs. Paint events don't relocate the whole UI so are quick and efficient.
Reimplemented from PowerUI.Css.DisplayableProperty.
|
inline |
Recomputes the space size and inner height of the parent element.
|
inlinevirtual |
Called to apply the given colour overlay to this property.
colour | The colour overlay to apply. |
Reimplemented from PowerUI.Css.DisplayableProperty.
|
inline |
Loads the character array (PowerUI.Css.TextRenderingProperty.Characters) from the text string.
|
inline |
The base space size for this text.
|
inline |
bool PowerUI.Css.TextRenderingProperty.AllWhitespace |
True if all characters are whitespaces. No batches will be generated.
float PowerUI.Css.TextRenderingProperty.Ascender =1f |
The ascender for the font with the current gap applied.
Color PowerUI.Css.TextRenderingProperty.BaseColour |
The colour that the font should be without the colour overlay.
Glyph [] PowerUI.Css.TextRenderingProperty.Characters |
The set of characters to render. Note that the characters are shared globally.
int PowerUI.Css.TextRenderingProperty.EndPunctuationCount |
The number of punctiation characters at the end of the word.
float PowerUI.Css.TextRenderingProperty.Extrude |
How far this text is being extruded.
Color PowerUI.Css.TextRenderingProperty.FontColour |
The base colour combined with the colour overlay.
int PowerUI.Css.TextRenderingProperty.FontSize |
The size of the font in pixels.
DynamicFont PowerUI.Css.TextRenderingProperty.FontToDraw |
The font to use when rendering.
bool PowerUI.Css.TextRenderingProperty.Italic |
True if the text should be italic.
|
private |
Kern values for this text, if it has any. Created only if it's needed.
float PowerUI.Css.TextRenderingProperty.LetterSpacing |
Additional spacing to apply around letters.
float PowerUI.Css.TextRenderingProperty.LineGap =0.2f |
The gap to apply around lines as an em value.
|
private |
A scale factor converting the SDF rasters to FontSize units tall.
float PowerUI.Css.TextRenderingProperty.SpaceSize |
How wide a space should be in pixels.
int PowerUI.Css.TextRenderingProperty.StartPunctuationCount |
The number of punctiation characters at the start of the word.
string PowerUI.Css.TextRenderingProperty.Text |
The string to render. Note that this is parsed into PowerUI.Css.TextRenderingProperty.Characters.
Text3D PowerUI.Css.TextRenderingProperty.Text3D |
The computed 3D extruded text, if there is any.
TextDecorationInfo PowerUI.Css.TextRenderingProperty.TextLine |
How and where a line should be drawn if at all (e.g. underline, overline etc.)
int PowerUI.Css.TextRenderingProperty.Weight =400 |
Font weight (boldness). 400 is regular.
|
get |
The width in pixels of the last whitespace of this element, if it's got one.