X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftext.cpp;h=f791c3b269632e1ed2113554d8095f55182102c2;hp=e3a854006a9bc444e929c90a3ef4b525204dbf8d;hb=00cc52f21b5ae29fb1b25c162552c851a0559e66;hpb=31e788548ca4875539ad59c4fbec26ab90517141 diff --git a/source/text.cpp b/source/text.cpp index e3a85400..f791c3b2 100644 --- a/source/text.cpp +++ b/source/text.cpp @@ -23,7 +23,7 @@ void Text::set_technique(const Technique *tech) if(tech) { technique = *tech; - technique.replace_texture("diffusemap", font.get_texture()); + technique.replace_texture("diffuse_map", font.get_texture()); object.set_technique(&technique); } else @@ -34,7 +34,7 @@ void Text::set_text(const string &text, StringCodec::Decoder &dec) { clear(); width = font.get_string_width(text, dec); - GL::MeshBuilder bld(mesh); + MeshBuilder bld(mesh); bld.matrix() *= Matrix::translation(Vector3(-horz_align*width, vert_offset, 0.0f)); font.build_string(text, dec, bld); } @@ -61,7 +61,7 @@ void Text::set_alignment(HorizontalAlign ha, VerticalAlign va) { case DESCENT: v = -font.get_descent(); break; case BASELINE: v = 0.0f; break; - case MIDLINE: v = font.get_ascent()/2; break; // XXX Midline should be cap height / 2 + case MIDLINE: v = font.get_cap_height()/2; break; case ASCENT: v = font.get_ascent(); break; default: throw invalid_argument("Text::set_alignment"); } @@ -71,6 +71,9 @@ void Text::set_alignment(HorizontalAlign ha, VerticalAlign va) void Text::set_alignment(float h, float v) { + if(h==horz_align && -v==vert_offset) + return; + float horz_adjust = (horz_align-h)*width; float vert_adjust = -v-vert_offset; horz_align = h;