Text


Data Structures

struct  UL_FONTINFO
struct  UL_FONT
struct  UL_FONT_FORMAT_HEADER

Defines

#define ulSetFont(f)   (ul_curFont = f)
#define ulPrintf_xy(x, y, format...)   ({ char __str[1000]; sprintf(__str , ##format); ulDrawString(x, y, __str); })

Functions

void ulInitText ()
UL_FONTulCreateFont (UL_FONTINFO *fi)
UL_FONTulLoadFont (VIRTUAL_FILE *f)
void ulDrawChar (int x, int y, unsigned char c)
void ulDrawString (int x, int y, const char *str)
void ulSetTextColor (UL_COLOR color)
void ulDrawTextBox (int x0, int y0, int x1, int y1, const char *text, int format)
int ulGetStringWidth (const char *str)
int ulGetTextBoxHeight (int width, int maxHeight, const char *text, int format)

Variables

UL_FONTul_curFont
UL_FONTul_lcdFont

Detailed Description

Text support with support for loading OldSchool Library fonts (.oft).

Define Documentation

#define ulSetFont (  )     (ul_curFont = f)

Sets the current font.

#define ulPrintf_xy ( x,
y,
format...   )     ({ char __str[1000]; sprintf(__str , ##format); ulDrawString(x, y, __str); })

Draws text using printf format somewhere on the screen.

Parameters:
x,y Positions where to draw the text
format Printf-like string (ex: "%i", someInteger)


Function Documentation

void ulInitText (  ) 

Initializes the text system with the default supplied font (2 kB). Can be called several times, it will then only set the default font.

UL_FONT* ulCreateFont ( UL_FONTINFO fi  ) 

Creates a new font based on a FONTINFO header. Not very useful, as you should load fonts from a whole file. The only use it currently has is for the default font, which is embedded in the source code (but even there, you could only put the binary data of the file in a simple table and use a virtual file to open and load it).

UL_FONT* ulLoadFont ( VIRTUAL_FILE f  ) 

Loads a font from an open virtual file.

void ulDrawChar ( int  x,
int  y,
unsigned char  c 
)

Draws a character to the specified positions.

void ulDrawString ( int  x,
int  y,
const char *  str 
)

Draws a string to the specified positions.

Note: Drawing an entire string is faster than drawing characters individually.

void ulSetTextColor ( UL_COLOR  color  ) 

Sets the text color.

void ulDrawTextBox ( int  x0,
int  y0,
int  x1,
int  y1,
const char *  text,
int  format 
)

Draws a text box.

Parameters:
x0,y0,x1,y1 Rectangle where the text should be placed on. Text will automatically be word-wrapped (words are not cut in half at the end of a line) so make sure to let enough horizontal space else it will look ugly.
text The text you want to draw. Currently, there is no special format tag supported.
format For future use. Set it to zero for now.
Also there, it should be faster to draw a text box using this method than doing it by yourself and drawing individual characters.

int ulGetStringWidth ( const char *  str  ) 

Returns the size of a string using the current active font.

int ulGetTextBoxHeight ( int  width,
int  maxHeight,
const char *  text,
int  format 
)

Returns the height of a text box using the current active font.

Parameters:
width Text box width (x1 - x0 in ulDrawTextBox)
maxHeight Height limit. If set to 0, there will be no limit.
text Text.
format Let it to 0.


Variable Documentation

UL_FONT* ul_curFont

Currently selected font.

UL_FONT* ul_lcdFont

Default LCD font (loaded upon call to ulInitConsole).


Generated on Sat Jul 14 23:39:33 2007 by  doxygen 1.5.2