From 71926f325d3ee742271480a3bb8b6af481b03961 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sun, 8 Jun 2014 14:22:11 -0400 Subject: [PATCH] use font line height instead of created size to determine line height --- ftgl_testing.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ftgl_testing.cc b/ftgl_testing.cc index 7080293..5a7f9b3 100644 --- a/ftgl_testing.cc +++ b/ftgl_testing.cc @@ -40,17 +40,18 @@ void display(SDL_Window * window) glVertex3f(10.0, 210.0, 0.0); glVertex3f(10.0, 202.0, 0.0); glEnd(); - font->Render("abcdefghijklmnopqrstuvwxyz", -1, FTPoint(10, HEIGHT - FONT_SIZE, 0)); - font->Render("ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, FTPoint(10, HEIGHT - FONT_SIZE * 2, 0)); + float line_height = font->LineHeight(); + font->Render("abcdefghijklmnopqrstuvwxyz", -1, FTPoint(10, HEIGHT - line_height, 0)); + font->Render("ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, FTPoint(10, HEIGHT - line_height * 2, 0)); for (int i = 0; i < 26; i++) { char s[2]; s[0] = 'A' + i; s[1] = '\0'; float advance = font->Advance("M"); - font->Render(s, -1, FTPoint(10 + advance * i, HEIGHT - FONT_SIZE * 3, 0)); + font->Render(s, -1, FTPoint(10 + advance * i, HEIGHT - line_height * 3, 0)); } - font->Render("0123456789", -1, FTPoint(10, HEIGHT - FONT_SIZE * 4, 0)); + font->Render("0123456789", -1, FTPoint(10, HEIGHT - line_height * 4, 0)); SDL_GL_SwapWindow(window); }