README.md (3510B)
1 # bdf2sfd 2 3 bdf2sfd is a [BDF][1] to [SFD][2] converter, allowing to vectorize bitmap 4 fonts. It works by converting each pixel of a glyph to a polygon, which 5 produces large and unoptimized SFD files that should be post-processed 6 using [FontForge][3]. 7 8 There are several reasons why it might be desirable to convert bitmap 9 fonts to OpenType or TrueType versions. This allow for example to use them 10 as Web fonts, or simply to keep using them in some terminal emulators, 11 since Pango 1.44 dropped support for bitmap fonts. 12 13 It was originally created to generate OpenType versions of [Spleen][4], and 14 is released in the hope it can be useful to convert other fonts as well. 15 Please be aware that it works best on fonts proportional to 8x16. Other 16 sizes will work but the aspect ratio will not be preserved. There is 17 currently little interest in addressing the issue. 18 19 bdf2sfd is written with security in mind and is running sandboxed on OpenBSD 20 (using pledge). Experimental seccomp support is available for selected 21 architectures and can be enabled by setting the `ENABLE_SECCOMP` variable 22 to `1` when invoking CMake. It has also been extensively fuzzed using AFL 23 and Honggfuzz. 24 25 ## Dependencies 26 27 bdf2sfd uses the `CMake` build system and does not requires any external 28 dependencies. 29 30 mkdir build 31 cd build 32 cmake .. 33 make 34 35 bdf2sfd has been successfully built and tested on OpenBSD, NetBSD, FreeBSD, 36 and Linux with both Clang and GCC. 37 38 ## Packages 39 40 Packages are available for the following operating systems: 41 42 - [OpenBSD][5] 43 - [NetBSD][6] 44 - [FreeBSD][7] 45 - [Void Linux][8] 46 - [Debian][9] 47 - [Ubuntu][10] 48 - [Nix][11] 49 50 ## Usage 51 52 bdf2sfd [-hv] [-f name] [-p name] font.bdf 53 54 If file is a single dash (`-'), bdf2sfd reads from the standard input. 55 56 The options are as follows: 57 58 -f name Specify font name. 59 -p name Specify PostScript font name. 60 -h Display usage. 61 -v Display version. 62 63 bdf2sfd outputs SFD data to **stdout**. 64 65 ### Post-processing 66 67 The SFD files created by bdf2sfd should be post-processed with FontForge 68 in order to remove overlap and simplify shapes. 69 70 This can be done as follow: 71 72 ``` 73 fontforge -lang ff -c 'Open("spleen.sfd"); SelectAll(); RemoveOverlap(); Simplify(-1, 1); Save("spleen.sfd")' 74 ``` 75 76 ### Producing OTF and TTF fonts 77 78 After post-processing, OpenType and/or TrueType fonts can be produced as follow: 79 80 For OTF fonts: 81 82 ``` 83 fontforge -lang ff -c 'Open("spleen.sfd"); Generate("spleen.otf")' 84 ``` 85 86 For TTF fonts: 87 88 ``` 89 fontforge -lang ff -c 'Open("spleen.sfd"); Generate("spleen.ttf")' 90 ``` 91 92 ## License 93 94 bdf2sfd is released under the BSD 2-Clause license. See `LICENSE` file for 95 details. 96 97 ## Author 98 99 bdf2sfd is developed by Frederic Cambus. 100 101 - Site: https://www.cambus.net 102 103 ## Resources 104 105 GitHub: https://github.com/fcambus/bdf2sfd 106 107 [1]: https://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format 108 [2]: https://fontforge.org/en-US/documentation/developers/sfdformat/ 109 [3]: https://fontforge.org 110 [4]: https://github.com/fcambus/spleen 111 [5]: https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/converters/bdf2sfd 112 [6]: https://pkgsrc.se/converters/bdf2sfd 113 [7]: https://www.freshports.org/x11-fonts/bdf2sfd 114 [8]: https://github.com/void-linux/void-packages/tree/master/srcpkgs/bdf2sfd 115 [9]: https://packages.debian.org/search?keywords=bdf2sfd 116 [10]: https://packages.ubuntu.com/bdf2sfd 117 [11]: https://github.com/NixOS/nixpkgs/tree/master/pkgs/tools/misc/bdf2sfd 118 119 ## Packaging status 120 121 [](https://repology.org/project/bdf2sfd/versions)