Wt::Font Class Reference

#include <font.h>

Collaboration diagram for Wt::Font:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::map< std::string,
Font
Map
 Normal = TTF_STYLE_NORMAL
 Bold = TTF_STYLE_BOLD
 Italic = TTF_STYLE_ITALIC
 Underline = TTF_STYLE_UNDERLINE
enum  FaceStyle { Normal = TTF_STYLE_NORMAL, Bold = TTF_STYLE_BOLD, Italic = TTF_STYLE_ITALIC, Underline = TTF_STYLE_UNDERLINE }

Public Member Functions

 Font (const std::string &filename, int ptsize, int style=Normal, int index=0)
 Font ()
 Font (const std::string &desc)
std::string description () const
std::string family () const
void setFont (std::string &filename)
int pointSize () const
void setPointSize (int ptsize)
bool bold () const
void setBold (bool enable)
bool italic () const
void setItalic (bool enable)
bool underline () const
void setUnderline (bool enable)
int ascent () const
int descent () const
int height () const
int lineSpacing () const
int leading () const
int leftBearing (Uint16 ch) const
int rightBearing (Uint16 ch) const
int width (Uint16 ch) const
Size size (const Uint16 ch) const
Rect boundingRect (const Uint16 ch) const
Rect boundingRect (const std::string &str, int len=-1) const
Size size (const std::string &text) const
Size size (const Uint16 *text) const

Static Public Member Functions

static void init ()
static void quit ()
static int defaultFontSize (int ptsize=0)
static FontdefaultFont ()

Static Public Attributes

static Map map

Protected Types

 ASCII
 UTF8
 Solid
 Shaded
 Blended
enum  Encoding { ASCII, UTF8 }
enum  Rendering { Solid, Shaded, Blended }

Protected Member Functions

void detach ()
bool style () const
bool styleFlag (int flag) const
void setStyleFlag (int flag, bool enable)
void setRendering (int rendering)
int rendering () const
void setEncoding (int encoding)
int encoding () const
void setBackgroundColor (const Color &bg_color)
const ColorbackgroundColor () const
void setForegroundColor (const Color &fg_color)
const ColorforegroundColor () const
Pixmap blitText (const std::string &text) const
Pixmap blitText (const Uint16 *text) const
int faces () const
std::string faceStyleName () const
bool monoSpace () const

Private Types

typedef boost::shared_ptr<
TTF_Font > 
Ptr

Private Member Functions

 operator const Ptr () const
 operator Ptr ()
 operator const TTF_Font * () const
 operator TTF_Font * ()
TTF_Font * deconst () const

Static Private Member Functions

static Ptr open_default_font (int ptsize)
static Ptr open_font (const std::string &filename, int ptsize, int style, int index=0)

Private Attributes

Ptr ttf_font
std::string filename_
int ptsize_
int index_
int rendering_
int encoding_
Color bg_color_
Color fg_color_

Static Private Attributes

static Fontdefault_font = 0

Friends

class Painter

Classes

class  Deleter

Detailed Description

Definition at line 38 of file font.h.


Member Typedef Documentation

typedef std::map<std::string, Font> Wt::Font::Map

Definition at line 167 of file font.h.

typedef boost::shared_ptr<TTF_Font> Wt::Font::Ptr [private]

Definition at line 131 of file font.h.


Member Enumeration Documentation

enum Wt::Font::Encoding [protected]

Enumerator:
ASCII 
UTF8 

Definition at line 84 of file font.h.

00084                  {
00085         ASCII,
00086         UTF8
00087     } Encoding;

enum Wt::Font::FaceStyle

Enumerator:
Normal 
Bold 
Italic 
Underline 

Definition at line 74 of file font.h.

00074                  {
00075         Normal = TTF_STYLE_NORMAL,
00076         Bold = TTF_STYLE_BOLD,
00077         Italic = TTF_STYLE_ITALIC,
00078         Underline = TTF_STYLE_UNDERLINE
00079     } FaceStyle;

enum Wt::Font::Rendering [protected]

Enumerator:
Solid 
Shaded 
Blended 

