aboutsummaryrefslogtreecommitdiffstats
path: root/src/gdisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gdisp')
-rw-r--r--src/gdisp/gdisp.c20
-rw-r--r--src/gdisp/gdisp.h33
-rw-r--r--src/gdisp/gdisp_driver.h2
-rw-r--r--src/gdisp/gdisp_fonts.c12
4 files changed, 34 insertions, 33 deletions
diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c
index 323699d2..39f17ff3 100644
--- a/src/gdisp/gdisp.c
+++ b/src/gdisp/gdisp.c
@@ -3363,7 +3363,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
}
#endif
- void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, font_t font, gColor color) {
+ void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, gFont font, gColor color) {
if (!font)
return;
MUTEX_ENTER(g);
@@ -3378,7 +3378,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
MUTEX_EXIT(g);
}
- void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, font_t font, gColor color, gColor bgcolor) {
+ void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, gFont font, gColor color, gColor bgcolor) {
if (!font)
return;
MUTEX_ENTER(g);
@@ -3400,7 +3400,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
MUTEX_EXIT(g);
}
- void gdispGDrawString(GDisplay *g, gCoord x, gCoord y, const char *str, font_t font, gColor color) {
+ void gdispGDrawString(GDisplay *g, gCoord x, gCoord y, const char *str, gFont font, gColor color) {
if (!font)
return;
MUTEX_ENTER(g);
@@ -3416,7 +3416,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
MUTEX_EXIT(g);
}
- void gdispGFillString(GDisplay *g, gCoord x, gCoord y, const char *str, font_t font, gColor color, gColor bgcolor) {
+ void gdispGFillString(GDisplay *g, gCoord x, gCoord y, const char *str, gFont font, gColor color, gColor bgcolor) {
if (!font)
return;
MUTEX_ENTER(g);
@@ -3439,7 +3439,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
MUTEX_EXIT(g);
}
- void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, gJustify justify) {
+ void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, gFont font, gColor color, gJustify justify) {
gCoord totalHeight;
if (!font)
@@ -3517,7 +3517,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
MUTEX_EXIT(g);
}
- void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, gColor bgcolor, gJustify justify) {
+ void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, gFont font, gColor color, gColor bgcolor, gJustify justify) {
gCoord totalHeight;
if (!font)
@@ -3608,7 +3608,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
MUTEX_EXIT(g);
}
- gCoord gdispGetFontMetric(font_t font, gFontmetric metric) {
+ gCoord gdispGetFontMetric(gFont font, gFontmetric metric) {
if (!font)
return 0;
/* No mutex required as we only read static data */
@@ -3625,14 +3625,14 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
return 0;
}
- gCoord gdispGetCharWidth(char c, font_t font) {
+ gCoord gdispGetCharWidth(char c, gFont font) {
if (!font)
return 0;
/* No mutex required as we only read static data */
return mf_character_width(font, c);
}
- gCoord gdispGetStringWidthCount(const char* str, font_t font, uint16_t count) {
+ gCoord gdispGetStringWidthCount(const char* str, gFont font, uint16_t count) {
if (!str || !font)
return 0;
@@ -3644,7 +3644,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
#endif
}
- gCoord gdispGetStringWidth(const char* str, font_t font) {
+ gCoord gdispGetStringWidth(const char* str, gFont font) {
return gdispGetStringWidthCount(str, font, 0);
}
#endif
diff --git a/src/gdisp/gdisp.h b/src/gdisp/gdisp.h
index ed6e7c6a..338ec5a0 100644
--- a/src/gdisp/gdisp.h
+++ b/src/gdisp/gdisp.h
@@ -90,7 +90,7 @@ typedef enum gFontmetric {
/**
* @brief The type of a font.
*/
-typedef const struct mf_font_s* font_t;
+typedef const struct mf_font_s* gFont;
/**
* @enum orientation
@@ -917,7 +917,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, font_t font, gColor color);
+ void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, gFont font, gColor color);
#define gdispDrawChar(x,y,s,f,c) gdispGDrawChar(GDISP,x,y,s,f,c)
/**
@@ -933,7 +933,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, font_t font, gColor color, gColor bgcolor);
+ void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, gFont font, gColor color, gColor bgcolor);
#define gdispFillChar(x,y,s,f,c,b) gdispGFillChar(GDISP,x,y,s,f,c,b)
/**
@@ -948,7 +948,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- void gdispGDrawString(GDisplay *g, gCoord x, gCoord y, const char *str, font_t font, gColor color);
+ void gdispGDrawString(GDisplay *g, gCoord x, gCoord y, const char *str, gFont font, gColor color);
#define gdispDrawString(x,y,s,f,c) gdispGDrawString(GDISP,x,y,s,f,c)
/**
@@ -964,7 +964,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- void gdispGFillString(GDisplay *g, gCoord x, gCoord y, const char *str, font_t font, gColor color, gColor bgcolor);
+ void gdispGFillString(GDisplay *g, gCoord x, gCoord y, const char *str, gFont font, gColor color, gColor bgcolor);
#define gdispFillString(x,y,s,f,c,b) gdispGFillString(GDISP,x,y,s,f,c,b)
/**
@@ -981,7 +981,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, gJustify justify);
+ void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, gFont font, gColor color, gJustify justify);
#define gdispDrawStringBox(x,y,cx,cy,s,f,c,j) gdispGDrawStringBox(GDISP,x,y,cx,cy,s,f,c,j)
/**
@@ -1000,7 +1000,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, gColor bgColor, gJustify justify);
+ void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, gFont font, gColor color, gColor bgColor, gJustify justify);
#define gdispFillStringBox(x,y,cx,cy,s,f,c,b,j) gdispGFillStringBox(GDISP,x,y,cx,cy,s,f,c,b,j)
/**
@@ -1013,7 +1013,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- gCoord gdispGetFontMetric(font_t font, gFontmetric metric);
+ gCoord gdispGetFontMetric(gFont font, gFontmetric metric);
/**
* @brief Get the pixel width of a character.
@@ -1025,7 +1025,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- gCoord gdispGetCharWidth(char c, font_t font);
+ gCoord gdispGetCharWidth(char c, gFont font);
/**
* @brief Get the pixel width of a string of a given character length.
@@ -1040,7 +1040,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- gCoord gdispGetStringWidthCount(const char* str, font_t font, uint16_t count);
+ gCoord gdispGetStringWidthCount(const char* str, gFont font, uint16_t count);
/**
* @brief Get the pixel width of an entire string.
@@ -1052,7 +1052,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- gCoord gdispGetStringWidth(const char* str, font_t font);
+ gCoord gdispGetStringWidth(const char* str, gFont font);
/**
* @brief Find a font and return it.
@@ -1066,7 +1066,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- font_t gdispOpenFont(const char *name);
+ gFont gdispOpenFont(const char *name);
/**
* @brief Release a font after use.
@@ -1076,7 +1076,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- void gdispCloseFont(font_t font);
+ void gdispCloseFont(gFont font);
/**
* @brief Make a scaled copy of an existing font.
@@ -1090,7 +1090,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
* @param[in] scale_x The scale factor in horizontal direction.
* @param[in] scale_y The scale factor in vertical direction.
*/
- font_t gdispScaleFont(font_t font, uint8_t scale_x, uint8_t scale_y);
+ gFont gdispScaleFont(gFont font, uint8_t scale_x, uint8_t scale_y);
/**
* @brief Get the name of the specified font.
@@ -1101,7 +1101,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- const char *gdispGetFontName(font_t font);
+ const char *gdispGetFontName(gFont font);
/**
* @brief Add a font permanently to the font list.
@@ -1112,7 +1112,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- gBool gdispAddFont(font_t font);
+ gBool gdispAddFont(gFont font);
#endif
/* Extra Arc Functions */
@@ -1234,6 +1234,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
typedef gPixel pixel_t;
typedef gCoord coord_t;
typedef gPoint point, point_t;
+ typedef gFont font_t;
typedef gPowermode powermode_t;
#define powerOff gPowerOff
#define powerDeepSleep gPowerDeepSleep
diff --git a/src/gdisp/gdisp_driver.h b/src/gdisp/gdisp_driver.h
index 7a2692e4..7d0d7ef3 100644
--- a/src/gdisp/gdisp_driver.h
+++ b/src/gdisp/gdisp_driver.h
@@ -362,7 +362,7 @@ struct GDisplay {
#if GDISP_NEED_TEXT
// Text rendering parameters
struct {
- font_t font;
+ gFont font;
gColor color;
gColor bgcolor;
gCoord clipx0, clipy0;
diff --git a/src/gdisp/gdisp_fonts.c b/src/gdisp/gdisp_fonts.c
index a217c4d9..14164f02 100644
--- a/src/gdisp/gdisp_fonts.c
+++ b/src/gdisp/gdisp_fonts.c
@@ -42,7 +42,7 @@ static gBool matchfont(const char *pattern, const char *name) {
}
}
-font_t gdispOpenFont(const char *name) {
+gFont gdispOpenFont(const char *name) {
const struct mf_font_list_s *fp;
if (!fontList)
@@ -64,7 +64,7 @@ font_t gdispOpenFont(const char *name) {
return mf_get_font_list()->font;
}
-void gdispCloseFont(font_t font) {
+void gdispCloseFont(gFont font) {
if ((font->flags & (FONT_FLAG_DYNAMIC|FONT_FLAG_UNLISTED)) == (FONT_FLAG_DYNAMIC|FONT_FLAG_UNLISTED)) {
/* Make sure that no-one can successfully use font after closing */
((struct mf_font_s *)font)->render_character = 0;
@@ -74,7 +74,7 @@ void gdispCloseFont(font_t font) {
}
}
-font_t gdispScaleFont(font_t font, uint8_t scale_x, uint8_t scale_y)
+gFont gdispScaleFont(gFont font, uint8_t scale_x, uint8_t scale_y)
{
struct mf_scaledfont_s *newfont;
@@ -83,14 +83,14 @@ font_t gdispScaleFont(font_t font, uint8_t scale_x, uint8_t scale_y)
mf_scale_font(newfont, font, scale_x, scale_y);
((struct mf_font_s *)newfont)->flags |= FONT_FLAG_DYNAMIC|FONT_FLAG_UNLISTED;
- return (font_t)newfont;
+ return (gFont)newfont;
}
-const char *gdispGetFontName(font_t font) {
+const char *gdispGetFontName(gFont font) {
return font->short_name;
}
-gBool gdispAddFont(font_t font) {
+gBool gdispAddFont(gFont font) {
struct mf_font_list_s *hdr;
if ((font->flags & (FONT_FLAG_DYNAMIC|FONT_FLAG_UNLISTED)) != (FONT_FLAG_DYNAMIC|FONT_FLAG_UNLISTED))