]> Dogcows Code - chaz/openbox/blobdiff - otk/font.hh
use otk objects in the ob scripts by importing otk
[chaz/openbox] / otk / font.hh
index c070bbff9a4511d2589878eca0f171c3daba0d7e..16c47f27aed9f2c5c2c28e4cdcc03561ba264209 100644 (file)
@@ -1,29 +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 <X11/Xlib.h>
-
+#define _XFT_NO_COMPAT_ // no Xft 1 API
 #include <X11/Xft/Xft.h>
 }
 
 #include <assert.h>
 
-#include <string>
+namespace otk {
 
-class BGCCache;
-class BGCCacheItem;
-class BColor;
+class Color;
+class Surface;
 
-#include "screen.hh"
-
-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
@@ -36,16 +37,10 @@ public:
    * instance members
    */
 private:
-  Display          *_display;
-  BScreen          *_screen;
+  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;
@@ -54,29 +49,24 @@ private:
 
   bool createXftFont(void);
   
-  bool              _valid;
-
 public:
   // loads an Xft font
-  BFont(Display *d, BScreen *screen, const std::string &family, int size,
-        bool bold, bool italic, bool shadow, unsigned char offset, 
-        unsigned char tint, bool antialias = True);
-  virtual ~BFont(void);
+  Font(int screen_num, const std::string &fontstring, bool shadow,
+        unsigned char offset, unsigned char tint);
+  virtual ~Font();
 
-  inline bool valid(void) const { return _valid; }
+  inline const std::string &fontstring() const { return _fontstring; }
 
-  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; }
+  int height() const;
+  int maxCharWidth() const;
 
-  unsigned int height(void) const;
-  unsigned int maxCharWidth(void) const;
+  int measureString(const ustring &string) const;
 
-  unsigned int measureString(const std::string &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
This page took 0.02357 seconds and 4 git commands to generate.