TTF2PT1(1)
okay bestie, pull up a chair and grab a snack, because this is the TTF2PT1(1) manual page ๐
โ the TTF2PT1 Font Converter. yes it's long. yes we're doing all of it. no cap.
๐ NAME ๐
TTF2PT1 โ A True Type to PostScript Type 1 Font Converter
literally that's the whole vibe: it takes your TrueType and turns it into Type1. iconic behavior.
โจ SYNOPSIS โจ
"ttf2pt1 [-options] ttffont.ttf [Fontname]"
or, if you're feeling mysterious:
"ttf2pt1 [-options] ttffont.ttf -"
๐ฆ DESCRIPTION ๐ฆ
so Ttf2pt1 is a font converter that goes from the True Type format โ and honestly also some other formats, whatever the FreeType library supports โ over to the Adobe Type1 format. glow up complete. โจ
versions 3.0 and later got this rather extensive post-processing algorithm that drags your converted fonts into compliance with the requirements of the Type1 standard. it tries to correct the rounding errors that sneak in during conversions, plus some simple kinds of bugs that are just, like, typical of public domain TTF fonts (we don't judge, we fix ๐ซถ). it also generates the hints that enable much better rendering of fonts in small sizes, which is exactly the situation you're in on a computer display. but bestie, everything has its price ๐ญ โ some of those optimizations may not work well for certain fonts. that's literally why all these options exist: to control the optimizations being performed.
๐ OPTIONS ๐
okay so here's the tea on the two variants. the first one creates the file Fontname.pfa โ or Fontname.pfb if you used the option -b โ with the converted font, plus Fontname.afm with the font metrics. the second variant prints the font, or another file if you used the option -G, on the standard output, from where it can be immediately piped through some filter. slay. ๐
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 get included, because the rest of the glyphs would be inaccessible anyway and would only consume disk space. but some applications are clever enough to change the encoding on the fly and thus use the other glyphs, and in that case they could benefit from using this option. there is a catch though ๐: 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 that limit. rip.-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 the 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 through t1asm, the Type 1 assembler. And, anyways, it's good to have the t1utils package 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 with caution bestie.
-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 of ttf2pt1 is 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 the 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 byLANG, it 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. (it's giving future-proofing ๐ )
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), and 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, 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 to pile together the Unicode fonts and the non-Unicode Windows fonts for that language and let the program to 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.mapandCP1250.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 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, ttf2pt1 must be run multiple times, each time with a different plane name specified.
okay so bestie, picking right back up on the -L tea: the default original TTF encoding table it uses is Unicode. The map files can include directives that specify different original TTF encodings. But โ and this is the plot twist โ if the pid/eid pair is specified with it, that overrides any original encoding specified in the map file. periodt.
-m type=valueโ sets the maximal or minimal limits of resources. These limits control the font generation by capping the resources the font is allowed to require from the PostScript interpreter. The currently supported types of limits are:hโ the maximal hint stack depth for the substituted hints. The default value is128, matching the limitation in X11. This seems to be the lowest (and thus the safest) widespread value. To display the hint stack depth required by each glyph in a.t1afile, use the scriptttf2pt1_cntstems. ๐ซถ
-O suboptionsโ outline processing options. The suboptions may be lowercase or uppercase: the lowercase ones disable the features, the corresponding uppercase suboptions enable the same features. The suboptions to disable/enable features are:b/Bโ guessing of theForceBoldparameter. This parameter helps the Type1 engine rasterize bold fonts properly at small sizes. But the algorithm used to guess the proper value of this flag makes that guess based solely on the font name. In rare cases that may cause errors, and in these cases you may want to disable this guessing. Default: enabled โจh/Hโ autogeneration of hints. The really complex outlines may confuse the algorithm, so theoretically it may be useful sometimes to disable them. Although up to now it seems that even bad hints are better than no hints at all. Default: enabledu/Uโ hint substitution. Hint substitution is a technique permitting generation of more detailed hints for the rasterizer. It allows use of different sets of hints for different parts of a glyph and to change these sets as neccessary during rasterization (that's why it's "substituted"). So it should improve the quality of the fonts rendered at small sizes. But there are two catches: First, the X11 library has a rather low limit for the font size. More detailed hints increase the file size and thus increase the chance of hitting this limit (that does not mean that you shall hit it, but you may if your fonts are particularly big). This is especially probable for Unicode fonts converted with option-a, so you may want to use-atogether with-Ou. Second, some rasterizers (again, X11 is the typical example) have a limitation for the total number of hints used when drawing a glyph (also known as the hint stack depth). If that stack overflows, the glyph is ignored. Starting from version 3.22,ttf2pt1uses algorithms to minimize this depth, with the trade-off of slightly bigger font files. The glyphs which still exceed the limit set by option-mhhave all the substituted hints removed and only base hints left. The algorithms seem to have been refined far enough to make the fonts with substituted hints look better than the fonts without them, or at least the same. Still, if the original fonts are not well-designed, the detailed hinting may emphasize the defects of the design, such as non-even thickness of lines. So provided that you are 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 programttf2pt1_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 this feature is for comparison of the generated fonts with the fonts generated by the previous versions of converter. Well, it almost never hurts. As it turned out, there exist some brain-damaged printers which don't understand it. Actually, this feature does not change the outlines at all. The Type 1 font manual provides a set of redundant operators that make font description shorter, such as10 hlinetoinstead of0 10 rlinetoto describe a horizontal line. This feature enables use of these operators. Default: enableds/Sโ smoothing of outlines. If the font is broken in some way (even the ones that are not easily noticeable), such smoothing may break it further. So disabling this feature is the first thing to be tried if some font looks odd. But with smoothing off, the hint generation algorithms may not work properly too. Default: enabledt/Tโ auto-scaling to the 1000x1000 Type1 standard matrix. The TTF fonts are described in terms of an arbitrary matrix up to 4000x4000. The converted fonts must be scaled to conform to the Type1 standard. But the scaling introduces additional rounding errors, so it may be curious sometimes to look at the font in its original scale. Default: enabledv/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: disabledw/Wโ glyphs' width corection. This option is designed to be used on broken fonts which specify too narrow widths for the letters. You can tell that a font can benefit from this option if you see that the characters are smashed together without any whitespace between them. This option causes the converter to set the character widths to the actual width of this character plus the width of a typical vertical stem. But on the other hand, well-designed fonts may have characters that look better if their widths are set slightly narrower. Such well-designed fonts will benefit from disabling this feature. You may want to convert a font with and without this feature, compare the results and select the better one. This feature may be used only on proportional fonts; it has no effect on the fixed-width fonts. Default: disabledz/Zโ use the Autotrace library on the bitmap fonts. The results are horrible and the use of this option is not recommended. This option is present for experimental purposes. It may change or be removed in the future. The 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 is not used,ttf2pt1selects 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. 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 don't support this parser on Windows: probably it will work, but nobody tried and nobody knows how to build it. ๐ญ
The conversion of the bitmap fonts (such as 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 add much to the quality of the fonts.
-u numberโ mark the font with this value as itsUniqueID. TheUniqueIDis used by the printers with the hard disks to cache the rasterized characters and thus significantly speed up the printing. Some of those printers just can't store the fonts withoutUniqueIDon their disk. The problem is that the ID is supposed to be unique, as its name says. And there is no easy way to create a guaranteed unique ID. Adobe specifies the range4000000-4999999for private IDs, but still it's difficult to guarantee the 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 a special value"A"is given, then the converter generates the value ofUniqueIDautomatically, as a hash of the font name. (NOTE: in the version 3.22 the algorithm for autogeneration ofUniqueIDwas changed to fit the values into the Adobe-spacified range. This means that ifUniqueIDs were used, then the printer's cache may need to be flushed before replacing the fonts converted by an old version with fonts converted by a newer version). A simple way to find if any of the fonts in a given directory have duplicatedUniqueIDs is to use the command:
cat *.pf[ab] | grep UniqueID | sort | uniq -c | grep -v ' 1 '
Or if you use ttf2pt1_convert, it will do that for you automatically, plus it will 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 of the specified size. Now this letter isAin all the supported languages. The size is specified in the points of the Type 1 coordinate grids, 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 located mostly between600and850. This re-scaling may be quite useful but needs more experience to understand the balance of its effects. ๐ฆ-W levelโ select the verbosity level of the warnings. Currently the 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 on STDOUT. Use-GAinstead. - Very obsolete option:
The algorithm that implemented the forced fixed width had major flaws, so it was disabled. The code is still in the program and some day it will be refined and returned back. Meanwhile the option name -f was reused for another option. The old version was:
-fโ bestie, do NOT force the fixed width of the font. Here's the tea: normally the converter side-eyes any font where the glyph width wobbles by no more than 5%, calls it a buggy fixed-width font, and โจforcesโจ it into being truly fixed width. If that's not the vibe you want, this flag turns the whole thing off. ๐ซถ
Okay so about the .pfa font format โ it literally assumes the character descriptions are binary encoded and encrypted. And this converter? It does not encode or encrypt the data by default. Nope. You have to either pass -e or use the t1asm program to assemble that font program (assemble = encode + encrypt, iykyk). The t1asm that ships with the converter is actually a lil piece of the t1utils package, and a kinda old version of it can be scooped up from
http://ttf2pt1.sourceforge.net/t1utils.tar.gz
Heads up bestie:t1asmfrom that old version of the package will not work properly with files generated byttf2pt1version 3.20 and later. So pls use thet1asmpackaged withttf2pt1, or the one from the new version oft1utils. For a newert1utils, go look at
http://www.lcdf.org/~eddietwo/type/
โจ EXAMPLES โจ
So, these command lines right here:
ttf2pt1 -e ttffont.ttf t1font
ttf2pt1 ttffont.ttf - | t1asm >t1font.pfa
are two whole ways to get yourself a working font. ๐ The second one's glow-up? Other filters can be applied to the font in between the converter and the assembler. Iconic pipeline behavior, no cap.
๐ FILES ๐
/usr/share/ttf2pt1/*/usr/share/ttf2pt1/scripts/*/usr/share/doc/ttf2pt1-3.4.4/other/*/usr/share/doc/ttf2pt1-3.4.4/README/usr/share/doc/ttf2pt1-3.4.4/FONTS
๐ SEE ALSO ๐
ttf2pt1_convert(1)ttf2pt1_x2gs(1)t1asm(1)ttf2pt1-announce@lists.sourceforge.net
The mailing list for announcements about ttf2pt1. It's moderated and has extremely low traffic (like, ghost-town energy ๐). Everyone is encouraged to subscribe and stay in touch with the current status of the project. To subscribe, use the Web interface at http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-announce. If you only have e-mail access to the Net, then send a subscribe request to the development mailing list ttf2pt1-devel@lists.sourceforge.net and somebody will help you with the subscription. ๐ซถ
ttf2pt1-devel@lists.sourceforge.net
ttf2pt1-users@lists.sourceforge.net
These are the ttf2pt1 mailing lists for development and user issues. They don't have that much traffic either. To subscribe, use the Web interfaces at http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-devel and http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-users. If you only have e-mail access to the Net, then send a subscribe request to the development mailing list ttf2pt1-devel@lists.sourceforge.net and somebody will help you with the subscription. ๐
The main page of the project. ๐
http://www.netspace.net.au/~mheath/ttf2pt1/
The old main page of the project. (the vintage one, we keep her for the memories ๐ฆ)
๐ BUGS ๐
Okay so, real talk: it seems like a lot of Eastern fonts use features of the TTF format that the ttf2pt1's built-in front-end parser justโฆ does not support. ๐ญ Because of this, for now we recommend using the FreeType-based parser (option -p ft) with the "plane" language.
๐ง Troubleshooting and bug reports ๐ง
Having problems converting some font? The converter straight up dumps core? Your printer refuses to understand the converted fonts? Some characters are just missing? Or some characters look super strange? ๐
Send those bug reports to the ttf2pt1 development mailing list at ttf2pt1-devel@lists.sourceforge.net.
Try to collect more info about the problem and include it in the bug report. (Obviously even better if you show up with a ready fix, but a detailed bug report is also great, fr fr.) Give detailed info about your problem โ it speeds up the response so much. Don't just write "this font looks strange after conversion," bestie, describe what's exactly wrong with it: like, which characters look wrong and what exactly is wrong about their look. Providing a link to the original font file would also be a good idea. Try doing a lil troubleshooting and report the result. This doesn't just help with the fix โ it might also hand you a temporary work-around for the bug. ๐ธ
First step: enable full warnings with option -W99, save them to a file, and read carefully. ๐ Sometimes the problem is a not-implemented feature that's reported right there in the warnings. Still, reporting about such problems may be a good idea: some features were missed to cut corners, in the hope that no real font uses them. So a report about a font using such a feature may motivate someone to implement it. And of course, you may be the most motivated person: after all, you're the one wishing to convert that font. ;-) Seriously, the philosophy "scrath your own itch" seems to be the strongest moving force behind Open Source software. ๐
The next step is playing with the options. Dual purpose, iconic: on one hand it helps localize the bug, on the other hand you might 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 that doesn't help then -Os, then -Oh, then -Oo. They're described in a bit more detail above. Try them one by one and in combinations. See if the resulting fonts look better with them. โจ
On some fonts ttf2pt1 just crashes. Commonly that happens because the font being converted is highly defective (although sometimes the bug is in ttf2pt1 itself). In any case it should not crash, so reports about such cases will help handle these defects properly in the future.
We try to respond to bug reports in a timely fashion, but alas, that's not always possible, especially if the problem is complex. This is a volunteer project and its resources are limited. Because of this we'd appreciate bug reports as detailed as possible โ and we'd appreciate 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 version 3.4.4, dated December 31, 2003 โ yes she's an elder icon, respect the vintage. Now go convert some fonts and slay. ๐ โจ
๐ฆ where this page comes from
- fedora 43: ttf2pt1 3.4.4-51.fc43 ยท GPL-2.0-or-later AND LicenseRef-Callaway-BSD-with-advertising
- fedora 44: ttf2pt1 3.4.4-52.fc44 ยท GPL-2.0-or-later AND LicenseRef-Callaway-BSD-with-advertising
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms