news download themes documentation links










Font.hh

00001 // Font.cc for FbTk
00002 // Copyright (c) 2002 Henrik Kinnunen (fluxgen at linuxmail.org)
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: Font.hh,v 1.7 2003/12/19 17:07:53 fluxgen Exp $
00023 
00024 #ifndef FBTK_FONT_HH
00025 #define FBTK_FONT_HH
00026 
00027 #include <X11/Xlib.h>
00028 #include <X11/Xresource.h>
00029 
00030 #include <string>
00031 #include <memory>
00032 
00033 namespace FbTk {
00034 
00035 class FontImp;
00036 
00040 class Font {
00041 public:
00042 
00043     Font(const char *name=0, bool antialias = false);
00044     virtual ~Font();
00050     bool load(const std::string &name);
00051 
00053     static bool multibyte() { return m_multibyte; }
00055     static bool utf8() { return m_utf8mode; }
00056     void setAntialias(bool flag);
00057     inline void setShadow(bool flag) { m_shadow = flag; }
00063     unsigned int textWidth(const char * const text, unsigned int size) const;
00064     unsigned int height() const;    
00065     int ascent() const;
00066     int descent() const;
00071     void rotate(float angle);
00072 
00084     void drawText(Drawable w, int screen, GC gc, 
00085                   const char *text, size_t len, 
00086                   int x, int y, bool rotate=true) const;
00087     bool isAntialias() const { return m_antialias; }
00089     bool isRotated() const { return m_rotated; }
00091     float angle() const { return m_angle; }
00092     bool shadow() const { return m_shadow; }
00093 private:
00094     
00095     std::auto_ptr<FontImp> m_fontimp; 
00096     std::string m_fontstr; 
00097     static bool m_multibyte; 
00098     static bool m_utf8mode; 
00099     bool m_antialias; 
00100     bool m_rotated; 
00101     float m_angle; 
00102     bool m_shadow; 
00103 };
00104 
00105 } //end namespace FbTk
00106 
00107 #endif //FBTK_FONT_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