[xorg-commit-diffs] xc/extras/ttf2pt1 CHANGES.html, NONE,
1.1.2.1 COPYRIGHT, NONE, 1.1.2.1 FONTS.hpux.html, NONE,
1.1.2.1 FONTS.html, NONE, 1.1.2.1 Makefile, NONE,
1.1.2.1 README.FIRST, NONE, 1.1.2.1 README.html, NONE,
1.1.2.1 bdf.c, NONE, 1.1.2.1 bitmap.c, NONE,
1.1.2.1 byteorder.h, NONE, 1.1.2.1 cygbuild.sh, NONE,
1.1.2.1 ft.c, NONE, 1.1.2.1 global.h, NONE, 1.1.2.1 pt1.c,
NONE, 1.1.2.1 pt1.h, NONE, 1.1.2.1 runt1asm.c, NONE,
1.1.2.1 t1asm.c, NONE, 1.1.2.1 ttf.c, NONE, 1.1.2.1 ttf.h,
NONE, 1.1.2.1 ttf2pt1.1, NONE, 1.1.2.1 ttf2pt1.c, NONE,
1.1.2.1 ttf2pt1_convert.1, NONE, 1.1.2.1 ttf2pt1_x2gs.1, NONE,
1.1.2.1 version.h, NONE, 1.1.2.1 winbuild.bat, NONE,
1.1.2.1 windows.h, NONE, 1.1.2.1
Roland Mainz
xorg-commit at pdx.freedesktop.org
Mon Apr 12 20:16:36 PDT 2004
- Previous message: [xorg-commit-diffs] xc/lib/XprintUtil Imakefile, NONE,
1.1.2.1 xprintutil.c, NONE, 1.1.2.1 xprintutil.h, NONE,
1.1.2.1 xprintutil_printtofile.c, NONE, 1.1.2.1
- Next message: [xorg-commit-diffs] xc/extras/freetype2/include/freetype/config
ftoption.h, 1.1.4.1.6.1, 1.1.4.1.6.1.6.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: gisburn
Update of /cvs/xorg/xc/extras/ttf2pt1
In directory pdx:/tmp/cvs-serv9732/xc/extras/ttf2pt1
Added Files:
Tag: XPRINT
CHANGES.html COPYRIGHT FONTS.hpux.html FONTS.html Makefile
README.FIRST README.html bdf.c bitmap.c byteorder.h
cygbuild.sh ft.c global.h pt1.c pt1.h runt1asm.c t1asm.c ttf.c
ttf.h ttf2pt1.1 ttf2pt1.c ttf2pt1_convert.1 ttf2pt1_x2gs.1
version.h winbuild.bat windows.h
Log Message:
Fix for http://xprint.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=462 - RFE: Merge xprint.mozdev.org Xprint enhancements into Xorg XPRINT branch
--- NEW FILE: CHANGES.html ---
<HTML>
<HEAD>
<TITLE>
TTF2PT1 - CHANGES history
</TITLE>
</HEAD>
<BODY>
<H2>
TTF2PT1 - CHANGES history
</H2>
<!
(Do not edit this file, it is generated from CHANGES.html!!!)
>
<H4>
3.4.4-SNAP-030526
</H4>
<!
-------
>
<b>New features:</b>
<ul>
<li> Improved the auto-vectoring (-OV) alrogithm.
</ul>
<b>Bug fixes:</b>
<ul>
<li> Fix to build all the features on Windows MS C++, by Tomoo Amano.
</ul>
<H4>
3.4.3 -- December 2, 2002
</H4>
<!
-------
>
<b>New features:</b>
<ul>
<li> <tt>scripts/forceiso</tt> got an optional argument to select the
format of the names for glyphs without standard Latin-1 names.
</ul>
<b>Bug fixes:</b>
<ul>
<li> Changed the glyph names in scripts/forceiso to match those in ttf2pt1.
<li> Included the missing directory app/TeX.
</ul>
<H4>
3.4.2 -- August 30, 2002
</H4>
<!
-------
>
<b>New features:</b>
<ul>
<li> New map for T2A_compat encoding (for Cyrillic LaTeX) by Mikhail
Umorin.
<li> Scripts supporting font conversion for CJK-LaTeX, by Mike Fabian
from SuSE.
</ul>
<b>Bug fixes:</b>
<ul>
<li> Explicit owner/group/permissions are used to install directories.
<li> In scripts/convert fixed the addition of encoding name to the font
name for the external encoding maps, was missing "/" at the start.
<li> Fixed the divergence between two copies of UniqueID.
<li> Fixed the recovery after defective empty contours.
</ul>
<H4>
3.4.1 -- June 13, 2002
</H4>
<!
-------
>
<b>New features:</b>
<ul>
<li> Added Autotrace support for the bitmap fonts (-OZ). It's horrible.
<li> Added vectorization of bitmap fonts (-OV) - functionally the same thing as
autotrace but home-grown. Works mostly decently but still with large
space for impprovement.
<li> Relaxed the conditions for warnings about long glyphs.
</ul>
<b>Bug fixes:</b>
<ul>
<li> Fix by Rob Kolstad for a crash in the new outline smoothing
code (on small thin contours) and diagnostic for another crash.
<li> Fix by Holger Huesing for a crash on degenerate contours.
<li> Fix for bitmaps of zero dimensions.
<li> The BDF reader does not fail on redefintion of the properties.
<li> Fix for reading of BDF glyphs with 0 size.
<li> Fix for a hang when guessing the boldness of some fonts.
<li> Fix by Adriano Konzen for scaling coefficients in composite glyphs.
</ul>
<H4>
3.4.0 -- November 24, 2001
</H4>
<!
-------
>
<b>New features:</b>
<ul>
<li> Parser for the BDF bitmap fonts.
<li> Vastly improved the smoothing of the outlines.
<li> The options are saved as a comment in the output file.
<li> New script <tt>other/showdf</tt> for visual comparison of the fonts.
<li> New option <b>-G</b> to select the file types to generate.
<li> Creation of the dvips encoding files (by Rigel).
<li> More glyphs in the Chinese maps (by Rigel).
<li> Made the assignment of ISO8859/1 glyph names to the glyphs in the
fonts without PostScript names in them dependent on the original
encoding: no change for the 8-bit encodings, for the Unicode encoding
the names are assigned to the glyph with the codes 0-255 in Unicode,
and for the other 16-bit encodings the 8859/1 names are not assigned
at all.
</ul>
<b>Bug fixes:</b>
<ul>
<li> Added a check for spaces in the PostScript font name in the FreeType
parser.
<li> Made "-" a valid character in the glyph names.
<li> Fixed handling of the Unicode names returned by FreeType, though
not perfectly.
<li> Changed the build for FreeType-2.0.4.
<li> Fixed the handling and printing of bad glyph names.
<li> Fixed the bug with duplicated glyph names when more than 256 glyphs are
extracted from a font that has no PostScript glyph names defined.
<li> Added ability to map a glyph to more than one code when unisng the
native parser (-pttf).
</ul>
<H4>
3.3.5 -- September 12, 2001
</H4>
<!
-------
>
Packaged by Sergey Babkin.
<p>
<b>Bug fixes:</b>
<ul>
<li> Fixed the scaling of Ascender and Descender in the AFM file.
<li> Fixed the brekage of "-l adobestd".
</ul>
<H4>
3.3.4 -- June 4, 2001
</H4>
<!
-------
>
Packaged by Sergey Babkin.
<p>
<b>New features:</b>
<ul>
<li> Cyrillic (full set of glyphs) language tables (by Zvezdan Petkovic).
Now the languages "russian" and "bulgarian" are provided for compatibility
only, use the common language "cyrillic" instead.
<li> More information in <a href="FONTS.html">FONTS</a> on using Cyrillic fonts with
Netscape (by Zvezdan Petkovic)
<li> In the Netscape print filter added removal of the clipping path command:
otherwise Netscape tends to cut off a large piece of the rightmost column
of the tables.
<li> One more script for printing from Netscape (by Zvezdan Petkovic).
<li> Added selection of the base TTF encoding by pid/eid in the external maps.
<li> Improved the recognition of substituted stems for intersecting contours.
<li> Improved the substituted hints to make the horizontal positioning of
the points at the same height more uniform at small pixel sizes.
<li> Made the algorithm for calculation of standard stem widths more
selective.
<li> Added link to the GnuWin32 project.
</ul>
<b>Bug fixes:</b>
<ul>
<li> TH: Print out metrics of un-encoded glyphs even without "-a" option.
<li> Added missing "/" in Fontmap generation in convert (by Zvezdan Petkovic).
<li> Removed unneccessary "\n" in messages in x2gs.
<li> Removed the broken overoptimisation of "0 0 rmoveto".
<li> Removed the useless warnings about multiple codes for a glyph.
<li> Changed the FreeType2 include directory in the Makefile to match the
FreeType's default.
</ul>
<H4>
3.3.3 -- March 4, 2001
</H4>
<!
-------
>
Packaged by Sergey Babkin.
<p>
<b>New features:</b>
<ul>
<li> TH: Added printing of front-end parser in the header of the font file.
<li> Tested build with FreeType 2.0 Release.
</ul>
<b>Bug fixes:</b>
<ul>
<li> Changed the installation script which on some versions of bash
copied all files into the share directory.
<li> Fixed the close sequences of html2man comments in the HTML files,
now they should display correctly with <tt>lynx</tt>.
<li> Restored the ability to include un-encoded characters into the
customised maps (those with codes over 255).
<li> Fixed the Unicode mapping of the Cyrillic letters "YO" and "yo"
(by Yuri Shemanin).
<li> Fixed the spurious aborts when the conversion-by-plane function
gets called for auto-guessing of encoding.
</ul>
<H4>
3.3.2 -- November 20, 2000
</H4>
<!
--------------------------
>
Packaged by Sergey Babkin.
<p>
<b>New features:</b>
<ul>
<li> Added generation of man pages.
<li> Added "make install" and "make uninstall".
<li> Added language option "-l plane".
<li> In <tt>other/showg</tt> added better support of comparison files:
<ul>
<li> printing of the comparison file legend;
<li> guessing of missing glyph names in a comparison file by code;
<li> bounding boxes of all comparison files are used for page layout.
</ul>
<li> Added ability to use external t1asm instead of compiling it in.
<li> Renamed the fonts installation guide from INSTALL*html to FONTS*html
to avoid confusion with installation of ttf2pt1 itself.
</ul>
<b>Bug fixes:</b>
<ul>
<li> Removed erroneous extra fclose(pfa_file).
<li> Fixed random memory corruption that manifested with crash on Linux
when converting fonts not containing glyph names.
<li> Removed from the output file the comments that confused dvips. Changed
<tt>other/showg</tt> to work without them.
<li> In <tt>other/showg</tt> added better checks for missing glyphs, now it
gives warnings about them and the output file does not crash PostScript.
</ul>
<b>Other:</b>
<ul>
<li> <tt>ttf2pfa</tt> is no longer included, people interested in history
should look for it in the older versions.
</ul>
<H4>
3.3.1 -- October 22, 2000
</H4>
<!
-------------------------
>
Packaged by Sergey Babkin.
<p>
<b>New features:</b>
<ul>
<li> Added front-end parser based on the FreeType-2 library. See Makefile
for build instructions.
<li> Changed the handling of encodings to accomodate the FreeType model.
<li> Further cleaned up the front-end parser interface.
</ul>
<b>Bug fixes:</b>
<ul>
<li> Fixed a bug that caused core dump on Alpha machines.
<li> Fixed a bug in the outline smoothing that occasionally caused core dump.
<li> Cleaned up warnings from picky compilers
<li> Fixed more bugs in the Windows port (by Stefan Bauer).
<li> Fixed the RPM spec file (suggested by Brian Armstrong).
</ul>
<p>
<H4>
3.3.0 -- September 22, 2000
</H4>
<!
---------------------------
>
Packaged by Sergey Babkin.
<p>
<b>New features:</b>
<ul>
<li> Converted most of the outlines' processing to floating point
arithmetic.
<li> Added splitting of curves crossing the quadrant boundaries (no gross
damage is done any more to the Marvosym font and others like it).
<li> Added modular interface for front-end font parsers and option to control
their selection at run time.
<li> Grouped the outline processing control options into one to reduce the
options namespace pollution.
<li> Thomas moved the Chinese maps into a separate module, chinese-maps.
<li> Thomas added option -V to print version number. In addition, the version
number is put in the header of the font file.
<li> Added long option names (suggested by Thomas).
<li> Added support for multi-level composite glyphs.
<li> TH: Made <fontname> command-line argument optional; default to <ttf-file>
with suffix replaced.
<li> In <tt>other/showg</tt> added more ways to specify glyphs and the comparison option.
</ul>
<b>Bug fixes:</b>
<ul>
<li> Fixed the VC++ batch file, added batch file for Cygnus GCC on Windows.
<li> Removed parentheses from the Version string in AFM files because it does
not help StarOffice anyway. StarOffice 5.2 has been reported to have this
bug fixed. Added paragraph on StarOffice in FONTS.html.
<li> Made messages on the '?' option parameter more meaningful (by Johan Vromans).
<li> Changed the latin1 encoding table to include the Euro sign, Z and z with
caron (by Thomas Henlich).
<li> Improved the smoothing code which occasionally had problems with
joining curves. Also fixed a few minor bugs in it.
</ul>
<H4>
3.22 -- May 23, 2000
</H4>
<!
--------------------
>
Packaged by Sergey Babkin.
<p>
<b>New features:</b>
<ul>
<li> Included windows support by Frank Siegert (somewhat amended)
<li> Added control over verbosity of warnings.
<li> Added arguments and initialization functions to the language
translation routines.
<li> Added support of planes determined by arguments to the external
maps.
<li> Added compact external maps format (primarily for Eastern fonts).
<li> Added external maps for Chinese GBK and Big5 encodings (converted
from ttf2pfb) as well as maps for other Chinese encodings by Wang Lei.
<li> Added the idea of buckets to speed up the search in external maps.
<li> Changed the grouping algorithm for substituted hints: now it creates
a bit bigger files but requires smaller hint stack when being rendered.
<li> Added maximal limit of hint stack depth, glyphs requiring bigger
stack get generation of substituted hints disabled. This makes substituted
hints safe to use, no more lost glyphs due to hint stack overflow.
<li> Added the font dump program <tt>other/dumpf</tt>.
<li> Changed the testing HTML generator <tt>other/lst.pl</tt> to use tables.
<li> Added debugging script <tt>other/cntstems.pl</tt> to count required hint
stack depth for the glyphs.
</ul>
<b>Bug fixes:</b>
<ul>
<li> Fixed printing of UID in script/trans. Changed the auto-generated UID to
be in range 4000000-4999999 which is reserved by Adobe for private use.
<li> Fixed handling of "cleartomark" in built-in t1asm.
<li> Added handling of "can't happen" case in straighten() routine
which actually happened on strange fonts and caused failure on assertion.
<li> Made it always include the glyph .notdef in the resulting font.
<li> Placed the version string in AFM file in parentheses, hopefully
that would fix the problem with StarOffice.
<li> Improved the smoothing code which occasionally had problems with
joining curves.
</ul>
<H4>
3.21 -- March 1, 2000
</H4>
<!
---------------------
>
Sergey Babkin: committed the changes by Petr Titera and
my bugfixes.
<p>
<b>New features:</b>
<ul>
<li> New Unicode map format with glyph names, by Petr Titera.
<li> Option to force the Unicode encoding by Petr Titera
(I changed it to work on any MS encoding, not only Symbol).
<li> Slightly tweaked the calculation of hints, should be better now.
</ul>
<b>Bug fixes:</b>
<ul>
<li> The unicode-sample.map with description of the map formats
was lost in the release process, restored and enhanced.
<li> Renamed the table ISOLatin1Encoding to Fmt3Encoding to reflect
the way it is used. Saved the original one for reference
purposes. In the new table renamed "quoteright" to "quotesingle"
as Thomas Henlich suggested (and he were right).
<li> In the ISOLatinEncoding table renamed the glyph "grave"
at octal 0140 to "quoteleft", "quotesingle" at octal 047 to
"quoteright" to conform to the standard as suggested by
Martin Trautner).
<li> Fixed bug in scripts/trans that corrupted the UniqueID record
in the translated fonts.
<li> Fixed bug in interaction of substituted hints with BlueZones.
Now the fonts with hint substitution seem to be always at least
not worse than without it (well, when they fit in the X11
file size limit).
</ul>
<H4>
3.2 -- January 15, 2000
</H4>
<!
-----------------------
>
Sergey Babkin: combined my changes with the changes by
Thomas Henlich. The result deserves a not-so-minor version
increase.
<p>
<b>New features:</b>
<ul>
<li> Support of the external Unicode re-encoding maps
(by Thomas).
<li> Support for inclusion of all the glyphs from the
source file into the resulting file (inspired by
Thomas but I re-implemented it to remove the limitation
of his implementation: not more than 1024 glyphs).
<li> The hints substitution. It's an experimental feature
yet and needs further work.
<li> Support for UniqueID and its auto-generation.
<li> Support for the name-based conversions from Unicode
in general and the adobestd "language" in particular.
<li> Started the split of the source code into multiple
files. This needs more work to do it in a cleaner
way.
<li> Better framework for the debugging printout
in the converter.
<li> Utilities to install the fonts in Netscape
Navigator/Communicator 4.x.
<li> Patches for bigger font files in the X11 rasterizer.
<li> Linux RPM spec-file (by Johan Vromans).
<li> Added the COPYRIGHT file (BSD-style, as we discussed
on the mailing list earlier) and the CHANGES file.
<li> Creation of the <tt>.pfb</tt> files from the <tt>convert</tt>
script.
<li> Changed the <tt>.notdef</tt>-s in the built-in
ISOLatin1Encoding table to some valid names (by Thomas).
Thomas also suggested replacing `<tt>quoteright</tt>' by
`<tt>quotesingle</tt>' but this seems to be against the
Adobe ISOLatin1 table.
<li> New aliases <tt>windows-1251</tt> and <tt>cp-866</tt> for
the Russian encodings: those are expected by Netscape
navigator.
<li> The font comparison program <tt>other/cmpf</tt>.
<li> The "magnifying glass" program for glyph outlines:
<tt>other/showg</tt>.
<li> Other updates of the tools in the `<tt>other</tt>' subdirectory.
<li> Added a link to T1LIB in README.
<li> A few new options in <tt>convert.cfg</tt>.
</ul>
<b>Bux fixes:</b>
<ul>
<li> A bug in the outline smoothing code that corrupted some
of the fonts (for example, Microsoft Verdana).
<li> Added explicit `<tt>cleartomark</tt>' to the end of file,
this seems to be compatible with both old and new version
of <tt>t1asm</tt> (suggested by Thomas).
<li> Added the <tt>FontEncoding</tt> statement to the AFM files
(techincally this was not a bug because this statement
is optional but some programs want it).
<li> A coredump when the converter tried to print a warning
(rather ironically) about a weird glyph width.
<li> Changed the underscores in the font names to dashes (this
has been proposed long time ago by Johan Vromans).
<li> No more glyph names of font names staring with a digit.
<li> The names of the fonts in font and AFM files are now the
same as in the generated Ghostscript <tt>Fontmap</tt> file.<br>
<b>Warning:</b> the names in <tt>Fontmap</tt> have been
changed.
<li> The <tt>forceiso</tt> script does not corrupt the character
and kerning pairs counts any more, and is optional at all.
<li> Fix for a loop going to 254 instead of 255 (by Thomas).
<li> Added ':' in the font header (by Thomas).
<li> A coredump when wrong language name is given (this was
also fixed by Thomas but I noticed it too late, after
I already fixed it by myself).
<li> Fixed the links to the Adobe documents in README.
</ul>
<H4>
3.13 -- October 18, 1999
</H4>
<!
------------------------
>
Packaged by Sergey Babkin.
<p>
<b>New features:</b>
<ul>
<li> New option -v for automatic re-scaling based on the vertical size of the font
<li> Changed the code to use getopt() instead of a home-made version of it.
<li> Latin2 language support by Szalay Tamas.
</ul>
<b>Bux fixes:</b>
<ul>
<li> Fix for the bug that made possible calls of malloc(0).
<li> Refinement of the option -w to prevent extra wide spacing
</ul>
<H4>
3.12 -- October 2, 1999
</H4>
<!
-----------------------
>
Packaged by Sergey Babkin.
<p>
<b>New features:</b>
<ul>
<li> Added support for the Bulgarian language (actually, for now just an alias
of Russian).
<li> Added option -w that tries to make sure that the character widths are not
too narrow.
<li> Added the concept of aliased encodings.
<li> Now the conversion scripts create and install the .afm files too.
<li> The conversion script removes the intermediate files after installation.
<li> Added tunables to the conversion script.
<li> Installation of the Ghostscript fonts can now be done automatically
together with the X11 fonts.
</ul>
<b>Bux fixes:</b>
<ul>
<li> (FINALLY!!!) A correct fix for the infamous Red Hat 6.0 stdio "feature".
<li> A number of little bugs discovered by a picky SGI compiler (well, maybe
some day I'll try to run it through the UnixWare lint and see what happens).
<li> A diagnostic message about the empty encodings in the convert script was
made less cryptic and a bug in the awk sub-script was fixed.
<li> The .afm creation code now considers the option -t.
</ul>
<H4>
3.11 -- May 24, 1999
</H4>
<!
--------------------
>
Packaged by Sergey Babkin.
<p>
<b>New features:</b>
<ul>
<li> It includes the Turkish (Latin5, ISO8859/9)
language support by Turgut Uyar and Baltic (ISO8859/4) languages support by
Rihardas Hepas.
<li> Also the installation script got updated: the configuration parameters
are moved to a separate file and the generated fonts.dir files should now be
compatible with Xfsft.
</ul>
<H4>
3.1 -- March 28, 1999
</H4>
<!
---------------------
>
Packaged by Sergey Babkin.
<p>
<b>New features:</b>
<ul>
<li> Improved the interaction of the character-level hints and font-level hints
</ul>
<H4>
3.0 -- March 6, 1999
</H4>
<!
--------------------
>
Packaged by Sergey Babkin.
<p>
<b>New features:</b>
<ul>
<li> Added HTML documents.
</ul>
<H4>
3.0beta2 -- February 14, 1999
</H4>
<!
-----------------------------
>
Packaged by Sergey Babkin.
<p>
<b>New features:</b>
<ul>
<li> Added ability to print the .afm file instead of the font to STDOUT.
<li> Added the guessing of the /ForceBold parameter that proved to be useful.
</ul>
<b>Bux fixes:</b>
<ul>
<li> Removed the force-fixed option that proved to be troublesome.
</ul>
<H4>
3.0beta1 -- December 11, 1998
</H4>
<!
-----------------------------
>
By Andrew Weeks.
<p>
<b>New features:</b>
<ul>
<li> Added option (passed to t1asm) to create a compressed binary
version of the font (A PFB file).
</ul>
<b>Bux fixes:</b>
<ul>
<li> Versions of handle_post and handle_cmap that deal with some
problems with buggy fonts.
<li> Minor Bug Fixes.
</ul>
<H4>
3.0beta-afm -- December 5, 1998
</H4>
<!
-------------------------------
>
By Thomas Henlich.
<p>
<b>New features:</b>
<ul>
<li> Integration of AFM file creation.
</ul>
<H4>
3.0beta -- November 15, 1998
</H4>
<!
----------------------------
>
By Sergey Babkin.
<p>
<b>New features:</b>
<ul>
<li> Added the auto-calculation of the italic angle.
</ul>
<b>Bux fixes:</b>
<ul>
<li> Fixed a couple of bugs.
</ul>
<H4>
3.0alpha -- October 19, 1998
</H4>
<!
----------------------------
>
By Sergey Babkin.
<p>
<b>New features:</b>
<ul>
<li> Improved (although still not perfect) handling of
scaling in composite glyphs
<li> Automatic correction of outlines to make them more
smooth (to correct both rounding errors introduced
during conversion and present in the original font)
<li> Automatic generation of hints (still has lots of
space for improvement)
<li> Automatic generation of BlueValues etc.
</ul>
<b>Bux fixes:</b>
<ul>
<li> Scaling of fonts to 1000x1000 M-square required by
Type1 standard
<li> Printing out the contours in reverse direction, because
TTF directions are different from Type1 ones (that was
the major reason why the fonts generated by
version 2.2 were rendered so badly in small sizes)
</ul>
<H4>
June 22, 1998 (AKA 2.2)
</H4>
<!
-------------
>
By Thomas Henlich.
<p>
<b>Bux fixes:</b>
<ul>
<li> "width" should be "short int" because otherwise:
characters with negative widths (e.g. -4) become *very* wide (65532)
<li> The number of /CharStrings is numglyphs and not numglyphs+1
</ul>
<H4>
February 13, 1998
</H4>
<!
-----------------
>
By Mark Heath.
<p>
<b>Bux fixes:</b>
<ul>
<li> An original Bug Reported by Frank, which was just incorrect syntax in the
Type 1 header, managed to creep back into the Feb 04 Version. This has been
Fixed in the Feb 13 Version.
</ul>
<H4>
February 4, 1998
</H4>
<!
----------------
>
By Mark Heath.
<p>
<b>Bux fixes:</b>
<ul>
<li> A workaround was implemented in ttf2pfa by altering the matrix. I suspect
I will have to calculate the correct values, as matrix ops are probably not
allowed in Type 1 format.
</ul>
<!
---------------------------------------------
>
<H4>
The older history seems to be lost.
</H4>
<I>
(S.B.: The story how we got the version numbers is rather funny. Initially
there were no version umbers, the releases were marked by dates. The version
from June 22 1998 untarred itself into a directory "<tt>ttf2pt1-22</tt>". When I
made my changes to it I assumed that this was the version number meaning
version 2.2. Since Mark asked me to send him a complete archive I supposed
that I have to bump the version number. And I bumped it to 3.0 because the
changes were rather extensive. Mark silently agreed and released the new
version as 3.0. And that's the end of the story about how we got this
Microsoft-like high version number.)
</I>
</BODY>
</HTML>
--- NEW FILE: COPYRIGHT ---
The following copyright notice applies to all the files provided
in this distribution unless explicitly noted otherwise
(the most notable exception being t1asm.c).
Copyright (c) 1997-2002 by the AUTHORS:
Andrew Weeks <ccsaw at bath.ac.uk>
Frank M. Siegert <fms at this.net>
Mark Heath <mheath at netspace.net.au>
Thomas Henlich <thenlich at rcs.urz.tu-dresden.de>
Sergey Babkin <babkin at users.sourceforge.net>, <sab123 at hotmail.com>
Turgut Uyar <uyar at cs.itu.edu.tr>
Rihardas Hepas <rch at WriteMe.Com>
Szalay Tamas <tomek at elender.hu>
Johan Vromans <jvromans at squirrel.nl>
Petr Titera <P.Titera at sh.cvut.cz>
Lei Wang <lwang at amath8.amt.ac.cn>
Chen Xiangyang <chenxy at sun.ihep.ac.cn>
Zvezdan Petkovic <z.petkovic at computer.org>
Rigel <rigel863 at yahoo.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by the TTF2PT1 Project
and its contributors.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
For the approximate list of the AUTHORS' responsibilities see the
project history.
Other contributions to the project are:
Turgut Uyar <uyar at cs.itu.edu.tr>
The Unicode translation table for the Turkish language.
Rihardas Hepas <rch at WriteMe.Com>
The Unicode translation table for the Baltic languages.
Szalay Tamas <tomek at elender.hu>
The Unicode translation table for the Central European languages.
Johan Vromans <jvromans at squirrel.nl>
The RPM file.
Petr Titera <P.Titera at sh.cvut.cz>
The Unicode map format with names, the forced Unicode option.
Frank M. Siegert <frank at this.net>
Port to Windows
Lei Wang <lwang at amath8.amt.ac.cn>
Chen Xiangyang <chenxy at sun.ihep.ac.cn>
Translation maps for Chinese fonts.
Zvezdan Petkovic <z.petkovic at computer.org>
The Unicode translation tables for the Cyrillic alphabet.
Rigel <rigel863 at yahoo.com>
Generation of the dvips encoding files, modification to the Chinese maps.
I. Lee Hetherington <ilh at lcs.mit.edu>
The Type1 assembler (from the package 't1utils'), its full copyright
notice:
Copyright (c) 1992 by I. Lee Hetherington, all rights reserved.
Permission is hereby granted to use, modify, and distribute this program
for any purpose provided this copyright notice and the one below remain
intact.
--- NEW FILE: FONTS.hpux.html ---
<HTML>
<HEAD>
<TITLE>
How to install new Type1 fonts on an HP-UX 10.20 machine
</TITLE>
</HEAD>
<BODY>
Sergey A. Babkin
<br>
<A HREF="mailto:babkin at bellatlantic.net">
<babkin at bellatlantic.net></A> or <A HREF="mailto:sab123 at hotmail.com"><sab123 at hotmail.com></A>
<p>
<!
(Do not edit this file, it is generated from FONTS.hpux.html!!!)
>
<H3>
How to install new Type1 fonts on an HP-UX 10.20 machine
</H3>
<!
--------------------------------------------------------
>
1. Add the font files to <tt>/usr/lib/X11/fonts/type1.st/typefaces</tt>.
<p>
2. Add the font descriptions to
<tt>/usr/lib/X11/fonts/type1.st/typefaces/fonts.scale</tt>. Run `mkfontdir'
in <tt>/usr/lib/X11/fonts/type1.st/typefaces</tt>. In the descriptions
you have to specify the font manufacturer as `misc', like:
<p>
<tt>
-misc-courier-...
</tt>
<p>
3. Copy <tt>/usr/lib/X11/fonts/type1.st/typefaces/fonts.dir</tt> to
<tt>/usr/lib/X11/fonts/type1.st/licenses/STSYSTEM/DISPLAYS/fonts.dir</tt>.
Better yet, create a symbolic link.
<p>
4. For each font encoding you are going to use create a description
file in <tt>/usr/lib/X11/fonts/stadmin/type1/charsets</tt>. Of course, if you
are going to use the same fonts in several encodings, the best way
would be to create fair descriptions of charsets and really store
only one encoding in typefaces, all the others will be produced
automatically. That's not difficult at all.
But the simplest way is to just copy the file <tt>cp.iso8859-1</tt>
to <tt>cp.<i><your-encoding-name></i></tt>, like <tt>cp.koi8-r</tt>.
<p>
5. Restart you X server and/or font server.
<p>
<H4>
What if you don't have the `root' privileges ?
</H4>
<!
----------------------------------------------
>
You still can run the font server and configure your X server
to get the fonts from it.
<p>
Further let's suppose that the name on which you are going
to run the font server is named `somehost'. Login to it
and configure the font server.
<p>
First, choose some unused port. Numbers around 9000 are a good
choice. Verify that this port is not used by somebody else
by entering
<p>
<blockquote><tt>
netstat -naf inet |grep 9000
</tt></blockquote>
and look what happens. If you get nothing, that's good, this
port is unused. If you get some lines of data, try abother port.
<p>
Go to you home directory <tt>$HOME</tt> and create some directory for
your font server, say, <tt>$HOME/fs</tt>. Copy the directory structure
of <tt>/usr/lib/X11/fonts/type1.st</tt> into <tt>$HOME/fs</tt>, so that in result
you get <tt>$HOME/fs/type1.st/<i><whatever was there></i></tt>. Copy the directory
structure of <tt>/usr/lib/X11/fonts/stadmin/type1/charsets</tt> into <tt>$HOME/fs</tt>,
so that in result you get <tt>$HOME/fs/charsets/<i><whatever was there></i></tt>.
Install the new fonts in these directorues as described above.
<p>
Then create the fontserver configuration file, say, <tt>$HOME/fs/xfs.cfg</tt>.
The sample contents (supposing that my <tt>$HOME</tt> is equal to <tt>/home/babkin</tt>)
is:
<p>
<!
--------------8<----------- cut here -----------------------------
>
<hr>
<tt>
# font server configuration file
<br>
# $XConsortium: config.cpp,v 1.7 91/08/22 11:39:59 rws Exp $
<br>
<br>
rasterizers = /usr/lib/X11/fs/ufstrast.sl,/usr/lib/X11/fs/iforast.sl
<br>
<br>
clone-self = off
<br>
use-syslog = off
<br>
catalogue = /home/babkin/fs/type1.st
<br>
# in decipoints
<br>
default-point-size = 120
<br>
default-resolutions = 100,100,75,75
<br>
port=9000
<br>
error-file=/home/babkin/fs/fs.err
</tt>
<hr>
<!
--------------8<----------- cut here -----------------------------
>
<p>
Then create the script to start your font server, say, <tt>$HOME/fs/runme</tt>:
<p>
<!
--------------8<----------- cut here -----------------------------
>
<hr>
<tt>
TYPE1_CODEPAGE_DIR=$HOME/fs/charsets
<br>
export TYPE1_CODEPAGE_DIR
<br>
kill `ps -ef | grep $HOME/\[f\]s/xfs.cfg | awk '{print $2}'`;
<br>
nohup xfs -config $HOME/fs/xfs.cfg &
</tt>
<hr>
<!
--------------8<----------- cut here -----------------------------
>
<p>
Don't forget to make <tt>$HOME/fs/runme</tt> executable. Then you can
execute it manually or from you .profile.
<p>
After you get your font server running, just execute the following
command (with proper host name and port number) in your X session
<p>
<blockquote><tt>
xset fp+ tcp/somehost:9000
</tt></blockquote>
to get the access to your private font server. You can add this
information to the configuration data of your X server or just
put it also into your .profile. In the latter case the best way
to do that would be like:
<p>
<!
--------------8<----------- cut here -----------------------------
>
<hr>
<tt>
...
<br>
$HOME/fs/runme
<br>
sleep 2 # give it some time to start
<br>
xset fp+ tcp/somehost:9000
<br>
...
</tt>
<hr>
<!
--------------8<----------- cut here -----------------------------
>
<p>
</BODY>
</HTML>
--- NEW FILE: FONTS.html ---
<HTML>
<HEAD>
<TITLE>
The ttf2pt1 font installation guide
</TITLE>
</HEAD>
<BODY>
Sergey A. Babkin
<br>
<A HREF="mailto:babkin at users.sourceforge.net">
<babkin at bellatlantic.net></A> or <A HREF="mailto:sab123 at hotmail.com"><sab123 at hotmail.com></A>
<p>
<!
(Do not edit this file, it is generated from FONTS.html!!!)
>
<!-- =defdoc cv ttf2pt1_convert 1 -->
<!-- =defdoc gs ttf2pt1_x2gs 1 -->
<H2>
THE FONT INSTALLATION GUIDE
<br>
for the TTF to Type1 converter and fonts generated by it
</H2>
<!
========================================================
>
There is historically a number of problems with the support of the 8-bit
character encodings. This installation guide pays a lot of attention
to the 8-bit issues, because these issues are responsible for the
most of troubles during the installation of fonts. But they are
not the only things covered in this guide, so it's worth reading
even if all you need is plain ASCII. For convenience of reading
I have marked the paragraphs dealing solely with 8-bit problems
with characters <FONT COLOR="#3333FF"><FONT SIZE=-1>*8*</FONT></FONT>.
<p>
To simplify this installation the distribution package of the
converter contains a number of scripts written in shell and
Perl. So, to run them you will need a shell interpreter (Bourne-shell,
POSIX-shell, Korn-shell are OK, ba-shell is probably also OK but not
tested yet). The Perl scripts were tested with Perl5 but probably
should work with Perl4 too. All the scripts are located in the
`scripts' subdirectory.
<p>
This guide considers the following issues of installation of the
fonts:
<p>
<b>
<ul>
<li> <A HREF="#X11">X11</A><br>
<li> <A HREF="#gs">Ghostscript</A><br>
<li> <A HREF="#win">MS Windows</A><br>
<li> <A HREF="#netscape">Netscape Navigator/Communicator</A><br>
<li> <A HREF="#rpm">Linux RPM package</A><br>
<li> <A HREF="#framemaker">FrameMaker</A><br>
<li> <A HREF="#soffice">StarOffice</A><br>
</ul>
</b><p>
<A NAME="X11"></A>
<H3>
X11
</H3>
<!
===
>
<!-- =section cv NAME -->
<!-- =text B<ttf2pt1_convert> - convenience font conversion script -->
<!-- =stop -->
To simplify the conversion a set of scripts is provided with <b>ttf2pt1</b>.
They are collected in the `<TT>scripts</TT>' subdirectory.
<p>
<!-- =section cv DESCRIPTION -->
`<b>Convert</b>' is the master conversion script provided with ttf2pt1.
When installed into a public directory it's named `<b>ttf2pt1_convert</b>'
to avoid name collisions with the other programs.
<p>
<!-- =stop -->
It's called as:
<p>
<!-- =section cv SYNOPSIS -->
<!-- =text ttf2pt1_convert B<[config-file]> -->
<!-- =stop -->
<blockquote>
convert <i>[config-file]</i>
</blockquote>
<!-- =section cv DESCRIPTION -->
If the configuration file is not specified as an argument then the file
`<TT>convert.cfg</TT>' in the current directory is used. This file contains
a set of configuration variables. The distribution contains a sample file
file `<TT>convert.cfg.sample</TT>'. Please copy it to `<TT>convert.cfg</TT>',
look inside it and change the configuration variables. The more stable
configuration variables, such as the path names of the scripts and
encoding files are located in `<TT>convert</TT>' itself, they are
automatically updated when installing <b>ttf2pt1</b>.
<p>
Put all the TTF fonts you want to convert into some directory (this
may be just the directory that already contains all the Windows
fonts on a mounted FAT filesystem). If you have fonts in different
source encoding then put the fonts in each of the encodings
into a separate directory. Up to 10 source directories are
supported. If you (in a rather unlikely case) have more source
directories then you can make two separate runs of the converter,
converting up to 10 directories at a time.
<p>
The variables in the configuration file are:
<p>
<!-- ==over 2 -->
<!-- ==item * -->
<B><tt>SRCDIRS</tt></B> - the list of directories (with absolute paths) with
TTF fonts. Each line contains at least 3 fields: the name of the directory,
the language of the fonts in it (if you have fonts for different
languages you have to put them into the separate directories) and the
encoding of the fonts. Again, if you have some of the TTF typefaces in
one encoding, and some in another (say, CP-1251 and KOI-8), you have
to put them into the separate source directories. Some lines may contain
4 fields. Then the fourth field is the name of the external map to
convert the Unicode fonts into the desirable encoding. This map is
used instead of the built-in map for the specified language.
<p>
<FONT COLOR="#3333FF"><FONT SIZE=-1>*8*</FONT></FONT>
An interesting thing is that some languages have more than one
widely used character encodings. For example, the widely used
encodings for Russian are IBM CP-866 (MS-DOS and Unix), KOI-8
(Unix and VAX, also the standard Internet encoding), IBM CP-1251 (MS Windows).
That's why I have provided the means to generate the converted fonts
in more than one encoding. See the file <A HREF="encodings/README.html">encodings/README</A> for
details about the encoding tables. Actually, if you plan to use
these fonts with Netscape Navigator better use the aliases
cp-866 instead of ibm-866 and windows-1251 instead of ibm-1251
because that's what Netscape wants.
<p>
<!-- ==item * -->
<b><tt>DSTDIR</tt></b> - directory for the resulting Type1 fonts. Be careful!
This directory gets completely wiped out before conversion,
so don't use any already existing directory for this purpose.
<p>
<!-- ==item * -->
<b><tt>DSTENC<i>{language}</i></tt></b> - the list of encodings in which the destination
fonts will be generated for each language. Each font of that
language will be generated in each of the specified
encodings. If you don't want any translation, just specify both
<tt>SRCENC</tt> and <tt>DSTENC</tt> as iso8859-1 (or if you want any other encoding
specified in the fonts.dir, copy the description of 8859-1 with
new name and use this new name for <tt>SRCENC</tt> and <tt>DSTENC</tt>).
<p>
<!-- ==item * -->
<b><tt>FOUNDRY</tt></b> - the foundry name to be used in the fonts.dir file. I have
set it to `fromttf' to avoid name conflicts with any existing font for
sure. But this foundry name is not registered in X11 standards and
if you want to get the full standard compliance or have a font server
that enforces such a compliance, use `misc'.
<p>
<!-- ==back -->
The next few parameters control the general behavior of the converter.
They default values are set to something reasonable.
<p>
<!-- ==over 2 -->
<!-- ==item * -->
<b><tt>CORRECTWIDTH</tt></b> - if the value is set to <b><tt>YES</tt></b> then use the
converter option <tt><b>-w</b></tt>, otherwise don't use it. See the description of
this option in the <A HREF="README.html">README</A> file.
<p>
<!-- ==item * -->
<b><tt>REMOVET1A</tt></b> - if the value is set to <b><tt>YES</tt></b> then after
conversion remove the un-encoded <tt>.t1a</tt> font files and the
intermediate <tt>.xpfa</tt> font metric files.
<p>
<!-- ==item * -->
<b><tt>INSTALLFONTMAP</tt></b> - a Ghostscript parameter, if the value is set to
<b><tt>YES</tt></b> then install the entries for the new fonts
right into the main <tt>Fontmap</tt> file. Otherwise just leave
the file <tt>Fontmap.ttf</tt> in the Ghostscript configuration
directory.
<p>
<!-- ==item * -->
<b><tt>HINTSUBST</tt></b> - if the value is set to <b><tt>YES</tt></b> use the option
<tt><b>-H</b></tt>, otherwise don't use it. This option enables the
hint substitution technique. If you have not installed the X11 patch
described above, use this option with great caution. See further
description of this option in the <A HREF="README.html">README</A> file.
<p>
<!-- ==item * -->
<b><tt>ENFORCEISO</tt></b> - if the value is set to <b><tt>YES</tt></b> then
disguise the resulting fonts as the fonts in ISOLatin1 encoding. Historically
this was neccessary due to the way the installer scripts created the
X11 font configuration files. It is not neccessary any more for this
purpose. But if you plan to use these fonts with some other application
that expects ISOLatin1 encoding then better enable this option.
<p>
<!-- ==item * -->
<b><tt>ALLGLYPHS</tt></b> - if the value is set to <b><tt>YES</tt></b> then
include all the glyphs from the source fonts into the resulting fonts, even
if these glyphs are inaccessible. If it's set to <b><tt>NO</tt></b> then
include only the glyphs which have codes assigned to them. The glyphs
without codes can not be used directly. But some clever programs,
such as the Type 1 library from XFree86 3.9 and higher can change
the encoding on the fly and use another set of glyphs. If you have not
installed the X11 patch described above, use this option with great
caution. See further description of the option option <tt><b>-a</b></tt> in the
<A HREF="README.html">README</A> file.
<p>
<!-- ==item * -->
<b><tt>GENUID</tt></b> - if the value is set to <b><tt>YES</tt></b> then use
the option <tt><b>-uA</b></tt> of the converter to generate UniqueIDs for
the converted fonts. The standard X11 Type 1 library does not use
this ID, so it may only be neccessary for the other applications.
The script is clever enough to generate different UniqueID for the
same font converted to multiple encodings. Also after conversion it
checks all the fonts generacted during the session for duplicated
UniqueID and shows those. Still, this does not quarantee that these
UniqueIDs won't overlap with some other fonts. The UniqueIDs are
generated as hash values from the font names, so it's guaranteed
that if the `<tt>convert</tt>' script runs multiple times it will
generate the same UniqueIDs during each run. See further description
of this option in the <A HREF="README.html">README</A> file.
<p>
<!-- ==item * -->
<b><tt>GENUID</tt></b> - if the value is set to <b><tt>YES</tt></b> then create
the <tt>.pfb</tt> files, otherwise the <tt>.pfa</tt> files. The <tt>.pfb</tt>
files are more compact but contain binary data, so you may experience some
troubles when transferring them through the network.
<p>
<!-- ==back -->
The following parameters are used to locate the other scripts and
configuration files. By default the scripts do a bit of guessing for them:
they search in the <b>ttf2pt1</b> installation directory if <b>ttf2pt1</b>
was installed or otherwise suppose that you are running `<tt>convert</tt>' with
`<tt>scripts</tt>' subdirectory being the current directory.
<p>
<!-- ==over 2 -->
<!-- ==item * -->
<b><tt>ENCDIR</tt></b> - directory containing the descriptions of encodings
<br>
<!-- ==item * -->
<b><tt>MAPDIR</tt></b> - directory containing the external map files
<p>
<!-- ==back -->
Besides that a few parameters are built into the `<tt>convert</tt>' script itself.
You probably won't need to change them:
<p>
<!-- ==over 2 -->
<!-- ==item * -->
<tt><b>T1ASM</b></tt>, <tt><b>TTF2PT1</b></tt>, <tt><b>TRANS</b></tt>, <tt><b>T1FDIR</b></tt>, <tt><b>FORCEISO</b></tt> - paths to the other script
<p>
<!-- ==back -->
Also there are a few parameters controlling the installation of
fonts for Ghostscript. Please look at their description in the
<A HREF="#gs">Ghostscript</a> section of documentation or in the <b>ttf2pt1_x2gs(1)</b>
manual page before running `<tt>convert</tt>'. If these parameters are
set, `<tt>convert</tt>' will call the `<tt>x2gs</tt>' script automatically
to install the newly converted fonts in Ghostscript.
<p>
After creating the configuration file run the `<tt>convert</tt>' script. Look at
the result and the log file in <tt>DSTDIR</tt>.
<p>
Add the directory with newly converted fonts to the configuration
of X server or font server. For most of the systems this step is
very straightforward. For HP-UX it's rather tricky and poorly
documented, so the file <A HREF="FONTS.hpux.html">FONTS.hpux</A> gives a short description.
<p>
If you don't have the privileges of the root user, you still can
configure your private font server. Just use some non-standard
port number (see <A HREF="FONTS.hpux.html">FONTS.hpux</A> for an example, exept that you won't
need all the HP-related stuff on any other system).
<p>
<!-- =stop -->
<H4>
Known Problems
</H4>
<!
--------------
>
<!-- =section cv BUGS -->
<!-- ==head2 Known problems -->
<ul>
<li> One catch is that the X11 Type 1 font library has a rather low limit
on the font size. Because of this the fonts with more complicated
outlines and the enabled hint substitution may not fit into
this limit. The same applies to the fonts with very complicated
outlines or with very many glyphs (especially the fonts with
over 256 glyphs). So you will need to excercise caution with
these options if you plan using these fonts with X11. Some vendors
such as HP provide the Type 1 implementation licensed from Adobe
which should have no such problem.
<p>
But there is a solution even for the generic X11. A patch located
in the subdirectory `<tt>app/X11</tt>' fixes this problem as well
as some other minor problems. Its description is provided in
<A HREF="app/X11/README.html">app/X11/README</A>.
<p>
To fix the X11 font library, you have to get the X11 sources. I
can recommend the ftp sites of the XFree86 project <A HREF="ftp://ftp.xfree86.org">ftp://ftp.xfree86.org</A>
or of the Open Group <A HREF="ftp://ftp.x.org">ftp://ftp.x.org</A>. This patch was made on the sources
of XFree86 so you may have better success with applying it to the
XFree86 distribution. After you have got the sources, make sure
that you can compile them. Then apply the patch as described.
Make sure that it was applied properly. Compile the sources again
(actually, you need only the fonts library, the fonts server, and
possibly the X server). It would be prudent now to save your old
font library, font server and, possibly, X server. Then install
the new recently compiled versions of these files. Of course,
if you know someone who already has compiled these files for the
same OS as yours, you can just copy the binary fles from him.
<p>
Alas, building the X11 system from the source code is not the
easiest thing in the world and if you have no experience it
can be quite difficult. In this case just avoid the aforementioned
features or check each converted font to make sure that it
works properly.
<p>
<li> The Type1 font library from the standard X11 distribution
does not work on HP-UX (at least, up to 10.01). The font server
supplied with HP-UX up to 10.01 is also broken. Starting from
HP-UX 10.20 (I don't know about 10.10) they supply a proprietary font
library and the converted fonts work fine with it, provided that
they are configured properly (see the file <A HREF="FONTS.hpux.html">FONTS.hpux</A>).
<p>
<li> The <tt>fonts.scale</tt> files created by the older versions of the
<tt>ttf2pt1</tt> installation program (up to release 3.1) have conflicted
with the language definitions of the <tt>Xfsft</tt> font server and
parts of it included into XFree86. To overcome this incompatibility
the never versions creats the <tt>fonts.scale</tt> file describing all the
fonts as belonging to the <tt>adobe-fontspecific</tt> encoding and
the <tt>fonts.alias</tt> file with the proper names. The drawback of
this solution is that <tt>xlsfonts</tt> gives the list of twice more
fonts. But as a side effect the option <tt><b>ENFORCEISO</b></tt> in
`<tt>convert.cfg</tt>' is not required for X11 any more.
<p>
<li> The conversion script has no support for Eastern multi-plane fonts.
Contribution of such a support would be welcome.
<p>
</ul>
<!-- =stop -->
<!-- =section cv FILES -->
<!-- ==over 2 -->
<!-- ==item * -->
<!-- =text TTF2PT1_SHAREDIR/scripts/convert.cfg.sample -->
<!-- ==item * -->
<!-- =text TTF2PT1_SHAREDIR/scripts/* -->
<!-- ==item * -->
<!-- =text TTF2PT1_SHAREDIR/README -->
<!-- ==item * -->
<!-- =text TTF2PT1_SHAREDIR/FONTS -->
<!-- ==item * -->
<!-- =text TTF2PT1_SHAREDIR/* -->
<!-- ==item * -->
<!-- =text TTF2PT1_BINDIR/ttf2pt1 -->
<!-- ==back -->
<!-- =stop -->
<!-- =section cv SEE ALSO -->
<!-- ==over 4 -->
<!-- ==item * -->
<!-- =text L<ttf2pt1(1)> -->
<!-- ==item * -->
<!-- =text L<ttf2pt1_x2gs(1)> -->
<!-- ==item * -->
<!-- =text L<t1asm(1)> -->
<!-- ==back -->
<!-- =stop -->
<A NAME="gs"></A>
<H3>
Ghostscript
</H3>
<!
===========
>
<!-- =section gs NAME -->
<!-- =text B<ttf2pt1_x2gs> - font installer for Ghostscript -->
<!-- =stop -->
<!-- =section gs DESCRIPTION -->
The fonts generated with <b>ttf2pt1</b> work fine with Ghostscript by
themselves. The script `<b>x2gs</b>' (or `<b>ttf2pt1_x2gs</b>' when installed
into a public directory, to avoid name conflicts with other
programs) links the font files from the X11 direcotry into the Ghostscript
directory and automatically creates the description file (<tt>Fontmap</tt>)
in Ghostscript format.
<!-- =stop -->
It's called as:
<p>
<!-- =section gs SYNOPSIS -->
<!-- =text ttf2pt1_x2gs B<[config-file]> -->
<!-- =stop -->
<blockquote>
x2gs <i>[config-file]</i>
</blockquote>
<!-- =section gs DESCRIPTION -->
If the configuration file is not specified as an argument then the file
`<TT>convert.cfg</TT>' in the current directory is used, just like the
`<tt>convert</tt>' script does. Indeed, this configuration file is used for
both scripts.
<p>
The Ghostscript-related parameters in the configuration file are:
<p>
<b><tt>DSTDIR</tt></b> - the X11 font directory used by `<tt>x2gs</tt>' as the
source of the fonts. This parameter is common with the X11
configuration.
<p>
<b><tt>GSDIR</tt></b> - the base directory of Ghostsript. If this
parameter is set to an empty string then `<tt>convert</tt>' won't
call `<tt>x2gs</tt>'. So if you want to get only the X11 fonts
installed then set this parameter to an empty string. This
directory may vary on various system, so please check your
system and set this value accordingly before running the script.
<p>
<b><tt>GSFONTDIR</tt></b> - the font directory of Ghostscript. In the standard
Ghostscript installation it's a subdirectory of <tt>GSDIR</tt>
but some systems may use completely different directories.
<p>
<b><tt>GSCONFDIR</tt></b> - the configuration subdirectory of Ghostscript
that contains the <tt>Fontmap</tt> file.
<p>
<b><tt>INSTALLFONTMAP</tt></b> - if the value is set to <b><tt>YES</tt></b> then
install the entries for the new fonts right into the main
<tt>Fontmap</tt> file. Otherwise just leave the file <tt>Fontmap.ttf</tt>
in the Ghostscript configuration directory.
<p>
After preparing the configuration file run the script. It symbolicaly links
all the font files and creates the description file <tt>Fontmap.ttf</tt> in
<tt>GSCONDFIR</tt>. After that there are two choices.
<p>
If the option <tt>INSTALLFONTMAP</tt> was set to <tt>YES</tt> then
the font descriptions are also automatically installed into the
master <tt>Fontmap</tt> file. The script is clever enough to
detect if it was run multiple times with the same directories
and if so it replaces the old <tt>Fontmap</tt> entries with
the new ones instead of just accumulating all of them. You
may also run it multiple times for multiple X11 directories
and all the results will be properly collected in the <tt>Fontmap</tt>.
But it's your responsibility to watch that the names of the
font files don't overlap. If the X11 font directory gets
renamed then you have to remove its font entries from the
<tt>Fontmap</tt> and only after that re-run `<tt>x2gs</tt>'
for the new directory.
<p>
On the other hand if the option <tt>INSTALLFONTMAP</tt> was set to
<tt>NO</tt> then go to the <tt>GSCONFDIR</tt> directory and insert the
contents of <tt>Fontmap.ttf</tt> into the <tt>Fontmap</tt> file
manually. This step may be left manual to make the installation
a little bit more safe.
<p>
After that you may also want to redefine some of the aliases in
<tt>Fontmap</tt> to refer to the newly installed fonts.
But the redefinition of the aliases may be dangerous if the width of
characters in the new font will be different from the old font.
Alas, there is no visible solution of this problem yet.
<p>
<!-- =stop -->
<!-- =section gs FILES -->
<!-- ==over 2 -->
<!-- ==item * -->
<!-- =text TTF2PT1_SHAREDIR/scripts/convert.cfg.sample -->
<!-- ==item * -->
<!-- =text TTF2PT1_SHAREDIR/scripts/* -->
<!-- ==item * -->
<!-- =text TTF2PT1_SHAREDIR/README -->
<!-- ==item * -->
<!-- =text TTF2PT1_SHAREDIR/FONTS -->
<!-- ==item * -->
<!-- =text TTF2PT1_SHAREDIR/* -->
<!-- ==item * -->
<!-- =text TTF2PT1_BINDIR/ttf2pt1 -->
<!-- ==back -->
<!-- =stop -->
<!-- =section gs SEE ALSO -->
<!-- ==over 4 -->
<!-- ==item * -->
<!-- =text L<ttf2pt1(1)> -->
<!-- ==item * -->
<!-- =text L<ttf2pt1_convert(1)> -->
<!-- ==item * -->
<!-- =text L<t1asm(1)> -->
<!-- ==back -->
<!-- =stop -->
<A NAME="win"></A>
<H3>
MS Windows
</H3>
<!
===========
>
<b>Ttf2pt1</b> can be built on Windows either with native compiler or in
POSIX emulation mode.
<p>
Native MS Windows compilers require a different way to build the converter
instead of the Makefile (their <tt>make</tt> programs commonly are quite weird
and limited in capabilities). An example of batch file <tt>winbuild.bat</tt>
is provided for MS Visual C/C++. Probably it can be easily adapted for other
32-bit Windows and DOS compilers. The important part is to define the
preprocessor symbol WINDOWS during compilation.
<p>
Cygnus <tt>make</tt> almost supports full Makefiles but not quite. Seems
like its POSIX support is also of the same quality "almost but not quite".
So another command file <tt>cygbuild.sh</tt> is provided for Cygnus GNU C, also
with the preprocessor symbol WINDOWS defined. It is intended to be run from
the Cygnus BASH shell. To run the programs produced by the Cygnus compiler
the Cygnus library file <tt>CYGWIN1.DLL</tt> should be copied first into
<tt>C:\WINDOWS</tt>.
<p>
To run the accompanying scripts Perl for Windows will be required as well as
other tools from the Cygnus set.
<p>
The Windows support was not particularly tested, so in case of problems with
building or running the converter please let us know.
<p>
The pre-built code (possibly of an older version) of ttf2pt1 for MS Windows is
available from the GnuWin32 project from
<A HREF="http://gnuwin32.sourceforge.net/packages/ttf2pt1.htm">http://gnuwin32.sourceforge.net/packages/ttf2pt1.htm</A>
<p>
<A NAME="netscape"></a>
<H3>
Netscape Navigator/Communicator
</H3>
<!
===============================
>
Basically, the biggest problem with Netscape Navigator is that
it has built-in fixed PostScript font names and built-in fixed
glyph tables for them. Oh, no, that's two! Let's start over:
basically the two biggest problems of Netscape Navigator are
that (one)it has built-in fixed PostScript font names and (two)
built-in fixed glyph tables for them and (three) it always
assumes that the fonts have ISOLatin1 encoding. OK, let's
start over again: basically the three biggest problems of Netscape
Navigator are that (one) it has built-in fixed PostScript font names,
(two) built-in fixed glyph tables for them and (three) it always
assumes that the fonts have ISOLatin1 encoding and (four) it
does not remember the scaled font size between the sessions.
You did not expect such a Spanish Inquisition, did you ? (<A HREF="#nsfn1">*</a>)
<p>
Luckily, we have solutions for all of these problems. They are
located in the subdirectory `<tt>app/netscape</tt>' and described
in <A HREF="app/netscape/README.html">app/netscape/README</a>.
<p>
<A NAME="nsfn1"></a>
-------<br>
<FONT SIZE=-1>*) See Monty Python's Flying Circus, episode 15</FONT></FONT>
<p>
<FONT COLOR="#3333FF"><FONT SIZE=-1>*8*</FONT></FONT>
<H4>
Netscape and cyrillic fonts<br>
<!
---------------------------
>
(courtesy of Zvezdan Petkovic)
</H4>
If you use TrueType fonts in your X, as I do, and you always get
KOI8-R encoded pages, then your Netscape does not recognise windows-1251
encoding. Microsoft TrueType fonts simply declare all encodings they
can support including KOI8-R. For some reason, KOI8-R always wins over
ISO-8859-5 in Netscape under X. If you are reading other cyrillic
languages besides Russian, you might want to either erase KOI8-R entries
from the fonts.dir and fonts.scale files, or alternatively fix Netscape.
I put this line in my .Xdefaults.
<p>
<blockquote><tt>
Netscape*documentFonts.charset*koi8-r: iso-8859-5
</tt></blockquote>
<p>
Notice that you can still read Russian sites without trouble because
Netscape translates KOI8-R to ISO-8859-5 on the fly. I read both Russian
and Serbian sites with no trouble.
<p>
<b>Note:</b> <i>If anybody knows the way to tell Netscape under Unix how to
recognise {windows,ibm,cp}-1251 encoded fonts, I'd like to hear about that.</i>
<p>
<A NAME="rpm"></a>
<H3>
Linux RPM package
</H3>
<!
=================
>
The spec file for the creation of a Linux RPM package is located in
<tt>app/RPM</tt>. It has been contributed by Johan Vromans. When
<tt>make all</tt> is ran in the main directory it among the other
things creates the version of itself adapted to Linux in <tt>app/RPM</tt>,
you may want to copy that version back to the main directory.
<p>
<B>Warning:</B> Please note that the install section is incomplete, and
the installed scripts won't work until the paths inside them
are corrected.
<p>
<A NAME="framemaker"></a>
<H3>
FrameMaker
</H3>
<!
==========
>
The fonts and AFM files generated by the version 3.2 and higher
should work with Framemaker without problems. The AFM files
generated by the previous versions of the converter require a
line added to them:
<p>
<tt>EncodingScheme FontSpecific</tt>
<p>
And the underscores in the font names of the font and AFM files
generated by the older versions may need to be changed to dashes.
<p>
<B>NOTE by Jason Baietto:</B> Ignore the directions in the Frame on-line docs
that say to put a "serverdict begin 0 exitserver" line in the pfa files.
Doing this caused both my printer and ghostscript to choke on the resulting
output from FrameMaker, so I would not advise doing this (though your
mileage may vary).
<p>
<A NAME="soffice"></a>
<H3>
StarOffice
</H3>
<!
==========
>
StarOffice 5.1x has been reported to crash if the <tt>.afm</tt> file contains
spaces in the values of such statements as <b>Version</b>, <b>Weight</b> etc.
These spaces are permitted by the Adobe spec, so this is a problem of
StarOffice. The easiest way to fix these <tt>.afm</tt> files for StarOffice
is to remove spaces in these strings or remove these strings (in case if
they are optional) at all. This can be done automatically with a <tt>sed</tt>
script. It seems that StarOffice 5.2 has this problem fixed, so we decided to
spend no efforts on providing workarounds for 5.1 with <tt>ttf2pt1</tt>.
<p>
</BODY>
</HTML>
--- NEW FILE: Makefile ---
# This file should be configured before running `make'.
# Uncomment or change the values that are relevant for your OS.
# The preferred C compiler (by default use the OS-specific default value).
# For BSD/OS, FreeBSD, Linux (all flavors), NetBSD, OpenBSD the default
# compiler is GNU C.
# (Note please the politically correct ordering by alphabet ! :-)
#
# Use GNU C even if it's not the default compiler
#
#CC=gcc
#
# Use the standard ANSI C compiler on HP-UX even if it's not default
#
#CC=c89
#
# The system-dependent flags for the C compiler
#
# Default
CFLAGS_SYS= -O
# For GNU C
#
#CFLAGS_SYS= -O2
#
# For GNU C with long options support library (Linux etc.)
#
#CFLAGS_SYS= -O2 -D_GNU_SOURCE
#
# For GNU C on HP-UX/PA-RISC 1.1
#
#CFLAGS_SYS= -O2 -Wa,-w
#
# For the standard ANSI C on HP-UX
#
#CFLAGS_SYS= +O2 -D_HPUX_SOURCE
#
# The system-dependent libraries
#
# Defalut (for the BSD-style OSes)
LIBS_SYS= -lm
# For SystemV (such as SCO, UnixWare, Solaris, but _NOT_ Linux or HP-UX)
#
#LIBS_SYS= -lm -lsocket
#
# The flags for C compiler for the FreeType-2 library (disabled by default).
# This WON'T BUILD with FT2-beta8, use the FreeType release 2.0.4
# http://download.sourceforge.net/freetype/freetype-2.0.4.tar.gz
CFLAGS_FT=
# To enable use of the FreeType-2 library
# (if the include and lib directory do not match your installation,
# modify them), also uncomment LIBS_FT
#
#CFLAGS_FT = -DUSE_FREETYPE -I/usr/local/include/freetype2 -I/usr/local/include
#
# The FreeType-2 library flags (disabled by default)
LIBS_FT=
# To enable use of the FreeType-2 library
# (if the include and lib directory do not match your installation,
# modify them), also uncomment CFLAGS_FT
#
#LIBS_FT= -L/usr/local/lib -lfreetype
#
# The flags for C compiler for the Autotrace library (disabled by default).
# USE OF THIS FEATURE IS STRONGLY DISCOURAGED, THE BUILT-IN TRACING
# (AKA VECTORIZATION) PROVIDES MUCH BETTER RESULTS.
# The tested version is 0.29a (and the fonts produced with it are
# absolutely not usable).
# http://download.sourceforge.net/autotrace/autotrace-0.29.tar.gz
CFLAGS_AT=
# To enable use of the Autotrace library
# (if the include and lib directory do not match your installation,
# modify them), also uncomment LIBS_AT
#
#CFLAGS_AT = -DUSE_AUTOTRACE -I/usr/local/include
#
# The Autotrace library flags (disabled by default)
LIBS_AT=
# To enable use of the Autotrace library
# (if the include and lib directory do not match your installation,
# modify them), also uncomment CFLAGS_AT
#
#LIBS_AT= -L/usr/local/lib -lautotrace
#
# Preference of front-ends if multiple parsers match a file
# (by default the build-in front-end takes preference over FreeType)
CFLAGS_PREF=
# To prefer FreeType (if enabled):
#
#CFLAGS_PREF= -DPREFER_FREETYPE
# Uncomment the second line to not compile t1asm into ttf2pt1
CFLAGS_EXTT1ASM=
#CFLAGS_EXTT1ASM= -DEXTERNAL_T1ASM
CFLAGS= $(CFLAGS_SYS) $(CFLAGS_FT) $(CFLAGS_AT) $(CFLAGS_PREF)
LIBS= $(LIBS_SYS) $(LIBS_FT) $(LIBS_AT)
# Installation-related stuff
#
# The base dir for installation and subdirs in it
INSTDIR = /usr/local
# for binaries
BINDIR = $(INSTDIR)/bin
# for binaries of little general interest
LIBXDIR = $(INSTDIR)/libexec/ttf2pt1
# for scripts, maps/encodings etc.
SHAREDIR = $(INSTDIR)/share/ttf2pt1
MANDIR = $(INSTDIR)/man
# owner and group of installed files
OWNER = root
GROUP = bin
# After you have configured the Makefile, comment out the following
# definition:
warning: docs
@echo >&2
@echo " You have to configure the Makefile before running make!" >&2
@echo "(or if you are lazy and hope that it will work as is run \`make all')">&2
@echo >&2
DOCS=CHANGES README FONTS FONTS.hpux encodings/README other/README \
app/X11/README app/netscape/README app/TeX/README
SUBDIRS = app encodings maps scripts other
TXTFILES = README* FONTS* CHANGES* COPYRIGHT
MANS1=ttf2pt1.1 ttf2pt1_convert.1 ttf2pt1_x2gs.1
MANS=$(MANS1) $(MANS5)
all: t1asm ttf2pt1 docs mans rpm
docs: $(DOCS)
mans: $(MANS)
clean:
rm -f t1asm ttf2pt1 *.o app/RPM/Makefile app/RPM/*.spec *.core core.* core
( cd other && make clean; )
( cd app/netscape && make clean; )
veryclean: clean
rm -f $(DOCS) $(MANS)
rpm: app/RPM/Makefile app/RPM/ttf2pt1.spec
ttf2pt1.1: README.html
scripts/html2man . . <README.html
ttf2pt1_convert.1 ttf2pt1_x2gs.1: FONTS.html
scripts/html2man . . <FONTS.html
app/RPM/Makefile: Makefile
sed 's/^CFLAGS_SYS.*=.*$$/CFLAGS_SYS= -O2 -D_GNU_SOURCE/;/warning:/,/^$$/s/^/#/' <Makefile >app/RPM/Makefile
app/RPM/ttf2pt1.spec: app/RPM/ttf2pt1.spec.src version.h
sed 's/^Version:.*/Version: '`grep TTF2PT1_VERSION version.h| cut -d\" -f2`'/' <app/RPM/ttf2pt1.spec.src >$@
t1asm: t1asm.c
$(CC) $(CFLAGS) -o t1asm -DSTANDALONE t1asm.c $(LIBS)
ttf2pt1.o: ttf2pt1.c ttf.h pt1.h global.h version.h
$(CC) $(CFLAGS) -c ttf2pt1.c
pt1.o: pt1.c ttf.h pt1.h global.h
$(CC) $(CFLAGS) -c pt1.c
ttf.o: ttf.c ttf.h pt1.h global.h
$(CC) $(CFLAGS) -c ttf.c
ft.o: ft.c pt1.h global.h
$(CC) $(CFLAGS) -c ft.c
bdf.o: bdf.c pt1.h global.h
$(CC) $(CFLAGS) -c bdf.c
bitmap.o: bitmap.c pt1.h global.h
$(CC) $(CFLAGS) -c bitmap.c
runt1asm.o: runt1asm.c global.h
$(CC) $(CFLAGS) $(CFLAGS_EXTT1ASM) -c runt1asm.c
ttf2pt1: ttf2pt1.o pt1.o runt1asm.o ttf.o ft.o bdf.o bitmap.o
$(CC) $(CFLAGS) -o ttf2pt1 ttf2pt1.o pt1.o runt1asm.o ttf.o ft.o bdf.o bitmap.o $(LIBS)
CHANGES: CHANGES.html
scripts/unhtml <CHANGES.html >CHANGES
README: README.html
scripts/unhtml <README.html >README
encodings/README: encodings/README.html
scripts/unhtml <encodings/README.html >encodings/README
other/README: other/README.html
scripts/unhtml <other/README.html >other/README
app/X11/README: app/X11/README.html
scripts/unhtml <app/X11/README.html >app/X11/README
app/netscape/README: app/netscape/README.html
scripts/unhtml <app/netscape/README.html >app/netscape/README
app/TeX/README: app/TeX/README.html
scripts/unhtml <app/TeX/README.html >app/TeX/README
FONTS: FONTS.html
scripts/unhtml <FONTS.html >FONTS
FONTS.hpux: FONTS.hpux.html
scripts/unhtml <FONTS.hpux.html >FONTS.hpux
install: all
scripts/inst_dir $(BINDIR) $(OWNER) $(GROUP) 0755
scripts/inst_dir $(LIBXDIR) $(OWNER) $(GROUP) 0755
scripts/inst_dir $(SHAREDIR) $(OWNER) $(GROUP) 0755
scripts/inst_dir $(MANDIR)/man1 $(OWNER) $(GROUP) 0755
scripts/inst_dir $(MANDIR)/man5 $(OWNER) $(GROUP) 0755
cp -R $(TXTFILES) $(SUBDIRS) $(SHAREDIR)
chown -R $(OWNER) $(SHAREDIR)
chgrp -R $(GROUP) $(SHAREDIR)
chmod -R go-w $(SHAREDIR)
scripts/inst_file ttf2pt1 $(BINDIR)/ttf2pt1 $(OWNER) $(GROUP) 0755
[ -f $(BINDIR)/t1asm ] || scripts/inst_file t1asm $(LIBXDIR)/t1asm $(OWNER) $(GROUP) 0755
sed 's|^TTF2PT1_BINDIR=$$|TTF2PT1_BINDIR=$(BINDIR)|;\
s|^TTF2PT1_LIBXDIR=$$|TTF2PT1_LIBXDIR=$(LIBXDIR)|;\
s|^TTF2PT1_SHAREDIR=$$|TTF2PT1_SHAREDIR=$(SHAREDIR)|;' <scripts/convert >cvt.tmp
scripts/inst_file cvt.tmp $(BINDIR)/ttf2pt1_convert $(OWNER) $(GROUP) 0755
scripts/inst_file cvt.tmp $(SHAREDIR)/scripts/convert $(OWNER) $(GROUP) 0755
rm cvt.tmp
scripts/inst_file scripts/x2gs $(BINDIR)/ttf2pt1_x2gs $(OWNER) $(GROUP) 0755
for i in $(MANS1); do { \
sed 's|TTF2PT1_BINDIR|$(BINDIR)|;\
s|TTF2PT1_LIBXDIR|$(LIBXDIR)|;\
s|TTF2PT1_SHAREDIR|$(SHAREDIR)|;' <$$i >$(MANDIR)/man1/$$i \
&& chown $(OWNER) $(MANDIR)/man1/$$i \
&& chgrp $(GROUP) $(MANDIR)/man1/$$i \
&& chmod 0644 $(MANDIR)/man1/$$i \
|| exit 1; \
} done
uninstall:
rm -f $(BINDIR)/ttf2pt1 $(BINDIR)/ttf2pt1_convert $(BINDIR)/ttf2pt1_x2gs
rm -rf $(LIBXDIR)
rm -rf $(SHAREDIR)
for i in $(MANS1); do { \
rm -f $(MANDIR)/man1/$$i $(MANDIR)/man1/$$i.gz; \
} done
# targets for automatic generation of releases and snapshots
snapshot:
scripts/mkrel snapshot
release:
scripts/mkrel release
--- NEW FILE: README.FIRST ---
To get the plain-text README and installation guides run:
make docs
--- NEW FILE: README.html ---
<HTML>
<HEAD>
<TITLE>
TTF2PT1 - A True Type to PostScript Type 1 Converter
</TITLE>
</HEAD>
<BODY>
<!-- =defdoc t1 ttf2pt1 1 -->
<H2>
<!-- =section t1 NAME -->
TTF2PT1 - A True Type to PostScript Type 1 Font Converter
<!-- =stop -->
</H2>
<!
(Do not edit this file, it is generated from README.html!!!)
>
<TT>
[
[...1143 lines suppressed...]
blindly as replacements for Adobe Times-Roman and Helvetica. You can get
expanded versions of MS fonts from Microsoft's web site which do contain
these ligatures (and a lot else besides).
<p>
I deal with (2) by creating new character names. This can be error-prone
because I do not know which of them is the correct glyph to give the
name to. Some (buggy) fonts have large numbers of blank glyphs, all with
the same name.
<p>
(almost every TrueType font has three glyphs called <tt>.notdef</tt>, one of them
is usually an empty square shape, one has no outline and has zero width,
and one has no outline and a positive width. This example is not really
a problem with well formed fonts since the <tt>.notdef</tt> characters are only
used for unprintable characters, which shouldn't occur in your documents
anyway).
<p>
</BODY>
</HTML>
--- NEW FILE: bdf.c ---
/*
* The font parser for the BDF files
*
* Copyright (c) 2001 by the TTF2PT1 project
* Copyright (c) 2001 by Sergey Babkin
*
* see COPYRIGHT for the full copyright notice
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "pt1.h"
#include "global.h"
/* prototypes of call entries */
static void openfont(char *fname, char *arg);
static void closefont( void);
static int getnglyphs ( void);
static int glnames( GLYPH *glyph_list);
static void readglyphs( GLYPH *glyph_list);
static int glenc( GLYPH *glyph_list, int *encoding, int *unimap);
static void fnmetrics( struct font_metrics *fm);
static void glpath( int glyphno, GLYPH *glyph_list);
static void kerning( GLYPH *glyph_list);
/* globals */
/* front-end descriptor */
struct frontsw bdf_sw = {
/*name*/ "bdf",
/*descr*/ "BDF bitmapped fonts",
/*suffix*/ { "bdf" },
/*open*/ openfont,
/*close*/ closefont,
/*nglyphs*/ getnglyphs,
/*glnames*/ glnames,
/*glmetrics*/ readglyphs,
/*glenc*/ glenc,
/*fnmetrics*/ fnmetrics,
/*glpath*/ glpath,
/*kerning*/ kerning,
};
/* statics */
#define MAXLINE 10240 /* maximal line length in the input file */
static int lineno; /* line number */
#define GETLEN(s) s, (sizeof(s)-1)
#define LENCMP(str, txt) strncmp(str, txt, sizeof(txt)-1)
static FILE *bdf_file;
static int nglyphs;
static struct font_metrics fmet;
/* many BDF fonts are of small pixel size, so we better try
* to scale them by an integer to keep the dimensions in
* whole pixels. However if the size is too big and a non-
* integer scaling is needed, we use the standard ttf2pt1's
* scaling abilities.
*/
static int pixel_size;
static int scale;
static int scale_external;
static char *slant;
static char xlfdname[201];
static char *spacing;
static char *charset_reg;
static char *charset_enc;
static char *fnwidth;
static int is_unicode = 0;
/* tempoary storage for returning data to ttf2pt1 later on request */
static int maxenc = 0;
static int *fontenc;
static GENTRY **glpaths;
static int got_glyphs = 0;
static GLYPH *glyphs;
static int curgl;
static int readfile(FILE *f, int (*strfunc)(int len, char *str));
/*
* Read the file and parse each string with strfunc(),
* until strfunc() returns !=0 or the end of file happens.
* Returns -1 on EOF or strfunc() returning <0, else 0
*/
static int
readfile(
FILE *f,
int (*strfunc)(int len, char *str)
)
{
static char str[MAXLINE]; /* input line, maybe should be dynamic ? */
char *s;
int len, c, res;
len=0;
while(( c=getc(f) )!=EOF) {
if(c=='\n') {
str[len]=0;
res = strfunc(len, str);
lineno++;
if(res<0)
return -1;
else if(res!=0)
return 0;
len=0;
} else if(len<MAXLINE-1) {
if(c!='\r')
str[len++]=c;
} else {
fprintf(stderr, "**** bdf: line %d is too long (>%d)\n", lineno, MAXLINE-1);
exit(1);
}
}
return -1; /* EOF */
}
/*
* Parse the header of the font file.
* Stop after the line CHARS is encountered. Ignore the unknown lines.
*/
struct line {
char *name; /* property name with trailing space */
int namelen; /* length of the name string */
enum {
ALLOW_REPEAT = 0x01, /* this property may be repeated in multiple lines */
IS_SEEN = 0x02, /* this property has been seen already */
MUST_SEE = 0x04, /* this property must be seen */
IS_LAST = 0x08 /* this is the last property to be read */
} flags;
char *fmt; /* format string for the arguments, NULL means a string arg */
int nvals; /* number of values to be read by sscanf */
void *vp[4]; /* pointers to values to be read */
};
static struct line header[] = {
{ GETLEN("FONT "), 0, " %200s", 1, {&xlfdname} },
{ GETLEN("SIZE "), MUST_SEE, " %d", 1, {&pixel_size} },
{ GETLEN("FONTBOUNDINGBOX "), MUST_SEE, " %hd %hd %hd %hd", 4,
{&fmet.bbox[2], &fmet.bbox[3], &fmet.bbox[0], &fmet.bbox[1]} },
{ GETLEN("FAMILY_NAME "), MUST_SEE, NULL, 1, {&fmet.name_family} },
{ GETLEN("WEIGHT_NAME "), MUST_SEE, NULL, 1, {&fmet.name_style} },
{ GETLEN("COPYRIGHT "), 0, NULL, 1, {&fmet.name_copyright} },
{ GETLEN("SLANT "), MUST_SEE, NULL, 1, {&slant} },
{ GETLEN("SPACING "), 0, NULL, 1, {&spacing} },
{ GETLEN("SETWIDTH_NAME "), 0, NULL, 1, {&fnwidth} },
{ GETLEN("CHARSET_REGISTRY "), 0, NULL, 1, {&charset_reg} },
{ GETLEN("CHARSET_ENCODING "), 0, NULL, 1, {&charset_enc} },
{ GETLEN("FONT_ASCENT "), 0, " %hd", 1, {&fmet.ascender} },
{ GETLEN("FONT_DESCENT "), 0, " %hd", 1, {&fmet.descender} },
/* these 2 must go in this order for post-processing */
{ GETLEN("UNDERLINE_THICKNESS "), 0, " %hd", 1, {&fmet.underline_thickness} },
{ GETLEN("UNDERLINE_POSITION "), 0, " %hd", 1, {&fmet.underline_position} },
{ GETLEN("CHARS "), MUST_SEE|IS_LAST, " %d", 1, {&nglyphs} },
{ NULL, 0, 0 } /* end mark: name==NULL */
};
static int
handle_header(
int len,
char *str
)
{
struct line *cl;
char *s, *p;
int c;
#if 0
fprintf(stderr, "line: %s\n", str);
#endif
for(cl = header; cl->name != 0; cl++) {
if(strncmp(str, cl->name, cl->namelen))
continue;
#if 0
fprintf(stderr, "match: %s\n", cl->name);
#endif
if(cl->flags & IS_SEEN) {
if(cl->flags & ALLOW_REPEAT)
continue;
fprintf(stderr, "**** input line %d redefines the property %s\n", lineno, cl->name);
exit(1);
}
cl->flags |= IS_SEEN;
if(cl->fmt == 0) {
s = malloc(len - cl->namelen + 1);
if(s == 0) {
fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__);
exit(255);
}
*((char **)(cl->vp[0])) = s;
/* skip until a quote */
for(p = str+cl->namelen; (c = *p)!=0; p++) {
if(c == '"') {
p++;
break;
}
}
for(; (c = *p)!=0; p++) {
if(c == '"') {
c = *++p;
if(c == '"')
*s++ = c;
else
break;
} else
*s++ = c;
}
*s = 0; /* end of line */
} else {
c = sscanf(str+cl->namelen, cl->fmt, cl->vp[0], cl->vp[1], cl->vp[2], cl->vp[3]);
if(c != cl->nvals) {
fprintf(stderr, "**** property %s at input line %d must have %d arguments\n",
cl->name, lineno, cl->nvals);
exit(1);
}
}
if(cl->flags & IS_LAST)
return 1;
else
return 0;
}
return 0;
}
/*
* Parse the description of the glyphs
*/
static int
handle_glyphs(
int len,
char *str
)
{
static int inbmap=0;
static char *bmap;
static int xsz, ysz, xoff, yoff;
static int curln;
int i, c;
char *p, *plim, *psz;
if(!LENCMP(str, "ENDFONT")) {
if(curgl < nglyphs) {
fprintf(stderr, "**** unexpected end of font file after %d glyphs\n", curgl);
exit(1);
} else
return 1;
}
if(curgl >= nglyphs) {
fprintf(stderr, "**** file contains more glyphs than advertised (%d)\n", nglyphs);
exit(1);
}
if(!LENCMP(str, "STARTCHAR")) {
/* sizeof will count \0 instead of ' ' */
for(i=sizeof("STARTCHAR"); str[i] == ' '; i++)
{}
glyphs[curgl].name = strdup(str + i);
if(glyphs[curgl].name == 0) {
fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__);
exit(255);
}
} else if(!LENCMP(str, "ENCODING")) {
if(sscanf(str, "ENCODING %d", &fontenc[curgl])!=1) {
fprintf(stderr,"**** weird ENCODING statement at line %d\n", lineno);
exit(1);
}
if(fontenc[curgl] == -1) /* compatibility format */
sscanf(str, "ENCODING -1 %d", &fontenc[curgl]);
if(fontenc[curgl] > maxenc)
maxenc = fontenc[curgl];
} else if(!LENCMP(str, "DWIDTH")) {
if(sscanf(str, "DWIDTH %d %d", &xsz, &ysz)!=2) {
fprintf(stderr,"**** weird DWIDTH statement at line %d\n", lineno);
exit(1);
}
glyphs[curgl].width = xsz*scale;
} else if(!LENCMP(str, "BBX")) {
if(sscanf(str, "BBX %d %d %d %d", &xsz, &ysz, &xoff, &yoff)!=4) {
fprintf(stderr,"**** weird BBX statement at line %d\n", lineno);
exit(1);
}
bmap=malloc(xsz*ysz);
if(bmap==0) {
fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__);
exit(255);
}
glyphs[curgl].lsb = -xoff*scale;
glyphs[curgl].xMin = -xoff*scale;
glyphs[curgl].xMax = (xsz-xoff)*scale;
glyphs[curgl].yMin = -yoff*scale;
glyphs[curgl].yMax = (ysz-xoff)*scale;
} else if(!LENCMP(str, "BITMAP")) {
inbmap=1;
curln=ysz-1; /* the lowest line has index 0 */
} else if(!LENCMP(str, "ENDCHAR")) {
inbmap=0;
if(bmap) {
glyphs[curgl].lastentry = 0;
glyphs[curgl].path = 0;
glyphs[curgl].entries = 0;
bmp_outline(&glyphs[curgl], scale, bmap, xsz, ysz, xoff, yoff);
free(bmap);
/* remember in a static table or it will be erased */
glpaths[curgl] = glyphs[curgl].entries;
glyphs[curgl].entries = 0;
if(glpaths[curgl])
glyphs[curgl].ttf_pathlen = 1;
else
glyphs[curgl].ttf_pathlen = 0;
}
curgl++;
} else if(inbmap) {
if(curln<0) {
fprintf(stderr,"**** bitmap is longer than %d lines at line %d\n", ysz, lineno);
exit(1);
}
i=0;
p=&bmap[curln*xsz]; psz=p+xsz;
while(i<len) {
c=str[i++];
if(!isxdigit(c)) {
fprintf(stderr,"**** non-hex digit in bitmap at line %d\n", lineno);
exit(1);
}
if(c<='9')
c-='0';
else
c= tolower(c)-'a'+10;
for(plim=p+4; p<psz && p<plim; c<<=1)
*p++ = (( c & 0x08 )!=0);
}
if(p<psz) {
fprintf(stderr,"**** bitmap line is too short at line %d\n", lineno);
exit(1);
}
curln--;
}
return 0;
}
/*
* Read all the possible information about the glyphs
*/
static void
readglyphs(
GLYPH *glyph_list
)
{
int i;
GLYPH *g;
if(got_glyphs)
return;
/* pass them to handle_glyphs() through statics */
glyphs = glyph_list;
curgl = 2; /* skip the empty glyph and .notdef */
/* initialize the empty glyph and .notdef */
for(i=0; i<2; i++) {
g = &glyphs[i];
g->lsb = 0;
g->width = fmet.bbox[2];
g->xMin = 0;
g->yMin = 0;
}
g = &glyphs[0];
g->name = ".notdef";
g->xMax = fmet.bbox[2]*4/5;
g->yMax = fmet.bbox[3]*4/5;
g->entries = g->path = g->lastentry = 0;
/* make it look as a black square */
fg_rmoveto(g, 0.0, 0.0);
fg_rlineto(g, 0.0, (double)g->yMax);
fg_rlineto(g, (double)g->xMax, (double)g->yMax);
fg_rlineto(g, (double)g->xMax, 0.0);
fg_rlineto(g, 0.0, 0.0);
g_closepath(g);
glpaths[0] = g->entries;
g->entries = 0;
g->ttf_pathlen = 4;
g = &glyphs[1];
g->name = ".null";
g->xMax = g->yMax = 0;
g->ttf_pathlen = 0;
if(readfile(bdf_file, handle_glyphs) < 0) {
fprintf(stderr, "**** file does not contain the ENDFONT line\n");
exit(1);
}
got_glyphs = 1;
}
/*
* Open font and prepare to return information to the main driver.
* May print error and warning messages.
* Exit on error.
*/
static void
openfont(
char *fname,
char *arg /* unused now */
)
{
struct line *cl;
int i, l;
if ((bdf_file = fopen(fname, "r")) == NULL) {
fprintf(stderr, "**** Cannot open file '%s'\n", fname);
exit(1);
} else {
WARNING_2 fprintf(stderr, "Processing file %s\n", fname);
}
lineno = 1;
for(cl = header; cl->name != 0; cl++)
cl->flags &= ~IS_SEEN;
if(readfile(bdf_file, handle_header) < 0) {
fprintf(stderr, "**** file does not contain the CHARS definition\n");
exit(1);
}
for(cl = header; cl->name != 0; cl++) {
if( (cl->flags & MUST_SEE) && !(cl->flags & IS_SEEN) ) {
fprintf(stderr, "**** mandatory property %sis not found in the input line\n",
cl->name); /* cl->name has a space at the end */
exit(1);
}
/* set a few defaults */
if( !(cl->flags & IS_SEEN) ) {
if(cl->vp[0] == &fmet.underline_thickness) {
fmet.underline_thickness = 1;
} else if(cl->vp[0] == &fmet.underline_position) {
fmet.underline_position = fmet.bbox[1] + fmet.underline_thickness
- (pixel_size - fmet.bbox[3]);
} else if(cl->vp[0] == &fmet.ascender) {
fmet.ascender = fmet.bbox[2] + fmet.bbox[0];
} else if(cl->vp[0] == &fmet.descender) {
fmet.descender = fmet.bbox[0];
}
}
}
nglyphs += 2; /* add empty glyph and .notdef */
/* postprocessing to compensate for the differences in the metric formats */
fmet.bbox[2] += fmet.bbox[0];
fmet.bbox[3] += fmet.bbox[1];
scale = 1000/pixel_size; /* XXX ? */
if(scale*pixel_size < 950) {
scale = 1;
scale_external = 1;
fmet.units_per_em = pixel_size;
} else {
scale_external = 0;
fmet.units_per_em = scale*pixel_size;
fmet.underline_position *= scale;
fmet.underline_thickness *= scale;
fmet.ascender *= scale;
fmet.descender *= scale;
for(i=0; i<4; i++)
fmet.bbox[i] *= scale;
}
fmet.italic_angle = 0.0;
if(spacing == 0 /* possibly an old font */
|| toupper(spacing[0]) != 'P') /* or anything non-proportional */
fmet.is_fixed_pitch = 1;
else
fmet.is_fixed_pitch = 0;
if(fmet.name_copyright==NULL)
fmet.name_copyright = "";
/* create the full name */
l = strlen(fmet.name_family)
+ (fmet.name_style? strlen(fmet.name_style) : 0)
+ (fnwidth? strlen(fnwidth) : 0)
+ strlen("Oblique") + 1;
if(( fmet.name_full = malloc(l) )==NULL) {
fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__);
exit(255);
}
strcpy(fmet.name_full, fmet.name_family);
if(fnwidth && strcmp(fnwidth, "Normal")) {
strcat(fmet.name_full, fnwidth);
}
if(fmet.name_style && strcmp(fmet.name_style, "Medium")) {
strcat(fmet.name_full, fmet.name_style);
}
switch(toupper(slant[0])) {
case 'O':
strcat(fmet.name_full, "Oblique");
break;
case 'I':
strcat(fmet.name_full, "Italic");
break;
}
fmet.name_ps = fmet.name_full;
fmet.name_version = "1.0";
if(charset_reg && charset_enc
&& !strcmp(charset_reg, "iso10646") && !strcmp(charset_enc, "1"))
is_unicode = 1;
if(( fontenc = calloc(nglyphs, sizeof *fontenc) )==NULL) {
fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__);
exit(255);
}
for(i=0; i<nglyphs; i++)
fontenc[i] = -1;
if(( glpaths = calloc(nglyphs, sizeof *glpaths) )==NULL) {
fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__);
exit(255);
}
}
/*
* Close font.
* Exit on error.
*/
static void
closefont(
void
)
{
if(fclose(bdf_file) < 0) {
WARNING_1 fprintf(stderr, "Errors when closing the font file, ignored\n");
}
}
/*
* Get the number of glyphs in font.
*/
static int
getnglyphs (
void
)
{
return nglyphs;
}
/*
* Get the names of the glyphs.
* Returns 0 if the names were assigned, non-zero if the font
* provides no glyph names.
*/
static int
glnames(
GLYPH *glyph_list
)
{
readglyphs(glyph_list);
return 0;
}
/*
* Get the original encoding of the font.
* Returns 1 for if the original encoding is Unicode, 2 if the
* original encoding is other 16-bit, 0 if 8-bit.
*/
static int
glenc(
GLYPH *glyph_list,
int *encoding,
int *unimap
)
{
int i, douni, e;
if(is_unicode || forcemap)
douni = 1;
else
douni = 0;
for(i=0; i<nglyphs; i++) {
e = fontenc[i];
if(douni)
e = unicode_rev_lookup(e);
if(e>=0 && e<ENCTABSZ && encoding[e] == -1)
encoding[e] = i;
}
if(is_unicode)
return 1;
else if(maxenc > 255)
return 2;
else
return 0;
}
/*
* Get the font metrics
*/
static void
fnmetrics(
struct font_metrics *fm
)
{
*fm = fmet;
}
/*
* Get the path of contrours for a glyph.
*/
static void
glpath(
int glyphno,
GLYPH *glyf_list
)
{
readglyphs(glyf_list);
glyf_list[glyphno].entries = glpaths[glyphno];
glpaths[glyphno] = 0;
}
/*
* Get the kerning data.
*/
static void
kerning(
GLYPH *glyph_list
)
{
return; /* no kerning in BDF */
}
--- NEW FILE: bitmap.c ---
/*
* Handling of the bitmapped glyphs
*
* Copyright (c) 2001 by the TTF2PT1 project
* Copyright (c) 2001 by Sergey Babkin
*
* see COPYRIGHT for the full copyright notice
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "pt1.h"
#include "global.h"
/* possible values of limits */
#define L_NONE 0 /* nothing here */
#define L_ON 1 /* black is on up/right */
#define L_OFF 2 /* black is on down/left */
[...2594 lines suppressed...]
for(y=ysz-1; y>=0; y--) {
for(x=0; x<xsz; x++) {
if(amp[y*xsz+x])
putchar('!'); /* ambigouos point is always on a limit */
else
putchar(v_char[ vlm[y*(xsz+1)+x] & (L_ON|L_OFF) ]);
putchar(h_char[ hlm[(y+1)*xsz+x] & (L_ON|L_OFF) ]);
}
putchar(v_char[ vlm[y*(xsz+1)+x] & (L_ON|L_OFF) ]);
putchar('\n');
}
/* last line */
for(x=0; x<xsz; x++) {
putchar(' ');
putchar(h_char[ hlm[x] & (L_ON|L_OFF) ]);
}
putchar(' ');
putchar('\n');
}
#endif /* 0 */
--- NEW FILE: byteorder.h ---
/*
* see COPYRIGHT
*/
/* This defines the macroes ntohs and ntohl, which convert short and long
ints from network order (used on 68000 chips, and in TrueType font
files) to whatever order your computer uses. #define _BIG_ENDIAN or not
to control which set of definitions apply. If you don't know, try both. If
you have a peculiar machine you're on your own.
*/
#if defined(_BIG_ENDIAN)
#define ntohl(x) (x)
#define ntohs(x) (x)
#else
#define ntohs(x) \
((USHORT)((((USHORT)(x) & 0x00ff) << 8) | \
(((USHORT)(x) & 0xff00) >> 8)))
#define ntohl(x) \
((ULONG)((((ULONG)(x) & 0x000000ffU) << 24) | \
(((ULONG)(x) & 0x0000ff00U) << 8) | \
(((ULONG)(x) & 0x00ff0000U) >> 8) | \
(((ULONG)(x) & 0xff000000U) >> 24)))
#endif
--- NEW FILE: cygbuild.sh ---
:
# this file should be run from Cygnus BASH
# file to build ttf2pt1 with Cygnus GCC on Windows
# don't forget to copy CYGWIN1.DLL into C:\WINDOWS
gcc -o ttf2pt1 -DWINDOWS ttf2pt1.c pt1.c t1asm.c ttf.c -lm
gcc -o t1asm -DWINDOWS -DSTANDALONE t1asm.c
--- NEW FILE: ft.c ---
/*
* The font parser using the FreeType library version 2.
*
* see COPYRIGHT
*
*/
#ifdef USE_FREETYPE
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/types.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_TRUETYPE_TABLES_H
#include FT_BBOX_H
#include FT_GLYPH_H
#include FT_CONFIG_CONFIG_H
#include FT_CONFIG_OPTIONS_H
#include FT_ERRORS_H
#include FT_SYSTEM_H
#include FT_IMAGE_H
#include FT_TYPES_H
#include FT_OUTLINE_H
#include FT_MODULE_H
#include FT_RENDER_H
#include FT_TYPE1_TABLES_H
#include FT_TRUETYPE_IDS_H
#include FT_TRUETYPE_TAGS_H
#include FT_MULTIPLE_MASTERS_H
#include FT_SFNT_NAMES_H
#ifdef XP_PSTEXT
#include "os.h"
#include "Xproto.h"
#include "font.h"
#include "fontstruct.h"
#include "fntfilst.h"
#include "fontutil.h"
#include "fontenc.h"
#include "ft.h"
#include "ftfuncs.h"
#endif /* XP_PSTEXT */
#include "pt1.h"
#include "global.h"
/* prototypes of call entries */
static void openfont(char *fname, char *arg);
static void closefont( void);
static int getnglyphs ( void);
static int glnames( GLYPH *glyph_list);
static void glmetrics( GLYPH *glyph_list);
static int glenc( GLYPH *glyph_list, int *encoding, int *unimap);
static void fnmetrics( struct font_metrics *fm);
static void glpath( int glyphno, GLYPH *glyph_list);
static void kerning( GLYPH *glyph_list);
/* globals */
/* front-end descriptor */
struct frontsw freetype_sw = {
/*name*/ "ft",
/*descr*/ "based on the FreeType2 library",
/*suffix*/ { "ttf", "ttc", "otf", "otc", "pfa", "pfb" },
/*open*/ openfont,
/*close*/ closefont,
/*nglyphs*/ getnglyphs,
/*glnames*/ glnames,
/*glmetrics*/ glmetrics,
/*glenc*/ glenc,
/*fnmetrics*/ fnmetrics,
/*glpath*/ glpath,
/*kerning*/ kerning,
};
/* statics */
static char * dupcnstring( unsigned char *s, int len);
#ifndef XP_PSTEXT
static FT_Library library;
#endif /* !XP_PSTEXT */
static FT_Face face;
static int enc_type, enc_found;
/* SFNT functions do not seem to be included by default in FT2beta8 */
#define ENABLE_SFNT
/*
* Open font and prepare to return information to the main driver.
* May print error and warning messages.
* Exit on error.
*/
static void
openfont(
char *fname,
char *arg /* unused now */
)
{
FT_Error error;
#ifdef XP_PSTEXT
extern FT_Face xp_pstext_ft_face;
extern FT_Library ftypeLibrary; /* defined in xc/lib/font/FreeType/ftfuncs.c */
face = xp_pstext_ft_face;
#else
if( FT_Init_FreeType( &library ) ) {
fprintf(stderr, "** FreeType initialization failed\n");
exit(1);
}
if( error = FT_New_Face( library, fname, 0, &face ) ) {
if ( error == FT_Err_Unknown_File_Format )
fprintf(stderr, "**** %s has format unknown to FreeType\n", fname);
else
fprintf(stderr, "**** Cannot access %s ****\n", fname);
exit(1);
}
#endif /* XP_PSTEXT */
if(FT_HAS_FIXED_SIZES(face)) {
WARNING_1 fprintf(stderr, "Font contains bitmaps\n");
}
if(FT_HAS_MULTIPLE_MASTERS(face)) {
WARNING_1 fprintf(stderr, "Font contains multiple masters, using default\n");
}
if(ISDBG(FT)) fprintf(stderr," %d units per EM\n", face->units_per_EM);
enc_found = 0;
}
/*
* Close font.
* Exit on error.
*/
static void
closefont(
void
)
{
#ifdef XP_PSTEXT
/* NOP */
#else
if( FT_Done_Face(face) ) {
WARNING_1 fprintf(stderr, "Errors when closing the font file, ignored\n");
}
if( FT_Done_FreeType(library) ) {
WARNING_1 fprintf(stderr, "Errors when stopping FreeType, ignored\n");
}
#endif /* XP_PSTEXT */
}
/*
* Get the number of glyphs in font.
*/
static int
getnglyphs (
void
)
{
if(ISDBG(FT)) fprintf(stderr, "%d glyphs in font\n", face->num_glyphs);
return (int)face->num_glyphs;
}
/*
* Get the names of the glyphs.
* Returns 0 if the names were assigned, non-zero if the font
* provides no glyph names.
*/
static int
glnames(
GLYPH *glyph_list
)
{
#define MAX_NAMELEN 1024
#ifdef XP_PSTEXT
char buf[1024];
long i;
FT_Error error;
#ifdef XP_ONLY_BLOCKS
extern unsigned long xp_font_block_offset;
extern FTFontPtr xp_xtf;
int bc; /* block counter */
/* FixMe: This code should use PsOut_Get_FreeType_Glyph_Name() instead of
* duplicating the code
*/
for( bc = xp_font_block_offset ; bc < (xp_font_block_offset+256) ; bc++ ) {
/* Remap X11 font index to FreeType font index */
i = FTRemap(face, &xp_xtf->mapping, bc);
if( i >= face->num_glyphs )
continue;
#else
for(i=0; i < face->num_glyphs; i++) {
#endif /* XP_ONLY_BLOCKS */
if( FT_Has_PS_Glyph_Names(face) ) {
error = FT_Get_Glyph_Name(face, i, buf, MAX_NAMELEN);
}
else
{
error = -1;
}
if( error ) {
/* Check for unicode mapping
* See Adobe document "Unicode and Glyph Names"
* (http://partners.adobe.com/asn/tech/type/unicodegn.jsp)
*/
if( (xp_xtf->mapping.mapping->type == FONT_ENCODING_UNICODE) &&
(i < 0xFFFE) )
{
sprintf(buf, "uni%04lx", i);
}
else
{
sprintf(buf, "ch%02lx", i);
}
}
glyph_list[i].name = strdup(buf);
if(ISDBG(FT)) fprintf(stderr, "%d has name %s\n", i, buf);
if (glyph_list[i].name == NULL) {
fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__);
exit(255);
}
}
return 0;
#else
char bf[1024];
long i;
if( ! FT_HAS_GLYPH_NAMES(face) ) {
WARNING_1 fprintf(stderr, "Font has no glyph names\n");
return 1;
}
for(i=0; i < face->num_glyphs; i++) {
if( FT_Get_Glyph_Name(face, i, bf, MAX_NAMELEN) || bf[0]==0 ) {
sprintf(bf, "_g_%d", i);
WARNING_2 fprintf(stderr,
"Glyph No. %d has no postscript name, becomes %s\n", i, bf);
}
glyph_list[i].name = strdup(bf);
if(ISDBG(FT)) fprintf(stderr, "%d has name %s\n", i, bf);
if (glyph_list[i].name == NULL) {
fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__);
exit(255);
}
}
return 0;
#endif /* XP_PSTEXT */
}
/*
* Get the metrics of the glyphs.
*/
static void
glmetrics(
GLYPH *glyph_list
)
{
GLYPH *g;
int i;
FT_Glyph_Metrics *met;
FT_BBox bbox;
FT_Glyph gly;
#ifdef XP_ONLY_BLOCKS
extern unsigned long xp_font_block_offset;
extern FTFontPtr xp_xtf;
int bc; /* block counter */
for( bc = xp_font_block_offset ; bc < (xp_font_block_offset+256) ; bc++ ) {
/* Remap X11 font index to FreeType font index */
i = FTRemap(face, &xp_xtf->mapping, bc);
if( i >= face->num_glyphs )
continue;
#else
for(i=0; i < face->num_glyphs; i++) {
#endif /* XP_ONLY_BLOCKS */
g = &(glyph_list[i]);
if( FT_Load_Glyph(face, i, FT_LOAD_NO_BITMAP|FT_LOAD_NO_SCALE) ) {
fprintf(stderr, "Can't load glyph %s, skipped\n", g->name);
continue;
}
met = &face->glyph->metrics;
if(FT_HAS_HORIZONTAL(face)) {
g->width = met->horiAdvance;
g->lsb = met->horiBearingX;
} else {
WARNING_2 fprintf(stderr, "Glyph %s has no horizontal metrics, guessed them\n", g->name);
g->width = met->width;
g->lsb = 0;
}
if( FT_Get_Glyph(face->glyph, &gly) ) {
fprintf(stderr, "Can't access glyph %s bbox, skipped\n", g->name);
continue;
}
FT_Glyph_Get_CBox(gly, ft_glyph_bbox_unscaled, &bbox);
g->xMin = bbox.xMin;
g->yMin = bbox.yMin;
g->xMax = bbox.xMax;
g->yMax = bbox.yMax;
g->ttf_pathlen = face->glyph->outline.n_points;
}
}
/*
* Get the original encoding of the font.
* Returns 1 for if the original encoding is Unicode, 2 if the
* original encoding is other 16-bit, 0 if 8-bit.
*/
static int
glenc(
GLYPH *glyph_list,
int *encoding,
int *unimap
)
{
#ifdef XP_PSTEXT
int i,
e;
unsigned code;
extern FTFontPtr xp_xtf;
extern unsigned long xp_font_block_offset;
enc_found = 1;
enc_type = 0;
for(i=0; i<ENCTABSZ; i++) {
if(encoding[i] != -1)
continue;
/* Remap X11 font index to FreeType font index */
code = FTRemap(face, &xp_xtf->mapping, xp_font_block_offset+i);
if(code == 0)
continue; /* .notdef */
encoding[i] = code;
}
return enc_type;
#else
int i, e;
unsigned code;
if(ISDBG(FT))
for(e=0; e < face->num_charmaps; e++) {
fprintf(stderr, "found encoding pid=%d eid=%d\n",
face->charmaps[e]->platform_id,
face->charmaps[e]->encoding_id);
}
if(enc_found)
goto populate_map;
enc_type = 0;
/* first check for an explicit PID/EID */
if(force_pid != -1) {
for(e=0; e < face->num_charmaps; e++) {
if(face->charmaps[e]->platform_id == force_pid
&& face->charmaps[e]->encoding_id == force_eid) {
WARNING_1 fprintf(stderr, "Found Encoding PID=%d/EID=%d\n",
force_pid, force_eid);
if( FT_Set_Charmap(face, face->charmaps[e]) ) {
fprintf(stderr, "**** Cannot set charmap in FreeType ****\n");
exit(1);
}
enc_type = 1;
goto populate_map;
}
}
fprintf(stderr, "*** TTF encoding table PID=%d/EID=%d not found\n",
force_pid, force_eid);
exit(1);
}
/* next check for a direct Adobe mapping */
if(!forcemap) {
for(e=0; e < face->num_charmaps; e++) {
if(face->charmaps[e]->encoding == ft_encoding_adobe_custom) {
WARNING_1 fputs("Found Adobe Custom Encoding\n", stderr);
if( FT_Set_Charmap(face, face->charmaps[e]) ) {
fprintf(stderr, "**** Cannot set charmap in FreeType ****\n");
exit(1);
}
goto populate_map;
}
}
}
for(e=0; e < face->num_charmaps; e++) {
if(face->charmaps[e]->platform_id == 3) {
switch(face->charmaps[e]->encoding_id) {
case 0:
WARNING_1 fputs("Found Symbol Encoding\n", stderr);
break;
case 1:
WARNING_1 fputs("Found Unicode Encoding\n", stderr);
enc_type = 1;
break;
default:
WARNING_1 {
fprintf(stderr,
"****MS Encoding ID %d not supported****\n",
face->charmaps[e]->encoding_id);
fputs("Treating it like Symbol encoding\n", stderr);
}
break;
}
break;
}
}
if(e >= face->num_charmaps) {
WARNING_1 fputs("No Microsoft encoding, using first encoding available\n", stderr);
e = 0;
}
if( FT_Set_Charmap(face, face->charmaps[e]) ) {
fprintf(stderr, "**** Cannot set charmap in FreeType ****\n");
exit(1);
}
populate_map:
enc_found = 1;
for(i=0; i<ENCTABSZ; i++) {
if(encoding[i] != -1)
continue;
if(enc_type == 1 || forcemap) {
code = unimap[i];
if(code == (unsigned) -1)
continue;
} else
code = i;
code = FT_Get_Char_Index(face, code);
if(0 && ISDBG(FT)) fprintf(stderr, "code of %3d is %3d\n", i, code);
if(code == 0)
continue; /* .notdef */
encoding[i] = code;
}
return enc_type;
#endif /* XP_PSTEXT */
}
/* duplicate a string with counter to a 0-terminated string */
static char *
dupcnstring(
unsigned char *s,
int len
)
{
char *res, *out;
int i, c;
static int warned=0;
if(( res = malloc(len+1) )==NULL) {
fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__);
exit(255);
}
out = res;
for(i=0; i<len; i++) {
if(( c=s[i] )>=' ' && c!=127)
*out++ = c;
else if(!warned) {
warned=1;
WARNING_1 fprintf(stderr, "Some font name strings are in Unicode, may not show properly\n");
}
}
*out = 0;
return res;
}
/*
* Get the font metrics
*/
static void
fnmetrics(
struct font_metrics *fm
)
{
char *str;
static char *fieldstocheck[3];
#ifdef ENABLE_SFNT
FT_SfntName sn;
#endif /* ENABLE_SFNT */
int i;
fm->italic_angle = 0.0; /* FreeType hides the angle */
fm->underline_position = face->underline_position;
fm->underline_thickness = face->underline_thickness;
fm->is_fixed_pitch = FT_IS_FIXED_WIDTH(face);
fm->ascender = face->ascender;
fm->descender = face->descender;
fm->units_per_em = face->units_per_EM;
fm->bbox[0] = face->bbox.xMin;
fm->bbox[1] = face->bbox.yMin;
fm->bbox[2] = face->bbox.xMax;
fm->bbox[3] = face->bbox.yMax;
#ifdef ENABLE_SFNT
if( FT_Get_Sfnt_Name(face, TT_NAME_ID_COPYRIGHT, &sn) )
#endif /* ENABLE_SFNT */
fm->name_copyright = "";
#ifdef ENABLE_SFNT
else
fm->name_copyright = dupcnstring(sn.string, sn.string_len);
#endif /* ENABLE_SFNT */
fm->name_family = face->family_name;
fm->name_style = face->style_name;
if(fm->name_style == NULL)
fm->name_style = "";
#ifdef ENABLE_SFNT
if( FT_Get_Sfnt_Name(face, TT_NAME_ID_FULL_NAME, &sn) )
#endif /* ENABLE_SFNT */
{
int len;
len = strlen(fm->name_family) + strlen(fm->name_style) + 2;
if(( fm->name_full = malloc(len) )==NULL) {
fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__);
exit(255);
}
strcpy(fm->name_full, fm->name_family);
if(strlen(fm->name_style) != 0) {
strcat(fm->name_full, " ");
strcat(fm->name_full, fm->name_style);
}
}
#ifdef ENABLE_SFNT
else
fm->name_full = dupcnstring(sn.string, sn.string_len);
#endif /* ENABLE_SFNT */
#ifdef ENABLE_SFNT
if( FT_Get_Sfnt_Name(face, TT_NAME_ID_VERSION_STRING, &sn) )
#endif /* ENABLE_SFNT */
fm->name_version = "1.0";
#ifdef ENABLE_SFNT
else
fm->name_version = dupcnstring(sn.string, sn.string_len);
#endif /* ENABLE_SFNT */
#ifdef XP_PSTEXT
{
extern const char *xp_psfontname;
fm->name_ps = strdup(xp_psfontname);
/* Handle the rare case if a family name was not provided by the TTF
* font (like Solaris TTF fonts in /usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType,
* /usr/openwin/lib/locale/ko/X11/fonts/TrueType) - in this case we
* have to generate a family name somehow... */
if(fm->name_family == NULL)
fm->name_family = fm->name_ps;
}
#else
#ifdef ENABLE_SFNT
if( FT_Get_Sfnt_Name(face, TT_NAME_ID_PS_NAME , &sn) ) {
#endif /* ENABLE_SFNT */
if(( fm->name_ps = strdup(fm->name_full) )==NULL) {
fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__);
exit(255);
}
#ifdef ENABLE_SFNT
} else
fm->name_ps = dupcnstring(sn.string, sn.string_len);
#endif /* ENABLE_SFNT */
#endif /* XP_PSTEXT */
for(i=0; fm->name_ps[i]!=0; i++)
if(fm->name_ps[i] == ' ')
fm->name_ps[i] = '_'; /* no spaces in the Postscript name *m
/* guess the boldness from the font names */
fm->force_bold=0;
fieldstocheck[0] = fm->name_style;
fieldstocheck[1] = fm->name_full;
fieldstocheck[2] = fm->name_ps;
for(i=0; !fm->force_bold && i<sizeof fieldstocheck /sizeof(fieldstocheck[0]); i++) {
str=fieldstocheck[i];
for(i=0; str[i]!=0; i++) {
if( (str[i]=='B'
|| str[i]=='b'
&& ( i==0 || !isalpha(str[i-1]) )
)
&& !strncmp("old",&str[i+1],3)
&& !islower(str[i+4])
) {
fm->force_bold=1;
break;
}
}
}
}
/*
* Functions to decompose the outlines
*/
static GLYPH *curg;
static double lastx, lasty;
static int
outl_moveto(
FT_Vector *to,
void *unused
)
{
double tox, toy;
tox = fscale((double)to->x); toy = fscale((double)to->y);
/* FreeType does not do explicit closepath() */
if(curg->lastentry) {
g_closepath(curg);
}
fg_rmoveto(curg, tox, toy);
lastx = tox; lasty = toy;
return 0;
}
static int
outl_lineto(
FT_Vector *to,
void *unused
)
{
double tox, toy;
tox = fscale((double)to->x); toy = fscale((double)to->y);
fg_rlineto(curg, tox, toy);
lastx = tox; lasty = toy;
return 0;
}
static int
outl_conicto(
FT_Vector *control1,
FT_Vector *to,
void *unused
)
{
double c1x, c1y, tox, toy;
c1x = fscale((double)control1->x); c1y = fscale((double)control1->y);
tox = fscale((double)to->x); toy = fscale((double)to->y);
fg_rrcurveto(curg,
(lastx + 2.0 * c1x) / 3.0, (lasty + 2.0 * c1y) / 3.0,
(2.0 * c1x + tox) / 3.0, (2.0 * c1y + toy) / 3.0,
tox, toy );
lastx = tox; lasty = toy;
return 0;
}
static int
outl_cubicto(
FT_Vector *control1,
FT_Vector *control2,
FT_Vector *to,
void *unused
)
{
double c1x, c1y, c2x, c2y, tox, toy;
c1x = fscale((double)control1->x); c1y = fscale((double)control1->y);
c2x = fscale((double)control2->x); c2y = fscale((double)control2->y);
tox = fscale((double)to->x); toy = fscale((double)to->y);
fg_rrcurveto(curg, c1x, c1y, c2x, c2y, tox, toy);
lastx = tox; lasty = toy;
return 0;
}
static FT_Outline_Funcs ft_outl_funcs = {
outl_moveto,
outl_lineto,
outl_conicto,
outl_cubicto,
0,
0
};
/*
* Get the path of contrours for a glyph.
*/
static void
glpath(
int glyphno,
GLYPH *glyf_list
)
{
FT_Outline *ol;
curg = &glyf_list[glyphno];
if( FT_Load_Glyph(face, glyphno, FT_LOAD_NO_BITMAP|FT_LOAD_NO_SCALE|FT_LOAD_NO_HINTING)
|| face->glyph->format != ft_glyph_format_outline ) {
fprintf(stderr, "Can't load glyph %s, skipped\n", curg->name);
return;
}
ol = &face->glyph->outline;
lastx = 0.0; lasty = 0.0;
if( FT_Outline_Decompose(ol, &ft_outl_funcs, NULL) ) {
fprintf(stderr, "Can't decompose outline of glyph %s, skipped\n", curg->name);
return;
}
/* FreeType does not do explicit closepath() */
if(curg->lastentry) {
g_closepath(curg);
}
if(ol->flags & ft_outline_reverse_fill) {
assertpath(curg->entries, __FILE__, __LINE__, curg->name);
reversepaths(curg);
}
}
/*
* Get the kerning data.
*/
static void
kerning(
GLYPH *glyph_list
)
{
int i, j, n;
int nglyphs = face->num_glyphs;
FT_Vector k;
GLYPH *gl;
if( nglyphs == 0 || !FT_HAS_KERNING(face) ) {
WARNING_1 fputs("No Kerning data\n", stderr);
return;
}
for(i=0; i<nglyphs; i++) {
if( (glyph_list[i].flags & GF_USED) ==0)
continue;
for(j=0; j<nglyphs; j++) {
if( (glyph_list[j].flags & GF_USED) ==0)
continue;
if( FT_Get_Kerning(face, i, j, ft_kerning_unscaled, &k) )
continue;
if( k.x == 0 )
continue;
addkernpair(i, j, k.x);
}
}
}
#endif
--- NEW FILE: global.h ---
/*
* see COPYRIGHT
*/
/* options */
extern int encode; /* encode the resulting file */
extern int pfbflag; /* produce compressed file */
extern int wantafm; /* want to see .afm instead of .t1a on stdout */
extern int correctvsize; /* try to correct the vertical size of characters */
extern int wantuid; /* user wants UniqueID entry in the font */
extern int allglyphs; /* convert all glyphs, not only 256 of them */
extern int warnlevel; /* the level of permitted warnings */
extern int forcemap; /* do mapping even on non-Unicode fonts */
/* options - maximal limits */
extern int max_stemdepth; /* maximal depth of stem stack in interpreter */
/* options - debugging */
extern int absolute; /* print out in absolute values */
extern int reverse; /* reverse font to Type1 path directions */
/* options - suboptions of Outline Processing */
extern int optimize; /* enables space optimization */
extern int smooth; /* enable smoothing of outlines */
extern int transform; /* enables transformation to 1000x1000 matrix */
extern int hints; /* enables autogeneration of hints */
extern int subhints; /* enables autogeneration of substituted hints */
extern int trybold; /* try to guess whether the font is bold */
extern int correctwidth; /* try to correct the character width */
extern int vectorize; /* vectorize the bitmaps */
extern int use_autotrace; /* use the autotrace library on bitmap */
/* options - suboptions of File Generation */
extern int gen_pfa; /* generate the font file */
extern int gen_afm; /* generate the metrics file */
extern int gen_dvienc; /* generate the dvips encoding file */
/* not quite options to select a particular source encoding */
extern int force_pid; /* specific platform id */
extern int force_eid; /* specific encoding id */
/* other globals */
extern FILE *null_file, *pfa_file, *afm_file, *dvienc_file;
extern int numglyphs;
/* warnings */
#define WARNING_1 if(warnlevel >= 1)
#define WARNING_2 if(warnlevel >= 2)
#define WARNING_3 if(warnlevel >= 3)
#define WARNING_4 if(warnlevel >= 4)
/*
* Bitmap control macros
*/
#define BITMAP_BYTES(size) (((size)+7)>>3)
#define DEF_BITMAP(name, size) unsigned char name[BITMAP_BYTES(size)]
#define SET_BITMAP(name, bit) ( name[(bit)>>3] |= (1<<((bit)&7)) )
#define CLR_BITMAP(name, bit) ( name[(bit)>>3] &= ~(1<<((bit)&7)) )
#define IS_BITMAP(name, bit) ( name[(bit)>>3] & (1<<((bit)&7)) )
/* debugging */
/* debug flags */
#define DEBUG_UNICODE 0x00000001 /* unicode to 8-bit code conversion */
#define DEBUG_MAINSTEMS 0x00000002 /* glyph-wide main stem generation */
#define DEBUG_SUBSTEMS 0x00000004 /* substituted stem generation */
#define DEBUG_STEMS (DEBUG_MAINSTEMS|DEBUG_SUBSTEMS)
#define DEBUG_REVERSAL 0x00000008 /* reversal of the paths */
#define DEBUG_FIXCVDIR 0x00000010 /* fixcvdir() */
#define DEBUG_STEMOVERLAP 0x00000020 /* stemoverlap() */
#define DEBUG_BLUESTEMS 0x00000040 /* markbluestems() */
#define DEBUG_STRAIGHTEN 0x00000080 /* markbluestems() */
#define DEBUG_EXTMAP 0x00000100 /* parsing of external map */
#define DEBUG_TOINT 0x00000200 /* conversion of path to integer */
#define DEBUG_BUILDG 0x00000400 /* building of glyph path */
#define DEBUG_QUAD 0x00000800 /* splitting curves by quadrants */
#define DEBUG_SQEQ 0x00001000 /* square equation solver */
#define DEBUG_COMPOSITE 0x00002000 /* handling of composite glyphs */
#define DEBUG_FCONCISE 0x00004000 /* normalization of curves */
#define DEBUG_FT 0x00008000 /* FreeType front-end */
#define DEBUG_BITMAP 0x00010000 /* conversion from bitmap */
#define DEBUG_DISABLED 0x80000000 /* special flag: temporary disable debugging */
#if 0
/* at what we want to look now */
#ifndef DEBUG
# define DEBUG (DEBUG_BITMAP)
#endif
/* uncomment the next line if debugging data is wanted for one glyph only */
#define DBG_GLYPH "C118" /* */
#endif
#if 1
# define ISDBG(name) (0)
# define ENABLEDBG(condition) (0)
# define DISABLEDBG(condition) (0)
#else
extern int debug; /* collection of the flags */
/* this ISDBG will only work on ANSI C, not K&R */
# define ISDBG(name) ( (debug & DEBUG_DISABLED) ? 0 : (debug & (DEBUG_##name)) )
# define ENABLEDBG(condition) ( (condition) ? (debug&=~DEBUG_DISABLED) : 0 )
# define DISABLEDBG(condition) ( (condition) ? (debug|=DEBUG_DISABLED) : 0 )
#endif
#ifdef DBG_GLYPH
# define DBG_TO_GLYPH(g) DISABLEDBG( strcmp( (g)->name, DBG_GLYPH ) )
# define DBG_FROM_GLYPH(g) ENABLEDBG(1)
#else
# define DBG_TO_GLYPH(g) (0)
# define DBG_FROM_GLYPH(g) (0)
#endif
/* prototypes */
int iscale( int val);
double fscale( double val);
int unicode_rev_lookup( int unival);
void bmp_outline( GLYPH *g, int scale, char *bmap,
int xsz, int ysz, int xoff, int yoff);
int isign( int x);
int fsign( double x);
/* global metrics for a font */
struct font_metrics {
/* post */
double italic_angle;
short underline_position;
short underline_thickness;
short is_fixed_pitch;
/* hhea */
short ascender;
short descender;
/* head */
unsigned short units_per_em;
short bbox[4];
/* name */
char *name_copyright;
char *name_family;
char *name_style;
char *name_full;
char *name_version;
char *name_ps;
/* other */
int force_bold;
};
/* size of the encoding table - glyphs beyond 255 are actually unnumbered */
#define ENCTABSZ 1024
/* switch table structure for front-ends */
#define MAXSUFFIX 10
struct frontsw {
char *name; /* name of the front end */
char *descr; /* description of the front end */
char *suffix[MAXSUFFIX]; /* possible file name suffixes */
void (*open)(char *fname, char *arg); /* open font file */
void (*close)(void); /* close font file */
int (*nglyphs)(void); /* get the number of glyphs */
int (*glnames)(GLYPH *glyphs); /* get the names of glyphs */
void (*glmetrics)(GLYPH *glyphs); /* get the metrics of glyphs */
int (*glenc)(GLYPH *glyphs, int *enc, int *unimap); /* get the encoding */
void (*fnmetrics)(struct font_metrics *fm); /* get the font metrics */
void (*glpath)(int glyphno, GLYPH *glyphs); /* get the glyph path */
void (*kerning)(GLYPH *glyph_list); /* extract the kerning data */
};
--- NEW FILE: pt1.c ---
/*
* see COPYRIGHT
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <ctype.h>
#include <math.h>
#ifndef WINDOWS
# include <netinet/in.h>
# include <unistd.h>
#else
# include "windows.h"
[...7333 lines suppressed...]
}
/* save the information that may be needed further */
g->ncontours = ncont;
if (ncont > 0) {
g->contours = malloc(sizeof(CONTOUR) * ncont);
if (g->contours == 0) {
fprintf(stderr, "***** Memory allocation error *****\n");
exit(255);
}
memcpy(g->contours, cont, sizeof(CONTOUR) * ncont);
}
}
#endif
/*
*
*/
--- NEW FILE: pt1.h ---
/*
* see COPYRIGHT
*/
/* glyph entry, one drawing command */
typedef struct gentry {
/* this list links all GENTRYs of a GLYPH sequentially */
struct gentry *next; /* double linked list */
struct gentry *prev;
/* this list links all GENTRYs of one contour -
* of types GE_LINE and GE_CURVE only
* bkwd is also reused: in the very first entry (normally
* of type GE_MOVE) it points to g->entries
*/
struct gentry *cntr[2]; /* double-linked circular list */
/* convenience handles */
#define bkwd cntr[0]
#define frwd cntr[1]
/* various extended structures used at some stage of transformation */
void *ext;
union {
struct {
int val[2][3]; /* integer values */
} i;
struct {
double val[2][3]; /* floating values */
} f;
} points; /* absolute values, NOT deltas */
/* convenience handles */
#define ipoints points.i.val
#define fpoints points.f.val
#define ixn ipoints[0]
#define iyn ipoints[1]
#define fxn fpoints[0]
#define fyn fpoints[1]
#define ix1 ixn[0]
#define ix2 ixn[1]
#define ix3 ixn[2]
#define iy1 iyn[0]
#define iy2 iyn[1]
#define iy3 iyn[2]
#define fx1 fxn[0]
#define fx2 fxn[1]
#define fx3 fxn[2]
#define fy1 fyn[0]
#define fy2 fyn[1]
#define fy3 fyn[2]
char flags;
#define GEF_FLOAT 0x02 /* entry contains floating point data */
#define GEF_LINE 0x04 /* entry looks like a line even if it's a curve */
unsigned char dir; /* used to temporarily store the values for
* the directions of the ends of curves */
/* front end */
#define CVDIR_FUP 0x02 /* goes over the line connecting the ends */
#define CVDIR_FEQUAL 0x01 /* coincides with the line connecting the
* ends */
#define CVDIR_FDOWN 0x00 /* goes under the line connecting the ends */
#define CVDIR_FRONT 0x0F /* mask of all front directions */
/* rear end */
#define CVDIR_RSAME 0x30 /* is the same as for the front end */
#define CVDIR_RUP 0x20 /* goes over the line connecting the ends */
#define CVDIR_REQUAL 0x10 /* coincides with the line connecting the
* ends */
#define CVDIR_RDOWN 0x00 /* goes under the line connecting the ends */
#define CVDIR_REAR 0xF0 /* mask of all rear directions */
signed char stemid; /* connection to the substituted stem group */
char type;
#define GE_HSBW 'B'
#define GE_MOVE 'M'
#define GE_LINE 'L'
#define GE_CURVE 'C'
#define GE_PATH 'P'
/* indexes of the points to be used for calculation of the tangents */
signed char ftg; /* front tangent */
signed char rtg; /* rear tangent, -1 means "idx 2 of the previous entry" */
} GENTRY;
/* stem structure, describes one [hv]stem */
/* acually, it describes one border of a stem */
/* the whole stem is a pair of these structures */
typedef struct stem {
short value; /* value of X or Y coordinate */
short origin; /* point of origin for curve stems */
GENTRY *ge; /* entry that has (value, origin) as its first dot */
/* also for all the stems the couple (value, origin)
* is used to determine whether a stem is relevant for a
* line, it's considered revelant if this tuple is
* equal to any of the ends of the line.
* ge is also used to resolve ambiguity if there is more than
* one line going through certain pointi, it is used to
* distinguish these lines.
*/
short from, to; /* values of other coordinate between
* which this stem is valid */
short flags;
/* ordering of ST_END, ST_FLAT, ST_ZONE is IMPORTANT for sorting */
#define ST_END 0x01 /* end of line, lowest priority */
#define ST_FLAT 0x02 /* stem is defined by a flat line, not a
* curve */
#define ST_ZONE 0x04 /* pseudo-stem, the limit of a blue zone */
#define ST_UP 0x08 /* the black area is to up or right from
* value */
#define ST_3 0x20 /* first stem of [hv]stem3 */
#define ST_BLUE 0x40 /* stem is in blue zone */
#define ST_TOPZONE 0x80 /* 1 - top zone, 0 - bottom zone */
#define ST_VERT 0x100 /* vertical stem (used in substitutions) */
} STEM;
#define MAX_STEMS 2000 /* we can't have more stems than path
* elements (or hope so) */
#define NSTEMGRP 50 /* maximal number of the substituted stem groups */
/* structure for economical representation of the
* substituted stems
*/
typedef struct stembounds {
short low; /* low bound */
short high; /* high bound */
char isvert; /* 1 - vertical, 0 - horizontal */
char already; /* temp. flag: is aleready included */
} STEMBOUNDS;
struct kern {
unsigned id; /* ID of the second glyph */
int val; /* kerning value */
};
typedef struct contour {
short ymin, xofmin;
short inside; /* inside which contour */
char direction;
#define DIR_OUTER 1
#define DIR_INNER 0
} CONTOUR;
typedef struct glyph {
int char_no;/* Encoding of glyph */
int orig_code;/* code of glyph in the font's original encoding */
char *name; /* Postscript name of glyph */
int xMin, yMin, xMax, yMax; /* values from TTF dictionary */
int lsb; /* left sidebearing */
int ttf_pathlen; /* total length of TTF paths */
short width;
short flags;
#define GF_USED 0x0001 /* whether is this glyph used in T1 font */
#define GF_FLOAT 0x0002 /* thys glyph contains floating point entries */
GENTRY *entries;/* doube linked list of entries */
GENTRY *lastentry; /* the last inserted entry */
GENTRY *path; /* beggining of the last path */
int oldwidth; /* actually also scaled */
int scaledwidth;
#define MAXLEGALWIDTH 10000
struct kern *kern; /* kerning data */
int kerncount; /* number of kerning pairs */
int kernalloc; /* for how many pairs we have space */
STEM *hstems; /* global horiz. and vert. stems */
STEM *vstems;
int nhs, nvs; /* numbers of stems */
STEMBOUNDS *sbstems; /* substituted stems for all the groups */
short *nsbs; /* indexes of the group ends in the common array */
int nsg; /* actual number of the stem groups */
int firstsubr; /* first substistuted stems subroutine number */
CONTOUR *contours; /* it is not used now */
int ncontours;
int rymin, rymax; /* real values */
/* do we have flat surfaces on top/bottom */
char flatymin, flatymax;
} GLYPH;
/* description of a dot for calculation of its distance to a curve */
struct dot_dist {
double p[2 /*X,Y*/]; /* coordinates of a dot */
double dist2; /* squared distance from the dot to the curve */
short seg; /* the closest segment of the curve */
};
extern int stdhw, stdvw; /* dominant stems widths */
extern int stemsnaph[12], stemsnapv[12]; /* most typical stem width */
extern int bluevalues[14];
extern int nblues;
extern int otherblues[10];
extern int notherb;
extern int bbox[4]; /* the FontBBox array */
extern double italic_angle;
extern GLYPH *glyph_list;
extern int encoding[]; /* inverse of glyph[].char_no */
/* prototypes of functions */
void rmoveto( int dx, int dy);
void rlineto( int dx, int dy);
void rrcurveto( int dx1, int dy1, int dx2, int dy2, int dx3, int dy3);
void assertpath( GENTRY * from, char *file, int line, char *name);
void fg_rmoveto( GLYPH * g, double x, double y);
void ig_rmoveto( GLYPH * g, int x, int y);
void fg_rlineto( GLYPH * g, double x, double y);
void ig_rlineto( GLYPH * g, int x, int y);
void fg_rrcurveto( GLYPH * g, double x1, double y1,
double x2, double y2, double x3, double y3);
void ig_rrcurveto( GLYPH * g, int x1, int y1,
int x2, int y2, int x3, int y3);
void g_closepath( GLYPH * g);
void pathtoint( GLYPH *g);
void ffixquadrants( GLYPH *g);
void flattencurves( GLYPH * g);
int checkcv( GENTRY * ge, int dx, int dy);
void iclosepaths( GLYPH * g);
void fclosepaths( GLYPH * g);
void smoothjoints( GLYPH * g);
void buildstems( GLYPH * g);
void fstraighten( GLYPH * g);
void istraighten( GLYPH * g, int zigonly);
void isplitzigzags( GLYPH * g);
void fsplitzigzags( GLYPH * g);
void fforceconcise( GLYPH * g);
void iforceconcise( GLYPH * g);
void reversepathsfromto( GENTRY * from, GENTRY * to);
void reversepaths( GLYPH * g);
void dumppaths( GLYPH * g, GENTRY *start, GENTRY *end);
void print_glyph( int glyphno);
int print_glyph_subs( int glyphno, int startid);
void print_glyph_metrics( int code, int glyphno);
void findblues(void);
void stemstatistics(void);
void docorrectwidth(void);
void addkernpair( unsigned id1, unsigned id2, int unscval);
void print_kerning( FILE *afm_file);
int fcrossrayscv( double curve[4][2], double *max1, double *max2);
int fcrossraysge( GENTRY *ge1, GENTRY *ge2, double *max1, double *max2,
double crossdot[2][2]);
double fdotsegdist2( double seg[2][2], double dot[2]);
double fdotcurvdist2( double curve[4][2], struct dot_dist *dots, int ndots, double *maxp);
void fapproxcurve( double cv[4][2], struct dot_dist *dots, int ndots);
--- NEW FILE: runt1asm.c ---
/*
* Wrap-around code to either compile in t1asm or call it externally
*
* Copyright (C) 2000 by Sergey Babkin
* Copyright (C) 2000 by The TTF2PT1 Project
*
* See COPYRIGHT for full license
*/
#ifdef EXTERNAL_T1ASM
#include <stdio.h>
#include <errno.h>
FILE *ifp;
FILE *ofp;
int
runt1asm(
int pfbflag
)
{
char *cmd;
int id, od;
int error;
/* first make a copy in case some of then is already stdin/stdout */
if(( id = dup(fileno(ifp)) )<0) {
perror("** Re-opening input file for t1asm");
exit(1);
}
if(( od = dup(fileno(ofp)) )<0) {
perror("** Re-opening output file for t1asm");
exit(1);
}
fclose(ifp); fclose(ofp);
close(0);
if(( dup(id) )!=0) {
perror("** Re-directing input file for t1asm");
exit(1);
}
close(1);
if(( dup(od) )!=1) {
perror("** Re-directing output file for t1asm");
exit(1);
}
close(id); close(od);
if(pfbflag)
error = execlp("t1asm", "t1asm", "-b", NULL);
else
error = execlp("t1asm", "t1asm", NULL);
perror("** Calling t1asm");
exit(1);
}
#else
# include "t1asm.c"
#endif
--- NEW FILE: t1asm.c ---
/* t1asm
*
* This program `assembles' Adobe Type-1 font programs in pseudo-PostScript
* form into either PFB or PFA format. The human readable/editable input is
* charstring- and eexec-encrypted as specified in the `Adobe Type 1 Font
* Format' version 1.1 (the `black book'). There is a companion program,
* t1disasm, which `disassembles' PFB and PFA files into a pseudo-PostScript
* file.
*
* Copyright (c) 1992 by I. Lee Hetherington, all rights reserved.
*
* Permission is hereby granted to use, modify, and distribute this program
* for any purpose provided this copyright notice and the one below remain
* intact.
*
* I. Lee Hetherington (ilh at lcs.mit.edu)
*
* Revision 1.2 92/05/22 11:54:45 ilh
* Fixed bug where integers larger than 32000 could not be encoded in
* charstrings. Now integer range is correct for four-byte
* twos-complement integers: -(1<<31) <= i <= (1<<31)-1. Bug detected by
* Piet Tutelaers (rcpt at urc.tue.nl).
*
* Revision 1.1 92/05/22 11:48:46 ilh
* initial version
*
* Ported to Microsoft C/C++ Compiler and MS-DOS operating system by
* Kai-Uwe Herbing (herbing at netmbx.netmbx.de) on June 12, 1992. Code
* specific to the MS-DOS version is encapsulated with #ifdef _MSDOS
* ... #endif, where _MSDOS is an identifier, which is automatically
* defined, if you compile with the Microsoft C/C++ Compiler.
*
*/
#ifndef lint
static char copyright[] =
"@(#) Copyright (c) 1992 by I. Lee Hetherington, all rights reserved.";
#ifdef _MSDOS
static char portnotice[] =
"@(#) Ported to MS-DOS by Kai-Uwe Herbing (herbing at netmbx.netmbx.de).";
#endif
#endif
/* Note: this is ANSI C. */
#ifdef _MSDOS
#include <fcntl.h>
#include <getopt.h>
#include <io.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#ifdef WINDOWS
# ifdef STANDALONE
# define WINDOWS_FUNCTIONS
# include "windows.h"
# endif
#endif
/* int32 must be at least 32-bit and uint16 must be at least 16-bit */
#ifndef AIXV3
#if INT_MAX >= 0x7FFFFFFFUL
typedef int int32;
#else
typedef long int32;
#endif
#endif /* !AIXV3 */
#if USHRT_MAX >= 0xFFFFUL
typedef unsigned short uint16;
#else
typedef unsigned int uint16;
#endif
#define LINESIZE 256
#define MAXBLOCKLEN ((1L<<17)-6)
#define MINBLOCKLEN ((1L<<8)-6)
#define MARKER 128
#define ASCII 1
#define BINARY 2
#define DONE 3
typedef unsigned char byte;
/* must be visible from outside */
FILE *ifp;
FILE *ofp;
/* flags */
static int pfb = 0;
static int active = 0;
static int start_charstring = 0;
static int in_eexec = 0;
static char line[LINESIZE];
/* lenIV and charstring start command */
static int lenIV = 4;
static char cs_start[10];
/* for charstring buffering */
static byte charstring_buf[65535];
static byte *charstring_bp;
/* for PFB block buffering */
static byte blockbuf[MAXBLOCKLEN];
static int32 blocklen = MAXBLOCKLEN;
static int32 blockpos = -1;
static int blocktyp = ASCII;
/* decryption stuff */
static uint16 er, cr;
static uint16 c1 = 52845, c2 = 22719;
/* table of charstring commands */
static struct command {
char *name;
int one, two;
} command_table[] = {
{ "callothersubr", 12, 16 },
{ "callsubr", 10, -1 },
{ "closepath", 9, -1 },
{ "div", 12, 12 },
{ "dotsection", 12, 0 },
{ "endchar", 14, -1 },
{ "hlineto", 6, -1 },
{ "hmoveto", 22, -1 },
{ "hsbw", 13, -1 },
{ "hstem", 1, -1 },
{ "hstem3", 12, 2 },
{ "hvcurveto", 31, -1 },
{ "pop", 12, 17 },
{ "return", 11, -1 },
{ "rlineto", 5, -1 },
{ "rmoveto", 21, -1 },
{ "rrcurveto", 8, -1 },
{ "sbw", 12, 7 },
{ "seac", 12, 6 },
{ "setcurrentpoint", 12, 33 },
{ "vhcurveto", 30, -1 },
{ "vlineto", 7, -1 },
{ "vmoveto", 4, -1 },
{ "vstem", 3, -1 },
{ "vstem3", 12, 1 },
}; /* alphabetical */
/* Two separate encryption functions because eexec and charstring encryption
must proceed in parallel. */
static byte eencrypt(byte plain)
{
byte cipher;
cipher = (byte) (plain ^ (er >> 8));
er = (uint16) ((cipher + er) * c1 + c2);
return cipher;
}
static byte cencrypt(byte plain)
{
byte cipher;
cipher = (byte) (plain ^ (cr >> 8));
cr = (uint16) ((cipher + cr) * c1 + c2);
return cipher;
}
/* This function flushes a buffered PFB block. */
static void output_block()
{
int32 i;
/* output four-byte block length */
fputc((int) (blockpos & 0xff), ofp);
fputc((int) ((blockpos >> 8) & 0xff), ofp);
fputc((int) ((blockpos >> 16) & 0xff), ofp);
fputc((int) ((blockpos >> 24) & 0xff), ofp);
/* output block data */
for (i = 0; i < blockpos; i++)
fputc(blockbuf[i], ofp);
/* mark block buffer empty and uninitialized */
blockpos = -1;
}
/* This function outputs a single byte. If output is in PFB format then output
is buffered through blockbuf[]. If output is in PFA format, then output
will be hexadecimal if in_eexec is set, ASCII otherwise. */
static void output_byte(byte b)
{
static char *hexchar = "0123456789ABCDEF";
static int hexcol = 0;
if (pfb) {
/* PFB */
if (blockpos < 0) {
fputc(MARKER, ofp);
fputc(blocktyp, ofp);
blockpos = 0;
}
blockbuf[blockpos++] = b;
if (blockpos == blocklen)
output_block();
} else {
/* PFA */
if (in_eexec) {
/* trim hexadecimal lines to 64 columns */
if (hexcol >= 64) {
fputc('\n', ofp);
hexcol = 0;
}
fputc(hexchar[(b >> 4) & 0xf], ofp);
fputc(hexchar[b & 0xf], ofp);
hexcol += 2;
} else {
fputc(b, ofp);
}
}
}
/* This function outputs a byte through possible eexec encryption. */
static void eexec_byte(byte b)
{
if (in_eexec)
output_byte(eencrypt(b));
else
output_byte(b);
}
/* This function outputs a null-terminated string through possible eexec
encryption. */
static void eexec_string(char *string)
{
while (*string)
eexec_byte((byte) *string++);
}
/* This function gets ready for the eexec-encrypted data. If output is in
PFB format then flush current ASCII block and get ready for binary block.
We start encryption with four random (zero) bytes. */
static void eexec_start()
{
eexec_string(line);
if (pfb) {
output_block();
blocktyp = BINARY;
}
in_eexec = 1;
er = 55665;
eexec_byte(0);
eexec_byte(0);
eexec_byte(0);
eexec_byte(0);
}
/* This function wraps-up the eexec-encrypted data.
If output is in PFB format then this entails flushing binary block and
starting an ASCII block. */
static void eexec_end()
{
int i, j;
if (pfb) {
output_block();
blocktyp = ASCII;
} else {
fputc('\n', ofp);
}
in_eexec = 0;
for (i = 0; i < 8; i++) {
for (j = 0; j < 64; j++)
eexec_byte('0');
eexec_byte('\n');
}
#if 0
eexec_string("cleartomark\n");
#endif
}
/* This function writes ASCII trailer.
If output is in PFB format then this entails flushing binary block and
starting an ASCII block. */
static void file_end()
{
if (pfb) {
output_block();
fputc(MARKER, ofp);
fputc(DONE, ofp);
}
}
/* This function returns an input line of characters. A line is terminated by
length (including terminating null) greater than LINESIZE, a newline \n, or
when active (looking for charstrings) by '{'. When terminated by a newline
the newline is put into line[]. When terminated by '{', the '{' is not put
into line[], and the flag start_charstring is set to 1. */
static void t1asm_getline()
{
int c;
char *p = line;
int comment = 0;
start_charstring = 0;
while (p < line + LINESIZE) {
c = fgetc(ifp);
if (c == EOF)
break;
if (c == '%')
comment = 1;
if (active && !comment && c == '{') {
start_charstring = 1;
break;
}
*p++ = (char) c;
if (c == '\n')
break;
}
*p = '\0';
}
/* This function is used by the binary search, bsearch(), for command names in
the command table. */
static int command_compare(const void *key, const void *item)
{
return strcmp((char *) key, ((struct command *) item)->name);
}
/* This function returns 1 if the string is an integer and 0 otherwise. */
static int is_integer(char *string)
{
if (isdigit(string[0]) || string[0] == '-' || string[0] == '+') {
while (*++string && isdigit(*string))
; /* deliberately empty */
if (!*string)
return 1;
}
return 0;
}
/* This function initializes charstring encryption. Note that this is called
at the beginning of every charstring. */
static void charstring_start()
{
int i;
charstring_bp = charstring_buf;
cr = 4330;
for (i = 0; i < lenIV; i++)
*charstring_bp++ = cencrypt((byte) 0);
}
/* This function encrypts and buffers a single byte of charstring data. */
static void charstring_byte(int v)
{
byte b = (byte) (v & 0xff);
if (charstring_bp - charstring_buf > sizeof(charstring_buf)) {
fprintf(stderr, "error: charstring_buf full (%d bytes)\n",
sizeof(charstring_buf));
exit(1);
}
*charstring_bp++ = cencrypt(b);
}
/* This function outputs buffered, encrypted charstring data through possible
eexec encryption. */
static void charstring_end()
{
byte *bp;
sprintf(line, "%d ", charstring_bp - charstring_buf);
eexec_string(line);
sprintf(line, "%s ", cs_start);
eexec_string(line);
for (bp = charstring_buf; bp < charstring_bp; bp++)
eexec_byte(*bp);
}
/* This function generates the charstring representation of an integer. */
static void charstring_int(int num)
{
int x;
if (num >= -107 && num <= 107) {
charstring_byte(num + 139);
} else if (num >= 108 && num <= 1131) {
x = num - 108;
charstring_byte(x / 256 + 247);
charstring_byte(x % 256);
} else if (num >= -1131 && num <= -108) {
x = abs(num) - 108;
charstring_byte(x / 256 + 251);
charstring_byte(x % 256);
} else if (num >= (-2147483647-1) && num <= 2147483647) {
charstring_byte(255);
charstring_byte(num >> 24);
charstring_byte(num >> 16);
charstring_byte(num >> 8);
charstring_byte(num);
} else {
fprintf(stderr,
"error: cannot format the integer %d, too large\n", num);
exit(1);
}
}
/* This function parses an entire charstring into integers and commands,
outputting bytes through the charstring buffer. */
static void parse_charstring()
{
struct command *cp;
charstring_start();
while (fscanf(ifp, "%s", line) == 1) {
if (line[0] == '%') {
/* eat comment to end of line */
while (fgetc(ifp) != '\n' && !feof(ifp))
; /* deliberately empty */
continue;
}
if (line[0] == '}')
break;
if (is_integer(line)) {
charstring_int(atoi(line));
} else {
cp = (struct command *)
bsearch((void *) line, (void *) command_table,
sizeof(command_table) / sizeof(struct command),
sizeof(struct command),
command_compare);
if (cp) {
charstring_byte(cp->one);
if (cp->two >= 0)
charstring_byte(cp->two);
} else {
fprintf(stderr, "error: cannot use `%s' in charstring\n",line);
exit(1);
}
}
}
charstring_end();
}
static void usage()
{
fprintf(stderr,
"usage: t1asm [-b] [-l block-length] [input [output]]\n");
fprintf(stderr,
"\n-b means output in PFB format, otherwise PFA format.\n");
fprintf(stderr,
"The block length applies to the length of blocks in the\n");
fprintf(stderr,
"PFB output file; the default is to use the largest possible.\n");
exit(1);
}
static void print_banner()
{
static char rcs_revision[] = ""; /* removed RCS */
static char revision[20];
if (sscanf(rcs_revision, "$Revision: %19s", revision) != 1)
revision[0] = '\0';
fprintf(stderr, "This is t1asm %s.\n", revision);
}
#ifdef STANDALONE
int main(int argc, char **argv)
{
char *p, *q, *r;
int c;
extern char *optarg;
extern int optind;
ifp = stdin;
ofp = stdout;
print_banner();
/* interpret command line arguments using getopt */
while ((c = getopt(argc, argv, "bl:")) != -1)
switch (c) {
case 'b':
pfb = 1;
break;
case 'l':
blocklen = atoi(optarg);
if (blocklen < MINBLOCKLEN) {
blocklen = MINBLOCKLEN;
fprintf(stderr,
"warning: using minimum block length of %d\n",
blocklen);
} else if (blocklen > MAXBLOCKLEN) {
blocklen = MAXBLOCKLEN;
fprintf(stderr,
"warning: using maximum block length of %d\n",
blocklen);
}
break;
default:
usage();
break;
}
if (argc - optind > 2)
usage();
/* possibly open input & output files */
if (argc - optind >= 1) {
ifp = fopen(argv[optind], "r");
if (!ifp) {
fprintf(stderr, "error: cannot open %s for reading\n", argv[1]);
exit(1);
}
}
if (argc - optind >= 2) {
ofp = fopen(argv[optind + 1], "w");
if (!ofp) {
fprintf(stderr, "error: cannot open %s for writing\n", argv[2]);
exit(1);
}
}
#else
int runt1asm(int pfbflag)
{
char *p, *q, *r;
pfb = pfbflag;
#endif
#ifdef _MSDOS
/* If we are processing a PFB (binary) output */
/* file, we must set its file mode to binary. */
if (pfb)
_setmode(_fileno(ofp), _O_BINARY);
#endif
/* Finally, we loop until no more input. Some special things to look for
are the `currentfile eexec' line, the beginning of the `/Subrs'
definition, the definition of `/lenIV', and the definition of the
charstring start command which has `...string currentfile...' in it. */
while (!feof(ifp) && !ferror(ifp)) {
t1asm_getline();
if (strcmp(line, "currentfile eexec\n") == 0) {
eexec_start();
continue;
} else if (strstr(line, "/Subrs") && isspace(line[6])) {
active = 1;
} else if ((p = strstr(line, "/lenIV"))) {
sscanf(p, "%*s %d", &lenIV);
} else if ((p = strstr(line, "string currentfile"))) {
/* locate the name of the charstring start command */
*p = '\0'; /* damage line[] */
q = strrchr(line, '/');
if (q) {
r = cs_start;
++q;
while (!isspace(*q) && *q != '{')
*r++ = *q++;
*r = '\0';
}
*p = 's'; /* repair line[] */
}
/* output line data */
eexec_string(line);
if ((p = strstr(line, "currentfile closefile"))) {
eexec_end();
}
if (start_charstring) {
if (!cs_start[0]) {
fprintf(stderr, "error: couldn't find charstring start command\n");
exit(1);
}
parse_charstring();
}
}
file_end();
fclose(ifp);
fclose(ofp);
return 0;
}
--- NEW FILE: ttf.c ---
/*
* True Type Font to Adobe Type 1 font converter
* By Mark Heath <mheath at netspace.net.au>
* Based on ttf2pfa by Andrew Weeks <ccsaw at bath.ac.uk>
* With help from Frank M. Siegert <fms at this.net>
*
* see COPYRIGHT
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <ctype.h>
#include <math.h>
[...1441 lines suppressed...]
ptr = (char *) kern_table + 4;
for (i = 0; i < ntables; i++) {
subtable = (TTF_KERN_SUB *) ptr;
if ((ntohs(subtable->coverage) & 0xff00) == 0) {
npairs = (short) ntohs(subtable->nPairs);
kern_entry = (TTF_KERN_ENTRY *) (ptr + sizeof(TTF_KERN_SUB));
kern_entry = (TTF_KERN_ENTRY *) (ptr + sizeof(TTF_KERN_SUB));
for (j = 0; j < npairs; j++) {
if( kern_entry->value != 0)
addkernpair(ntohs(kern_entry->left),
ntohs(kern_entry->right), (short)ntohs(kern_entry->value));
kern_entry++;
}
}
ptr += subtable->length;
}
}
--- NEW FILE: ttf.h ---
/*
* see COPYRIGHT
*/
/* these definitions are mostly taken from Microsoft's True Type
documentation.
*/
#ifdef XP_PSTEXT
typedef unsigned char BYTE;
typedef signed char CHAR;
typedef unsigned short USHORT;
typedef signed short SHORT;
typedef unsigned int ULONG;
typedef signed int LONG;
typedef SHORT FWORD;
typedef USHORT UFWORD;
#else
#define BYTE unsigned char
#define CHAR signed char
#define USHORT unsigned short
#define SHORT signed short
#define ULONG unsigned int
#define LONG signed int
#define FWORD SHORT
#define UFWORD USHORT
#endif /* XP_PSTEXT */
#define ONOROFF 0x01
#define XSHORT 0x02
#define YSHORT 0x04
#define REPEAT 0x08
#define XSAME 0x10
#define YSAME 0x20
#define ARG_1_AND_2_ARE_WORDS 0x0001
#define ARGS_ARE_XY_VALUES 0x0002
#define XY_BOUND_TO_GRID 0x0004
#define WE_HAVE_A_SCALE 0x0008
#define MORE_COMPONENTS 0x0020
#define WE_HAVE_AN_X_AND_Y_SCALE 0x0040
#define WE_HAVE_A_TWO_BY_TWO 0x0080
#define WE_HAVE_INSTRUCTIONS 0x0100
#define USE_MY_METRICS 0x0200
typedef struct short_2 {
SHORT upper;
USHORT lower;
} FIXED ;
typedef struct longhormetric {
UFWORD advanceWidth;
FWORD lsb;
} LONGHORMETRIC;
typedef struct ttf_hhea {
BYTE version[4];
SHORT ascender, descender, lineGap;
USHORT advnaceWidthMax;
SHORT minLSB, minRSB, xMaxExtent;
SHORT caretSlopeRise, caretSlopeRun;
SHORT reserved[5];
SHORT metricDataFormat;
USHORT numberOfHMetrics;
} TTF_HHEA;
typedef struct ttf_dir_entry {
char tag[4];
ULONG checksum;
ULONG offset;
ULONG length;
} TTF_DIR_ENTRY ;
typedef struct ttf_directory {
ULONG sfntVersion;
USHORT numTables;
USHORT searchRange;
USHORT entrySelector;
USHORT rangeShift;
TTF_DIR_ENTRY list;
} TTF_DIRECTORY ;
typedef struct ttf_name_rec {
USHORT platformID;
USHORT encodingID;
USHORT languageID;
USHORT nameID;
USHORT stringLength;
USHORT stringOffset;
} TTF_NAME_REC;
typedef struct ttf_name {
USHORT format;
USHORT numberOfNameRecords;
USHORT offset;
TTF_NAME_REC nameRecords;
} TTF_NAME ;
typedef struct ttf_head {
ULONG version;
ULONG fontRevision;
ULONG checksumAdjust;
ULONG magicNo;
USHORT flags;
USHORT unitsPerEm;
BYTE created[8];
BYTE modified[8];
FWORD xMin, yMin, xMax, yMax;
USHORT macStyle, lowestRecPPEM;
SHORT fontDirection, indexToLocFormat, glyphDataFormat;
} TTF_HEAD ;
typedef struct ttf_kern {
USHORT version, nTables;
} TTF_KERN ;
typedef struct ttf_kern_sub {
USHORT version, length, coverage;
USHORT nPairs, searchRange, entrySelector, rangeShift;
} TTF_KERN_SUB;
typedef struct ttf_kern_entry {
USHORT left, right;
FWORD value;
} TTF_KERN_ENTRY;
typedef struct ttf_cmap_fmt0 {
USHORT format;
USHORT length;
USHORT version;
BYTE glyphIdArray[256];
} TTF_CMAP_FMT0;
typedef struct ttf_cmap_fmt4 {
USHORT format;
USHORT length;
USHORT version;
USHORT segCountX2;
USHORT searchRange;
USHORT entrySelector;
USHORT rangeShift;
} TTF_CMAP_FMT4;
typedef struct ttf_cmap_entry {
USHORT platformID;
USHORT encodingID;
ULONG offset;
} TTF_CMAP_ENTRY;
typedef struct ttf_cmap {
USHORT version;
USHORT numberOfEncodingTables;
TTF_CMAP_ENTRY encodingTable[1];
} TTF_CMAP ;
typedef struct ttf_glyf {
SHORT numberOfContours;
FWORD xMin, yMin, xMax, yMax;
} TTF_GLYF ;
typedef struct ttf_maxp {
ULONG version;
USHORT numGlyphs, maxPoints, maxContours;
USHORT maxCompositePoints, maxCompositeContours;
USHORT maxZones, maxTwilightPoints, maxStorage;
USHORT maxFunctionDefs, maxInstructionsDefs;
USHORT maxSizeOfInstructions, maxComponentElements;
USHORT maxComponentDepth;
} TTF_MAXP ;
typedef struct ttf_post_head {
ULONG formatType;
FIXED italicAngle;
FWORD underlinePosition;
FWORD underlineThickness;
ULONG isFixedPitch;
ULONG minMemType42;
ULONG maxMemType42;
ULONG minMemType1;
ULONG maxMemType1;
USHORT numGlyphs;
USHORT glyphNameIndex;
} TTF_POST_HEAD ;
--- NEW FILE: ttf2pt1.1 ---
.rn '' }`
''' $RCSfile: ttf2pt1.1,v $$Revision: 1.1 $$Date: 2003/06/04 00:33:54 $
'''
''' $Log: ttf2pt1.1,v $
''' Revision 1.1 2003/06/04 00:33:54 roland
''' Fix for http://xprint.mozdev.org/bugs/show_bug.cgi?id=3846 - RFE: Upload Freetype --> PS Type1 font converter "ttf2pt1" ...
'''
'''
.de Sh
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp
.if t .sp .5v
.if n .sp
..
.de Ip
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.de Vb
.ft CW
.nf
.ne \\$1
..
.de Ve
.ft R
.fi
..
'''
'''
''' Set up \*(-- to give an unbreakable dash;
''' string Tr holds user defined translation string.
''' Bell System Logo is used as a dummy character.
'''
.tr \(*W-|\(bv\*(Tr
.ie n \{\
.ds -- \(*W-
.ds PI pi
.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
.ds L" ""
.ds R" ""
''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of
''' \*(L" and \*(R", except that they are used on ".xx" lines,
''' such as .IP and .SH, which do another additional levels of
''' double-quote interpretation
.ds M" """
.ds S" """
.ds N" """""
.ds T" """""
.ds L' '
.ds R' '
.ds M' '
.ds S' '
.ds N' '
.ds T' '
'br\}
.el\{\
.ds -- \(em\|
.tr \*(Tr
.ds L" ``
.ds R" ''
.ds M" ``
.ds S" ''
.ds N" ``
.ds T" ''
.ds L' `
.ds R' '
.ds M' `
.ds S' '
.ds N' `
.ds T' '
.ds PI \(*p
'br\}
.\" If the F register is turned on, we'll generate
.\" index entries out stderr for the following things:
.\" TH Title
.\" SH Header
.\" Sh Subsection
.\" Ip Item
.\" X<> Xref (embedded
.\" Of course, you have to process the output yourself
.\" in some meaninful fashion.
.if \nF \{
.de IX
.tm Index:\\$1\t\\n%\t"\\$2"
..
.nr % 0
.rr F
.\}
.TH TTF2PT1 1 "version 3.4.4-SNAP-030526" "May 26, 2003" "TTF2PT1 Font Converter"
.UC
.if n .hy 0
.if n .na
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.de CQ \" put $1 in typewriter font
.ft CW
'if n "\c
'if t \\&\\$1\c
'if n \\&\\$1\c
'if n \&"
\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7
'.ft R
..
.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2
. \" AM - accent mark definitions
.bd B 3
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds ? ?
. ds ! !
. ds /
. ds q
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10'
. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#]
.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u'
.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u'
.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#]
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.ds oe o\h'-(\w'o'u*4/10)'e
.ds Oe O\h'-(\w'O'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds v \h'-1'\o'\(aa\(ga'
. ds _ \h'-1'^
. ds . \h'-1'.
. ds 3 3
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
. ds oe oe
. ds Oe OE
.\}
.rm #[ #] #H #V #F C
.SH "NAME"
TTF2PT1 \- A True Type to PostScript Type 1 Font Converter
.SH "SYNOPSIS"
\f(CWttf2pt1 \fI[-options] ttffont.ttf [Fontname]\fR\fR
.PP
or
.PP
\f(CWttf2pt1 \fI[-options] ttffont.ttf -\fR\fR
.SH "DESCRIPTION"
Ttf2pt1 is a font converter from the True Type format (and some other formats
supported by the FreeType library as well) to the Adobe Type1 format.
.PP
The versions 3.0 and later got rather extensive post-processing algorithm that
brings the converted fonts to the requirements of the Type1 standard, tries to
correct the rounding errors introduced during conversions and some simple
kinds of bugs that are typical for the public domain TTF fonts. It
also generates the hints that enable much better rendering of fonts in
small sizes that are typical for the computer displays. But everything
has its price, and some of the optimizations may not work well for certain
fonts. That's why the options were added to the converter, to control
the performed optimizations.
.SH "OPTIONS"
The first variant creates the file \f(CWFontname.pfa\fR (or \f(CWFontname.pfb\fR if the
option \*(L'\fB\-b\fR\*(R' was used) with the converted font and \f(CWFontname.afm\fR with the
font metrics, the second one prints the font or another file (if the option
\&\*(R'\fB\-G\fR\*(R' was used) on the standard output from where it can be immediately
piped through some filter. If no \f(CWFontname\fR is specified for the first
variant, the name is generated from \f(CWttffont\fR by replacing the \f(CW.ttf\fR
filename suffix.
.PP
Most of the time no options are neccessary (with a possible exception
of \*(L'\fB\-e\fR'). But if there are some troubles with the resulting font, they
may be used to control the conversion.
The \fBoptions\fR are:
.Ip "\(bu" 2
\f(CW\fB-a\fR\fR \- 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 rather low limit for the font size. Including more glyphs increases
the file size and thus increases the chance of hitting this limit.
See \f(CWapp/X11/README\fR for the description of a
patch to X11 which fixes this problem.
.Ip "\(bu" 2
\f(CW\fB-b\fR\fR \- Encode the resulting font to produce a ready \f(CW.pfb\fR file.
.Ip "\(bu" 2
\f(CW\fB-d \fIsuboptions\fR\fR\fR \- Debugging options. The suboptions are:
.Sp
\f(CW\fBa\fR\fR \- 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 \*(L'\fB\-e\fR') but it has proven to be a valuable debuging
information.
.Sp
\f(CW\fBr\fR\fR \- Do not reverse the direction of outlines. The \s-1TTF\s0 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 \s-1TTF\s0 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 like \*(L"P\*(R" or \*(L"B\*(R" without the unpainted \*(L"holes\*(R" inside.
.Ip "\(bu" 2
\f(CW\fB-e\fR\fR \- Assemble the resulting font to produce a ready \f(CW.pfa\fR file.
.Sp
[ 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. ]
.Ip "\(bu" 2
\f(CW\fB-F\fR\fR \- Force the Unicode encoding: any type of \s-1MS\s0 encoding specified
in the font is ignored and the font is treated like it has Unicode
encoding. \fB\s-1WARNING\s0:\fR 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.
.Ip "\(bu" 2
\f(CW\fB-G \fIsuboptions\fR\fR\fR \- File generation options. The suboptions may be lowercase
or uppercase, the lowercase ones disable the generation of particular
files, 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 \fB\-G\fR determines
which file will be written to the standard output and the rest of files
will be discarded. For example, \fB\-G A\fR will request the \s-1AFM\s0 file.
The suboptions to disable/enable the generation of the files are:
.Sp
\f(CW\fBf/F\fR\fR \- The font file. Depending on the other options this file
will have one of the suffixes \f(CW.t1a\fR, \f(CW.pfa\fR or \f(CW.pfb\fR. If the conversion result
is requested on the standard output ('\f(CW-\fR\*(R' 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 \fB\-G\fR.
\fBDefault: enabled\fR
.Sp
\f(CW\fBa/A\fR\fR \- The Adobe font metrics file (\f(CW.afm\fR).
\fBDefault: enabled\fR
.Sp
\f(CW\fBe/E\fR\fR \- The dvips encoding file (\f(CW.enc\fR).
\fBDefault: disabled\fR
.Ip "\(bu" 2
\f(CW\fB-l \fIlanguage\fR[+\fIargument\fR]\fR\fR \- 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 variable \s-1LANG\s0.
If it is not able to guess the language by \s-1LANG\s0 it tries all the
languages in the order they are listed.
.Sp
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.
.Sp
As of now the following languages are supported:
.Sp
\ \ \f(CWlatin1\fR \- for all the languages using the Latin-1 encoding
.Sp
\ \ \f(CWlatin2\fR \- for the Central European languages
.Sp
\ \ \f(CWlatin4\fR \- for the Baltic languages
.Sp
\ \ \f(CWlatin5\fR \- for the Turkish language
.Sp
\ \ \f(CWcyrillic\fR \- for the languages with Cyrillic alphabet
.Sp
\ \ \f(CWrussian\fR \- historic synonym for cyrillic
.Sp
\ \ \f(CWbulgarian\fR \- historic synonym for cyrillic
.Sp
\ \ \f(CWadobestd\fR \- for the AdobeStandard encoding used by TeX
.Sp
\ \ \f(CWplane+\fIargument\fR\fR \- to select one plane from a multi-byte encoding
.Sp
The argument of the \*(L"\f(CWplane\fR\*(R" language may be in one of three forms:
.Sp
\ \ \f(CWplane+\fBpid=\fR\fI<pid>\fR\fB,eid=\fR\fI<eid>\fR\fR
.Sp
\ \ \f(CWplane+\fBpid=\fR\fI<pid>\fR\fB,eid=\fR\fI<eid>\fR\fB,\fR\fI<plane_number>\fR\fR
.Sp
\ \ \f(CWplane+\fI<plane_number>\fR\fR
.Sp
Pid (\s-1TTF\s0 platform id) and eid (\s-1TTF\s0 encoding id) select a particular
\s-1TTF\s0 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 \s-1TTF\s0 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.
.Sp
Plane_number is a hexadecimal (if starts with \*(L"\fB0x\fR") 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 \*(L"0x\*(R" is not included into the suffix).
.Sp
\fB\s-1NOTE\s0:\fR
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* \*(L"languages\*(R"
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.
.Sp
\fB\s-1WARNING\s0:\fR
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 \*(L'fi\*(R', \*(L'fl\*(R' 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'\fB\-L\fR\*(R'
with an external map.
.Ip "\(bu" 2
\f(CW\fB-L \fIfile\fR[+[pid=\fI<pid>\fR,eid=\fI<eid>\fR,][\fIplane\fR]]\fR\fR \- 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'\fB\-l\fR\*(R' 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 in
\f(CWmaps/adobe-standard-encoding.map\fR, \f(CWCP1250.map\fR. (\fB\s-1NOTE\s0:\fR
the \*(L'standard encoding\*(R' 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 file
\f(CWmaps/unicode-sample.map\fR.
.Sp
Likewise to \*(L'\fB\-l\fR\*(R', an argument may be specified after the map file
name. But in this case the argument has fixed meaning: it selects the
original \s-1TTF\s0 encoding table (the syntax is the same as in \*(L'\fB\-l plane\fR')
and/or a plane of the map file. The plane name also gets added after dash
to the font name. The plane is a concept used in the Eastern fonts with big
number of glyphs: one \s-1TTF\s0 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 \s-1TTF\s0 font \f(CWttf2pt1\fR must be run multiple times, each time with
a different plane name specified.
.Sp
The default original \s-1TTF\s0 encoding table used for the option \*(L'\fB\-L\fR\*(R' is
Unicode. The map files may include directives to specify different original
\s-1TTF\s0 encodings. However if the pid/eid pair is specified with
it overrides any original encoding specified in the map file.
.Ip "\(bu" 2
\f(CW\fB-m \fItype\fR=\fIvalue\fR\fR\fR \- Set maximal or minimal limits of resources.
These limits control the the font generation by limiting the resources
that the font is permitted to require from the PostScript interpreter.
The currently supported types of limits are:
.Sp
\f(CW\fBh\fR\fR \- the maximal hint stack depth for the substituted hints.
The default value is 128, according to 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 \f(CW.t1a\fR file use the script
\f(CWscripts/cntstems.pl\fR.
.Ip "\(bu" 2
\f(CW\fB-O \fIsuboptions\fR\fR\fR \- 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:
.Sp
\f(CW\fBb/B\fR\fR \- Guessing of the ForceBold parameter. This parameter helps
the Type1 engine to rasterize the 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, in these cases you may want to disable this guessing.
\fBDefault: enabled\fR
.Sp
\f(CW\fBh/H\fR\fR \- 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.
\fBDefault: enabled\fR
.Sp
\f(CW\fBu/U\fR\fR \- Hint substitution. Hint substitution is a technique
permitting generation of more detailed hints for the rasterizer. It allows
to use different sets of hints for different parts of a glyph and change
these sets as neccessary during rasterization (that's why \*(L"substituted").
So it should improve the quality of the fonts rendered at small sizes.
But there are two catches: First, the X11 library has 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 \*(L'\fB\-a\fR\*(R', so you may want to
use \*(L'\fB\-a\fR\*(R' together with \*(L'\fB\-Ou\fR\*(R'. See \f(CWapp/X11/README\fR for the description of
a patch to X11 which fixes this problem. Second, some rasterizers (again,
X11 is the typical example) have a limitation for 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 \f(CWttf2pt1\fR
uses algorithms to minimizing this depth, with the trade-off of slightly
bigger font files. The glyphs which still exceed the limit set by option
\&\*(R'\fB\-mh\fR\*(R' have 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 program \f(CWother/cmpf\fR (see the description
in \f(CWother/README\fR) and decide which one looks better.
\fBDefault: enabled\fR
.Sp
\f(CW\fBo/O\fR\fR \- Space optimization of the outlines\*(R' 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 as \*(L'10 hlineto\*(R' instead of \*(L'0 10 rlineto\*(R' to describe a horizontal
line. This feature enables use of these operators.
\fBDefault: enabled\fR
.Sp
\f(CW\fBs/S\fR\fR \- 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.
\fBDefault: enabled\fR
.Sp
\f(CW\fBt/T\fR\fR \- Auto-scaling to the 1000x1000 Type1 standard matrix. The
\s-1TTF\s0 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.
\fBDefault: enabled\fR
.Sp
\f(CW\fBv/V\fR\fR \- Do vectorization on the bitmap fonts. Functionally
\*(L"vectorization\*(R" is the same thing as \*(L"autotracing\*(R", 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.
\fBDefault: disabled\fR
.Sp
\f(CW\fBw/W\fR\fR \- Glyphs\*(R' 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
the 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.
\fBDefault: disabled\fR
.Sp
\f(CW\fBz/Z\fR\fR \- Use the Autotrace library on the bitmap fonts. The results
are horrible and \fBthe use of this option is not recommended\fR. This option is
present for experimental purposes. It may change or be removed in the
future. The working tracing can be achieved with option \f(CW\fB-OV\fR\fR.
\fBDefault: disabled\fR
.Ip "\(bu" 2
\f(CW\fB-p \fIparser_name\fR\fR\fR \- Use the specified front-end parser to read the font file.
If this option is not used, ttf2pt1 selects 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:
.Sp
\ \ \f(CWttf\fR \- built-in parser for the ttf files (suffix \f(CW.ttf\fR)
.Sp
\ \ \f(CWbdf\fR \- built-in parser for the \s-1BDF\s0 files (suffix \f(CW.bdf\fR)
.Sp
\ \ \f(CWft\fR \- parser based on the FreeType-2 library (suffixes \f(CW.ttf\fR,
\&\f(CW.otf\fR, \f(CW.pfa\fR, \f(CW.pfb\fR)
.Sp
The parser \f(CWft\fR is \fB\s-1NOT\s0\fR linked in by default. See \f(CWMakefile\fR
for instructions how to enable it. We do no support this parser on
Windows: probably it will work but nobody tried and nobody knows how
to build it.
.Sp
The conversion of the bitmap fonts (such as \s-1BDF\s0) is simplistic yet,
producing jagged outlines. When converting such fonts, it might be
a good idea to turn off the hint substitution (using option \fB\-Ou\fR)
because the hints produced will be huge but not adding much to the
quality of the fonts.
.Ip "\(bu" 2
\f(CW\fB-u \fInumber\fR\fR\fR \- Mark the font with this value as its
UniqueID. The UniqueID is 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 without UniqueID on their disk.The problem
is that the \s-1ID\s0 is supposed to be unique, as it name says. And
there is no easy way to create a guaranteed unique \s-1ID\s0. Adobe specifies
the range 4000000-4999999 for private IDs but still it's difficult
to guarantee the uniqueness within it. So if you don't really need the
UniqueID 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 \*(L'\f(CW\fBA\fR\fR\*(R' is given
then the converter generates the value of UniqueID automatically,
as a hash of the font name. (\fB\s-1NOTE\s0:\fR in the version 3.22 the
algorithm for autogeneration of UniqueID was changed to fit the values
into the Adobe-spacified range. This means that if UniqueIDs 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
duplicated UniqueIDs is to use the command:
.Sp
\f(CW\ \ cat *.pf[ab] | grep UniqueID | sort | uniq -c | grep -v ' 1 '\fR
.Sp
Or if you use \f(CWscripts/convert\fR it will do that for you automatically
plus it will also give the exact list of files with duplicate UIDs.
.Ip "\(bu" 2
\f(CW\fB-v \fIsize\fR\fR\fR \- 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 is \*(L"A\*(R" in all the
supported languages. The size is specified in the points of the
Type 1 coordinate grids, the maximal value is 1000. 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 between 600 and 850. This
re-scaling may be quite useful but needs more experience to
understand the balance of its effects.
.Ip "\(bu" 2
\f(CW\fB-W \fIlevel\fR\fR\fR \- Select the verbosity level of the warnings.
Currently the levels from 0 to 4 are supported. Level 0 means no warnings
at all, level 4 means all the possible warnings. The default level is 3.
Other levels may be added in the future, so using the level number 99 is
recommended to get all the possible warnings. Going below level 2 is
not generally recommended because you may miss valuable information about
the problems with the fonts being converted.
.Ip "\(bu" 2
\fBObsolete option:\fR
\f(CW\fB-A\fR\fR \- Print the font metrics (.afm file) instead of the font on \s-1STDOUT\s0.
Use \fB\-\s-1GA\s0\fR instead.
.Ip "\(bu" 2
\fBVery obsolete option:\fR
.Sp
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 \*(L'\fB\-f\fR\*(R' was reused for another option. The old version was:
.Sp
\f(CW\fB-f\fR\fR \- 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.
.PP
The \f(CW.pfa\fR font format supposes that the description of the characters
is binary encoded and encrypted. This converter does not encode or
encrypt the data by default, you have to specify the option \*(L'\fB\-e\fR\*(R'
or use the \f(CWt1asm\fR program to assemble (that means, encode and
encrypt) the font program. The \f(CWt1asm\fR program that is included with
the converter is actually a part of the \f(CWt1utils\fR package, rather old
version of which may be obtained from
.PP
http://ttf2pt1.sourceforge.net/t1utils.tar.gz
.PP
Note that \f(CWt1asm\fR from the old version of that package won't work properly
with the files generated by \f(CWttf2pt1\fR version 3.20 and later. Please use
\f(CWt1asm\fR packaged with \f(CWttf2pt1\fR or from the new version \f(CWt1utils\fR
instead. For a newer version of \f(CWt1utils\fR please look at
.PP
http://www.lcdf.org/~eddietwo/type/
.SH "EXAMPLES"
So, the following command lines:
.PP
\f(CWttf2pt1 -e ttffont.ttf t1font\fR
.PP
\f(CWttf2pt1 ttffont.ttf - | t1asm >t1font.pfa\fR
.PP
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 assembler.
.SH "FILES"
.Ip "\(bu" 2
\s-1TTF2PT1_LIBXDIR/\s0t1asm
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR\s0/*
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR/\s0scripts/*
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR/\s0other/*
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR/README\s0
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR/FONTS\s0
.SH "SEE ALSO"
.Ip "\(bu" 4
the \fIttf2pt1_convert(1)\fR manpage
.Ip "\(bu" 4
the \fIttf2pt1_x2gs(1)\fR manpage
.Ip "\(bu" 4
the \fIt1asm(1)\fR manpage
.Ip "\(bu" 4
ttf2pt1-announce at lists.sourceforge.net
.Sp
The mailing list with announcements about ttf2pt1. 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/ttf2pt1-announce.
If you have only e-mail access to the Net then send a subscribe request to
the development mailing list ttf2pt1-devel at lists.sourceforge.net and somebody
will help you with subscription.
.Ip "\(bu" 4
ttf2pt1-devel at lists.sourceforge.net
.Sp
ttf2pt1-users at lists.sourceforge.net
.Sp
The ttf2pt1 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/ttf2pt1-devel
and http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-users.
If you have only e-mail access to the Net then send a subscribe request to
the development mailing list ttf2pt1-devel at lists.sourceforge.net and somebody
will help you with subscription.
.Ip "\(bu" 4
http://ttf2pt1.sourceforge.net
.Sp
The main page of the project.
.Sp
http://www.netspace.net.au/~mheath/ttf2pt1/
.Sp
The old main page of the project.
.SH "BUGS"
It seems that many Eastern fonts use features of the TTF format that are
not supported by the ttf2pt1's built-in front-end parser. Because of
this for now we recommend using the FreeType-based parser (option
\&\*(R'\fB\-p ft\fR') with the \*(L"\f(CWplane\fR\*(R" language.
.Sh "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 ?
.PP
Send the bug reports to the ttf2pt1 development mailing list at
ttf2pt1-devel at lists.sourceforge.net.
.PP
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 \*(L"this font looks strange after conversion\*(R" 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.
.PP
First, enable full warnings with option \*(L'\fB\-W99\fR\*(R', 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 \*(L"scrath your own itch\*(R"
seems to be the strongest moving force behind the Open Source software.
.PP
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 \*(L'\fB\-Ou\fR\*(R', if
it does not help then \*(L'\fB\-Os\fR\*(R', then \*(L'\fB\-Oh\fR\*(R', then \*(L'\fB\-Oo\fR\*(R'.
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.
.PP
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 the reports
about such cases will help to handle these defects properly in future.
.PP
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.
.SH "HISTORY"
Based on ttf2pfa by Andrew Weeks, and help from Frank Siegert.
.PP
Modification by Mark Heath.
.PP
Further modification by Sergey Babkin.
.PP
The Type1 assembler by I. Lee Hetherington with modifications by
Kai-Uwe Herbing.
.rn }` ''
.IX Title "TTF2PT1 1"
.IX Name "TTF2PT1 - A True Type to PostScript Type 1 Font Converter"
.IX Header "NAME"
.IX Header "SYNOPSIS"
.IX Header "DESCRIPTION"
.IX Header "OPTIONS"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Header "EXAMPLES"
.IX Header "FILES"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Header "SEE ALSO"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Header "BUGS"
.IX Subsection "Troubleshooting and bug reports"
.IX Header "HISTORY"
--- NEW FILE: ttf2pt1.c ---
/*
* True Type Font to Adobe Type 1 font converter
* By Mark Heath <mheath at netspace.net.au>
* Based on ttf2pfa by Andrew Weeks <ccsaw at bath.ac.uk>
* With help from Frank M. Siegert <fms at this.net>
*
* see COPYRIGHT for full copyright notice
*
***********************************************************************
*
* Sergey Babkin <babkin at users.sourceforge.net>, <sab123 at hotmail.com>
*
* Added post-processing of resulting outline to correct the errors
* both introduced during conversion and present in the original font,
* autogeneration of hints (has yet to be improved though) and BlueValues,
* scaling to 1000x1000 matrix, option to print the result on STDOUT,
* support of Unicode to CP1251 conversion, optimization of the
* resulting font code by space (that improves the speed too). Excluded
* the glyphs that are unaccessible through the encoding table from
[...2682 lines suppressed...]
snprintf(filename, sizeof filename, "%s.t1a", argv[2]);
if ((ifp = fopen(filename, "rb")) == NULL) {
fprintf(stderr, "**** Cannot read %s ****\n", filename);
exit(1);
} else {
WARNING_2 fprintf(stderr, "Converting file %s\n", filename);
}
runt1asm(pfbflag);
WARNING_2 fprintf(stderr, "Removing file %s\n", filename);
if(unlink(filename) < 0)
WARNING_1 fprintf(stderr, "Unable to remove file %s\n", filename);
}
#endif /* WINDOWS */
fclose(null_file);
return 0;
}
--- NEW FILE: ttf2pt1_convert.1 ---
.rn '' }`
''' $RCSfile: ttf2pt1_convert.1,v $$Revision: 1.1 $$Date: 2003/06/04 00:33:54 $
'''
''' $Log: ttf2pt1_convert.1,v $
''' Revision 1.1 2003/06/04 00:33:54 roland
''' Fix for http://xprint.mozdev.org/bugs/show_bug.cgi?id=3846 - RFE: Upload Freetype --> PS Type1 font converter "ttf2pt1" ...
'''
'''
.de Sh
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp
.if t .sp .5v
.if n .sp
..
.de Ip
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.de Vb
.ft CW
.nf
.ne \\$1
..
.de Ve
.ft R
.fi
..
'''
'''
''' Set up \*(-- to give an unbreakable dash;
''' string Tr holds user defined translation string.
''' Bell System Logo is used as a dummy character.
'''
.tr \(*W-|\(bv\*(Tr
.ie n \{\
.ds -- \(*W-
.ds PI pi
.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
.ds L" ""
.ds R" ""
''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of
''' \*(L" and \*(R", except that they are used on ".xx" lines,
''' such as .IP and .SH, which do another additional levels of
''' double-quote interpretation
.ds M" """
.ds S" """
.ds N" """""
.ds T" """""
.ds L' '
.ds R' '
.ds M' '
.ds S' '
.ds N' '
.ds T' '
'br\}
.el\{\
.ds -- \(em\|
.tr \*(Tr
.ds L" ``
.ds R" ''
.ds M" ``
.ds S" ''
.ds N" ``
.ds T" ''
.ds L' `
.ds R' '
.ds M' `
.ds S' '
.ds N' `
.ds T' '
.ds PI \(*p
'br\}
.\" If the F register is turned on, we'll generate
.\" index entries out stderr for the following things:
.\" TH Title
.\" SH Header
.\" Sh Subsection
.\" Ip Item
.\" X<> Xref (embedded
.\" Of course, you have to process the output yourself
.\" in some meaninful fashion.
.if \nF \{
.de IX
.tm Index:\\$1\t\\n%\t"\\$2"
..
.nr % 0
.rr F
.\}
.TH TTF2PT1_CONVERT 1 "version 3.4.4-SNAP-030526" "May 26, 2003" "TTF2PT1 Font Converter"
.UC
.if n .hy 0
.if n .na
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.de CQ \" put $1 in typewriter font
.ft CW
'if n "\c
'if t \\&\\$1\c
'if n \\&\\$1\c
'if n \&"
\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7
'.ft R
..
.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2
. \" AM - accent mark definitions
.bd B 3
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds ? ?
. ds ! !
. ds /
. ds q
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10'
. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#]
.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u'
.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u'
.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#]
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.ds oe o\h'-(\w'o'u*4/10)'e
.ds Oe O\h'-(\w'O'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds v \h'-1'\o'\(aa\(ga'
. ds _ \h'-1'^
. ds . \h'-1'.
. ds 3 3
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
. ds oe oe
. ds Oe OE
.\}
.rm #[ #] #H #V #F C
.SH "NAME"
\fBttf2pt1_convert\fR \- convenience font conversion script
.SH "SYNOPSIS"
ttf2pt1_convert \fB[config-file]\fR
.SH "DESCRIPTION"
`\fBConvert\fR\*(R' is the master conversion script provided with ttf2pt1.
When installed into a public directory it's named `\fBttf2pt1_convert\fR\*(R'
to avoid name collisions with the other programs.
.PP
If the configuration file is not specified as an argument then the file
`\f(CWconvert.cfg\fR\*(R' in the current directory is used. This file contains
a set of configuration variables. The distribution contains a sample file
file `\f(CWconvert.cfg.sample\fR\*(R'. Please copy it to `\f(CWconvert.cfg\fR\*(R',
look inside it and change the configuration variables. The more stable
configuration variables, such as the path names of the scripts and
encoding files are located in `\f(CWconvert\fR\*(R' itself, they are
automatically updated when installing \fBttf2pt1\fR.
.PP
Put all the TTF fonts you want to convert into some directory (this
may be just the directory that already contains all the Windows
fonts on a mounted FAT filesystem). If you have fonts in different
source encoding then put the fonts in each of the encodings
into a separate directory. Up to 10 source directories are
supported. If you (in a rather unlikely case) have more source
directories then you can make two separate runs of the converter,
converting up to 10 directories at a time.
.PP
The variables in the configuration file are:
.Ip "\(bu" 2
\fB\f(CWSRCDIRS\fR\fR \- the list of directories (with absolute paths) with
\s-1TTF\s0 fonts. Each line contains at least 3 fields: the name of the directory,
the language of the fonts in it (if you have fonts for different
languages you have to put them into the separate directories) and the
encoding of the fonts. Again, if you have some of the \s-1TTF\s0 typefaces in
one encoding, and some in another (say, \s-1CP\s0\-1251 and \s-1KOI\s0\-8), you have
to put them into the separate source directories. Some lines may contain
4 fields. Then the fourth field is the name of the external map to
convert the Unicode fonts into the desirable encoding. This map is
used instead of the built-in map for the specified language.
.Sp
*8*
An interesting thing is that some languages have more than one
widely used character encodings. For example, the widely used
encodings for Russian are \s-1IBM\s0 \s-1CP\s0\-866 (\s-1MS\s0\-\s-1DOS\s0 and Unix), \s-1KOI\s0\-8
(Unix and \s-1VAX\s0, also the standard Internet encoding), \s-1IBM\s0 \s-1CP\s0\-1251 (\s-1MS\s0 Windows).
That's why I have provided the means to generate the converted fonts
in more than one encoding. See the file encodings/\s-1README\s0 for
details about the encoding tables. Actually, if you plan to use
these fonts with Netscape Navigator better use the aliases
cp-866 instead of ibm-866 and windows-1251 instead of ibm-1251
because that's what Netscape wants.
.Ip "\(bu" 2
\fB\f(CWDSTDIR\fR\fR \- directory for the resulting Type1 fonts. Be careful!
This directory gets completely wiped out before conversion,
so don't use any already existing directory for this purpose.
.Ip "\(bu" 2
\fB\f(CWDSTENC\fI{language}\fR\fR\fR \- the list of encodings in which the destination
fonts will be generated for each language. Each font of that
language will be generated in each of the specified
encodings. If you don't want any translation, just specify both
\f(CWSRCENC\fR and \f(CWDSTENC\fR as iso8859-1 (or if you want any other encoding
specified in the fonts.dir, copy the description of 8859-1 with
new name and use this new name for \f(CWSRCENC\fR and \f(CWDSTENC\fR).
.Ip "\(bu" 2
\fB\f(CWFOUNDRY\fR\fR \- the foundry name to be used in the fonts.dir file. I have
set it to `fromttf\*(R' to avoid name conflicts with any existing font for
sure. But this foundry name is not registered in X11 standards and
if you want to get the full standard compliance or have a font server
that enforces such a compliance, use `misc\*(R'.
.PP
The next few parameters control the general behavior of the converter.
They default values are set to something reasonable.
.Ip "\(bu" 2
\fB\f(CWCORRECTWIDTH\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR then use the
converter option \f(CW\fB-w\fR\fR, otherwise don't use it. See the description of
this option in the \s-1README\s0 file.
.Ip "\(bu" 2
\fB\f(CWREMOVET1A\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR then after
conversion remove the un-encoded \f(CW.t1a\fR font files and the
intermediate \f(CW.xpfa\fR font metric files.
.Ip "\(bu" 2
\fB\f(CWINSTALLFONTMAP\fR\fR \- a Ghostscript parameter, if the value is set to
\fB\f(CWYES\fR\fR then install the entries for the new fonts
right into the main \f(CWFontmap\fR file. Otherwise just leave
the file \f(CWFontmap.ttf\fR in the Ghostscript configuration
directory.
.Ip "\(bu" 2
\fB\f(CWHINTSUBST\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR use the option
\f(CW\fB-H\fR\fR, otherwise don't use it. This option enables the
hint substitution technique. If you have not installed the X11 patch
described above, use this option with great caution. See further
description of this option in the \s-1README\s0 file.
.Ip "\(bu" 2
\fB\f(CWENFORCEISO\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR then
disguise the resulting fonts as the fonts in ISOLatin1 encoding. Historically
this was neccessary due to the way the installer scripts created the
X11 font configuration files. It is not neccessary any more for this
purpose. But if you plan to use these fonts with some other application
that expects ISOLatin1 encoding then better enable this option.
.Ip "\(bu" 2
\fB\f(CWALLGLYPHS\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR then
include all the glyphs from the source fonts into the resulting fonts, even
if these glyphs are inaccessible. If it's set to \fB\f(CWNO\fR\fR then
include only the glyphs which have codes assigned to them. The glyphs
without codes can not be used directly. But some clever programs,
such as the Type 1 library from XFree86 3.9 and higher can change
the encoding on the fly and use another set of glyphs. If you have not
installed the X11 patch described above, use this option with great
caution. See further description of the option option \f(CW\fB-a\fR\fR in the
\s-1README\s0 file.
.Ip "\(bu" 2
\fB\f(CWGENUID\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR then use
the option \f(CW\fB-uA\fR\fR of the converter to generate UniqueIDs for
the converted fonts. The standard X11 Type 1 library does not use
this \s-1ID\s0, so it may only be neccessary for the other applications.
The script is clever enough to generate different UniqueID for the
same font converted to multiple encodings. Also after conversion it
checks all the fonts generacted during the session for duplicated
UniqueID and shows those. Still, this does not quarantee that these
UniqueIDs won't overlap with some other fonts. The UniqueIDs are
generated as hash values from the font names, so it's guaranteed
that if the `\f(CWconvert\fR\*(R' script runs multiple times it will
generate the same UniqueIDs during each run. See further description
of this option in the \s-1README\s0 file.
.Ip "\(bu" 2
\fB\f(CWGENUID\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR then create
the \f(CW.pfb\fR files, otherwise the \f(CW.pfa\fR files. The \f(CW.pfb\fR
files are more compact but contain binary data, so you may experience some
troubles when transferring them through the network.
.PP
The following parameters are used to locate the other scripts and
configuration files. By default the scripts do a bit of guessing for them:
they search in the \fBttf2pt1\fR installation directory if \fBttf2pt1\fR
was installed or otherwise suppose that you are running `\f(CWconvert\fR\*(R' with
`\f(CWscripts\fR\*(R' subdirectory being the current directory.
.Ip "\(bu" 2
\fB\f(CWENCDIR\fR\fR \- directory containing the descriptions of encodings
.Ip "\(bu" 2
\fB\f(CWMAPDIR\fR\fR \- directory containing the external map files
.PP
Besides that a few parameters are built into the `\f(CWconvert\fR\*(R' script itself.
You probably won't need to change them:
.Ip "\(bu" 2
\f(CW\fBT1ASM\fR\fR, \f(CW\fBTTF2PT1\fR\fR, \f(CW\fBTRANS\fR\fR, \f(CW\fBT1FDIR\fR\fR, \f(CW\fBFORCEISO\fR\fR \- paths to the other script
.PP
Also there are a few parameters controlling the installation of
fonts for Ghostscript. Please look at their description in the
Ghostscript section of documentation or in the \fBttf2pt1_x2gs(1)\fR
manual page before running `\f(CWconvert\fR\*(R'. If these parameters are
set, `\f(CWconvert\fR\*(R' will call the `\f(CWx2gs\fR\*(R' script automatically
to install the newly converted fonts in Ghostscript.
.PP
After creating the configuration file run the `\f(CWconvert\fR\*(R' script. Look at
the result and the log file in \f(CWDSTDIR\fR.
.PP
Add the directory with newly converted fonts to the configuration
of X server or font server. For most of the systems this step is
very straightforward. For \s-1HP\s0\-\s-1UX\s0 it's rather tricky and poorly
documented, so the file \s-1FONTS\s0.hpux gives a short description.
.PP
If you don't have the privileges of the root user, you still can
configure your private font server. Just use some non-standard
port number (see \s-1FONTS\s0.hpux for an example, exept that you won't
need all the \s-1HP\s0\-related stuff on any other system).
.SH "FILES"
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR/\s0scripts/convert.cfg.sample
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR/\s0scripts/*
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR/README\s0
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR/FONTS\s0
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR\s0/*
.Ip "\(bu" 2
\s-1TTF2PT1_BINDIR/\s0ttf2pt1
.SH "SEE ALSO"
.Ip "\(bu" 4
the \fIttf2pt1(1)\fR manpage
.Ip "\(bu" 4
the \fIttf2pt1_x2gs(1)\fR manpage
.Ip "\(bu" 4
the \fIt1asm(1)\fR manpage
.SH "BUGS"
.Sh "Known problems"
.Ip "\(bu" 4
One catch is that the X11 Type 1 font library has a rather low limit
on the font size. Because of this the fonts with more complicated
outlines and the enabled hint substitution may not fit into
this limit. The same applies to the fonts with very complicated
outlines or with very many glyphs (especially the fonts with
over 256 glyphs). So you will need to excercise caution with
these options if you plan using these fonts with X11. Some vendors
such as \s-1HP\s0 provide the Type 1 implementation licensed from Adobe
which should have no such problem.
.Sp
But there is a solution even for the generic X11. A patch located
in the subdirectory `\f(CWapp/X11\fR\*(R' fixes this problem as well
as some other minor problems. Its description is provided in
app/X11/\s-1README\s0.
.Sp
To fix the X11 font library, you have to get the X11 sources. I
can recommend the ftp sites of the XFree86 project ftp://ftp.xfree86.org
or of the Open Group ftp://ftp.x.org. This patch was made on the sources
of XFree86 so you may have better success with applying it to the
XFree86 distribution. After you have got the sources, make sure
that you can compile them. Then apply the patch as described.
Make sure that it was applied properly. Compile the sources again
(actually, you need only the fonts library, the fonts server, and
possibly the X server). It would be prudent now to save your old
font library, font server and, possibly, X server. Then install
the new recently compiled versions of these files. Of course,
if you know someone who already has compiled these files for the
same \s-1OS\s0 as yours, you can just copy the binary fles from him.
.Sp
Alas, building the X11 system from the source code is not the
easiest thing in the world and if you have no experience it
can be quite difficult. In this case just avoid the aforementioned
features or check each converted font to make sure that it
works properly.
.Ip "\(bu" 4
The Type1 font library from the standard X11 distribution
does not work on \s-1HP\s0\-\s-1UX\s0 (at least, up to 10.01). The font server
supplied with \s-1HP\s0\-\s-1UX\s0 up to 10.01 is also broken. Starting from
\s-1HP\s0\-\s-1UX\s0 10.20 (I don't know about 10.10) they supply a proprietary font
library and the converted fonts work fine with it, provided that
they are configured properly (see the file \s-1FONTS\s0.hpux).
.Ip "\(bu" 4
The \f(CWfonts.scale\fR files created by the older versions of the
\f(CWttf2pt1\fR installation program (up to release 3.1) have conflicted
with the language definitions of the \f(CWXfsft\fR font server and
parts of it included into XFree86. To overcome this incompatibility
the never versions creats the \f(CWfonts.scale\fR file describing all the
fonts as belonging to the \f(CWadobe-fontspecific\fR encoding and
the \f(CWfonts.alias\fR file with the proper names. The drawback of
this solution is that \f(CWxlsfonts\fR gives the list of twice more
fonts. But as a side effect the option \f(CW\fBENFORCEISO\fR\fR in
`\f(CWconvert.cfg\fR\*(R' is not required for X11 any more.
.Ip "\(bu" 4
The conversion script has no support for Eastern multi-plane fonts.
Contribution of such a support would be welcome.
.rn }` ''
.IX Title "TTF2PT1_CONVERT 1"
.IX Name "B<ttf2pt1_convert> - convenience font conversion script"
.IX Header "NAME"
.IX Header "SYNOPSIS"
.IX Header "DESCRIPTION"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Header "FILES"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Header "SEE ALSO"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Header "BUGS"
.IX Subsection "Known problems"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
--- NEW FILE: ttf2pt1_x2gs.1 ---
.rn '' }`
''' $RCSfile: ttf2pt1_x2gs.1,v $$Revision: 1.1 $$Date: 2003/06/04 00:33:54 $
'''
''' $Log: ttf2pt1_x2gs.1,v $
''' Revision 1.1 2003/06/04 00:33:54 roland
''' Fix for http://xprint.mozdev.org/bugs/show_bug.cgi?id=3846 - RFE: Upload Freetype --> PS Type1 font converter "ttf2pt1" ...
'''
'''
.de Sh
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp
.if t .sp .5v
.if n .sp
..
.de Ip
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.de Vb
.ft CW
.nf
.ne \\$1
..
.de Ve
.ft R
.fi
..
'''
'''
''' Set up \*(-- to give an unbreakable dash;
''' string Tr holds user defined translation string.
''' Bell System Logo is used as a dummy character.
'''
.tr \(*W-|\(bv\*(Tr
.ie n \{\
.ds -- \(*W-
.ds PI pi
.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
.ds L" ""
.ds R" ""
''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of
''' \*(L" and \*(R", except that they are used on ".xx" lines,
''' such as .IP and .SH, which do another additional levels of
''' double-quote interpretation
.ds M" """
.ds S" """
.ds N" """""
.ds T" """""
.ds L' '
.ds R' '
.ds M' '
.ds S' '
.ds N' '
.ds T' '
'br\}
.el\{\
.ds -- \(em\|
.tr \*(Tr
.ds L" ``
.ds R" ''
.ds M" ``
.ds S" ''
.ds N" ``
.ds T" ''
.ds L' `
.ds R' '
.ds M' `
.ds S' '
.ds N' `
.ds T' '
.ds PI \(*p
'br\}
.\" If the F register is turned on, we'll generate
.\" index entries out stderr for the following things:
.\" TH Title
.\" SH Header
.\" Sh Subsection
.\" Ip Item
.\" X<> Xref (embedded
.\" Of course, you have to process the output yourself
.\" in some meaninful fashion.
.if \nF \{
.de IX
.tm Index:\\$1\t\\n%\t"\\$2"
..
.nr % 0
.rr F
.\}
.TH TTF2PT1_X2GS 1 "version 3.4.4-SNAP-030526" "May 26, 2003" "TTF2PT1 Font Converter"
.UC
.if n .hy 0
.if n .na
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.de CQ \" put $1 in typewriter font
.ft CW
'if n "\c
'if t \\&\\$1\c
'if n \\&\\$1\c
'if n \&"
\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7
'.ft R
..
.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2
. \" AM - accent mark definitions
.bd B 3
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds ? ?
. ds ! !
. ds /
. ds q
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10'
. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#]
.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u'
.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u'
.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#]
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.ds oe o\h'-(\w'o'u*4/10)'e
.ds Oe O\h'-(\w'O'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds v \h'-1'\o'\(aa\(ga'
. ds _ \h'-1'^
. ds . \h'-1'.
. ds 3 3
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
. ds oe oe
. ds Oe OE
.\}
.rm #[ #] #H #V #F C
.SH "NAME"
\fBttf2pt1_x2gs\fR \- font installer for Ghostscript
.SH "SYNOPSIS"
ttf2pt1_x2gs \fB[config-file]\fR
.SH "DESCRIPTION"
The fonts generated with \fBttf2pt1\fR work fine with Ghostscript by
themselves. The script `\fBx2gs\fR\*(R' (or `\fBttf2pt1_x2gs\fR\*(R' when installed
into a public directory, to avoid name conflicts with other
programs) links the font files from the X11 direcotry into the Ghostscript
directory and automatically creates the description file (\f(CWFontmap\fR)
in Ghostscript format.
.PP
If the configuration file is not specified as an argument then the file
`\f(CWconvert.cfg\fR\*(R' in the current directory is used, just like the
`\f(CWconvert\fR\*(R' script does. Indeed, this configuration file is used for
both scripts.
.PP
The Ghostscript-related parameters in the configuration file are:
.PP
\fB\f(CWDSTDIR\fR\fR \- the X11 font directory used by `\f(CWx2gs\fR\*(R' as the
source of the fonts. This parameter is common with the X11
configuration.
.PP
\fB\f(CWGSDIR\fR\fR \- the base directory of Ghostsript. If this
parameter is set to an empty string then `\f(CWconvert\fR\*(R' won't
call `\f(CWx2gs\fR\*(R'. So if you want to get only the X11 fonts
installed then set this parameter to an empty string. This
directory may vary on various system, so please check your
system and set this value accordingly before running the script.
.PP
\fB\f(CWGSFONTDIR\fR\fR \- the font directory of Ghostscript. In the standard
Ghostscript installation it's a subdirectory of \f(CWGSDIR\fR
but some systems may use completely different directories.
.PP
\fB\f(CWGSCONFDIR\fR\fR \- the configuration subdirectory of Ghostscript
that contains the \f(CWFontmap\fR file.
.PP
\fB\f(CWINSTALLFONTMAP\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR then
install the entries for the new fonts right into the main
\f(CWFontmap\fR file. Otherwise just leave the file \f(CWFontmap.ttf\fR
in the Ghostscript configuration directory.
.PP
After preparing the configuration file run the script. It symbolicaly links
all the font files and creates the description file \f(CWFontmap.ttf\fR in
\f(CWGSCONDFIR\fR. After that there are two choices.
.PP
If the option \f(CWINSTALLFONTMAP\fR was set to \f(CWYES\fR then
the font descriptions are also automatically installed into the
master \f(CWFontmap\fR file. The script is clever enough to
detect if it was run multiple times with the same directories
and if so it replaces the old \f(CWFontmap\fR entries with
the new ones instead of just accumulating all of them. You
may also run it multiple times for multiple X11 directories
and all the results will be properly collected in the \f(CWFontmap\fR.
But it's your responsibility to watch that the names of the
font files don't overlap. If the X11 font directory gets
renamed then you have to remove its font entries from the
\f(CWFontmap\fR and only after that re-run `\f(CWx2gs\fR\*(R'
for the new directory.
.PP
On the other hand if the option \f(CWINSTALLFONTMAP\fR was set to
\f(CWNO\fR then go to the \f(CWGSCONFDIR\fR directory and insert the
contents of \f(CWFontmap.ttf\fR into the \f(CWFontmap\fR file
manually. This step may be left manual to make the installation
a little bit more safe.
.PP
After that you may also want to redefine some of the aliases in
\f(CWFontmap\fR to refer to the newly installed fonts.
But the redefinition of the aliases may be dangerous if the width of
characters in the new font will be different from the old font.
Alas, there is no visible solution of this problem yet.
.SH "FILES"
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR/\s0scripts/convert.cfg.sample
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR/\s0scripts/*
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR/README\s0
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR/FONTS\s0
.Ip "\(bu" 2
\s-1TTF2PT1_SHAREDIR\s0/*
.Ip "\(bu" 2
\s-1TTF2PT1_BINDIR/\s0ttf2pt1
.SH "SEE ALSO"
.Ip "\(bu" 4
the \fIttf2pt1(1)\fR manpage
.Ip "\(bu" 4
the \fIttf2pt1_convert(1)\fR manpage
.Ip "\(bu" 4
the \fIt1asm(1)\fR manpage
.rn }` ''
.IX Title "TTF2PT1_X2GS 1"
.IX Name "B<ttf2pt1_x2gs> - font installer for Ghostscript"
.IX Header "NAME"
.IX Header "SYNOPSIS"
.IX Header "DESCRIPTION"
.IX Header "FILES"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Header "SEE ALSO"
.IX Item "\(bu"
.IX Item "\(bu"
.IX Item "\(bu"
--- NEW FILE: version.h ---
/*
* see COPYRIGHT
*/
/* version number */
#define TTF2PT1_VERSION "3.4.4-SNAP-030526"
--- NEW FILE: winbuild.bat ---
rem file to build ttf2pt1 with Visual C++
cl -DWINDOWS -c bdf.c
cl -DWINDOWS -c ttf2pt1.c
cl -DWINDOWS -c pt1.c
cl -DWINDOWS -c ttf.c
cl -DWINDOWS -c t1asm.c
cl -DWINDOWS -c bitmap.c
cl -o ttf2pt1 ttf2pt1.obj pt1.obj t1asm.obj ttf.obj bdf.obj bitmap.obj
cl -o t1asm -DWINDOWS -DSTANDALONE t1asm.c
--- NEW FILE: windows.h ---
/*
* Implementation of things missing in Windows
*/
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#undef ntohs
#undef ntohl
#undef htonl
#ifdef WINDOWS_FUNCTIONS
/* byte order */
static unsigned short StoM(unsigned short inv) {
union iconv {
unsigned short ui;
unsigned char uc[2];
} *inp, outv;
inp = (union iconv *)&inv;
outv.uc[0] = inp->uc[1];
outv.uc[1] = inp->uc[0];
return (outv.ui);
}
static unsigned int ItoM(unsigned int inv) {
union iconv {
unsigned int ui;
unsigned char uc[4];
} *inp, outv;
inp = (union iconv *)&inv;
outv.uc[0] = inp->uc[3];
outv.uc[1] = inp->uc[2];
outv.uc[2] = inp->uc[1];
outv.uc[3] = inp->uc[0];
return (outv.ui);
}
unsigned short ntohs(unsigned short inv) { return StoM(inv); }
unsigned long ntohl(unsigned long inv) { return ItoM(inv); }
unsigned long htonl(unsigned long inv) { return ItoM(inv); }
char *optarg;
int optind=1;
char getopt(int argc, char **argv, char *args) {
int n,nlen=strlen(args),nLen=0;
char nCmd;
if (argv[optind] && *argv[optind]=='-') {
nCmd=*((argv[optind]+1));
for (n=0;n<nlen;n++) {
if (args[n] == ':') continue;
if (args[n] == nCmd) {
if (args[n+1]==':') {
char retVal;
retVal=*(argv[optind]+1);
optarg=argv[optind+1];
if (!optarg) optarg="";
optind+=2;
return retVal;
} else {
char retVal;
retVal=*(argv[optind]+1);
optarg=NULL;
optind+=1;
return retVal;
}
}
}
}
return -1;
}
#else
unsigned short ntohs(unsigned short inv);
unsigned long ntohl(unsigned long inv);
unsigned long htonl(unsigned long inv);
extern char *optarg;
extern int optind;
char getopt(int argc, char **argv, char *args);
#endif
- Previous message: [xorg-commit-diffs] xc/lib/XprintUtil Imakefile, NONE,
1.1.2.1 xprintutil.c, NONE, 1.1.2.1 xprintutil.h, NONE,
1.1.2.1 xprintutil_printtofile.c, NONE, 1.1.2.1
- Next message: [xorg-commit-diffs] xc/extras/freetype2/include/freetype/config
ftoption.h, 1.1.4.1.6.1, 1.1.4.1.6.1.6.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the xorg-commit-diffs
mailing list