Space Engineers
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
VRageRender.MyFont Class Reference
Inheritance diagram for VRageRender.MyFont:
VRageRender.MyRenderFont

Classes

struct  KernPair
 
class  KernPairComparer
 
struct  MyBitmapInfo
 Info for each font bitmap More...
 
struct  MyGlyphInfo
 Info for each glyph in the font - where to find the glyph image and other properties More...
 

Public Member Functions

 MyFont (string fontFilePath, int spacing=1)
 Create a new font from the info in the specified font descriptor (XML) file More...
 
Vector2 MeasureString (StringBuilder text, float scale)
 
int ComputeCharsThatFit (StringBuilder text, float scale, float maxTextWidth)
 

Public Attributes

const char NEW_LINE = '\n'
 
int Spacing = 0
 This is artificial spacing in between two characters (in pixels). Using it we can make spaces wider or narrower More...
 
bool KernEnabled = true
 Enable / disable kerning of adjacent character pairs. More...
 
float Depth = 0.0f
 The depth at which to draw the font More...
 

Protected Member Functions

bool CanWriteOrReplace (ref char c)
 
float ComputeScaledAdvanceWithKern (char c, char cLast, float scale)
 
bool CanUseReplacementCharacter (char c)
 
int CalcKern (char chLeft, char chRight)
 

Protected Attributes

const char REPLACEMENT_CHARACTER = '\u25A1'
 Replacement character shown when we don't have something in our texture. Normally, this would be , but BMFontGen refuses to generate it, so I put its glyph at (empty square) More...
 
const char ELLIPSIS = '…'
 
readonly Dictionary< int, MyBitmapInfom_bitmapInfoByID = new Dictionary<int, MyBitmapInfo>()
 
readonly Dictionary< char, MyGlyphInfom_glyphInfoByChar = new Dictionary<char, MyGlyphInfo>()
 
readonly Dictionary< KernPair, sbyte > m_kernByPair = new Dictionary<KernPair, sbyte>(m_kernPairComparer)
 
readonly string m_fontDirectory
 

Properties

int Baseline [get]
 Distance from top of font to the baseline More...
 
int LineHeight [get]
 Distance from top to bottom of the font More...
 

Detailed Description

Definition at line 14 of file MyFont.cs.

Constructor & Destructor Documentation

VRageRender.MyFont.MyFont ( string  fontFilePath,
int  spacing = 1 
)
inline

Create a new font from the info in the specified font descriptor (XML) file

Definition at line 64 of file MyFont.cs.

Member Function Documentation

int VRageRender.MyFont.CalcKern ( char  chLeft,
char  chRight 
)
inlineprotected

Definition at line 213 of file MyFont.cs.

bool VRageRender.MyFont.CanUseReplacementCharacter ( char  c)
inlineprotected

Definition at line 206 of file MyFont.cs.

bool VRageRender.MyFont.CanWriteOrReplace ( ref char  c)
inlineprotected

Definition at line 144 of file MyFont.cs.

int VRageRender.MyFont.ComputeCharsThatFit ( StringBuilder  text,
float  scale,
float  maxTextWidth 
)
inline

Definition at line 155 of file MyFont.cs.

float VRageRender.MyFont.ComputeScaledAdvanceWithKern ( char  c,
char  cLast,
float  scale 
)
inlineprotected

Definition at line 193 of file MyFont.cs.

Vector2 VRageRender.MyFont.MeasureString ( StringBuilder  text,
float  scale 
)
inline

Definition at line 98 of file MyFont.cs.

Member Data Documentation

float VRageRender.MyFont.Depth = 0.0f

The depth at which to draw the font

Definition at line 57 of file MyFont.cs.

const char VRageRender.MyFont.ELLIPSIS = '…'
protected

Definition at line 21 of file MyFont.cs.

bool VRageRender.MyFont.KernEnabled = true

Enable / disable kerning of adjacent character pairs.

Definition at line 42 of file MyFont.cs.

readonly Dictionary<int, MyBitmapInfo> VRageRender.MyFont.m_bitmapInfoByID = new Dictionary<int, MyBitmapInfo>()
protected

Definition at line 25 of file MyFont.cs.

readonly string VRageRender.MyFont.m_fontDirectory
protected

Definition at line 28 of file MyFont.cs.

readonly Dictionary<char, MyGlyphInfo> VRageRender.MyFont.m_glyphInfoByChar = new Dictionary<char, MyGlyphInfo>()
protected

Definition at line 26 of file MyFont.cs.

readonly Dictionary<KernPair, sbyte> VRageRender.MyFont.m_kernByPair = new Dictionary<KernPair, sbyte>(m_kernPairComparer)
protected

Definition at line 27 of file MyFont.cs.

const char VRageRender.MyFont.NEW_LINE = '\n'

Definition at line 22 of file MyFont.cs.

const char VRageRender.MyFont.REPLACEMENT_CHARACTER = '\u25A1'
protected

Replacement character shown when we don't have something in our texture. Normally, this would be , but BMFontGen refuses to generate it, so I put its glyph at (empty square)

Definition at line 20 of file MyFont.cs.

int VRageRender.MyFont.Spacing = 0

This is artificial spacing in between two characters (in pixels). Using it we can make spaces wider or narrower

Definition at line 37 of file MyFont.cs.

Property Documentation

int VRageRender.MyFont.Baseline
get

Distance from top of font to the baseline

Definition at line 47 of file MyFont.cs.

int VRageRender.MyFont.LineHeight
get

Distance from top to bottom of the font

Definition at line 52 of file MyFont.cs.


The documentation for this class was generated from the following file: