]> git.tdb.fi Git - libs/gl.git/blobdiff - source/text.cpp
Add loader support for clipping in standard shaders
[libs/gl.git] / source / text.cpp
index e3a854006a9bc444e929c90a3ef4b525204dbf8d..85647a83980b9fbc0bdf45514460859a8c98a6f2 100644 (file)
@@ -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;