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 &);
36 void texture_ref(const std::string &);
42 class Loader: public Msp::DataFile::ObjectLoader<Glyph>
47 void texcoords(float, float, float, float);
58 typedef std::map<unsigned, Glyph> GlyphMap;
60 RefPtr<const Texture2D> texture;
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_native_size() const { return native_size; }
73 float get_default_size() const { return native_size; } // Deprecated
74 float get_ascent() const { return ascent; }
75 float get_descent() const { return descent; }
77 float get_string_width(const std::string &, Codecs::Decoder &) const;
80 float get_string_width(const std::string &str) const
82 typename C::Decoder dec;
83 return get_string_width(str, dec);
86 float get_string_width(const std::string &str) const
87 { return get_string_width<Codecs::Utf8>(str); }
89 void draw_string(const std::string &, Codecs::Decoder &) const;
90 void draw_string(const std::string &, Codecs::Decoder &, PrimitiveBuilder &) const;
93 void draw_string(const std::string &str) const
95 typename C::Decoder dec;
96 draw_string(str, dec);
99 void draw_string(const std::string &str) const
100 { draw_string<Codecs::Utf8>(str); }
103 void draw_string(const std::string &str, PrimitiveBuilder &pb) const
105 typename C::Decoder dec;
106 draw_string(str, dec, pb);
109 void draw_string(const std::string &str, PrimitiveBuilder &pb) const
110 { return draw_string<Codecs::Utf8>(str, pb); }
113 void create_glyph_vertices(const Glyph &, VertexBuilder &) const;
114 float get_glyph_advance(unsigned) const;