aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Font.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-11-26 16:01:28 (GMT)
committerfluxgen <fluxgen>2002-11-26 16:01:28 (GMT)
commitac4420cdc50b7d7410781bc1bbbd1e89e18f256d (patch)
tree5c18c5497d42fafdd962269aa42f2efe80a2afdf /src/FbTk/Font.hh
parent031edc36acb3957046d0836ec0ac17cd1c323b22 (diff)
downloadfluxbox-ac4420cdc50b7d7410781bc1bbbd1e89e18f256d.zip
fluxbox-ac4420cdc50b7d7410781bc1bbbd1e89e18f256d.tar.bz2
initial import
Diffstat (limited to 'src/FbTk/Font.hh')
-rw-r--r--src/FbTk/Font.hh84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/FbTk/Font.hh b/src/FbTk/Font.hh
new file mode 100644
index 0000000..60281ba
--- /dev/null
+++ b/src/FbTk/Font.hh
@@ -0,0 +1,84 @@
1// Font.cc
2// Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22//$Id: Font.hh,v 1.1 2002/11/26 16:01:27 fluxgen Exp $
23
24#ifndef FBTK_FONT_HH
25#define FBTK_FONT_HH
26
27#include <X11/Xlib.h>
28#include <X11/Xresource.h>
29
30#include <string>
31#include <memory>
32
33namespace FbTk {
34
35class FontImp;
36
37/**
38 Handles the client to fontimp bridge.
39*/
40class Font {
41public:
42 Font(const char *name=0, bool antialias = false);
43 virtual ~Font();
44 /**
45 Load a font
46 @return true on success, else false and it'll fall back on the last
47 loaded font
48 */
49 bool load(const char *name);
50
51 /// @return true if multibyte is enabled, else false
52 static bool multibyte() { return m_multibyte; }
53 /// @return true if utf-8 mode is enabled, else false
54 static bool utf8() { return m_utf8mode; }
55 void setAntialias(bool flag);
56 /**
57 @param text text to check size
58 @param size length of text in bytes
59 @return size of text in pixels
60 */
61 unsigned int textWidth(const char * const text, unsigned int size) const;
62 unsigned int height() const;
63 int ascent() const;
64 int descent() const;
65 /**
66 Rotate font in any angle (currently only 90 degrees supported and just XFont implementation)
67 */
68 void rotate(float angle);
69 void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const;
70 bool isAntialias() const { return m_antialias; }
71 bool isRotated() const { return m_rotated; }
72private:
73
74 std::auto_ptr<FontImp> m_fontimp;
75 std::string m_fontstr;
76 static bool m_multibyte;
77 static bool m_utf8mode;
78 bool m_antialias;
79 bool m_rotated; ///< wheter we're rotated or not
80};
81
82}; //end namespace FbTk
83
84#endif //FBTK_FONT_HH