bdf2sfd

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

parse.c (1125B)


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