Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix build warning, change file header, add msys built exe #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions bdf2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ void CreateFontHeaderFile(FILE * out)
register int i;

fprintf(out,
"// (c) 2009, 2010 Lutz Sammer, License: AGPLv3\n\n"
"// Created with bdf2c Version %s, (c) 2009, 2010 by Lutz Sammer\n\n"
"\t/// bitmap font structure\n" "struct bitmap_font {\n"
"\tunsigned char Width;\t\t///< max. character width\n"
"\tunsigned char Height;\t\t///< character height\n"
"\tunsigned short Chars;\t\t///< number of characters in font\n"
"\tconst unsigned char *Widths;\t///< width of each character\n"
"\tconst unsigned short *Index;\t///< encoding to character index\n"
"\tconst unsigned char *Bitmap;\t///< bitmap of all characters\n"
"};\n\n");
"};\n\n", VERSION);

fprintf(out, "\t/// @{ defines to have human readable font files\n");
for (i = 0; i < 256; ++i) {
Expand Down Expand Up @@ -136,8 +136,7 @@ void Header(FILE * out, const char *name)
headername = "MatrixFontCommon";

fprintf(out,
"// Created from bdf2c Version %s, (c) 2009, 2010 by Lutz Sammer\n"
"//\tLicense AGPLv3: GNU Affero General Public License version 3\n"
"// Created with bdf2c Version %s, (c) 2009, 2010 by Lutz Sammer\n"
"\n#include \"%s.h\"\n\n", VERSION, headername);

fprintf(out,
Expand Down Expand Up @@ -232,10 +231,10 @@ void DumpCharacter(FILE * out, unsigned char *bitmap, int fontwidth, int fonthei
fputc('\t', out);
for (x = 0; x < fontwidth; x += 8) {
// if current row is above or below the bitmap, output a blank row
if(y < yoffset || y > yoffset + charheight)
c = 0;
else
c = bitmap[(y - yoffset) * ((fontwidth + 7) / 8) + x / 8];
if(y < yoffset || y > yoffset + charheight){
c = 0;}
else{
c = bitmap[(y - yoffset) * ((fontwidth + 7) / 8) + x / 8];}

//printf("%d = %d\n", y * ((width+7)/8) + x/8, c);
if (c & 0x80) {
Expand Down Expand Up @@ -394,7 +393,7 @@ void ReadBdf(FILE * bdf, FILE * out, const char *name)
char *p;
int fontboundingbox_width;
int fontboundingbox_height;
int fontboundingbox_xoff;
// int fontboundingbox_xoff;
int fontboundingbox_yoff;
int chars;
int i;
Expand All @@ -414,7 +413,7 @@ void ReadBdf(FILE * bdf, FILE * out, const char *name)

fontboundingbox_width = 0;
fontboundingbox_height = 0;
fontboundingbox_xoff = 0;
// fontboundingbox_xoff = 0;
fontboundingbox_yoff = 0;
chars = 0;
for (;;) {
Expand All @@ -431,7 +430,7 @@ void ReadBdf(FILE * bdf, FILE * out, const char *name)
p = strtok(NULL, " \t\n\r");
fontboundingbox_height = atoi(p);
p = strtok(NULL, " \t\n\r");
fontboundingbox_xoff = atoi(p);
// fontboundingbox_xoff = atoi(p);
p = strtok(NULL, " \t\n\r");
fontboundingbox_yoff = atoi(p);
} else if (!strcasecmp(s, "CHARS")) {
Expand Down
Binary file added bdf2c.exe
Binary file not shown.
14 changes: 14 additions & 0 deletions msys_build_instructions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
install msys2 http://www.msys2.org

run msys from start menu

install mingw https://stackoverflow.com/questions/30069830/how-to-install-mingw-w64-and-msys2#30071634

add mingw to path, type:
export PATH=/mingw32/bin:$PATH

enter to directory of this sourse code, type:
cd "c:\path_to_this_folder"

to build, type:
make