Definition at line 89 of file font.h.

00089                  {
00090         Solid,
00091         Shaded,
00092         Blended
00093     } Rendering;


Constructor & Destructor Documentation

Wt::Font::Font ( const std::string &  filename,
int  ptsize,
int  style = Normal,
int  index = 0 
)

Definition at line 65 of file font.cpp.

References description(), filename_, trace, and ttf_font.

00065                                                                       :
00066         ttf_font(open_font(filename, defaultFontSize(ptsize), style, index)),
00067         filename_(filename),
00068         ptsize_(defaultFontSize(ptsize)),
00069         index_(index),
00070         rendering_(DEFAULT_RENDERING),
00071         encoding_(DEFAULT_ENCODING),
00072         bg_color_(DEFAULT_BACKGROUNDCOLOR),
00073 fg_color_(DEFAULT_FOREGROUNDCOLOR) {
00074     trace("font", "Creating font %p (%p) (%s)\n", this, ttf_font.get(), filename_.c_str());
00075     trace("font") << "Adding to Font::Map " << *this <<
00076     " use count: " << ttf_font.use_count() << std::endl;
00077     map[this->description()] = *this;
00078 }

Here is the call graph for this function:

Wt::Font::Font (  ) 

Definition at line 80 of file font.cpp.

References trace, and ttf_font.

Referenced by Font(), and init().

00080            :
00081         ttf_font(open_default_font(defaultFontSize())),
00082         filename_("*"),
00083         ptsize_(defaultFontSize()),
00084         index_(0),
00085         rendering_(DEFAULT_RENDERING),
00086         encoding_(DEFAULT_ENCODING),
00087         bg_color_(DEFAULT_BACKGROUNDCOLOR),
00088 fg_color_(DEFAULT_FOREGROUNDCOLOR) {
00089     trace("font", "Creating font %p (%p) (default)\n", this, ttf_font.get());
00090     trace("font") << "Adding to Font::Map " << *this <<
00091     " use count: " << ttf_font.use_count() << std::endl;
00092 }

Wt::Font::Font ( const std::string &  desc  ) 

Definition at line 94 of file font.cpp.

References Bold, Font(), Italic, Normal, trace, ttf_font, Underline, and Warn.

00094                                 {
00095     Map::iterator it = map.find(desc);
00096     trace("font", "Looking in Font::Map for '%s'\n", desc.c_str());
00097 
00098     // if it is in cache return it
00099     if (it != map.end()) {
00100         *this = it->second;
00101         trace("font") << "Found in Font::Map " << *this <<
00102         " use count: " << ttf_font.use_count() << std::endl;
00103         return;
00104     }
00105 
00106     // let's parse the description and load it in cache
00107     boost::char_separator<char> sep(", ");
00108     typedef boost::tokenizer<boost::char_separator<char> > Tokenizer;
00109     Tokenizer tokens(desc, sep);
00110     Tokenizer::iterator token = tokens.begin();
00111 
00112     std::string filename;
00113     if (token != tokens.end()) {
00114         filename = *token;
00115         ++token;
00116     }
00117 
00118     int point_size = 0;
00119     if (token != tokens.end()) {
00120         point_size = boost::lexical_cast<int>(*token);
00121         ++token;
00122     }
00123 
00124     int st = Normal;
00125     if (token != tokens.end()) {
00126         std::string flags = *token;
00127         for (std::string::iterator ct = flags.begin(),
00128                 ctend = flags.end(); ct != ctend; ++ct) {
00129             switch (*ct) {
00130             case 'b':
00131                 st |= Bold;
00132                 break;
00133             case 'i':
00134                 st |= Italic;
00135                 break;
00136             case 'u':
00137                 st |= Underline;
00138                 break;
00139             default:
00140                 Warn("Unknown specifier '%c' in font "
00141                      "attibute desctrition '%s'\n", *ct, flags.c_str());
00142                 break;
00143             }
00144         }
00145     }
00146 
00147     trace("font", "Parsing font description as '%s, %d, %d'\n",
00148           filename.c_str(), point_size, st);
00149 
00150     *this = Font(filename, point_size, st);
00151     trace("font") << "Added to Font::Map " << *this <<
00152     " use count: " << ttf_font.use_count() << std::endl;
00153 }

