bdf2sfd

BDF to SFD converter, allowing to vectorize bitmap fonts
Log | Files | Refs | README | LICENSE

parse.c (1079B)


      1 /*
      2  * bdf2sfd 1.1.5
      3  * Copyright (c) 2019-2020, Frederic Cambus
      4  * https://github.com/fcambus/bdf2sfd
      5  *
      6  * Created:      2019-11-21
      7  * Last Updated: 2020-02-08
      8  *
      9  * bdf2sfd is released under the BSD 2-Clause license
     10  * See LICENSE file for details
     11  */
     12 
     13 #include <string.h>
     14 #include "parse.h"
     15 
     16 int
     17 parseLine(char *lineBuffer) {
     18 	char *key = NULL;
     19 
     20 	if (*lineBuffer) {
     21 		key = strtok(lineBuffer, " \t\n");
     22 
     23 		if (key) {
     24 			if (!strcmp(key, "FAMILY_NAME"))
     25 				return FAMILY_NAME;
     26 
     27 			if (!strcmp(key, "COPYRIGHT"))
     28 				return COPYRIGHT;
     29 
     30 			if (!strcmp(key, "FONTBOUNDINGBOX"))
     31 				return FONTBOUNDINGBOX;
     32 
     33 			if (!strcmp(key, "FONT_ASCENT"))
     34 				return FONT_ASCENT;
     35 
     36 			if (!strcmp(key, "FONT_DESCENT"))
     37 				return FONT_DESCENT;
     38 
     39 			if (!strcmp(key, "FONT_VERSION"))
     40 				return FONT_VERSION;
     41 
     42 			if (!strcmp(key, "CHARS"))
     43 				return CHARS;
     44 
     45 			if (!strcmp(key, "STARTCHAR"))
     46 				return STARTCHAR;
     47 
     48 			if (!strcmp(key, "ENCODING"))
     49 				return ENCODING;
     50 
     51 			if (!strcmp(key, "BITMAP"))
     52 				return BITMAP;
     53 
     54 			if (!strcmp(key, "ENDCHAR"))
     55 				return ENDCHAR;
     56 		}
     57 	}
     58 
     59 	return 0;
     60 }