iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nrt::SimpleFont Class Reference

#include <nrt/ImageProc/Drawing/SimpleFont.H>

A simple font class.

 This is a very impoverished (by today's standards...) font class that allows one to write text into Image
 objects. The SimpleFont definitions only support fixed width and consist of the 95 following characters (the first
 one is a space):
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

as created by saliency/src/AppMedia/app-font2c.C in the INVT toolkit from an image of these characters. The function nrt::drawText() uses SimpleFont to render text into Image arrys of pixels.

See Also
Text Drawing

Definition at line 80 of file SimpleFont.H.

Public Member Functions

 SimpleFont (const uint cw, const uint ch, const unsigned char *cdata)
 Constructor.
 
 ~SimpleFont ()
 Destructor.
 
const unsigned char * charptr (const int c) const
 Helper function to get a pointer to a specific char. More...
 
uint w () const
 Width of each char, in pixels.
 
uint h () const
 Height of each char, in pixels.
 
bool operator== (SimpleFont const &f) const
 Equality operator; return true if the two fonts share the same data.
 
bool operator!= (SimpleFont const &f) const
 Inequality operator.
 

Static Public Member Functions

static SimpleFont FIXED (const uint width)
 Pseudo-constructor to get a font with fixed width. More...
 
static SimpleFont fixedMaxWidth (const uint maxwidth)
 Get a standard font with width <= maxwidth. More...
 
static SimpleFont fixedMaxHeight (const uint maxheight)
 Get a standard font with height <= maxheight. More...
 
static SimpleFont stdFont (const size_t n)
 Return the n'th standard font (n must be less than numStdFonts())
 
static size_t numStdFonts ()
 Return the number of standard fonts.
 

Member Function Documentation

static SimpleFont nrt::SimpleFont::FIXED ( const uint  width)
static

Pseudo-constructor to get a font with fixed width.

Supported widths include: 6, 7, 8, 9, 10, 14 and 20.

Examples:
tests/test-UKF.C.
static SimpleFont nrt::SimpleFont::fixedMaxWidth ( const uint  maxwidth)
static

Get a standard font with width <= maxwidth.

If no font satisfies this criterion, return the smallest available font

static SimpleFont nrt::SimpleFont::fixedMaxHeight ( const uint  maxheight)
static

Get a standard font with height <= maxheight.

If no font satisfies this criterion, return the smallest available font

const unsigned char* nrt::SimpleFont::charptr ( const int  c) const

Helper function to get a pointer to a specific char.

a Pointer to 'space' is returned if c < 32 or c > 126

Referenced by nrt::drawText().


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