diff options
author | fluxgen <fluxgen> | 2002-03-21 10:51:48 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-03-21 10:51:48 (GMT) |
commit | 3d3985609cd6dddff78558a9c1b3429ed4e891f4 (patch) | |
tree | fa6ae0dccb709eeb1ea98198054e543b1ee4f5f4 /src/Font.hh | |
parent | 3b330a5f6225f48f299371d5154bfb89db495903 (diff) | |
download | fluxbox_pavel-3d3985609cd6dddff78558a9c1b3429ed4e891f4.zip fluxbox_pavel-3d3985609cd6dddff78558a9c1b3429ed4e891f4.tar.bz2 |
first
Diffstat (limited to 'src/Font.hh')
-rw-r--r-- | src/Font.hh | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/Font.hh b/src/Font.hh new file mode 100644 index 0000000..04318ba --- /dev/null +++ b/src/Font.hh | |||
@@ -0,0 +1,68 @@ | |||
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/03/21 10:51:48 fluxgen Exp $ | ||
23 | |||
24 | #ifndef FBTK_FONT_HH | ||
25 | #define FBTK_FONT_HH | ||
26 | |||
27 | #include <X11/Xresource.h> | ||
28 | namespace FbTk | ||
29 | { | ||
30 | |||
31 | class Font | ||
32 | { | ||
33 | public: | ||
34 | Font(Display *display, const char *name=0); | ||
35 | virtual ~Font(); | ||
36 | //manipulators | ||
37 | bool load(const char *name); | ||
38 | bool loadFromDatabase(XrmDatabase &database, const char *rname, const char *rclass); | ||
39 | //accessors | ||
40 | inline bool isLoaded() const { return m_loaded; } | ||
41 | inline XFontStruct *getFontStruct() const { return m_font.fontstruct; } | ||
42 | inline XFontSet &getFontSet() { return m_font.set; } | ||
43 | inline XFontSetExtents *getFontSetExtents() const { return m_font.set_extents; } | ||
44 | static inline bool multibyte() { return m_multibyte; } | ||
45 | unsigned int getTextWidth(const char *text, unsigned int size) const; | ||
46 | unsigned int getHeight() const; | ||
47 | Display *getDisplay() const { return m_display; } | ||
48 | private: | ||
49 | void freeFont(); | ||
50 | static XFontSet createFontSet(Display *display, const char *fontname); | ||
51 | static const char *getFontSize(const char *pattern, int *size); | ||
52 | static const char *getFontElement(const char *pattern, char *buf, int bufsiz, ...); | ||
53 | |||
54 | struct FontType | ||
55 | { | ||
56 | XFontSet set; | ||
57 | XFontSetExtents *set_extents; | ||
58 | XFontStruct *fontstruct; | ||
59 | } m_font; | ||
60 | |||
61 | bool m_loaded; | ||
62 | static bool m_multibyte; | ||
63 | Display *m_display; | ||
64 | }; | ||
65 | |||
66 | }; //end namespace FbTk | ||
67 | |||
68 | #endif //FBTK_FONT_HH | ||