]> git.tdb.fi Git - libs/gl.git/commitdiff
Use cap height instead of ascent for midline alignment
authorMikko Rasa <tdb@tdb.fi>
Fri, 22 Jul 2016 19:00:48 +0000 (22:00 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 22 Jul 2016 19:00:48 +0000 (22:00 +0300)
source/text.cpp

index e3a854006a9bc444e929c90a3ef4b525204dbf8d..03421f5457c5ed3385548034115a6e18e1933269 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");
        }