Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# XFuPrinter Class Reference

Primitive bitmap font printer class. More...

`#include <XFuPrinter.h>`

Inheritance diagram for XFuPrinter:

[legend]
List of all members.

## Public Member Functions
virtual void | print (XFcGLSurface *aTarget, INT32 aX, INT32 aY, const CHAR *aText, INT32 aBlendType=0, INT32 aBlendValue=0x7f, XFcRectangle *aClipRect=NULL)
| Prints a character string with the printer's font.
INT32 | print (XFcGLSurface *aTarget, XFcRectangle *aTargetRect, const CHAR *aText, INT32 aBlendType=0, INT32 aBlendValue=0x7f, XFcRectangle *aClipRect=NULL)
| Prints a character string with the printer's font, using target rectangle and word wrapping.
virtual void | stringMetrics (const CHAR *aText, INT32 &aWidth, INT32 &aHeight)
| Calculates how big an area a string would take if printed.
virtual INT32 | getCharWidth (CHAR aChar)
| Returns the width of a single character.
virtual void | setSpaceWidth (INT32 aSpacing)
| Sets the width of a space.
virtual void | setLetterSpacing (INT32 aSpacing)
| Sets letter spacing (i.e. extra space between characters).
virtual INT32 | getLetterSpacing ()
| Returns the current letter spacing (i.e. extra space between characters).
virtual void | setLineSpacing (INT32 aSpacing)
| Sets line spacing (Y-coordinate offset from a row to the next row).
virtual INT32 | getLineSpacing ()
| Returns the current line spacing (Y-coordinate offset from a row to the next row).
virtual INT32 | getLineHeight ()
| Returns height of one printer line.
virtual | ~XFuPrinter ()
| Virtual destructor.
## Static Public Member Functions
XFuPrinter * | create (const CHAR *aFname)
| Creates a XFuPrinter object from an image file.
XFuPrinter * | create (const CHAR *aFname, INT32 aAlphamask)
| Creates a XFuPrinter object from an image file, with choise of color key value.
XFuPrinter * | create (const CHAR *aFname, INT32 aAlphamask, REAL aXScale, REAL aYScale)
| Creates a XFuPrinter object from an image file, with choise of color key value and scale.
## Protected Member Functions
| XFuPrinter ()
| Protected constructor.
## Protected Attributes
INT32 | mMaxletter
| Maximum letter in the font.
XFcGLSurface ** | mLetter
| Array of XFcGLSurfaces.
INT32 | mLetterSpacing
| Current letter spacing.
INT32 | mLineSpacing
| Current line spacing.
INT32 | mLineHeight
| Line height.
INT32 | mSpaceWidth
| Width of space character.

## Detailed Description

Primitive bitmap font printer class.

This class loads a single image file and creates as many XFcGLSurface objects as the font has characters. The image file must have all of its characters in ASCII order starting from character 33 (the exclamation mark, "!"). The image file must be as wide as a single character is high, i.e. for a 8x8 font with 20 characters and one character, the image dimensions would be 8x160.

Definition at line 24 of file XFuPrinter.h.

## Constructor & Destructor Documentation

XFuPrinter::~XFuPrinter | ( |  | ) | `[virtual]`

| Virtual destructor. Definition at line 415 of file XFuPrinter.cpp. References mLetter, and mMaxletter.

XFuPrinter::XFuPrinter | ( |  | ) | `[protected]`

| Protected constructor. Definition at line 427 of file XFuPrinter.cpp. References mLetter. Referenced by create().

## Member Function Documentation

XFuPrinter * XFuPrinter::create | ( | const CHAR * | aFname,
|  | INT32 | aAlphamask,
|  | REAL | aXScale,
|  | REAL | aYScale
| ) | `[static]`

| Creates a XFuPrinter object from an image file, with choise of color key value and scale. Definition at line 31 of file XFuPrinter.cpp. References mLetter, mLetterSpacing, mLineHeight, mLineSpacing, mMaxletter, mSpaceWidth, TORGB16, and XFuPrinter().

XFuPrinter * XFuPrinter::create | ( | const CHAR * | aFname,
|  | INT32 | aAlphamask
| ) | `[static]`

| Creates a XFuPrinter object from an image file, with choise of color key value. aAlphamask is the color key value. See also: XFcGLSurface Definition at line 26 of file XFuPrinter.cpp. References create().

XFuPrinter * XFuPrinter::create | ( | const CHAR * | aFname | ) | `[static]`

| Creates a XFuPrinter object from an image file. Reimplemented in XFuRLESpritePrinter. Definition at line 21 of file XFuPrinter.cpp. Referenced by create(), and XFuConfigurationData::loadPrinter().

INT32 XFuPrinter::getCharWidth | ( | CHAR | aChar | ) | `[virtual]`

| Returns the width of a single character. Reimplemented in XFuRLESpritePrinter. Definition at line 367 of file XFuPrinter.cpp. References mLetter, mMaxletter, and mSpaceWidth.

INT32 XFuPrinter::getLetterSpacing | ( |  | ) | `[virtual]`

| Returns the current letter spacing (i.e. extra space between characters). Definition at line 385 of file XFuPrinter.cpp. References mLetterSpacing.

INT32 XFuPrinter::getLineHeight | ( |  | ) | `[virtual]`

| Returns height of one printer line. Definition at line 403 of file XFuPrinter.cpp. References mLineHeight.

INT32 XFuPrinter::getLineSpacing | ( |  | ) | `[virtual]`

