fonts/Makefile
Each object depends only on the corresponding source. It means that header modifications wouldn't trigger recompilation. You may fix it by explicitly spelling out dependencies:
whimsy.o: whimsy.c whimsy.h core.hIn general it is a good habit to have dependencies auto generated: even in your not very complicated case it is easy to miss the
core.hdependency. Take a look at-Mfamily ofgccoptions.include/whimsy.h
Do not define objects (like
struct font whimsy) in the header file. You never know how many times the client would happen to#include "whimsy.h"in different places of their project. Better practice is to have the definition in the.cfile, and declare it in the header asextern struct font whimsy;DRY?
Unfortunately, you didn't show your font file. Also, I'm 95% sure thatthe
initandprintfiles are identical modulo font name. If I'm correct, you need to unify them, and have the unified version incore.c.Allocation
Allocating glyphs dynamically and copying them from a static area looks like a waste for me (it would make sense should you read glyphs from the text file instead). I would have a
struct glyph { int width; char * appearance; };(strictly speaking,
glyph.widthis redundant: given a font height and appearance length you may calculate width at runtime); an array of glyphs as a part ofstruct font:struct font { .... struct glyph typeface[128]; .... }and a static initialization of each font like
static struct font whimsy = { .... .typeface = { .... ['a'] = (struct glyph) { .width = 10, .appearance = " " " " " " " d888b8b " "d8P' ?88 " "88b ,88b " "`?88P'`88b" " " " " " "; }, .... }, .... };Beware that such partial array initialization is a gcc extension.
More abstraction
Now you may take advantage of
appearancebeing default initialized to anNULL, and conclude that such glyph is not implemented. Anallowedmethod becomes a trivial test, and is easily abstracted out of the font specifics.
fonts/Makefile
Each object depends only on the corresponding source. It means that header modifications wouldn't trigger recompilation. You may fix it by explicitly spelling out dependencies:
whimsy.o: whimsy.c whimsy.h core.hIn general it is a good habit to have dependencies auto generated: even in your not very complicated case it is easy to miss the
core.hdependency. Take a look at-Mfamily ofgccoptions.include/whimsy.h
Do not define objects (like
struct font whimsy) in the header file. You never know how many times the client would happen to#include "whimsy.h"in different places of their project. Better practice is to have the definition in the.cfile, and declare it in the header asextern struct font whimsy;DRY?
Unfortunately you didn't show your font file. Also, I'm 95% sure that
initandprintfiles are identical modulo font name. If I'm correct, you need to unify them, and have the unified version incore.c.Allocation
Allocating glyphs dynamically and copying them from a static area looks like a waste for me (it would make sense should you read glyphs from the text file instead). I would have a
struct glyph { int width; char * appearance; };(strictly speaking,
glyph.widthis redundant: given a font height and appearance length you may calculate width at runtime); an array of glyphs as a part ofstruct font:struct font { .... struct glyph typeface[128]; .... }and a static initialization of each font like
static struct font whimsy = { .... .typeface = { .... ['a'] = (struct glyph) { .width = 10, .appearance = " " " " " " " d888b8b " "d8P' ?88 " "88b ,88b " "`?88P'`88b" " " " " " "; }, .... }, .... };Beware that such partial array initialization is a gcc extension.
More abstraction
Now you may take advantage of
appearancebeing default initialized to anNULL, and conclude that such glyph is not implemented. Anallowedmethod becomes a trivial test, and is easily abstracted out of the font specifics.
fonts/Makefile
Each object depends only on the corresponding source. It means that header modifications wouldn't trigger recompilation. You may fix it by explicitly spelling out dependencies:
whimsy.o: whimsy.c whimsy.h core.hIn general it is a good habit to have dependencies auto generated: even in your not very complicated case it is easy to miss the
core.hdependency. Take a look at-Mfamily ofgccoptions.include/whimsy.h
Do not define objects (like
struct font whimsy) in the header file. You never know how many times the client would happen to#include "whimsy.h"in different places of their project. Better practice is to have the definition in the.cfile, and declare it in the header asextern struct font whimsy;DRY?
Unfortunately, you didn't show your font file. Also, I'm 95% sure the
initandprintfiles are identical modulo font name. If I'm correct, you need to unify them, and have the unified version incore.c.Allocation
Allocating glyphs dynamically and copying them from a static area looks like a waste for me (it would make sense should you read glyphs from the text file instead). I would have a
struct glyph { int width; char * appearance; };(strictly speaking,
glyph.widthis redundant: given a font height and appearance length you may calculate width at runtime); an array of glyphs as a part ofstruct font:struct font { .... struct glyph typeface[128]; .... }and a static initialization of each font like
static struct font whimsy = { .... .typeface = { .... ['a'] = (struct glyph) { .width = 10, .appearance = " " " " " " " d888b8b " "d8P' ?88 " "88b ,88b " "`?88P'`88b" " " " " " "; }, .... }, .... };Beware that such partial array initialization is a gcc extension.
More abstraction
Now you may take advantage of
appearancebeing default initialized to anNULL, and conclude that such glyph is not implemented. Anallowedmethod becomes a trivial test, and is easily abstracted out of the font specifics.
fonts/Makefile
Each object depends only on the corresponding source. It means that header modifications wouldn't trigger recompilation. You may fix it by explicitly spelling out dependencies:
whimsy.o: whimsy.c whimsy.h core.hIn general it is a good habit to have dependencies auto generated: even in your not very complicated case it is easy to miss the
core.hdependency. Take a look at-Mfamily ofgccoptions.include/whimsy.h
Do not define objects (like
struct font whimsy) in the header file. You never know how many times the client would happen to#include "whimsy.h"in different places of their project. Better practice is to have the definition in the.cfile, and declare it in the header asextern struct font whimsy;DRY?
Unfortunately you didn't show your another font file. I amAlso, I'm 95% sure that
initandprintfiles are identical modulo font name. If I amI'm correct, you need to unify them, and have the unified version incore.c.Allocation
Allocating glyphs dynamically and copying them from a static area looks like a waste for me (it would make sense should you read glyphs from the text file instead). I would have a
struct glyph { int width; char * appearance; };(strictly speaking,
glyph.widthis redundant: given a font height and appearance length you may calculate width at runtime); an array of glyphs as a part ofstruct font:struct font { .... struct glyph typeface[128]; .... }and a static initialization of each font like
static struct font whimsy = { .... .typeface = { .... ['a'] = (struct glyph) { .width = 10, .appearance = " " " " " " " d888b8b " "d8P' ?88 " "88b ,88b " "`?88P'`88b" " " " " " "; }, .... }, .... };Beware that such partial array initialization is a gcc extension.
More abstraction
Now you may take advantage of
appearancebeing default initialized to anNULL, and conclude that such glyph is not implemented. Anallowedmethod becomes a trivial test, and is easily abstracted out of the font specifics.
fonts/Makefile
Each object depends only on the corresponding source. It means that header modifications wouldn't trigger recompilation. You may fix it by explicitly spelling out dependencies:
whimsy.o: whimsy.c whimsy.h core.hIn general it is a good habit to have dependencies auto generated: even in your not very complicated case it is easy to miss the
core.hdependency. Take a look at-Mfamily ofgccoptions.include/whimsy.h
Do not define objects (like
struct font whimsy) in the header file. You never know how many times the client would happen to#include "whimsy.h"in different places of their project. Better practice is to have the definition in the.cfile, and declare it in the header asextern struct font whimsy;DRY?
Unfortunately you didn't show your another font file. I am 95% sure that
initandprintfiles are identical modulo font name. If I am correct, you need to unify them, and have the unified version incore.c.Allocation
Allocating glyphs dynamically and copying them from a static area looks like a waste for me (it would make sense should you read glyphs from the text file instead). I would have a
struct glyph { int width; char * appearance; };(strictly speaking,
glyph.widthis redundant: given a font height and appearance length you may calculate width at runtime); an array of glyphs as a part ofstruct font:struct font { .... struct glyph typeface[128]; .... }and a static initialization of each font like
static struct font whimsy = { .... .typeface = { .... ['a'] = (struct glyph) { .width = 10, .appearance = " " " " " " " d888b8b " "d8P' ?88 " "88b ,88b " "`?88P'`88b" " " " " " "; }, .... }, .... };Beware that such partial array initialization is a gcc extension.
More abstraction
Now you may take advantage of
appearancebeing default initialized to anNULL, and conclude that such glyph is not implemented. Anallowedmethod becomes a trivial test, and is easily abstracted out of the font specifics.
fonts/Makefile
Each object depends only on the corresponding source. It means that header modifications wouldn't trigger recompilation. You may fix it by explicitly spelling out dependencies:
whimsy.o: whimsy.c whimsy.h core.hIn general it is a good habit to have dependencies auto generated: even in your not very complicated case it is easy to miss the
core.hdependency. Take a look at-Mfamily ofgccoptions.include/whimsy.h
Do not define objects (like
struct font whimsy) in the header file. You never know how many times the client would happen to#include "whimsy.h"in different places of their project. Better practice is to have the definition in the.cfile, and declare it in the header asextern struct font whimsy;DRY?
Unfortunately you didn't show your font file. Also, I'm 95% sure that
initandprintfiles are identical modulo font name. If I'm correct, you need to unify them, and have the unified version incore.c.Allocation
Allocating glyphs dynamically and copying them from a static area looks like a waste for me (it would make sense should you read glyphs from the text file instead). I would have a
struct glyph { int width; char * appearance; };(strictly speaking,
glyph.widthis redundant: given a font height and appearance length you may calculate width at runtime); an array of glyphs as a part ofstruct font:struct font { .... struct glyph typeface[128]; .... }and a static initialization of each font like
static struct font whimsy = { .... .typeface = { .... ['a'] = (struct glyph) { .width = 10, .appearance = " " " " " " " d888b8b " "d8P' ?88 " "88b ,88b " "`?88P'`88b" " " " " " "; }, .... }, .... };Beware that such partial array initialization is a gcc extension.
More abstraction
Now you may take advantage of
appearancebeing default initialized to anNULL, and conclude that such glyph is not implemented. Anallowedmethod becomes a trivial test, and is easily abstracted out of the font specifics.
fonts/Makefile
Each object depends only on the corresponding source. It means that header modifications wouldn't trigger recompilation. You may fix it by explicitly spelling out dependencies:
whimsy.o: whimsy.c whimsy.h core.hIn general it is a good habit to have dependencies auto generated: even in your not very complicated case it is easy to miss the
core.hdependency. Take a look at-Mfamily ofgccoptions.include/whimsy.h
Do not define objects (like
struct font whimsy) in the header file. You never know how many times the client would happen to#include "whimsy.h"in different places of their project. Better practice is to have the definition in the.cfile, and declare it in the header asextern struct font whimsy;DRY?
Unfortunately you didn't show your another font file. I am 95% sure that
initandprintfiles are identical modulo font name. If I am correct, you need to unify them, and have the unified version incore.c.Allocation
Allocating glyphs dynamically and copying them from a static area looks like a waste for me (it would make sense should you read glyphs from the text file instead). I would have a
struct glyph { int width; char * appearance; };(strictly speaking,
glyph.widthis redundant: given a font height and appearance length you may calculate width at runtime); an array of glyphs as a part ofstruct font:struct font { .... struct glyph typeface[128]; .... }and a static initialization of each font like
static struct font whimsy = { .... .typeface = { .... ['a'] = (struct glyph) { .width = 10, .appearance = " " " " " " " d888b8b " "d8P' ?88 " "88b ,88b " "`?88P'`88b" " " " " " "; }, .... }, .... };Beware that such partial array initialization is a gcc extension.
More abstraction
Now you may take advantage of
appearancebeing default initialized to anNULL, and conclude that such glyph is not implemented. Anallowedmethod becomes a trivial test, and is easily abstracted out of the font specifics.
fonts/Makefile
Each object depends only on the corresponding source. It means that header modifications wouldn't trigger recompilation. You may fix it by explicitly spelling out dependencies:
whimsy.o: whimsy.c whimsy.h core.hIn general it is a good habit to have dependencies auto generated: even in your not very complicated case it is easy to miss the
core.hdependency. Take a look at-Mfamily ofgccoptions.include/whimsy.h
Do not define objects (like
struct font whimsy) in the header file. You never know how many times the client would happen to#include "whimsy.h"in different places of their project. Better practice is to have the definition in the.cfile, and declare it in the header asextern struct font whimsy;DRY?
Unfortunately you didn't show your another font file. I am 95% sure that
initandprintfiles are identical modulo font name. If I am correct, you need to unify them, and have the unified version incore.c.Allocation
Allocating glyphs dynamically and copying them from a static area looks like a waste for me. I would have a
struct glyph { int width; char * appearance; };(strictly speaking,
glyph.widthis redundant: given a font height and appearance length you may calculate width at runtime); an array of glyphs as a part ofstruct font:struct font { .... struct glyph typeface[128]; .... }and a static initialization of each font like
static struct font whimsy = { .... .typeface = { .... ['a'] = (struct glyph) { .width = 10, .appearance = " " " " " " " d888b8b " "d8P' ?88 " "88b ,88b " "`?88P'`88b" " " " " " "; }, .... }, .... };Beware that such partial array initialization is a gcc extension.
More abstraction
Now you may take advantage of
appearancebeing default initialized to anNULL, and conclude that such glyph is not implemented. Anallowedmethod becomes a trivial test, and is easily abstracted out of the font specifics.
fonts/Makefile
Each object depends only on the corresponding source. It means that header modifications wouldn't trigger recompilation. You may fix it by explicitly spelling out dependencies:
whimsy.o: whimsy.c whimsy.h core.hIn general it is a good habit to have dependencies auto generated: even in your not very complicated case it is easy to miss the
core.hdependency. Take a look at-Mfamily ofgccoptions.include/whimsy.h
Do not define objects (like
struct font whimsy) in the header file. You never know how many times the client would happen to#include "whimsy.h"in different places of their project. Better practice is to have the definition in the.cfile, and declare it in the header asextern struct font whimsy;DRY?
Unfortunately you didn't show your another font file. I am 95% sure that
initandprintfiles are identical modulo font name. If I am correct, you need to unify them, and have the unified version incore.c.Allocation
Allocating glyphs dynamically and copying them from a static area looks like a waste for me (it would make sense should you read glyphs from the text file instead). I would have a
struct glyph { int width; char * appearance; };(strictly speaking,
glyph.widthis redundant: given a font height and appearance length you may calculate width at runtime); an array of glyphs as a part ofstruct font:struct font { .... struct glyph typeface[128]; .... }and a static initialization of each font like
static struct font whimsy = { .... .typeface = { .... ['a'] = (struct glyph) { .width = 10, .appearance = " " " " " " " d888b8b " "d8P' ?88 " "88b ,88b " "`?88P'`88b" " " " " " "; }, .... }, .... };Beware that such partial array initialization is a gcc extension.
More abstraction
Now you may take advantage of
appearancebeing default initialized to anNULL, and conclude that such glyph is not implemented. Anallowedmethod becomes a trivial test, and is easily abstracted out of the font specifics.