issue #2406
This commit is contained in:
parent
3e86287a55
commit
17b0cca50d
|
@ -92,6 +92,14 @@ issue1769: bdfconv
|
||||||
./bdfconv -v -f 1 -b 2 -m '32-128' 3x7_Multi_V7.bdf -o u8g2_font_3x7_multi.c -n u8g2_font_3x7_multi -d ../bdf/helvR12.bdf
|
./bdfconv -v -f 1 -b 2 -m '32-128' 3x7_Multi_V7.bdf -o u8g2_font_3x7_multi.c -n u8g2_font_3x7_multi -d ../bdf/helvR12.bdf
|
||||||
convert bdf.tga -trim u8g2_font_3x7_multi.png
|
convert bdf.tga -trim u8g2_font_3x7_multi.png
|
||||||
|
|
||||||
|
issue2406: bdfconv
|
||||||
|
-../otf2bdf/otf2bdf -y -v -r 72 -p 16 -o tmp.bdf ../tmp/zfull/zfull-regular.ttf
|
||||||
|
#-../otf2bdf/otf2bdf -v -r 72 -p 16 -o tmp.bdf ../ttf/Logisoso.ttf
|
||||||
|
#-../otf2bdf/otf2bdf -v -r 72 -p 16 -o tmp.bdf ../ttf/PressStart2P.ttf
|
||||||
|
#-../otf2bdf/otf2bdf -v -r 72 -p 16 -o tmp.bdf ../ttf/Wizzard.ttf
|
||||||
|
./bdfconv -v -f 1 -b 2 -m '32-128' tmp.bdf -o u8g2_zfull.c -n u8g2_zfull -d ../bdf/helvR12.bdf
|
||||||
|
convert bdf.tga -trim u8g2_zfull.png
|
||||||
|
|
||||||
|
|
||||||
emoticons21: bdfconv
|
emoticons21: bdfconv
|
||||||
./bdfconv -v -f 1 -m '32-64' ../emoticons/emoticons21.bdf -o emoticons21.c -n u8g2_font_emoticons21_tn -d ../bdf/helvB18.bdf
|
./bdfconv -v -f 1 -m '32-64' ../emoticons/emoticons21.bdf -o emoticons21.c -n u8g2_font_emoticons21_tn -d ../bdf/helvB18.bdf
|
||||||
|
|
|
@ -135,6 +135,8 @@ static char *prog;
|
||||||
*/
|
*/
|
||||||
static int verbose = 0;
|
static int verbose = 0;
|
||||||
|
|
||||||
|
static int alternate_y_offset_calculation = 0; // u8g2 issue 2406 https://github.com/olikraus/u8g2/issues/2406
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flags used when loading glyphs.
|
* Flags used when loading glyphs.
|
||||||
*/
|
*/
|
||||||
|
@ -880,6 +882,10 @@ generate_font(FILE *out, char *iname, char *oname)
|
||||||
ht = ey - sy;
|
ht = ey - sy;
|
||||||
x_off = sx + face->glyph->bitmap_left;
|
x_off = sx + face->glyph->bitmap_left;
|
||||||
y_off = sy + face->glyph->bitmap_top - face->glyph->bitmap.rows;
|
y_off = sy + face->glyph->bitmap_top - face->glyph->bitmap.rows;
|
||||||
|
// u8g2 issue 2406
|
||||||
|
// the above calculation seems to be wrong, this should be:
|
||||||
|
if ( alternate_y_offset_calculation )
|
||||||
|
y_off = face->glyph->bitmap_top - ey;
|
||||||
|
|
||||||
bbx.maxas = MAX(bbx.maxas, ht + y_off);
|
bbx.maxas = MAX(bbx.maxas, ht + y_off);
|
||||||
bbx.maxds = MAX(bbx.maxds, -y_off);
|
bbx.maxds = MAX(bbx.maxds, -y_off);
|
||||||
|
@ -902,6 +908,10 @@ generate_font(FILE *out, char *iname, char *oname)
|
||||||
fprintf(tmp, "DWIDTH %hd 0\n", dwidth);
|
fprintf(tmp, "DWIDTH %hd 0\n", dwidth);
|
||||||
fprintf(tmp, "BBX %ld %ld %hd %hd\n", wd, ht, x_off, y_off);
|
fprintf(tmp, "BBX %ld %ld %hd %hd\n", wd, ht, x_off, y_off);
|
||||||
|
|
||||||
|
// debug output (u8g2 issue 2406)
|
||||||
|
//if ( remapped_code >= 96 && remapped_code <= 103 )
|
||||||
|
// fprintf(stderr, "%05ld BBX %ld %ld %hd %hd sy=%d, ey=%d bitmap_top=%d bitmap.rows=%d\n", (long) remapped_code, wd, ht, x_off, y_off, (int)sy, (int)ey, face->glyph->bitmap_top, face->glyph->bitmap.rows);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for an error return here in case the temporary file system
|
* Check for an error return here in case the temporary file system
|
||||||
* fills up or the file is deleted while it is being used.
|
* fills up or the file is deleted while it is being used.
|
||||||
|
@ -1242,6 +1252,7 @@ usage(int eval)
|
||||||
printf("-m mapfile\tGlyph reencoding file.\n");
|
printf("-m mapfile\tGlyph reencoding file.\n");
|
||||||
printf("-n\t\tTurn off glyph hinting.\n");
|
printf("-n\t\tTurn off glyph hinting.\n");
|
||||||
printf("-a\t\tForce auto hinting.\n");
|
printf("-a\t\tForce auto hinting.\n");
|
||||||
|
printf("-y\t\tApply bugfix for the bbx y offset calculation (u8g2 issue 2406).\n");
|
||||||
printf("-g\t\tOutput raw glyphs instead of unicode chars.\n");
|
printf("-g\t\tOutput raw glyphs instead of unicode chars.\n");
|
||||||
printf("-et\t\tDisplay the encoding tables available in the font.\n");
|
printf("-et\t\tDisplay the encoding tables available in the font.\n");
|
||||||
printf("-c c\t\tSet the character spacing (default: from font).\n");
|
printf("-c c\t\tSet the character spacing (default: from font).\n");
|
||||||
|
@ -1310,6 +1321,9 @@ main(int argc, char *argv[])
|
||||||
case 'a': case 'A':
|
case 'a': case 'A':
|
||||||
load_flags |= FT_LOAD_FORCE_AUTOHINT;
|
load_flags |= FT_LOAD_FORCE_AUTOHINT;
|
||||||
break;
|
break;
|
||||||
|
case 'y': case 'Y':
|
||||||
|
alternate_y_offset_calculation = 1;
|
||||||
|
break;
|
||||||
case 'g': case 'G':
|
case 'g': case 'G':
|
||||||
forcenocmap = 1;
|
forcenocmap = 1;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue