This is how I did it even if there can be other ways. I used these scripts with Archlinux, but they can work on many other operating systems as long as you have a recent version of
Fontforge and
Python (and
python-pip for Arch).
About pyftsubset
I failed to see who are its five authors and its maintainer. Anyway many thanks to them.
Here is some more information about its use. If I understand correctly, by default, it says that it preserves ligatures. As you can read in the attachment, it's quite an advanced tool.
First, if you do not have it yet,
Code:
sudo pip install fonttools
Then, prepare a work folder. We'll put here
- the ttf font (exported from the EPUB or downloaded from elsewhere), for example
STSong.ttf
- a UTF-8 txt file named for example
china.txt containing the characters (here Chinese) you wish to include in the subset. These characters can easily be copied for example from the last line of the Characters tab of the Calibre Editor
reports tool.
To create the subset, just use this command
Code:
pyftsubset STSong.ttf --text-file=china.txt
It will create a subsetted font "STSong.subset.ttf" (12.9 k) with which you can replace the original one.
This way of creating a subset seems quite useful, for example if you have a book containing some words or expressions in some exotic language.
About ReadifyFont
Many thanks to Sherman Perry. Note that the GUI has been made clearer. You will find it here:
I used the GUI provided with the script. I could darken and generate ttf for a family of four fonts. The GUI was started with this command.
Code:
fontforge -script ReadifyFontGUI.py
Quote:
note that to add multiple font files, you have to add them at the same time (the file chooser dialog allows multiple selection). The current system is designed that if you click the load button again, it assumes you want to load a a new font family.
|