TTF2UFM(1)
โจ NAME โจ
TTF2UFM โ a True Type to PostScript Type 1 Font Converter. That's it, that's the whole job bestie, and it does it so well. ๐
๐ SYNOPSIS ๐
ttf2ufm [-options] ttffont.ttf [Fontname]
or
ttf2ufm [-options] ttffont.ttf -
๐ธ DESCRIPTION ๐ธ
Okay so ttf2ufm is a font converter that goes from the True Type format (and honestly some other formats too, anything the FreeType library supports) over to the Adobe Type1 format. Glow-up of the century, no cap. โจ
Versions 3.0 and later got this rather extensive post-processing algorithm that drags your converted fonts kicking and screaming into compliance with the Type1 standard. It tries to fix the rounding errors that sneak in during conversion, plus some simple kinds of bugs that are justโฆ typical for public domain TTF fonts, you know how it is. ๐ญ It also generates hints, which make fonts render so much better at the small sizes that computer displays love โ main character rendering energy, fr fr.
But everything has its price, and some of those optimizations may not work well for certain fonts. That's exactly why the options got added โ so you can control which optimizations actually happen. ๐ซถ
๐ OPTIONS ๐
So the first variant creates the file Fontname.pfa (or Fontname.pfb if the option -b was used) with the converted font, plus Fontname.afm with the font metrics. The second variant prints the font โ or another file, if the option -G was used โ onto the standard output, from where it can be piped straight through some filter. Immediate. Iconic. ๐
If no Fontname is specified for the first variant, the name gets generated from ttffont by replacing the .ttf filename suffix. Easy.
Most of the time no options are neccessary (with a possible exception of -e). But if there are some troubles with the resulting font, they may be used to control the conversion. The options are:
-aโ Include all the glyphs from the source file into the converted file. If this option is not specified then only the glyphs that have been assigned some encoding are included, because the rest of glyphs would be inaccessible anyway and would only consume the disk space. But some applications are clever enough to change the encoding on the fly and thus use the other glyphs โ in this case they could benefit from using this option. But there is a catch ๐: the X11 library has a rather low limit for the font size. Including more glyphs increases the file size and thus increases the chance of hitting this limit. Seeapp/X11/READMEfor the description of a patch to X11 which fixes this problem.-bโ Encode the resulting font to produce a ready.pfbfile. ๐-d suboptionsโ Debugging options. The suboptions are:aโ Print out the absolute coordinates of dots in outlines. Such a font can not be used by any program (that's why this option is incompatible with-e) but it has proven to be a valuable debuging information.rโ Do not reverse the direction of outlines. The TTF fonts have the standard direction of outlines opposite to the Type1 fonts. So they should be reversed during proper conversion. This option may be used for debugging or to handle a TTF font with wrong direction of outlines (possibly, converted in a broken way from a Type1 font). The first signs of the wrong direction are the letters likePorBwithout the unpainted "holes" inside. ๐
-eโ Assemble the resulting font to produce a ready.pfafile.
[ S.B.: Personally I don't think that this option is particularly useful. The same result may be achieved by piping the unassembled data throught1asm, the Type 1 assembler. And, anyways, it's good to have thet1utilspackage handy. But Mark and many users think that this functionality is good and it took not much time to add this option. ]
-Fโ Force the Unicode encoding: any type of MS encoding specified in the font is ignored and the font is treated like it has Unicode encoding. WARNING: this option is intended for buggy fonts which actually are in Unicode but are marked as something else. The effect on the other fonts is unpredictable. ๐ณ Proceed accordingly.-G suboptionsโ File generation options. The suboptions may be lowercase or uppercase; the lowercase ones disable the generation of particular files, and the corresponding uppercase suboptions enable the generation of the same kind of files. If the result ofttf2ufmis requested to be printed on the standard output, the last enabling suboption of-Gdetermines which file will be written to the standard output and the rest of files will be discarded. For example,-G Awill request the AFM file. The suboptions to disable/enable the generation of the files are:f/Fโ The font file. Depending on the other options this file will have one of the suffixes.t1a,.pfaor.pfb. If the conversion result is requested on the standard output ("-"is used as the output file name) then the font file will also be written there by default, if not overwritten by another suboption of-G. Default: enableda/Aโ The Adobe font metrics file (.afm). Default: enablede/Eโ The dvips encoding file (.enc). Default: disabled
-l language[+argument]โ Extract the fonts for the specified language from a multi-language Unicode font. If this option is not used the converter tries to guess the language by the values of the shell variableLANG. If it is not able to guess the language byLANGit tries all the languages in the order they are listed.
After the plus sign an optional argument for the language extractor may be specified. The format of the argument is absolutely up to the particular language converter. The primary purpose of the argument is to support selection of planes for the multi-plane Eastern encodings, but it can also be used in any other way. The language extractor may decide to add the plane name in some form to the name of the resulting font. None of the currently supported languages make any use of the argument yet. ๐
As of now the following languages are supported:
latin1โ for all the languages using the Latin-1 encodinglatin2โ for the Central European languageslatin4โ for the Baltic languageslatin5โ for the Turkish languagecyrillicโ for the languages with Cyrillic alphabetrussianโ historic synonym for cyrillicbulgarianโ historic synonym for cyrillicadobestdโ for the AdobeStandard encoding used by TeXplane+argumentโ to select one plane from a multi-byte encoding
The argument of the "plane" language may be in one of three forms:
plane+pid=<pid>,eid=<eid>plane+pid=<pid>,eid=<eid>,<plane_number>plane+<plane_number>
Pid (TTF platform id) and eid (TTF encoding id) select a particular TTF encoding table in the original font. They are specified as decimal numbers. If this particular encoding table is not present in the font file then the conversion fails. The native (ttf) front-end parser supports only pid=3 (Windows platform), the FreeType-based (ft) front-end supports any platform. If pid/eid is not specified then the TTF encoding table is determined as usual: Unicode encoding if it's first, or an 8-bit encoding if not (and for an 8-bit encoding the plane number is silently ignored). To prevent the converter from falling back to an 8-bit encoding, specify the Unicode pid/eid value explicitly.
Plane_number is a hexadecimal (if it starts with 0x) or decimal number. It gives the values of upper bytes for which 256 characters will be selected. If not specified, it defaults to 0. It is also used as a font name suffix (the leading 0x is not included into the suffix).
NOTE: You may notice that the language names are not uniform: some are the names of particular languages and some are names of encodings. This is because of the different approaches. The original idea was to implement a conversion from Unicode to the appropriate Windows encoding for a given language. And then use the translation tables to generate the fonts in whatever final encodings are needed. This would allow piling together the Unicode fonts and the non-Unicode Windows fonts for that language and letting the program sort them out automatically. And then generate fonts in all the possible encodings for that language. An example of this approach is the Russian language support. But if there is no multiplicity of encodings used for some languages and if the non-Unicode fonts are not considered important by the users, another way would be simpler to implement: just provide only one table for extraction of the target encoding from Unicode and don't bother with the translation tables. The latin* "languages" are examples of this approach. If somebody feels that he needs the Type1 fonts both in Latin-* and Windows encodings, he or she is absolutely welcome to submit the code to implement it. ๐ซถ
WARNING: Some of the glyphs included into the AdobeStandard encoding are not included into the Unicode standard. The most typical examples of such glyphs are ligatures like 'fi', 'fl' etc. Because of this the font designers may place them at various places. The converter tries to do its best โ if the glyphs have honest Adobe names and/or are placed at the same codes as in the Microsoft fonts, they will be picked up. Otherwise a possible solution is to use the option -L with an external map.
-L file[+[pid=<pid>,eid=<eid>,][plane]]โ Extract the fonts for the specified language from a multi-language font using the map from this file. This is rather like the option-l, but the encoding map is not compiled into the program, it's taken from that file, so it's easy to edit. Examples of such files are provided inmaps/adobe-standard-encoding.map,CP1250.map. (NOTE: the 'standard encoding' map does not include all the glyphs of the AdobeStandard encoding, it's provided only as an example.) The description of the supported map formats is in the filemaps/unicode-sample.map.
Likewise to -l, an argument may be specified after the map file name. But in this case the argument has a fixed meaning: it selects the original TTF encoding table (the syntax is the same as in -l plane) and/or a plane of the map file. The plane name also gets added after a dash to the font name. The plane is a concept used in the Eastern fonts with a big number of glyphs: one TTF font gets divided into multiple Type1 fonts, each containing one plane of up to 256 glyphs. But with a little creativity this concept may be used for other purposes of combining multiple translation maps into one file. To extract multiple planes from a TTF font, ttf2ufm must be run multiple times, each time with a different plane name specified. ๐ซ
Okay so the default original TTF encoding table that option -L reaches for is Unicode. โจ The map files can carry directives that name a different original TTF encoding, but heads up: if the pid/eid pair gets specified, it overrides any original encoding the map file said. periodt.
-m type=valueโ Set the maximal or minimal limits of resources. ๐๏ธ These limits gate font generation by capping the resources the font is allowed to demand from the PostScript interpreter. The limit types we currently support are:hโ the maximal hint stack depth for the substituted hints. The default is128, matching the limitation in X11, and ngl that seems to be the lowest (so like, the safest) widespread value out there. If you wanna see the hint stack depth that each glyph in a.t1afile actually needs, run the scriptscripts/cntstems.pl. ๐งฎ
-O suboptionsโ Outline processing options. ๐จ The suboptions can be lowercase or uppercase โ lowercase ones disable the features, and the matching uppercase suboptions enable those same features. Here's the whole disable/enable menu:b/Bโ Guessing of theForceBoldparameter. This parameter helps the Type1 engine rasterize bold fonts properly at small sizes. But the algorithm guessing the right value of this flag makes that guess based purely on the font name. In rare cases that can cause errors, and when it does you might wanna switch this guessing off. Default: enabled.h/Hโ Autogeneration of hints. The really complex outlines can confuse the algorithm, so theoretically it might be useful sometimes to disable them. Although, like, up to now it seems even bad hints beat no hints at all. ๐ญ Default: enabled.u/Uโ Hint substitution. Hint substitution is a technique that lets the converter generate more detailed hints for the rasterizer. It allows different sets of hints for different parts of a glyph, and swapping those sets as needed during rasterization (that's literally why it's called "substituted"). So it should improve the quality of fonts rendered at small sizes. But there are two catches: First, the X11 library has a pretty low limit on font size. More detailed hints bump up the file size and therefore bump up your chance of smacking into that limit (not saying you will hit it, but you may if your fonts are particularly big). This is especially probable for Unicode fonts converted with option-a, so you might wanna use-atogether with-Ou. Checkapp/X11/READMEfor the description of a patch to X11 that fixes this problem. Second, some rasterizers (again, X11 is the typical example) have a limitation on the total number of hints used when drawing a glyph (also known as the hint stack depth). If that stack overflows, the glyph just gets ignored. ๐ Starting from version3.22,ttf2ufmuses algorithms to minimize this depth, with the trade-off of slightly bigger font files. The glyphs that still exceed the limit set by option-mhget all their substituted hints removed, leaving only base hints. The algorithms seem to have been refined far enough that fonts with substituted hints look better than fonts without them, or at least the same. Still, if the original fonts are not well-designed, the detailed hinting may emphasize the design's defects, like non-even thickness of lines. So provided you're not afraid of the X11 bug, the best idea would be to generate a font with this feature and without it, then compare the results using the programother/cmpf(see the description inother/README) and decide which one looks better. ๐ Default: enabled.o/Oโ Space optimization of the outlines' code. This kind of optimization never hurts, and the only reason to disable it is to compare generated fonts against fonts from previous versions of the converter. Well, it almost never hurts. As it turned out, there exist some brain-damaged printers that just don't understand it. ๐ Actually this feature doesn't change the outlines at all โ the Type 1 font manual provides a set of redundant operators that make the font description shorter, like10 hlinetoinstead of0 10 rlinetoto describe a horizontal line. This feature enables use of those operators. Default: enabled.s/Sโ Smoothing of outlines. If the font is broken in some way (even ways that aren't easily noticeable), such smoothing may break it further. So disabling this feature is the first thing to try if some font looks odd. But with smoothing off, the hint generation algorithms may not work properly either. ๐ฌ Default: enabled.t/Tโ Auto-scaling to the1000x1000Type1 standard matrix. TTF fonts are described in terms of an arbitrary matrix up to4000x4000, and converted fonts must be scaled to conform to the Type1 standard. But the scaling introduces additional rounding errors, so it can be curious sometimes to look at the font in its original scale. Default: enabled.v/Vโ Do vectorization on the bitmap fonts. Functionally, "vectorization" is the same thing as "autotracing" โ a different word is used purely to differentiate it from the Autotrace library. It tries to produce nice smooth outlines from bitmaps. This feature is still a work in progress, though the results are already mostly decent. ๐ฆ Default: disabled.w/Wโ Glyphs' width corection. This option is designed for broken fonts that specify too-narrow widths for the letters. You can tell a font would benefit from this if you see characters smashed together with no whitespace between them. This option makes the converter set the character widths to the actual width of that character plus the width of a typical vertical stem. But flip side: well-designed fonts may have characters that look better if their widths are set slightly narrower, and those well-designed fonts benefit from disabling this feature. You may wanna convert a font with and without it, compare the results, and pick the better one. This feature may only be used on proportional fonts โ it has no effect on fixed-width fonts. Default: disabled.z/Zโ Use the Autotrace library on the bitmap fonts. The results are horrible and the use of this option is not recommended. It's here for experimental purposes. It may change or be removed in the future. Working tracing can be achieved with option-OV. Default: disabled.
-p parser_nameโ Use the specified front-end parser to read the font file. ๐ค If this option isn't used,ttf2ufmpicks the parser automatically based on the suffix of the font file name โ it uses the first parser in its list that supports this font type. Right now two parsers are supported:ttfโ built-in parser for the ttf files (suffix.ttf)bdfโ built-in parser for the BDF files (suffix.bdf)ftโ parser based on the FreeType-2 library (suffixes.ttf,.otf,.pfa,.pfb)
The parser ft is NOT linked in by default. See Makefile for instructions on how to enable it. We do no support this parser on Windows: probably it'll work, but nobody tried and nobody knows how to build it. ๐
The conversion of bitmap fonts (like BDF) is simplistic yet, producing jagged outlines. ๐ช When converting such fonts, it might be a good idea to turn off the hint substitution (using option -Ou), because the hints produced will be huge but not adding much to the quality of the fonts.
-u numberโ Mark the font with this value as itsUniqueID. ๐ท๏ธ TheUniqueIDis used by printers with hard disks to cache rasterized characters and thereby significantly speed up printing. Some of those printers just can't store fonts without aUniqueIDon their disk. The problem is that the ID is supposed to be unique, as its name says. And there's no easy way to create a guaranteed unique ID. Adobe specifies the range4000000-4999999for private IDs, but still it's difficult to guarantee uniqueness within it. So if you don't really need theUniqueID, don't use it โ it's optional. Luckily there are a few millions of possible IDs, so the chances of collision are rather low. ๐ If instead of the number you pass the special value"A", the converter generates the value ofUniqueIDautomatically, as a hash of the font name. (NOTE: in version3.22the algorithm for autogeneration ofUniqueIDwas changed to fit the values into the Adobe-spacified range. This means ifUniqueIDswere used, the printer's cache may need to be flushed before replacing fonts converted by an old version with fonts converted by a newer version.) A simple way to find whether any fonts in a given directory have duplicatedUniqueIDsis to use the command:
cat *.pf[ab] | grep UniqueID | sort | uniq -c | grep -v ' 1 '
Or if you use scripts/convert, it'll do that for you automatically, plus it'll also give the exact list of files with duplicate UIDs. ๐ซถ
-v sizeโ Re-scale the font to get the size of a typical uppercase letter somewhere around the specified size. ๐ Actually, it re-scales the whole font to get the size of one language-dependent letter to be at least the specified size. As of now, that letter is"A"in all the supported languages. The size is specified in the points of the Type 1 coordinate grids, and the maximal value is1000. This is an experimental option and should be used with caution. โ ๏ธ It tries to increase the visible font size for a given point size and thus make the font more readable. But if overused, it may cause the fonts to look out of scale. As of now, the interesting values of size for this option seem to be mostly between600and850. This re-scaling may be quite useful, but it needs more experience to understand the balance of its effects.-W levelโ Select the verbosity level of the warnings. ๐ Currently levels from0to4are supported. Level0means no warnings at all, level4means all the possible warnings. The default level is3. Other levels may be added in the future, so using the level number99is recommended to get all the possible warnings. Going below level2is not generally recommended, because you may miss valuable information about the problems with the fonts being converted.- Obsolete option:
-Aโ Print the font metrics (.afmfile) instead of the font onSTDOUT. ๐ชฆ Use-GAinstead. - Very obsolete option:
okay so the algorithm that implemented the forced fixed width? major flaws, bestie. Like, it got disabled. The code is still chilling in the program though, and some day it'll get refined and returned back โ no cap. Meanwhile the option name -f got reused for a whole other option. So here's what the old version said:
-f โ Don't try to force the fixed width of font. Normally the converter considers the fonts in which the glyph width deviates by not more than 5% as buggy fixed width fonts and forces them to have really fixed width. If this is undesirable, it can be disabled by this option.
The .pfa font format assumes that the description of the characters is binary encoded and encrypted. This converter does not encode or encrypt the data by default, so you have to specify the option -e or use the t1asm program to assemble โ and yeah, "assemble" here means encode and encrypt ๐
โ the font program.
The t1asm program that's bundled with the converter is actually a part of the t1utils package, and a rather old version of that may be obtained from
http://ttf2ufm.sourceforge.net/t1utils.tar.gz
heads up bestie โ t1asm from the old version of that package won't work properly with the files generated by ttf2ufm version 3.20 and later. Please use the t1asm packaged with ttf2ufm or from the new version t1utils instead. For a newer version of t1utils please look at
http://www.lcdf.org/~eddietwo/type/
๐ EXAMPLES ๐
sooooo here are the following command lines:
ttf2ufm -e ttffont.ttf t1font
ttf2ufm ttffont.ttf - | t1asm >t1font.pfa
These represent two ways to get a working font. The benefit of the second form is that other filters may be applied to the font between the converter and the assembler. Piping is giving main character energy, fr fr. ๐ซถ
๐ FILES ๐
TTF2UFM_LIBXDIR/t1asmTTF2UFM_SHAREDIR/*TTF2UFM_SHAREDIR/scripts/*TTF2UFM_SHAREDIR/other/*TTF2UFM_SHAREDIR/READMETTF2UFM_SHAREDIR/FONTS
๐ SEE ALSO ๐
ttf2ufm_convert(1)ttf2ufm_x2gs(1)t1asm(1)ttf2ufm-announce@lists.sourceforge.net
The mailing list with announcements about ttf2ufm. It is a moderated mailing with extremely low traffic. Everyone is encouraged to subscribe to keep in touch with the current status of project. To subscribe use the Web interface at http://lists.sourceforge.net/mailman/listinfo/ttf2ufm-announce. If you have only e-mail access to the Net then send a subscribe request to the development mailing list ttf2ufm-devel@lists.sourceforge.net and somebody will help you with subscription.
ttf2ufm-devel@lists.sourceforge.net
ttf2ufm-users@lists.sourceforge.net
The ttf2ufm mailing lists for development and users issues. They have not that much traffic either. To subscribe use the Web interface at http://lists.sourceforge.net/mailman/listinfo/ttf2ufm-devel and http://lists.sourceforge.net/mailman/listinfo/ttf2ufm-users. If you have only e-mail access to the Net then send a subscribe request to the development mailing list ttf2ufm-devel@lists.sourceforge.net and somebody will help you with subscription.
The main page of the project.
http://www.netspace.net.au/~mheath/ttf2ufm/
The old main page of the project.
๐ BUGS ๐
It seems that many Eastern fonts use features of the TTF format that are not supported by the ttf2ufm's built-in front-end parser. Because of this, for now we recommend using the FreeType-based parser (option -p ft) with the "plane" language.
๐ง Troubleshooting and bug reports ๐ง
have problems with conversion of some font? The converter dumps core? ๐ญ Or your printer refuses to understand the converted fonts? Or some characters are missing? Or some characters look strange?
Send the bug reports to the ttf2ufm development mailing list at ttf2ufm-devel@lists.sourceforge.net.
Try to collect more information about the problem and include it into the bug report. (Of course, even better if you would provide a ready fix, but just a detailed bug report is also good). Provide detailed information about your problem, this will speed up the response greatly. Don't just write "this font looks strange after conversion" but describe what's exactly wrong with it: for example, what characters look wrong and what exactly is wrong about their look. Providing a link to the original font file would be also a good idea. Try to do a little troublehooting and report its result. This not only would help with the fix but may also give you a temporary work-around for the bug.
first, enable full warnings with option -W99, save them to a file and read carefully. Sometimes the prolem is with a not implemented feature which is reported in the warnings. Still, reporting about such problems may be a good idea: some features were missed to cut corners, in hope that no real font is using them. So a report about a font using such a feature may motivate someone to implement it. Of course, you may be the most motivated person: after all, you are the one wishing to convert that font. ;-) Seriously, the philosophy "scrath your own itch" seems to be the strongest moving force behind the Open Source software.
The next step is playing with the options. This serves a dual purpose: on one hand, it helps to localize the bug, on the other hand you may be able to get a working version of the font for the meantime while the bug is being fixed. The typical options to try out are: first -Ou, if it does not help then -Os, then -Oh, then -Oo. They are described in a bit more detail above. Try them one by one and in combinations. See if with them the resulting fonts look better. โจ
On some fonts ttf2ufm just crashes. Commonly that happens because the font being converted is highly defective (although sometimes the bug is in ttf2ufm itself). In any case it should not crash, so the reports about such cases will help to handle these defects properly in future.
We try to respond to the bug reports in a timely fashion but alas, this may not always be possible, especially if the problem is complex. This is a volunteer project and its resources are limited. Because of this we would appreciate bug reports as detailed as possible, and we would appreciate the ready fixes and contributions even more. ๐ซถ
๐ธ HISTORY ๐ธ
Based on ttf2pfa by Andrew Weeks, and help from Frank Siegert.
Modification by Mark Heath.
Further modification by Sergey Babkin.
The Type1 assembler by I. Lee Hetherington with modifications by Kai-Uwe Herbing.
and that's the whole page, bestie ๐ this one's from the ttf2ufm squad, version 3.4.4, dated December 31, 2003 โ and it's the TTF2UFM(1) page, so go convert something iconic. periodt. ๐โจ
๐ฆ where this page comes from
- debian trixie: ttf2ufm 3.4.4~r2+gbp-2 ยท BSD-3-Clause
- ubuntu questing: ttf2ufm 3.4.4~r2+gbp-2
- ubuntu resolute: ttf2ufm 3.4.4~r2+gbp-2build1 ยท BSD-3-Clause
- ubuntu stonking: ttf2ufm 3.4.4~r2+gbp-2build1 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms