bdf2sfd

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

header.c (2156B)


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