create_glyph_vertices(glyph, *va_builder);
}
-float Font::get_string_width(const string &str) const
-{
- float x=0;
-
- for(string::const_iterator i=str.begin(); i!=str.end(); ++i)
- x+=get_glyph_advance(static_cast<unsigned char>(*i));
-
- return x;
-}
-
float Font::get_string_width(const string &str, Codecs::Decoder &dec) const
{
float x=0;
return x;
}
-void Font::draw_string(const string &str) const
-{
- prepare_render();
-
- for(string::const_iterator i=str.begin(); i!=str.end(); ++i)
- draw_glyph(static_cast<unsigned char>(*i));
-
- glPopMatrix();
-}
-
void Font::draw_string(const string &str, Codecs::Decoder &dec) const
{
prepare_render();
#include <map>
#include <string>
#include <msp/datafile/collection.h>
-#include <msp/strings/codec.h>
+#include <msp/strings/utf8.h>
#include "vertexarray.h"
namespace Msp {
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::string &, Codecs::Decoder &) const;
void draw_glyph(unsigned);
- void draw_string(const std::string &) const;
void draw_string(const std::string &, Codecs::Decoder &) const;
void draw_multiline(const std::string &) const;
return get_string_width(str, dec);
}
+ float get_string_width(const std::string &str) const
+ { return get_string_width<Codecs::Utf8>(str); }
+
template<class C>
void draw_string(const std::string &str) const
{
typename C::Decoder dec;
draw_string(str, dec);
}
+
+ void draw_string(const std::string &str) const
+ { draw_string<Codecs::Utf8>(str); }
+
private:
struct Glyph
{