X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Ffont.h;h=a2406b9ee043009824dbe1787fd7a05d6b583038;hb=d653d25b548070c688e40c052730d63345ce70c9;hp=f647dbbdef1a07a92bcb75e8373822e028cf1316;hpb=d1800d7ea80290f4913d0203241cef1409656522;p=libs%2Fgl.git diff --git a/source/font.h b/source/font.h index f647dbbd..a2406b9e 100644 --- a/source/font.h +++ b/source/font.h @@ -17,6 +17,7 @@ Distributed under the LGPL namespace Msp { namespace GL { +class PrimitiveBuilder; class Texture2D; class Font @@ -37,13 +38,15 @@ public: DataFile::Collection &get_collection(); private: void init(); - void texture(const std::string &); void glyph(unsigned); + void texture_inline(); }; Font(); + ~Font(); void set_texture(const Texture2D &); + const Texture2D &get_texture() const; void add_glyph(unsigned, float, float, float, float, float, float, float, float, float); float get_default_size() const { return default_size; } float get_ascent() const { return ascent; } @@ -51,7 +54,7 @@ public: float get_string_width(const std::string &, Codecs::Decoder &) const; void draw_glyph(unsigned); void draw_string(const std::string &, Codecs::Decoder &) const; - void draw_multiline(const std::string &) const; + void draw_string(const std::string &, Codecs::Decoder &, PrimitiveBuilder &) const; template float get_string_width(const std::string &str) const @@ -73,6 +76,16 @@ public: void draw_string(const std::string &str) const { draw_string(str); } + template + void draw_string(const std::string &str, PrimitiveBuilder &pb) const + { + typename C::Decoder dec; + draw_string(str, dec, pb); + } + + void draw_string(const std::string &str, PrimitiveBuilder &pb) const + { return draw_string(str, pb); } + private: struct Glyph { @@ -97,6 +110,7 @@ private: typedef std::map GlyphMap; const Texture2D *tex; + bool own_tex; float default_size; float ascent; float descent;