aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-10-19 14:01:05 (GMT)
committerfluxgen <fluxgen>2002-10-19 14:01:05 (GMT)
commit1b6e3c1750aa199719a6165276ae858c1b89096e (patch)
treee4ad2b3a1f3cf66929c6b2eb081301ef8b6a8582
parent28b84d6fc03587ffacfcc575323e9113ae172be3 (diff)
downloadfluxbox-1b6e3c1750aa199719a6165276ae858c1b89096e.zip
fluxbox-1b6e3c1750aa199719a6165276ae858c1b89096e.tar.bz2
ascent and descent
-rw-r--r--src/Font.cc9
-rw-r--r--src/Font.hh4
-rw-r--r--src/FontImp.hh4
-rw-r--r--src/XFontImp.hh4
-rw-r--r--src/XftFontImp.hh4
-rw-r--r--src/XmbFontImp.hh4
6 files changed, 23 insertions, 6 deletions
diff --git a/src/Font.cc b/src/Font.cc
index 7023c88..c86bb84 100644
--- a/src/Font.cc
+++ b/src/Font.cc
@@ -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.cc,v 1.15 2002/10/16 23:22:45 fluxgen Exp $ 22//$Id: Font.cc,v 1.16 2002/10/19 14:01:05 fluxgen Exp $
23 23
24 24
25#include "Font.hh" 25#include "Font.hh"
@@ -152,6 +152,13 @@ unsigned int Font::height() const {
152 return m_fontimp->height(); 152 return m_fontimp->height();
153} 153}
154 154
155int Font::ascent() const {
156 return m_fontimp->ascent();
157}
158
159int Font::descent() const {
160 return m_fontimp->descent();
161}
155void Font::drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const { 162void Font::drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const {
156 if (text == 0 || len == 0) 163 if (text == 0 || len == 0)
157 return; 164 return;
diff --git a/src/Font.hh b/src/Font.hh
index b7b9cf2..93cbd87 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.7 2002/10/16 23:26:41 fluxgen Exp $ 22//$Id: Font.hh,v 1.8 2002/10/19 14:00:37 fluxgen Exp $
23 23
24#ifndef FBTK_FONT_HH 24#ifndef FBTK_FONT_HH
25#define FBTK_FONT_HH 25#define FBTK_FONT_HH
@@ -60,6 +60,8 @@ public:
60 */ 60 */
61 unsigned int textWidth(const char * const text, unsigned int size) const; 61 unsigned int textWidth(const char * const text, unsigned int size) const;
62 unsigned int height() const; 62 unsigned int height() const;
63 int ascent() const;
64 int descent() const;
63 void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const; 65 void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const;
64 bool isAntialias() const { return m_antialias; } 66 bool isAntialias() const { return m_antialias; }
65private: 67private:
diff --git a/src/FontImp.hh b/src/FontImp.hh
index 0f4db9a..f822b73 100644
--- a/src/FontImp.hh
+++ b/src/FontImp.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: FontImp.hh,v 1.2 2002/10/15 16:43:15 fluxgen Exp $ 22// $Id: FontImp.hh,v 1.3 2002/10/19 13:57:48 fluxgen Exp $
23 23
24#ifndef FBTK_FONTIMP_HH 24#ifndef FBTK_FONTIMP_HH
25#define FBTK_FONTIMP_HH 25#define FBTK_FONTIMP_HH
@@ -42,6 +42,8 @@ public:
42 virtual bool load(const std::string &name) = 0; 42 virtual bool load(const std::string &name) = 0;
43 virtual void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const = 0; 43 virtual void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const = 0;
44 virtual unsigned int textWidth(const char * const text, unsigned int size) const = 0; 44 virtual unsigned int textWidth(const char * const text, unsigned int size) const = 0;
45 virtual int ascent() const = 0;
46 virtual int descent() const = 0;
45 virtual unsigned int height() const = 0; 47 virtual unsigned int height() const = 0;
46 virtual bool loaded() const = 0; 48 virtual bool loaded() const = 0;
47protected: 49protected:
diff --git a/src/XFontImp.hh b/src/XFontImp.hh
index 30ad7ed..8ea7af1 100644
--- a/src/XFontImp.hh
+++ b/src/XFontImp.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: XFontImp.hh,v 1.2 2002/10/15 16:44:26 fluxgen Exp $ 22// $Id: XFontImp.hh,v 1.3 2002/10/19 13:58:47 fluxgen Exp $
23 23
24#ifndef XFONTIMP_HH 24#ifndef XFONTIMP_HH
25#define XFONTIMP_HH 25#define XFONTIMP_HH
@@ -33,6 +33,8 @@ public:
33 bool load(const std::string &filename); 33 bool load(const std::string &filename);
34 unsigned int textWidth(const char * const text, unsigned int size) const; 34 unsigned int textWidth(const char * const text, unsigned int size) const;
35 unsigned int height() const; 35 unsigned int height() const;
36 int ascent() const { return m_fontstruct ? m_fontstruct->ascent : 0; }
37 int descent() const { return m_fontstruct ? m_fontstruct->descent : 0; }
36 void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const; 38 void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const;
37 bool loaded() const { return m_fontstruct != 0; } 39 bool loaded() const { return m_fontstruct != 0; }
38private: 40private:
diff --git a/src/XftFontImp.hh b/src/XftFontImp.hh
index d03e65a..78f4080 100644
--- a/src/XftFontImp.hh
+++ b/src/XftFontImp.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: XftFontImp.hh,v 1.3 2002/10/16 23:13:54 fluxgen Exp $ 22//$Id: XftFontImp.hh,v 1.4 2002/10/19 13:58:21 fluxgen Exp $
23 23
24#ifndef XFTFONTIMP_HH 24#ifndef XFTFONTIMP_HH
25#define XFTFONTIMP_HH 25#define XFTFONTIMP_HH
@@ -35,6 +35,8 @@ public:
35 void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const; 35 void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const;
36 unsigned int textWidth(const char * const text, unsigned int len) const; 36 unsigned int textWidth(const char * const text, unsigned int len) const;
37 unsigned int height() const; 37 unsigned int height() const;
38 int ascent() const { return m_xftfont ? m_xftfont->ascent : 0; }
39 int descent() const { return m_xftfont ? m_xftfont->descent : 0; }
38 bool loaded() const { return m_xftfont != 0; } 40 bool loaded() const { return m_xftfont != 0; }
39private: 41private:
40 XftFont *m_xftfont; 42 XftFont *m_xftfont;
diff --git a/src/XmbFontImp.hh b/src/XmbFontImp.hh
index 64a176f..4fb2a2e 100644
--- a/src/XmbFontImp.hh
+++ b/src/XmbFontImp.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: XmbFontImp.hh,v 1.3 2002/10/16 23:30:17 fluxgen Exp $ 22// $Id: XmbFontImp.hh,v 1.4 2002/10/19 13:58:58 fluxgen Exp $
23 23
24#ifndef XMBFONTIMP_HH 24#ifndef XMBFONTIMP_HH
25#define XMBFONTIMP_HH 25#define XMBFONTIMP_HH
@@ -34,6 +34,8 @@ public:
34 virtual void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const; 34 virtual void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const;
35 unsigned int textWidth(const char * const text, unsigned int len) const; 35 unsigned int textWidth(const char * const text, unsigned int len) const;
36 unsigned int height() const; 36 unsigned int height() const;
37 int ascent() const { return m_setextents ? -m_setextents->max_ink_extent.y : 0; }
38 int descent() const { return m_setextents ? m_setextents->max_ink_extent.height + m_setextents->max_ink_extent.y : 0; }
37 bool loaded() const { return m_fontset != 0; } 39 bool loaded() const { return m_fontset != 0; }
38private: 40private:
39 XFontSet m_fontset; 41 XFontSet m_fontset;