From cb2bcb6ad9a684013b928c3bc906833c11201553 Mon Sep 17 00:00:00 2001 From: Felix Raimundo Date: Wed, 23 Mar 2016 19:05:56 +0100 Subject: [PATCH] Remove hardcoded font size. Change-Id: I5fbd54467ec727bb3f93ecb75e03593d466e9b7b --- app/text_input.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/text_input.cpp b/app/text_input.cpp index 36eb331d7..522203310 100644 --- a/app/text_input.cpp +++ b/app/text_input.cpp @@ -17,14 +17,12 @@ static void clear_prompt() { } static void print_prompt(char* text, int index) { - // Here we draw the input and inverse the pixels under the cursor. - // FIXME: hard coded value + char* tmp = (char*) " "; + KDSize font_size = KDStringSize(tmp); KDDrawLine(KDPointMake(0, SCREEN_HEIGHT - PROMPT_HEIGHT), - KDPointMake(SCREEN_WIDTH, SCREEN_HEIGHT - PROMPT_HEIGHT), 0xff); + KDPointMake(SCREEN_WIDTH, SCREEN_HEIGHT - PROMPT_HEIGHT), 0xff); KDDrawString(text, KDPointMake(0, SCREEN_HEIGHT - (PROMPT_HEIGHT / 2))); - // The hardcoded 7 is the width of the font. - KDDrawInverseChar(text[index], - KDPointMake(index*7, SCREEN_HEIGHT - (PROMPT_HEIGHT / 2))); + KDDrawInverseChar(text[index], KDPointMake(index * font_size.width, SCREEN_HEIGHT - (PROMPT_HEIGHT / 2))); } char* get_text() {