Here is the call graph for this function:


Member Function Documentation

int Wt::Font::ascent (  )  const

Definition at line 373 of file font.cpp.

References deconst().

Referenced by Wt::PushButton::drawButtonLabel(), and Wt::Painter::drawText().

00373                        {
00374     return TTF_FontAscent(deconst());
00375 }

Here is the call graph for this function:

const Color & Wt::Font::backgroundColor (  )  const [protected]

Definition at line 293 of file font.cpp.

References bg_color_.

00293                                          {
00294     return bg_color_;
00295 }

Pixmap Wt::Font::blitText ( const Uint16 *  text  )  const [protected]

Definition at line 354 of file font.cpp.

References bg_color_, Blended, deconst(), fg_color_, rendering_, Shaded, and Solid.

00354                                               {
00355     SDL_Surface *s = 0;
00356     switch (rendering_) {
00357     case Solid:
00358         s = TTF_RenderUNICODE_Solid(deconst(), text, fg_color_);
00359         break;
00360     case Shaded:
00361         s = TTF_RenderUNICODE_Shaded(deconst(), text, fg_color_, bg_color_);
00362         break;
00363     case Blended:
00364         s = TTF_RenderUNICODE_Blended(deconst(), text, fg_color_);
00365         break;
00366     default:
00367         break;
00368     }
00369 
00370     return Pixmap(s);
00371 }

Here is the call graph for this function:

Pixmap Wt::Font::blitText ( const std::string &  text  )  const [protected]

Definition at line 322 of file font.cpp.

References ASCII, bg_color_, Blended, deconst(), encoding_, fg_color_, rendering_, Shaded, Solid, and UTF8.

Referenced by Wt::Painter::drawText().

00322                                                  {
00323     SDL_Surface *s = 0;
00324     switch (rendering_) {
00325     case Solid:
00326         if (encoding_ == ASCII) {
00327             s = TTF_RenderText_Solid(deconst(), text.c_str(), fg_color_);
00328         } else if (encoding_ == UTF8) {
00329             s = TTF_RenderUTF8_Solid(deconst(), text.c_str(), fg_color_);
00330         }
00331         break;
00332     case Shaded:
00333         if (encoding_ == ASCII) {
00334             s = TTF_RenderText_Shaded(deconst(),
00335                                       text.c_str(), fg_color_, bg_color_);
00336         } else if (encoding_ == UTF8) {
00337             s = TTF_RenderUTF8_Shaded(deconst(), text.c_str(),fg_color_, bg_color_);
00338         }
00339         break;
00340     case Blended:
00341         if (encoding_ == ASCII) {
00342             s = TTF_RenderText_Blended(deconst(), text.c_str(), fg_color_);
00343         } else if (encoding_ == UTF8) {
00344             s = TTF_RenderUTF8_Blended(deconst(), text.c_str(), fg_color_);
00345         }
00346         break;
00347     default:
00348         break;
00349     }
00350 
00351     return Pixmap(s);
00352 }

Here is the call graph for this function:

bool Wt::Font::bold (  )  const

Definition at line 245 of file font.cpp.

References styleFlag().

00245                       {
00246     return styleFlag(TTF_STYLE_BOLD);
00247 }

Here is the call graph for this function:

Rect Wt::Font::boundingRect ( const std::string &  str,
int  len = -1 
) const

Definition at line 438 of file font.cpp.

References size().

00438                                                            {
00439     const std::string s = (len == -1) ? str : str.substr(0, len);
00440     return Rect(Point(0, 0), size(str));
00441 }

Here is the call graph for this function:

Rect Wt::Font::boundingRect ( const Uint16  ch  )  const

Definition at line 432 of file font.cpp.

References deconst().

Referenced by Wt::Painter::boundingRect().

