aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKumar Abhishek <abhishek@kumar>2012-06-14 16:17:22 +0530
committerKumar Abhishek <abhishek@kumar>2012-06-14 16:17:22 +0530
commit3be667c90e2ef8f1de5f85b16a7b78d6e910e2f7 (patch)
tree50c8b47c86d53ff47d4a5edb4aa9f60207cc8a5e
parenta5ae06796053bbb6cee77a2bbaeea5de4daad4ef (diff)
downloaduGFX-3be667c90e2ef8f1de5f85b16a7b78d6e910e2f7.tar.gz
uGFX-3be667c90e2ef8f1de5f85b16a7b78d6e910e2f7.tar.bz2
uGFX-3be667c90e2ef8f1de5f85b16a7b78d6e910e2f7.zip
Critical Bug fix in Text Rendering function
-rw-r--r--glcd.c8
-rw-r--r--glcd.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/glcd.c b/glcd.c
index f50c696d..42685439 100644
--- a/glcd.c
+++ b/glcd.c
@@ -5,9 +5,9 @@
uint16_t lcd_width, lcd_height;
uint16_t bgcolor=White, fgcolor=Black;
-uint16_t cx, cy;
+uint16_t cx=0, cy=0;
static uint8_t tpText=0;
-uint8_t* font;
+const uint8_t* font;
void lcdInit(void) {
lld_lcdInit();
@@ -117,7 +117,7 @@ void lcdDrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t co
}
}
-void lcdSetFont(uint8_t *fnt) {
+void lcdSetFont(const uint8_t *fnt) {
font = fnt;
}
@@ -164,7 +164,7 @@ void lcdDrawChar(char c) {
cx += fontWidth;
if(sps != 0) {
if(!tpText)
- lcdFillArea(cx, cy, sps, fontHeight, fgcolor);
+ lcdFillArea(cx, cy, cx+sps, cy+fontHeight, bgcolor);
cx += sps;
}
}
diff --git a/glcd.h b/glcd.h
index 65c5ef3f..69d5c6ed 100644
--- a/glcd.h
+++ b/glcd.h
@@ -35,7 +35,7 @@ enum transparency {solid, transparent};
// For text rendering only
extern uint16_t bgcolor, fgcolor;
extern uint16_t cx, cy;
-extern uint8_t* font;
+extern const uint8_t* font;
// A few macros
#define lcdGotoXY(x,y) { cx=x; cy=y; }
@@ -55,7 +55,7 @@ void lcdDrawRectString(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, const
void lcdDrawCircle(uint16_t x, uint16_t y, uint16_t radius, uint8_t filled, uint16_t color);
void lcdSetFontTransparency(uint8_t transparency);
-void lcdSetFont(uint8_t *fnt);
+void lcdSetFont(const uint8_t *fnt);
void lcdDrawChar(char c);
void lcdPutString(const char *str);
void lcdDrawString(uint16_t x, uint16_t y, const char *str, uint16_t color, uint16_t bkcolor);