news download themes documentation links










XFontImp.hh

00001 // XFontImp.hh for FbTk fluxbox toolkit
00002 // Copyright (c) 2002-2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
00003 // 
00004 // Permission is hereby granted, free of charge, to any person obtaining a
00005 // copy of this software and associated documentation files (the "Software"),
00006 // to deal in the Software without restriction, including without limitation
00007 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008 // and/or sell copies of the Software, and to permit persons to whom the
00009 // Software is furnished to do so, subject to the following conditions:
00010 //
00011 // The above copyright notice and this permission notice shall be included in
00012 // all copies or substantial portions of the Software.
00013 //
00014 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00017 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00019 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00020 // DEALINGS IN THE SOFTWARE.
00021 
00022 // $Id: XFontImp.hh,v 1.5 2003/12/16 17:06:52 fluxgen Exp $
00023 
00024 #ifndef FBTK_XFONTIMP_HH
00025 #define FBTK_XFONTIMP_HH
00026 
00027 #include "FontImp.hh"
00028 
00029 #include <X11/Xlib.h>
00030 
00031 namespace FbTk {
00032 
00034 class XFontImp:public FbTk::FontImp {
00035 public:
00036     explicit XFontImp(const char *filename = 0);
00037     ~XFontImp();
00038     bool load(const std::string &filename);
00039     unsigned int textWidth(const char * const text, unsigned int size) const;
00040     unsigned int height() const;
00041     float angle() const { return m_angle; }
00042     int ascent() const;
00043     int descent() const { return m_fontstruct ? m_fontstruct->descent : 0; }
00044     void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const;
00045     bool loaded() const { return m_fontstruct != 0; }
00046     void rotate(float angle);
00048     void setRotate(bool val) { m_rotate = val; }
00049 private:
00050     void freeRotFont();
00051     void drawRotText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const;
00052     unsigned int rotTextWidth(const char * const text, unsigned int size) const;
00053     struct BitmapStruct {
00054         int bit_w;
00055         int bit_h;
00056 
00057         Pixmap bm;
00058     };
00059 
00060     struct XRotCharStruct {
00061         int ascent;
00062         int descent;
00063         int lbearing;
00064         int rbearing;
00065         int width;
00066 
00067         BitmapStruct glyph;
00068     };
00069 
00070     struct XRotFontStruct {
00071         int dir;
00072         int height;
00073         int max_ascent;
00074         int max_descent;
00075         int max_char;
00076         int min_char;
00077 
00078         XRotCharStruct per_char[95];
00079     };
00080     XRotFontStruct *m_rotfont; 
00081     XFontStruct *m_fontstruct; 
00082     float m_angle; 
00083     bool m_rotate; 
00084 };
00085 
00086 } // end namespace FbTk
00087 
00088 #endif // XFONTIMP_HH

Fluxbox CVS-Jan-2003




      



Got comments about the page? Send them to webmaster.
If you have general Fluxbox related questions ask them on our irc channel or mailing lists.

Show Source








Designed by aLEczapKA