diff options
Diffstat (limited to 'src/FbTk/Font.hh')
-rw-r--r-- | src/FbTk/Font.hh | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/src/FbTk/Font.hh b/src/FbTk/Font.hh index d8f0f46..d322097 100644 --- a/src/FbTk/Font.hh +++ b/src/FbTk/Font.hh | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <X11/Xresource.h> | 28 | #include <X11/Xresource.h> |
29 | 29 | ||
30 | #include <string> | 30 | #include <string> |
31 | #include <memory> | ||
32 | 31 | ||
33 | #ifdef HAVE_CONFIG_H | 32 | #ifdef HAVE_CONFIG_H |
34 | #include "config.h" | 33 | #include "config.h" |
@@ -38,6 +37,8 @@ | |||
38 | #include <iconv.h> | 37 | #include <iconv.h> |
39 | #endif // HAVE_ICONV | 38 | #endif // HAVE_ICONV |
40 | 39 | ||
40 | #include "Color.hh" | ||
41 | |||
41 | namespace FbTk { | 42 | namespace FbTk { |
42 | 43 | ||
43 | class FontImp; | 44 | class FontImp; |
@@ -56,13 +57,13 @@ public: | |||
56 | static void shutdown(); | 57 | static void shutdown(); |
57 | 58 | ||
58 | /// @return true if multibyte is enabled, else false | 59 | /// @return true if multibyte is enabled, else false |
59 | static bool multibyte() { return m_multibyte; } | 60 | static bool multibyte() { return s_multibyte; } |
60 | /// @return true if utf-8 mode is enabled, else false | 61 | /// @return true if utf-8 mode is enabled, else false |
61 | static bool utf8() { return m_utf8mode; } | 62 | static bool utf8() { return s_utf8mode; } |
62 | 63 | ||
63 | 64 | ||
64 | 65 | ||
65 | Font(const char *name=0, bool antialias = false); | 66 | Font(const char *name = "fixed"); |
66 | virtual ~Font(); | 67 | virtual ~Font(); |
67 | /** | 68 | /** |
68 | Load a font | 69 | Load a font |
@@ -70,10 +71,15 @@ public: | |||
70 | loaded font | 71 | loaded font |
71 | */ | 72 | */ |
72 | bool load(const std::string &name); | 73 | bool load(const std::string &name); |
73 | 74 | ||
74 | void setAntialias(bool flag); | 75 | void setHalo(bool flag) { m_halo = flag; if (m_halo) setShadow(false); } |
75 | inline void setShadow(bool flag) { m_shadow = flag; if (m_shadow) setHalo(false); } | 76 | void setHaloColor(const Color& color) { m_halo_color = color; } |
76 | inline void setHalo(bool flag) { m_halo = flag; if (m_halo) setShadow(false); } | 77 | |
78 | void setShadow(bool flag) { m_shadow = flag; if (m_shadow) setHalo(false); } | ||
79 | void setShadowColor(const Color& color) { m_shadow_color = color; } | ||
80 | void setShadowOffX(int offx) { m_shadow_offx = offx; } | ||
81 | void setShadowOffY(int offy) { m_shadow_offy = offy; } | ||
82 | |||
77 | /** | 83 | /** |
78 | @param text text to check size | 84 | @param text text to check size |
79 | @param size length of text in bytes | 85 | @param size length of text in bytes |
@@ -103,28 +109,28 @@ public: | |||
103 | void drawText(const FbDrawable &w, int screen, GC gc, | 109 | void drawText(const FbDrawable &w, int screen, GC gc, |
104 | const char *text, size_t len, | 110 | const char *text, size_t len, |
105 | int x, int y, bool rotate=true) const; | 111 | int x, int y, bool rotate=true) const; |
106 | bool isAntialias() const { return m_antialias; } | ||
107 | /// @return true if the font is rotated, else false | 112 | /// @return true if the font is rotated, else false |
108 | bool isRotated() const { return m_rotated; } | 113 | bool isRotated() const { return m_rotated; } |
109 | /// @return rotated angle | 114 | /// @return rotated angle |
110 | float angle() const { return m_angle; } | 115 | float angle() const { return m_angle; } |
111 | bool shadow() const { return m_shadow; } | 116 | bool hasShadow() const { return m_shadow; } |
112 | bool halo() const { return m_halo; } | 117 | bool hasHalo() const { return m_halo; } |
113 | private: | 118 | private: |
114 | 119 | ||
115 | std::auto_ptr<FontImp> m_fontimp; ///< font implementation | 120 | FbTk::FontImp* m_fontimp; ///< font implementation |
116 | std::string m_fontstr; ///< font name | 121 | std::string m_fontstr; ///< font name |
117 | static bool m_multibyte; ///< if the fontimp should be a multibyte font | 122 | |
118 | static bool m_utf8mode; ///< should the font use utf8 font imp | 123 | static bool s_multibyte; ///< if the fontimp should be a multibyte font |
119 | bool m_antialias; ///< is font antialias | 124 | static bool s_utf8mode; ///< should the font use utf8 font imp |
125 | |||
120 | bool m_rotated; ///< wheter we're rotated or not | 126 | bool m_rotated; ///< wheter we're rotated or not |
121 | float m_angle; ///< rotation angle | 127 | float m_angle; ///< rotation angle |
122 | bool m_shadow; ///< shadow text | 128 | bool m_shadow; ///< shadow text |
123 | std::string m_shadow_color; ///< shadow color | 129 | Color m_shadow_color; ///< shadow color |
124 | int m_shadow_offx; ///< offset y for shadow | 130 | int m_shadow_offx; ///< offset y for shadow |
125 | int m_shadow_offy; ///< offset x for shadow | 131 | int m_shadow_offy; ///< offset x for shadow |
126 | bool m_halo; ///< halo text | 132 | bool m_halo; ///< halo text |
127 | std::string m_halo_color; ///< halo color | 133 | Color m_halo_color; ///< halo color |
128 | #ifdef HAVE_ICONV | 134 | #ifdef HAVE_ICONV |
129 | iconv_t m_iconv; | 135 | iconv_t m_iconv; |
130 | #else | 136 | #else |