Commit d70b51ac authored by Vincent Wei's avatar Vincent Wei
Browse files

cleanup

parent 2827e4db
......@@ -3,7 +3,7 @@
**
** parse_bdf.c: a bdf file parsor
**
** Copyright (C) 2009 Feynman Software
** Copyright (C) 2009 FMSoft
**
** Author: WEI Yongming
**
......
/*
** Copyright (C) 2009 Feynman Software
** Copyright (C) 2009 FMSoft
** Author: WEI Yongming
** Create date: 2009/12/19
*/
......
......@@ -3,7 +3,7 @@
**
** gen_upf.c: a upf file generator
**
** Copyright (C) 2009 Feynman Software
** Copyright (C) 2009 FMSoft
**
** Author: WEI Yongming
**
......
......@@ -3,7 +3,7 @@
**
** load_upf.c: a upf loader
**
** Copyright (C) 2009 Feynman Software
** Copyright (C) 2009 FMSoft
**
** Author: WEI Yongming
**
......
......@@ -3,7 +3,7 @@
**
** parse_bdf.c: a bdf file parsor
**
** Copyright (C) 2009 Feynman Software
** Copyright (C) 2009 FMSoft
**
** Author: WEI Yongming
**
......
/*
** Copyright (C) 2009 Feynman Software
** Copyright (C) 2009 FMSoft
** Author: WEI Yongming
** Create date: 2009/12/19
*/
......
/*
** Copyright (C) 2009 Feynman Software
** Copyright (C) 2009 FMSoft
** Author: WEI Yongming
** Create date: 2009/12/19
*/
......
/*
** Copyright (C) 2009 Feynman Software
** Copyright (C) 2009 FMSoft
** Author: WEI Yongming
** Create date: 2009/12/19
*/
......
......@@ -4,7 +4,7 @@
** varbitmap.h: the head file of raw bitmap font operation set.
**
** Copyright (C) 2000 ~ 2002, Wei Yongming.
** Copyright (C) 2003 ~ 2007 Feynman Software.
** Copyright (C) 2003 ~ 2007 FMSoft.
**
*/
......
......@@ -3,7 +3,7 @@
**
** vbfeditor.c: A VBF font editor.
**
** Copyright (C) 2003 Feynman Software.
** Copyright (C) 2003 FMSoft.
*/
/*
......
/*
** Copyright (C) 2003, Feynman Software.
** Copyright (C) 2003, FMSoft.
*/
#ifndef _DUMPBMP_H
......
......@@ -4,7 +4,7 @@
** vi: tabstop=4:expandtab
**
**
** Copyright (C) 2005 ~ 2008, Feynman Software.
** Copyright (C) 2005 ~ 2008, FMSoft.
**
** Create date: 2008/01/26 mgwang
*/
......
/*
** $Id: upf2c.c $
**
**
** vi: tabstop=4:expandtab
**
**
** Copyright (C) 2005 ~ 2008, Feynman Software.
** Copyright (C) 2005 ~ 2008, FMSoft.
**
** Create date: 2008/01/26
*/
......@@ -17,7 +17,7 @@ typedef unsigned char Uint8;
typedef char Sint8;
typedef unsigned int Uint32;
typedef struct
typedef struct
{
char font_name [LEN_UNIDEVFONT_NAME + 1];
......@@ -38,96 +38,100 @@ typedef struct
int main (int arg, char *argv[])
{
FILE * tab_file =NULL;
FILE * c_file =NULL;
unsigned int cha;
unsigned int n =0;
char upf_cfile[128],name[256]={0};
char *s;
if (arg < 3) {
fprintf (stderr, "Usage: upf2c <upffile> <name> [new_font_name]\n");
fprintf (stderr, "./upf2c unifont_160_50.upf unifont_160_50\n");
return 1;
}
strcpy(name, "__mgif_upf_");
FILE * font_file =NULL;
FILE * c_file =NULL;
unsigned int cha;
unsigned int n =0;
char upf_cfile[128],name[256]={0};
char *s;
if (arg < 3) {
fprintf (stderr, "Usage: upf2c <upffile> <name>\n");
fprintf (stderr, "./upf2c unifont_160_50.upf unifont_160_50\n");
return 1;
}
strcpy(name, "_incore_font_upf_");
strcat(name, argv[2]);
strcpy(upf_cfile, "upf_");
strcat(upf_cfile, argv[1]);
s = strrchr ((const char *)upf_cfile, '.');
if (s==NULL) {
printf ("Please specify the 'upf' file\n");
s = strrchr ((const char *)argv[1], '.');
if (s == NULL) {
printf ("Please specify a 'upf' file\n");
return 1;
}
*s ='\0';
sprintf (s, "%s", ".c");
font_file = fopen (argv[1], "rb");
if (font_file == NULL) {
printf ("Cant open the font file: %s\n", argv[1]);
return 2;
}
tab_file = fopen (argv[1], "rb");
strcpy(upf_cfile, argv[2]);
strcat(upf_cfile, ".c");
c_file = fopen (upf_cfile, "w");
if (c_file == NULL) {
printf ("Cant open the C file: %s\n", upf_cfile);
return 2;
}
if (tab_file == NULL) {
printf ("Cant open the table file!\n");
return 2;
}
c_file = fopen (upf_cfile, "w");
s = strrchr ((const char *)upf_cfile, '.');
*s ='\0';
fprintf (c_file, "/*\n");
fprintf (c_file, "** In-core UPF file for %s.\n", name);
fprintf (c_file, "**\n");
fprintf (c_file, "** This file is created by 'upf2c' by FMSoft (http://www.fmsoft.cn).\n");
fprintf (c_file, "** This file is created by 'upf2c'\n");
fprintf (c_file, "** Please do not modify it manually.\n");
fprintf (c_file, "**\n");
fprintf (c_file, "** Copyright (C) 2009 Feynman Software\n");
fprintf (c_file, "**\n");
fprintf (c_file, "** All right reserved by Feynman Software.\n");
fprintf (c_file, "**\n");
fprintf (c_file, "*/\n");
fprintf (c_file, "#include <stdio.h>\n");
fprintf (c_file, "#include <stdlib.h>\n");
fprintf (c_file, "\n");
fprintf (c_file, "#include \"common.h\"\n");
fprintf (c_file, "#include \"minigui.h\"\n");
fprintf (c_file, "#include \"gdi.h\"\n");
fprintf (c_file, "#include <minigui/common.h>\n");
fprintf (c_file, "#include <minigui/minigui.h>\n");
fprintf (c_file, "#include <minigui/gdi.h>\n");
fprintf (c_file, "\n");
fprintf (c_file, "#ifdef _MGFONT_UPF\n");
fprintf (c_file, "\n");
fprintf (c_file, "#include \"upf.h\"\n");
fprintf (c_file, "typedef struct\n");
fprintf (c_file, "{\n");
fprintf (c_file, " Uint8 width;\n");
fprintf (c_file, " Uint8 height;\n");
fprintf (c_file, " Sint8 ascent;\n");
fprintf (c_file, " Sint8 descent;\n");
fprintf (c_file, " Uint8 max_width;\n");
fprintf (c_file, " Uint8 underline_pos;\n");
fprintf (c_file, " Uint8 underline_width;\n");
fprintf (c_file, " Sint8 leading;\n");
fprintf (c_file, " Uint8 mono_bitmap;\n");
fprintf (c_file, " Uint8 reserved[3];\n");
fprintf (c_file, " void* root_dir;\n");
fprintf (c_file, " Uint32 file_size;\n");
fprintf (c_file, "} UPFINFO;\n");
fprintf (c_file, "\n");
fprintf (c_file, "static unsigned char %s[] = {\n", upf_cfile);
cha =0;
while (1) {
if (fread (&cha, 1, 1, tab_file)!=1) {
fprintf (c_file, "0x%02x", 0 );
break;
}
fprintf (c_file, "0x%02x", cha);
fprintf (c_file, ", ");
if (++n % 10 == 0)
fprintf (c_file, "\n");
cha =0;
}
fprintf (c_file, "};\n\n" );
fprintf (c_file,"UPFINFO %s = {\n", name);
fprintf (c_file, "static const unsigned char font_data[] = {\n");
cha =0;
while (1) {
if (fread (&cha, 1, 1, font_file)!=1) {
fprintf (c_file, "0x%02x", 0 );
break;
}
fprintf (c_file, "0x%02x", cha);
fprintf (c_file, ", ");
if (++n % 10 == 0)
fprintf (c_file, "\n");
cha =0;
}
fprintf (c_file, "};\n\n" );
fprintf (c_file,"const UPFINFO %s = {\n", name);
fprintf (c_file," 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0},\n");
fprintf (c_file," %s, \n sizeof (%s)\n", upf_cfile, upf_cfile);
fprintf (c_file," font_data, sizeof (font_data)\n");
fprintf (c_file,"};\n\n");
fprintf (c_file,"#endif /* _MGFONT_UPF */\n");
printf ("OK! translation is successful! there are %d bytes in the %s.c\n", n, upf_cfile);
fclose (tab_file);
fclose (c_file);
return 0;
printf ("OK! translation is successful! there are %d bytes in the %s.c\n", n, upf_cfile);
fclose (font_file);
fclose (c_file);
return 0;
}
......@@ -3,7 +3,7 @@
**
** vi: tabstop=4:expandtab
**
** Copyright (C) 2009, Feynman Software.
** Copyright (C) 2009, FMSoft.
**
** Create date: 2009/12/01 WEI Yongming
*/
......
......@@ -3,7 +3,7 @@
**
** vi: tabstop=4:expandtab
**
** Copyright (C) 2009, Feynman Software.
** Copyright (C) 2009, FMSoft.
**
** Create date: 2009/12/09 WEI Yongming
*/
......
......@@ -3,7 +3,7 @@
**
** vi: tabstop=4:expandtab
**
** Copyright (C) 2005 ~ 2009, Feynman Software.
** Copyright (C) 2005 ~ 2009, FMSoft.
**
** Create date: 2008/08/25 hejian
*/
......
......@@ -3,7 +3,7 @@
**
** vi: tabstop=4:expandtab
**
** Copyright (C) 2009, Feynman Software.
** Copyright (C) 2009, FMSoft.
**
** Create date: 2009/12/09 WEI Yongming
*/
......
......@@ -5,7 +5,7 @@
**
** vbf2c.c: Dump VBF font to in-core C file.
**
** Copyright (C) 2007, Feynman Software.
** Copyright (C) 2007, FMSoft.
**
** Create date: 2007/04/24
*/
......@@ -597,9 +597,9 @@ static void dumpVBF2C (const char* name, const VBFINFO* vbf_info, int len_bits)
printf ("** This file is created by 'vbf2c' by FMSoft (http://www.fmsoft.cn).\n");
printf ("** Please do not modify it manually.\n");
printf ("**\n");
printf ("** Copyright (C) 2007 Feynman Software\n");
printf ("** Copyright (C) 2007 FMSoft\n");
printf ("**\n");
printf ("** All right reserved by Feynman Software.\n");
printf ("** All right reserved by FMSoft.\n");
printf ("**\n");
printf ("*/\n");
......
......@@ -3,7 +3,7 @@
**
** vbfeditor.c: A VBF font editor.
**
** Copyright (C) 2003 Feynman Software.
** Copyright (C) 2003 FMSoft.
*/
/*
......
/*
** Copyright (C) 2003, Feynman Software.
** Copyright (C) 2003, FMSoft.
*/
#ifndef _DUMPBMP_H
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment