A simple font class. More...
#include <Image/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. | |
uint | w () const |
Width of each char, in pixels. | |
uint | h () const |
Height of each char, in pixels. | |
bool | operator== (const SimpleFont &f) const |
Equality operator; return true if the two fonts share the same data. | |
bool | operator!= (const SimpleFont &f) const |
Inequality operator. | |
Static Public Member Functions | |
static SimpleFont | FIXED (const uint width) |
Pseudo-constructor to get a font with fixed width. | |
static SimpleFont | fixedMaxWidth (const uint maxwidth) |
Get a standard font with width <= maxwidth. | |
static SimpleFont | fixedMaxHeight (const uint maxheight) |
Get a standard font with height <= maxheight. | |
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. |
A simple font class.
This is very impoverished by today's standards... Our font definitions only support fixed width and consist of the 95 characters (the first one is a space):
as created by AppMedia/app-font2c.C from an image of these characters. See writeText() in Image/DrawOps.H for a function that uses fonts.
Definition at line 56 of file SimpleFont.H.
SimpleFont::~SimpleFont | ( | ) |
Destructor.
Definition at line 96 of file SimpleFont.C.
const unsigned char * 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
Definition at line 100 of file SimpleFont.C.
SimpleFont 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.
Definition at line 107 of file SimpleFont.C.
References numStdFonts(), and SimpleFont().
Referenced by ColorbarsInput::ColorbarsInput(), HippocampusI::displayMap(), SDLdisplay::displayText(), SimulationViewerEyeHand::drawHand(), SimulationViewerHand::drawHand(), SimulationViewerStd::drawMegaCombo(), InferotemporalCortexI::evolve(), formatMapForDisplay(), SimulationViewerStd::prepMapForDisplay(), ColorbarsInput::readFrame(), and submain().
SimpleFont SimpleFont::fixedMaxHeight | ( | const uint | maxheight | ) | [static] |
Get a standard font with height <= maxheight.
If no font satisfies this criterion, return the smallest available font
Definition at line 143 of file SimpleFont.C.
References ASSERT, and numStdFonts().
Referenced by drawMeters(), linePlot(), and multilinePlot().
SimpleFont SimpleFont::fixedMaxWidth | ( | const uint | maxwidth | ) | [static] |
Get a standard font with width <= maxwidth.
If no font satisfies this criterion, return the smallest available font
Definition at line 126 of file SimpleFont.C.
References ASSERT, and numStdFonts().
Referenced by SimulationViewerStd::start2().
uint SimpleFont::h | ( | ) | const [inline] |
Height of each char, in pixels.
Definition at line 92 of file SimpleFont.H.
Referenced by formatMapForDisplay(), linePlot(), multilinePlot(), and SimulationViewerStd::prepMapForDisplay().
size_t SimpleFont::numStdFonts | ( | ) | [static] |
Return the number of standard fonts.
Definition at line 169 of file SimpleFont.C.
Referenced by FIXED(), fixedMaxHeight(), fixedMaxWidth(), and stdFont().
bool SimpleFont::operator!= | ( | const SimpleFont & | f | ) | const [inline] |
Inequality operator.
Definition at line 99 of file SimpleFont.H.
bool SimpleFont::operator== | ( | const SimpleFont & | f | ) | const [inline] |
Equality operator; return true if the two fonts share the same data.
Definition at line 95 of file SimpleFont.H.
SimpleFont SimpleFont::stdFont | ( | const size_t | n | ) | [static] |
Return the n'th standard font (n must be less than numStdFonts()).
Definition at line 160 of file SimpleFont.C.
References numStdFonts().
uint SimpleFont::w | ( | ) | const [inline] |
Width of each char, in pixels.
Definition at line 89 of file SimpleFont.H.
Referenced by SimulationViewerStd::drawFOA(), drawMeters(), formatMapForDisplay(), linePlot(), and multilinePlot().