richard@stardate.bc.ca escribió:
Hi Mariano; A minor change.
void GrDumpFont(GrFont *f,char *CsymbolName,char *fileName);
write a font to file like C code, so it can be linked with a user program.
Should be..... writes a font to a C source code file, so it can be compiled and linked with a user program.
Thanks
I had to try the function to see what it produced. Could I suggest a small addendum because the why of using this function may not be very apparent to some people.
/* start proposed addendum */
GrDumpFont would not normally be used in a release program because its purpose is to produce source code. When the source code is compiled and linked into a program distributing the font file with the program in not necessary, avoiding the possibility of the font file being deleted or corrupted.
usage
int main( void ) { GrFont *font_foo; font_foo = GrLoadFont ( "helv15" ); GrDumpFont( font_foo, "helv15", "helv15.c" ); return 0; }
/* end proposed addendum */
OK, but I think it will be better to point to the fnt2c.c test progran, that do exactly that, and next make a example about how to use the generated code:
--- GrDumpFont would not normally be used in a release program because its purpose is to produce source code. When the source code is compiled and linked into a program distributing the font file with the program in not necessary, avoiding the possibility of the font file being deleted or corrupted.
You can use the premade "fnt2c.c" program (see the source, it's so simple) to dump a selected font to source code, by example:
"fnt2c helv15 myhelv15 nyhelv15.c"
Next, if this line is included in your main include file:
extern GrFont myhelv15
and "myhelv15.c" compiled and linked with your project, you can use 'myhelv15' in every place a 'GrFont' is required. ----
What do you think?
M.Alvarez