GithubHelp home page GithubHelp logo

bkmgit / mkttf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tblue/mkttf

0.0 0.0 0.0 81 KB

Scripts to generate TTF files from BDF source files

License: BSD 3-Clause "New" or "Revised" License

Shell 43.57% Python 56.43%

mkttf's Introduction

mkttf: BDF to TTF conversion

The mkttf.py script converts a set of BDF files into a TTF file, automatically generating the required scalable outlines (actually, any font format supported by FontForge is accepted). Call it with the -h option for usage help.

The mkttf.sh script generates medium (normal), bold and italic versions of the Terminus font. It will create three directories ("Normal", "Bold" and "Italic") in the current working directory.

To use mktff.py, you need the following tools installed in your PATH:

  • FontForge: This tool and its Python extension enable me to modify the font using Python. You need a version that has Python support enabled (i. e. provides a Python extension).
  • Potrace: To generate the scalable outlines.
  • A recent version of Python. Whether you have to choose Python 2 or Python 3 depends on how your version of FontForge was built: FontForge can either be built with support for Python 2 or with support for Python 3. mkttf.py supports both versions.

To use mkttf.sh, you additionally need the following programs in your path:

  • Obviously, you need a POSIX-compliant shell.
  • mkitalic: To generate the italic font.

The mkttf.sh script takes two mandatory arguments:

  1. The directory containing the Terminus BDF files. The italic versions of the BDF files will be placed there.
  2. The font version which will be included in the file names of the generated files and in the font files themselves (so it can be e. g. shown to the user).

All other arguments are passed directly to mkttf.py.

Additionally to generating TTF fonts, the script will also generate an SFD file (FontForge's native file format) for each font weight so that the generated fonts can be easily modified, if necessary.

If you want to generate TTF versions of other fonts, you should only need to modify mkttf.sh -- the mkttf.py script is completely generic.

Have fun!

Generating TTF fonts for Windows

Windows, and native Windows programs like Visual Studio, will only use the bitmaps embedded in the TTF fonts generated by mkttf if certain Hiragana characters are present in the fonts (for full details, see Raster fonts in Visual Studio 2010).

mkttf can ensure that those Hiragana characters are present in the generated fonts. To enable this feature, pass the --visual-studio-fixes (or just -s) option to your invocations of mkttf.sh or mkttf.py.

Caveat: mkttf will not add real Hiragana glyphs to the font! Instead, it will try to add a fake glyph for every required Hiragana character that is missing from the font to fool Windows into thinking that the font is an Asian font for which bitmaps should be used.

In detail, mkttf will ensure that glyphs for the following Hiragana characters are present:

For missing Hiragana characters, mkttf will simply re-use the glyph for another character from the font; it will use the first character from the following list that exists in the font:

Doing this has one big drawback: For the above Hiragana characters, the "fake" glyphs will be used instead of real Hiragana glyphs from another suitable font -- i. e. falling back to another font will not work, and those characters will not be displayed correctly. This of course is an issue if you actually need those Hiragana characters to display correctly, so you cannot use this mkttf feature in that case.

mkttf's People

Contributors

tblue avatar hexchain avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.