00432                                              {
00433     int minx, maxx, miny, maxy;
00434     TTF_GlyphMetrics(deconst(), ch, &minx, &maxx, &miny, &maxy, 0);
00435     return Rect(minx, miny, maxx - minx + 1, maxy - miny + 1);
00436 }

Here is the call graph for this function:

TTF_Font * Wt::Font::deconst (  )  const [private]

Definition at line 162 of file font.cpp.

Referenced by ascent(), blitText(), boundingRect(), descent(), faces(), faceStyleName(), family(), height(), leftBearing(), lineSpacing(), monoSpace(), rightBearing(), size(), style(), and width().

00162                               {
00163     //SDL breakage
00164     return const_cast<TTF_Font *>
00165            (static_cast<const TTF_Font *>(*this));
00166 }

Font & Wt::Font::defaultFont (  )  [static]

Definition at line 184 of file font.cpp.

References default_font.

00184                         {
00185     return *default_font;
00186 }

int Wt::Font::defaultFontSize ( int  ptsize = 0  )  [static]

Definition at line 180 of file font.cpp.

References DEFAULT_POINTSIZE.

00180                                     {
00181     return (ptsize) ? ptsize : DEFAULT_POINTSIZE;
00182 }

int Wt::Font::descent (  )  const

Definition at line 377 of file font.cpp.

References deconst().

00377                         {
00378     return TTF_FontDescent(deconst());
00379 }

Here is the call graph for this function:

std::string Wt::Font::description (  )  const

Definition at line 188 of file font.cpp.

References Bold, filename_, Italic, pointSize(), style(), and Underline.

Referenced by Font(), init(), and Wt::operator<<().

00188                                   {
00189     std::string desc = filename_ + ", ";
00190     desc += boost::lexical_cast<std::string>(pointSize())  + ", ";
00191 
00192     int st = style();
00193     desc += (st & Bold) ? "b" : "";
00194     desc += (st & Italic) ? "i" : "";
00195     desc += (st & Underline) ? "u" : "";
00196     return desc;
00197 }

Here is the call graph for this function:

void Wt::Font::detach (  )  [protected]

Definition at line 155 of file font.cpp.

References filename_, index_, open_font(), pointSize(), style(), and ttf_font.

Referenced by setBackgroundColor(), setEncoding(), setForegroundColor(), setRendering(), and setStyleFlag().

00155                   {
00156     //avoid detaching if we are the only client for this font
00157     if (!ttf_font.unique()) {
00158         ttf_font = open_font(filename_, pointSize(), style(), index_);
00159     }
00160 }

Here is the call graph for this function:

int Wt::Font::encoding (  )  const [protected]

Definition at line 284 of file font.cpp.

References encoding_.

Referenced by setEncoding().

00284                          {
00285     return encoding_;
00286 }

int Wt::Font::faces (  )  const [protected]

Definition at line 393 of file font.cpp.

References deconst().

00393                       {
00394     return TTF_FontFaces(deconst());
00395 }

Here is the call graph for this function:

std::string Wt::Font::faceStyleName (  )  const [protected]

Definition at line 397 of file font.cpp.

References deconst().

00397                                     {
00398     const char *face_style_name = TTF_FontFaceStyleName(deconst());
00399     if (!face_style_name)
00400         face_style_name = "*";
00401     return face_style_name;
00402 }

Here is the call graph for this function:

std::string Wt::Font::family (  )  const

Definition at line 199 of file font.cpp.

References deconst().

00199                              {
00200     const char *font_family = TTF_FontFaceFamilyName(deconst());
00201     if (!font_family)
00202         font_family = "*";
00203     return font_family;
00204 }

Here is the call graph for this function:

const Color & Wt::Font::foregroundColor (  )  const [protected]

Definition at line 302 of file font.cpp.

References fg_color_.

00302                                          {
00303     return fg_color_;
00304 }

int Wt::Font::height (  )  const

Definition at line 381 of file font.cpp.

References deconst().

Referenced by leading().

00381                        {
00382     return TTF_FontHeight(deconst());
00383 }

Here is the call graph for this function:

void Wt::Font::init (  )  [static]

Definition at line 168 of file font.cpp.

