Make games that sell. |  |
| download
| order now
KTrueText
> Introduction
> Examples
> Showcase
> Documentation
| KWindow
| KGraphic
| KMiscTools
| KInput
| KText
| KTrueText
| KSpline
| KWeb
| KIniReader
| KResource
| K3D
| KSound
| KSound2
> History
> Download
> FAQ
> Credits
includes : #include "KTrueText.h" | Quick Reference loadFontFile drawStringFromLeft drawStringFromRight getStringWidth getHeightPix setColor setHeightPix setHeightPt
KTrueText::KTrueText( char *fontName )
Initialises a KTrueText instance ( using the constructor ) Example : KTrueText *myfont ; myfont = new KTrueText( KMiscTools::makeFilePath( "font.ttf" ) ) ;
void KTrueText::loadFontFile( char *font_Filename )
loads a TrueType file and associates it with the font. Example : KTrueText myFont ; myFont.loadFontFile( KMiscTools::makeFilePath( "superfont.ttf" ) ) ;
void drawStringFromLeft( char *txt , long x , long y, long kerning = 0 )
Draws a string at the specified X and Y coordinates. The Kerning parameter enables you to set the horizontal spacing between characters. Example : KTrueText *myFont ; myFont = new KTrueText( KMiscTools::MakeFilePath( "font.ttf") ) ; myFont->drawStringFromLeft( "A beautiful text" ,100,100,2) ;
void drawStringFromRight( char *txt , long x , long y, long kerning = 0 )
Draws a string at the specified X and Y coordinates being the right of the string. ( right aligned ) The Kerning parameter enables you to set the horizontal spacing between characters. Example : KTrueText *myFont ; myFont = new KTrueText( KMiscTools::MakeFilePath( "font.ttf") ) ; myFont->drawStringFromRight( "A beautiful text" ,100,100,2) ;
long getStringWidth( char *txt , long kerning = 0 )
Returns the width of a string in the current font. Example : long stringWidthInPixels = myFont->getStringWidth("A beautiful text" , 2 ) ;
long getHeightPix( void )
Returns the height of the current font in pixels. Example : long fontHeightInPixels = myFont->getHeightPix( ) ;
void setHeightPix( long height )
Sets the height of the current font in pixels. Example : myFont->setHeightPix( 20 ) ;
void setHeightPt( long height )
Sets the height of the current font in points for 96 dpp. Example : myFont->setHeightPt( 12 ) ;
void setColor (float r, float g,float b , float alpha )
Sets the color of a rendered truetext bitmap. Example : myFont->setColor( 0,1,0,0.5f ) ; //set the color to translucent green
© 2003-2005, Phelios, inc. - All rights reserved. Trademarks mentioned are the property of their respective owners.