From 3977ee687ffff23e49dcac0ea9a7c3e8652248f0 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 28 Jul 2013 17:08:45 +1000 Subject: First cut - beautiful new font handling by PetteriAimonen --- demos/applications/notepad/gfxconf.h | 7 ++----- demos/applications/notepad/main.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'demos') diff --git a/demos/applications/notepad/gfxconf.h b/demos/applications/notepad/gfxconf.h index 6755d30d..f3f50009 100644 --- a/demos/applications/notepad/gfxconf.h +++ b/demos/applications/notepad/gfxconf.h @@ -57,11 +57,8 @@ #define GDISP_NEED_MSGAPI FALSE /* Builtin Fonts */ -#define GDISP_INCLUDE_FONT_SMALL FALSE -#define GDISP_INCLUDE_FONT_LARGER FALSE -#define GDISP_INCLUDE_FONT_UI1 FALSE -#define GDISP_INCLUDE_FONT_UI2 TRUE -#define GDISP_INCLUDE_FONT_LARGENUMBERS TRUE +#define GDISP_INCLUDE_FONT_DEJAVUSANS12 TRUE +#define GDISP_INCLUDE_FONT_DEJAVUSANS24 TRUE /* Features for the GINPUT sub-system. */ #define GINPUT_NEED_MOUSE TRUE diff --git a/demos/applications/notepad/main.c b/demos/applications/notepad/main.c index 261b09d4..020a2b60 100644 --- a/demos/applications/notepad/main.c +++ b/demos/applications/notepad/main.c @@ -46,8 +46,8 @@ void drawScreen(void) { char *msg = "ChibiOS/GFX"; font_t font1, font2; - font1 = gdispOpenFont("UI2 Double"); - font2 = gdispOpenFont("LargeNumbers"); + font1 = gdispOpenFont("DejaVuSans24"); + font2 = gdispOpenFont("DejaVuSans12"); gdispClear(White); gdispDrawString(gdispGetWidth()-gdispGetStringWidth(msg, font1)-3, 3, msg, font1, Black); @@ -61,12 +61,12 @@ void drawScreen(void) { gdispDrawBox (5 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Black); /* White */ /* pens */ - gdispDrawString(OFFSET * 2, DRAW_PEN(1), "1", font2, Black); - gdispDrawString(OFFSET * 2, DRAW_PEN(2), "2", font2, Black); - gdispDrawString(OFFSET * 2, DRAW_PEN(3), "3", font2, Black); - gdispDrawString(OFFSET * 2, DRAW_PEN(4), "4", font2, Black); - gdispDrawString(OFFSET * 2, DRAW_PEN(5), "5", font2, Black); - + gdispFillStringBox(OFFSET * 2, DRAW_PEN(1), PEN_SIZE, PEN_SIZE, "1", font2, White, Black, justifyCenter); + gdispFillStringBox(OFFSET * 2, DRAW_PEN(2), PEN_SIZE, PEN_SIZE, "2", font2, White, Black, justifyCenter); + gdispFillStringBox(OFFSET * 2, DRAW_PEN(3), PEN_SIZE, PEN_SIZE, "3", font2, White, Black, justifyCenter); + gdispFillStringBox(OFFSET * 2, DRAW_PEN(4), PEN_SIZE, PEN_SIZE, "4", font2, White, Black, justifyCenter); + gdispFillStringBox(OFFSET * 2, DRAW_PEN(5), PEN_SIZE, PEN_SIZE, "5", font2, White, Black, justifyCenter); + gdispCloseFont(font1); gdispCloseFont(font2); } -- cgit v1.2.3