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