diff options
author | inmarket <inmarket@ugfx.org> | 2017-01-18 14:27:25 +1000 |
---|---|---|
committer | inmarket <inmarket@ugfx.org> | 2017-01-18 14:27:25 +1000 |
commit | 9360b2725035727262df05ae720654a48d620c69 (patch) | |
tree | 6d2cc409cbaa9c5d42c58745dce704f3adf1e952 /demos/modules/gdisp/fonts/main.c | |
parent | b8ece23f18d184a66b6a59ab982cd2d2a0e0964d (diff) | |
download | uGFX-9360b2725035727262df05ae720654a48d620c69.tar.gz uGFX-9360b2725035727262df05ae720654a48d620c69.tar.bz2 uGFX-9360b2725035727262df05ae720654a48d620c69.zip |
Update font demo to show Anti-aliased drawing
Diffstat (limited to 'demos/modules/gdisp/fonts/main.c')
-rw-r--r-- | demos/modules/gdisp/fonts/main.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/demos/modules/gdisp/fonts/main.c b/demos/modules/gdisp/fonts/main.c index 0384b737..b43e32dc 100644 --- a/demos/modules/gdisp/fonts/main.c +++ b/demos/modules/gdisp/fonts/main.c @@ -30,7 +30,7 @@ #include "gfx.h" int main(void) { - coord_t width; + coord_t width, y; font_t font1, font2; coord_t fheight1, fheight2; const char *line1, *line2; @@ -52,19 +52,32 @@ int main(void) { //font2 = gdispOpenFont("PF Ronda*"); //font2 = gdispOpenFont("Apple*"); - // Font 1 - line1 = "a b c d e f h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"; - line2 = "0 1 2 3 4 5 6 7 8 9 ~ ! @ # $ % ^ & * _ - + = ( ) { } [ ] < > | / \\ : ; , . ? ' \" `"; + y = 0; fheight1 = gdispGetFontMetric(font1, fontHeight)+2; - gdispFillStringBox(0, 0, width, fheight1, line1, font1, Black, White, justifyCenter); - gdispFillStringBox(0, fheight1+1, width, fheight1, line2, font1, Black, White, justifyCenter); + fheight2 = gdispGetFontMetric(font2, fontHeight)+2; + + line1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + line2 = "0123456789~!@#$%^&*_-+=(){}[]<>|/\\:;,.?'\"`"; + + // Font 1 + gdispFillStringBox(0, y, width, fheight1, line1, font1, Black, White, justifyCenter); + y += fheight1+1; + gdispFillStringBox(0, y, width, fheight1, line2, font1, Black, White, justifyCenter); + y += fheight1+1; // Font 2 - fheight2 = gdispGetFontMetric(font2, fontHeight)+2; - gdispFillStringBox(0, 2*fheight1+2, width, fheight2, line1, font2, Black, White, justifyCenter); - gdispFillStringBox(0, 2*fheight1+fheight2+3, width, fheight2, line2, font2, Black, White, justifyCenter); + gdispFillStringBox(0, y, width, fheight2, line1, font2, Black, White, justifyCenter); + y += fheight2+1; + gdispFillStringBox(0, y, width, fheight2, line2, font2, Black, White, justifyCenter); + y += fheight2+1; + + // Font 1 drawing White on the (black) background + gdispDrawStringBox(0, y, width, fheight1, line1, font1, White, justifyCenter); + y += fheight1+1; + gdispDrawStringBox(0, y, width, fheight1, line2, font1, White, justifyCenter); + y += fheight1+1; - // Show Sizes + // Show Sizes buf[0] = (fheight1-2)/10 + '0'; buf[1] = (fheight1-2)%10 + '0'; buf[2] = ','; @@ -72,7 +85,7 @@ int main(void) { buf[4] = (fheight2-2)/10 + '0'; buf[5] = (fheight2-2)%10 + '0'; buf[6] = 0; - gdispFillStringBox(0, 2*fheight1+2*fheight2+4, width, fheight1, buf, font1, Red, White, justifyCenter); + gdispFillStringBox(0, y, width, fheight1, buf, font1, Red, White, justifyCenter); // Wait forever while(TRUE) { |