From a24fab0d7217aaae1463f62d5d1381ef820cfa17 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 8 Jul 2018 12:50:05 +1000 Subject: Added type gFontmetric to replace V2.x fontmetric_t, and values gFontXXX replace fontXXX --- src/gdisp/gdisp.c | 18 +++++++++--------- src/gdisp/gdisp.h | 41 +++++++++++++++++++++++++---------------- 2 files changed, 34 insertions(+), 25 deletions(-) (limited to 'src/gdisp') diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c index 1dbd26b2..323699d2 100644 --- a/src/gdisp/gdisp.c +++ b/src/gdisp/gdisp.c @@ -3608,19 +3608,19 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor MUTEX_EXIT(g); } - gCoord gdispGetFontMetric(font_t font, fontmetric_t metric) { + gCoord gdispGetFontMetric(font_t font, gFontmetric metric) { if (!font) return 0; /* No mutex required as we only read static data */ switch(metric) { - case fontHeight: return font->height; - case fontDescendersHeight: return font->height - font->baseline_y; - case fontLineSpacing: return font->line_height; - case fontCharPadding: return 0; - case fontMinWidth: return font->min_x_advance; - case fontMaxWidth: return font->max_x_advance; - case fontBaselineX: return font->baseline_x; - case fontBaselineY: return font->baseline_y; + case gFontHeight: return font->height; + case gFontDescendersHeight: return font->height - font->baseline_y; + case gFontLineSpacing: return font->line_height; + case gFontCharPadding: return 0; + case gFontMinWidth: return font->min_x_advance; + case gFontMaxWidth: return font->max_x_advance; + case gFontBaselineX: return font->baseline_x; + case gFontBaselineY: return font->baseline_y; } return 0; } diff --git a/src/gdisp/gdisp.h b/src/gdisp/gdisp.h index aac33e44..ed6e7c6a 100644 --- a/src/gdisp/gdisp.h +++ b/src/gdisp/gdisp.h @@ -73,19 +73,19 @@ typedef enum gJustify { #define JUSTIFYMASK_TOPBOTTOM (gJustifyTop|gJustifyMiddle|gJustifyBottom) /** - * @enum fontmetric + * @enum gFontmetric * @brief Type for the font metric. */ -typedef enum fontmetric { - fontHeight, /**< The height of the font */ - fontDescendersHeight, /**< The descenders height */ - fontLineSpacing, /**< The line spacing */ - fontCharPadding, /**< The char padding */ - fontMinWidth, /**< The minimum width */ - fontMaxWidth, /**< The maximum width */ - fontBaselineX, /**< The base line in x direction */ - fontBaselineY /**< The base line in y direction */ -} fontmetric_t; +typedef enum gFontmetric { + gFontHeight, /**< The height of the font */ + gFontDescendersHeight, /**< The descenders height */ + gFontLineSpacing, /**< The line spacing */ + gFontCharPadding, /**< The char padding */ + gFontMinWidth, /**< The minimum width */ + gFontMaxWidth, /**< The maximum width */ + gFontBaselineX, /**< The base line in x direction */ + gFontBaselineY /**< The base line in y direction */ +} gFontmetric; /** * @brief The type of a font. @@ -1013,7 +1013,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor * * @api */ - gCoord gdispGetFontMetric(font_t font, fontmetric_t metric); + gCoord gdispGetFontMetric(font_t font, gFontmetric metric); /** * @brief Get the pixel width of a character. @@ -1230,6 +1230,10 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor /* V2 compatibility */ #if GFX_COMPAT_V2 + typedef gColor color_t; + typedef gPixel pixel_t; + typedef gCoord coord_t; + typedef gPoint point, point_t; typedef gPowermode powermode_t; #define powerOff gPowerOff #define powerDeepSleep gPowerDeepSleep @@ -1246,10 +1250,15 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor #define justifyNoWordWrap gJustifyNoWordWrap #define justifyPad gJustifyPad #define justifyNoPad gJustifyNoPad - typedef gColor color_t; - typedef gPixel pixel_t; - typedef gCoord coord_t; - typedef gPoint point, point_t; + typedef gFontmetric fontmetric_t; + #define fontHeight gFontHeight + #define fontDescendersHeight gFontDescendersHeight + #define fontLineSpacing gFontLineSpacing + #define fontCharPadding gFontCharPadding + #define fontMinWidth gFontMinWidth + #define fontMaxWidth gFontMaxWidth + #define fontBaselineX gFontBaselineX + #define fontBaselineY gFontBaselineY #endif #endif /* GFX_USE_GDISP */ -- cgit v1.2.3