}
void Font::add_glyph(unsigned code, float x1, float y1, float x2, float y2, float w, float h, float ox, float oy, float adv)
{
Glyph glyph;
}
void Font::add_glyph(unsigned code, float x1, float y1, float x2, float y2, float w, float h, float ox, float oy, float adv)
{
Glyph glyph;
glyphs.insert(GlyphMap::value_type(code, glyph));
}
float Font::get_string_width(const string &str, Codecs::Decoder &dec) const
{
glyphs.insert(GlyphMap::value_type(code, glyph));
}
float Font::get_string_width(const string &str, Codecs::Decoder &dec) const
{
+ Immediate imm((TEXCOORD2, VERTEX2));
+ draw_string(str, dec, imm);
+}
+
+void Font::draw_string(const string &str, Codecs::Decoder &dec, PrimitiveBuilder &pbuilder) const
+{
+ if(!tex)
+ throw InvalidState("No texture");
+
- create_glyph_vertices(j->second, *vab, x);
- x+=j->second.advance;
- count+=4;
+ create_glyph_vertices(j->second, pbuilder, x);
+ x += j->second.advance;
+ count += 4;
void Font::Loader::init()
{
add("default_size", &Font::default_size);
add("ascent", &Font::ascent);
add("descent", &Font::descent);
add("texture", &Font::tex);
void Font::Loader::init()
{
add("default_size", &Font::default_size);
add("ascent", &Font::ascent);
add("descent", &Font::descent);
add("texture", &Font::tex);
add("glyph", &Loader::glyph);
}
void Font::Loader::glyph(unsigned c)
{
Glyph gl;
add("glyph", &Loader::glyph);
}
void Font::Loader::glyph(unsigned c)
{
Glyph gl;
- font.glyphs.insert(GlyphMap::value_type(c, gl));
+ obj.glyphs.insert(GlyphMap::value_type(c, gl));
+}
+
+void Font::Loader::texture_inline()
+{
+ RefPtr<Texture2D> tex = new Texture2D;
+ load_sub(*tex);
+ obj.tex = tex.release();
+ obj.own_tex = true;
{
add("texcoords", &Loader::texcoords);
add("size", &Glyph::w, &Glyph::h);
{
add("texcoords", &Loader::texcoords);
add("size", &Glyph::w, &Glyph::h);
void Font::Glyph::Loader::texcoords(float x1, float y1, float x2, float y2)
{
void Font::Glyph::Loader::texcoords(float x1, float y1, float x2, float y2)
{