Detailed Description

Represents a character within a font for display on the screen. Extends the InfiniText glyph object. This saves memory and avoids fragmentation.

A raw glyph in the font. With this you can access the raw outline (as it's also a vector) and stats about this glyph. Its size is relative; it's stored as if it's a 1px font.

Inheritance diagram for InfiniText.Glyph:
Blaze.VectorPath Blaze.AtlasEntity InfiniText.CompositeGlyph

Public Member Functions

void OnScreen ()
 Called when this character goes on screen. More...
 
void OffScreen ()
 Called when this character goes on screen. More...
 
void SetupImage (ImagePackage package)
 Called when an image is found for this character. Used by e.g. Emoji. More...
 
bool AddToFont (string name, int charcode)
 Add this glyph to the named font. Can override existing characters. More...
 
bool AddToFont (string name, string charcode)
 Add this glyph to the named font. Can override existing characters. More...
 
virtual void LoadNow ()
 Completes the load of this glyph. You must have checked RequiresLoad first. More...
 
bool MultiThreadDraw ()
 True if DrawToAtlas can be multithreaded for this object. More...
 
void GetDimensionsOnAtlas (out int width, out int height)
 Gets the dimensions of this entity on an atlas. More...
 
bool DrawToAtlas (TextureAtlas atlas, AtlasLocation location)
 Draws this entity to the given atlas now. More...
 
int GetAtlasID ()
 A globally unique ID that can be used to identify the image being held. More...
 
bool Rasterise (Color32[] atlasPixels, int atlasWidth, int baseIndex, bool clear)
 
 Glyph ()
 
 Glyph (FontFace parent)
 
Glyph Copy ()
 
void AddKerningPair (Glyph beforeThis, float value)
 
void AddCharcode (int charCode)
 
virtual void LoadFully (Glyph[] glyphs)
 
- Public Member Functions inherited from Blaze.VectorPath
void HoleSort ()
 Sorts this path such that any holes it contains begin closest to it's containing contour. This essentially allows paths with holes (think hole in o!) to be correctly triangulated. More...
 
VectorPoint Nearest (float x, float y)
 Gets the nearest node in this shape to the given point. More...
 
VectorPoint Nearest (float x, float y, VectorPoint from, VectorPoint to)
 Gets the nearest node in the given section of this shape to the given point. More...
 
bool Contains (float x, float y)
 Does this path contain the given point? More...
 
bool Contains (float x, float y, VectorPoint from, VectorPoint to)
 Does the given section of this path contain the given point? More...
 
void GetVertices (Vector3[] vertices, Vector3[] normals, float accuracy, float offsetX, float offsetY, float scale, ref int index, List< int > contourStarts)
 
int GetVertexCount (float accuracy)
 
void MoveTo (float x, float y)
 Moves the current pen location to the given point. Used when drawing paths. More...
 
void CopyInto (VectorPath path)
 Copies this vector path into the given one. More...
 
void Clear ()
 Clears this path. More...
 
void AddPathNode (VectorPoint point)
 Adds the given node to this path. More...
 
void ClosePathFast ()
 Closes the path quickly and safely. More...
 
void ClosePath ()
 A full path close. More...
 
void CloseLast ()
 Marks the last node as a close. More...
 
StraightLinePoint LineTo (float x, float y)
 
QuadLinePoint QuadraticCurveTo (float cx, float cy, float x, float y)
 
void CurveTo (float c1x, float c1y, float c2x, float c2y, float x, float y)
 
void RecalculateMeta ()
 Recalculates bounds and normals. More...
 
void RecalculateBounds ()
 Recalculates the minimum values and width/height of this path, taking curves into account. More...
 
void RecalculateNormals ()
 Recalculates the normals of this path. Not required unless you're using SDF. More...
 
void Extrude (float by)
 Extrudes this path along it's normals. Used to e.g. make something bold. Assumes one or more closed loops and that RecalculateNormals has been called. More...
 
void Sheer (float by)
 Sheers this path. Note that it's assumed to be at most 1 unit tall. More...
 
void MultiplyNormals (float by)
 Multiply the normals of this path by the given value. More...
 
void Scale (float by)
 Scales this path by the given value. More...
 
float GetSignedArea ()
 Gets the signed area of the "major" contour (the first one). It's signed as this can identify the winding order. More...
 
override string ToString ()
 

Public Attributes

ImagePackage Image
 A graphical image representation of this character for e.g. Emoji. More...
 
AtlasLocation Location
 The rendered location of this SDF character. Also tracks on-screen counts internally. More...
 
int UniqueID
 A globally unique ID for this glyph. Used with font atlases. More...
 
FontFace Font
 The font face this is a glyph from. More...
 
int RawCharcode
 The first charcode to assign itself to this glyph. More...
 
float AdvanceWidth
 The amount to advance by when this glyph is displayed. More...
 
float LeftSideBearing
 The left side bearing. An offset of this glyph. More...
 
Dictionary< Glyph, float > Kerning
 A group of kerning pairs and their offsets. More...
 
- Public Attributes inherited from Blaze.VectorPath
float MinX
 The minimum X value. More...
 
float MinY
 The minimum Y value. More...
 
float Width
 The width of this path. More...
 
float Height =1f
 The height of this path. More...
 
int PathNodeCount
 The number of points in this vector path. More...
 
MoveToPoint CloseNode
 The current node which will be used when the path is closed. More...
 
VectorPoint FirstPathNode
 When creating a path its nodes are stored as a linked list. The first node created. More...
 
VectorPoint LatestPathNode
 When creating a path its nodes are stored as a linked list. The latest node created. More...
 

Properties

bool Rightwards [get]
 True if this is a rightwards character (e.g. Arabic). More...
 
bool Space [get]
 True if this character is a whitespace of any kind. More...
 
virtual bool RequiresLoad [get]
 Does this glyph require loading? If this is true, call LoadNow to get the glyph outline loaded. More...
 
int RasterHeight [get]
 The height of this glyphs SDF raster. More...
 
int RasterWidth [get]
 The width of this glyphs SDF raster. More...
 
float DescendorOffset [get]
 How much this glyph extends below the baseline. More...
 
string TextString [get]
 Gets this glyphs charcode as a string. Note that this is a string and not a char because of things called surrogate pairs. More...
 
int Charcode [get]
 The first charcode assigned to this glyph. More...
 
virtual bool IsComposite [get]
 
- Properties inherited from Blaze.VectorPath
bool Unclosed [get]
 True if this glyph is currently unclosed. More...
 

Static Private Attributes

static Color32 Fill =new Color32(255,255,255,255)
 The colour used to fill the glyphs. More...
 

Constructor & Destructor Documentation

InfiniText.Glyph.Glyph ( )
inline
InfiniText.Glyph.Glyph ( FontFace  parent)
inline

Member Function Documentation

void InfiniText.Glyph.AddCharcode ( int  charCode)
inline
void InfiniText.Glyph.AddKerningPair ( Glyph  beforeThis,
float  value 
)
inline
bool InfiniText.Glyph.AddToFont ( string  name,
int  charcode 
)
inline

Add this glyph to the named font. Can override existing characters.

Parameters
nameThe font family name, e.g. "Vera".
bool InfiniText.Glyph.AddToFont ( string  name,
string  charcode 
)
inline

Add this glyph to the named font. Can override existing characters.

Parameters
nameThe font family name, e.g. "Vera".
Glyph InfiniText.Glyph.Copy ( )
inline
bool InfiniText.Glyph.DrawToAtlas ( TextureAtlas  atlas,
AtlasLocation  location 
)
inline

Draws this entity to the given atlas now.

Implements Blaze.AtlasEntity.

int InfiniText.Glyph.GetAtlasID ( )
inline

A globally unique ID that can be used to identify the image being held.

Implements Blaze.AtlasEntity.

void InfiniText.Glyph.GetDimensionsOnAtlas ( out int  width,
out int  height 
)
inline

Gets the dimensions of this entity on an atlas.

Implements Blaze.AtlasEntity.

virtual void InfiniText.Glyph.LoadFully ( Glyph[]  glyphs)
inlinevirtual

Reimplemented in InfiniText.CompositeGlyph.

virtual void InfiniText.Glyph.LoadNow ( )
inlinevirtual

Completes the load of this glyph. You must have checked RequiresLoad first.

Reimplemented in InfiniText.CompositeGlyph.

bool InfiniText.Glyph.MultiThreadDraw ( )
inline

True if DrawToAtlas can be multithreaded for this object.

Implements Blaze.AtlasEntity.

void InfiniText.Glyph.OffScreen ( )
inline

Called when this character goes on screen.

void InfiniText.Glyph.OnScreen ( )
inline

Called when this character goes on screen.

bool InfiniText.Glyph.Rasterise ( Color32[]  atlasPixels,
int  atlasWidth,
int  baseIndex,
bool  clear 
)
inline
void InfiniText.Glyph.SetupImage ( ImagePackage  package)
inline

Called when an image is found for this character. Used by e.g. Emoji.

Parameters
packageThe image that was found.

Member Data Documentation

float InfiniText.Glyph.AdvanceWidth

The amount to advance by when this glyph is displayed.

Color32 InfiniText.Glyph.Fill =new Color32(255,255,255,255)
staticprivate

The colour used to fill the glyphs.

FontFace InfiniText.Glyph.Font

The font face this is a glyph from.

ImagePackage InfiniText.Glyph.Image

A graphical image representation of this character for e.g. Emoji.

Dictionary<Glyph,float> InfiniText.Glyph.Kerning

A group of kerning pairs and their offsets.

float InfiniText.Glyph.LeftSideBearing

The left side bearing. An offset of this glyph.

AtlasLocation InfiniText.Glyph.Location

The rendered location of this SDF character. Also tracks on-screen counts internally.

int InfiniText.Glyph.RawCharcode

The first charcode to assign itself to this glyph.

int InfiniText.Glyph.UniqueID

A globally unique ID for this glyph. Used with font atlases.

Property Documentation

int InfiniText.Glyph.Charcode
get

The first charcode assigned to this glyph.

float InfiniText.Glyph.DescendorOffset
get

How much this glyph extends below the baseline.

virtual bool InfiniText.Glyph.IsComposite
get
int InfiniText.Glyph.RasterHeight
get

The height of this glyphs SDF raster.

int InfiniText.Glyph.RasterWidth
get

The width of this glyphs SDF raster.

virtual bool InfiniText.Glyph.RequiresLoad
get

Does this glyph require loading? If this is true, call LoadNow to get the glyph outline loaded.

bool InfiniText.Glyph.Rightwards
get

True if this is a rightwards character (e.g. Arabic).

bool InfiniText.Glyph.Space
get

True if this character is a whitespace of any kind.

string InfiniText.Glyph.TextString
get

Gets this glyphs charcode as a string. Note that this is a string and not a char because of things called surrogate pairs.