Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class font

boost::ui::font — Font class.

Synopsis

// In header: <boost/ui/font.hpp>


class font {
public:
  // types
  typedef void * native_handle_type;  // Implementation-defined font type. 

  // Enumaration of font families. 
  enum family { other, serif, sans_serif, cursive, fantasy, monospace };

  // Enumaration of font slants. 
  enum slant { normal, italic, oblique };

  // Enumaration of font weights. 
  enum weight { normal, bold };

  // construct/copy/destruct
  explicit font(double, family, slant = slant::normal, 
                weight = weight::normal);
  explicit font(double, const uistring &, slant = slant::normal, 
                weight = weight::normal);
  font();
  ~font();

  // public member functions
  font & set_family(family);
  family get_family() const;
  font & set_slant(slant);
  slant get_slant() const;
  font & set_weight(weight);
  weight get_weight() const;
  font & name(const uistring &);
  uistring name() const;
  font & size_pt(double);
  double size_pt() const;
  bool valid() const noexcept;

  // public static functions
  static font caption() noexcept;
};

Description

See Also:

CSS 2 Fonts (W3C)

See Also:

CSS Fonts 3 (W3C)

See Also:

Font (Wikipedia)

font public construct/copy/destruct

  1. explicit font(double pt, family f, slant s = slant::normal, 
                  weight w = weight::normal);
    Creates font.
  2. explicit font(double pt, const uistring & n, slant s = slant::normal, 
                  weight w = weight::normal);
    Creates font.
  3. font();
  4. ~font();

font public member functions

  1. font & set_family(family f);
    Sets font family.
  2. family get_family() const;
    Returns font family.
  3. font & set_slant(slant s);
    Sets font slant.
  4. slant get_slant() const;
    Returns font slant.
  5. font & set_weight(weight w);
    Sets font weight.
  6. weight get_weight() const;
    Returns font weight.
  7. font & name(const uistring & n);
    Sets font name.

    Throws:

    std::out_of_range If font name isn't supported
  8. uistring name() const;
    Returns font name.
  9. font & size_pt(double pt);
    Sets font size in points.

    Throws:

    std::out_of_range If font size isn't positive value
  10. double size_pt() const;
    Returns font size in points.
  11. bool valid() const noexcept;
    Returns true only if font is valid.

font public static functions

  1. static font caption() noexcept;
    Returns default font used for captioned widgets.

PrevUpHomeNext