Class GorgonGlyph
A glyph used to define a character in a GorgonFont.
Inherited Members
Namespace: Gorgon.Graphics.Fonts
Assembly: Gorgon.Graphics.Fonts.dll
Syntax
public sealed class GorgonGlyph : IGorgonNamedObject, IEquatable<GorgonGlyph>
Properties
| Edit this page View SourceAdvance
Property to set or return the horizontal advance for the glyph.
Declaration
public int Advance { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
This value defines the exact width of the glyph and is a total of the left bearing (A), black box width (B), and right bearing (C) for a glyph.
Character
Property to return the character that this glyph represents.
Declaration
public char Character { get; }
Property Value
Type | Description |
---|---|
char |
GlyphCoordinates
Property to return the coordinates, in pixel space, of the glyph.
Declaration
public Rectangle GlyphCoordinates { get; }
Property Value
Type | Description |
---|---|
Rectangle |
Offset
Property to set or return the offset of the glyph.
Declaration
public Point Offset { get; set; }
Property Value
Type | Description |
---|---|
Point |
Remarks
The offset of a glyph is the distance from the glyph black box (i.e. the bounds of the glyph pixels) to the actual starting point of the glyph. For example, if 'g' has an offset of 4, 6 and we change the offset to 3, 4 then the 'g' glyph will be shifted left by 1 pixel and up by 2 pixels when rendering.
OutlineCoordinates
Property to return the coordinates, in pixel space, of the glyph outline (if applicable).
Declaration
public Rectangle OutlineCoordinates { get; }
Property Value
Type | Description |
---|---|
Rectangle |
Remarks
This property will only be assigned if a GorgonFont has an outline.
OutlineOffset
Property to set or return the offset of the glyph outline (if applicable).
Declaration
public Point OutlineOffset { get; set; }
Property Value
Type | Description |
---|---|
Point |
Remarks
The offset of a glyph is the distance from the glyph outline black box (i.e. the bounds of the glyph pixels) to the actual starting point of the glyph outline. For example, if 'g' has an offset of 4, 6 and we change the offset to 3, 4 then the 'g' glyph outline will be shifted left by 1 pixel and up by 2 pixels when rendering.
This property will only be assigned if a GorgonFont has an outline.
OutlineTextureCoordinates
Property to return the texture coordinates for the glyph outline (if applicable).
Declaration
public RectangleF OutlineTextureCoordinates { get; }
Property Value
Type | Description |
---|---|
RectangleF |
Remarks
This property will only be assigned if a GorgonFont has an outline.
TextureCoordinates
Property to return the texture coordinates for the glyph.
Declaration
public RectangleF TextureCoordinates { get; }
Property Value
Type | Description |
---|---|
RectangleF |
TextureIndex
Property to return the array index for the backing texture array.
Declaration
public int TextureIndex { get; }
Property Value
Type | Description |
---|---|
int |
TextureView
Property to return the texture that the glyph can be found on.
Declaration
public GorgonTexture2DView TextureView { get; }
Property Value
Type | Description |
---|---|
GorgonTexture2DView |
Methods
| Edit this page View SourceEquals(GorgonGlyph)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(GorgonGlyph other)
Parameters
Type | Name | Description |
---|---|---|
GorgonGlyph | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
Equals(object)
Indicates whether the current object is equal to another object of the same type.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
Overrides
| Edit this page View SourceGetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
| Edit this page View SourceToString()
Returns a string that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents this instance. |
Overrides
| Edit this page View SourceUpdateTexture(GorgonTexture2D, Rectangle, Rectangle, int)
Function to change the texture pointed at by this glyph.
Declaration
public void UpdateTexture(GorgonTexture2D texture, Rectangle glyphCoordinates, Rectangle outlineCoordinates, int textureArrayIndex)
Parameters
Type | Name | Description |
---|---|---|
GorgonTexture2D | texture | The texture to assign to the glyph. |
Rectangle | glyphCoordinates | The coordinates of the glyph on the texture, in pixels. |
Rectangle | outlineCoordinates | The coordinates of the glyph outline on the texture, in pixels. |
int | textureArrayIndex | The array index on the 2D texture array to use for this glyph. |
Remarks
This allows an application to point a glyph at a new GorgonTexture2D for custom bitmap glyphs, or allows the region on the texture that contains the glyph to be modified. This allows applications to create custom characters in fonts that the font generation code cannot produce.
Currently any custom texture/coordinates are not persisted when the font is saved. This may change in a future release of Gorgon.
If the GorgonFont for this glyph does not have an outline, then the outlineCoordinates
should be set to empty.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the -or- Thrown if the |