3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
13 #include <msp/datafile/collection.h>
14 #include <msp/strings/utf8.h>
15 #include "vertexarray.h"
25 class Loader: public DataFile::Loader
29 DataFile::Collection *coll;
32 typedef DataFile::Collection Collection;
35 Loader(Font &, DataFile::Collection &);
36 Font &get_object() { return font; }
37 DataFile::Collection &get_collection();
40 void texture(const std::string &);
46 void set_texture(const Texture2D &);
47 void add_glyph(unsigned, float, float, float, float, float, float, float, float, float);
48 float get_default_size() const { return default_size; }
49 float get_ascent() const { return ascent; }
50 float get_descent() const { return descent; }
51 float get_string_width(const std::string &, Codecs::Decoder &) const;
52 void draw_glyph(unsigned);
53 void draw_string(const std::string &, Codecs::Decoder &) const;
54 void draw_multiline(const std::string &) const;
57 float get_string_width(const std::string &str) const
59 typename C::Decoder dec;
60 return get_string_width(str, dec);
63 float get_string_width(const std::string &str) const
64 { return get_string_width<Codecs::Utf8>(str); }
67 void draw_string(const std::string &str) const
69 typename C::Decoder dec;
70 draw_string(str, dec);
73 void draw_string(const std::string &str) const
74 { draw_string<Codecs::Utf8>(str); }
79 class Loader: public Msp::DataFile::Loader
83 Glyph &get_object() { return glyph; }
87 void texcoords(float, float, float, float);
97 typedef std::map<unsigned, Glyph> GlyphMap;
105 void create_glyph_vertices(const Glyph &, VertexBuilder &, float) const;
106 float get_glyph_advance(unsigned) const;