aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2013-08-17 23:33:31 +1000
committerinmarket <andrewh@inmarket.com.au>2013-08-17 23:33:31 +1000
commit323f53e1dc19c03d803ce4501af7fb878a512855 (patch)
tree05fc4b1461f19f0a9d561eb006128de4a0a66e4c /src
parenta2b27a6f5c404a8b8883c0f7d50279550120035a (diff)
downloaduGFX-323f53e1dc19c03d803ce4501af7fb878a512855.tar.gz
uGFX-323f53e1dc19c03d803ce4501af7fb878a512855.tar.bz2
uGFX-323f53e1dc19c03d803ce4501af7fb878a512855.zip
Improve font name searching.
Diffstat (limited to 'src')
-rw-r--r--src/gdisp/fonts.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gdisp/fonts.c b/src/gdisp/fonts.c
index c688137c..937102ee 100644
--- a/src/gdisp/fonts.c
+++ b/src/gdisp/fonts.c
@@ -51,13 +51,17 @@ static bool_t matchfont(const char *pattern, const char *name) {
font_t gdispOpenFont(const char *name) {
const struct mf_font_list_s *fp;
- fp = mf_get_font_list();
- while (fp)
- {
+ // Try the long names first
+ for(fp = mf_get_font_list(); fp; fp = fp->next) {
+ if (matchfont(name, fp->font->full_name))
+ return fp->font;
+ }
+
+ // Try the short names if no long names match
+ for(fp = mf_get_font_list(); fp; fp = fp->next) {
if (matchfont(name, fp->font->short_name))
return fp->font;
- fp = fp->next;
}
/* Return default font.. better than nothing. */