nux-1.16.0
nux::CairoFont Class Reference

List of all members.

Public Types

enum  Style { STYLE_NORMAL, STYLE_ITALIC }
enum  Weight { WEIGHT_NORMAL, WEIGHT_BOLD }
 Enum used to specify font weight.

Public Member Functions

 CairoFont (const std::string &family, double size, Style style, Weight weight)
 Constructor for CairoFont.
virtual Style GetStyle () const
virtual Weight GetWeight () const
virtual double GetPointSize () const
virtual void Destroy ()
const PangoFontDescription * GetFontDescription () const

Detailed Description

Definition at line 33 of file TextEntry.h.


Constructor & Destructor Documentation

nux::CairoFont::CairoFont ( const std::string &  family,
double  size,
Style  style,
Weight  weight 
)

Constructor for CairoFont.

Takes a PangoFontDescription object and its ownership. Will free the PangoFontDescription object on destruction.

Definition at line 79 of file TextEntry.cpp.

    : font_(pango_font_description_new())
    , size_(pt_size * PANGO_SCALE * 96 / 72)
    , style_(style)
    , weight_(weight)
  {
    pango_font_description_set_family(font_, family.c_str());
    pango_font_description_set_absolute_size(font_, size_);

    if (weight_ == CairoFont::WEIGHT_BOLD)
    {
      pango_font_description_set_weight(font_, PANGO_WEIGHT_BOLD);
    }

    if (style_ == CairoFont::STYLE_ITALIC)
    {
      pango_font_description_set_style(font_, PANGO_STYLE_ITALIC);
    }
  }

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends