ttfm.sh(1)

NAME
ttfm.sh - TrueType Font Manager

SYNOPSIS
ttfm.sh command [ module ] [ font1 font2 ... ]

DESCRIPTION
TTFM (TrueType Font Manager) consists of a TrueType font parser, and several modules that help managing TrueType fonts in various applications. Users can then use ttfm.sh (which will call those modules), to execute simple commands like font adding, removing, list, and so on.

command can be one of the followings:

--add
    Add fonts. The command accepts multiple fonts specied by the font's filename.

--initm
    Initial selected modules. (Deprecated)

--list
    List installed fonts. No font arguments are needed.

--modules
    List all avaiable modules. No font arguments are needed.

--remove
    Remove installed fonts. Accepts multiple fonts.

--setdefault
    Set the following font as the default font(Ming). Only one font argument is allowed.

--setdefault_kai
    Set the following font as default font(Kai). Only one font argument is allowed.

AVAIABLE MODULES
Currently these modules are available:

abiword
    For AbiWord 0.7.12 and above. It depends on modules of both XFree86 and Ghostscript.

chitex
    For ChiTeX, a TeX/LaTeX environment that can handle both BIG5 and GB encodings. Broken in FreeBSD.

ghostscript6
    For Aladdin Ghostscript 6.50. It can manage TrueType fonts and CID fonts(limited functionalities). Ghostscript must be patched to use TrueType fonts. See the following for more details.

ttf2pk
    Generate pk (packed raster) and tfm (TeX font metrics) files from TrueType fonts. These files can then be used in the CJK LaTeX environment. Broken under FreeBSD.

xfreetype
    For XFree86's freetype backend, which is Xfsft in 3.x, and freetype module in 4.x.

xttfm-tcl
    For XFree86 3.3.x X-TrueType server. Written in TCL.

xttfm
    For XFree86 X-TrueType server, both 3.3.x or 4.x. Bourne shell script.

EXAMPLES

ttfm.sh --modules
    List all available modules in system.

