Main Page Data Structures File List Data Fields Globals Related Pages

# gfxfont.h File Reference

`#include "bitmap.h"`
`#include "fontstruct.h"`
`#include "gfxcore.h"`

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Functions
Font * | GFX_LoadFont (char *fn)
| Load a Font from disk.
void | GFX_FreeFont (Font *font)
| Free a Font.
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.

## 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, Graphics::font, font, Font::numChars, Font::offsets, and width.