Documentation from font.h

ROV

Introduction

[top]

ROV - Easy applications from C

Copyright - © Jason Tribbeck / 7th ARM 1994-2001

Contributing authors - Jason Tribbeck

File - font.h

Type - helper

Description

The font helper deals with font issues, such as painting, selecting, listing and so forth.

font_find

[top]

Registers a font.

Parameters:

 - char *font_name - the font name.
 - int xpts - the width in points * 16.
 - int ypts - the height in points * 16.

Returns:

 -  the font handle (or zero for no font found).

int font_find(char *font_name,
	      int xpts,
	      int ypts);

See also: font_lose(), font_setfont()

font_lose

[top]

Deregisters a font handle.

Parameters:

 - int handle - the font handle.

void font_lose(int handle);

See also: font_find()

font_paint

[top]

Draw a string on a canvas using a font.

Parameters:

 - char *str - the string to print.
 - int flags - the painting flags.
 - int x - the x coordinate.
 - int y - the y coordinate.

Note - Call font_setfont() to select the font handle prior to painting.

Note - If flags has FONT_OSCOORDINATES bit set, then the canvas origin is added, making the coordinates canvas coordinates. Otherwise, points are used.

void font_paint(char *str,
		int flags,
		int x,
		int y);

See also: Font paint flags, font_setfont()

font_converttoos

[top]

Convert a pair of font coordinates to OS coordinates.

Parameters:

 - int xf - the x font coordinate (points).
 - int yf - the y font coordinate (points).
 - int *xo - the pointer to store the x OS coordinate.
 - int *yo - the pointer to store the y OS coordinate.

Note - If either pointer is NULL, then that value is not stored.

void font_converttoos(int xf,
		      int yf,
		      int *xo,
		      int *yo);

font_converttopoints

[top]

Convert a pair of OS coordinates to font coordinates.

Parameters:

 - int xo - the x OS coordinate.
 - int yo - the y OS coordinate.
 - int *xf - the pointer to store the x font coordinate (points).
 - int *yf - the pointer to store the y font coordinate (points).

Note - If either pointer is NULL, then that value is not stored.

void font_converttopoints(int xo,
			  int yo,
			  int *xf,
			  int *yf);

font_setfont

[top]

Set a font as the current font to use.

Parameters:

 - int handle - the font handle.

void font_setfont(int handle);

See also: font_find()

font_currentfont

[top]

Get the current font handle

Returns:

 -  the current font handle.

int font_currentfont(void);

font_setfontcolours

[top]

Sets the font colours.

Parameters:

 - int handle - the handle to use (or 0 for current handle).
 - int bcol - background logical colour.
 - int fcol - foreground logical colour.
 - int fco - foreground colour offset.

Note - This does not use ColourTrans. If you want to use ColourTrans, use draw_setfontcolour().

void font_setfontcolours(int handle,
			 int bcol,
			 int fcol,
			 int fco);

See also: draw.h

font_listfonts

[top]

List fonts

Parameters:

 - char *buffer - the pointer to the resultant buffer.
 - int count - the current counter (start at 0).
 - int b_size - the size of the buffer.
 - char *font_name - the pointer to the font name buffer.
 - int fn_size - the size of the font name buffer.

Returns:

 -  the current counter, or -1 if no more, or -2 if an error occurred.

int font_listfonts(char *buffer,
		   int count,
		   int b_size,
		   char *font_name,
		   int fn_size);

font_charwidth

[top]

Gets the width of a character

Parameters:

 - int handle - font handle
 - char chr - the character to get the width of
 - int flags - the flags to use.

Returns:

 -  the width (either in points or OS coordinates).

int font_charwidth(int handle,
		   char chr,
		   int flags);

See also: FONT_OSCOORDINATES

font_stringwidth

[top]

Gets the width of the string in the current font.

Parameters:

 - char *str - the string.
 - int max - the maximum width (in points).
 - int strl - the string length.

Returns:

 -  the length in points.

int font_stringwidth(char *str,
		     int max,
		     int strl);

See also: font_setfont(), font_stringcut()

font_stringcut

[top]

Indicate where the string should be cut.

Parameters:

 - char *str - the string.
 - int max - the maximum width (in points).
 - int strl - the string length.

Returns:

 -  the index of the cut position.

int font_stringcut(char *str,
		   int max,
		   int strl);

See also: font_setfont(), font_stringwidth()

Font paint flags

[top]
#define FONT_PLOTRUBOUTBOX (1<<1)
#define FONT_OSCOORDINATES (1<<4)

Generated Sun Feb 10 21:31:39 2002