Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

gfxfont.cpp File Reference

#include "gfxfont.h"
#include "gfxcore.h"
#include "misc.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
#include <mem.h>
#include <dos.h>

Go to the source code of this file.

Functions

FontGFX_LoadFont (char *fn)
 Load a Font from disk.

void GFX_FreeFont (Font *font)
 Free a Font.

int printScratch (char *bmBits, Font *font, char *string)
 Print a string into scratch memory.

int GFX_Print (Graphics *gfx, char *string)
int GFX_PrintAt (Graphics *gfx, int x, int y, char *string)
 Print text at position (x,y).

int GFX_Printf (Graphics *gfx, char *format,...)
 Print a formatted text string.

int GFX_PrintfAt (Graphics *gfx, int x, int y, char *format,...)
 Print formatted text at position (x,y).

int GFX_TextWidth (Graphics *gfx, char *string)
 Get width of text.


Variables

char printfbuf [256]


Function Documentation

void GFX_FreeFont Font   font
 

Free a Font.

Parameters:
font  pointer to Font structure to free.

Definition at line 85 of file gfxfont.cpp.

References font.

Font* GFX_LoadFont char *    fn
 

Load a Font from disk.

Parameters:
fn  filename to load.
Returns:
pointer to Font structure, or NULL if some error occured.

Definition at line 38 of file gfxfont.cpp.

References Font::firstChar, font, FONT_MAGIC, Font::height, Font::maxWidth, and Font::numChars.

Referenced by main().

int GFX_Print Graphics   gfx,
char *    string
 

Definition at line 180 of file gfxfont.cpp.

References Graphics::bitmap, Graphics::blitMode, BM_Blit(), Graphics::font, Font::height, printScratch(), Graphics::x, and Graphics::y.

Referenced by GFX_PrintAt(), and GFX_Printf().

int GFX_PrintAt Graphics   gfx,
int    x,
int    y,
char *    string
 

Print text at position (x,y).

The cursor position isn't changed by this function.

Parameters:
gfx  Graphics context to use.
string  pointer to text string.
Returns:
width of printed text (in pixels).

Definition at line 207 of file gfxfont.cpp.

References GFX_Print(), swap(), width, Graphics::x, and Graphics::y.

Referenced by GFX_PrintfAt(), and gfxTest().

int GFX_Printf Graphics   gfx,
char *    format,
...   
 

Print a formatted text string.

The cursor position is advanced to the end of the string.

Parameters:
gfx  Graphics context to use.
format  see printf documentation.
Returns:
width of printed text (in pixels).

Definition at line 225 of file gfxfont.cpp.

References GFX_Print(), printfbuf, and width.

int GFX_PrintfAt Graphics   gfx,
int    x,
int    y,
char *    format,
...   
 

Print formatted text at position (x,y).

The cursor position isn't changed by this function.

Parameters:
gfx  Graphics context to use.
format  see printf documentation.
Returns:
width of printed text (in pixels).

Definition at line 251 of file gfxfont.cpp.

References GFX_PrintAt(), printfbuf, and width.

Referenced by gfxTest().

int GFX_TextWidth Graphics   gfx,
char *    string
 

Get width of text.

Return the width of the string in pixels, as it would be returned by GFX_Print().

Parameters:
gfx  graphics context to use.
string  text string
Returns:
width in pixels

Definition at line 277 of file gfxfont.cpp.

References Font::firstChar, font, Graphics::font, Font::numChars, Font::offsets, and width.

int printScratch char *    bmBits,
Font   font,
char *    string
[static]
 

Print a string into scratch memory.

Parameters:
bmBits  pointer to scratch memory
fnt  pointer to bitmap font
string  text to print
Returns:
width of printed text

Definition at line 101 of file gfxfont.cpp.

References bmBits, font, Font::numPages, and pages.

Referenced by GFX_Print().


Variable Documentation

char printfbuf[256] [static]
 

Definition at line 28 of file gfxfont.cpp.

Referenced by GFX_Printf(), and GFX_PrintfAt().


Generated on Sun Aug 4 21:47:37 2002 for k/os mp3v2 by doxygen1.2.16