- x += get_glyph_advance(dec.decode_char(str, i));
+ {
+ unsigned c = dec.decode_char(str, i);
+ if(prev)
+ x += get_glyph_advance(prev, c);
+ prev = c;
+ }
+ x += get_glyph_advance(prev);
Immediate imm((TEXCOORD2, COLOR4_UBYTE, VERTEX2));
imm.color(color);
build_string(str, dec, imm);
Immediate imm((TEXCOORD2, COLOR4_UBYTE, VERTEX2));
imm.color(color);
build_string(str, dec, imm);
- create_glyph_vertices(j->second, bld);
- bld.matrix() *= Matrix::translation(j->second.advance, 0, 0);
+ if(prev)
+ bld.matrix() *= Matrix::translation(get_glyph_advance(prev, c), 0, 0);
+
+ create_glyph_quad(j->second, bld);
+ prev = c;
bld.texcoord(glyph.x1, glyph.y1);
bld.vertex(glyph.off_x, glyph.off_y);
bld.texcoord(glyph.x1, glyph.y1);
bld.vertex(glyph.off_x, glyph.off_y);
bld.texcoord(glyph.x2, glyph.y2);
bld.vertex(glyph.off_x+glyph.w, glyph.off_y+glyph.h);
bld.texcoord(glyph.x2, glyph.y2);
bld.vertex(glyph.off_x+glyph.w, glyph.off_y+glyph.h);
- bld.texcoord(glyph.x1, glyph.y2);
- bld.vertex(glyph.off_x, glyph.off_y+glyph.h);
+ bld.texcoord(glyph.x2, glyph.y1);
+ bld.vertex(glyph.off_x+glyph.w, glyph.off_y);
+ bld.end();
add("texture", &Loader::texture);
add("texture", &Loader::texture_ref);
add("glyph", &Loader::glyph);
add("texture", &Loader::texture);
add("texture", &Loader::texture_ref);
add("glyph", &Loader::glyph);
-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_)