Support negative baseline_x in a font.

release/v2.9
inmarket 2018-01-09 17:53:30 +10:00
parent c41cbd05e9
commit 013bac84ce
2 changed files with 17 additions and 19 deletions

View File

@ -43,7 +43,7 @@ struct mf_font_s
uint8_t max_x_advance;
/* Location of the text baseline relative to character. */
uint8_t baseline_x;
int8_t baseline_x;
uint8_t baseline_y;
/* Line height of the font (vertical advance). */

View File

@ -51,10 +51,8 @@ static bool get_wordlen(const struct mf_font_s *font, mf_str *text,
{
result->chars++;
if (c == ' ')
if (c == ' ' || c == '-')
result->space += mf_character_width(font, c);
else if (c == '-')
result->space += mf_character_width(font, '-');
else if (c == '\t')
result->space += mf_character_width(font, 'm') * MF_TABSIZE;
else if (c == '\n') {