ttfm.sh --add xttfm <path>/*.[TtTtCcFf]
    Install all TrueType fonts in <path>, using xttfm module.

ttfm.sh --setdefault xttfm <path>/good_ming.ttf
    Set <path>/good_ming.ttf as xttfm module's default font(Ming).

ttfm.sh --setdefault_kai xttfm <path>/good_kai.ttf
    Set <path>/good_kai.ttf as xttfm module's default font(Kai).

ttfm.sh --list xttfm
    List all fonts installed by xttfm.ttfm module.

ttfm.sh --remove xttfm.ttfm bkai00mp.ttf
    Remove bkai00mp.ttf(from the above list), installed by xttfm.ttfm.

ttfm.sh --add ghostscript6 /somewhere/bsmi00lp.ttf
    Install /somewhere/bsmi00lp.ttf in Ghostscript, using ghostscript6 module.

ttfm.sh --remove ghostscript6 bsmi00lp.ttf
    Remove bsmi00lp.ttf, using ghostscript6 module.

ttfm.sh --remove ghostscript6 ArphicMingB5-Regular
    Remove ArphicMingB5-Regular(which is equivalent to bsmi00lp.ttf above, obtained from "ttfm.sh --list ghostscript6"), using ghostscript6 module.

ttfm.sh --add abiword /WIN98/FONTS/MINGLIU.TTC
    Install Windows 98's MINGLIU.TTC high quality font for AbiWord. This has the chain effect that MINGLIU.TTC will be also installed by xttfm and ghostscript6 modules, since a fully CJK functioning AbiWord needs both XFree86 and Ghostscript support. See the following for additional details.

ttfm.sh --setdefault abiword /WIN98/FONTS/MINGLIU.TTC
    Set MINGLIU.TTC as AbiWord's default font(Ming). This also has the chain effect that MINGLIU.TTC will be also set as xttfm and ghostscript6 modules' default fonts(Ming). See the following for additional details.

ttfm.sh --add <path>/*.ttf
    Install <path>/*.ttf, using every module. However, usages like "--add *.ttf" and "--remove *.ttf" are reserved only for backward compatibility. Since the dependency between modules will become more complex, whether "--add *.ttf" has chain effects totally depends on individual applications. It's strongly suggested that users specify which module to invoke explicitly, rather than doing a global installation/removal.

HOW TO WRITE A TTFM MODULE
It's straightforward to make a new TTFM module. A TTFM module can be in any format, ie. it could be a shell or Perl or Python script, a C program, or even an Assembly if you like. Any program is a TTFM module as long as it accepts the following arguments:

    --add [font ...]
    --list
    --remove [font ...]
    --setdefault [font]
    --setdefault_kai [font]

The meanings should be clear by their names, and the above "DESCRIPTION" section. The ttfm.sh will call a TTFM module in only one of these forms.

Note that there's no font format involved in this requirement, meaning that a TTFM module can have nothing to do with TrueType at all. For example, an independent VFGhostscript's bdf manager can be used as a TTFM module, once it accepts the above arguments(maybe as it own arguments' subset).

If a TTFM module tries to get information from a TrueType font, then ttfinfo(1) should be used. Although it lacks some advanced features, like CJK entries, it's far better than most programs.

SEE ALSO

AbiWord's CJK support:
    http://www.hj.webprovider.com/develope/index.html, and
    http://www.abisource.com/mailinglists/abiword-dev/00/October/0398.html

Adobe Technical Notes:
    http://partners.adobe.com/asn/developer/technotes.html.
    This page contains many excellent technical notes, specifications, supplements, and errata for Adobe's font technology.

ChiTeX
    http://www.math.ncu.edu.tw/yih/

cwTeX
    http://ceiba.cc.ntu.edu.tw/tmwu/index.htm

Ghostscript 6's TrueType patch:
    http://www.aihara.co.jp/~taiji/tops/

VFlib:
    http://TypeHack.aial.hiroshima-u.ac.jp/VFlib/

X-TrueType(For XFree86 3.3.x):
    http://X-TT.dsl.gr.jp

Xatm(For CID fonts used in X 3.3.x):
    http://www.netlab.is.tsukuba.ac.jp/~yokota/izumi/Xatm/xatm_e.html

XFree86 4.x:
    See xc/programs/Xserver/hw/xfree86/doc/README.fonts.
    It contains comprehensive instructions on how to install TrueType fonts for X-TT & X-FreeType backend, and CID fonts under XFree86 4.x.

TODO
About modules(in the order of precedence):

vfghostscript55.ttfm
    For VFlib + Ghostscript 5.5.

Fix chitex.ttfm and ttf2pk.ttfm under FreeBSD.
    It means making a FreeBSD port of ChiTeX, and modifying existing CJK port. It's also possible that ChiTeX, CJK, cwTeX can all co-exist.

cwtex.ttfm
    For cwTeX, a BIG5 TeX/LaTeX system of ultra-high quality.

xcid.ttfm
    Handling CID fonts under XFree86, which is Xatm in 3.3.x, built-in in 4.x.

Clearer relationship between modules
    With more and more modules, dependencies between modules will become a problem. For example, which actions have chain effects (like AbiWord) should be clarified.

About ttfinfo(also in the order of precedence):

Use FreeType 2.
    It supports more font types like OpenType or CID.

Support CJK font entries
    Although TrueType fonts can have CJK fontname entries, like in MS Windows, TTFM cannot use this feature currently. Since many individual CJK TrueType fonts have bogus English vendor and face entries(like -misc-unknown- in XLFD), users can be easily confused with which font to use, if proper CJK font names are not given.

GUI interface
    It's simple to write a X client to have basic functions, since all the dirty work are done by ttfm.sh or modules. However, it would not be trivial to manage CJK fonts simultaneously in a single session.

Support CID
    When TTFM supports FreeType 2, support for CID fonts would be trivial. However, all CID fonts available now as free are released by Adobe, so this functionality probably won't be widely tested.

L10N font face names
    Currently, TTFM sets both Ming and Kai regardless the encoding of TrueType fonts. But usually each country has its own face name convention, eg. "Ming" in Taiwan, "Song" in China, "Mincho" in Japan, and "Munhwa" in Korea. TTFM's "--setdefault" and "--setdefault_kai" should be localized to suite users' needs.

NOTES
TODOs or BUGs that are not related to TTFM.

BIG5-encoded TrueType fonts
    Many applications can only handle modern Unicode-encoded TrueType fonts, eg. XFree86 (both 3.x and 4.x) has problems with certain types of BIG5 TTFs, and Alladdin Ghostscript 6 can't read them at all. Sometimes the problem may be just a wrong encoding ID, and others are due to the lack of BIG5 tables. The same may happen to other legacy fonts, but the author has only BIG5 TTFs at hand. If users encounter the same problem, either switch to newer TTFs, or contact the author would be fine.

CJK XLFD fields
    XLFD (X Logical Font Description) is the standard X Window uses to identify fonts, eg. -adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1. The standard says that each field allows ISO 8859-1 characters(except the '-' character, which is used as field separater), so it's possible to use CJK characters in the face field, just like in MS Windows. But it seems that X protocol converts byte orders, maybe using the htonl() family, when handling fonts. It will be a great challenge to modify X libraries to support multibyte XLFD.

AUTHORS

Yuan-Chung Cheng <platin@linux.org.tw>
    Main program, ttf2pk.ttfm, and xttfm-tcl.ttfm.

Chih-Wei Huang <cwhuang@linux.org.tw>
    ttfm.sh, chitex.ttfm, ttf2pk.ttfm, and xttfm-tcl.ttfm. CLE maintainer.

Jing-Tang Keith Jang <keith@FreeBSD.org>
    abiword.ttfm, ghostscript6.ttfm, xfreetype.ttfm, and xttfm.ttfm. FreeBSD maintainer.