font pics
This commit is contained in:
parent
01e9cdc054
commit
7a15997349
|
@ -284,6 +284,7 @@ uint8_t u8g2_IsIntersection(u8g2_t *u8g2, u8g2_uint_t x0, u8g2_uint_t y0, u8g2_u
|
|||
/*==========================================*/
|
||||
/* u8g2_font.c */
|
||||
|
||||
size_t u8g2_GetFontSize(const uint8_t *font_arg);
|
||||
|
||||
#define U8G2_FONT_HEIGHT_MODE_TEXT 0
|
||||
#define U8G2_FONT_HEIGHT_MODE_XTEXT 1
|
||||
|
@ -298,7 +299,7 @@ u8g2_uint_t u8g2_DrawGlyph(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, uint16_t
|
|||
void u8g2_SetFontDirection(u8g2_t *u8g2, uint8_t dir);
|
||||
u8g2_uint_t u8g2_DrawString(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, const char *str);
|
||||
#define u8g2_GetMaxCharHeight(u8g2) ((u8g2)->font_info.max_char_height)
|
||||
#define u8g2_GetMaxCharWidth(u8g2) ((u8g2)->font_info.max_char_height)
|
||||
#define u8g2_GetMaxCharWidth(u8g2) ((u8g2)->font_info.max_char_width)
|
||||
#define u8g2_GetAscent(u8g2) ((u8g2)->font_info.ascent_A)
|
||||
#define u8g2_GetDescent(u8g2) ((u8g2)->font_info.descent_g)
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ void u8g2_read_font_info(u8g2_font_info_t *font_info, const uint8_t *font)
|
|||
|
||||
|
||||
/* calculate the overall length of the font, only used to create the picture for the google wiki */
|
||||
size_t u8g2_font_GetSize(const void *font_arg)
|
||||
size_t u8g2_GetFontSize(const uint8_t *font_arg)
|
||||
{
|
||||
uint16_t e;
|
||||
const uint8_t *font = font_arg;
|
||||
|
|
|
@ -268,7 +268,6 @@ void overview_draw_line(int i, uint16_t encoding_start, uint16_t x, uint16_t y,
|
|||
|
||||
u8g2_SetFont(&u8g2, u8g2_font_list[u8g2_fnt_cnt]);
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
u8g2_DrawString(&u8g2, 0, 40, u8g2_font_names[u8g2_fnt_cnt]);
|
||||
for( j = 0; j < 16; j++)
|
||||
{
|
||||
if ( u8g2_IsGlyph(&u8g2, encoding_start + j) != 0 )
|
||||
|
@ -294,18 +293,38 @@ int is_overview_line_empty(uint16_t encoding_start)
|
|||
void overview_draw_table(int i, uint16_t x, uint16_t y)
|
||||
{
|
||||
int cw, ch;
|
||||
int line;
|
||||
int line, h;
|
||||
uint16_t encoding;
|
||||
static char s[256];
|
||||
|
||||
u8g2_SetFont(&u8g2, u8g2_font_7x13_tr);
|
||||
u8g2_DrawString(&u8g2, 0, 20, u8g2_font_names[u8g2_fnt_cnt]);
|
||||
h = 13;
|
||||
|
||||
u8g2_SetFont(&u8g2, u8g2_font_list[u8g2_fnt_cnt]);
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
|
||||
ch = u8g2_GetMaxCharHeight(&u8g2);
|
||||
cw = u8g2_GetMaxCharWidth(&u8g2);
|
||||
|
||||
sprintf(s, "BBX Width %d, Height %d, Capital A %d",
|
||||
u8g2_GetMaxCharWidth(&u8g2),
|
||||
u8g2_GetMaxCharHeight(&u8g2),
|
||||
u8g2_GetAscent(&u8g2));
|
||||
|
||||
u8g2_SetFont(&u8g2, u8g2_font_7x13_tr);
|
||||
u8g2_DrawString(&u8g2, 0, h, u8g2_font_names[u8g2_fnt_cnt]);
|
||||
u8g2_DrawString(&u8g2, 0, h*2, s);
|
||||
|
||||
sprintf(s, "Font Data Size: %d Bytes", u8g2_GetFontSize(u8g2_font_list[u8g2_fnt_cnt]));
|
||||
u8g2_DrawString(&u8g2, 0, h*3, s);
|
||||
|
||||
u8g2_SetFont(&u8g2, u8g2_font_list[u8g2_fnt_cnt]);
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
|
||||
ch = u8g2_GetMaxCharHeight(&u8g2);
|
||||
cw = u8g2_GetMaxCharWidth(&u8g2);
|
||||
if ( ch < h )
|
||||
ch = h;
|
||||
y = h*3+ch;
|
||||
|
||||
line = 0;
|
||||
for(;;)
|
||||
|
@ -313,6 +332,10 @@ void overview_draw_table(int i, uint16_t x, uint16_t y)
|
|||
encoding = line*16;
|
||||
if ( is_overview_line_empty(encoding) == 0 )
|
||||
{
|
||||
u8g2_SetFont(&u8g2, u8g2_font_7x13_tr);
|
||||
sprintf(s, "%5d/%04x ", encoding, encoding);
|
||||
|
||||
x = u8g2_DrawString(&u8g2, 0, y, s);
|
||||
overview_draw_line(i, encoding, x, y, cw);
|
||||
y += ch;
|
||||
}
|
||||
|
@ -338,12 +361,6 @@ void overviewpic(int i, int fm, char *fms, int bm, char *bms, int mm, char *mms)
|
|||
u8g2_FirstPage(&u8g2);
|
||||
do
|
||||
{
|
||||
u8g2_SetFont(&u8g2, u8g2_font_list[u8g2_fnt_cnt]);
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
u8g2_DrawString(&u8g2, 0, 40, u8g2_font_names[u8g2_fnt_cnt]);
|
||||
|
||||
ch = u8g2_GetMaxCharHeight(&u8g2);
|
||||
cw = u8g2_GetMaxCharWidth(&u8g2);
|
||||
|
||||
overview_draw_table(i, 0, 60);
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define FACTOR 3
|
||||
#define XOFFSET (FACTOR*32)
|
||||
#define YOFFSET (FACTOR*32)
|
||||
#define DEFAULT_WIDTH (FACTOR*128)
|
||||
#define DEFAULT_HEIGHT (FACTOR*64)
|
||||
//#define FACTOR 3
|
||||
//#define XOFFSET (FACTOR*32)
|
||||
//#define YOFFSET (FACTOR*32)
|
||||
#define DEFAULT_WIDTH (512U)
|
||||
#define DEFAULT_HEIGHT (1024U)
|
||||
|
||||
|
||||
uint16_t tga_max_x;
|
||||
|
@ -130,7 +130,7 @@ void tga_save(const char *name)
|
|||
if ( tga_data == NULL )
|
||||
return;
|
||||
|
||||
printf("tga_save: File %s with %dx%d pixel\n", name, tga_width, tga_height);
|
||||
//printf("tga_save: File %s with %dx%d pixel\n", name, tga_width, tga_height);
|
||||
|
||||
fp = fopen(name, "wb");
|
||||
if ( fp != NULL )
|
||||
|
|
Loading…
Reference in New Issue