]> git.tdb.fi Git - libs/gl.git/blobdiff - source/font.h
Add Vector3 and Vector4 classes
[libs/gl.git] / source / font.h
index f647dbbdef1a07a92bcb75e8373822e028cf1316..a2406b9ee043009824dbe1787fd7a05d6b583038 100644 (file)
@@ -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<class C>
        float get_string_width(const std::string &str) const
@@ -73,6 +76,16 @@ public:
        void draw_string(const std::string &str) const
        { draw_string<Codecs::Utf8>(str); }
 
+       template<class C>
+       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<Codecs::Utf8>(str, pb); }
+
 private:
        struct Glyph
        {
@@ -97,6 +110,7 @@ private:
        typedef std::map<unsigned, Glyph> GlyphMap;
 
        const Texture2D *tex;
+       bool     own_tex;
        float    default_size;
        float    ascent;
        float    descent;