Gorgon Font File Format
This page gives a detailed explanation of the binary Gorgon Font file format.
The binary file format for a GorgonFont
stores the metadata required for generating a bitmap font for use with Gorgon. The format uses the Gorgon Chunked File Format (GCFF) system and as such, the explanation will be broken down by the data chunks present in the file. Please review the specifcation for the GCFF if you are not familiar with it.
File layout
The following is a detailed breakdown of the binary Gorgon Font file format.
File header
Name | Data Type | Value | Size | Description |
---|---|---|---|---|
ID | UInt64 |
GORFNT10 (0x474f52464e543130) |
8 bytes | This is the ID indicating that this file is a GorgonFont file. |
Chunk Table
The following describes the list of chunks used by the Font file format.
Chunk descriptor
Chunk ID | Hex Value | Description |
---|---|---|
FONTINFO |
0x464f4e54494e464f |
Metadata used to create the font. Such as font family, font size, etc... |
The following represents the data contained within the chunk. The order of the values is the order in which they appear within the chunk.
FONTINFO Chunk
Value | Data Type | Description |
---|---|---|
Font Family Name | System.String |
The name of the font (e.g. Arial, Times New Roman, etc...) |
Size | System.Single |
The size of the font. This can be either in pixels, or points. Use the FontHeightMode to determine the type of units. |
Font Height Mode | FontHeightMode |
The value that represents the font size units. Either Points or Pixels . |
Font Style | System.Drawing.FontStyle |
The value that defines the styling to apply to the font. |
Default Character | System.Char |
The character to use when the font does not contain a glyph for a character being rendered. |
Characters | System.String |
The list of characters that can be rendered by this font. |
Antialiasing Mode | FontAntiAliasMode |
The value used to enable or disable anti-aliasing for the font glyphs. |
Outline Color #1 | System.Int32 |
The value representing the starting color for the font outline. Values are encoded as ARGB. |
Outline Color #2 | System.Int32 |
The value representing the ending color for the font outline. Values are encoded as ARGB. |
Outline Size | System.Int32 |
The value used to determine the size, in pixels, of the font outline. |
Packing Space | System.Int32 |
The value used to put spacing (in pixels) in between the font glyphs on the font glyph textures. |
Texture Width | System.Int32 |
The value used to define the maximum width, in pixels, of the glyph textures used when generating the font. |
Texture Height | System.Int32 |
The value used to define the maximum height, in pixels, of the glyph textures used when generating the font. |
Premultiplied | System.Boolean |
The value that indicates that the glyph textures use premultiplied alpha. |
Use Kerning | System.Boolean |
The value that indicates if kerning pair information should be generated for the font. |
Chunk descriptor
Chunk ID | Hex Value | Description |
---|---|---|
BRSHDATA |
0x4252534844415441 |
Metadata used to create the brush used to paint the font glyphs. |
The following represents the data contained within the chunk. The order of the values is the order in which they appear within the chunk.
BRSHDATA Chunk
Value | Data Type | Description |
---|---|---|
Brush Type | GlyphBrushType |
The value representing the type of brush used to paint the glyph. |
Note
This value affects the data values that appear after this one. Each brush type has its data values listed in the sections below.
For example, if this value is set to a solid brush, then the data values in the solid brush grid should be read. Likewise, if it was set to a hatch brush, the hatch brush data values should be read.
Solid Brush
If the brush type is Solid
, then the following values appear in the BRSHDATA
chunk:
Value | Data Type | Description |
---|---|---|
Color | System.Int32 |
The color of the brush, encoded as ARGB. |
Hatched Brush
If the brush type is Hatched
, then the following values appear in the BRSHDATA
chunk:
Value | Data Type | Description |
---|---|---|
Hatch Style | System.Drawing.Drawing2D.HatchStyle |
The style of hatch pattern to apply. |
Foreground Color | System.Int32 |
The foreground color for the hatch pattern, encoded as ARGB. |
Background Color | System.Int32 |
The background color for the hatch pattern, encoded as ARGB. |
Linear Gradient Brush
If the brush type is LinearGradient
, then the following values appear in the BRSHDATA
chunk:
Value | Data Type | Description |
---|---|---|
Angle | System.Single |
The value for the angle of rotation (in degrees) for the gradient pattern. |
Scale Angle | System.Boolean |
The value that will enable or disable scaling on the angle. |
Gamma Correction | System.Boolean |
The value that will enable or disable whether Gamma correction is applied to the gradient. |
Interpolation Count | System.Int32 |
The number of interpolation points. This indicates the number of weighting/color values that come after this value. |
Note
The following values describe the properties for an interpolation point.
Read from 0 to Interpolation Count - 1
Value | Data Type | Description |
---|---|---|
Weight | System.Single |
The weighting value for the interpolation point. |
Color | System.Int32 |
The color of the interpolation point, encoded as ARGB. |
End read loop
Path Gradient Brush
If the brush type is PathGradient
, then the following values appear in the BRSHDATA
chunk:
Value | Data Type | Description |
---|---|---|
Wrap Mode | GlyphBrushWrapMode |
The value representing the type of wrapping to perform when the gradient hits an edge. |
Point Count | System.Int32 |
The number of points on the path. |
Note
The following values describe the properties for a path point.
Read from 0 to Point Count - 1
Value | Data Type | Description |
---|---|---|
Position | SharpDX.Vector2 |
The X/Y coordinate for the point on the path. |
End read loop
Value | Data Type | Description |
---|---|---|
Blend Factor Count | System.Int32 |
The number of blend factors on the path. |
Note
The following values describe the properties for a blend factor.
Read from 0 to Blend Factor Count - 1
Value | Data Type | Description |
---|---|---|
Blend Factor | System.Single |
The blending factor. |
End read loop
Value | Data Type | Description |
---|---|---|
Blend Position Count | System.Int32 |
The number of blend positions on the path. |
Note
The following values describe the properties for a blend position.
Read from 0 to Blend Factor Position - 1
Value | Data Type | Description |
---|---|---|
Blend Position | System.Single |
The blending position on the path. |
End read loop
Value | Data Type | Description |
---|---|---|
Center Color | System.Int32 |
The color of the center point for the gradient path, encoded as ARGB. |
Center Point | SharpDX.Vector2 |
The center point for the gradient path. |
Interpolation Point Count | System.Int32 |
The number of interpolation points. This indicates the number of weighting/color values that come after this value. |
Note
The following values describe the properties for an interpolation point.
Read from 0 to Interpolation Point Count - 1
Value | Data Type | Description |
---|---|---|
Weight | System.Single |
The weighting value for the interpolation point. |
Color | System.Int32 |
The color of the interpolation point for the gradient path, encoded as ARGB. |
End read loop
Value | Data Type | Description |
---|---|---|
Surrounding Color Count | System.Int32 |
The number of surrounding colors around the center of the path. |
Note
The following values describe the properties for a surround color.
Read from 0 to Surrounding Color Count - 1
Value | Data Type | Description |
---|---|---|
Surrounding Color | System.Int32 |
The surrounding color value, encoded as ARGB. |
End read loop
Texture Brush
If the brush type is Texture
, then the following values appear in the BRSHDATA
chunk:
Value | Data Type | Description |
---|---|---|
Wrap Mode | GlyphBrushWrapMode |
The value representing the type of wrapping to perform when the texture width or height is exceeded. |
Image Size | System.Int32 |
The size of the brush texture, in bytes. |
Image Data | Byte data |
The image data for the brush. Encoded as PNG data. |