Mercurial > hg > dmlib
diff tools/fontconv.c @ 2408:60e119262c67
Option index re-ordering cleanup work.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 13 Jan 2020 21:21:25 +0200 |
parents | b7cd5dd0b82e |
children | bc05bcfc4598 |
line wrap: on
line diff
--- a/tools/fontconv.c Mon Jan 13 21:16:57 2020 +0200 +++ b/tools/fontconv.c Mon Jan 13 21:21:25 2020 +0200 @@ -24,33 +24,39 @@ static const DMOptArg optList[] = { - { 0, '?', "help", "Show this help", OPT_NONE }, - { 1, 'v', "verbose", "Be more verbose", OPT_NONE }, - { 2, 's', "size", "Set glyph dimensions (-s W:H or -s N) for image->font conversion", OPT_ARGREQ }, + { 0, '?', "help" , "Show this help", OPT_NONE }, + { 2, 'v', "verbose" , "Be more verbose", OPT_NONE }, + + { 10, 's', "size" , "Set glyph dimensions (-s W:H or -s N) for image->font conversion", OPT_ARGREQ }, #ifdef DM_GFX_TTF_TEXT - { 3, 'c', "color", "TTF font rendering color (def: 0xFFFFFF)", OPT_ARGREQ }, - { 4, 'b', "bpp", "Render font in 8 or 32 bits per pixel (default 32)", OPT_ARGREQ }, + { 12, 'c', "color" , "TTF font rendering color (def: 0xFFFFFF)", OPT_ARGREQ }, + { 14, 'b', "bpp" , "Render font in 8 or 32 bits per pixel (default 32)", OPT_ARGREQ }, #endif }; const int optListN = sizeof(optList) / sizeof(optList[0]); +void argShowHelp() +{ + dmPrintBanner(stdout, dmProgName, + "[options] <sourcefile.(ttf|fnt|dmf|png)> <outputfile.dmf>"); + + dmArgsPrintHelp(stdout, optList, optListN, 0, 80 - 2); + printf( + "\n" + "This utility can be used to convert TSFONT files to bitmap DMFONT (DMF)\n" + "files, render TrueType TTF to DMFONT at desired glyph resolution, or\n" + "cut a PNG (or JPEG) image to glyphs of desired size.\n"); +} + + BOOL argHandleOpt(const int optN, char *optArg, char *currArg) { switch (optN) { case 0: - dmPrintBanner(stdout, dmProgName, - "[options] <sourcefile.(ttf|fnt|dmf|png)> <outputfile.dmf>"); - - dmArgsPrintHelp(stdout, optList, optListN, 0, 80 - 2); - printf( - "\n" - "This utility can be used to convert TSFONT files to bitmap DMFONT (DMF)\n" - "files, render TrueType TTF to DMFONT at desired glyph resolution, or\n" - "cut a PNG (or JPEG) image to glyphs of desired size.\n"); - + argShowHelp(); exit(0); break; @@ -58,7 +64,7 @@ dmVerbosity++; break; - case 2: + case 10: { unsigned int fontW, fontH; char *sep = strchr(optArg, ':'); @@ -103,7 +109,7 @@ } break; - case 3: + case 12: { unsigned int colR, colG, colB, colA = 100; if (optArg[0] == '#' || optArg[0] == '$') optArg++; @@ -125,7 +131,7 @@ } break; - case 4: + case 14: if (sscanf(optArg, "%d", &optBPP) != 1) { dmErrorMsg("Invalid argument for -b option, '%s'.\n",