aboutsummaryrefslogtreecommitdiff
path: root/src/Font.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/Font.hh')
-rw-r--r--src/Font.hh41
1 files changed, 32 insertions, 9 deletions
diff --git a/src/Font.hh b/src/Font.hh
index 6c1d95e..66cd6cf 100644
--- a/src/Font.hh
+++ b/src/Font.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22//$Id: Font.hh,v 1.3 2002/05/15 09:36:57 fluxgen Exp $ 22//$Id: Font.hh,v 1.4 2002/08/04 15:55:13 fluxgen Exp $
23 23
24#ifndef FBTK_FONT_HH 24#ifndef FBTK_FONT_HH
25#define FBTK_FONT_HH 25#define FBTK_FONT_HH
@@ -30,23 +30,46 @@
30namespace FbTk 30namespace FbTk
31{ 31{
32 32
33/**
34 Handles loading of font.
35*/
33class Font 36class Font
34{ 37{
35public: 38public:
36 Font(Display *display, const char *name=0); 39 Font(Display *display, const char *name=0);
37 virtual ~Font(); 40 virtual ~Font();
38 //manipulators 41 /**
42 Load a font
43 @return true on success, else false and it'll fall back on the last
44 loaded font
45 */
39 bool load(const char *name); 46 bool load(const char *name);
47 /**
48 Loads a font from database
49 @return true on success, else false and it'll fall back on the last
50 loaded font
51 @see load(const char *name)
52 */
40 bool loadFromDatabase(XrmDatabase &database, const char *rname, const char *rclass); 53 bool loadFromDatabase(XrmDatabase &database, const char *rname, const char *rclass);
41 //accessors 54 /// @return true if a font is loaded, else false
42 inline bool isLoaded() const { return m_loaded; } 55 inline bool isLoaded() const { return m_loaded; }
43 inline const XFontStruct *getFontStruct() const { return m_font.fontstruct; } 56 /// @return XFontStruct of font, note: can be 0
44 inline const XFontSet &getFontSet() const { return m_font.set; } 57 inline const XFontStruct *fontStruct() const { return m_font.fontstruct; }
45 inline const XFontSetExtents *getFontSetExtents() const { return m_font.set_extents; } 58 /// @return XFontSet of font, note: check isLoaded
59 inline const XFontSet &fontSet() const { return m_font.set; }
60 /// @return XFontSetExtents of font, note: can be 0
61 inline const XFontSetExtents *fontSetExtents() const { return m_font.set_extents; }
62 /// @return true if multibyte is enabled, else false
46 static inline bool multibyte() { return m_multibyte; } 63 static inline bool multibyte() { return m_multibyte; }
47 unsigned int getTextWidth(const char *text, unsigned int size) const; 64 /**
48 unsigned int getHeight() const; 65 @param text text to check size
49 Display *getDisplay() const { return m_display; } 66 @param size length of text in bytes
67 @return size of text in pixels
68 */
69 unsigned int textWidth(const char *text, unsigned int size) const;
70 unsigned int height() const;
71 /// @return display connection
72 Display *display() const { return m_display; }
50private: 73private:
51 void freeFont(); 74 void freeFont();
52 static XFontSet createFontSet(Display *display, const char *fontname); 75 static XFontSet createFontSet(Display *display, const char *fontname);