C# Class TexLib.TextureFont

Afficher le fichier Open project: LukaHorvat/Kento

Méthodes publiques

Свойство Type Description
AdvanceWidth double
CharacterBoundingBoxHeight double
CharacterBoundingBoxWidth double

Méthodes publiques

Méthode Description
ComputeWidth ( string text ) : double

Computes the expected width of text string given. The height is always 1.0. Model space coordinates.

TextureFont ( int textureId ) : System.Diagnostics

Create a TextureFont object. The sent-in textureId should refer to a texture bitmap containing a 16x16 grid of fixed-width characters, representing the ASCII table. A 32 bit texture is assumed, aswell as all GL state necessary to turn on texturing. The dimension of the texture bitmap may be anything from 128x128 to 512x256 or any other order-by-two-squared-dimensions.

WriteString ( string text ) : void

Draw an ASCII string around coordinate (0,0,0) in the XY-plane of the model space coordinate system. The height of the text is 1.0. The width may be computed by calling ComputeWidth(string). This call modifies the currently bound 2D-texture, but no other GL state.

WriteStringAt ( string text, double heightPercent, double xPercent, double yPercent, double degreesCounterClockwise ) : void

This is a convenience function to write a text string using a simple coordinate system defined to be 0..100 in x and 0..100 in y. For example, writing the text at 50,50 means it will be centered onscreen. The height is given in percent of the height of the viewport. No GL state except the currently bound texture is modified. This method is not as flexible nor as fast as the WriteString() method, but it is easier to use.

Private Methods

Méthode Description
ComputeAspectRatio ( ) : double
WriteCharacter ( char ch, double xpos ) : void

Method Details

ComputeWidth() public méthode

Computes the expected width of text string given. The height is always 1.0. Model space coordinates.
public ComputeWidth ( string text ) : double
text string
Résultat double

TextureFont() public méthode

Create a TextureFont object. The sent-in textureId should refer to a texture bitmap containing a 16x16 grid of fixed-width characters, representing the ASCII table. A 32 bit texture is assumed, aswell as all GL state necessary to turn on texturing. The dimension of the texture bitmap may be anything from 128x128 to 512x256 or any other order-by-two-squared-dimensions.
public TextureFont ( int textureId ) : System.Diagnostics
textureId int
Résultat System.Diagnostics

WriteString() public méthode

Draw an ASCII string around coordinate (0,0,0) in the XY-plane of the model space coordinate system. The height of the text is 1.0. The width may be computed by calling ComputeWidth(string). This call modifies the currently bound 2D-texture, but no other GL state.
public WriteString ( string text ) : void
text string
Résultat void

WriteStringAt() public méthode

This is a convenience function to write a text string using a simple coordinate system defined to be 0..100 in x and 0..100 in y. For example, writing the text at 50,50 means it will be centered onscreen. The height is given in percent of the height of the viewport. No GL state except the currently bound texture is modified. This method is not as flexible nor as fast as the WriteString() method, but it is easier to use.
public WriteStringAt ( string text, double heightPercent, double xPercent, double yPercent, double degreesCounterClockwise ) : void
text string
heightPercent double
xPercent double
yPercent double
degreesCounterClockwise double
Résultat void

Property Details

AdvanceWidth public_oe property

Determines the distance from character center to adjacent character center, horizontally, in one written text string. Model space coordinates.
public double AdvanceWidth
Résultat double

CharacterBoundingBoxHeight public_oe property

Determines the height of the cut-out to do for each character when rendering. This is necessary to avoid artefacts stemming from filtering (zooming/rotating). Make sure your font contains some "white space" around each character so they won't be clipped due to this!
public double CharacterBoundingBoxHeight
Résultat double

CharacterBoundingBoxWidth public_oe property

Determines the width of the cut-out to do for each character when rendering. This is necessary to avoid artefacts stemming from filtering (zooming/rotating). Make sure your font contains some "white space" around each character so they won't be clipped due to this!
public double CharacterBoundingBoxWidth
Résultat double