VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
DtTTSDrawer Class Reference

class DtTTSDrawer: More...

Inheritance diagram for DtTTSDrawer:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtTTSDrawer ()
 DtTTSDrawer (const QString &family, int pointSize=24)
virtual ~DtTTSDrawer ()
virtual bool draw (QPainter &paint, const DtSymbol *const symbol) const
virtual QSize calcBBox (const DtSymbol *const symbol) const
 Calculate the drawn size of this symbol.
virtual void setFont (const QString &family, unsigned pointSize)
virtual void setFont (const QFont &font)
const QFont & font () const
virtual bool compareFamily (const QString &desiredFamily, const QFont &font) const
 Compare the desired family to the one actually loaded.
virtual QPoint calcOrigin (const DtTTSSymbol *s, bool calcBitmapOrigin=false) const
 Calculates the upper left corner of the text and sets the appearance font for drawing, so, if you call this routine, you do not need to call setAppearance.
virtual void paintFont (QPainter &painter, int left, int base, const DtTTSSymbol &symbol, const QColor &) const
 Paint the font symbol on the device, so that its left, bottom corner is at the specified location.
virtual void paintFont (QPainter &painter, QRect &rect, const DtTTSSymbol &t, const QColor &, int flags=0) const
virtual void setCenter (bool b)
 Sets whether or not to center the text. By default left jusitfies.

Static Public Member Functions

static DtSymbolDrawercreate ()

Protected Member Functions

virtual void setAppearance (const DtTTSSymbol &s) const
 Use symbol to set attributes.
virtual bool drawSymbolAsBitmap (QPainter &painter, const QPoint &origin, const DtTTSSymbol &t) const
virtual bool drawFont (QPainter &painter, const QPoint &origin, const DtTTSSymbol &t) const
virtual QString calcKey (const DtTTSSymbol &symbol) const
virtual void createFontKey ()
virtual QHash< QString,
QPixmap >::const_iterator 
insertPix (const DtTTSSymbol &symbol, const QPixmap *pix) const
 Cache management functions.
virtual const QPixmap * lookupPix (const DtTTSSymbol &symbol) const
 Cache management functions.
virtual const QPixmap * createPix (const DtTTSSymbol *pSymbol) const
 Cache management functions.

Protected Attributes

QFont myFont
 Mutable since we are just saving this information for performance reasons.
QFont myDefaultFont
QFontMetrics myFontMetrics
bool myCenter
QHash< QString, QPixmap > myCache
 mutable since we are just saving this information for performance reasons.
QString myFontKey

Private Member Functions

 DtTTSDrawer (const DtTTSDrawer &orig)
DtTTSDraweroperator= (const DtTTSDrawer &orig)

Detailed Description

class DtTTSDrawer:

Concrete class which draws scaled strings using a true type font. Subclassed from BMP Drawer to support caching of font drawing to bitmaps (QPixmap). This is a faster way to draw under windows than font drawing (as of Qt 4.4.1)


Constructor & Destructor Documentation

DtTTSDrawer::DtTTSDrawer ( const QString &  family,
int  pointSize = 24 
)
virtual DtTTSDrawer::~DtTTSDrawer ( ) [virtual]
DtTTSDrawer::DtTTSDrawer ( const DtTTSDrawer orig) [private]

Member Function Documentation

virtual bool DtTTSDrawer::draw ( QPainter &  paint,
const DtSymbol *const  symbol 
) const [virtual]

Implements DtSymbolDrawer.

virtual QSize DtTTSDrawer::calcBBox ( const DtSymbol *const  symbol) const [virtual]

Calculate the drawn size of this symbol.

The symbol must be of a type this drawer can recognize.

Implements DtSymbolDrawer.

Reimplemented in DtTTFUnitSymbolDrawer.

virtual void DtTTSDrawer::setFont ( const QString &  family,
unsigned  pointSize 
) [virtual]
virtual void DtTTSDrawer::setFont ( const QFont &  font) [virtual]
const QFont& DtTTSDrawer::font ( ) const
virtual bool DtTTSDrawer::compareFamily ( const QString &  desiredFamily,
const QFont &  font 
) const [virtual]

Compare the desired family to the one actually loaded.

virtual QPoint DtTTSDrawer::calcOrigin ( const DtTTSSymbol s,
bool  calcBitmapOrigin = false 
) const [virtual]

Calculates the upper left corner of the text and sets the appearance font for drawing, so, if you call this routine, you do not need to call setAppearance.

Reimplemented in DtMMMDrawer, and DtTTFUnitSymbolDrawer.

virtual void DtTTSDrawer::paintFont ( QPainter &  painter,
int  left,
int  base,
const DtTTSSymbol symbol,
const QColor &   
) const [virtual]

Paint the font symbol on the device, so that its left, bottom corner is at the specified location.

virtual void DtTTSDrawer::paintFont ( QPainter &  painter,
QRect &  rect,
const DtTTSSymbol t,
const QColor &  ,
int  flags = 0 
) const [virtual]
virtual void DtTTSDrawer::setCenter ( bool  b) [virtual]

Sets whether or not to center the text. By default left jusitfies.

static DtSymbolDrawer* DtTTSDrawer::create ( ) [static]

Reimplemented in DtTTFUnitSymbolDrawer, and DtMMMDrawer.

virtual void DtTTSDrawer::setAppearance ( const DtTTSSymbol s) const [protected, virtual]

Use symbol to set attributes.

virtual bool DtTTSDrawer::drawSymbolAsBitmap ( QPainter &  painter,
const QPoint &  origin,
const DtTTSSymbol t 
) const [protected, virtual]

Reimplemented in DtMMMDrawer.

virtual bool DtTTSDrawer::drawFont ( QPainter &  painter,
const QPoint &  origin,
const DtTTSSymbol t 
) const [protected, virtual]

Reimplemented in DtMMMDrawer.

virtual QString DtTTSDrawer::calcKey ( const DtTTSSymbol symbol) const [protected, virtual]
virtual QHash<QString, QPixmap>::const_iterator DtTTSDrawer::insertPix ( const DtTTSSymbol symbol,
const QPixmap *  pix 
) const [protected, virtual]

Cache management functions.

virtual const QPixmap* DtTTSDrawer::lookupPix ( const DtTTSSymbol symbol) const [protected, virtual]

Cache management functions.

virtual const QPixmap* DtTTSDrawer::createPix ( const DtTTSSymbol pSymbol) const [protected, virtual]

Cache management functions.

Reimplemented in DtMMMDrawer.

virtual void DtTTSDrawer::createFontKey ( ) [protected, virtual]
DtTTSDrawer& DtTTSDrawer::operator= ( const DtTTSDrawer orig) [private]

Member Data Documentation

QFont DtTTSDrawer::myFont [mutable, protected]

Mutable since we are just saving this information for performance reasons.

We reset it for every symbol.

QFont DtTTSDrawer::myDefaultFont [mutable, protected]
QFontMetrics DtTTSDrawer::myFontMetrics [mutable, protected]
QHash<QString, QPixmap> DtTTSDrawer::myCache [mutable, protected]

mutable since we are just saving this information for performance reasons.

QString DtTTSDrawer::myFontKey [protected]

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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)