wmi

git clone git://oldgit.suckless.org/wmi/
Log | Files | Refs | LICENSE

font.h (838B)


      1 // Copyright (c) 2003 - 2009 Anselm R Garbe <anselm@garbe.us>
      2 // See LICENSE for license details.
      3 
      4 #ifndef __FONT_H
      5 #define __FONT_H
      6 
      7 extern "C" {
      8 #include <X11/Xlib.h>
      9 }
     10 
     11 #include <string>
     12 
     13 #include "wmi.h"
     14 
     15 class Monitor;
     16 
     17 /** Base class for fonts (currently default XFonts and XftFonts). */
     18 class WFont {
     19 
     20 public:
     21 
     22     enum Type {NORMAL, XFT};
     23 
     24     WFont(Monitor *monitor);
     25     virtual ~WFont();
     26 
     27     Type type() const;
     28 
     29     static WFont *load(Monitor *monitor, string name);
     30 
     31     virtual void drawText(Window window, GC gc, int x, int y, string text) = 0;
     32 
     33     virtual int textWidth(string text) = 0;
     34 
     35     virtual unsigned int height() = 0;
     36 
     37     virtual void setHeight(unsigned int height) = 0;
     38 
     39     virtual int ascent() = 0;
     40 
     41     virtual int descent() = 0;
     42 
     43 protected:
     44 
     45     Monitor *monitor_;
     46     Type type_;
     47 
     48 };
     49 
     50 #endif // __FONT_H