Gorgon
Show / Hide Table of Contents

Interface IGorgonFontInfo

Provides information used to create a new GorgonFont.

Inherited Members
IGorgonNamedObject.Name
Namespace: Gorgon.Graphics.Fonts
Assembly: Gorgon.Graphics.Fonts.dll
Syntax
public interface IGorgonFontInfo : IGorgonNamedObject
Remarks

This interface is used to provide an immutable view of the information used to generate a new GorgonFont.

Properties

| Edit this page View Source

AntiAliasingMode

Property to return the anti-aliasing mode for the font.

Declaration
FontAntiAliasMode AntiAliasingMode { get; }
Property Value
Type Description
FontAntiAliasMode
Remarks

This defines the smoothness of font pixel edges.

important

Gorgon does not support clear type at this time.

The default value is AntiAlias.

| Edit this page View Source

Brush

Property to return a GorgonGlyphBrush to use for special effects on the glyphs for the font.

Declaration
GorgonGlyphBrush Brush { get; }
Property Value
Type Description
GorgonGlyphBrush
Remarks

This value can be used to define how a glyph is rendered when the GorgonFont is generated. Applications can use brushes for gradients, textures, etc... to render the glyphs to give them a unique look.

This default value is null.

See Also
GorgonGlyphHatchBrush
GorgonGlyphLinearGradientBrush
GorgonGlyphPathGradientBrush
GorgonGlyphSolidBrush
GorgonGlyphTextureBrush
| Edit this page View Source

Characters

Property to return the list of available characters to use as glyphs within the font.

Declaration
IEnumerable<char> Characters { get; }
Property Value
Type Description
IEnumerable<char>
Remarks

This will define what characters the font can display when rendering. Any character not defined in this property will use the default character (typically a space).

The default encompasses characters from ASCII character code 32 to 255.

| Edit this page View Source

DefaultCharacter

Property to return a default character to use in place of a character that cannot be found in the font.

Declaration
char DefaultCharacter { get; }
Property Value
Type Description
char
Remarks

If some characters are unprintable (e.g. have no width/height), or they were not defined in the Characters property. This character will be substituted in those cases.

The default value is a space (' ').

| Edit this page View Source

FontFamilyName

Property to return the font family name to generate the font from.

Declaration
string FontFamilyName { get; }
Property Value
Type Description
string
| Edit this page View Source

FontHeightMode

Property to return whether the font height is in pixels or in points.

Declaration
FontHeightMode FontHeightMode { get; }
Property Value
Type Description
FontHeightMode
Remarks

When the font uses points for its height, the user must be aware of DPI scaling issues that may arise.

This will affect the Size value in that it will alter the meaning of the units.

The default value is Pixels.

| Edit this page View Source

FontStyle

Property to return the style for the font.

Declaration
FontStyle FontStyle { get; }
Property Value
Type Description
FontStyle
Remarks

The default value is Regular.

| Edit this page View Source

OutlineColor1

Property to return the starting color of the outline.

Declaration
GorgonColor OutlineColor1 { get; }
Property Value
Type Description
GorgonColor
Remarks

This defines the starting color for an outline around a font glyph. This can be used to give a gradient effect to the outline and allow for things like glowing effects and such.

If the alpha channel is set to 0.0f and the OutlineColor2 alpha channel is set to 0.0f, then outlining will be disabled since it will be invisible. This will also be ignored if the OutlineSize value is not greater than 0.

The default value is Transparent (A=1.0f, R=0.0f, G=0.0f, B=0.0f).

| Edit this page View Source

OutlineColor2

Property to return the ending color of the outline.

Declaration
GorgonColor OutlineColor2 { get; }
Property Value
Type Description
GorgonColor
Remarks

This defines the ending color for an outline around a font glyph. This can be used to give a gradient effect to the outline and allow for things like glowing effects and such.

If the alpha channel is set to 0.0f and the OutlineColor1 alpha channel is set to 0.0f, then outlining will be disabled since it will be invisible. This will also be ignored if the OutlineSize value is not greater than 3.

The default value is Transparent (A=1.0f, R=0.0f, G=0.0f, B=0.0f).

| Edit this page View Source

OutlineSize

Property to return the size of an outline.

Declaration
int OutlineSize { get; }
Property Value
Type Description
int
Remarks

This defines the thickness of an outline (in pixels) for each glyph in the font. A value greater than 0 will draw an outline, 0 or less will turn outlining off.

The default value is 0.

| Edit this page View Source

PackingSpacing

Property to return the spacing (in pixels) used between font glyphs on the backing texture.

Declaration
int PackingSpacing { get; }
Property Value
Type Description
int
Remarks

This defines how much space to put between glyphs. Higher values will waste more space (and thus lead to more textures being created), but may resolve rendering issues.

The valid values are between 0 and 8.

The default value is 1 pixel.

| Edit this page View Source

Size

Property to return the font size.

Declaration
float Size { get; }
Property Value
Type Description
float
Remarks

This sets the height of the font.

This is affected by the FontHeightMode. If the FontHeightMode is set to Points, then this unit is the height size height for the font. Otherwise, this represents the font height in Pixels.

| Edit this page View Source

TextureHeight

Property to return the height of the texture(s) used as the backing store for the bitmap font data.

Declaration
int TextureHeight { get; }
Property Value
Type Description
int
Remarks

This value will control the width of the textures created. It can be used to decrease or increase the number of textures used for a font. This is important because if the number of requested glyphs cannot fit onto a single texture, a new texture will be created to store the remaining glyphs. Keeping as few textures as possible for a font is beneficial for performance.

Font textures cannot be smaller than 256x256 and the maximum size is dependent upon FeatureSet for the IGorgonVideoAdapterInfo.

The default height is 256.

| Edit this page View Source

TextureWidth

Property to return the width of the texture(s) used as the backing store for the bitmap font data.

Declaration
int TextureWidth { get; }
Property Value
Type Description
int
Remarks

This value will control the width of the textures created. It can be used to decrease or increase the number of textures used for a font. This is important because if the number of requested glyphs cannot fit onto a single texture, a new texture will be created to store the remaining glyphs. Keeping as few textures as possible for a font is beneficial for performance.

Font textures cannot be smaller than 256x256 and the maximum size is dependent upon FeatureSet for the IGorgonVideoAdapterInfo.

The default width is 256.

| Edit this page View Source

UseKerningPairs

Property to return whether to include kerning pair information in the font.

Declaration
bool UseKerningPairs { get; }
Property Value
Type Description
bool
Remarks

Kerning pairs are used to define spacing between 2 characters in a font. When this value is set to true the kerning information of the font is retrieved and added to the GorgonFont for use when rendering. This can be used to resolve rendering issues regarding horizontal font spacing.

note

Some fonts do not employ the use of kerning pairs, and consequently, this setting will be ignored if that is the case.

The default value is true.

| Edit this page View Source

UsePremultipliedTextures

Property to return whether premultiplied textures are used when generating the glyphs for the font.

Declaration
bool UsePremultipliedTextures { get; }
Property Value
Type Description
bool
Remarks

This defines whether the textures used to store the glyphs of the font will use premultiplied alpha. Premultiplied alpha is used to give a more accurate representation of blending between colors, and is accomplished by multiplying the RGB values by the Alpha component of a pixel.

If this value is true, then applications should use the Premultiplied blending state when rendering text.

The default value is false.

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author