cook-font
is a font file to C header converter.
Written in C++ 20, the source code tries to provide readability with speed and efficiency.
Currently this program supports reading files of only one syntax but more may be added later.
The constituion of this repository is the CONTRIBUTING.md.
cook-font --help
cook-font font.txt -o font.h
List of Flags
Flag | Purpose |
---|---|
-h OR --help |
Shows a help prompt with all the available flags |
-v OR --ver OR --version |
Shows the version number |
-o OR --output= |
Specify the output file name |
-q OR --quiet |
Suppress logs |
-Q OR --no-quiet |
Show Logs. Negate the effects of -q |
-p OR --cpu-i |
Generate Output which will be CPU/Processor Intensive to interpret and use. Not Yet Implemented |
-P OR --no-cpu-i |
Generate Output which will be memory intensive to use. Implemented and is the DEFAULT Output mode |
-d OR --font-desc |
to include the font comments after the "-" |
-D OR --no-font-d |
to exclude the font comments after the "-" DEFULT |
-c OR --char-info |
to include information about character index in the output header file |
-C OR --no-char-i |
to exclude information about character index in the output header file DEFAULT |
Any Other Arguement | Is interpreted as the input file |
- The program has its starting point in file the cook-font.cpp in the
int main(int argc, const char* argv[])
function. - inc/prefs.hpp and src/prefs.cpp contain
Preferences
class which defines and stores the user preferences. It has methods to set, clear and access them. - inc/fio.hpp has some basic IO macros.
- inc/version stores the version.
- inc/errMgr.hpp has the macro for error handling.
- src/translator has the core translation unit.
- src/translator_main.cpp has the font identification, macro creation units and calls translate_core internally.
The program currently reads files with the following syntax.
The extension or name does not matter but show have the following syntax.
- The file MUST have the following line as its FIRST LINE.
Some Valid examples are:
font-<font_width>x<font_height>-<font_type>
font-8x18-psf1
font-6x10-psf1
- The second line MUST start with
-
.-
also marks the start/end of a glyph and also acts as a comment. Some Examples:-
But this comment WILL BE IGNORED- This is a comment but will be written in the header
- Write 1's and 0's according to the width and height.
Will be valid for a font whose width is specified as 8 and height as 6, otherwise it is regarded as a syntax error. A Sample may be:
00011000 01100110 01100110 01111110 01100110 01100110 - This is an A ;)
font-8x6-psf1
-
00011000
01100110
01100110
01111110
01100110
01100110
- There will be many more glyphs
The tests are provided with the release as compressed files.