X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Ffont.hh;h=618d4f6ebb99cd38a5c768c40b7f6b75c5b061ff;hb=8269fc2b3965d12ba308caa554bfa7ee037fba13;hp=8afd2bd10bd6aa22efe753061ec3dc66ebfa344b;hpb=fa8cefef63feb1d559c40db3cf9407e5bd1ac4df;p=chaz%2Fopenbox diff --git a/otk/font.hh b/otk/font.hh index 8afd2bd1..618d4f6e 100644 --- a/otk/font.hh +++ b/otk/font.hh @@ -1,28 +1,30 @@ -// -*- mode: C++; indent-tabs-mode: nil; -*- -#ifndef __Font_hh -#define __Font_hh +// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- +#ifndef __font_hh +#define __font_hh + +#include "ustring.hh" +#include "truerendercontrol.hh" extern "C" { #include +#define _XFT_NO_COMPAT_ // no Xft 1 API #include } -#include -#include +#include namespace otk { -class BGCCache; -class BGCCacheItem; -class BColor; -class ScreenInfo; +class Color; +class Surface; -class BFont { +class Font { /* * static members */ private: static std::string _fallback_font; + static bool _xft_init; public: // the fallback is only used for X fonts, not for Xft fonts, since it is @@ -37,13 +39,8 @@ public: private: int _screen_num; - std::string _family; - bool _simplename; // true if not spec'd as a -*-* string - int _size; - bool _bold; - bool _italic; + std::string _fontstring; - bool _antialias; bool _shadow; unsigned char _offset; unsigned char _tint; @@ -52,31 +49,24 @@ private: bool createXftFont(void); - bool _valid; - public: // loads an Xft font - BFont(int screen_num, const std::string &family, int size, - bool bold, bool italic, bool shadow, unsigned char offset, - unsigned char tint, bool antialias = True); - virtual ~BFont(void); - - inline bool valid(void) const { return _valid; } + Font(int screen_num, const std::string &fontstring, bool shadow, + unsigned char offset, unsigned char tint); + virtual ~Font(); - inline std::string family(void) const { assert(_valid); return _family; } - inline int size(void) const { assert(_valid); return _size; } - inline bool bold(void) const { assert(_valid); return _bold; } - inline bool italic(void) const { assert(_valid); return _italic; } + inline const std::string &fontstring() const { return _fontstring; } - unsigned int height(void) const; - unsigned int maxCharWidth(void) const; + int height() const; + int maxCharWidth() const; - unsigned int measureString(const std::string &string) const; + int measureString(const ustring &string) const; - void drawString(Drawable d, int x, int y, const BColor &color, - const std::string &string) const; + // The RenderControl classes use the internal data to render the fonts, but + // noone else needs it, so its private. + friend class RenderControl; }; } -#endif // __Font_hh +#endif // __font_hh