3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
13 #include <msp/datafile/objectloader.h>
14 #include <msp/strings/utf8.h>
15 #include "vertexarray.h"
20 class PrimitiveBuilder;
26 class Loader: public DataFile::CollectionObjectLoader<Font>
30 Loader(Font &, Collection &);
34 void texture_inline();
40 class Loader: public Msp::DataFile::ObjectLoader<Glyph>
45 void texcoords(float, float, float, float);
56 typedef std::map<unsigned, Glyph> GlyphMap;
69 void set_texture(const Texture2D &);
70 const Texture2D &get_texture() const;
71 void add_glyph(unsigned, float, float, float, float, float, float, float, float, float);
72 float get_default_size() const { return default_size; }
73 float get_ascent() const { return ascent; }
74 float get_descent() const { return descent; }
76 float get_string_width(const std::string &, Codecs::Decoder &) const;
79 float get_string_width(const std::string &str) const
81 typename C::Decoder dec;
82 return get_string_width(str, dec);
85 float get_string_width(const std::string &str) const
86 { return get_string_width<Codecs::Utf8>(str); }
88 void draw_string(const std::string &, Codecs::Decoder &) const;
89 void draw_string(const std::string &, Codecs::Decoder &, PrimitiveBuilder &) const;
92 void draw_string(const std::string &str) const
94 typename C::Decoder dec;
95 draw_string(str, dec);
98 void draw_string(const std::string &str) const
99 { draw_string<Codecs::Utf8>(str); }
102 void draw_string(const std::string &str, PrimitiveBuilder &pb) const
104 typename C::Decoder dec;
105 draw_string(str, dec, pb);
108 void draw_string(const std::string &str, PrimitiveBuilder &pb) const
109 { return draw_string<Codecs::Utf8>(str, pb); }
112 void create_glyph_vertices(const Glyph &, VertexBuilder &, float) const;
113 float get_glyph_advance(unsigned) const;