bdf2sfd

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

header.c (2654B)


      1 /*
      2  * bdf2sfd 1.1.3
      3  * Copyright (c) 2019-2020, Frederic Cambus
      4  * https://github.com/fcambus/bdf2sfd
      5  *
      6  * Created:      2019-11-21
      7  * Last Updated: 2020-03-30
      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 	fprintf(stream, "UnderlinePosition: -100\n");
     38 	fprintf(stream, "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 	fprintf(stream, "Layer: 0 0 \"Back\"  1\n");
     43 	fprintf(stream, "Layer: 1 0 \"Fore\"  0\n");
     44 	fprintf(stream, "FSType: 0\n");
     45 	fprintf(stream, "OS2Version: 0\n");
     46 	fprintf(stream, "OS2_WeightWidthSlopeOnly: 0\n");
     47 	fprintf(stream, "OS2_UseTypoMetrics: 0\n");
     48 	fprintf(stream, "CreationTime: %ld\n", tv.tv_sec);
     49 	fprintf(stream, "PfmFamily: 33\n");
     50 	fprintf(stream, "TTFWeight: 500\n");
     51 	fprintf(stream, "TTFWidth: 5\n");
     52 	fprintf(stream, "LineGap: 72\n");
     53 	fprintf(stream, "VLineGap: 0\n");
     54 	fprintf(stream, "Panose: 2 0 6 4 0 0 0 0 0 0\n");
     55 	fprintf(stream, "OS2TypoAscent: 0\n");
     56 	fprintf(stream, "OS2TypoAOffset: 1\n");
     57 	fprintf(stream, "OS2TypoDescent: 0\n");
     58 	fprintf(stream, "OS2TypoDOffset: 1\n");
     59 	fprintf(stream, "OS2TypoLinegap: 0\n");
     60 	fprintf(stream, "OS2WinAscent: 0\n");
     61 	fprintf(stream, "OS2WinAOffset: 1\n");
     62 	fprintf(stream, "OS2WinDescent: 0\n");
     63 	fprintf(stream, "OS2WinDOffset: 1\n");
     64 	fprintf(stream, "HheadAscent: 0\n");
     65 	fprintf(stream, "HheadAOffset: 1\n");
     66 	fprintf(stream, "HheadDescent: 0\n");
     67 	fprintf(stream, "HheadDOffset: 1\n");
     68 	fprintf(stream, "OS2Vendor: 'PfEd'\n");
     69 	fprintf(stream, "Encoding: UnicodeBmp\n");
     70 	fprintf(stream, "UnicodeInterp: none\n");
     71 	fprintf(stream, "DisplaySize: -24\n");
     72 	fprintf(stream, "AntiAlias: 0\n");
     73 	fprintf(stream, "FitToEm: 1\n");
     74 	fprintf(stream, "WinInfo: 64 16 4\n");
     75 	fprintf(stream, "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 }