fluxbox/src/FbTk/XftFontImp.hh

53 lines
2 KiB
C++
Raw Normal View History

2002-11-26 16:01:28 +00:00
// XftFontImp.hh Xft font implementation for FbTk
2003-01-05 23:39:50 +00:00
// Copyright (c) 2002-2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
2002-11-26 16:01:28 +00:00
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
2003-01-05 23:39:50 +00:00
//$Id: XftFontImp.hh,v 1.3 2003/01/05 23:39:49 fluxgen Exp $
2002-11-26 16:01:28 +00:00
2003-01-05 23:39:50 +00:00
#ifndef FBTK_XFTFONTIMP_HH
#define FBTK_XFTFONTIMP_HH
2002-11-26 16:01:28 +00:00
#include "FontImp.hh"
2003-01-05 23:39:50 +00:00
2002-11-26 16:01:28 +00:00
#include <X11/Xft/Xft.h>
2003-01-05 23:39:50 +00:00
2002-11-26 16:01:28 +00:00
namespace FbTk {
2003-01-05 23:39:50 +00:00
/// Handles Xft font drawing
2002-11-26 16:01:28 +00:00
class XftFontImp:public FbTk::FontImp {
public:
2002-12-01 13:42:15 +00:00
XftFontImp(const char *fontname, bool utf8);
~XftFontImp();
bool load(const std::string &name);
void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const;
unsigned int textWidth(const char * const text, unsigned int len) const;
unsigned int height() const;
int ascent() const { return m_xftfont ? m_xftfont->ascent : 0; }
int descent() const { return m_xftfont ? m_xftfont->descent : 0; }
bool loaded() const { return m_xftfont != 0; }
2002-11-26 16:01:28 +00:00
private:
2002-12-01 13:42:15 +00:00
XftFont *m_xftfont;
bool m_utf8mode;
2002-11-26 16:01:28 +00:00
};
}; // end namespace FbTk
2003-01-05 23:39:50 +00:00
#endif // FBTK_XFTFONTIMP_HH