| Returns the current line spacing (Y-coordinate offset from a row to the next row). Definition at line 397 of file XFuPrinter.cpp. References mLineSpacing.

INT32 XFuPrinter::print | ( | XFcGLSurface * | aTarget,
|  | XFcRectangle * | aTargetRect,
|  | const CHAR * | aText,
|  | INT32 | aBlendType = 0,
|  | INT32 | aBlendValue = 0x7f,
|  | XFcRectangle * | aClipRect = NULL
| ) |

| Prints a character string with the printer's font, using target rectangle and word wrapping. If the string contains words that are wider than the rectangle, the words are printed on a new line (no inter-word chopping is performed). If the aTargetRect is NULL, the whole surface is used. This function uses print() and stringmetrics() internally, so it will also work with rlespriteprinter. See also: print Returns: Pixel height of the total printing operation (ignores clipping) Definition at line 145 of file XFuPrinter.cpp. References mLetterSpacing, mLineHeight, mLineSpacing, mSpaceWidth, print(), and stringMetrics().

void XFuPrinter::print | ( | XFcGLSurface * | aTarget,
|  | INT32 | aX,
|  | INT32 | aY,
|  | const CHAR * | aText,
|  | INT32 | aBlendType = 0,
|  | INT32 | aBlendValue = 0x7f,
|  | XFcRectangle * | aClipRect = NULL
| ) | `[virtual]`

| Prints a character string with the printer's font. String is printed to a target surface with optional blending and clipping rectangle. Reimplemented in XFuRLESpritePrinter. Definition at line 243 of file XFuPrinter.cpp. References mLetter, mLetterSpacing, mLineHeight, mLineSpacing, mMaxletter, and mSpaceWidth. Referenced by print().

void XFuPrinter::setLetterSpacing | ( | INT32 | aSpacing | ) | `[virtual]`

| Sets letter spacing (i.e. extra space between characters). Definition at line 379 of file XFuPrinter.cpp. References mLetterSpacing. Referenced by XFuConfigurationData::loadPrinter().

void XFuPrinter::setLineSpacing | ( | INT32 | aSpacing | ) | `[virtual]`

| Sets line spacing (Y-coordinate offset from a row to the next row). Definition at line 391 of file XFuPrinter.cpp. References mLineSpacing.

void XFuPrinter::setSpaceWidth | ( | INT32 | aSpacing | ) | `[virtual]`

| Sets the width of a space. Definition at line 409 of file XFuPrinter.cpp. References mSpaceWidth.

void XFuPrinter::stringMetrics | ( | const CHAR * | aText,
|  | INT32 & | aWidth,
|  | INT32 & | aHeight
| ) | `[virtual]`

| Calculates how big an area a string would take if printed. Reimplemented in XFuRLESpritePrinter. Definition at line 323 of file XFuPrinter.cpp. References mLetter, mLetterSpacing, mLineHeight, mLineSpacing, mMaxletter, and mSpaceWidth. Referenced by print().

## Member Data Documentation

XFcGLSurface** XFuPrinter::mLetter`[protected]`

| Array of XFcGLSurfaces. Definition at line 77 of file XFuPrinter.h. Referenced by create(), getCharWidth(), print(), stringMetrics(), XFuPrinter(), and ~XFuPrinter().

INT32 XFuPrinter::mLetterSpacing`[protected]`

| Current letter spacing. Definition at line 78 of file XFuPrinter.h. Referenced by XFuRLESpritePrinter::create(), create(), getLetterSpacing(), XFuRLESpritePrinter::print(), print(), setLetterSpacing(), XFuRLESpritePrinter::stringMetrics(), and stringMetrics().

INT32 XFuPrinter::mLineHeight`[protected]`

| Line height. Definition at line 80 of file XFuPrinter.h. Referenced by XFuRLESpritePrinter::create(), create(), getLineHeight(), print(), XFuRLESpritePrinter::stringMetrics(), and stringMetrics().

INT32 XFuPrinter::mLineSpacing`[protected]`

| Current line spacing. Definition at line 79 of file XFuPrinter.h. Referenced by XFuRLESpritePrinter::create(), create(), getLineSpacing(), XFuRLESpritePrinter::print(), print(), setLineSpacing(), XFuRLESpritePrinter::stringMetrics(), and stringMetrics().

INT32 XFuPrinter::mMaxletter`[protected]`

| Maximum letter in the font. Definition at line 76 of file XFuPrinter.h. Referenced by XFuRLESpritePrinter::create(), create(), XFuRLESpritePrinter::getCharWidth(), getCharWidth(), XFuRLESpritePrinter::print(), print(), XFuRLESpritePrinter::stringMetrics(), stringMetrics(), ~XFuPrinter(), and XFuRLESpritePrinter::~XFuRLESpritePrinter().

INT32 XFuPrinter::mSpaceWidth`[protected]`

| Width of space character. Definition at line 81 of file XFuPrinter.h. Referenced by XFuRLESpritePrinter::create(), create(), XFuRLESpritePrinter::getCharWidth(), getCharWidth(), XFuRLESpritePrinter::print(), print(), setSpaceWidth(), XFuRLESpritePrinter::stringMetrics(), and stringMetrics().

The documentation for this class was generated from the following files:

- XFuPrinter.h
- XFuPrinter.cpp

|  | X-Forge Documentation Confidential Copyright © 2002-2003 Fathammer |  | Documentation generated with doxygen by Dimitri van Heesch