References default_font, description(), and Font().

Referenced by Wt::Application::Application().

00168                 {
00169     TTF_Init();
00170     default_font = new Font();
00171     map[default_font->description()] = *default_font;
00172 }

Here is the call graph for this function:

bool Wt::Font::italic (  )  const

Definition at line 253 of file font.cpp.

References styleFlag().

00253                         {
00254     return styleFlag(TTF_STYLE_ITALIC);
00255 }

Here is the call graph for this function:

int Wt::Font::leading (  )  const

Definition at line 389 of file font.cpp.

References height(), and lineSpacing().

00389                         {
00390     return lineSpacing() - height();
00391 }

Here is the call graph for this function:

int Wt::Font::leftBearing ( Uint16  ch  )  const

Definition at line 408 of file font.cpp.

References deconst().

00408                                      {
00409     int minx;
00410     TTF_GlyphMetrics(deconst(), ch, &minx, 0, 0, 0, 0);
00411     return minx;
00412 }

Here is the call graph for this function:

int Wt::Font::lineSpacing (  )  const

Definition at line 385 of file font.cpp.

References deconst().

Referenced by leading().

00385                             {
00386     return TTF_FontLineSkip(deconst());
00387 }

Here is the call graph for this function:

bool Wt::Font::monoSpace (  )  const [protected]

Definition at line 404 of file font.cpp.

References deconst().

00404                            {
00405     return TTF_FontFaceIsFixedWidth(deconst()) > 0;
00406 }

Here is the call graph for this function:

Font::Ptr Wt::Font::open_default_font ( int  ptsize  )  [static, private]

Definition at line 45 of file font.cpp.

References Wt::BultinFontData, Wt::BultinFontDataSize, default_font, and ttf_font.

Referenced by open_font().

00045                                           {
00046     if (!default_font) {
00047         SDL_RWops *rwop = SDL_RWFromConstMem(BultinFontData,
00048                                              BultinFontDataSize);
00049         return Ptr(TTF_OpenFontRW(rwop, true, ptsize), Deleter());
00050     }
00051     return default_font->ttf_font;
00052 }

Font::Ptr Wt::Font::open_font ( const std::string &  filename,
int  ptsize,
int  style,
int  index = 0 
) [static, private]

Definition at line 54 of file font.cpp.

References open_default_font(), and style().

Referenced by detach(), setFont(), and setPointSize().

00055                                                             {
00056     Ptr f(TTF_OpenFontIndex(filename.c_str(), ptsize, index), Deleter());
00057     if (!f)
00058         f = open_default_font(ptsize);
00059 
00060     if (f)
00061         TTF_SetFontStyle(f.get(), style);
00062     return f;
00063 }

Here is the call graph for this function:

Wt::Font::operator const Ptr (  )  const [inline, private]

Definition at line 142 of file font.h.

References ttf_font.

00142                                 {
00143         return ttf_font;
00144     }

Wt::Font::operator const TTF_Font * (  )  const [inline, private]

Definition at line 150 of file font.h.

References ttf_font.

00150                                       {
00151         return ttf_font.get();
00152     }

Wt::Font::operator Ptr (  )  [inline, private]

Definition at line 146 of file font.h.

References ttf_font.

00146                      {
00147         return ttf_font;
00148     }

Wt::Font::operator TTF_Font * (  )  [inline, private]

Definition at line 154 of file font.h.

References ttf_font.

00154                           {
00155         return ttf_font.get();
00156     }

int Wt::Font::pointSize (  )  const

Definition at line 211 of file font.cpp.

References ptsize_.

Referenced by description(), detach(), and setFont().

00211                           {
00212     return ptsize_;
00213 }

void Wt::Font::quit (  )  [static]

Definition at line 174 of file font.cpp.

References default_font.

Referenced by Wt::Application::~Application().

00174                 {
00175     map.clear();
00176     delete default_font;
00177     TTF_Quit();
00178 }

int Wt::Font::rendering (  )  const [protected]

Definition at line 275 of file font.cpp.

References rendering_.

Referenced by setRendering().

