]>
Dogcows Code - chaz/openbox/blob - otk/font.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
5 #include "userstring.hh"
9 #define _XFT_NO_COMPAT_ // no Xft 1 API
10 #include <X11/Xft/Xft.h>
26 static std::string _fallback_font
;
27 static bool _xft_init
;
30 // the fallback is only used for X fonts, not for Xft fonts, since it is
31 // assumed that X fonts will be the fallback from Xft.
32 inline static std::string
fallbackFont(void) { return _fallback_font
; }
33 inline static void setFallbackFont(const std::string
&f
)
34 { _fallback_font
= f
; }
42 std::string _fontstring
;
45 unsigned char _offset
;
50 bool createXftFont(void);
54 Font(int screen_num
, const std::string
&fontstring
, bool shadow
,
55 unsigned char offset
, unsigned char tint
);
58 inline const std::string
&fontstring() const { return _fontstring
; }
60 unsigned int height() const;
61 unsigned int maxCharWidth() const;
63 //! Measures the length of a string
65 @param string The string to measure, it should be UTF8 encoded.
67 unsigned int measureString(const userstring
&string
) const;
69 //! Draws a string into an XftDraw object
71 Be Warned: If you use an XftDraw object and a color, or a font from
72 different screens, you WILL have unpredictable results! :)
73 @param d The drawable to render into.
74 @param x The X offset onto the drawable at which to start drawing.
75 @param x The Y offset onto the drawable at which to start drawing.
76 @param color The color to use for drawing the text.
77 @param string The string to draw, it should be UTF8 encoded.
79 void drawString(XftDraw
*d
, int x
, int y
, const Color
&color
,
80 const userstring
&string
) const;
This page took 0.041011 seconds and 4 git commands to generate.