bdf2sfd

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

commit a1c2a042efc4362af1062de8e97622567bd12b41
parent 1811c9049d4eee05800c4b006274702ecde06df0
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon, 23 Dec 2019 15:51:16 +0100

Introduce and build a header() function to output an SFD header.

Diffstat:
MCMakeLists.txt | 2+-
Asrc/header.c | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/header.h | 18++++++++++++++++++
3 files changed, 85 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -26,7 +26,7 @@ check_function_exists(strtonum HAVE_STRTONUM) include_directories("compat") set(CMAKE_BUILD_TYPE Release) -set(SRC src/bdftosfd.c) +set(SRC src/bdftosfd.c src/header.c) if(NOT HAVE_PLEDGE) set (SRC ${SRC} compat/pledge.c) diff --git a/src/header.c b/src/header.c @@ -0,0 +1,66 @@ +/* + * bdftosfd + * Copyright (c) 2019, Frederic Cambus + * https://github.com/fcambus/bdftosfd + * + * Created: 2019-11-21 + * Last Updated: 2019-12-23 + * + * bdftosfd is released under the BSD 2-Clause license + * See LICENSE file for details + */ + +#include <stdio.h> + +void +header(FILE *stream, char *name, char *chars) +{ + fprintf(stream, "SplineFontDB: 3.0\n"); + fprintf(stream, "FontName: %s\n", name); + fprintf(stream, "FullName: %s\n", name); + fprintf(stream, "FamilyName: %s\n", name); + fprintf(stream, "Weight: Medium\n"); + fprintf(stream, "Version: 1.5.0\n"); + fprintf(stream, "ItalicAngle: 0\n"); + fprintf(stream, "UnderlinePosition: -100\n"); + fprintf(stream, "UnderlineWidth: 40\n"); + fprintf(stream, "Ascent: 768\n"); + fprintf(stream, "Descent: 256\n"); + fprintf(stream, "LayerCount: 2\n"); + fprintf(stream, "Layer: 0 0 \"Back\" 1\n"); + fprintf(stream, "Layer: 1 0 \"Fore\" 0\n"); + fprintf(stream, "FSType: 0\n"); + fprintf(stream, "OS2Version: 0\n"); + fprintf(stream, "OS2_WeightWidthSlopeOnly: 0\n"); + fprintf(stream, "OS2_UseTypoMetrics: 0\n"); + fprintf(stream, "CreationTime: 1575314000\n"); + fprintf(stream, "ModificationTime: 1575314000\n"); + fprintf(stream, "PfmFamily: 33\n"); + fprintf(stream, "TTFWeight: 500\n"); + fprintf(stream, "TTFWidth: 5\n"); + fprintf(stream, "LineGap: 72\n"); + fprintf(stream, "VLineGap: 0\n"); + fprintf(stream, "Panose: 2 0 6 4 0 0 0 0 0 0\n"); + fprintf(stream, "OS2TypoAscent: 0\n"); + fprintf(stream, "OS2TypoAOffset: 1\n"); + fprintf(stream, "OS2TypoDescent: 0\n"); + fprintf(stream, "OS2TypoDOffset: 1\n"); + fprintf(stream, "OS2TypoLinegap: 0\n"); + fprintf(stream, "OS2WinAscent: 0\n"); + fprintf(stream, "OS2WinAOffset: 1\n"); + fprintf(stream, "OS2WinDescent: 0\n"); + fprintf(stream, "OS2WinDOffset: 1\n"); + fprintf(stream, "HheadAscent: 0\n"); + fprintf(stream, "HheadAOffset: 1\n"); + fprintf(stream, "HheadDescent: 0\n"); + fprintf(stream, "HheadDOffset: 1\n"); + fprintf(stream, "OS2Vendor: 'PfEd'\n"); + fprintf(stream, "Encoding: UnicodeBmp\n"); + fprintf(stream, "UnicodeInterp: none\n"); + fprintf(stream, "DisplaySize: -24\n"); + fprintf(stream, "AntiAlias: 0\n"); + fprintf(stream, "FitToEm: 1\n"); + fprintf(stream, "WinInfo: 64 16 4\n"); + fprintf(stream, "TeXData: 1 0 0 346030 173015 115343 0 1048576 115343 783286 444596 497025 792723 393216 433062 380633 303038 157286 324010 404750 52429 2506097 1059062 262144\n"); + fprintf(stream, "BeginChars: 65536 %s\n\n", chars); +} diff --git a/src/header.h b/src/header.h @@ -0,0 +1,18 @@ +/* + * bdftosfd + * Copyright (c) 2019, Frederic Cambus + * https://github.com/fcambus/bdftosfd + * + * Created: 2019-11-21 + * Last Updated: 2019-12-23 + * + * bdftosfd is released under the BSD 2-Clause license + * See LICENSE file for details + */ + +#ifndef HEADER_H +#define HEADER_H + +void header(FILE *stream, char *name, char *chars); + +#endif /* HEADER_H */