bdf2sfd

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

header.c (2110B)


      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-10-08
      8  *
      9  * bdf2sfd is released under the BSD 2-Clause license
     10  * See LICENSE file for details
     11  */
     12 
     13 #include <sys/time.h>
     14 #include <stdio.h>
     15 
     16 #include "header.h"
     17 
     18 void
     19 header(FILE *stream, struct fontinfo *font)
     20 {
     21 	struct timeval tv;
     22 	gettimeofday(&tv, NULL);
     23 
     24 	fprintf(stream, "SplineFontDB: 3.0\n");
     25 	fprintf(stream, "FontName: %s\n", font->psname);
     26 	fprintf(stream, "FullName: %s\n", font->name);
     27 	fprintf(stream, "FamilyName: %s\n", font->name);
     28 	fprintf(stream, "Weight: Medium\n");
     29 
     30 	if (font->copyright)
     31 		fprintf(stream, "Copyright: %s\n", font->copyright);
     32 
     33 	if (font->version)
     34 		fprintf(stream, "Version: %s\n", font->version);
     35 
     36 	fprintf(stream, "ItalicAngle: 0\n"
     37 			"UnderlinePosition: -100\n"
     38 			"UnderlineWidth: 40\n");
     39 	fprintf(stream, "Ascent: %i\n", font->ascent);
     40 	fprintf(stream, "Descent: %i\n", font->descent);
     41 	fprintf(stream, "LayerCount: 2\n"
     42 			"Layer: 0 0 \"Back\"  1\n"
     43 			"Layer: 1 0 \"Fore\"  0\n"
     44 			"FSType: 0\n"
     45 			"OS2Version: 0\n"
     46 			"OS2_WeightWidthSlopeOnly: 0\n"
     47 			"OS2_UseTypoMetrics: 0\n");
     48 	fprintf(stream, "CreationTime: %ld\n", tv.tv_sec);
     49 	fprintf(stream, "PfmFamily: 33\n"
     50 			"TTFWeight: 500\n"
     51 			"TTFWidth: 5\n"
     52 			"LineGap: 72\n"
     53 			"VLineGap: 0\n"
     54 			"Panose: 2 0 6 4 0 0 0 0 0 0\n"
     55 			"OS2TypoAscent: 0\n"
     56 			"OS2TypoAOffset: 1\n"
     57 			"OS2TypoDescent: 0\n"
     58 			"OS2TypoDOffset: 1\n"
     59 			"OS2TypoLinegap: 0\n"
     60 			"OS2WinAscent: 0\n"
     61 			"OS2WinAOffset: 1\n"
     62 			"OS2WinDescent: 0\n"
     63 			"OS2WinDOffset: 1\n"
     64 			"HheadAscent: 0\n"
     65 			"HheadAOffset: 1\n"
     66 			"HheadDescent: 0\n"
     67 			"HheadDOffset: 1\n"
     68 			"OS2Vendor: 'PfEd'\n"
     69 			"Encoding: UnicodeBmp\n"
     70 			"UnicodeInterp: none\n"
     71 			"DisplaySize: -24\n"
     72 			"AntiAlias: 0\n"
     73 			"FitToEm: 1\n"
     74 			"WinInfo: 64 16 4\n"
     75 			"TeXData: 1 0 0 346030 173015 115343 0 1048576 115343 "
     76 			"783286 444596 497025 792723 393216 433062 380633 "
     77 			"303038 157286 324010 404750 52429 2506097 1059062 "
     78 			"262144\n");
     79 	fprintf(stream, "BeginChars: 65536 %s\n\n", font->chars);
     80 }