mirror of
https://github.com/zyphlar/bdf2c.git
synced 2024-03-08 13:47:46 +00:00
Added -s option to tweak output to match format needed for SmartMatrix library
Now the .c file can be copied directly to the SmartMatrix library without modification
This commit is contained in:
parent
f68c2384bd
commit
b07deb7a48
24
bdf2c.c
24
bdf2c.c
|
@ -84,6 +84,7 @@
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
int Outline; ///< true generate outlined font
|
int Outline; ///< true generate outlined font
|
||||||
|
int SmartMatrix; // modify output to be used in the SmartMatrix library
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -128,10 +129,16 @@ void CreateFontHeaderFile(FILE * out)
|
||||||
///
|
///
|
||||||
void Header(FILE * out, const char *name)
|
void Header(FILE * out, const char *name)
|
||||||
{
|
{
|
||||||
|
char * headername;
|
||||||
|
if(!SmartMatrix)
|
||||||
|
headername = "font";
|
||||||
|
else
|
||||||
|
headername = "MatrixFontCommon";
|
||||||
|
|
||||||
fprintf(out,
|
fprintf(out,
|
||||||
"// Created from bdf2c Version %s, (c) 2009, 2010 by Lutz Sammer\n"
|
"// Created from bdf2c Version %s, (c) 2009, 2010 by Lutz Sammer\n"
|
||||||
"//\tLicense AGPLv3: GNU Affero General Public License version 3\n"
|
"//\tLicense AGPLv3: GNU Affero General Public License version 3\n"
|
||||||
"\n#include \"font.h\"\n\n", VERSION);
|
"\n#include \"%s.h\"\n\n", VERSION, headername);
|
||||||
|
|
||||||
fprintf(out,
|
fprintf(out,
|
||||||
"\t/// character bitmap for each encoding\n"
|
"\t/// character bitmap for each encoding\n"
|
||||||
|
@ -197,7 +204,12 @@ void Footer(FILE * out, const char *name, int width, int height, int chars)
|
||||||
name);
|
name);
|
||||||
fprintf(out, "\t.Width = %d, .Height = %d,\n", width, height);
|
fprintf(out, "\t.Width = %d, .Height = %d,\n", width, height);
|
||||||
fprintf(out, "\t.Chars = %d,\n", chars);
|
fprintf(out, "\t.Chars = %d,\n", chars);
|
||||||
fprintf(out, "\t.Widths = __%s_widths__,\n", name);
|
|
||||||
|
if(!SmartMatrix)
|
||||||
|
fprintf(out, "\t.Widths = __%s_widths__,\n", name);
|
||||||
|
else
|
||||||
|
fprintf(out, "\t.Widths = 0,\n");
|
||||||
|
|
||||||
fprintf(out, "\t.Index = __%s_index__,\n", name);
|
fprintf(out, "\t.Index = __%s_index__,\n", name);
|
||||||
fprintf(out, "\t.Bitmap = __%s_bitmap__,\n", name);
|
fprintf(out, "\t.Bitmap = __%s_bitmap__,\n", name);
|
||||||
fprintf(out, "};\n\n");
|
fprintf(out, "};\n\n");
|
||||||
|
@ -589,7 +601,8 @@ void ReadBdf(FILE * bdf, FILE * out, const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output width table for proportional font.
|
// Output width table for proportional font.
|
||||||
WidthTable(out, name, width_table, chars);
|
if(!SmartMatrix)
|
||||||
|
WidthTable(out, name, width_table, chars);
|
||||||
// FIXME: Output offset table for proportional font.
|
// FIXME: Output offset table for proportional font.
|
||||||
// OffsetTable(out, name, offset_table, chars);
|
// OffsetTable(out, name, offset_table, chars);
|
||||||
// Output encoding table for utf-8 support
|
// Output encoding table for utf-8 support
|
||||||
|
@ -641,7 +654,7 @@ int main(int argc, char *const argv[])
|
||||||
// Parse arguments.
|
// Parse arguments.
|
||||||
//
|
//
|
||||||
for (;;) {
|
for (;;) {
|
||||||
switch (getopt(argc, argv, "bcC:n:hO?-")) {
|
switch (getopt(argc, argv, "bcC:n:hOs?-")) {
|
||||||
case 'b': // bdf file name
|
case 'b': // bdf file name
|
||||||
ReadBdf(stdin, stdout, name);
|
ReadBdf(stdin, stdout, name);
|
||||||
continue;
|
continue;
|
||||||
|
@ -667,6 +680,9 @@ int main(int argc, char *const argv[])
|
||||||
case 'O':
|
case 'O':
|
||||||
Outline = 1;
|
Outline = 1;
|
||||||
continue;
|
continue;
|
||||||
|
case 's':
|
||||||
|
SmartMatrix = 1;
|
||||||
|
continue;
|
||||||
|
|
||||||
case EOF:
|
case EOF:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user