XFuPrinter.h Source File

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

# XFuPrinter.h

Go to the documentation of this file.

    00001 /*! \file
    00002  * X-Forge Util <br>
    00003  * Copyright 2000-2003 Fathammer Ltd
    00004  *
    00005  * \brief Primitive bitmap font printer class.
    00006  *
    00007  * $Id: XFuPrinter.h,v 1.17 2003/08/12 13:33:52 lars Exp $
    00008  * $Date: 2003/08/12 13:33:52 $
    00009  * $Revision: 1.17 $
    00010  */
    00011
    00012 #ifndef XFUPRINTER_H_INCLUDED
    00013 #define XFUPRINTER_H_INCLUDED
    00014
    00015
    00016 //! Primitive bitmap font printer class.
    00017 /*!
    00018  * This class loads a single image file and creates as many XFcGLSurface objects as the
    00019  * font has characters. The image file must have all of its characters in ASCII order starting
    00020  * from character 33 (the exclamation mark, "!"). The image file must be as wide as a single
    00021  * character is high, i.e. for a 8x8 font with 20 characters and one character, the image
    00022  * dimensions would be 8x160.
    00023  */
    00024 class XFuPrinter
    00025 {
    00026 public:
    00027     //! Creates a XFuPrinter object from an image file.
    00028     static XFuPrinter * create(const CHAR *aFname);
    00029     //! Creates a XFuPrinter object from an image file, with choise of color key value.
    00030     /*!
    00031      * aAlphamask is the color key value.
    00032      * \sa XFcGLSurface
    00033      */
    00034     static XFuPrinter * create(const CHAR *aFname, INT32 aAlphamask);
    00035     //! Creates a XFuPrinter object from an image file, with choise of color key value and scale
    00036     static XFuPrinter * create(const CHAR *aFname, INT32 aAlphamask, REAL aXScale, REAL aYScale);
    00037     //! Prints a character string with the printer's font.
    00038     /*! String is printed to a target surface with optional blending and clipping rectangle.
    00039      */
    00040     virtual void print(XFcGLSurface *aTarget, INT32 aX, INT32 aY, const CHAR *aText,
    00041                        INT32 aBlendType = 0, INT32 aBlendValue = 0x7f, XFcRectangle *aClipRect = NULL);
    00042     //! Prints a character string with the printer's font, using target rectangle and word wrapping.
    00043     /*! If the string contains words that are wider than the rectangle, the words are printed on a new
    00044      *  line (no inter-word chopping is performed). If the aTargetRect is NULL, the whole surface is used.
    00045      *  \Note This function uses print() and stringmetrics() internally, so it will also work with rlespriteprinter.
    00046      *  \sa print
    00047      *  \return Pixel height of the total printing operation (ignores clipping)
    00048      */
    00049     INT32 print(XFcGLSurface *aTarget, XFcRectangle *aTargetRect, const CHAR *aText,
    00050                 INT32 aBlendType = 0, INT32 aBlendValue = 0x7f, XFcRectangle *aClipRect = NULL);
    00051
    00052     //! Calculates how big an area a string would take if printed.
    00053     virtual void stringMetrics(const CHAR *aText, INT32 &aWidth, INT32 &aHeight);
    00054     //! Returns the width of a single character.
    00055     virtual INT32 getCharWidth(CHAR aChar);
    00056     //! Sets the width of a space.
    00057     virtual void setSpaceWidth(INT32 aSpacing);
    00058     //! Sets letter spacing (i.e. extra space between characters).
    00059     virtual void setLetterSpacing(INT32 aSpacing);
    00060     //! Returns the current letter spacing (i.e. extra space between characters).
    00061     virtual INT32 getLetterSpacing();
    00062     //! Sets line spacing (Y-coordinate offset from a row to the next row).
    00063     virtual void setLineSpacing(INT32 aSpacing);
    00064     //! Returns the current line spacing (Y-coordinate offset from a row to the next row).
    00065     virtual INT32 getLineSpacing();
    00066     //! Returns height of one printer line.
    00067     virtual INT32 getLineHeight();
    00068     //! Virtual destructor.
    00069     virtual ~XFuPrinter();
    00070
    00071 protected:
    00072
    00073     //! Protected constructor.
    00074     XFuPrinter();
    00075
    00076     INT32 mMaxletter;           //!< Maximum letter in the font.
    00077     XFcGLSurface **mLetter;     //!< Array of XFcGLSurfaces.
    00078     INT32 mLetterSpacing;       //!< Current letter spacing.
    00079     INT32 mLineSpacing;         //!< Current line spacing.
    00080     INT32 mLineHeight;          //!< Line height.
    00081     INT32 mSpaceWidth;          //!< Width of space character.
    00082 };
    00083
    00084
    00085 #endif // !XFUPRINTER_H_INCLUDED
    00086

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