00275                           {
00276     return rendering_;
00277 }

int Wt::Font::rightBearing ( Uint16  ch  )  const

Definition at line 414 of file font.cpp.

References deconst().

00414                                       {
00415     int maxx, advance;
00416     TTF_GlyphMetrics(deconst(), ch, 0, &maxx, 0, 0, &advance);
00417     return advance - maxx;
00418 }

Here is the call graph for this function:

void Wt::Font::setBackgroundColor ( const Color bg_color  )  [protected]

Definition at line 288 of file font.cpp.

References bg_color_, and detach().

Referenced by Wt::Painter::setBackgroundColor().

00288                                                    {
00289     detach();
00290     bg_color_ = bg_color;
00291 }

Here is the call graph for this function:

void Wt::Font::setBold ( bool  enable  ) 

Definition at line 249 of file font.cpp.

References setStyleFlag().

00249                               {
00250     setStyleFlag(TTF_STYLE_BOLD, enable);
00251 }

Here is the call graph for this function:

void Wt::Font::setEncoding ( int  encoding  )  [protected]

Definition at line 279 of file font.cpp.

References detach(), encoding(), and encoding_.

00279                                    {
00280     detach();
00281     encoding_ = encoding;
00282 }

Here is the call graph for this function:

void Wt::Font::setFont ( std::string &  filename  ) 

Definition at line 206 of file font.cpp.

References filename_, index_, open_font(), pointSize(), style(), and ttf_font.

00206                                       {
00207     ttf_font = open_font(filename, pointSize(), style(), index_);
00208     filename_ = filename;
00209 }

Here is the call graph for this function:

void Wt::Font::setForegroundColor ( const Color fg_color  )  [protected]

Definition at line 297 of file font.cpp.

References detach(), and fg_color_.

Referenced by Wt::Painter::setPen().

00297                                                    {
00298     detach();
00299     fg_color_ = fg_color;
00300 }

Here is the call graph for this function:

void Wt::Font::setItalic ( bool  enable  ) 

Definition at line 257 of file font.cpp.

References setStyleFlag().

00257                                 {
00258     setStyleFlag(TTF_STYLE_ITALIC, enable);
00259 }

Here is the call graph for this function:

void Wt::Font::setPointSize ( int  ptsize  ) 

Definition at line 215 of file font.cpp.

References filename_, index_, open_font(), ptsize_, style(), and ttf_font.

00215                                   {
00216     ttf_font = open_font(filename_, ptsize, style(), index_);
00217     ptsize_ = ptsize;
00218 }

Here is the call graph for this function:

void Wt::Font::setRendering ( int  rendering  )  [protected]

Definition at line 270 of file font.cpp.

References detach(), rendering(), and rendering_.

00270                                      {
00271     detach();
00272     rendering_ = rendering;
00273 }

Here is the call graph for this function:

void Wt::Font::setStyleFlag ( int  flag,
bool  enable 
) [protected]

Definition at line 228 of file font.cpp.

References detach(), and style().

Referenced by setBold(), setItalic(), and setUnderline().

00228                                              {
00229     int s = style();
00230 
00231     if (enable && (flag & s))
00232         return;
00233 
00234     if (!enable && !(~flag & s))
00235         return;
00236 
00237     detach();
00238 
00239     if (enable)
00240         TTF_SetFontStyle(*this, flag | s);
00241     else
00242         TTF_SetFontStyle(*this, ~flag & s);
00243 }

Here is the call graph for this function:

void Wt::Font::setUnderline ( bool  enable  ) 

Definition at line 266 of file font.cpp.

References setStyleFlag().

00266                                    {
00267     setStyleFlag(TTF_STYLE_UNDERLINE, enable);
00268 }

Here is the call graph for this function:

Size Wt::Font::size ( const Uint16 *  text  )  const

Definition at line 316 of file font.cpp.

References deconst().

00316                                         {
00317     int w, h;
00318     TTF_SizeUNICODE(deconst(), text, &w, &h);
00319     return Size(w, h);
00320 }

Here is the call graph for this function:

Size Wt::Font::size ( const std::string &  text  )  const

