diff options
author | inmarket <andrewh@inmarket.com.au> | 2015-06-08 14:14:40 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2015-06-08 14:14:40 +1000 |
commit | ccde54722f2c284fb0e7fc273d65c57a3be71db1 (patch) | |
tree | fffa49870c73d7e9d5caaf5c6d1d47cf0e5c90d3 /src/gdisp/mcufont | |
parent | e850c344b818f21a2ec286f9c4a149a9cd4ac34b (diff) | |
download | uGFX-ccde54722f2c284fb0e7fc273d65c57a3be71db1.tar.gz uGFX-ccde54722f2c284fb0e7fc273d65c57a3be71db1.tar.bz2 uGFX-ccde54722f2c284fb0e7fc273d65c57a3be71db1.zip |
Added ability to compile ugfx as a single file (excluding driver and board files).
Simply compile src/gfx_mk.c
Diffstat (limited to 'src/gdisp/mcufont')
-rw-r--r-- | src/gdisp/mcufont/mf_bwfont.h | 4 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_config.h | 2 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_encoding.h | 6 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_font.c | 12 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_font.h | 6 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_justify.c | 2 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_rlefont.c | 2 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_rlefont.h | 4 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_scaledfont.c | 4 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_scaledfont.h | 4 |
10 files changed, 28 insertions, 18 deletions
diff --git a/src/gdisp/mcufont/mf_bwfont.h b/src/gdisp/mcufont/mf_bwfont.h index f0429073..761352df 100644 --- a/src/gdisp/mcufont/mf_bwfont.h +++ b/src/gdisp/mcufont/mf_bwfont.h @@ -73,12 +73,12 @@ struct mf_bwfont_s /* Internal functions, don't use these directly. */ MF_EXTERN uint8_t mf_bwfont_render_character(const struct mf_font_s *font, int16_t x0, int16_t y0, - mf_char character, + uint16_t character, mf_pixel_callback_t callback, void *state); MF_EXTERN uint8_t mf_bwfont_character_width(const struct mf_font_s *font, - mf_char character); + uint16_t character); #endif #endif diff --git a/src/gdisp/mcufont/mf_config.h b/src/gdisp/mcufont/mf_config.h index 88838c1d..ac2262d4 100644 --- a/src/gdisp/mcufont/mf_config.h +++ b/src/gdisp/mcufont/mf_config.h @@ -159,7 +159,7 @@ #ifdef __cplusplus #define MF_EXTERN extern "C" #else -#define MF_EXTERN extern +#define MF_EXTERN #endif #endif diff --git a/src/gdisp/mcufont/mf_encoding.h b/src/gdisp/mcufont/mf_encoding.h index d8b7b70e..a8c44d9d 100644 --- a/src/gdisp/mcufont/mf_encoding.h +++ b/src/gdisp/mcufont/mf_encoding.h @@ -19,9 +19,11 @@ /* Type used to represent characters internally. */ #if MF_ENCODING == MF_ENCODING_ASCII -typedef char mf_char; + typedef char mf_char; + #define MFCHAR2UINT16(c) ((uint16_t)(uint8_t)(c)) #else -typedef uint16_t mf_char; + typedef uint16_t mf_char; + #define MFCHAR2UINT16(c) (c) #endif /* Type used to represent input strings. */ diff --git a/src/gdisp/mcufont/mf_font.c b/src/gdisp/mcufont/mf_font.c index 7a4ebf95..ccf71bec 100644 --- a/src/gdisp/mcufont/mf_font.c +++ b/src/gdisp/mcufont/mf_font.c @@ -5,10 +5,18 @@ * http://ugfx.org/license.html */ -#include "mf_font.h" +#include "mf_config.h" #ifndef MF_NO_COMPILE +#define MF_BWFONT_INTERNALS +#define MF_RLEFONT_INTERNALS +#define MF_SCALEDFONT_INTERNALS +#include "mf_font.h" +#include "mf_rlefont.h" +#include "mf_bwfont.h" +#include "mf_scaledfont.h" + #include <stdbool.h> /* This will be made into a list of included fonts using macro magic. */ @@ -40,7 +48,7 @@ uint8_t mf_character_width(const struct mf_font_s *font, mf_char character) { uint8_t width; - width = font->character_width(font, character); + width = font->character_width(font, MFCHAR2UINT16(character)); if (!width) { diff --git a/src/gdisp/mcufont/mf_font.h b/src/gdisp/mcufont/mf_font.h index 1166fa3b..ff8840c8 100644 --- a/src/gdisp/mcufont/mf_font.h +++ b/src/gdisp/mcufont/mf_font.h @@ -53,17 +53,17 @@ struct mf_font_s uint8_t flags; /* Fallback character to use for missing glyphs. */ - mf_char fallback_character; + uint16_t fallback_character; /* Function to get character width. Should return 0 if character is * not found. */ - uint8_t (*character_width)(const struct mf_font_s *font, mf_char character); + uint8_t (*character_width)(const struct mf_font_s *font, uint16_t character); /* Function to render a character. Returns the character width or 0 if * character is not found. */ uint8_t (*render_character)(const struct mf_font_s *font, int16_t x0, int16_t y0, - mf_char character, + uint16_t character, mf_pixel_callback_t callback, void *state); }; diff --git a/src/gdisp/mcufont/mf_justify.c b/src/gdisp/mcufont/mf_justify.c index 857777cd..204bb7f7 100644 --- a/src/gdisp/mcufont/mf_justify.c +++ b/src/gdisp/mcufont/mf_justify.c @@ -297,7 +297,7 @@ void mf_render_justified(const struct mf_font_s *font, { int16_t x, tmp; - uint16_t c1 = 0, c2; + mf_char c1 = 0, c2; x = x0 - font->baseline_x; while (count--) diff --git a/src/gdisp/mcufont/mf_rlefont.c b/src/gdisp/mcufont/mf_rlefont.c index c4b344c6..2ef89fd1 100644 --- a/src/gdisp/mcufont/mf_rlefont.c +++ b/src/gdisp/mcufont/mf_rlefont.c @@ -267,7 +267,7 @@ uint8_t mf_rlefont_render_character(const struct mf_font_s *font, rstate.callback = callback; rstate.state = state; - p = find_glyph((struct mf_rlefont_s*)font, character); + p = find_glyph((struct mf_rlefont_s*)font, character); if (!p) return 0; diff --git a/src/gdisp/mcufont/mf_rlefont.h b/src/gdisp/mcufont/mf_rlefont.h index d9cee8dc..7e717ccc 100644 --- a/src/gdisp/mcufont/mf_rlefont.h +++ b/src/gdisp/mcufont/mf_rlefont.h @@ -70,12 +70,12 @@ struct mf_rlefont_s /* Internal functions, don't use these directly. */ MF_EXTERN uint8_t mf_rlefont_render_character(const struct mf_font_s *font, int16_t x0, int16_t y0, - mf_char character, + uint16_t character, mf_pixel_callback_t callback, void *state); MF_EXTERN uint8_t mf_rlefont_character_width(const struct mf_font_s *font, - mf_char character); + uint16_t character); #endif #endif diff --git a/src/gdisp/mcufont/mf_scaledfont.c b/src/gdisp/mcufont/mf_scaledfont.c index 4f9de208..570baef6 100644 --- a/src/gdisp/mcufont/mf_scaledfont.c +++ b/src/gdisp/mcufont/mf_scaledfont.c @@ -36,7 +36,7 @@ static void scaled_pixel_callback(int16_t x, int16_t y, uint8_t count, } uint8_t mf_scaled_character_width(const struct mf_font_s *font, - mf_char character) + uint16_t character) { struct mf_scaledfont_s *sfont = (struct mf_scaledfont_s*)font; uint8_t basewidth; @@ -48,7 +48,7 @@ uint8_t mf_scaled_character_width(const struct mf_font_s *font, uint8_t mf_scaled_render_character(const struct mf_font_s *font, int16_t x0, int16_t y0, - mf_char character, + uint16_t character, mf_pixel_callback_t callback, void *state) { diff --git a/src/gdisp/mcufont/mf_scaledfont.h b/src/gdisp/mcufont/mf_scaledfont.h index 5fdc0980..c4e4406b 100644 --- a/src/gdisp/mcufont/mf_scaledfont.h +++ b/src/gdisp/mcufont/mf_scaledfont.h @@ -31,12 +31,12 @@ MF_EXTERN void mf_scale_font(struct mf_scaledfont_s *newfont, /* Internal functions, don't use these directly. */ MF_EXTERN uint8_t mf_scaled_render_character(const struct mf_font_s *font, int16_t x0, int16_t y0, - mf_char character, + uint16_t character, mf_pixel_callback_t callback, void *state); MF_EXTERN uint8_t mf_scaled_character_width(const struct mf_font_s *font, - mf_char character); + uint16_t character); #endif #endif |