Might and Magic 6 7 8 and Heroes 3 FNT (font) File Generator for Multiple Languages (Python Script). It uses another small library of mine: BDF Parser
FntObject = FntGen(<FONT_FILE_PATH>)
Example:
FntObject = FntGen('example_fonts/bdf/unifont-9.0.06.bdf')
FntObject.setCharset(<CHARSET>)
Set charset. CHARSET
is a string
- All single-byte charsets are supported, typical example:
cp1252
(default value, for latin alphabet-based languages, e.g. en, fr, de, es, it)cp1251
(for Cyrillic script-based languages, e.g. ru)cp1250
(for Central European languages, e.g. cs, pl)
- For double-byte charsets (DBCS), only
gb2312
(zh_CN),gbk
(zh_CN),big5
(zh_TW),euc_jp
(ja),euc_kr
(ko) are supported
Example:
FntObject.setCharset('cp1252')
FntObject.setDecoration(<DECORATION>)
Set decoration. DECORATION
is a string, it can be: empty, shadow
, black
, or glow
Example:
FntObject.setDecoration('shadow')
FntObject.output(<FILE_NAME>, [PATH])
Output .fnt file(s). FILE_NAME
is a required string parameter, PATH
is an optional string parameter.
If there is any "<SIZE>
" in FILE_NAME
parameter, it will be replaced by the final font's actual size.
For single-byte charsets, a single .fnt file is generated.
For double-byte charsets (DBCS), it outputs multiple .fnt files. Each file name is followed by a hex representation of its corresponding high byte.
Examples:
FntObject.output('myfont', 'folder')
FntObject.output('myfont_<SIZE>_', 'folder2')
import fntgen as f
FntObject = f.FntGen('example_fonts/bdf/unifont-9.0.06.bdf')
FntObject.setCharset('cp1252').setDecoration('shadow').output('FONT', 'uni_cp1252')
FntObject.setCharset('gb2312').setDecoration('glow').output('DBCS_<SIZE>_', 'uni_gb2312')
(More combined examples: example.py)
- Example .bdf fonts:
- GNU Unifont (Wikipedia article; Homepage): Unicode font (intended to support "all" common languages)
- M+ FONTS (Wikipedia article; Homepage): Japanese font
- HanWangYanKai 王漢宗自由字型顏體 (Chinese Wikipedia article; download .ttf): Traditional Chinese font
- MingLiU 細明體: Traditional Chinese font
- SimSun 中易宋体: Simplified Chinese font
- STKaiti 华文楷体: Simplified Chinese font
- FZCKJW 方正粗楷简体: Simplified Chinese font
- FNT font file editors: 2 old, executable FNT file editors. Just an archive. Not written by me.
- otf2bdf: OpenType to BDF Converter. Just an archive. Not written by me.
- Python code is written by me (Tom CHEN) and is released under the MIT License.
- otf2bdf: see its page.
- FNT font file editors: fair use.
- Example .bdf fonts:
- GNU Unifont: GNU General Public License v2, by Roman Czyborra, Paul Hardy, part of the GNU Project
- M+ FONTS: a free license, designed by Coji Morishita
- HanWangYanKai 王漢宗自由字型顏體: GNU General Public License v2, by 王漢宗
- Other fonts are proprietary, and are used non-commercially and fairly