Definition at line 306 of file font.cpp.

References ASCII, deconst(), encoding_, and UTF8.

00306                                            {
00307     int w = 0, h = 0;
00308     if (encoding_ == ASCII) {
00309         TTF_SizeText(deconst(), text.c_str(), &w, &h);
00310     } else if (encoding_ == UTF8) {
00311         TTF_SizeUTF8(deconst(), text.c_str(), &w, &h);
00312     }
00313     return Size(w, h);
00314 }

Here is the call graph for this function:

Size Wt::Font::size ( const Uint16  ch  )  const

Definition at line 426 of file font.cpp.

References deconst().

Referenced by boundingRect(), Wt::Label::calc_size_hint(), Wt::PushButton::drawButtonLabel(), Wt::Label::drawContents(), and Wt::PushButton::setButtonSize().

00426                                      {
00427     int minx, maxx, miny, maxy;
00428     TTF_GlyphMetrics(deconst(), ch, &minx, &maxx, &miny, &maxy, 0);
00429     return Size(maxx - minx, maxy - miny);
00430 }

Here is the call graph for this function:

bool Wt::Font::style (  )  const [protected]

Definition at line 220 of file font.cpp.

References deconst().

Referenced by description(), detach(), open_font(), setFont(), setPointSize(), setStyleFlag(), and styleFlag().

00220                        {
00221     return TTF_GetFontStyle(deconst());
00222 }

Here is the call graph for this function:

bool Wt::Font::styleFlag ( int  flag  )  const [protected]

Definition at line 224 of file font.cpp.

References style().

Referenced by bold(), italic(), and underline().

00224                                    {
00225     return style() & flag;
00226 }

Here is the call graph for this function:

bool Wt::Font::underline (  )  const

Definition at line 261 of file font.cpp.

References styleFlag().

00261                            {
00262     return styleFlag(TTF_STYLE_UNDERLINE);
00263 
00264 }

Here is the call graph for this function:

int Wt::Font::width ( Uint16  ch  )  const

Definition at line 420 of file font.cpp.

References deconst().

Referenced by Wt::Label::effectiveIndent().

00420                                {
00421     int minx, maxx;
00422     TTF_GlyphMetrics(deconst(), ch, &minx, &maxx, 0, 0, 0);
00423     return maxx - minx;
00424 }

Here is the call graph for this function:


Friends And Related Function Documentation

friend class Painter [friend]

Definition at line 40 of file font.h.


Member Data Documentation

Color Wt::Font::bg_color_ [private]

Definition at line 138 of file font.h.

Referenced by backgroundColor(), blitText(), and setBackgroundColor().

Font * Wt::Font::default_font = 0 [static, private]

Definition at line 160 of file font.h.

Referenced by defaultFont(), init(), open_default_font(), and quit().

int Wt::Font::encoding_ [private]

Definition at line 137 of file font.h.

Referenced by blitText(), encoding(), setEncoding(), and size().

Color Wt::Font::fg_color_ [private]

Definition at line 139 of file font.h.

Referenced by blitText(), foregroundColor(), and setForegroundColor().

std::string Wt::Font::filename_ [private]

Definition at line 133 of file font.h.

Referenced by description(), detach(), Font(), setFont(), and setPointSize().

int Wt::Font::index_ [private]

Definition at line 135 of file font.h.

Referenced by detach(), setFont(), and setPointSize().

Font::Map Wt::Font::map [static]

Definition at line 168 of file font.h.

int Wt::Font::ptsize_ [private]

Definition at line 134 of file font.h.

Referenced by pointSize(), and setPointSize().

int Wt::Font::rendering_ [private]

Definition at line 136 of file font.h.

Referenced by blitText(), rendering(), and setRendering().

Ptr Wt::Font::ttf_font [private]

Definition at line 132 of file font.h.

Referenced by detach(), Font(), open_default_font(), operator const Ptr(), operator const TTF_Font *(), operator Ptr(), operator TTF_Font *(), setFont(), and setPointSize().


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

Generated Fri Jul 28 19:29:03 2006.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.