From 0947bc1a50a81e38d0b6f042ab5be349cc6bb7ff Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 26 Apr 2016 20:28:33 +0100 Subject: [PATCH] Handle Spaces now!!!! --- gb_gl.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gb_gl.h b/gb_gl.h index f21e541..62de418 100644 --- a/gb_gl.h +++ b/gb_gl.h @@ -551,7 +551,12 @@ GBGL_DEF f32 gbgl_get_string_width (gbglFont *font #endif #ifndef GBGL_FONT_CHAR_LIST -#define GBGL_FONT_CHAR_LIST "Āā㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľŁłŃńŅņņŇňʼnŊŋŌōōŎŏŐőŒœŕŖŗŘřŚśŜŝŞşŠšŢţŤťŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽža!ö\"#$%%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~Šš?ŒœŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõøùúûüýþÿ®™" +#define GBGL_FONT_CHAR_LIST \ + "Āā㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľŁłŃńŅņņŇňʼnŊŋ"\ + "ŌōōŎŏŐőŒœŕŖŗŘřŚśŜŝŞşŠšŢţŤťŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽža!ö"\ + "\"#$%%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"\ + "Šš?ŒœŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõøùúûüýþÿ®™"\ + " \t\r\n" #endif #ifndef GBGL_PT_TO_PX_SCALE @@ -2203,20 +2208,24 @@ gbgl_bs_draw_substring(gbglBasicState *bs, gbglFont *font, i32 x, i32 y, gbColou if (ptr - str > len) break; + if (cp == '\t') { + draw_this_glyph_count = GBGL_TAB_CHARACTER_WIDTH; + cp = ' '; // TODO(bill): Set tab to be space + } + + gi = gbgl_get_glyph_info(font, cp, &curr_index); if (!gi) { gi = gbgl_get_glyph_info(font, ' ', &curr_index); } - if (cp == '\t') - draw_this_glyph_count = GBGL_TAB_CHARACTER_WIDTH; - if (gi) { for (j = 0; j < draw_this_glyph_count; j++) { f32 s0, t0, s1, t1; f32 x0, y0, x1, y1; f32 kern = 0.0f; + if (cp == '\r' || cp == '\n' || (max_width > 0 && px - ox + gi->xadv >= max_width32)) { px = ox;