diff --git a/share/examples/gpanel/font.c b/share/examples/gpanel/font.c index b868eab..70fb3eb 100644 --- a/share/examples/gpanel/font.c +++ b/share/examples/gpanel/font.c @@ -26,6 +26,9 @@ extern const struct gpanel_font_t font_digits20; #define COLOR_YELLOW COLOR_RGB(31, 63, 0) #define COLOR_MAGENTA COLOR_RGB(31, 0, 31) #define COLOR_CYAN COLOR_RGB(0, 63, 31) +#define COLOR_RED COLOR_RGB(31, 0, 0) +#define COLOR_GREEN COLOR_RGB(0, 63, 0) +#define COLOR_BLUE COLOR_RGB(0, 0, 31) /* * Screen size. @@ -35,26 +38,27 @@ int xsize, ysize; void show(const struct gpanel_font_t *font, const char *title, int digits_only) { char line[100]; - int x = 10; - int y = 10; + int x = 0, y = 0, i, color; + const char *phrase = digits_only ? "0123456789" : + "The quick brown fox jumps over the lazy dog."; + static const int colortab[] = { + COLOR_YELLOW, COLOR_CYAN, COLOR_MAGENTA, + COLOR_RED, COLOR_GREEN, COLOR_BLUE, + 0, + }; gpanel_clear(COLOR_BLACK, 0, 0); gpanel_text(&font_lucidasans15, COLOR_WHITE, COLOR_BLACK, x, y, title); - y += font_lucidasans15.height; + y += font_lucidasans15.height * 2; - gpanel_text(font, COLOR_YELLOW, COLOR_BLACK, x, y, - digits_only ? "0123456789" - : "The quick brown fox"); - y += font->height; + for (i=0; yheight; - - gpanel_text(font, COLOR_MAGENTA, COLOR_BLACK, x, y, - digits_only ? "6789012345" - : "the lazy dog."); + gpanel_text(font, color, COLOR_BLACK, x, y, phrase); + y += font->height; + } printf("Font %s: press Enter...", title); fflush(stdout); diff --git a/sys/pic32/hx8357.c b/sys/pic32/hx8357.c index 2bf6f3e..415fac3 100644 --- a/sys/pic32/hx8357.c +++ b/sys/pic32/hx8357.c @@ -420,7 +420,8 @@ static void newLine(const struct gpanel_font_t *font) void drawGlyph(const struct gpanel_font_t *font, int color, int background, int width, const unsigned short *bits) { - int i, j; + int h, w; + unsigned bitmask = 0; if (background >= 0) { /* @@ -430,33 +431,38 @@ void drawGlyph(const struct gpanel_font_t *font, while (PMMODE & PIC32_PMMODE_BUSY); PMADDR = 0x0001; - /* Loop on each glyph row, backwards from bottom to top. */ - for (i=0; iheight; i++) { - unsigned glyph_row = bits[i]; + /* Loop on each glyph row. */ + for (h=0; hheight; h++) { + /* Loop on every pixel in the row (left to right). */ + for (w=0; wheight; i++) { - unsigned glyph_row = bits[i]; + /* Loop on each glyph row. */ + for (h=0; hheight; h++) { + /* Loop on every pixel in the row (left to right). */ + for (w=0; w