From: Mikko Rasa Date: Tue, 10 Jul 2007 19:21:01 +0000 (+0000) Subject: Add ascent and descent to Font X-Git-Tag: 0.9~52 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b2851c18f6361fed2203e0aced4a5d671ad28630;p=libs%2Fgl.git Add ascent and descent to Font --- diff --git a/source/font.cpp b/source/font.cpp index f15e372a..956acb46 100644 --- a/source/font.cpp +++ b/source/font.cpp @@ -11,6 +11,8 @@ Font::Font(): tex(0), own_tex(false), default_size(1), + ascent(1), + descent(0), varray((TEXCOORD2, VERTEX2)) { } @@ -142,6 +144,8 @@ Font::Loader::Loader(Font &f): font(f) { add("default_size", &Font::default_size); + add("ascent", &Font::ascent); + add("descent", &Font::descent); add("texture", &Loader::texture); add("glyph", &Loader::glyph); } diff --git a/source/font.h b/source/font.h index ebaa8e7a..609f2723 100644 --- a/source/font.h +++ b/source/font.h @@ -31,6 +31,8 @@ public: void set_texture(const Texture2D &); void add_glyph(wchar_t, float, float, float, float, float, float, float, float, float); float get_default_size() const { return default_size; } + float get_ascent() const { return ascent; } + float get_descent() const { return descent; } float get_string_width(const std::string &) const; float get_string_width(const std::wstring &) const; void draw_glyph(wchar_t); @@ -67,6 +69,8 @@ private: const Texture2D *tex; bool own_tex; float default_size; + float ascent; + float descent; GlyphMap glyphs; VertexArray varray;