MityDSP Documentation Index

MityDSP::tcDspFont Class Reference

The tcDspFont class allows various fixed and proportional fonts to be defined for use (with tcDspDisplay, for example). More...

#include <core/DspFont.h>

List of all members.

Public Member Functions

 tcDspFont (const char *aaFontName, int anStartChar, int anNumChars, int anBytesPerChar, int anHeight, const int *apWidth, const unsigned char *apBitmap)
 This constructor is used to create an instance of a font using precompile font structure information.
 tcDspFont (const char *aaFontName, const char *apFileName)
 This constructor is used to create an instance of a font using a filename.
 tcDspFont (const char *aaFontName, const char *apFileImage, int anImageLen)
 This constructor is used to create an instance of a font using an image buffer representing a MityDSP font file (e.g., "font.mfn") generated from the FontExtract MityDSP tool.
 ~tcDspFont ()
 This routine is used to destroy an instance of a font.
int getHeight (void)
 This routine returns the character height (constant across font).
int getWidth (unsigned char anTheChar)
 This routine returns the width of the specified character in the stored font bitmap / glyph.
const unsigned char * getBitmap (unsigned char anTheChar)
 This routine returns a pointer to the bitmap of the specified character in the font.
int getAdvance (unsigned char anTheChar)
 This routine returns the number of pixels that should be advanced following drawing the specified character to the sceen.
int getPreAdvance (unsigned char anTheChar)
 This routine returns the number of pixels that should be advanced prior to drawing the specified character to the sceen.
int getPreAdvance (unsigned char anTheChar, unsigned char anPrevChar)
 This routine returns the number of pixels that should be advanced prior to drawing the specified character to the sceen.
int getBitsPerPixel ()

Public Attributes

const char * maPublicName
 Pointer to name of the font.

Static Public Attributes

static const int gnFONT_NUM_CHARS = 256

Detailed Description

The tcDspFont class allows various fixed and proportional fonts to be defined for use (with tcDspDisplay, for example).

All fonts are 1 bits per pixel.

See also:
tcDspFont Page

Constructor & Destructor Documentation

tcDspFont::tcDspFont ( const char *  aaFontName,
int  anStartChar,
int  anNumChars,
int  anBytesPerChar,
int  anHeight,
const int *  apWidth,
const unsigned char *  apBitmap 
)

This constructor is used to create an instance of a font using precompile font structure information.

Parameters:
[in] aaFontName Public name of the font being defined.
[in] anStartChar Index of first character in the font.
[in] anNumChars Number of characters in the font.
[in] anBytesPerChar Number of bytes used to define each character.
[in] anHeight Character height (in bits).
[in] apWidth Pointer to an array of character widths (must be anNumChars in length).
[in] apBitmap Pointer to character bitmaps (must be anNumChars x anBytesPerChar in length).
See also:
DspFont.h
tcDspFont::tcDspFont ( const char *  aaFontName,
const char *  apFileName 
)

This constructor is used to create an instance of a font using a filename.

The file should reference a MityDSP Font File ("file.mfn") as generated by the FontExtract tool.

Parameters:
[in] aaFontName Public name of the font being defined.
[in] apFileName Pointer to the file name of the MFN file.
See also:
DspFont.h
tcDspFont::tcDspFont ( const char *  aaFontName,
const char *  apFileImage,
int  anImageLen 
)

This constructor is used to create an instance of a font using an image buffer representing a MityDSP font file (e.g., "font.mfn") generated from the FontExtract MityDSP tool.

Parameters:
[in] aaFontName Public name of the font being defined.
[in] apFileImage Pointer to the file image buffer.
[in] anImageLen Number of bytes of the apFileImage buffer.
See also:
DspFont.h
tcDspFont::~tcDspFont (  ) 

This routine is used to destroy an instance of a font.

See also:
DspFont.h

Member Function Documentation

int tcDspFont::getHeight ( void   ) 

This routine returns the character height (constant across font).

Returns:
Character height in pixels.
See also:
DspFont.h
int tcDspFont::getWidth ( unsigned char  anTheChar  ) 

This routine returns the width of the specified character in the stored font bitmap / glyph.

Parameters:
[in] anTheChar Character number (0-255).
Returns:
Character width in pixels.
See also:
DspFont.h
const unsigned char * tcDspFont::getBitmap ( unsigned char  anTheChar  ) 

This routine returns a pointer to the bitmap of the specified character in the font.

The bitmap is packed with a bit depth of 1.

Parameters:
[in] anTheChar Character number (0-255).
Returns:
Constant pointer to the character's bitmap.
See also:
DspFont.h
int tcDspFont::getAdvance ( unsigned char  anTheChar  ) 

This routine returns the number of pixels that should be advanced following drawing the specified character to the sceen.

Note: The advance may be different from the width specified in the getWidth method.

Note:
the advance is relative to the intial origin of the drawing position prior to applying the getPreAdvance offset in the drawing cycle.
Parameters:
[in] anTheChar Character number (0-255).
Returns:
Number of pixels to advance prior to drawing the next character
See also:
DspFont.h
int tcDspFont::getPreAdvance ( unsigned char  anTheChar  ) 

This routine returns the number of pixels that should be advanced prior to drawing the specified character to the sceen.

This method allows for reduced glyph bitmap size by shaving padding off the front side of a glyph.

Parameters:
[in] anTheChar Character number (0-255).
Returns:
Number of pixels to advance prior to drawing the next character
See also:
DspFont.h
int tcDspFont::getPreAdvance ( unsigned char  anTheChar,
unsigned char  anPrevChar 
)

This routine returns the number of pixels that should be advanced prior to drawing the specified character to the sceen.

The intent of this method is to provide Kerning capability.

Note:
currently this method does not support kerning and is equivalent to getPreAdvance(unsigned char anTheChar)
Parameters:
[in] anTheChar Character number (0-255).
[in] anPrevChar Previously drawn character (0-255);
Returns:
Number of pixels to advance prior to drawing the next character
See also:
DspFont.h
int MityDSP::tcDspFont::getBitsPerPixel (  )  [inline]

Member Data Documentation

const int MityDSP::tcDspFont::gnFONT_NUM_CHARS = 256 [static]

Pointer to name of the font.


  
Generated on Fri Sep 23 16:33:49 2011 for MityDSP Core by  Doxygen Version 1.6.1
Copyright © 2009, Critical Link LLC, All rights reserved.