6 #include <msp/datafile/objectloader.h>
7 #include <msp/stringcodec/utf8.h>
8 #include "vertexarray.h"
13 class PrimitiveBuilder;
19 class Loader: public DataFile::CollectionObjectLoader<Font>
23 Loader(Font &, Collection &);
29 void texture_ref(const std::string &);
35 class Loader: public Msp::DataFile::ObjectLoader<Glyph>
40 void texcoords(float, float, float, float);
51 typedef std::map<unsigned, Glyph> GlyphMap;
53 RefPtr<const Texture2D> texture;
62 void set_texture(const Texture2D &);
63 const Texture2D &get_texture() const;
64 void add_glyph(unsigned, float, float, float, float, float, float, float, float, float);
65 float get_native_size() const { return native_size; }
66 float get_default_size() const { return native_size; } // Deprecated
67 float get_ascent() const { return ascent; }
68 float get_descent() const { return descent; }
70 float get_string_width(const std::string &, StringCodec::Decoder &) const;
73 float get_string_width(const std::string &str) const
75 typename C::Decoder dec;
76 return get_string_width(str, dec);
79 float get_string_width(const std::string &str) const
80 { return get_string_width<StringCodec::Utf8>(str); }
82 void draw_string(const std::string &, StringCodec::Decoder &) const;
83 void draw_string(const std::string &, StringCodec::Decoder &, PrimitiveBuilder &) const;
86 void draw_string(const std::string &str) const
88 typename C::Decoder dec;
89 draw_string(str, dec);
92 void draw_string(const std::string &str) const
93 { draw_string<StringCodec::Utf8>(str); }
96 void draw_string(const std::string &str, PrimitiveBuilder &pb) const
98 typename C::Decoder dec;
99 draw_string(str, dec, pb);
102 void draw_string(const std::string &str, PrimitiveBuilder &pb) const
103 { return draw_string<StringCodec::Utf8>(str, pb); }
106 void create_glyph_vertices(const Glyph &, VertexBuilder &) const;
107 float get_glyph_advance(unsigned) const;