Primer commit del sistema avantika sin cambios

This commit is contained in:
2026-01-06 19:42:24 -06:00
commit 3ae4be5957
7127 changed files with 440072 additions and 0 deletions

24
pdf/lib/ttf2ufm/README.TXT Executable file
View File

@@ -0,0 +1,24 @@
To embed TrueType fonts (.TTF) files, you need to extract the font metrics and
build the required tables using the provided utility (/fonts/ttf2ufm).
TTF2UFM is a modified version of Mark Heath's TTF 2 PT1 converter
(http://ttf2pt1.sourceforge.net/) by Steven Wittens <steven@acko.net>
(http://www.acko.net/blog/ufpdf). ttf2ufm, is included in /ttf2ufm-src.
The /fonts/ttf2ufm folder contains a compiled Windows binary.
TTF 2 UFM is identical to TTF 2 PT1 except that it also generates a .ufm file
for usage with makefontuni.php.
Setting up a Truetype font for usage with TCPDF:
1) Generate the font's .ufm metrics file by processing it with the provided
ttf2ufm program (modified ttf2pt1). For example:
$ ttf2ufm -a -F myfont.ttf
2) Run makefontuni.php with the .ttf and .ufm filenames as argument:
$ php -q makefontuni.php myfont.ttf myfont.ufm
3) Copy the resulting .php, .z and .ctg.z file to the TCPDF font directory.
4) Rename php font files variations for bold and italic using the following schema:
[basic-font-name]b.php for bold variation
[basic-font-name]i.php for oblique variation
[basic-font-name]bi.php for bold oblique variation
5) Convert all fonts filenames to lowercase.

BIN
pdf/lib/ttf2ufm/bin/ttf2ufm.exe Executable file

Binary file not shown.

0
pdf/lib/ttf2ufm/src/CHANGES Executable file
View File

815
pdf/lib/ttf2ufm/src/CHANGES.html Executable file
View File

@@ -0,0 +1,815 @@
<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 -- December 31, 2003
</H4>
<!
-------
>
<b>New features:</b>
<ul>
<li> Improved the auto-vectoring (-OV) alrogithm.
<li> Allow use of any encoding table of format 4 in the ttf parser.
<li> Take the first available format 4 encoding table if no known
table is found in the ttf parser.
<li> The ttf parser lists the available encodings if no supported
encoding table is found. This can be used to list the encodings in
any font by specifying a bogus explicit PID/EID, such as
with option <b>-l plane+pid=50,eid=50</b>.
</ul>
<b>Bug fixes:</b>
<ul>
<li> Fix to build all the features on Windows MS C++, by Tomoo Amano.
<li> Fix for a null pointer in the encodings, bad inner loop variable.
<li> Unified the parsing of font name strings and improved the checks
against invalid characters.
</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 &lt;fontname&gt; command-line argument optional; default to &lt;ttf-file&gt;
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>

87
pdf/lib/ttf2ufm/src/COPYRIGHT Executable file
View File

@@ -0,0 +1,87 @@
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-2003 by the AUTHORS:
Andrew Weeks <ccsaw@bath.ac.uk>
Frank M. Siegert <fms@this.net>
Mark Heath <mheath@netspace.net.au>
Thomas Henlich <thenlich@rcs.urz.tu-dresden.de>
Sergey Babkin <babkin@users.sourceforge.net>, <sab123@hotmail.com>
Turgut Uyar <uyar@cs.itu.edu.tr>
Rihardas Hepas <rch@WriteMe.Com>
Szalay Tamas <tomek@elender.hu>
Johan Vromans <jvromans@squirrel.nl>
Petr Titera <P.Titera@sh.cvut.cz>
Lei Wang <lwang@amath8.amt.ac.cn>
Chen Xiangyang <chenxy@sun.ihep.ac.cn>
Zvezdan Petkovic <z.petkovic@computer.org>
Rigel <rigel863@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@cs.itu.edu.tr>
The Unicode translation table for the Turkish language.
Rihardas Hepas <rch@WriteMe.Com>
The Unicode translation table for the Baltic languages.
Szalay Tamas <tomek@elender.hu>
The Unicode translation table for the Central European languages.
Johan Vromans <jvromans@squirrel.nl>
The RPM file.
Petr Titera <P.Titera@sh.cvut.cz>
The Unicode map format with names, the forced Unicode option.
Frank M. Siegert <frank@this.net>
Port to Windows
Lei Wang <lwang@amath8.amt.ac.cn>
Chen Xiangyang <chenxy@sun.ihep.ac.cn>
Translation maps for Chinese fonts.
Zvezdan Petkovic <z.petkovic@computer.org>
The Unicode translation tables for the Cyrillic alphabet.
Rigel <rigel863@yahoo.com>
Generation of the dvips encoding files, modification to the Chinese maps.
I. Lee Hetherington <ilh@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.

462
pdf/lib/ttf2ufm/src/FONTS Executable file
View File

@@ -0,0 +1,462 @@
Sergey A. Babkin
<babkin@bellatlantic.net> or <sab123@hotmail.com>
(Do not edit this file, it is generated from FONTS.html!!!)
THE FONT INSTALLATION GUIDE
for the TTF to Type1 converter and fonts generated by it
========================================================
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 *8*.
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.
This guide considers the following issues of installation of the
fonts:
- X11
- Ghostscript
- MS Windows
- Netscape Navigator/Communicator
- Linux RPM package
- FrameMaker
- StarOffice
X11
===
To simplify the conversion a set of scripts is provided with ttf2pt1.
They are collected in the `scripts' subdirectory.
`Convert' is the master conversion script provided with ttf2pt1.
When installed into a public directory it's named `ttf2pt1_convert'
to avoid name collisions with the other programs.
It's called as:
convert [config-file]
If the configuration file is not specified as an argument then the file
`convert.cfg' in the current directory is used. This file contains
a set of configuration variables. The distribution contains a sample file
file `convert.cfg.sample'. Please copy it to `convert.cfg',
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 `convert' itself, they are
automatically updated when installing ttf2pt1.
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.
The variables in the configuration file are:
SRCDIRS - 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.
*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 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 encodings/README 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.
DSTDIR - 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.
DSTENC{language} - 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
SRCENC and DSTENC 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 SRCENC and DSTENC).
FOUNDRY - 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'.
The next few parameters control the general behavior of the converter.
They default values are set to something reasonable.
CORRECTWIDTH - if the value is set to YES then use the
converter option -w, otherwise don't use it. See the description of
this option in the README file.
REMOVET1A - if the value is set to YES then after
conversion remove the un-encoded .t1a font files and the
intermediate .xpfa font metric files.
INSTALLFONTMAP - a Ghostscript parameter, if the value is set to
YES then install the entries for the new fonts
right into the main Fontmap file. Otherwise just leave
the file Fontmap.ttf in the Ghostscript configuration
directory.
HINTSUBST - if the value is set to YES use the option
-H, 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 README file.
ENFORCEISO - if the value is set to YES 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.
ALLGLYPHS - if the value is set to YES then
include all the glyphs from the source fonts into the resulting fonts, even
if these glyphs are inaccessible. If it's set to NO 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 -a in the
README file.
GENUID - if the value is set to YES then use
the option -uA 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 `convert' script runs multiple times it will
generate the same UniqueIDs during each run. See further description
of this option in the README file.
GENUID - if the value is set to YES then create
the .pfb files, otherwise the .pfa files. The .pfb
files are more compact but contain binary data, so you may experience some
troubles when transferring them through the network.
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 ttf2pt1 installation directory if ttf2pt1
was installed or otherwise suppose that you are running `convert' with
`scripts' subdirectory being the current directory.
ENCDIR - directory containing the descriptions of encodings
MAPDIR - directory containing the external map files
Besides that a few parameters are built into the `convert' script itself.
You probably won't need to change them:
T1ASM, TTF2PT1, TRANS, T1FDIR, FORCEISO - paths to the other script
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 ttf2pt1_x2gs(1)
manual page before running `convert'. If these parameters are
set, `convert' will call the `x2gs' script automatically
to install the newly converted fonts in Ghostscript.
After creating the configuration file run the `convert' script. Look at
the result and the log file in DSTDIR.
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 FONTS.hpux gives a short description.
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 FONTS.hpux for an example, exept that you won't
need all the HP-related stuff on any other system).
Known Problems
--------------
- 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.
But there is a solution even for the generic X11. A patch located
in the subdirectory `app/X11' fixes this problem as well
as some other minor problems. Its description is provided in
app/X11/README.
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 OS as yours, you can just copy the binary fles from him.
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.
- 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 FONTS.hpux).
- The fonts.scale files created by the older versions of the
ttf2pt1 installation program (up to release 3.1) have conflicted
with the language definitions of the Xfsft font server and
parts of it included into XFree86. To overcome this incompatibility
the never versions creats the fonts.scale file describing all the
fonts as belonging to the adobe-fontspecific encoding and
the fonts.alias file with the proper names. The drawback of
this solution is that xlsfonts gives the list of twice more
fonts. But as a side effect the option ENFORCEISO in
`convert.cfg' is not required for X11 any more.
- The conversion script has no support for Eastern multi-plane fonts.
Contribution of such a support would be welcome.
Ghostscript
===========
The fonts generated with ttf2pt1 work fine with Ghostscript by
themselves. The script `x2gs' (or `ttf2pt1_x2gs' 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 (Fontmap)
in Ghostscript format.
It's called as:
x2gs [config-file]
If the configuration file is not specified as an argument then the file
`convert.cfg' in the current directory is used, just like the
`convert' script does. Indeed, this configuration file is used for
both scripts.
The Ghostscript-related parameters in the configuration file are:
DSTDIR - the X11 font directory used by `x2gs' as the
source of the fonts. This parameter is common with the X11
configuration.
GSDIR - the base directory of Ghostsript. If this
parameter is set to an empty string then `convert' won't
call `x2gs'. 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.
GSFONTDIR - the font directory of Ghostscript. In the standard
Ghostscript installation it's a subdirectory of GSDIR
but some systems may use completely different directories.
GSCONFDIR - the configuration subdirectory of Ghostscript
that contains the Fontmap file.
INSTALLFONTMAP - if the value is set to YES then
install the entries for the new fonts right into the main
Fontmap file. Otherwise just leave the file Fontmap.ttf
in the Ghostscript configuration directory.
After preparing the configuration file run the script. It symbolicaly links
all the font files and creates the description file Fontmap.ttf in
GSCONDFIR. After that there are two choices.
If the option INSTALLFONTMAP was set to YES then
the font descriptions are also automatically installed into the
master Fontmap 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 Fontmap 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 Fontmap.
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
Fontmap and only after that re-run `x2gs'
for the new directory.
On the other hand if the option INSTALLFONTMAP was set to
NO then go to the GSCONFDIR directory and insert the
contents of Fontmap.ttf into the Fontmap file
manually. This step may be left manual to make the installation
a little bit more safe.
After that you may also want to redefine some of the aliases in
Fontmap 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.
MS Windows
===========
Ttf2pt1 can be built on Windows either with native compiler or in
POSIX emulation mode.
Native MS Windows compilers require a different way to build the converter
instead of the Makefile (their make programs commonly are quite weird
and limited in capabilities). An example of batch file winbuild.bat
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.
Cygnus make 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 cygbuild.sh 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 CYGWIN1.DLL should be copied first into
C:\WINDOWS.
To run the accompanying scripts Perl for Windows will be required as well as
other tools from the Cygnus set.
The Windows support was not particularly tested, so in case of problems with
building or running the converter please let us know.
The pre-built code (possibly of an older version) of ttf2pt1 for MS Windows is
available from the GnuWin32 project from
http://gnuwin32.sourceforge.net/packages/ttf2pt1.htm
Netscape Navigator/Communicator
===============================
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 ? (*)
Luckily, we have solutions for all of these problems. They are
located in the subdirectory `app/netscape' and described
in app/netscape/README.
-------
*) See Monty Python's Flying Circus, episode 15
*8*
Netscape and cyrillic fonts
---------------------------
(courtesy of Zvezdan Petkovic)
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.
Netscape*documentFonts.charset*koi8-r: iso-8859-5
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.
Note: 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.
Linux RPM package
=================
The spec file for the creation of a Linux RPM package is located in
app/RPM. It has been contributed by Johan Vromans. When
make all is ran in the main directory it among the other
things creates the version of itself adapted to Linux in app/RPM,
you may want to copy that version back to the main directory.
Warning: Please note that the install section is incomplete, and
the installed scripts won't work until the paths inside them
are corrected.
FrameMaker
==========
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:
EncodingScheme FontSpecific
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.
NOTE by Jason Baietto: 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).
StarOffice
==========
StarOffice 5.1x has been reported to crash if the .afm file contains
spaces in the values of such statements as Version, Weight etc.
These spaces are permitted by the Adobe spec, so this is a problem of
StarOffice. The easiest way to fix these .afm 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 sed
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 ttf2pt1.

107
pdf/lib/ttf2ufm/src/FONTS.hpux Executable file
View File

@@ -0,0 +1,107 @@
Sergey A. Babkin
<babkin@bellatlantic.net> or <sab123@hotmail.com>
(Do not edit this file, it is generated from FONTS.hpux.html!!!)
How to install new Type1 fonts on an HP-UX 10.20 machine
--------------------------------------------------------
1. Add the font files to /usr/lib/X11/fonts/type1.st/typefaces.
2. Add the font descriptions to
/usr/lib/X11/fonts/type1.st/typefaces/fonts.scale. Run `mkfontdir'
in /usr/lib/X11/fonts/type1.st/typefaces. In the descriptions
you have to specify the font manufacturer as `misc', like:
-misc-courier-...
3. Copy /usr/lib/X11/fonts/type1.st/typefaces/fonts.dir to
/usr/lib/X11/fonts/type1.st/licenses/STSYSTEM/DISPLAYS/fonts.dir.
Better yet, create a symbolic link.
4. For each font encoding you are going to use create a description
file in /usr/lib/X11/fonts/stadmin/type1/charsets. 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 cp.iso8859-1
to cp.<your-encoding-name>, like cp.koi8-r.
5. Restart you X server and/or font server.
What if you don't have the `root' privileges ?
----------------------------------------------
You still can run the font server and configure your X server
to get the fonts from it.
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.
First, choose some unused port. Numbers around 9000 are a good
choice. Verify that this port is not used by somebody else
by entering
netstat -naf inet |grep 9000
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.
Go to you home directory $HOME and create some directory for
your font server, say, $HOME/fs. Copy the directory structure
of /usr/lib/X11/fonts/type1.st into $HOME/fs, so that in result
you get $HOME/fs/type1.st/<whatever was there>. Copy the directory
structure of /usr/lib/X11/fonts/stadmin/type1/charsets into $HOME/fs,
so that in result you get $HOME/fs/charsets/<whatever was there>.
Install the new fonts in these directorues as described above.
Then create the fontserver configuration file, say, $HOME/fs/xfs.cfg.
The sample contents (supposing that my $HOME is equal to /home/babkin)
is:
--------------8<----------- cut here -----------------------------
# font server configuration file
# $XConsortium: config.cpp,v 1.7 91/08/22 11:39:59 rws Exp $
rasterizers = /usr/lib/X11/fs/ufstrast.sl,/usr/lib/X11/fs/iforast.sl
clone-self = off
use-syslog = off
catalogue = /home/babkin/fs/type1.st
# in decipoints
default-point-size = 120
default-resolutions = 100,100,75,75
port=9000
error-file=/home/babkin/fs/fs.err
--------------8<----------- cut here -----------------------------
Then create the script to start your font server, say, $HOME/fs/runme:
--------------8<----------- cut here -----------------------------
TYPE1_CODEPAGE_DIR=$HOME/fs/charsets
export TYPE1_CODEPAGE_DIR
kill `ps -ef | grep $HOME/\[f\]s/xfs.cfg | awk '{print $2}'`;
nohup xfs -config $HOME/fs/xfs.cfg &
--------------8<----------- cut here -----------------------------
Don't forget to make $HOME/fs/runme executable. Then you can
execute it manually or from you .profile.
After you get your font server running, just execute the following
command (with proper host name and port number) in your X session
xset fp+ tcp/somehost:9000
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:
--------------8<----------- cut here -----------------------------
...
$HOME/fs/runme
sleep 2 # give it some time to start
xset fp+ tcp/somehost:9000
...
--------------8<----------- cut here -----------------------------

View File

@@ -0,0 +1,197 @@
<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@bellatlantic.net">
&lt;babkin@bellatlantic.net&gt;</A> or <A HREF="mailto:sab123@hotmail.com">&lt;sab123@hotmail.com&gt;</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>
&nbsp;&nbsp;-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>&lt;your-encoding-name&gt;</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>&lt;whatever was there&gt;</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>&lt;whatever was there&gt;</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&lt;----------- 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&lt;----------- cut here -----------------------------
>
<p>
Then create the script to start your font server, say, <tt>$HOME/fs/runme</tt>:
<p>
<!
--------------8&lt;----------- 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&lt;----------- 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&lt;----------- 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&lt;----------- cut here -----------------------------
>
<p>
</BODY>
</HTML>

708
pdf/lib/ttf2ufm/src/FONTS.html Executable file
View File

@@ -0,0 +1,708 @@
<HTML>
<HEAD>
<TITLE>
The ttf2pt1 font installation guide
</TITLE>
</HEAD>
<BODY>
Sergey A. Babkin
<br>
<A HREF="mailto:babkin@users.sourceforge.net">
&lt;babkin@bellatlantic.net&gt;</A> or <A HREF="mailto:sab123@hotmail.com">&lt;sab123@hotmail.com&gt;</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&lt;ttf2pt1_convert&gt; - 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&lt;[config-file]&gt; -->
<!-- =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&lt;ttf2pt1(1)&gt; -->
<!-- ==item * -->
<!-- =text L&lt;ttf2pt1_x2gs(1)&gt; -->
<!-- ==item * -->
<!-- =text L&lt;t1asm(1)&gt; -->
<!-- ==back -->
<!-- =stop -->
<A NAME="gs"></A>
<H3>
Ghostscript
</H3>
<!
===========
>
<!-- =section gs NAME -->
<!-- =text B&lt;ttf2pt1_x2gs&gt; - 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&lt;[config-file]&gt; -->
<!-- =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&lt;ttf2pt1(1)&gt; -->
<!-- ==item * -->
<!-- =text L&lt;ttf2pt1_convert(1)&gt; -->
<!-- ==item * -->
<!-- =text L&lt;t1asm(1)&gt; -->
<!-- ==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>
&nbsp;&nbsp;-------<br>
&nbsp;&nbsp;<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>
&nbsp;&nbsp;<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>

279
pdf/lib/ttf2ufm/src/Makefile Executable file
View File

@@ -0,0 +1,279 @@
# 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= -g
# 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/include/freetype2 -I/usr/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/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 -e 's|^TTF2PT1_BINDIR=$$|TTF2PT1_BINDIR=$(BINDIR)|;' \
-e 's|^TTF2PT1_LIBXDIR=$$|TTF2PT1_LIBXDIR=$(LIBXDIR)|;' \
-e '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 -e 's|TTF2PT1_BINDIR|$(BINDIR)|;' \
-e 's|TTF2PT1_LIBXDIR|$(LIBXDIR)|;' \
-e '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

814
pdf/lib/ttf2ufm/src/README Executable file
View File

@@ -0,0 +1,814 @@
TTF2PT1 - A True Type to PostScript Type 1 Font Converter
(Do not edit this file, it is generated from README.html!!!)
[
Based on ttf2pfa by Andrew Weeks, and help from Frank Siegert.
Modification by Mark Heath.
Further modification by Sergey Babkin.
The Type1 assembler by I. Lee Hetherington with modifications by
Kai-Uwe Herbing.
]
Ever wanted to install a particular font on your XServer but only could find
the font you are after in True Type Format?
Ever asked comp.fonts for a True Type to Type 1 converter and got a List
of Commercial software that doesn't run on your Operating System?
Well, this program should be the answer. This program is written in C (so it
should be portable) and therefore should run on any OS. The only limitation
is that the program requires some method of converting Big endian integers into
local host integers so the network functions ntohs and ntohl are used. These
can be replaced by macros if your platform doesn't have them.
Of course the target platform requires a C compiler and command line ability.
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.
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.
The converter is simple to run, just:
ttf2pt1 [-options] ttffont.ttf [Fontname]
or
ttf2pt1 [-options] ttffont.ttf -
The first variant creates the file Fontname.pfa (or Fontname.pfb if the
option '-b' was used) with the converted font and Fontname.afm with the
font metrics, the second one prints the font or another file (if the option
'-G' was used) on the standard output from where it can be immediately
piped through some filter. If no Fontname is specified for the first
variant, the name is generated from ttffont by replacing the .ttf
filename suffix.
Most of the time no options are neccessary (with a possible exception
of '-e'). But if there are some troubles with the resulting font, they
may be used to control the conversion.
The options are:
-a - Include all the glyphs from the source file into the converted
file. If this option is not specified then only the glyphs that have
been assigned some encoding are included, because the rest of glyphs
would be inaccessible anyway and would only consume the disk space.
But some applications are clever enough to change the encoding on
the fly and thus use the other glyphs, in this case they could
benefit from using this option. But there is a catch: the X11 library
has rather low limit for the font size. Including more glyphs increases
the file size and thus increases the chance of hitting this limit.
See app/X11/README for the description of a
patch to X11 which fixes this problem.
-b - Encode the resulting font to produce a ready .pfb file.
-d suboptions - Debugging options. The suboptions are:
a - Print out the absolute coordinates of dots in outlines. Such
a font can not be used by any program (that's why this option is
incompatible with '-e') but it has proven to be a valuable debuging
information.
r - Do not reverse the direction of outlines. The TTF fonts have
the standard direction of outlines opposite to the Type1 fonts. So
they should be reversed during proper conversion. This option
may be used for debugging or to handle a TTF font with wrong
direction of outlines (possibly, converted in a broken way from
a Type1 font). The first signs of the wrong direction are the
letters like "P" or "B" without the unpainted "holes" inside.
-e - Assemble the resulting font to produce a ready .pfa file.
[ S.B.: Personally I don't think that this option is particularly useful.
The same result may be achieved by piping the unassembled data
through t1asm, the Type 1 assembler. And, anyways, it's good to
have the t1utils package handy. But Mark and many users think that
this functionality is good and it took not much time to add this option. ]
-F - Force the Unicode encoding: any type of MS encoding specified
in the font is ignored and the font is treated like it has Unicode
encoding. WARNING: this option is intended for buggy fonts
which actually are in Unicode but are marked as something else. The
effect on the other fonts is unpredictable.
-G suboptions - 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 -G determines
which file will be written to the standard output and the rest of files
will be discarded. For example, -G A will request the AFM file.
The suboptions to disable/enable the generation of the files are:
f/F - The font file. Depending on the other options this file
will have one of the suffixes .t1a, .pfa or .pfb. If the conversion result
is requested on the standard output ('-' is used as the output file name)
then the font file will also be written there by default, if not overwritten
by another suboption of -G.
Default: enabled
a/A - The Adobe font metrics file (.afm).
Default: enabled
e/E - The dvips encoding file (.enc).
Default: disabled
-l language[+argument] - Extract the fonts for the specified language from a
multi-language Unicode font. If this option is not used the converter
tries to guess the language by the values of the shell variable LANG.
If it is not able to guess the language by LANG it tries all the
languages in the order they are listed.
After the plus sign an optional argument for the language extractor
may be specified. The format of the argument is absolutely up to
the particular language converter. The primary purpose of the
argument is to support selection of planes for the multi-plane
Eastern encodings but it can also be used in any other way. The
language extractor may decide to add the plane name in some form
to the name of the resulting font. None of the currently supported
languages make any use of the argument yet.
As of now the following languages are supported:
latin1 - for all the languages using the Latin-1 encoding
latin2 - for the Central European languages
latin4 - for the Baltic languages
latin5 - for the Turkish language
cyrillic - for the languages with Cyrillic alphabet
russian - historic synonym for cyrillic
bulgarian - historic synonym for cyrillic
adobestd - for the AdobeStandard encoding used by TeX
plane+argument - to select one plane from a multi-byte encoding
The argument of the "plane" language may be in one of three forms:
plane+pid=<pid>,eid=<eid>
plane+pid=<pid>,eid=<eid>,<plane_number>
plane+<plane_number>
Pid (TTF platform id) and eid (TTF encoding id) select a particular
TTF encoding table in the original font. They are specified as decimal
numbers. If this particular encoding table is not present in the font
file then the conversion fails. The native ("ttf") front-end parser supports
only pid=3 (Windows platform), the FreeType-based ("ft") front-end supports
any platform. If pid/eid is not specified then the TTF encoding table is
determined as usual: Unicode encoding if it's first or an 8-bit encoding
if not (and for an 8-bit encoding the plane number is silently ignored).
To prevent the converter from falling back to an 8-bit encoding, specify
the Unicode pid/eid value explicitly.
Plane_number is a hexadecimal (if starts with "0x") or decimal number.
It gives the values of upper bytes for which 256 characters will be
selected. If not specified, defaults to 0. It is also used as a font
name suffix (the leading "0x" is not included into the suffix).
NOTE:
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
'-p ft') with the "plane" language.
NOTE:
You may notice that the language names are not uniform: some are the
names of particular languages and some are names of encodings. This
is because of the different approaches. The original idea was to
implement a conversion from Unicode to the appropriate Windows
encoding for a given language. And then use the translation tables
to generate the fonts in whatever final encodings are needed. This
would allow to pile together the Unicode fonts and the non-Unicode
Windows fonts for that language and let the program to sort them out
automatically. And then generate fonts in all the possible encodings
for that language. An example of this approach is the Russian language
support. But if there is no multiplicity of encodings used for some
languages and if the non-Unicode fonts are not considered important
by the users, another way would be simpler to implement: just provide
only one table for extraction of the target encoding from Unicode
and don't bother with the translation tables. The latin* "languages"
are examples of this approach. If somebody feels that he needs the
Type1 fonts both in Latin-* and Windows encodings he or she is absolutely
welcome to submit the code to implement it.
WARNING:
Some of the glyphs included into the AdobeStandard encoding are not
included into the Unicode standard. The most typical examples of such
glyphs are ligatures like 'fi', 'fl' etc. Because of this the font
designers may place them at various places. The converter tries to
do its best, if the glyphs have honest Adobe names and/or are
placed at the same codes as in the Microsoft fonts they will be
picked up. Otherwise a possible solution is to use the option '-L'
with an external map.
-L file[+[pid=<pid>,eid=<eid>,][plane]] - Extract the fonts for the specified
language from a multi-language font using the map from this file. This is
rather like the option '-l' but the encoding map is not
compiled into the program, it's taken from that file, so it's
easy to edit. Examples of such files are provided in
maps/adobe-standard-encoding.map, CP1250.map. (NOTE:
the 'standard encoding' map does not include all the glyphs of the
AdobeStandard encoding, it's provided only as an example.) The
description of the supported map formats is in the file
maps/unicode-sample.map.
Likewise to '-l', an argument may be specified after the map file
name. But in this case the argument has fixed meaning: it selects the
original TTF encoding table (the syntax is the same as in '-l plane')
and/or a plane of the map file. The plane name also gets added after dash
to the font name. The plane is a concept used in the Eastern fonts with big
number of glyphs: one TTF font gets divided into multiple Type1 fonts,
each containing one plane of up to 256 glyphs. But with a little
creativity this concept may be used for other purposes of combining
multiple translation maps into one file. To extract multiple planes
from a TTF font ttf2pt1 must be run multiple times, each time with
a different plane name specified.
The default original TTF encoding table used for the option '-L' is
Unicode. The map files may include directives to specify different original
TTF encodings. However if the pid/eid pair is specified with
it overrides any original encoding specified in the map file.
-m type=value - 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:
h - 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 .t1a file use the script
scripts/cntstems.pl.
-O suboptions - Outline processing options. The suboptions
may be lowercase or uppercase, the lowercase ones disable the features,
the corresponding uppercase suboptions enable the same features.
The suboptions to disable/enable features are:
b/B - Guessing of 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.
Default: enabled
h/H - Autogeneration of hints. The really complex outlines
may confuse the algorithm, so theoretically it may be useful
sometimes to disable them. Although up to now it seems that
even bad hints are better than no hints at all.
Default: enabled
u/U - 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 "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 '-a', so you may want to
use '-a' together with '-Ou'. See app/X11/README 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 ttf2pt1
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
'-mh' 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 other/cmpf (see the description
in other/README) and decide which one looks better.
Default: enabled
o/O - Space optimization of the outlines' code. This kind of optimization
never hurts, and the only reason to disable this feature is for comparison
of the generated fonts with the fonts generated by the previous versions of
converter. Well, it _almost_ never hurts. As it turned out there exist
some brain-damaged printers which don't understand it. Actually this
feature does not change the outlines at all. The Type 1 font manual
provides a set of redundant operators that make font description shorter,
such as '10 hlineto' instead of '0 10 rlineto' to describe a horizontal
line. This feature enables use of these operators.
Default: enabled
s/S - Smoothing of outlines. If the font is broken in some
way (even the ones that are not easily noticeable), such smoothing
may break it further. So disabling this feature is the first thing to be
tried if some font looks odd. But with smoothing off the hint generation
algorithms may not work properly too.
Default: enabled
t/T - Auto-scaling to the 1000x1000 Type1 standard matrix. The
TTF fonts are described in terms of an arbitrary matrix up to
4000x4000. The converted fonts must be scaled to conform to
the Type1 standard. But the scaling introduces additional rounding
errors, so it may be curious sometimes to look at the font in its
original scale.
Default: enabled
v/V - Do vectorization on the bitmap fonts. Functionally
"vectorization" is the same thing as "autotracing", a different word is
used purely to differentiate it from the Autotrace library. It tries to
produce nice smooth outlines from bitmaps. This feature is still a work
in progress though the results are already mostly decent.
Default: disabled
w/W - Glyphs' width corection. This option is designed 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.
Default: disabled
z/Z - Use the Autotrace library on the bitmap fonts. The results
are horrible and the use of this option is not recommended. This option is
present for experimental purposes. It may change or be removed in the
future. The working tracing can be achieved with option -OV.
Default: disabled
-p parser_name - Use the specified front-end parser to read the font file.
If this option is not used, 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:
ttf - built-in parser for the ttf files (suffix .ttf)
bdf - built-in parser for the BDF files (suffix .bdf)
ft - parser based on the FreeType-2 library (suffixes .ttf,
.otf, .pfa, .pfb)
The parser ft is NOT linked in by default. See Makefile
for instructions 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.
The conversion of the bitmap fonts (such as BDF) is simplistic yet,
producing jagged outlines. When converting such fonts, it might be
a good idea to turn off the hint substitution (using option -Ou)
because the hints produced will be huge but not adding much to the
quality of the fonts.
-u number - 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 ID is supposed to be unique, as it name says. And
there is no easy way to create a guaranteed unique ID. 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 'A' is given
then the converter generates the value of UniqueID automatically,
as a hash of the font name. (NOTE: 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:
cat *.pf[ab] | grep UniqueID | sort | uniq -c | grep -v ' 1 '
Or if you use scripts/convert it will do that for you automatically
plus it will also give the exact list of files with duplicate UIDs.
-v size - Re-scale the font to get the size of a typical uppercase
letter somewhere around the specified size. Actually, it re-scales
the whole font to get the size of one language-dependent letter to be
at least of the specified size. Now this letter is "A" 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.
-W level - 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.
Obsolete option:
-A - Print the font metrics (.afm file) instead of the font on STDOUT.
Use -GA instead.
Very obsolete option:
The algorithm that implemented the forced fixed width had major
flaws, so it was disabled. The code is still in the program and
some day it will be refined and returned back. Meanwhile the
option name '-f' was reused for another option. The old version was:
-f - Don't try to force the fixed width of font. Normally the converter
considers the fonts in which the glyph width deviates by not more
than 5% as buggy fixed width fonts and forces them to have really
fixed width. If this is undesirable, it can be disabled by this option.
The .pfa font format 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 '-e'
or use the t1asm program to assemble (that means, encode and
encrypt) the font program. The t1asm program that is included with
the converter is actually a part of the t1utils package, rather old
version of which may be obtained from
http://ttf2pt1.sourceforge.net/t1utils.tar.gz
Note that t1asm from the old version of that package won't work properly
with the files generated by ttf2pt1 version 3.20 and later. Please use
t1asm packaged with ttf2pt1 or from the new version t1utils
instead. For a newer version of t1utils please look at
http://www.lcdf.org/~eddietwo/type/
So, the following command lines:
ttf2pt1 -e ttffont.ttf t1font
ttf2pt1 ttffont.ttf - | t1asm >t1font.pfa
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.
Installation and deinstallation of the converter
------------------------------------------------
The converter may be easily installed systemwide with
make install
and uninstalled with
make uninstall
By default the Makefile is configured to install in the hierarchy
of directory /usr/local. This destination directory as well as
the structure of the hierarchy may be changed by editing the Makefile.
Installation of the fonts
-------------------------
Running the converter manually becomes somewhat boring if it has to
be applied to a few hundreds of fonts and then you have to generate the
fonts.scale and/or Fontmap files. The FONTS file describes how to use
the supplied scripts to handle such cases easily. It also discusses
the installation of the fonts for a few widespread programs.
Other utilities
---------------
A few other small interesting programs that allow a cloase look at
the fonts are located in the subdirectory 'other'. They
are described shortly in others/README.
Optional packages
-----------------
Some auxiliary files are not needed by everyone and are big enough that
moving them to a separate package speeds up the downloads of the main
package significantly. As of now we have one such optional package:
ttf2pt1-chinese - contains the Chinese conversion maps
The general versioning policy for the optional packages is the following:
These packages may have no direct dependency on the ttf2pt1 version.
But they may be updated in future, as well as some versions of optional
packages may have dependencies on certain versions of ttf2pt1.
To avoid unneccessary extra releases on one hand and keep the updates in
sync with the ttf2pt1 itself on the other hand, a new version of an optional
package will be released only if there are any changes to it and it will be
given the same version number as ttf2pt1 released at the same time. So not
every release of ttf2pt1 would have a corresponding release of all optional
packages. For example, to get the correct version of optional packages for an
imaginary release 8.3.4 of ttf2pt1 you would need to look for optional
packages of the highest version not higher than (but possibly equal to) 8.3.4.
TO DO:
------
- Improve hinting.
- Improve the auto-tracing of bitmaps.
- Implement the family-level hints.
- Add generation of CID-fonts.
- Handle the composite glyphs with relative base points.
- Preserve the relative width of stems during scaling to 1000x1000 matrix.
- Add support for bitmap TTF fonts.
- Implement better support of Asian encodings.
- Implement automatic creation of ligatures.
TROUBLESHOOTING AND BUG REPORTS
-------------------------------
Have problems with conversion of some font ? The converter dumps core ? Or your
printer refuses to understand the converted fonts ? Or some characters are
missing ? Or some characters look strange ?
Send the bug reports to the ttf2pt1 development mailing list at
ttf2pt1-devel@lists.sourceforge.net.
Try to collect more information about the problem and include it into
the bug report. (Of course, even better if you would provide a ready
fix, but just a detailed bug report is also good). Provide detailed
information about your problem, this will speed up the response greatly.
Don't just write "this font looks strange after conversion" but describe
what's exactly wrong with it: for example, what characters look wrong
and what exactly is wrong about their look. Providing a link to the
original font file would be also a good idea. Try to do a little
troublehooting and report its result. This not only would help with
the fix but may also give you a temporary work-around for the bug.
First, enable full warnings with option '-W99', save them to
a file and read carefully. Sometimes the prolem is with a not implemented
feature which is reported in the warnings. Still, reporting about such
problems may be a good idea: some features were missed to cut corners,
in hope that no real font is using them. So a report about a font using
such a feature may motivate someone to implement it. Of course, you
may be the most motivated person: after all, you are the one wishing
to convert that font. ;-) Seriously, the philosophy "scrath your own itch"
seems to be the strongest moving force behind the Open Source software.
The next step is playing with the options. This serves a dual purpose:
on one hand, it helps to localize the bug, on the other hand you may be
able to get a working version of the font for the meantime while the
bug is being fixed. The typical options to try out are: first '-Ou', if
it does not help then '-Os', then '-Oh', then '-Oo'.
They are described in a bit more detail above. Try them one by one
and in combinations. See if with them the resulting fonts look better.
On some fonts 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.
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.
CONTACTS
--------
ttf2pt1-announce@lists.sourceforge.net
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@lists.sourceforge.net and somebody
will help you with subscription.
ttf2pt1-devel@lists.sourceforge.net
ttf2pt1-users@lists.sourceforge.net
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@lists.sourceforge.net and somebody
will help you with subscription.
mheath@netspace.net.au
Mark Heath
A.Weeks@mcc.ac.uk
Andrew Weeks
babkin@users.sourceforge.net (preferred)
sab123@hotmail.com
http://members.bellatlantic.net/~babkin
Sergey Babkin
SEE ALSO
--------
http://ttf2pt1.sourceforge.net
The main page of the project.
http://www.netspace.net.au/~mheath/ttf2pt1/
The old main page of the project.
http://sourceforge.net/projects/gnuwin32
Precompiled binaries for Windows.
http://www.lcdf.org/~eddietwo/type/
The home page of the Type 1 utilities package.
http://www.rightbrain.com/pages/books.html
The first book about PostScript on the Web, "Thinking in PostScript".
http://fonts.apple.com/TTRefMan/index.html
The True Type reference manual.
http://partners.adobe.com/asn/developer/PDFS/TN/PLRM.pdf
Adobe PostScript reference manual.
http://partners.adobe.com/asn/developer/PDFS/TN/T1_SPEC.PDF
Specification of the Type 1 font format.
http://partners.adobe.com/asn/developer/PDFS/TN/5015.Type1_Supp.pdf
The Type 1 font format supplement.
http://partners.adobe.com/asn/developer/PDFS/TN/5004.AFM_Spec.pdf
Specification of the Adobe font metrics file format.
http://www.cs.wpi.edu/~matt/courses/cs563/talks/surface/bez_surf.html
http://www.cs.wpi.edu/~matt/courses/cs563/talks/curves.html
Information about the Bezier curves.
http://www.neuroinformatik.ruhr-uni-bochum.de/ini/PEOPLE/rmz/t1lib/t1lib.html
A stand-alone library supporting the Type1 fonts. Is neccessary
to compile the programs other/cmpf and other/dmpf.
http://www.freetype.org
A library supporting the TTF fonts. Also many useful TTF programs
are included with it.
http://heliotrope.homestead.com/files/printsoft.html
Moses Gold's collection of links to printing software.
http://linuxartist.org/fonts/
Collection of font-related links.
----------------------------------------------------------------------
----------------------------------------------------------------------
Following is the Readme of ttf2pfa (true type to type 3 font converter) It
covers other issues regarding the use of this software. Please note that
although ttf2pfa is a public domain software, ttf2pt1
is instead covered by an Open Source license. See the COPYRIGHT
file for details.
Please note also that ttf2pfa has not been maintained for a long time.
All of its functionality has been integrated into ttf2pt1 and all the
development moved to ttf2pt1, including Andrew Weeks, the author of
ttf2pfa. Ttf2pfa is provided for historical reasons only. Please use
ttf2pt1 instead.
----------------------------------------------------------------------
True Type to Postscript Font converter
--------------------------------------
My mind is still reeling from the discovery that I was able to write
this program. What it does is it reads a Microsoft TrueType font and
creates a Postscript font. '_A_ postscript font', that is, not necessarily
the same font, you understand, but a fair imitation.
Run it like this:
ttf2pfa fontfile.ttf fontname
The first parameter is the truetype filename, the second is a stem for
the output file names. The program will create a fontname.pfa containing
the Postscript font and a fontname.afm containing the metrics.
The motivation behind this is that in Linux if you do not have a
Postscript printer, but only some other printer, you can only print
Postscript by using Ghostscript. But the fonts that come with
Ghostscript are very poor (they are converted from bitmaps and look
rather lumpy). This is rather frustrating as the PC running Linux
probably has MS-Windows as well and will therefore have truetype fonts,
but which are quite useless with Linux, X or Ghostscript.
The program has been tested on over a hundred different TrueType fonts
from various sources, and seems to work fairly well. The converted
characters look OK, and the program doesn't seem to crash any more. I'm
not sure about the AFM files though, as I have no means to test them.
The fonts generated will not work with X, as the font rasterizer that
comes with X only copes with Type 1 fonts. If I have the time I may
modify ttf2pfa to generate Type 1s.
Copyright issues
----------------
I am putting this program into the public domain, so don't bother
sending me any money, I'd only have to declare it for income tax.
Copyright on fonts, however, is a difficult legal question. Any
copyright statements found in a font will be preserved in the output.
Whether you are entitled to translate them at all I don't know.
If you have a license to run a software package, like say MS-Windows, on
your PC, then you probably have a right to use any part of it, including
fonts, on that PC, even if not using that package for its intended
purpose.
I am not a lawyer, however, so this is not a legal opinion, and may be
garbage.
There shouldn't be a any problem with public domain fonts.
About the Program
-----------------
It was written in C on a IBM PC running Linux.
The TrueType format was originally developed by Apple for the MAC, which
has opposite endianness to the PC, so to ensure compatibility 16 and 32
bit fields are the wrong way round from the PC's point of view. This is
the reason for all the 'ntohs' and 'ntohl' calls. Doing it this way
means the program will also work on big-endian machines like Suns.
I doubt whether it will work on a DOS-based PC though.
The program produces what technically are Type 3 rather than Type 1
fonts. They are not compressed or encrypted and are plain text. This is
so I (and you) can see what's going on, and (if you're a Postscript guru
and really want to) can alter the outlines.
I only translate the outlines, not the 'instructions' that come with
them. This latter task is probably virtually impossible anyway. TrueType
outlines are B-splines rather than the Bezier curves that Postscript
uses. I believe that my conversion algorithm is reasonably correct, if
nothing else because the characters look right.
Problems that may occur
-----------------------
Most seriously, very complex characters (with lots of outline segments)
can make Ghostscript releases 2.x.x fail with a 'limitcheck' error. It
is possible that this may happen with some older Postscript printers as
well. Such characters will be flagged by the program and there are
basically two things you can do. First is to edit the .pfa file to
simplify or remove the offending character. This is not really
recommended. The second is to use Ghostscript release 3, if you can get
it. This has much larger limits and does not seem to have any problems
with complex characters.
Then there are buggy fonts (yes, a font can have bugs). I try to deal
with these in as sane a manner as possible, but it's not always
possible.
Encodings
---------
A postscript font must have a 256 element array, called an encoding,
each element of which is a name, which is also the name of a procedure
contained within the font. The 'BuildChar' command takes a byte and uses
it to index the encoding array to find a character name, and then looks
that up in the font's procedure table find the commands to draw the
glyph. However, not all characters need be in the encoding array. Those
that are not cannot be drawn (at least not using 'show'), however it is
possible to 're-encode' the font to enable these characters. There are
several standard encodings: Adobe's original, ISO-Latin1 and Symbol
being the most commonly encountered.
TrueType fonts are organised differently. As well as the glyph
descriptions there are a number of tables. One of these is a mapping
from a character set into the glyph array, and another is a mapping from
the glyph array into a set of Postscript character names. The problems
are:
1) Microsoft uses Unicode, a 16-bit system, to encode the font.
2) that more than one glyph is given the same Postscript name.
I deal with (1) by assuming a Latin1 encoding. The MS-Windows and
Unicode character sets are both supersets of ISO-8859-1. This usually
means that most characters will be properly encoded, but you should be
warned that some software may assume that fonts have an Adobe encoding.
Symbol, or Dingbat, fonts are in fact less of a problem, as they have
private encodings starting at 0xF000. It is easy to just lose the top
byte.
Postscript fonts can be re-encoded, either manually, or by software.
Groff, for example, generates postscript that re-encodes fonts with the
Adobe encoding. The problem here is that not all characters in the Adobe
set are in the MS-Windows set. In particular there are no fi and fl
ligatures. This means that conversions of the versions of
Times-New-Roman and Arial that come with MS-Windows cannot be used
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).
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.
(almost every TrueType font has three glyphs called .notdef, 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 .notdef characters are only
used for unprintable characters, which shouldn't occur in your documents
anyway).

View File

@@ -0,0 +1,4 @@
To get the plain-text README and installation guides run:
make docs

1182
pdf/lib/ttf2ufm/src/README.html Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,279 @@
# 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= -O2 -D_GNU_SOURCE
# For GNU C
#
CFLAGS_SYS= -O2 -D_GNU_SOURCE
#
# 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/include/freetype2 -I/usr/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/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 = /home/eclecticgeek/apps
# 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 = eclecticgeek
GROUP = pg1755828
# 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 -e 's|^TTF2PT1_BINDIR=$$|TTF2PT1_BINDIR=$(BINDIR)|;' \
-e 's|^TTF2PT1_LIBXDIR=$$|TTF2PT1_LIBXDIR=$(LIBXDIR)|;' \
-e '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 -e 's|TTF2PT1_BINDIR|$(BINDIR)|;' \
-e 's|TTF2PT1_LIBXDIR|$(LIBXDIR)|;' \
-e '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

View File

@@ -0,0 +1,40 @@
Summary: TrueType to Adobe Type 1 font converter
Name: ttf2pt1
Version: 3.4.4
Release: 1jv
Source: %{name}-%{version}.tgz
Copyright: Distributable
Group: Utilities/Printing
BuildRoot: /var/tmp/ttf2pt1
%description
* True Type Font to Adobe Type 1 font converter
* By Mark Heath <mheath@netspace.net.au>
* Based on ttf2pfa by Andrew Weeks <ccsaw@bath.ac.uk>
* With help from Frank M. Siegert <fms@this.net>
%prep
%setup
%build
make all
%install
rm -fr $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/local/bin
mkdir -p $RPM_BUILD_ROOT/usr/local/share/%{name}
mkdir -p $RPM_BUILD_ROOT/usr/local/doc
install -s -m 0555 ttf2pt1 $RPM_BUILD_ROOT/usr/local/bin
install -m 0555 scripts/* $RPM_BUILD_ROOT/usr/local/share/%{name}
chmod 0444 $RPM_BUILD_ROOT/usr/local/share/%{name}/convert.cfg.sample
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644, root, root, 755)
%doc README README.html INSTALL INSTALL.html
/usr/local/bin/ttf2pt1
/usr/local/share/%{name}

View File

@@ -0,0 +1,40 @@
Summary: TrueType to Adobe Type 1 font converter
Name: ttf2pt1
Version: XXX
Release: 1jv
Source: %{name}-%{version}.tgz
Copyright: Distributable
Group: Utilities/Printing
BuildRoot: /var/tmp/ttf2pt1
%description
* True Type Font to Adobe Type 1 font converter
* By Mark Heath <mheath@netspace.net.au>
* Based on ttf2pfa by Andrew Weeks <ccsaw@bath.ac.uk>
* With help from Frank M. Siegert <fms@this.net>
%prep
%setup
%build
make all
%install
rm -fr $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/local/bin
mkdir -p $RPM_BUILD_ROOT/usr/local/share/%{name}
mkdir -p $RPM_BUILD_ROOT/usr/local/doc
install -s -m 0555 ttf2pt1 $RPM_BUILD_ROOT/usr/local/bin
install -m 0555 scripts/* $RPM_BUILD_ROOT/usr/local/share/%{name}
chmod 0444 $RPM_BUILD_ROOT/usr/local/share/%{name}/convert.cfg.sample
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644, root, root, 755)
%doc README README.html INSTALL INSTALL.html
/usr/local/bin/ttf2pt1
/usr/local/share/%{name}

View File

@@ -0,0 +1,51 @@
Scripts to support CJK-LaTeX
by Mike Fabian
<mfabian@suse.de>
The tiny Perl-script 'sfd2map' converts .sfd files (as used by
CJK-LaTeX) to .map files (as used by ttf2pt1).
Actually I currently don't use that script stand-alone for performance
reasons.
Currently I use such a conversion in another small script 'cjk-latex-config'
(attached as well) which creates .tfm files usable with CJK-LaTeX
from TrueType fonts as listed in /etc/ttf2pk/ttfonts.map. When called like
cjk-latex-config --type1
this script will use ttf2pt1 to generate .pfb files as well from these TrueType
fonts to be used with CJK-LaTeX.
The .sfd files cannot be directly used as input to ttf2pt1 because the
format of the .map files which ttf2pt1 expects is slightly different,
therefore I made the 'sfd2map' converter script.
But then I noticed that I would have to parse the generated map file
*again* to get a list of the plane numbers to use. That seemed to be a
bit wastful because I had just parsed the .sfd file to convert it to
.map, therefore I included sfd2map as a function in 'cjk-latex-config'
as well and collected the plane numbers during the conversion.
But 'cjk-latex-config' is maybe a little bit SuSE specific, therefore
I kept 'sfd2map' also as a standalong script. Use it if you like.
'cjk-latex-config' calls another small script 'cjk-latex-t1mapgen'
to generate a cjk-latex.map file containing something like
cyberb00 BitstreamCyberbit-Roman-00 <cyberb00.pfb
cyberb01 BitstreamCyberbit-Roman-01 <cyberb01.pfb
cyberb02 BitstreamCyberbit-Roman-02 <cyberb02.pfb
[...]
after all .pfb files have been generated.
Maybe this is also SuSE specific, I'm not sure about in what
directories the relevant files are stored on other Linux-like systems.
I'm not yet sure whether they work on other systems beside SuSE Linux.
They have hard coded path names where to find the TrueType fonts,
ttfonts.map, the TeX fonts etc and cjk-latex-config checks
whether freetype-tools.rpm is installed. freetype-tools.rpm might
have another name for other distributions and for distributions
which don't use rpm this check can't work anyway.
These are small details and it should not be difficult to adapt the
scripts for other Linux-like systems though.

View File

@@ -0,0 +1,80 @@
<HTML>
<HEAD>
<TITLE>
Scripts to support CJK-LaTeX
</TITLE>
</HEAD>
<BODY>
<H2>
Scripts to support CJK-LaTeX
</H2>
by Mike Fabian
&lt;mfabian@suse.de&gt;
<p>
The tiny Perl-script '<tt>sfd2map</tt>' converts <tt>.sfd</tt> files (as used by
CJK-LaTeX) to <tt>.map</tt> files (as used by ttf2pt1).
<p>
Actually I currently don't use that script stand-alone for performance
reasons.
<p>
Currently I use such a conversion in another small script '<tt>cjk-latex-config</tt>'
(attached as well) which creates <tt>.tfm</tt> files usable with CJK-LaTeX
from TrueType fonts as listed in <tt>/etc/ttf2pk/ttfonts.map</tt>. When called like
<br>
&nbsp;&nbsp;<tt>cjk-latex-config --type1</tt>
<br>
this script will use ttf2pt1 to generate <tt>.pfb</tt> files as well from these TrueType
fonts to be used with CJK-LaTeX.
<p>
The <tt>.sfd</tt> files cannot be directly used as input to ttf2pt1 because the
format of the <tt>.map</tt> files which ttf2pt1 expects is slightly different,
therefore I made the '<tt>sfd2map</tt>' converter script.
<p>
But then I noticed that I would have to parse the generated map file
*again* to get a list of the plane numbers to use. That seemed to be a
bit wastful because I had just parsed the <tt>.sfd</tt> file to convert it to
<tt>.map</tt>, therefore I included <tt>sfd2map</tt> as a function in '<tt>cjk-latex-config</tt>'
as well and collected the plane numbers during the conversion.
<p>
But '<tt>cjk-latex-config</tt>' is maybe a little bit SuSE specific, therefore
I kept '<tt>sfd2map</tt>' also as a standalong script. Use it if you like.
<p>
'<tt>cjk-latex-config</tt>' calls another small script '<tt>cjk-latex-t1mapgen</tt>'
to generate a <tt>cjk-latex.map</tt> file containing something like
<br>
<tt>&nbsp;&nbsp;cyberb00 BitstreamCyberbit-Roman-00 &lt;cyberb00.pfb</tt>
<br>
<tt>&nbsp;&nbsp;cyberb01 BitstreamCyberbit-Roman-01 &lt;cyberb01.pfb</tt>
<br>
<tt>&nbsp;&nbsp;cyberb02 BitstreamCyberbit-Roman-02 &lt;cyberb02.pfb</tt>
<br>
<tt>&nbsp;&nbsp;[...]</tt>
<br>
after all <tt>.pfb</tt> files have been generated.
<p>
Maybe this is also SuSE specific, I'm not sure about in what
directories the relevant files are stored on other Linux-like systems.
<p>
I'm not yet sure whether they work on other systems beside SuSE Linux.
They have hard coded path names where to find the TrueType fonts,
<tt>ttfonts.map</tt>, the TeX fonts etc and <tt>cjk-latex-config</tt> checks
whether freetype-tools.rpm is installed. freetype-tools.rpm might
have another name for other distributions and for distributions
which don't use rpm this check can't work anyway.
<p>
These are small details and it should not be difficult to adapt the
scripts for other Linux-like systems though.
<p>
</BODY>
</HTML>

View File

@@ -0,0 +1,352 @@
#!/usr/bin/perl -w
#
# Copyright (c) 2002 SuSE Linux AG, Nuernberg, Germany. All rights reserved.
#
# Author: Mike Fabian <mfabian@suse.de>, 2002
#
use English;
use Getopt::Long;
# check if we are started as root
# only one of UID and USER must be set correctly
if ($UID != 0 && $ENV{USER} !~ /root/) {
print "You must be root to start $0\n";
exit 1;
}
if (system ("rpm -q freetype-tools >/dev/null 2>&1") != 0) {
print "freetype-tools package missing, exiting.\n";
exit 1;
}
sub usage {
print "Usage: cjk-latex-config [--verbose|v] [--force|f] [--type1|t]\n";
exit 1;
}
# Process command line options
my %opt;
unless (GetOptions(\%opt,
'verbose|v', \$OPT_VERBOSE,
'force|f', \$OPT_FORCE,
'type1|t', \$OPT_TYPE1,
)) {
&usage();
exit 1;
}
# to make sure ttf2tfm finds the .sdf files:
system("texhash");
$tfm_created = 0;
$type1_created = 0;
system("mkdir -p /usr/share/texmf/fonts/truetype/");
open (TTFONTS_MAP, "/etc/ttf2pk/ttfonts.map");
while (<TTFONTS_MAP>) {
chomp($ARG);
if ($ARG =~ /\@[a-zA-Z0-9\/]+\@/) {
if($OPT_VERBOSE) {
print "----------------------------------------------------------------------\n";
print "$ARG\n";
}
@fields = split(/\s+/, $ARG);
$tt_dir = "/usr/X11R6/lib/X11/fonts/truetype/";
$tt_basename = $fields[1];
if ($fields[0] =~ /([^\s]+)\@[a-zA-Z0-9\/]+\@/) {
$latex_font_name = $1;
} else {
print "can't find latex font name.\n";
exit 1
}
if ($fields[0] =~ /\@([a-zA-Z0-9\/]+)\@/) {
$sfd_name = $1;
$sfd_name =~ /.*\/([a-zA-Z0-9]+)/;
$sfd_basename = $1;
} else {
print "can't find sfd_name.\n";
exit 1
}
if ($ARG =~ /Pid=([0-9]+)/) {
$pid = "$1";
} else {
$pid = "3";
}
if ($ARG =~ /Eid=([0-9]+)/) {
$eid = "$1";
} else {
$eid = "1";
}
if ($ARG =~ /Slant=([0-9.]+)/) {
$slant = $1;
$slant_opt = "-s $1";
} else {
$slant = 0;
$slant_opt = "-s 0";
}
if ($ARG =~ /Rotate=(Yes)/) {
$rotate = 1;
$rotate_opt = "-x";
} else {
$rotate = 0;
$rotate_opt = "";
}
if (-e "$tt_dir/$tt_basename") {
symlink("$tt_dir/$tt_basename",
"/usr/share/texmf/fonts/truetype/$tt_basename");
$tfm_dir = "/usr/share/texmf/fonts/tfm/cjk-latex/";
$type1_dir = "/usr/share/texmf/fonts/type1/cjk-latex/";
if (0 != create_or_update_tfm ()) {
print "creating .tfm failed.\n";
}
if ($OPT_TYPE1 && $slant == 0 && $rotate == 0) {
if (0 != create_or_update_type1 ()) {
print "creating type1 font failed.\n";
}
}
}
}
}
if ($type1_created) {
$command = "cjk-latex-t1mapgen $type1_dir";
if (0 != system ($command)) {
print "$command failed.\n";
exit 1;
}
}
if ($tfm_created || $type1_created) {
system("texhash");
}
exit 0;
######################################################################
sub create_or_update_tfm {
if ($OPT_FORCE ||
mtime_differs_or_missing ("$tt_dir/$tt_basename",
"$tfm_dir/$sfd_basename/$latex_font_name/")) {
if (0 != system ("mkdir -p $tfm_dir/$sfd_basename/$latex_font_name/")) {
print "mkdir -p $tfm_dir/$sfd_basename/$latex_font_name/ failed.\n";
exit 1;
}
if (! chdir ("$tfm_dir/$sfd_basename/$latex_font_name/")) {
print "can't chdir to $tfm_dir/$sfd_basename/$latex_font_name/\n";
exit 1;
}
$command = "ttf2tfm $tt_dir/$tt_basename ";
unless ($OPT_VERBOSE) {
$command .= " -q";
}
$command .= " -P $pid -E $eid $rotate_opt $slant_opt $latex_font_name\@$sfd_name\@";
if ($OPT_VERBOSE) {
print "$command\n";
} else {
$command .= " > /dev/null 2>&1";
print "$latex_font_name\@$sfd_name\@: calling ttf2tfm ...\n";
}
if (0 != system($command)) {
print "$command failed.\n";
return 1;
}
# success, mark this by giving the created directory the same time stamp
# as the TT-font:
system("touch -r $tt_dir/$tt_basename $tfm_dir/$sfd_basename/$latex_font_name/");
$tfm_created = 1;
return 0;
}
}
######################################################################
sub create_or_update_type1 {
if ($OPT_FORCE ||
mtime_differs_or_missing ("$tt_dir/$tt_basename",
"$type1_dir/$sfd_basename/$latex_font_name/")) {
if (0 != system ("mkdir -p $type1_dir/$sfd_basename/$latex_font_name/")) {
print "mkdir -p $type1_dir/$sfd_basename/$latex_font_name/ failed.\n";
exit 1;
}
if (! chdir ("$type1_dir/$sfd_basename/$latex_font_name/")) {
print "can't chdir to $type1_dir/$sfd_basename/$latex_font_name/\n";
exit 1;
}
if (grep(/$tt_basename/,("wadalab-gothic.ttf","watanabe-mincho.ttf"))) {
print "$tt_basename does not work with ttf2pt1, skipping ...\n";
return 0;
}
# disable smoothing of outlines for broken fonts
# (for details see 'man ttf2pt1'):
my $smoothing_opt = " ";
if (grep(/$tt_basename/,("kochi-gothic.ttf"))) {
print "$tt_basename broken, disabling smoothing of outlines.\n";
$smoothing_opt = " -O s ";
}
$sfd_file = "/usr/share/texmf/ttf2tfm/$sfd_basename.sfd";
$map_file = `mktemp /tmp/cjk-latex-config-map.XXXXXX`;
chomp $map_file;
if ($map_file eq "") {
print "mktemp /tmp/cjk-latex-config-map.XXXXXX failed.\n";
}
@planes = sfd2map($sfd_file,$map_file);
if ($#planes == -1) {
print "sfd2map($sfd_file,$map_file) failed.\n";
return 1;
}
for my $plane (@planes) {
if ($OPT_VERBOSE) {
$command = "ttf2pt1 -W 99 ";
} else {
$command = "ttf2pt1 -W 0 ";
}
$command .= $smoothing_opt;
$command .= " -p ft -b -G a -m h=5000 ";
$command .= " -L $map_file+pid=$pid,eid=$eid,$plane ";
$command .= " $tt_dir/$tt_basename $latex_font_name$plane";
if ($OPT_VERBOSE) {
print "$command\n";
} else {
$command .= " > /dev/null 2>&1";
print "$latex_font_name\@$sfd_name\@, plane=$plane: calling ttf2pt1 ...\n";
}
if (0 != system($command)) {
print "$command failed.\n";
return 1;
}
}
unlink $map_file;
# success, mark this by giving the created directory the same time stamp
# as the TT-font:
system("touch -r $tt_dir/$tt_basename $type1_dir/$sfd_basename/$latex_font_name/");
$type1_created = 1;
return 0;
}
}
######################################################################
sub sfd2map {
my($sfd_file,$map_file) = @_;
if (! open (SFD, "<$sfd_file")) {
print "cannot open $sfd_file\n";
return ();
}
if (! open (MAP, ">$map_file")) {
print "cannot open $map_file\n";
close (SFD);
return ();
}
my(@planes) = ();
while (<SFD>) {
if ( ! ($ARG =~ /^[[:space:]]*\#/)) { # skip comment lines
# handle plane numbers:
if ( $ARG =~ /^([[:xdigit:]]{2})[[:space:]]*/ ) {
$ARG =~ s/^([[:xdigit:]]{2})[[:space:]]*/ /;
print MAP "plane $1\n";
print MAP "at 0x00\n";
$planes[$#planes + 1] = $1;
}
# remove continuation chars '\':
$ARG =~ s/\\$//;
$ARG =~ s/(0x[[:xdigit:]]{1,4})/$1,/g;
# handle ranges like 0xF800_0xF8FF
$ARG =~ s/(0x[[:xdigit:]]{1,4}),_/$1-/g;
}
print MAP $ARG;
}
close (MAP);
close (SFD);
return @planes;
}
# Returns true if the modification time of $f1 differs from
# the modification time of $f2
sub mtime_differs {
my($f1,$f2) = @_;
if( -e $f1 && -e $f2) {
local (@f1s) = stat ($f1);
local (@f2s) = stat ($f2);
return ($f1s[9] != $f2s[9]);
} else {
return 0;
}
}
# Returns true if the modification time of $f1 differs from
# the modification time of $f2 or if one of the files is missing
sub mtime_differs_or_missing {
my($f1,$f2) = @_;
if (! -e $f1 || ! -e $f2 || mtime_differs($f1,$f2)) {
return 1;
} else {
return 0;
}
}
# Returns true if $f1 is newer than $f2
sub newer {
my($f1,$f2) = @_;
if( -e $f1 && -e $f2) {
local (@f1s) = stat ($f1);
local (@f2s) = stat ($f2);
return ($f1s[9] > $f2s[9]);
} else {
return 0;
}
}
# Returns true if $f1 is newer than $f2 or if one of the files is missing
sub newer_or_missing {
my($f1,$f2) = @_;
if (! -e $f1 || ! -e $f2 || newer($f1,$f2)) {
return 1;
} else {
return 0;
}
}

View File

@@ -0,0 +1,60 @@
#!/bin/sh
#
# Copyright (c) 2002 SuSE Linux AG, Nuernberg, Germany. All rights reserved.
#
# Author: Mike Fabian <mfabian@suse.de>, 2002
#
TYPE1_DIR=$1
if [ -z $TYPE1_DIR ] ; then
TYPE1_DIR=/usr/share/texmf/fonts/type1/cjk-latex/
fi
CJK_LATEX_TYPE1_MAP_FILE=/var/lib/texmf/dvips/config/cjk-latex.map
echo "creating $CJK_LATEX_TYPE1_MAP_FILE ..."
TMPFILE=`mktemp /tmp/cjk-latex-t1mapgen.XXXXXX`
if [ -d $TYPE1_DIR ] ; then
for FILE in $( find $TYPE1_DIR -name "*.pfb" )
do
BASENAME_WITHOUT_EXT=$( basename $FILE )
BASENAME_WITHOUT_EXT=${BASENAME_WITHOUT_EXT%.pfb}
FONT_NAME=$( grep -a "/FontName.*def" ${FILE} | perl -pe "s%/FontName /([^ ]+) def%\1%" )
echo "${BASENAME_WITHOUT_EXT} ${FONT_NAME} <${BASENAME_WITHOUT_EXT}.pfb" >> $TMPFILE
done
fi
mv $TMPFILE $CJK_LATEX_TYPE1_MAP_FILE
chmod 644 $CJK_LATEX_TYPE1_MAP_FILE
# add entries for PostScript font map files used by CJK-LaTeX
# to 'pdftex.cfg' and 'config.ps':
PDFTEX_CFG=/var/lib/texmf/pdftex/config/pdftex.cfg
CONFIG_PS=/var/lib/texmf/dvips/config/config.ps
for MAP in cjk-latex.map
do
if [ -f /var/lib/texmf/dvips/config/$MAP ] ; then
egrep "^p \+$MAP" $CONFIG_PS > /dev/null
if [ $? = 1 ] ; then
echo "p +$MAP" >> $CONFIG_PS
fi
egrep "^map \+$MAP" $PDFTEX_CFG > /dev/null
if [ $? = 1 ] ; then
echo "map +$MAP" >> $PDFTEX_CFG
fi
fi
done
# pdflatex seems to prefer pk fonts if they exist. That seems strange
# but I couldn't find out how to change this.
# Deleting all the pk fonts from /var/cache/fonts/pk/* is probably a bit overkill
# but it helps. 'dvips' will regenerate the pk fonts as needed but will not
# regenerate pk fonts for the pfb fonts listed in the map file generated above.
# Therefore, deleting /var/cache/fonts/pk/* makes sure that all available pfb
# fonts are used:
rm -rf /var/cache/fonts/pk/*

View File

@@ -0,0 +1,68 @@
#!/usr/bin/perl -w
#
# Copyright (c) 2002 Mike Fabian <mike.fabian@gmx.de>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
use English;
use Getopt::Long;
sub usage {
print "Usage: sfd2map [-debug|d]\n\n";
print "Converts a .sfd files in the format used by ttf2pk and ttf2tfm\n";
print "into .map files in the format expected by ttf2pt1. For example:\n\n";
print " sfd2map < UJIS.sfd > UJIS.map \n\n";
exit 1;
}
# Process command line options
my %opt;
unless (GetOptions(\%opt,
'-debug|d' , \$OPT_DEBUG
)) {
&usage();
exit 1;
}
if($OPT_DEBUG) {
}
open (MAP, ">&STDOUT");
open (SFD, "<&STDIN");
print MAP "# generated from a .sfd file by sfd2map to make it usable with ttf2pt1\n";
print MAP "#\n";
while (<SFD>) {
if ( ! ($ARG =~ /^[[:space:]]*\#/)) { # skip comment lines
# handle plane numbers:
if ( $ARG =~ /^([[:xdigit:]]{2})[[:space:]]*/ ) {
$ARG =~ s/^([[:xdigit:]]{2})[[:space:]]*/ /;
print MAP "plane $1\n";
print MAP "at 0x00\n";
}
# remove continuation chars '\':
$ARG =~ s/\\$//;
$ARG =~ s/(0x[[:xdigit:]]{1,4})/$1,/g;
# handle ranges like 0xF800_0xF8FF
$ARG =~ s/(0x[[:xdigit:]]{1,4}),_/$1-/g;
}
print MAP $ARG;
}

View File

@@ -0,0 +1,24 @@
Recommended patches for the X11 font library
by Sergey Babkin
<babkin@bellatlantic.net>, <sab123@hotmail.com>
These are patches for XFree86 versions 3.3.4 and 3.9
to fix a few known problems with big Type1 fonts and
with strange handling of the standard stem width table.
The patch for XFree86 3.3.4 probably may be easily
installed on any other distribution of X11.
They are supposed to be installed in the subdirectory
xc/lib/font/Type1
of the X11 source tree and after that the font library,
font server and X server should be rebuilt.
Sorry that the description has so little details but if
you know how to build X11 then this is enough, otherwise
any more details won't help much.
The patches have been submitted to the XFree86 project,
hope they will be included in some next release of XFree86
and X11.

View File

@@ -0,0 +1,41 @@
<HTML>
<HEAD>
<TITLE>
Recommended patches for the X11 font library
</TITLE>
</HEAD>
<BODY>
<H2>
Recommended patches for the X11 font library
</H2>
by Sergey Babkin
&lt;babkin@bellatlantic.net&gt;, &lt;sab123@hotmail.com&gt;
<p>
These are patches for XFree86 versions 3.3.4 and 3.9
to fix a few known problems with big Type1 fonts and
with strange handling of the standard stem width table.
The patch for XFree86 3.3.4 probably may be easily
installed on any other distribution of X11.
They are supposed to be installed in the subdirectory
<br>
&nbsp;&nbsp;<tt>xc/lib/font/Type1</tt>
<br>
of the X11 source tree and after that the font library,
font server and X server should be rebuilt.
<p>
Sorry that the description has so little details but if
you know how to build X11 then this is enough, otherwise
any more details won't help much.
<p>
The patches have been submitted to the XFree86 project,
hope they will be included in some next release of XFree86
and X11.
<p>
</BODY>
</HTML>

View File

@@ -0,0 +1,199 @@
*** fontfcn.c 2000/01/02 18:55:56 1.1
--- fontfcn.c 2000/01/02 19:00:17
***************
*** 33,38 ****
--- 33,39 ----
#include <string.h>
#include "t1imager.h"
#include "util.h"
+ #include "t1stdio.h"
#include "fontfcn.h"
#include "fontmisc.h"
***************
*** 117,132 ****
resetFont(env);
/* This will load the font into the FontP */
rcode = scan_font(FontP);
! if (rcode == SCAN_OUT_OF_MEMORY) {
/* free the memory and start again */
xfree(vm_base);
if (!(initFont(vm_size * 2))) {
/* we are really out of memory */
return(SCAN_OUT_OF_MEMORY);
}
resetFont(env);
rcode = scan_font(FontP);
- /* only double the memory once, then report error */
}
return(rcode);
}
--- 118,151 ----
resetFont(env);
/* This will load the font into the FontP */
rcode = scan_font(FontP);
! if (rcode != SCAN_OUT_OF_MEMORY)
! return rcode;
!
! if (T1FileSize > VM_SIZE) {
! /* use the file size as estimation */
!
/* free the memory and start again */
xfree(vm_base);
+ if (!(initFont(T1FileSize))) {
+ /* we are really out of memory */
+ return(SCAN_OUT_OF_MEMORY);
+ }
+ resetFont(env);
+ rcode = scan_font(FontP);
+ if (rcode != SCAN_OUT_OF_MEMORY)
+ return rcode;
+ }
+
+ /* if still not enough, increase up to maximum */
+ while (rcode == SCAN_OUT_OF_MEMORY
+ && vm_size <= VM_SIZE_MAX/2 ) {
+ xfree(vm_base);
if (!(initFont(vm_size * 2))) {
/* we are really out of memory */
return(SCAN_OUT_OF_MEMORY);
}
resetFont(env);
rcode = scan_font(FontP);
}
return(rcode);
}
*** paths.c 2000/01/02 18:55:56 1.1
--- paths.c 2000/01/02 18:56:27
***************
*** 584,590 ****
CONCAT(before, r);
r = before;
}
! else
r->context = after->context;
if (after != NULL)
CONCAT(r, after);
--- 584,590 ----
CONCAT(before, r);
r = before;
}
! else if (after != NULL)
r->context = after->context;
if (after != NULL)
CONCAT(r, after);
*** scanfont.c 2000/01/02 18:55:56 1.1
--- scanfont.c 2000/01/02 18:56:26
***************
*** 1383,1388 ****
--- 1383,1390 ----
/* point to name and search for leading blanks */
nameP= FontP->FontFileName.data.nameP;
namelen = FontP->FontFileName.len;
+ if (namelen > (128-1) ) /* prevent getting out of filename[] */
+ namelen = (128-1);
while (nameP[0] == ' ') {
nameP++;
namelen--;
*** t1io.c 2000/01/02 18:55:56 1.1
--- t1io.c 2000/01/02 18:56:32
***************
*** 54,59 ****
--- 54,62 ----
/* Our single FILE structure and buffer for this package */
STATIC F_FILE TheFile;
STATIC unsigned char TheBuffer[F_BUFSIZ];
+
+ /* the size of the file we read */
+ int T1FileSize;
/* Our routines */
F_FILE *T1Open(), *T1Eexec();
***************
*** 87,92 ****
--- 90,96 ----
of->flags = 0;
of->error = 0;
haveextrach = 0;
+ T1FileSize = 0;
return &TheFile;
} /* end Open */
***************
*** 165,171 ****
--- 169,181 ----
int T1Close(f) /* Close the file */
F_FILE *f; /* Stream descriptor */
{
+ int rc;
+
if (f->b_base == NULL) return 0; /* already closed */
+
+ while ( (rc = read(f->fd, f->b_base, F_BUFSIZ)) >0)
+ T1FileSize += rc; /* count the rest of the file */
+
f->b_base = NULL; /* no valid stream */
return close(f->fd);
} /* end Close */
***************
*** 289,294 ****
--- 299,305 ----
}
}
f->b_ptr = f->b_base;
+ T1FileSize += rc; /* remember how many bytes we have */
if (Decrypt) rc = T1Decrypt(f->b_base, rc);
return rc;
} /* end Fill */
*** type1.c 2000/01/02 18:55:56 1.1
--- type1.c 2000/01/02 18:56:27
***************
*** 365,378 ****
/* ADJUST STEM WIDTHS */
/**********************/
! widthdiff = 0.0;
/* Find standard stem with smallest width difference from this stem */
if (stems[stemno].vertical) { /* vertical stem */
if (blues->StdVW != 0) /* there is an entry for StdVW */
widthdiff = blues->StdVW - stemwidth;
for (i = 0; i < blues->numStemSnapV; ++i) { /* now look at StemSnapV */
! if (blues->StemSnapV[i] - stemwidth < widthdiff)
/* this standard width is the best match so far for this stem */
widthdiff = blues->StemSnapV[i] - stemwidth;
}
--- 365,380 ----
/* ADJUST STEM WIDTHS */
/**********************/
! /* a big value to not compete with StemSnap */
! /* if there is no StemSnap it will be caught later */
! widthdiff = onepixel*2;
/* Find standard stem with smallest width difference from this stem */
if (stems[stemno].vertical) { /* vertical stem */
if (blues->StdVW != 0) /* there is an entry for StdVW */
widthdiff = blues->StdVW - stemwidth;
for (i = 0; i < blues->numStemSnapV; ++i) { /* now look at StemSnapV */
! if ( FABS(blues->StemSnapV[i] - stemwidth) < FABS(widthdiff) )
/* this standard width is the best match so far for this stem */
widthdiff = blues->StemSnapV[i] - stemwidth;
}
***************
*** 380,386 ****
if (blues->StdHW != 0) /* there is an entry for StdHW */
widthdiff = blues->StdHW - stemwidth;
for (i = 0; i < blues->numStemSnapH; ++i) { /* now look at StemSnapH */
! if (blues->StemSnapH[i] - stemwidth < widthdiff)
/* this standard width is the best match so far for this stem */
widthdiff = blues->StemSnapH[i] - stemwidth;
}
--- 382,388 ----
if (blues->StdHW != 0) /* there is an entry for StdHW */
widthdiff = blues->StdHW - stemwidth;
for (i = 0; i < blues->numStemSnapH; ++i) { /* now look at StemSnapH */
! if ( FABS(blues->StemSnapH[i] - stemwidth) < FABS(widthdiff) )
/* this standard width is the best match so far for this stem */
widthdiff = blues->StemSnapH[i] - stemwidth;
}

View File

@@ -0,0 +1,252 @@
*** scanfont.c 1999/12/27 00:34:02 1.1
--- scanfont.c 1999/12/27 00:35:34
***************
*** 2234,2239 ****
--- 2234,2241 ----
/* point to name and search for leading blanks */
nameP= FontP->FontFileName.data.nameP;
namelen = FontP->FontFileName.len;
+ if (namelen > (128-1) ) /* prevent getting out of filename[] */
+ namelen = (128-1);
while (nameP[0] == ' ') {
nameP++;
namelen--;
*** paths.c 1999/12/27 00:37:01 1.1
--- paths.c 1999/12/27 00:37:43
***************
*** 583,589 ****
CONCAT(before, r);
r = before;
}
! else
r->context = after->context;
if (after != NULL)
CONCAT(r, after);
--- 583,589 ----
CONCAT(before, r);
r = before;
}
! else if (after != NULL)
r->context = after->context;
if (after != NULL)
CONCAT(r, after);
*** type1.c 1999/12/27 00:38:16 1.1
--- type1.c 1999/12/27 01:08:02
***************
*** 399,412 ****
/* ADJUST STEM WIDTHS */
/**********************/
! widthdiff = 0.0;
/* Find standard stem with smallest width difference from this stem */
if (stems[stemno].vertical) { /* vertical stem */
if (blues->StdVW != 0) /* there is an entry for StdVW */
widthdiff = blues->StdVW - stemwidth;
for (i = 0; i < blues->numStemSnapV; ++i) { /* now look at StemSnapV */
! if (blues->StemSnapV[i] - stemwidth < widthdiff)
/* this standard width is the best match so far for this stem */
widthdiff = blues->StemSnapV[i] - stemwidth;
}
--- 399,414 ----
/* ADJUST STEM WIDTHS */
/**********************/
! /* a big value to not compete with StemSnap */
! /* if there is no StemSnap it will be caught later */
! widthdiff = onepixel*2;
/* Find standard stem with smallest width difference from this stem */
if (stems[stemno].vertical) { /* vertical stem */
if (blues->StdVW != 0) /* there is an entry for StdVW */
widthdiff = blues->StdVW - stemwidth;
for (i = 0; i < blues->numStemSnapV; ++i) { /* now look at StemSnapV */
! if ( FABS(blues->StemSnapV[i] - stemwidth) < FABS(widthdiff) )
/* this standard width is the best match so far for this stem */
widthdiff = blues->StemSnapV[i] - stemwidth;
}
***************
*** 414,420 ****
if (blues->StdHW != 0) /* there is an entry for StdHW */
widthdiff = blues->StdHW - stemwidth;
for (i = 0; i < blues->numStemSnapH; ++i) { /* now look at StemSnapH */
! if (blues->StemSnapH[i] - stemwidth < widthdiff)
/* this standard width is the best match so far for this stem */
widthdiff = blues->StemSnapH[i] - stemwidth;
}
--- 416,422 ----
if (blues->StdHW != 0) /* there is an entry for StdHW */
widthdiff = blues->StdHW - stemwidth;
for (i = 0; i < blues->numStemSnapH; ++i) { /* now look at StemSnapH */
! if ( FABS(blues->StemSnapH[i] - stemwidth) < FABS(widthdiff) )
/* this standard width is the best match so far for this stem */
widthdiff = blues->StemSnapH[i] - stemwidth;
}
*** t1io.c 2000/01/01 00:41:44 1.1
--- t1io.c 2000/01/01 01:23:38
***************
*** 78,83 ****
--- 78,86 ----
/* Our single FILE structure and buffer for this package */
STATIC F_FILE TheFile;
STATIC unsigned char TheBuffer[F_BUFSIZ];
+
+ /* the size of the file we read */
+ int T1FileSize;
/* Our routines */
F_FILE *T1Open(), *T1Eexec();
***************
*** 118,123 ****
--- 121,127 ----
of->flags = 0;
of->error = 0;
haveextrach = 0;
+ T1FileSize = 0;
return &TheFile;
} /* end Open */
***************
*** 196,202 ****
--- 200,212 ----
int T1Close(f) /* Close the file */
F_FILE *f; /* Stream descriptor */
{
+ int rc;
+
if (f->b_base == NULL) return 0; /* already closed */
+
+ while ( (rc = read(f->fd, f->b_base, F_BUFSIZ)) >0)
+ T1FileSize += rc; /* count the rest of the file */
+
f->b_base = NULL; /* no valid stream */
return close(f->fd);
} /* end Close */
***************
*** 381,386 ****
--- 391,397 ----
}
}
f->b_ptr = f->b_base;
+ T1FileSize += rc; /* remember how many bytes we have */
if (Decrypt) rc = T1Decrypt(f->b_base, rc);
return rc;
} /* end Fill */
*** t1stdio.h 2000/01/01 00:43:38 1.1
--- t1stdio.h 2000/01/01 01:24:19
***************
*** 73,78 ****
--- 73,79 ----
extern FILE *T1Open(), *T1eexec();
extern int T1Close(), T1Ungetc(), T1Read();
+ extern int T1FileSize;
#undef fclose
#undef fopen
*** fontfcn.c 2000/01/01 00:07:54 1.1
--- fontfcn.c 2000/01/01 01:36:02
***************
*** 57,62 ****
--- 57,63 ----
#endif
#include "t1imager.h"
#include "util.h"
+ #include "t1stdio.h"
#ifdef BUILDCID
#include "range.h"
#include "fontmisc.h"
***************
*** 300,333 ****
resetFont(env);
/* This will load the font into the FontP */
rcode = scan_font(FontP);
! if (rcode == SCAN_OUT_OF_MEMORY) {
/* free the memory and start again */
#ifdef BUILDCID
/* xfree(vm_base); */
#else
xfree(vm_base);
#endif
if (!(initFont(vm_size * 2))) {
/* we are really out of memory */
return(SCAN_OUT_OF_MEMORY);
}
resetFont(env);
rcode = scan_font(FontP);
- #ifdef BUILDCID
- /* only double the memory twice, then report error */
- if (rcode == SCAN_OUT_OF_MEMORY) {
- /* free the memory and start again */
- /* xfree(vm_base) */
- if (!(initFont(vm_size * 2))) {
- /* we are really out of memory */
- return(SCAN_OUT_OF_MEMORY);
- }
- resetFont(env);
- rcode = scan_font(FontP);
- }
- #else
- /* only double the memory once, then report error */
- #endif
}
return(rcode);
}
--- 301,342 ----
resetFont(env);
/* This will load the font into the FontP */
rcode = scan_font(FontP);
! if (rcode != SCAN_OUT_OF_MEMORY)
! return rcode;
!
! if (T1FileSize > VM_SIZE) {
! /* use the file size as estimation */
!
/* free the memory and start again */
#ifdef BUILDCID
/* xfree(vm_base); */
#else
xfree(vm_base);
#endif
+ if (!(initFont(T1FileSize))) {
+ /* we are really out of memory */
+ return(SCAN_OUT_OF_MEMORY);
+ }
+ resetFont(env);
+ rcode = scan_font(FontP);
+ if (rcode != SCAN_OUT_OF_MEMORY)
+ return rcode;
+ }
+
+ /* if still not enough, increase up to maximum */
+ while (rcode == SCAN_OUT_OF_MEMORY
+ && vm_size <= VM_SIZE_MAX/2 ) {
+ #ifdef BUILDCID
+ /* xfree(vm_base); */
+ #else
+ xfree(vm_base);
+ #endif
if (!(initFont(vm_size * 2))) {
/* we are really out of memory */
return(SCAN_OUT_OF_MEMORY);
}
resetFont(env);
rcode = scan_font(FontP);
}
return(rcode);
}
*** util.h 2000/01/01 00:40:11 1.1
--- util.h 2000/01/01 01:29:18
***************
*** 83,88 ****
--- 83,92 ----
#else
#define VM_SIZE (50*1024)
#endif
+
+ /* this is the maximal permitted memory size */
+ #define VM_SIZE_MAX (1024*1024)
+
/***================================================================***/
#ifndef MIN

View File

@@ -0,0 +1,5 @@
nsfix: nsfix.c
$(CC) $(CFLAGS) -o nsfix nsfix.c $(LDFLAGS)
clean:
rm -f *.o core *.core core.* nsfix

View File

@@ -0,0 +1,180 @@
Installing the fonts in Netscape Navigator
by Sergey Babkin
<babkin@bellatlantic.net>, <sab123@hotmail.com>
This is a collection of supplements to Netscape 4.x on
Unix. Probably they will also work with Netscape 3.x,
possilby with minor modifications.
Makefile
nsfix.c
psfonts.cf
This is a program that allows to substitute the font metrics
of any PostScript font in Netscape.
When Netscape prints the files to PostScript format it uses a
built-in table of character widths. It prints all the fixed-width
characters in the typeface "Courier" and all the variable-width
characters in the typeface "Times". And if the PostScript printer
has these fonts by Adobe then everything goes fine because
the tables inside Netscape are generated from the Adobe fonts.
But if the fonts are different (say, those supplied with Ghostscripts
or the fonts with non-latin characters) then the result is quite
ugly. This program allows to replace the width tables inside
the Netscape executable with the tables for any given font.
The only problem is that Netscape can hold only one set of tables
at once. So if you want to print with different fonts (say,
for different languages or encodings) you will have to make
multiple copies of the executable, tune each of them for its
font and then run them separately.
I tried to make the program as machine-independent as possible.
But because it patches the binary files it still has the dependencies
on hardware. The default version as supplied was designed for
Intel x86 machines but it should work OK on any machine
with 32-bit CPU and 4Kbyte (or less) page size. If it can't
find the tables matching the font names on some other architecture
the first thing to try would be reduce the `PAGEBITS' definition
in the source code. On the machines with non-page-aligned structure
of executables it won't work at all. I don't know whether would
it work on the 64-bit machines. This may depend on whether the
Netscape executable was compiled in 32-bit or 64-bit mode. For
the 64-bit executables it may be neccessary to change the definition
of the type `tptr' to an 8-byte integer type (probably `long'
or `long long'). Also must be re-compiled for patching of the
Netscape binary for each particular machine architecture because
it assumes the byte order of the current machine.
It might be possible to create a program that would patch
a running Netscape binary on the fly, that would allow
changing the printing fonts as neccessary when Netscape is
running. But this would be even more platform-dependent,
so I don't feel any enthusiasm about doing that.
I have tested the program on the Intel machines, Netscape
4.08 and 4.7, OS FreeBSD (both a.out and ELF formats of the
Netscape binary) and UnixWare.
After all these scary issues are resolved the compiling
is easy: just run `make'.
To command to patch the Netscape is:
./nsfix <netscape-binary> <config-file>
Please make a copy of the original Netscape binary before
patching in case anything goes wrong. Patch the copy, test
that it works OK and only then install it. The configuration
file describes the fonts that are to be used. An example
is provided in the file psfonts.cf.
Each line in the configuration file consists of 4
columns:
<PS_font_name> <font_base_file> <suffix_afm> <suffix_font>
For example, the following line from my configuration file:
Courier /usr/lib/X11/fonts/ttf/cokoi8n.koi8-r .afm .pfa
says that the font `Courier' will be replaced with the
font taken from the file `/usr/lib/X11/fonts/ttf/cokoi8n.koi8-r.pfa'
and the metrics for that font will be taken from the file
`/usr/lib/X11/fonts/ttf/cokoi8n.koi8-r.afm' .
One more caveat: the new font must have a proper encoding
table. Some fonts contain characters for multiple encodings
hoping that the program wil re-encode them as neccessary.
This won't work in this case, only the primary encoding table
of the font will be used.
nsfilter
nsprint
psfonts.cf
These are the filters for printing from Netscape.
Changing the metrics is not the end of the story. This will
provide proper placement of the characters but not the
characters themselves. There are a few ways to provide
the characters:
First, if you use GhostScript you may configure proper
aliases in the GhostScript configuration file. We will
consider this variant trivial and won't discuss it furter
except for one caveat: Netscape tries to re-encode the
fonts per the ISO Latin-1 encoding. If the primary encoding
of the font is different this cause unexpected effects.
So you still may consider using the filters (at least in a
simplified form) to solve this problem.
Second, load the fonts right into your printer. This is
very much like configuring GhostScript.
Third, use the provided filters. The script `nsfilter'
reads the output of Netscape on its standard input and
puts the result to its standard output. It uses the same
configuration file `psfonts.cf' as `nsfix'. First it
looks for the configuration file in the user's home
directory ($HOME/.netscape/psfonts.cf) and if the
file it not there then the second guess is the system-wide
configuration file /usr/local/etc/psfonts.cf. The
script inserts the fonts into the output and also
removes the Netscape's experiments with the encodings.
`nsfilter' is generally intended to be ran by user, not by the
printing subsystem. The reason is that the user may have
changed fonts in his Netscape and the printing subsystem
would have no way to access user's configuration file.
But if all the users are using the same fonts then it
may be incorporated into the printing subsystem and use
the system-wide configuration file.
The script `nsprint' is purely for convenience, to type it
as a printing command in the Netscape printing window.
It just pipelines the data through `nsfilter' to the
printing program which also gets all the arguments. Please
note that the SystemV-style and BSD-style systems use different
printing programs (although they commonly provide compatibility
with the other style too). The script tries to guess the
type of system and use its native print program, `lp' or
`lpr'. But in case it guesses wrong you may want
to change this in the script. Also if the printer does not support
PostScript directly this script may be a good place to
insert a call to GhostScript.
notscape
fontsz.cf
Netscape on Unix has a very annoying "feature", it does
not remember the desired base size of the scalable screen
fonts and always resets it to 12.0 points. Even if the size
is changed manually in its preferences file, Netscape
forgets it after it exits.
So my solution was to write a program which would change
the size to my favorite one every time right before
starting Netscape. `notscape' is exactly such a program,
it sets the font sizes an then transparently executes
netscape. It takes the font sizes from the file
`$HOME/.netscape/fontsz.cf' . An example of such file
is provided. The format of the file is quite self-explanatory,
for example the lines
fixed-koi8-r 140
prop-koi8-r 150
mean "set the size of the fixed-width screen font in the
encoding koi8-r to 14.0 points; set the size of the proportional
(variable-width) font in the encoding koi8-r to 15.0 points".
nspr
by Zvezdan Petkovic
To print from Netscape, I usually print to the Postscript file first.
Then I use this small script to change the names of Times and Courier fonts
in the file and remove `/Encoding' lines. After that the file can be
sent to printer.

View File

@@ -0,0 +1,242 @@
<HTML>
<HEAD>
<TITLE>
Installing the fonts in Netscape Navigator
</TITLE>
</HEAD>
<BODY>
<H2>
Installing the fonts in Netscape Navigator
</H2>
<tt>
by Sergey Babkin
&lt;babkin@bellatlantic.net&gt;, &lt;sab123@hotmail.com&gt;
</tt>
<p>
This is a collection of supplements to Netscape 4.x on
Unix. Probably they will also work with Netscape 3.x,
possilby with minor modifications.
<p>
<h4><tt>
&nbsp;&nbsp;Makefile<br>
&nbsp;&nbsp;nsfix.c<br>
&nbsp;&nbsp;psfonts.cf
</tt></h4>
<p>
This is a program that allows to substitute the font metrics
of any PostScript font in Netscape.
<p>
When Netscape prints the files to PostScript format it uses a
built-in table of character widths. It prints all the fixed-width
characters in the typeface "Courier" and all the variable-width
characters in the typeface "Times". And if the PostScript printer
has these fonts by Adobe then everything goes fine because
the tables inside Netscape are generated from the Adobe fonts.
But if the fonts are different (say, those supplied with Ghostscripts
or the fonts with non-latin characters) then the result is quite
ugly. This program allows to replace the width tables inside
the Netscape executable with the tables for any given font.
The only problem is that Netscape can hold only one set of tables
at once. So if you want to print with different fonts (say,
for different languages or encodings) you will have to make
multiple copies of the executable, tune each of them for its
font and then run them separately.
<p>
I tried to make the program as machine-independent as possible.
But because it patches the binary files it still has the dependencies
on hardware. The default version as supplied was designed for
Intel x86 machines but it should work OK on any machine
with 32-bit CPU and 4Kbyte (or less) page size. If it can't
find the tables matching the font names on some other architecture
the first thing to try would be reduce the `<tt>PAGEBITS</tt>' definition
in the source code. On the machines with non-page-aligned structure
of executables it won't work at all. I don't know whether would
it work on the 64-bit machines. This may depend on whether the
Netscape executable was compiled in 32-bit or 64-bit mode. For
the 64-bit executables it may be neccessary to change the definition
of the type `<tt>tptr</tt>' to an 8-byte integer type (probably `<tt>long</tt>'
or `<tt>long long</tt>'). Also must be re-compiled for patching of the
Netscape binary for each particular machine architecture because
it assumes the byte order of the current machine.
<p>
It might be possible to create a program that would patch
a running Netscape binary on the fly, that would allow
changing the printing fonts as neccessary when Netscape is
running. But this would be even more platform-dependent,
so I don't feel any enthusiasm about doing that.
<p>
I have tested the program on the Intel machines, Netscape
4.08 and 4.7, OS FreeBSD (both a.out and ELF formats of the
Netscape binary) and UnixWare.
<p>
After all these scary issues are resolved the compiling
is easy: just run `<tt>make</tt>'.
<p>
To command to patch the Netscape is:
<p>
<tt>
&nbsp;&nbsp;./nsfix <i>&lt;netscape-binary&gt; &lt;config-file&gt;</i>
</tt>
<p>
Please make a copy of the original Netscape binary before
patching in case anything goes wrong. Patch the copy, test
that it works OK and only then install it. The configuration
file describes the fonts that are to be used. An example
is provided in the file psfonts.cf.
<p>
Each line in the configuration file consists of 4
columns:
<p>
<tt><i>
&lt;PS_font_name&gt; &lt;font_base_file&gt; &lt;suffix_afm&gt; &lt;suffix_font&gt;
</i></tt>
<p>
For example, the following line from my configuration file:
<p>
<tt>
Courier /usr/lib/X11/fonts/ttf/cokoi8n.koi8-r .afm .pfa
</tt>
<p>
says that the font `Courier' will be replaced with the
font taken from the file `<tt>/usr/lib/X11/fonts/ttf/cokoi8n.koi8-r.pfa</tt>'
and the metrics for that font will be taken from the file
`<tt>/usr/lib/X11/fonts/ttf/cokoi8n.koi8-r.afm</tt>' .
<p>
One more caveat: the new font must have a proper encoding
table. Some fonts contain characters for multiple encodings
hoping that the program wil re-encode them as neccessary.
This won't work in this case, only the primary encoding table
of the font will be used.
<p>
<h4><tt>
&nbsp;&nbsp;nsfilter<br>
&nbsp;&nbsp;nsprint<br>
&nbsp;&nbsp;psfonts.cf
</tt></h4>
<p>
These are the filters for printing from Netscape.
<p>
Changing the metrics is not the end of the story. This will
provide proper placement of the characters but not the
characters themselves. There are a few ways to provide
the characters:
<p>
First, if you use GhostScript you may configure proper
aliases in the GhostScript configuration file. We will
consider this variant trivial and won't discuss it furter
except for one caveat: Netscape tries to re-encode the
fonts per the ISO Latin-1 encoding. If the primary encoding
of the font is different this cause unexpected effects.
So you still may consider using the filters (at least in a
simplified form) to solve this problem.
<p>
Second, load the fonts right into your printer. This is
very much like configuring GhostScript.
<p>
Third, use the provided filters. The script `<tt>nsfilter</tt>'
reads the output of Netscape on its standard input and
puts the result to its standard output. It uses the same
configuration file `<tt>psfonts.cf</tt>' as `<tt>nsfix</tt>'. First it
looks for the configuration file in the user's home
directory (<tt>$HOME/.netscape/psfonts.cf</tt>) and if the
file it not there then the second guess is the system-wide
configuration file <tt>/usr/local/etc/psfonts.cf</tt>. The
script inserts the fonts into the output and also
removes the Netscape's experiments with the encodings.
<p>
`<tt>nsfilter</tt>' is generally intended to be ran by user, not by the
printing subsystem. The reason is that the user may have
changed fonts in his Netscape and the printing subsystem
would have no way to access user's configuration file.
But if all the users are using the same fonts then it
may be incorporated into the printing subsystem and use
the system-wide configuration file.
<p>
The script `<tt>nsprint</tt>' is purely for convenience, to type it
as a printing command in the Netscape printing window.
It just pipelines the data through `<tt>nsfilter</tt>' to the
printing program which also gets all the arguments. Please
note that the SystemV-style and BSD-style systems use different
printing programs (although they commonly provide compatibility
with the other style too). The script tries to guess the
type of system and use its native print program, `<tt>lp</tt>' or
`<tt>lpr</tt>'. But in case it guesses wrong you may want
to change this in the script. Also if the printer does not support
PostScript directly this script may be a good place to
insert a call to GhostScript.
<p>
<h4><tt>
&nbsp;&nbsp;notscape<br>
&nbsp;&nbsp;fontsz.cf
</tt></h4>
<p>
Netscape on Unix has a very annoying "feature", it does
not remember the desired base size of the scalable screen
fonts and always resets it to 12.0 points. Even if the size
is changed manually in its preferences file, Netscape
forgets it after it exits.
<p>
So my solution was to write a program which would change
the size to my favorite one every time right before
starting Netscape. `<tt>notscape</tt>' is exactly such a program,
it sets the font sizes an then transparently executes
netscape. It takes the font sizes from the file
`<tt>$HOME/.netscape/fontsz.cf</tt>' . An example of such file
is provided. The format of the file is quite self-explanatory,
for example the lines
<p>
<tt>
fixed-koi8-r 140<br>
prop-koi8-r 150
</tt>
<p>
mean "set the size of the fixed-width screen font in the
encoding koi8-r to 14.0 points; set the size of the proportional
(variable-width) font in the encoding koi8-r to 15.0 points".
<p>
<h3><tt>
&nbsp;&nbsp;nspr
</tt><br>
by Zvezdan Petkovic</h3>
<p>
To print from Netscape, I usually print to the Postscript file first.
Then I use this small script to change the names of Times and Courier fonts
in the file and remove `/Encoding' lines. After that the file can be
sent to printer.
<p>
</BODY>
</HTML>

View File

@@ -0,0 +1,8 @@
fixed-koi8-r 150
prop-koi8-r 150
fixed-iso-8859-5 150
prop-iso-8859-5 150
fixed-iso-8859-1 150
prop-iso-8859-1 150
fixed-x-user-defined 150
prop-x-user-defined 150

View File

@@ -0,0 +1,25 @@
#!/bin/sh
NDIR=$HOME/.netscape
PFILE=$NDIR/preferences.js
CFFILE=$NDIR/fontsz.cf
TMPFILE=$NDIR/fontsz.sed
die() {
echo "notscape: can't $*" >&2
exit 1
}
[ -r $CFFILE ] && {
awk '{ printf("/intl.font_spec_list/s/-[^-]*-\\([^-]*\\)-%s,/-%s-\\1-%s,/\n", \
$1, $2, $1); }' <$CFFILE >$TMPFILE
cp $PFILE $PFILE.old || die "save old pref file"
sed -f $TMPFILE <$PFILE.old >$PFILE.new || die "create new pref file"
[ -s $PFILE.new ] || die "create new pref file"
mv $PFILE.new $PFILE || die "install new pref file"
}
exec netscape -no-about-splash "$@"

View File

@@ -0,0 +1,24 @@
#!/bin/sh
CONFLOCAL=$HOME/.netscape/psfonts.cf
CONFGLOBAL=/usr/local/etc/nspsfonts.cf
if [ -r "$CONFLOCAL" ]
then
CONF="$CONFLOCAL"
else
CONF="$CONFGLOBAL"
fi
grep -v "^#" <$CONF | grep -v "^$" | while :
do {
read nsname base afm pfa x
[ -z "$nsname" ] && break;
fname=`awk '/^FontName/ {print $2;}' <$base$afm`
cat $base$pfa
echo "/$nsname /$fname findfont definefont"
} done
grep -v "^ /Encoding isolatin1encoding def$" | egrep -v '^newpath .* closepath clip newpath$'

View File

@@ -0,0 +1,469 @@
/*
* Fix the Netscape executable for specified font widths
*
* (c) 1999 Copyright by Sergey Babkin
* see COPYRIGHT
*/
#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>
#include <locale.h>
#include <unistd.h>
/************************** DEFINES *************************/
#undef DEBUG
/* we can handle at most this many fonts */
#define MAXFONTS 20
/* maximal line buffer size */
#define MAXLINE 512
/* there may be multiple strings with the same contents */
#define MAXDUPS 10
/* file read buffer size */
#define FILEBF 40960
/* bits in the hardware page offset */
#define BITSPERPAGE 12
/* size of page in bytes */
#define PAGESIZE (1<<BITSPERPAGE)
/* mask of the in-page offset */
#define PAGEMASK (PAGESIZE-1)
/* this is machine-dependent! */
typedef short t2b; /* 2-byte type */
typedef int t4b; /* 4-byte type */
typedef int tptr; /* integer type with the same size as pointer */
struct bbox { /* bounding box */
t2b llx; /* lower-left-x */
t2b lly;
t2b urx;
t2b ury; /* upper-right-y */
};
struct glyphmetrics { /* metrics of one glyph */
t2b width;
t2b unknown;
struct bbox bbox;
};
struct fontmetrics { /* metrics of the wholefont */
tptr name;
struct bbox bbox;
t2b underlinepos;
t2b underlinethick;
struct glyphmetrics glyphs[256];
};
struct font {
char nsname[MAXLINE]; /* name in the Netscape binary */
char afmname[MAXLINE]; /* name of the .afm file */
char pfaname[MAXLINE]; /* name of the .pfa (or .pfb) file */
struct fontmetrics metrics;
off_t binoff; /* offset in the binary */
};
#define SCONST(x) (x), ((sizeof (x))-1)
/************************** GLOBALS *************************/
struct font font[MAXFONTS];
int nfonts=0;
char msg[MAXLINE];
/*************************** PROTOTYPES **********************/
void usage(void);
void readconfig( char *fn);
void readmetrics(void);
void replacefonts( char *fn);
/************************** main ****************************/
main(ac, av)
int ac;
char **av;
{
setlocale(LC_ALL, "");
if(ac!=3) {
usage(); exit(1);
}
readconfig(av[2]);
readmetrics();
replacefonts( av[1]);
}
/************************** usage ***************************/
void
usage(void)
{
fprintf(stderr,"Use:\n");
fprintf(stderr," nsfix <netscape.bin> <config-file>\n");
}
/************************** readconfig **********************/
void
readconfig(fn)
char *fn;
{
char s[MAXLINE];
char afmsuffix[MAXLINE], pfasuffix[MAXLINE];
int lineno=0;
FILE *f;
if(( f=fopen(fn, "r") )==NULL) {
sprintf(msg,"nsfix: open %s",fn);
perror(msg);
exit(1);
}
while( fgets(s, MAXLINE, f) ) {
lineno++;
if(s[0]=='#' || s[0]=='\n')
continue;
if(nfonts>=MAXFONTS) {
fprintf(stderr, "nsfix: only %d fonts are supported at once\n",
MAXFONTS);
exit(1);
}
if( sscanf(s, "%s %s %s %s", font[nfonts].nsname,
font[nfonts].afmname, afmsuffix, pfasuffix) != 4 ) {
fprintf(stderr, "nsfix: syntax error at line %d of %s\n",
lineno, fn);
exit(1);
}
strcpy(font[nfonts].pfaname, font[nfonts].afmname);
strcat(font[nfonts].afmname, afmsuffix);
strcat(font[nfonts].pfaname, pfasuffix);
nfonts++;
}
if(nfonts==0) {
fprintf(stderr, "nsfix: no fonts are defined in %s\n", fn);
exit(1);
}
fclose(f);
}
/************************** readmetrics *********************/
void
readmetrics(void)
{
int i;
char s[MAXLINE];
FILE *f;
int n;
int lineno;
int code, width, llx, lly, urx, ury;
char gn[MAXLINE];
struct glyphmetrics *gm;
for(i=0; i<nfonts; i++) {
if(( f=fopen(font[i].afmname, "r") )==NULL) {
sprintf(msg,"nsfix: open %s", font[i].afmname);
perror(msg);
exit(1);
}
lineno=0;
while( fgets(s, MAXLINE, f) ) {
lineno++;
if( !strncmp(s, SCONST("UnderlineThickness ")) ) {
if( sscanf(s, "UnderlineThickness %d", &n) <1) {
fprintf(stderr, "nsfix: weird UnderlineThickness at line %d in %s\n",
lineno, font[i].afmname);
exit(1);
}
font[i].metrics.underlinethick=n;
} else if( !strncmp(s, SCONST("UnderlinePosition ")) ) {
if( sscanf(s, "UnderlinePosition %d", &n) <1) {
fprintf(stderr, "nsfix: weird UnderlinePosition at line %d in %s\n",
lineno, font[i].afmname);
exit(1);
}
font[i].metrics.underlinepos=n;
} else if( !strncmp(s, SCONST("FontBBox ")) ) {
if( sscanf(s, "FontBBox %d %d %d %d", &llx, &lly, &urx, &ury) <4) {
fprintf(stderr, "nsfix: weird FontBBox at line %d in %s\n",
lineno, font[i].afmname);
exit(1);
}
font[i].metrics.bbox.llx=llx;
font[i].metrics.bbox.lly=lly;
font[i].metrics.bbox.urx=urx;
font[i].metrics.bbox.ury=ury;
} else if( !strncmp(s, SCONST("C ")) ) {
if( sscanf(s, "C %d ; WX %d ; N %s ; B %d %d %d %d",
&code, &width, &gn, &llx, &lly, &urx, &ury) <7)
{
fprintf(stderr, "nsfix: weird metrics at line %d in %s\n",
lineno, font[i].afmname);
exit(1);
}
if(code>=32 && code<=255) {
font[i].metrics.glyphs[code].width=width;
font[i].metrics.glyphs[code].bbox.llx=llx;
font[i].metrics.glyphs[code].bbox.lly=lly;
font[i].metrics.glyphs[code].bbox.urx=urx;
font[i].metrics.glyphs[code].bbox.ury=ury;
}
}
}
fclose(f);
}
#ifdef DEBUG
for(i=0; i<nfonts; i++) {
printf("Font %s\n", font[i].nsname);
for(n=0; n<256; n++) {
gm= &font[i].metrics.glyphs[n];
printf(" %d w=%4d [%4d %4d %4d %4d]", n, gm->width,
gm->bbox.llx, gm->bbox.lly, gm->bbox.urx, gm->bbox.ury);
printf(" w=0x%04x [0x%04x 0x%04x 0x%04x 0x%04x]\n", gm->width & 0xffff,
gm->bbox.llx & 0xffff, gm->bbox.lly & 0xffff, gm->bbox.urx & 0xffff, gm->bbox.ury & 0xffff);
}
}
exit(0);
#endif
}
/************************** replacefonts ********************/
void
replacefonts(fn)
char *fn;
{
int f; /* don't use stdio */
char bf[FILEBF];
char *bfend, *p;
int len;
off_t pos;
off_t zerooff[MAXFONTS*MAXDUPS]; /* offset of zero strings */
tptr nameaddr[MAXFONTS*MAXDUPS]; /* name pointers before these zero strings */
int zeroid[MAXFONTS*MAXDUPS]; /* font number for this zero block */
int nzeroes;
short matched[MAXFONTS]; /* counters how many matches we have for each requested font */
struct fontmetrics *fp;
struct {
int noff;
int nz;
off_t off[MAXDUPS]; /* there may be multiple strings with the same contents */
} o[MAXFONTS];
int maxnlen;
int i, j, k, n;
static struct glyphmetrics gm[32]; /* 0-initialized */
if(( f=open(fn, O_RDWR) )<0) {
sprintf(msg,"nsfix: open %s",fn);
perror(msg);
exit(1);
}
/* get the maximal font name length */
maxnlen=0;
for(i=0; i<nfonts; i++) {
o[i].noff=o[i].nz=0;
matched[i]=0;
len=strlen(font[i].nsname)+1;
if(len>maxnlen)
maxnlen=len;
}
/* fprintf(stderr,"maxnlen= 0x%x\n", maxnlen); /* */
/* try to find the literal strings of the font names */
pos=0; bfend=bf;
while(( len=read(f, bfend, FILEBF-(bfend-bf)) )>=0 ) {
/* fprintf(stderr,"looking at 0x%lx\n", (long)pos); /* */
/* the last position to check */
if(len>=maxnlen)
/* leave the rest with the next block */
bfend+= len-maxnlen;
else {
/* we are very near to the end of file, check
* up to the very last byte */
bfend+= len-2;
memset(bfend+2, 0, maxnlen);
}
for(p=bf; p<=bfend; p++)
for(i=0; i<nfonts; i++)
if(!strcmp(font[i].nsname, p) && o[i].noff<MAXDUPS) {
o[i].off[ o[i].noff++ ] = pos + (p-bf);
fprintf(stderr,"found %s at 0x%lx\n", font[i].nsname, (long)pos + (p-bf));
}
if(len==0)
break;
memmove(bf, bfend, maxnlen);
pos+= (bfend-bf);
bfend= (bf+maxnlen);
}
if(len<0) {
sprintf(msg,"nsfix: read %s",fn);
perror(msg);
exit(1);
}
fprintf(stderr,"---\n");
/* if there are any dups try to resolve them */
for(i=0; i<nfonts; i++) {
if(o[i].noff==0) {
fprintf(stderr, "nsfix: font %s (%d of %d) is missing in %s\n",
font[i].nsname, i, nfonts, fn);
exit(1);
}
if(o[i].noff!=1)
continue;
/* good, only one entry */
fprintf(stderr,"found unique %s at 0x%lx\n", font[i].nsname, (long)o[i].off[0] );
/* if any dupped entry is right after this one then it's good */
/* if it's farther than PAGESIZE/2 then it's bad */
pos=o[i].off[0]+strlen(font[i].nsname)+1;
for(j=0; j<MAXFONTS; j++) {
if(o[j].noff<=1)
continue;
for(k=0; k<o[j].noff; k++) {
if(o[j].off[k]==pos) { /* good */
fprintf(stderr,"got unique %s at 0x%lx\n", font[j].nsname, (long)pos );
o[j].off[0]=pos;
o[j].noff=1;
break;
}
if(o[j].off[k] < pos - PAGESIZE/2
|| o[j].off[k] > pos + PAGESIZE/2) { /* bad */
fprintf(stderr, "eliminated %s at 0x%lx\n", font[j].nsname, (long)o[j].off[k] );
for(n=k+1; n<o[j].noff; n++)
o[j].off[n-1]=o[j].off[n];
o[j].noff--;
k--;
}
}
if(o[j].noff==1 && j<i) { /* have to revisit this font */
i=j-1; /* compensate for i++ */
break;
}
}
}
/* try to find the metric tables in the executable */
if(lseek(f, (off_t)0, SEEK_SET)<0) {
sprintf(msg,"nsfix: rewind %s",fn);
perror(msg);
exit(1);
}
/*
* search for the zeroes in place of the metrics for the codes 0-31:
* 4-byte aligned strings of (32*sizeof(struct glyphmetrics)) zero bytes
*/
maxnlen=sizeof(struct fontmetrics);
pos=0; bfend=bf; nzeroes=0;
while(( len=read(f, bfend, FILEBF-(bfend-bf)) )>=0 ) {
/* fprintf(stderr,"looking at 0x%lx\n", (long)pos); /* */
/* the last position to check */
bfend+= len-maxnlen; /* don't look beyond the EOF */
for(p=bf; p<=bfend; p+=4 /* 4-byte aligned */ ) {
fp=(struct fontmetrics *)p;
if(fp->name==0)
continue;
if( memcmp(gm, fp->glyphs, sizeof gm) )
continue;
/* OK, looks like it, see if we can match it to any name */
n= fp->name & PAGEMASK;
for(i=0; i<nfonts; i++) {
for(j=0; j<o[i].noff; j++)
if( n==(o[i].off[j] & PAGEMASK) ) {
zerooff[nzeroes]= pos + (p-bf);
nameaddr[nzeroes]= fp->name;
zeroid[nzeroes]=i;
o[i].nz++;
fprintf(stderr, "matched %s at 0x%lx\n",
font[i].nsname, (long) zerooff[nzeroes]);
nzeroes++;
matched[i]++;
break;
}
}
}
if(len==0)
break;
memmove(bf, bfend, maxnlen);
pos+= (bfend-bf);
bfend= (bf+maxnlen);
}
if(len<0) {
sprintf(msg,"nsfix: read %s",fn);
perror(msg);
exit(1);
}
fprintf(stderr,"---\n");
/* make sure that all the fonts got one match */
k=0; /* flag: have non-matched fonts */ n=0; /* flag: have ambiguities */
for(i=0; i<nfonts; i++)
if(matched[i]==0)
k=1;
else if(matched[i]>1)
n=1;
if(k) {
fprintf(stderr,"nsfix: can't find match for some of the fonts\n");
fprintf(stderr,"nsfix: maybe wrong byte order, aborting\n");
exit(1);
}
if(n) {
fprintf(stderr,"nsfix: got multiple matches for some of the fonts\n");
fprintf(stderr,"nsfix: can't resolve, aborting\n");
exit(1);
}
/* now finally write the updated tables */
for(i=0; i<nzeroes; i++) {
j=zeroid[i];
fprintf(stderr, "nsfix: writing table for %s at 0x%lx\n", font[j].nsname,
(long)zerooff[i]);
font[j].metrics.name=nameaddr[i];
if( lseek(f, zerooff[i], SEEK_SET)<0 ) {
sprintf(msg,"nsfix: seek %s to 0x%lx",fn, (long)zerooff[i] );
perror(msg);
exit(1);
}
if( write(f, &font[j].metrics, sizeof font[j].metrics) != sizeof font[j].metrics ) {
sprintf(msg,"nsfix: write to %s",fn );
perror(msg);
exit(1);
}
}
close(f);
}

View File

@@ -0,0 +1,26 @@
#!/bin/sh
if [ $# != 2 ]
then
echo "Usage: 'nspr # file.ps' where # is 2, 5, or 1251"
exit
else
enc=$1
shift
fi
case ${enc} in
1250|1251)
charset=windows
;;
*)
charset=iso8859
;;
esac
sed "s/Times-Roman/Timesnew-Roman-${charset}-${enc}/g;\
s/Times-Italic/Timesnew-Italic-${charset}-${enc}/g;\
s/Times-BoldItalic/Timesnew-BoldItalic-${charset}-${enc}/g;\
s/Times-Bold/Timesnew-Bold-${charset}-${enc}/g;\
s/Courier/Couriernew-Roman-${charset}-${enc}/g;\
s/Couriernew-Roman-${charset}-${enc}-BoldOblique/Couriernew-BoldItalic-${charset}-${enc}/g;\
s/Couriernew-Roman-${charset}-${enc}-Bold/Couriernew-Bold-${charset}-${enc}/g;\
s/Couriernew-Roman-${charset}-${enc}-Oblique/Couriernew-Italic-${charset}-${enc}/g;" $* | \
grep -v "^ /Encoding isolatin1encoding def$"

View File

@@ -0,0 +1,10 @@
#!/bin/sh
if uname -s | grep -i bsd >/dev/null
then
LPR=lpr
else
LPR=lp
fi
nsfilter | $LPR "$@"

View File

@@ -0,0 +1,11 @@
# PS_font_name font_base_file suffix_afm suffix_font
Courier /usr/lib/X11/fonts/ttf/cokoi8n.koi8-r .afm .pfa
Courier-Bold /usr/lib/X11/fonts/ttf/cokoi8b.koi8-r .afm .pfa
Courier-Oblique /usr/lib/X11/fonts/ttf/cokoi8i.koi8-r .afm .pfa
Courier-BoldOblique /usr/lib/X11/fonts/ttf/cokoi8bi.koi8-r .afm .pfa
Times-Roman /usr/lib/X11/fonts/ttf/kudriash.koi8-r .afm .pfa
Times-Bold /usr/lib/X11/fonts/ttf/kudrias1.koi8-r .afm .pfa
Times-Italic /usr/lib/X11/fonts/ttf/kudrias3.koi8-r .afm .pfa
Times-BoldItalic /usr/lib/X11/fonts/ttf/kudrias2.koi8-r .afm .pfa

661
pdf/lib/ttf2ufm/src/bdf.c Executable file
View File

@@ -0,0 +1,661 @@
/*
* 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;
char bf[2000];
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) {
if(len - cl->namelen + 1 > sizeof bf)
len = sizeof bf; /* cut it down */
s = bf; /* a temporary buffer to extract the value */
/* skip until a quote */
for(p = str+cl->namelen; len!=0 && (c = *p)!=0; p++, len--) {
if(c == '"') {
p++;
break;
}
}
for(; len!=0 && (c = *p)!=0; p++, len--) {
if(c == '"') {
c = *++p;
if(c == '"')
*s++ = c;
else
break;
} else
*s++ = c;
}
*s = 0; /* end of line */
*((char **)(cl->vp[0])) = dupcnstring(bf, s-bf);
} 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 */
}

2633
pdf/lib/ttf2ufm/src/bitmap.c Executable file

File diff suppressed because it is too large Load Diff

24
pdf/lib/ttf2ufm/src/byteorder.h Executable file
View File

@@ -0,0 +1,24 @@
/*
* 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

View File

@@ -0,0 +1,8 @@
:
# 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

View File

@@ -0,0 +1,47 @@
Sergey A. Babkin
<babkin@bellatlantic.net> or <sab123@hotmail.com>
(Do not edit this file, it is generated from README.html!!!)
The Translation Tables
----------------------
These translation tables are used to translate the Type 1 fonts between
different encodings of the same language.
The file names are supposed to have the suffix .tbl. Each file
describes one encoding, and all the tables for a given language
are stored in the same directory.
The file format is quite simple: just a sequence of rows in
format
<name> <decimal code>
The names do not have to conform to any standard, just the same
glyph must have the same name in all the files for a given language.
Not all the codes need to be described in the tables, the codes that
are not mentioned in the tables are left untranslated. So a file
of zero length may be used in case when no translation is neccessary.
The translation changes only the encoding table of the font and does not
rename the glyphs in the font file.
Examples
--------
The directory `russian' contains the tables for some encodings of the
Russian language: KOI-8, IBM CP-866, IBM CP-1251 and just for fun
ISO-8859/5 (nobody uses it anyways). The tables describe both russian
letters and table graphics characters (except for CP-1251 for which
the table graphics is not defined, so the table graphics portion for
it is just copied from KOI-8).
The file for ISO-8859/1 is just a copy of file for KOI-8. It is neccessary
because Netscape has rather weird ideas about the documents in
KOI-8 encoding. The common way to fool Netscape is to set the KOI-8
fonts for the ISO-8859/1 encoding and set the default encoding
in Netscape to 8859/1.
The directory `latin1' contains an empty table for ISO-8859/1
because it does not need any translation.

View File

@@ -0,0 +1,81 @@
<HTML>
<HEAD>
<TITLE>
The INSTALLATION GUIDE
</TITLE>
</HEAD>
<BODY>
Sergey A. Babkin
<br>
<A HREF="mailto:babkin@bellatlantic.net">
&lt;babkin@bellatlantic.net&gt;</A> or <A HREF="mailto:sab123@hotmail.com">&lt;sab123@hotmail.com&gt;</A>
<p>
<!
(Do not edit this file, it is generated from README.html!!!)
>
<H3>
The Translation Tables
</H3>
<!
----------------------
>
These translation tables are used to translate the Type 1 fonts between
different encodings of the same language.
<p>
The file names are supposed to have the suffix <tt>.tbl</tt>. Each file
describes one encoding, and all the tables for a given language
are stored in the same directory.
<p>
The file format is quite simple: just a sequence of rows in
format
<p>
<tt>
&lt;name&gt; &lt;decimal code&gt;
</tt>
<p>
The names do not have to conform to any standard, just the same
glyph must have the same name in all the files for a given language.
<p>
Not all the codes need to be described in the tables, the codes that
are not mentioned in the tables are left untranslated. So a file
of zero length may be used in case when no translation is neccessary.
<p>
The translation changes only the encoding table of the font and does not
rename the glyphs in the font file.
<p>
<H3>
Examples
</H3>
<!
--------
>
The directory `russian' contains the tables for some encodings of the
Russian language: KOI-8, IBM CP-866, IBM CP-1251 and just for fun
ISO-8859/5 (nobody uses it anyways). The tables describe both russian
letters and table graphics characters (except for CP-1251 for which
the table graphics is not defined, so the table graphics portion for
it is just copied from KOI-8).
<p>
The file for ISO-8859/1 is just a copy of file for KOI-8. It is neccessary
because Netscape has rather weird ideas about the documents in
KOI-8 encoding. The common way to fool Netscape is to set the KOI-8
fonts for the ISO-8859/1 encoding and set the default encoding
in Netscape to 8859/1.
<p>
The directory `latin1' contains an empty table for ISO-8859/1
because it does not need any translation.
<p>
</BODY>
</HTML>

View File

@@ -0,0 +1,3 @@
These files are copies of thos provided for the language "cyrillic"
and are provided for compatibility purposes only, please
use the language "cyrillic" instead.

View File

@@ -0,0 +1,4 @@
# alias real-name
iso8859-1 koi8-r
windows-1251 ibm-1251
cp-866 ibm-866

View File

@@ -0,0 +1,127 @@
cyr_DJE 128
cyr_GJE 129
quotesinglbase 130
cyr_gje 131
quotedblbase 132
ellipsis 133
dagger 134
daggerdbl 135
Euro 136
perthousand 137
cyr_LJE 138
guilsinglleft 139
cyr_NJE 140
cyr_KJE 141
cyr_TSHE 142
cyr_DZHE 143
cyr_dje 144
quotesinglleft 145
quotesinglright 146
quotedblleft 147
quotedblright 148
bullet 149
endash 150
emdash 151
trademark 153
cyr_lje 154
guilsinglright 155
cyr_nje 156
cyr_kje 157
cyr_tshe 158
cyr_dzhe 159
nbspace 160
cyr_SHORT_U 161
cyr_short_u 162
cyr_JE 163
currency 164
cyr_GHE_UPTURN 165
brokenbar 166
section 167
cyr_IO 168
copyright 169
cyr_UKRAINIAN_IE 170
guillemotleft 171
notsign 172
hyphen 173
registered 174
cyr_YI 175
degree 176
plusminus 177
cyr_BYELORUSSIAN_UKRAINIAN_I 178
cyr_byelorussian_ukrainian_i 179
cyr_ghe_upturn 180
mu 181
paragraph 182
periodcentered 183
cyr_io 184
numero 185
cyr_ukrainian_ie 186
guillemotright 187
cyr_je 188
cyr_DZE 189
cyr_dze 190
cyr_yi 191
cyr_A 192
cyr_BE 193
cyr_VE 194
cyr_GHE 195
cyr_DE 196
cyr_IE 197
cyr_ZHE 198
cyr_ZE 199
cyr_I 200
cyr_SHORT_I 201
cyr_KA 202
cyr_EL 203
cyr_EM 204
cyr_EN 205
cyr_O 206
cyr_PE 207
cyr_ER 208
cyr_ES 209
cyr_TE 210
cyr_U 211
cyr_EF 212
cyr_HA 213
cyr_TSE 214
cyr_CHE 215
cyr_SHA 216
cyr_SHCHA 217
cyr_HARD_SIGN 218
cyr_YERU 219
cyr_SOFT_SIGN 220
cyr_E 221
cyr_YU 222
cyr_YA 223
cyr_a 224
cyr_be 225
cyr_ve 226
cyr_ghe 227
cyr_de 228
cyr_ie 229
cyr_zhe 230
cyr_ze 231
cyr_i 232
cyr_short_i 233
cyr_ka 234
cyr_el 235
cyr_em 236
cyr_en 237
cyr_o 238
cyr_pe 239
cyr_er 240
cyr_es 241
cyr_te 242
cyr_u 243
cyr_ef 244
cyr_ha 245
cyr_tse 246
cyr_che 247
cyr_sha 248
cyr_shcha 249
cyr_hard_sign 250
cyr_yeru 251
cyr_soft_sign 252
cyr_e 253
cyr_yu 254
cyr_ya 255

View File

@@ -0,0 +1,128 @@
cyr_A 128
cyr_BE 129
cyr_CHE 151
cyr_DE 132
cyr_E 157
cyr_EF 148
cyr_EL 139
cyr_EM 140
cyr_EN 141
cyr_ER 144
cyr_ES 145
cyr_GHE 131
cyr_HA 149
cyr_HARD_SIGN 154
cyr_I 136
cyr_IE 133
cyr_KA 138
cyr_O 142
cyr_PE 143
cyr_SHA 152
cyr_SHCHA 153
cyr_SHORT_I 137
cyr_SOFT_SIGN 156
cyr_TE 146
cyr_TSE 150
cyr_U 147
cyr_VE 130
cyr_YA 159
cyr_YERU 155
cyr_IO 240
cyr_YU 158
cyr_ZE 135
cyr_ZHE 134
cyr_a 160
cyr_be 161
cyr_che 231
cyr_de 164
cyr_e 237
cyr_ef 228
cyr_el 171
cyr_em 172
cyr_en 173
cyr_er 224
cyr_es 225
graphic_100pc 219
graphic_25pc 178
graphic_50pc 177
graphic_75pc 176
graphic_LD 187
graphic_LR 205
graphic_LRD 203
graphic_LRT 202
graphic_LRTD 206
graphic_LRd 209
graphic_LRt 207
graphic_LRtd 216
graphic_LT 188
graphic_LTD 185
graphic_Ld 184
graphic_Lt 190
graphic_Ltd 181
graphic_RD 201
graphic_RT 200
graphic_RTD 204
graphic_Rd 213
graphic_Rt 212
graphic_Rtd 198
graphic_TD 186
copyright 252
degree 248
graphic_dintegral 245
graphic_divide 246
graphic_equal 247
graphic_fatdot 249
graphic_ge 242
graphic_lD 183
graphic_lT 189
graphic_lTD 182
graphic_ld 191
graphic_le 243
graphic_leandot 250
graphic_lefthalf 221
graphic_lowerhalf 220
graphic_lr 196
graphic_lrD 210
graphic_lrT 208
graphic_lrTD 215
graphic_lrd 194
graphic_lrt 193
graphic_lrtd 197
graphic_lt 217
graphic_ltd 180
graphic_power2 253
graphic_rD 214
graphic_rT 211
graphic_rTD 199
graphic_rd 218
graphic_righthalf 222
graphic_root 251
graphic_rt 192
graphic_rtd 195
nbspace 255
graphic_square 254
graphic_td 179
graphic_tintegral 244
graphic_upperhalf 223
cyr_ghe 163
cyr_ha 229
cyr_hard_sign 234
cyr_i 168
cyr_ie 165
cyr_ka 170
cyr_o 174
cyr_pe 175
cyr_sha 232
cyr_shcha 233
cyr_short_i 169
cyr_soft_sign 236
cyr_te 226
cyr_tse 230
cyr_u 227
cyr_ve 162
cyr_ya 239
cyr_yeru 235
cyr_io 241
cyr_yu 238
cyr_ze 167
cyr_zhe 166

View File

@@ -0,0 +1,127 @@
cyr_GHE_UPTURN 128
cyr_ghe_upturn 129
quotesinglbase 130
currency 131
quotedblbase 132
ellipsis 133
dagger 134
daggerdbl 135
Euro 136
perthousand 137
brokenbar 138
guilsinglleft 139
copyright 140
guillemotleft 141
notsign 142
registered 143
degree 144
quotesinglleft 145
quotesinglright 146
quotedblleft 147
quotedblright 148
bullet 149
endash 150
emdash 151
trademark 153
plusminus 154
guilsinglright 155
mu 156
paragraph 157
periodcentered 158
guillemotright 159
nbspace 160
cyr_IO 161
cyr_DJE 162
cyr_GJE 163
cyr_UKRAINIAN_IE 164
cyr_DZE 165
cyr_BYELORUSSIAN_UKRAINIAN_I 166
cyr_YI 167
cyr_JE 168
cyr_LJE 169
cyr_NJE 170
cyr_TSHE 171
cyr_KJE 172
hyphen 173
cyr_SHORT_U 174
cyr_DZHE 175
cyr_A 176
cyr_BE 177
cyr_VE 178
cyr_GHE 179
cyr_DE 180
cyr_IE 181
cyr_ZHE 182
cyr_ZE 183
cyr_I 184
cyr_SHORT_I 185
cyr_KA 186
cyr_EL 187
cyr_EM 188
cyr_EN 189
cyr_O 190
cyr_PE 191
cyr_ER 192
cyr_ES 193
cyr_TE 194
cyr_U 195
cyr_EF 196
cyr_HA 197
cyr_TSE 198
cyr_CHE 199
cyr_SHA 200
cyr_SHCHA 201
cyr_HARD_SIGN 202
cyr_YERU 203
cyr_SOFT_SIGN 204
cyr_E 205
cyr_YU 206
cyr_YA 207
cyr_a 208
cyr_be 209
cyr_ve 210
cyr_ghe 211
cyr_de 212
cyr_ie 213
cyr_zhe 214
cyr_ze 215
cyr_i 216
cyr_short_i 217
cyr_ka 218
cyr_el 219
cyr_em 220
cyr_en 221
cyr_o 222
cyr_pe 223
cyr_er 224
cyr_es 225
cyr_te 226
cyr_u 227
cyr_ef 228
cyr_ha 229
cyr_tse 230
cyr_che 231
cyr_sha 232
cyr_shcha 233
cyr_hard_sign 234
cyr_yeru 235
cyr_soft_sign 236
cyr_e 237
cyr_yu 238
cyr_ya 239
numero 240
cyr_io 241
cyr_dje 242
cyr_gje 243
cyr_ukrainian_ie 244
cyr_dze 245
cyr_byelorussian_ukrainian_i 246
cyr_yi 247
cyr_je 248
cyr_lje 249
cyr_nje 250
cyr_tshe 251
cyr_kje 252
section 253
cyr_short_u 254
cyr_dzhe 255

View File

@@ -0,0 +1,128 @@
cyr_A 225
cyr_BE 226
cyr_CHE 254
cyr_DE 228
cyr_E 252
cyr_EF 230
cyr_EL 236
cyr_EM 237
cyr_EN 238
cyr_ER 242
cyr_ES 243
cyr_GHE 231
cyr_HA 232
cyr_HARD_SIGN 255
cyr_I 233
cyr_IE 229
cyr_KA 235
cyr_O 239
cyr_PE 240
cyr_SHA 251
cyr_SHCHA 253
cyr_SHORT_I 234
cyr_SOFT_SIGN 248
cyr_TE 244
cyr_TSE 227
cyr_U 245
cyr_VE 247
cyr_YA 241
cyr_YERU 249
cyr_IO 179
cyr_YU 224
cyr_ZE 250
cyr_ZHE 246
cyr_a 193
cyr_be 194
cyr_che 222
cyr_de 196
cyr_e 220
cyr_ef 198
cyr_el 204
cyr_em 205
cyr_en 206
cyr_er 210
cyr_es 211
graphic_100pc 141
graphic_25pc 144
graphic_50pc 145
graphic_75pc 146
graphic_LD 168
graphic_LR 160
graphic_LRD 184
graphic_LRT 187
graphic_LRTD 190
graphic_LRd 182
graphic_LRt 185
graphic_LRtd 188
graphic_LT 174
graphic_LTD 181
graphic_Ld 166
graphic_Lt 172
graphic_Ltd 178
graphic_RD 165
graphic_RT 171
graphic_RTD 177
graphic_Rd 162
graphic_Rt 170
graphic_Rtd 175
graphic_TD 161
copyright 191
degree 156
graphic_dintegral 155
graphic_divide 159
graphic_equal 151
graphic_fatdot 149
graphic_ge 153
graphic_lD 167
graphic_lT 173
graphic_lTD 180
graphic_ld 131
graphic_le 152
graphic_leandot 158
graphic_lefthalf 142
graphic_lowerhalf 140
graphic_lr 128
graphic_lrD 183
graphic_lrT 186
graphic_lrTD 189
graphic_lrd 136
graphic_lrt 137
graphic_lrtd 138
graphic_lt 133
graphic_ltd 135
graphic_power2 157
graphic_rD 164
graphic_rT 169
graphic_rTD 176
graphic_rd 130
graphic_righthalf 143
graphic_root 150
graphic_rt 132
graphic_rtd 134
nbspace 154
graphic_square 148
graphic_td 129
graphic_tintegral 147
graphic_upperhalf 139
cyr_ghe 199
cyr_ha 200
cyr_hard_sign 223
cyr_i 201
cyr_ie 197
cyr_ka 203
cyr_o 207
cyr_pe 208
cyr_sha 219
cyr_shcha 221
cyr_short_i 202
cyr_soft_sign 216
cyr_te 212
cyr_tse 195
cyr_u 213
cyr_ve 215
cyr_ya 209
cyr_yeru 217
cyr_io 163
cyr_yu 192
cyr_ze 218
cyr_zhe 214

View File

@@ -0,0 +1,4 @@
# alias real-name
iso8859-1 koi8-r
windows-1251 ibm-1251
cp-866 ibm-866

View File

@@ -0,0 +1,127 @@
cyr_DJE 128
cyr_GJE 129
quotesinglbase 130
cyr_gje 131
quotedblbase 132
ellipsis 133
dagger 134
daggerdbl 135
Euro 136
perthousand 137
cyr_LJE 138
guilsinglleft 139
cyr_NJE 140
cyr_KJE 141
cyr_TSHE 142
cyr_DZHE 143
cyr_dje 144
quotesinglleft 145
quotesinglright 146
quotedblleft 147
quotedblright 148
bullet 149
endash 150
emdash 151
trademark 153
cyr_lje 154
guilsinglright 155
cyr_nje 156
cyr_kje 157
cyr_tshe 158
cyr_dzhe 159
nbspace 160
cyr_SHORT_U 161
cyr_short_u 162
cyr_JE 163
currency 164
cyr_GHE_UPTURN 165
brokenbar 166
section 167
cyr_IO 168
copyright 169
cyr_UKRAINIAN_IE 170
guillemotleft 171
notsign 172
hyphen 173
registered 174
cyr_YI 175
degree 176
plusminus 177
cyr_BYELORUSSIAN_UKRAINIAN_I 178
cyr_byelorussian_ukrainian_i 179
cyr_ghe_upturn 180
mu 181
paragraph 182
periodcentered 183
cyr_io 184
numero 185
cyr_ukrainian_ie 186
guillemotright 187
cyr_je 188
cyr_DZE 189
cyr_dze 190
cyr_yi 191
cyr_A 192
cyr_BE 193
cyr_VE 194
cyr_GHE 195
cyr_DE 196
cyr_IE 197
cyr_ZHE 198
cyr_ZE 199
cyr_I 200
cyr_SHORT_I 201
cyr_KA 202
cyr_EL 203
cyr_EM 204
cyr_EN 205
cyr_O 206
cyr_PE 207
cyr_ER 208
cyr_ES 209
cyr_TE 210
cyr_U 211
cyr_EF 212
cyr_HA 213
cyr_TSE 214
cyr_CHE 215
cyr_SHA 216
cyr_SHCHA 217
cyr_HARD_SIGN 218
cyr_YERU 219
cyr_SOFT_SIGN 220
cyr_E 221
cyr_YU 222
cyr_YA 223
cyr_a 224
cyr_be 225
cyr_ve 226
cyr_ghe 227
cyr_de 228
cyr_ie 229
cyr_zhe 230
cyr_ze 231
cyr_i 232
cyr_short_i 233
cyr_ka 234
cyr_el 235
cyr_em 236
cyr_en 237
cyr_o 238
cyr_pe 239
cyr_er 240
cyr_es 241
cyr_te 242
cyr_u 243
cyr_ef 244
cyr_ha 245
cyr_tse 246
cyr_che 247
cyr_sha 248
cyr_shcha 249
cyr_hard_sign 250
cyr_yeru 251
cyr_soft_sign 252
cyr_e 253
cyr_yu 254
cyr_ya 255

View File

@@ -0,0 +1,128 @@
cyr_A 128
cyr_BE 129
cyr_CHE 151
cyr_DE 132
cyr_E 157
cyr_EF 148
cyr_EL 139
cyr_EM 140
cyr_EN 141
cyr_ER 144
cyr_ES 145
cyr_GHE 131
cyr_HA 149
cyr_HARD_SIGN 154
cyr_I 136
cyr_IE 133
cyr_KA 138
cyr_O 142
cyr_PE 143
cyr_SHA 152
cyr_SHCHA 153
cyr_SHORT_I 137
cyr_SOFT_SIGN 156
cyr_TE 146
cyr_TSE 150
cyr_U 147
cyr_VE 130
cyr_YA 159
cyr_YERU 155
cyr_IO 240
cyr_YU 158
cyr_ZE 135
cyr_ZHE 134
cyr_a 160
cyr_be 161
cyr_che 231
cyr_de 164
cyr_e 237
cyr_ef 228
cyr_el 171
cyr_em 172
cyr_en 173
cyr_er 224
cyr_es 225
graphic_100pc 219
graphic_25pc 178
graphic_50pc 177
graphic_75pc 176
graphic_LD 187
graphic_LR 205
graphic_LRD 203
graphic_LRT 202
graphic_LRTD 206
graphic_LRd 209
graphic_LRt 207
graphic_LRtd 216
graphic_LT 188
graphic_LTD 185
graphic_Ld 184
graphic_Lt 190
graphic_Ltd 181
graphic_RD 201
graphic_RT 200
graphic_RTD 204
graphic_Rd 213
graphic_Rt 212
graphic_Rtd 198
graphic_TD 186
copyright 252
degree 248
graphic_dintegral 245
graphic_divide 246
graphic_equal 247
graphic_fatdot 249
graphic_ge 242
graphic_lD 183
graphic_lT 189
graphic_lTD 182
graphic_ld 191
graphic_le 243
graphic_leandot 250
graphic_lefthalf 221
graphic_lowerhalf 220
graphic_lr 196
graphic_lrD 210
graphic_lrT 208
graphic_lrTD 215
graphic_lrd 194
graphic_lrt 193
graphic_lrtd 197
graphic_lt 217
graphic_ltd 180
graphic_power2 253
graphic_rD 214
graphic_rT 211
graphic_rTD 199
graphic_rd 218
graphic_righthalf 222
graphic_root 251
graphic_rt 192
graphic_rtd 195
nbspace 255
graphic_square 254
graphic_td 179
graphic_tintegral 244
graphic_upperhalf 223
cyr_ghe 163
cyr_ha 229
cyr_hard_sign 234
cyr_i 168
cyr_ie 165
cyr_ka 170
cyr_o 174
cyr_pe 175
cyr_sha 232
cyr_shcha 233
cyr_short_i 169
cyr_soft_sign 236
cyr_te 226
cyr_tse 230
cyr_u 227
cyr_ve 162
cyr_ya 239
cyr_yeru 235
cyr_io 241
cyr_yu 238
cyr_ze 167
cyr_zhe 166

View File

@@ -0,0 +1,127 @@
cyr_GHE_UPTURN 128
cyr_ghe_upturn 129
quotesinglbase 130
currency 131
quotedblbase 132
ellipsis 133
dagger 134
daggerdbl 135
Euro 136
perthousand 137
brokenbar 138
guilsinglleft 139
copyright 140
guillemotleft 141
notsign 142
registered 143
degree 144
quotesinglleft 145
quotesinglright 146
quotedblleft 147
quotedblright 148
bullet 149
endash 150
emdash 151
trademark 153
plusminus 154
guilsinglright 155
mu 156
paragraph 157
periodcentered 158
guillemotright 159
nbspace 160
cyr_IO 161
cyr_DJE 162
cyr_GJE 163
cyr_UKRAINIAN_IE 164
cyr_DZE 165
cyr_BYELORUSSIAN_UKRAINIAN_I 166
cyr_YI 167
cyr_JE 168
cyr_LJE 169
cyr_NJE 170
cyr_TSHE 171
cyr_KJE 172
hyphen 173
cyr_SHORT_U 174
cyr_DZHE 175
cyr_A 176
cyr_BE 177
cyr_VE 178
cyr_GHE 179
cyr_DE 180
cyr_IE 181
cyr_ZHE 182
cyr_ZE 183
cyr_I 184
cyr_SHORT_I 185
cyr_KA 186
cyr_EL 187
cyr_EM 188
cyr_EN 189
cyr_O 190
cyr_PE 191
cyr_ER 192
cyr_ES 193
cyr_TE 194
cyr_U 195
cyr_EF 196
cyr_HA 197
cyr_TSE 198
cyr_CHE 199
cyr_SHA 200
cyr_SHCHA 201
cyr_HARD_SIGN 202
cyr_YERU 203
cyr_SOFT_SIGN 204
cyr_E 205
cyr_YU 206
cyr_YA 207
cyr_a 208
cyr_be 209
cyr_ve 210
cyr_ghe 211
cyr_de 212
cyr_ie 213
cyr_zhe 214
cyr_ze 215
cyr_i 216
cyr_short_i 217
cyr_ka 218
cyr_el 219
cyr_em 220
cyr_en 221
cyr_o 222
cyr_pe 223
cyr_er 224
cyr_es 225
cyr_te 226
cyr_u 227
cyr_ef 228
cyr_ha 229
cyr_tse 230
cyr_che 231
cyr_sha 232
cyr_shcha 233
cyr_hard_sign 234
cyr_yeru 235
cyr_soft_sign 236
cyr_e 237
cyr_yu 238
cyr_ya 239
numero 240
cyr_io 241
cyr_dje 242
cyr_gje 243
cyr_ukrainian_ie 244
cyr_dze 245
cyr_byelorussian_ukrainian_i 246
cyr_yi 247
cyr_je 248
cyr_lje 249
cyr_nje 250
cyr_tshe 251
cyr_kje 252
section 253
cyr_short_u 254
cyr_dzhe 255

View File

@@ -0,0 +1,128 @@
cyr_A 225
cyr_BE 226
cyr_CHE 254
cyr_DE 228
cyr_E 252
cyr_EF 230
cyr_EL 236
cyr_EM 237
cyr_EN 238
cyr_ER 242
cyr_ES 243
cyr_GHE 231
cyr_HA 232
cyr_HARD_SIGN 255
cyr_I 233
cyr_IE 229
cyr_KA 235
cyr_O 239
cyr_PE 240
cyr_SHA 251
cyr_SHCHA 253
cyr_SHORT_I 234
cyr_SOFT_SIGN 248
cyr_TE 244
cyr_TSE 227
cyr_U 245
cyr_VE 247
cyr_YA 241
cyr_YERU 249
cyr_IO 179
cyr_YU 224
cyr_ZE 250
cyr_ZHE 246
cyr_a 193
cyr_be 194
cyr_che 222
cyr_de 196
cyr_e 220
cyr_ef 198
cyr_el 204
cyr_em 205
cyr_en 206
cyr_er 210
cyr_es 211
graphic_100pc 141
graphic_25pc 144
graphic_50pc 145
graphic_75pc 146
graphic_LD 168
graphic_LR 160
graphic_LRD 184
graphic_LRT 187
graphic_LRTD 190
graphic_LRd 182
graphic_LRt 185
graphic_LRtd 188
graphic_LT 174
graphic_LTD 181
graphic_Ld 166
graphic_Lt 172
graphic_Ltd 178
graphic_RD 165
graphic_RT 171
graphic_RTD 177
graphic_Rd 162
graphic_Rt 170
graphic_Rtd 175
graphic_TD 161
copyright 191
degree 156
graphic_dintegral 155
graphic_divide 159
graphic_equal 151
graphic_fatdot 149
graphic_ge 153
graphic_lD 167
graphic_lT 173
graphic_lTD 180
graphic_ld 131
graphic_le 152
graphic_leandot 158
graphic_lefthalf 142
graphic_lowerhalf 140
graphic_lr 128
graphic_lrD 183
graphic_lrT 186
graphic_lrTD 189
graphic_lrd 136
graphic_lrt 137
graphic_lrtd 138
graphic_lt 133
graphic_ltd 135
graphic_power2 157
graphic_rD 164
graphic_rT 169
graphic_rTD 176
graphic_rd 130
graphic_righthalf 143
graphic_root 150
graphic_rt 132
graphic_rtd 134
nbspace 154
graphic_square 148
graphic_td 129
graphic_tintegral 147
graphic_upperhalf 139
cyr_ghe 199
cyr_ha 200
cyr_hard_sign 223
cyr_i 201
cyr_ie 197
cyr_ka 203
cyr_o 207
cyr_pe 208
cyr_sha 219
cyr_shcha 221
cyr_short_i 202
cyr_soft_sign 216
cyr_te 212
cyr_tse 195
cyr_u 213
cyr_ve 215
cyr_ya 209
cyr_yeru 217
cyr_io 163
cyr_yu 192
cyr_ze 218
cyr_zhe 214

View File

View File

View File

@@ -0,0 +1,3 @@
These files are copies of thos provided for the language "cyrillic"
and are provided for compatibility purposes only, please
use the language "cyrillic" instead.

View File

@@ -0,0 +1,4 @@
# alias real-name
iso8859-1 koi8-r
windows-1251 ibm-1251
cp-866 ibm-866

View File

@@ -0,0 +1,127 @@
cyr_DJE 128
cyr_GJE 129
quotesinglbase 130
cyr_gje 131
quotedblbase 132
ellipsis 133
dagger 134
daggerdbl 135
Euro 136
perthousand 137
cyr_LJE 138
guilsinglleft 139
cyr_NJE 140
cyr_KJE 141
cyr_TSHE 142
cyr_DZHE 143
cyr_dje 144
quotesinglleft 145
quotesinglright 146
quotedblleft 147
quotedblright 148
bullet 149
endash 150
emdash 151
trademark 153
cyr_lje 154
guilsinglright 155
cyr_nje 156
cyr_kje 157
cyr_tshe 158
cyr_dzhe 159
nbspace 160
cyr_SHORT_U 161
cyr_short_u 162
cyr_JE 163
currency 164
cyr_GHE_UPTURN 165
brokenbar 166
section 167
cyr_IO 168
copyright 169
cyr_UKRAINIAN_IE 170
guillemotleft 171
notsign 172
hyphen 173
registered 174
cyr_YI 175
degree 176
plusminus 177
cyr_BYELORUSSIAN_UKRAINIAN_I 178
cyr_byelorussian_ukrainian_i 179
cyr_ghe_upturn 180
mu 181
paragraph 182
periodcentered 183
cyr_io 184
numero 185
cyr_ukrainian_ie 186
guillemotright 187
cyr_je 188
cyr_DZE 189
cyr_dze 190
cyr_yi 191
cyr_A 192
cyr_BE 193
cyr_VE 194
cyr_GHE 195
cyr_DE 196
cyr_IE 197
cyr_ZHE 198
cyr_ZE 199
cyr_I 200
cyr_SHORT_I 201
cyr_KA 202
cyr_EL 203
cyr_EM 204
cyr_EN 205
cyr_O 206
cyr_PE 207
cyr_ER 208
cyr_ES 209
cyr_TE 210
cyr_U 211
cyr_EF 212
cyr_HA 213
cyr_TSE 214
cyr_CHE 215
cyr_SHA 216
cyr_SHCHA 217
cyr_HARD_SIGN 218
cyr_YERU 219
cyr_SOFT_SIGN 220
cyr_E 221
cyr_YU 222
cyr_YA 223
cyr_a 224
cyr_be 225
cyr_ve 226
cyr_ghe 227
cyr_de 228
cyr_ie 229
cyr_zhe 230
cyr_ze 231
cyr_i 232
cyr_short_i 233
cyr_ka 234
cyr_el 235
cyr_em 236
cyr_en 237
cyr_o 238
cyr_pe 239
cyr_er 240
cyr_es 241
cyr_te 242
cyr_u 243
cyr_ef 244
cyr_ha 245
cyr_tse 246
cyr_che 247
cyr_sha 248
cyr_shcha 249
cyr_hard_sign 250
cyr_yeru 251
cyr_soft_sign 252
cyr_e 253
cyr_yu 254
cyr_ya 255

View File

@@ -0,0 +1,128 @@
cyr_A 128
cyr_BE 129
cyr_CHE 151
cyr_DE 132
cyr_E 157
cyr_EF 148
cyr_EL 139
cyr_EM 140
cyr_EN 141
cyr_ER 144
cyr_ES 145
cyr_GHE 131
cyr_HA 149
cyr_HARD_SIGN 154
cyr_I 136
cyr_IE 133
cyr_KA 138
cyr_O 142
cyr_PE 143
cyr_SHA 152
cyr_SHCHA 153
cyr_SHORT_I 137
cyr_SOFT_SIGN 156
cyr_TE 146
cyr_TSE 150
cyr_U 147
cyr_VE 130
cyr_YA 159
cyr_YERU 155
cyr_IO 240
cyr_YU 158
cyr_ZE 135
cyr_ZHE 134
cyr_a 160
cyr_be 161
cyr_che 231
cyr_de 164
cyr_e 237
cyr_ef 228
cyr_el 171
cyr_em 172
cyr_en 173
cyr_er 224
cyr_es 225
graphic_100pc 219
graphic_25pc 178
graphic_50pc 177
graphic_75pc 176
graphic_LD 187
graphic_LR 205
graphic_LRD 203
graphic_LRT 202
graphic_LRTD 206
graphic_LRd 209
graphic_LRt 207
graphic_LRtd 216
graphic_LT 188
graphic_LTD 185
graphic_Ld 184
graphic_Lt 190
graphic_Ltd 181
graphic_RD 201
graphic_RT 200
graphic_RTD 204
graphic_Rd 213
graphic_Rt 212
graphic_Rtd 198
graphic_TD 186
copyright 252
degree 248
graphic_dintegral 245
graphic_divide 246
graphic_equal 247
graphic_fatdot 249
graphic_ge 242
graphic_lD 183
graphic_lT 189
graphic_lTD 182
graphic_ld 191
graphic_le 243
graphic_leandot 250
graphic_lefthalf 221
graphic_lowerhalf 220
graphic_lr 196
graphic_lrD 210
graphic_lrT 208
graphic_lrTD 215
graphic_lrd 194
graphic_lrt 193
graphic_lrtd 197
graphic_lt 217
graphic_ltd 180
graphic_power2 253
graphic_rD 214
graphic_rT 211
graphic_rTD 199
graphic_rd 218
graphic_righthalf 222
graphic_root 251
graphic_rt 192
graphic_rtd 195
nbspace 255
graphic_square 254
graphic_td 179
graphic_tintegral 244
graphic_upperhalf 223
cyr_ghe 163
cyr_ha 229
cyr_hard_sign 234
cyr_i 168
cyr_ie 165
cyr_ka 170
cyr_o 174
cyr_pe 175
cyr_sha 232
cyr_shcha 233
cyr_short_i 169
cyr_soft_sign 236
cyr_te 226
cyr_tse 230
cyr_u 227
cyr_ve 162
cyr_ya 239
cyr_yeru 235
cyr_io 241
cyr_yu 238
cyr_ze 167
cyr_zhe 166

View File

@@ -0,0 +1,127 @@
cyr_GHE_UPTURN 128
cyr_ghe_upturn 129
quotesinglbase 130
currency 131
quotedblbase 132
ellipsis 133
dagger 134
daggerdbl 135
Euro 136
perthousand 137
brokenbar 138
guilsinglleft 139
copyright 140
guillemotleft 141
notsign 142
registered 143
degree 144
quotesinglleft 145
quotesinglright 146
quotedblleft 147
quotedblright 148
bullet 149
endash 150
emdash 151
trademark 153
plusminus 154
guilsinglright 155
mu 156
paragraph 157
periodcentered 158
guillemotright 159
nbspace 160
cyr_IO 161
cyr_DJE 162
cyr_GJE 163
cyr_UKRAINIAN_IE 164
cyr_DZE 165
cyr_BYELORUSSIAN_UKRAINIAN_I 166
cyr_YI 167
cyr_JE 168
cyr_LJE 169
cyr_NJE 170
cyr_TSHE 171
cyr_KJE 172
hyphen 173
cyr_SHORT_U 174
cyr_DZHE 175
cyr_A 176
cyr_BE 177
cyr_VE 178
cyr_GHE 179
cyr_DE 180
cyr_IE 181
cyr_ZHE 182
cyr_ZE 183
cyr_I 184
cyr_SHORT_I 185
cyr_KA 186
cyr_EL 187
cyr_EM 188
cyr_EN 189
cyr_O 190
cyr_PE 191
cyr_ER 192
cyr_ES 193
cyr_TE 194
cyr_U 195
cyr_EF 196
cyr_HA 197
cyr_TSE 198
cyr_CHE 199
cyr_SHA 200
cyr_SHCHA 201
cyr_HARD_SIGN 202
cyr_YERU 203
cyr_SOFT_SIGN 204
cyr_E 205
cyr_YU 206
cyr_YA 207
cyr_a 208
cyr_be 209
cyr_ve 210
cyr_ghe 211
cyr_de 212
cyr_ie 213
cyr_zhe 214
cyr_ze 215
cyr_i 216
cyr_short_i 217
cyr_ka 218
cyr_el 219
cyr_em 220
cyr_en 221
cyr_o 222
cyr_pe 223
cyr_er 224
cyr_es 225
cyr_te 226
cyr_u 227
cyr_ef 228
cyr_ha 229
cyr_tse 230
cyr_che 231
cyr_sha 232
cyr_shcha 233
cyr_hard_sign 234
cyr_yeru 235
cyr_soft_sign 236
cyr_e 237
cyr_yu 238
cyr_ya 239
numero 240
cyr_io 241
cyr_dje 242
cyr_gje 243
cyr_ukrainian_ie 244
cyr_dze 245
cyr_byelorussian_ukrainian_i 246
cyr_yi 247
cyr_je 248
cyr_lje 249
cyr_nje 250
cyr_tshe 251
cyr_kje 252
section 253
cyr_short_u 254
cyr_dzhe 255

View File

@@ -0,0 +1,128 @@
cyr_A 225
cyr_BE 226
cyr_CHE 254
cyr_DE 228
cyr_E 252
cyr_EF 230
cyr_EL 236
cyr_EM 237
cyr_EN 238
cyr_ER 242
cyr_ES 243
cyr_GHE 231
cyr_HA 232
cyr_HARD_SIGN 255
cyr_I 233
cyr_IE 229
cyr_KA 235
cyr_O 239
cyr_PE 240
cyr_SHA 251
cyr_SHCHA 253
cyr_SHORT_I 234
cyr_SOFT_SIGN 248
cyr_TE 244
cyr_TSE 227
cyr_U 245
cyr_VE 247
cyr_YA 241
cyr_YERU 249
cyr_IO 179
cyr_YU 224
cyr_ZE 250
cyr_ZHE 246
cyr_a 193
cyr_be 194
cyr_che 222
cyr_de 196
cyr_e 220
cyr_ef 198
cyr_el 204
cyr_em 205
cyr_en 206
cyr_er 210
cyr_es 211
graphic_100pc 141
graphic_25pc 144
graphic_50pc 145
graphic_75pc 146
graphic_LD 168
graphic_LR 160
graphic_LRD 184
graphic_LRT 187
graphic_LRTD 190
graphic_LRd 182
graphic_LRt 185
graphic_LRtd 188
graphic_LT 174
graphic_LTD 181
graphic_Ld 166
graphic_Lt 172
graphic_Ltd 178
graphic_RD 165
graphic_RT 171
graphic_RTD 177
graphic_Rd 162
graphic_Rt 170
graphic_Rtd 175
graphic_TD 161
copyright 191
degree 156
graphic_dintegral 155
graphic_divide 159
graphic_equal 151
graphic_fatdot 149
graphic_ge 153
graphic_lD 167
graphic_lT 173
graphic_lTD 180
graphic_ld 131
graphic_le 152
graphic_leandot 158
graphic_lefthalf 142
graphic_lowerhalf 140
graphic_lr 128
graphic_lrD 183
graphic_lrT 186
graphic_lrTD 189
graphic_lrd 136
graphic_lrt 137
graphic_lrtd 138
graphic_lt 133
graphic_ltd 135
graphic_power2 157
graphic_rD 164
graphic_rT 169
graphic_rTD 176
graphic_rd 130
graphic_righthalf 143
graphic_root 150
graphic_rt 132
graphic_rtd 134
nbspace 154
graphic_square 148
graphic_td 129
graphic_tintegral 147
graphic_upperhalf 139
cyr_ghe 199
cyr_ha 200
cyr_hard_sign 223
cyr_i 201
cyr_ie 197
cyr_ka 203
cyr_o 207
cyr_pe 208
cyr_sha 219
cyr_shcha 221
cyr_short_i 202
cyr_soft_sign 216
cyr_te 212
cyr_tse 195
cyr_u 213
cyr_ve 215
cyr_ya 209
cyr_yeru 217
cyr_io 163
cyr_yu 192
cyr_ze 218
cyr_zhe 214

649
pdf/lib/ttf2ufm/src/ft.c Executable file
View File

@@ -0,0 +1,649 @@
/*
* 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 <freetype/config/ftheader.h>
#include <freetype/freetype.h>
#include <freetype/ftglyph.h>
#include <freetype/ftsnames.h>
#include <freetype/ttnameid.h>
#include <freetype/ftoutln.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 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 FreeType library",
/*suffix*/ { "ttf", "otf", "pfa", "pfb" },
/*open*/ openfont,
/*close*/ closefont,
/*nglyphs*/ getnglyphs,
/*glnames*/ glnames,
/*glmetrics*/ glmetrics,
/*glenc*/ glenc,
/*fnmetrics*/ fnmetrics,
/*glpath*/ glpath,
/*kerning*/ kerning,
};
/* statics */
static FT_Library library;
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;
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);
}
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
)
{
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");
}
}
/*
* 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
unsigned char bf[1024];
int 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;
}
/*
* 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;
FT_ULong charcode;
FT_UInt index;
for(i=0; i < face->num_glyphs; i++) {
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;
}
charcode = FT_Get_First_Char(face, &index);
while ( index != 0 ) {
if ( index >= face->num_glyphs ) {
break;
}
for ( i = 0; i < GLYPH_MAX_ENCODINGS; i++ ) {
if ( glyph_list[index].orig_code[i] == -1 )
break;
}
if ( i == GLYPH_MAX_ENCODINGS ) {
if (strcmp(glyph_list[index].name, ".notdef") != 0) {
WARNING_2 fprintf(stderr,
"Glyph %s has >= %d encodings (A), %4.4x & %4.4x\n",
GLYPH_MAX_ENCODINGS,
glyph_list[index].name,
glyph_list[index].orig_code[i],
charcode);
}
} else {
glyph_list[index].orig_code[i] = charcode;
}
charcode = FT_Get_Next_Char(face, charcode, &index);
}
}
/*
* 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, e;
unsigned code, index;
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( !face->charmaps || 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;
}
/*
* 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, j, len;
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 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 */
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];
len = strlen(str);
for(j=0; j<len; j++) {
if( (str[j]=='B'
|| str[j]=='b'
&& ( j==0 || !isalpha(str[j-1]) )
)
&& !strncmp("old",&str[j+1],3)
&& (j+4 >= len || !islower(str[j+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

173
pdf/lib/ttf2ufm/src/global.h Executable file
View File

@@ -0,0 +1,173 @@
/*
* 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, *ufm_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 */
/* at what we want to look now */
#ifndef DEBUG
# define DEBUG (0)
#endif
/* uncomment the next line if debugging data is wanted for one glyph only */
/* #define DBG_GLYPH "C118" /* */
#if DEBUG==0
# 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);
char *dupcnstring( unsigned char *s, int len);
/* 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 */
};

View File

@@ -0,0 +1,254 @@
// CP1250 code encoding table with glyph renaming
// Petr Titera P.Titera@sh.cvut.cz
!00 U+0000 .notdef
!01 U+0001 .notdef
!02 U+0002 .notdef
!03 U+0003 .notdef
!04 U+0004 .notdef
!05 U+0005 .notdef
!06 U+0006 .notdef
!07 U+0007 .notdef
!08 U+0008 .notdef
!09 U+0009 .notdef
!0A U+000A .notdef
!0B U+000B .notdef
!0C U+000C .notdef
!0D U+000D .notdef
!0E U+000E .notdef
!0F U+000F .notdef
!10 U+0010 .notdef
!11 U+0011 .notdef
!12 U+0012 .notdef
!13 U+0013 .notdef
!14 U+0014 .notdef
!15 U+0015 .notdef
!16 U+0016 .notdef
!17 U+0017 .notdef
!18 U+0018 .notdef
!19 U+0019 .notdef
!1A U+001A .notdef
!1B U+001B .notdef
!1C U+001C .notdef
!1D U+001D .notdef
!1E U+001E .notdef
!1F U+001F .notdef
!20 U+0020 space
!21 U+0021 exclam
!22 U+0022 quotedbl
!23 U+0023 numbersign
!24 U+0024 dollar
!25 U+0025 percent
!26 U+0026 ampersand
!27 U+0027 quote
!28 U+0028 parenleft
!29 U+0029 parenright
!2A U+002A asterisk
!2B U+002B plus
!2C U+002C comma
!2D U+002D minus
!2E U+002E period
!2F U+002F slash
!30 U+0030 zero
!31 U+0031 one
!32 U+0032 two
!33 U+0033 three
!34 U+0034 four
!35 U+0035 five
!36 U+0036 six
!37 U+0037 seven
!38 U+0038 eight
!39 U+0039 nine
!3A U+003A colon
!3B U+003B semicolon
!3C U+003C less
!3D U+003D equal
!3E U+003E greater
!3F U+003F question
!40 U+0040 at
!41 U+0041 A
!42 U+0042 B
!43 U+0043 C
!44 U+0044 D
!45 U+0045 E
!46 U+0046 F
!47 U+0047 G
!48 U+0048 H
!49 U+0049 I
!4A U+004A J
!4B U+004B K
!4C U+004C L
!4D U+004D M
!4E U+004E N
!4F U+004F O
!50 U+0050 P
!51 U+0051 Q
!52 U+0052 R
!53 U+0053 S
!54 U+0054 T
!55 U+0055 U
!56 U+0056 V
!57 U+0057 W
!58 U+0058 X
!59 U+0059 Y
!5A U+005A Z
!5B U+005B bracketleft
!5C U+005C backslash
!5D U+005D bracketright
!5E U+005E asciicircum
!5F U+005F underscore
!60 U+0060 grave
!61 U+0061 a
!62 U+0062 b
!63 U+0063 c
!64 U+0064 d
!65 U+0065 e
!66 U+0066 f
!67 U+0067 g
!68 U+0068 h
!69 U+0069 i
!6A U+006A j
!6B U+006B k
!6C U+006C l
!6D U+006D m
!6E U+006E n
!6F U+006F o
!70 U+0070 p
!71 U+0071 q
!72 U+0072 r
!73 U+0073 s
!74 U+0074 t
!75 U+0075 u
!76 U+0076 v
!77 U+0077 w
!78 U+0078 x
!79 U+0079 y
!7A U+007A z
!7B U+007B braceleft
!7C U+007C bar
!7D U+007D braceright
!7E U+007E asciitilde
!7F U+007F .notdef
!80 U+20AC .notdef
!82 U+201A quotesinglbase
!84 U+201E quotedblbase
!85 U+2026 ellipsis
!86 U+2020 dagger
!87 U+2021 daggerdbl
!89 U+2030 perthousand
!8A U+0160 Scaron
!8B U+2039 guilsinglleft
!8C U+015A Sacute
!8D U+0164 Tcaron
!8E U+017D Zcaron
!8F U+0179 Zacute
!91 U+2018 quotesinglleft
!92 U+2019 quotesinglright
!93 U+201C quotedblleft
!94 U+201D quotedblright
!95 U+2022 bullet
!96 U+2013 endash
!97 U+2014 emdash
!99 U+2122 trademark
!9A U+0161 scaron
!9B U+203A guilsinglright
!9C U+015B sacute
!9D U+0165 tcaron
!9E U+017E zcaron
!9F U+017A zacute
!A0 U+00A0 nbspace
!A1 U+02C7 caron
!A2 U+02D8 breve
!A3 U+0141 Lslash
!A4 U+00A4 currency
!A5 U+0104 Aogonek
!A6 U+00A6 brokenbar
!A7 U+00A7 section
!A8 U+00A8 dieresis
!A9 U+00A9 copyright
!AA U+015E Scedilla
!AB U+00AB guillemotleft
!AC U+00AC notsign
!AD U+00AD hyphen
!AE U+00AE registered
!AF U+017B Zdotaccent
!B0 U+00B0 degree
!B1 U+00B1 plusminus
!B2 U+02DB ogonek
!B3 U+0142 lslash
!B4 U+00B4 acute
!B5 U+00B5 mu
!B6 U+00B6 paragraph
!B7 U+2219 periodcentered
!B8 U+00B8 cedilla
!B9 U+0105 aogonek
!BA U+015F scedilla
!BB U+00BB guillemotright
!BC U+013D Lcaron
!BD U+02DD hungarumlaut
!BE U+013E lcaron
!BF U+017C zdotaccent
!C0 U+0154 Racute
!C1 U+00C1 Aacute
!C2 U+00C2 Acircumflex
!C3 U+0102 Abreve
!C4 U+00C4 Adieresis
!C5 U+0139 Lacute
!C6 U+0106 Cacute
!C7 U+00C7 Ccedilla
!C8 U+010C Ccaron
!C9 U+00C9 Eacute
!CA U+0118 Eogonek
!CB U+00CB Edieresis
!CC U+011A Ecaron
!CD U+00CD Iacute
!CE U+00CE Icircumflex
!CF U+010E Dcaron
!D0 U+00D0 Eth
!D1 U+0143 Nacute
!D2 U+0147 Ncaron
!D3 U+00D3 Oacute
!D4 U+00D4 Ocircumflex
!D5 U+0150 Ohungarumlaut
!D6 U+00D6 Odieresis
!D7 U+00D7 multiply
!D8 U+0158 Rcaron
!D9 U+016E Uring
!DA U+00DA Uacute
!DB U+0170 Uhungarumlaut
!DC U+00DC Udieresis
!DD U+00DD Yacute
!DE U+0162 Tcedilla
!DF U+00DF germandbls
!E0 U+0155 racute
!E1 U+00E1 aacute
!E2 U+00E2 acircumflex
!E3 U+0103 abreve
!E4 U+00E4 adieresis
!E5 U+013A lacute
!E6 U+0107 cacute
!E7 U+00E7 ccedilla
!E8 U+010D ccaron
!E9 U+00E9 eacute
!EA U+0119 eogonek
!EB U+00EB edieresis
!EC U+011B ecaron
!ED U+00ED iacute
!EE U+00EE icircumflex
!EF U+010F dcaron
!F0 U+0111 eth
!F1 U+0144 nacute
!F2 U+0148 ncaron
!F3 U+00F3 oacute
!F4 U+00F4 ocircumflex
!F5 U+0151 ohungarumlaut
!F6 U+00F6 odieresis
!F7 U+00F7 divide
!F8 U+0159 rcaron
!F9 U+016F uring
!FA U+00FA uacute
!FB U+0171 uhungarumlaut
!FC U+00FC udieresis
!FD U+00FD yacute
!FE U+0163 tcedilla
!FF U+02D9 dotaccent

View File

@@ -0,0 +1,245 @@
// CP1251 encoding table
// Zvezdan Petkovic <z.petkovic@computer.org>
!00 U+0000 .notdef
!01 U+0001 .notdef
!02 U+0002 .notdef
!03 U+0003 .notdef
!04 U+0004 .notdef
!05 U+0005 .notdef
!06 U+0006 .notdef
!07 U+0007 .notdef
!08 U+0008 .notdef
!09 U+0009 .notdef
!0A U+000A .notdef
!0B U+000B .notdef
!0C U+000C .notdef
!0D U+000D .notdef
!0E U+000E .notdef
!0F U+000F .notdef
!10 U+0010 .notdef
!11 U+0011 .notdef
!12 U+0012 .notdef
!20 U+0020 space
!21 U+0021 exclam
!22 U+0022 quotedbl
!23 U+0023 numbersign
!24 U+0024 dollar
!25 U+0025 percent
!26 U+0026 ampersand
!27 U+0027 quote
!28 U+0028 parenleft
!29 U+0029 parenright
!2A U+002A asterisk
!2B U+002B plus
!2C U+002C comma
!2D U+002D minus
!2E U+002E period
!2F U+002F slash
!30 U+0030 zero
!31 U+0031 one
!32 U+0032 two
!33 U+0033 three
!34 U+0034 four
!35 U+0035 five
!36 U+0036 six
!37 U+0037 seven
!38 U+0038 eight
!39 U+0039 nine
!3A U+003A colon
!3B U+003B semicolon
!3C U+003C less
!3D U+003D equal
!3E U+003E greater
!3F U+003F question
!40 U+0040 at
!41 U+0041 A
!42 U+0042 B
!43 U+0043 C
!44 U+0044 D
!45 U+0045 E
!46 U+0046 F
!47 U+0047 G
!48 U+0048 H
!49 U+0049 I
!4A U+004A J
!4B U+004B K
!4C U+004C L
!4D U+004D M
!4E U+004E N
!4F U+004F O
!50 U+0050 P
!51 U+0051 Q
!52 U+0052 R
!53 U+0053 S
!54 U+0054 T
!55 U+0055 U
!56 U+0056 V
!57 U+0057 W
!58 U+0058 X
!59 U+0059 Y
!5A U+005A Z
!5B U+005B bracketleft
!5C U+005C backslash
!5D U+005D bracketright
!5E U+005E asciicircum
!5F U+005F underscore
!60 U+0060 grave
!61 U+0061 a
!62 U+0062 b
!63 U+0063 c
!64 U+0064 d
!65 U+0065 e
!66 U+0066 f
!67 U+0067 g
!68 U+0068 h
!69 U+0069 i
!6A U+006A j
!6B U+006B k
!6C U+006C l
!6D U+006D m
!6E U+006E n
!6F U+006F o
!70 U+0070 p
!71 U+0071 q
!72 U+0072 r
!73 U+0073 s
!74 U+0074 t
!75 U+0075 u
!76 U+0076 v
!77 U+0077 w
!78 U+0078 x
!79 U+0079 y
!7A U+007A z
!7B U+007B braceleft
!7C U+007C bar
!7D U+007D braceright
!7E U+007E asciitilde
!7F U+007F .notdef
!80 U+0402 cyr_DJE
!81 U+0403 cyr_GJE
!82 U+201A quotesinglbase
!83 U+0453 cyr_gje
!84 U+201E quotedblbase
!85 U+2026 ellipsis
!86 U+2020 dagger
!87 U+2021 daggerdbl
!88 U+20AC Euro
!89 U+2030 perthousand
!8A U+0409 cyr_LJE
!8B U+2039 guilsinglleft
!8C U+040A cyr_NJE
!8D U+040C cyr_KJE
!8E U+040B cyr_TSHE
!8F U+040F cyr_DZHE
!90 U+0452 cyr_dje
!91 U+2018 quotesinglleft
!92 U+2019 quotesinglright
!93 U+201C quotedblleft
!94 U+201D quotedblright
!95 U+2022 bullet
!96 U+2013 endash
!97 U+2014 emdash
!99 U+2122 trademark
!9A U+0459 cyr_lje
!9B U+203A guilsinglright
!9C U+045A cyr_nje
!9D U+045C cyr_kje
!9E U+045B cyr_tshe
!9F U+045F cyr_dzhe
!A0 U+00A0 nbspace
!A1 U+040E cyr_SHORT_U
!A2 U+045E cyr_short_u
!A3 U+0408 cyr_JE
!A4 U+00A4 currency
!A5 U+0490 cyr_GHE_UPTURN
!A6 U+00A6 brokenbar
!A7 U+00A7 section
!A8 U+0401 cyr_IO
!A9 U+00A9 copyright
!AA U+0404 cyr_UKRAINIAN_IE
!AB U+00AB guillemotleft
!AC U+00AC notsign
!AD U+00AD hyphen
!AE U+00AE registered
!AF U+0407 cyr_YI
!B0 U+00B0 degree
!B1 U+00B1 plusminus
!B2 U+0406 cyr_BYELORUSSIAN_UKRAINIAN_I
!B3 U+0456 cyr_byelorussian_ukrainian_i
!B4 U+0491 cyr_ghe_upturn
!B5 U+00B5 mu
!B6 U+00B6 paragraph
!B7 U+00B7 periodcentered
!B8 U+0451 cyr_io
!B9 U+2116 numero
!BA U+0454 cyr_ukrainian_ie
!BB U+00BB guillemotright
!BC U+0458 cyr_je
!BD U+0405 cyr_DZE
!BE U+0455 cyr_dze
!BF U+0457 cyr_yi
!C0 U+0410 cyr_A
!C1 U+0411 cyr_BE
!C2 U+0412 cyr_VE
!C3 U+0413 cyr_GHE
!C4 U+0414 cyr_DE
!C5 U+0415 cyr_IE
!C6 U+0416 cyr_ZHE
!C7 U+0417 cyr_ZE
!C8 U+0418 cyr_I
!C9 U+0419 cyr_SHORT_I
!CA U+041A cyr_KA
!CB U+041B cyr_EL
!CC U+041C cyr_EM
!CD U+041D cyr_EN
!CE U+041E cyr_O
!CF U+041F cyr_PE
!D0 U+0420 cyr_ER
!D1 U+0421 cyr_ES
!D2 U+0422 cyr_TE
!D3 U+0423 cyr_U
!D4 U+0424 cyr_EF
!D5 U+0425 cyr_HA
!D6 U+0426 cyr_TSE
!D7 U+0427 cyr_CHE
!D8 U+0428 cyr_SHA
!D9 U+0429 cyr_SHCHA
!DA U+042A cyr_HARD_SIGN
!DB U+042B cyr_YERU
!DC U+042C cyr_SOFT_SIGN
!DD U+042D cyr_E
!DE U+042E cyr_YU
!DF U+042F cyr_YA
!E0 U+0430 cyr_a
!E1 U+0431 cyr_be
!E2 U+0432 cyr_ve
!E3 U+0433 cyr_ghe
!E4 U+0434 cyr_de
!E5 U+0435 cyr_ie
!E6 U+0436 cyr_zhe
!E7 U+0437 cyr_ze
!E8 U+0438 cyr_i
!E9 U+0439 cyr_short_i
!EA U+043A cyr_ka
!EB U+043B cyr_el
!EC U+043C cyr_em
!ED U+043D cyr_en
!EE U+043E cyr_o
!EF U+043F cyr_pe
!F0 U+0440 cyr_er
!F1 U+0441 cyr_es
!F2 U+0442 cyr_te
!F3 U+0443 cyr_u
!F4 U+0444 cyr_ef
!F5 U+0445 cyr_ha
!F6 U+0446 cyr_tse
!F7 U+0447 cyr_che
!F8 U+0448 cyr_sha
!F9 U+0449 cyr_shcha
!FA U+044A cyr_hard_sign
!FB U+044B cyr_yeru
!FC U+044C cyr_soft_sign
!FD U+044D cyr_e
!FE U+044E cyr_yu
!FF U+044F cyr_ya

View File

@@ -0,0 +1,111 @@
// Map file to make PFA/PFB files with T2A encoding
// from TTF using ttf2pt1 package. See package documentation for details.
// The encoding is incomplete but some (many) glyphs do not exist in TTF.
// Mikhail Umorin mikeumo@obebox.com
//start at 0
0x0060
0x00B4
0x02C6
0x02DC
0x00A8
0x02DD
0x02DA
0x02C7
0x02D8
0x00AF
0x02D9
// at 0x000B (11)
// will set more later
0x00B8
0x02DB
0x0130
0x2039
0x203A
0x201C
0x201D
0x0000
0x0000
0x0000
0x2013
0x2014
0x0000
0x0000
0x0131
0x0000
0x0000
0x0000
0x0000
0x0000
0x0000
// at 0x0020 (32)
0x0020-0x005F
// at 0x0060 (96)
0x2018
// at 0x0061 (97)
0x0061-0x007E
0x00AD
//this ends the lower half of the table: 0x007F (127)
// at 0x008F
0x0490
0x0000
0x040B
0x0402
0x0000
0x0000
0x0000
0x0409
0x0407
0x0000
0x0000
0x0000
0x00C6
0x0000
0x0000
0x0405
0x0000
0x00C7
0x040E
0x0000
0x0000
0x0000
0x040F
0x0000
0x0000
0x0404
0x0000
// at 155
0x040A, 0x0401, 0x2116, 0x00A4, 0x00A7
// at A0 (160)
0x0491
0x0000
0x045B
0x0452
0x0000
0x0000
0x0000
0x0459
0x0457
0x0000
0x0000
0x0000
0x00E6
0x0000
0x0000
0x0455
0x0000
0x00E7
0x045E
0x0000
0x0000
0x0000
0x045F
0x0000
0x0000
0x0454
0x0000
// at 187
0x045A, 0x0451, 0x201E, 0x00AB, 0x00BB
// at 192
0x0410-0x044F
// this concludes the upper half of the table

View File

@@ -0,0 +1,231 @@
// Adobe Standard Encoding table for ttf2pt1
// Thomas Henlich <Thomas.Henlich@mailbox.tu-dresden.de>
=20 U+0020 SPACE
=21 U+0021 EXCLAMATION MARK
=22 U+0022 QUOTATION MARK
=23 U+0023 NUMBER SIGN
=24 U+0024 DOLLAR SIGN
=25 U+0025 PERCENT SIGN
=26 U+0026 AMPERSAND
=27 U+2019 RIGHT SINGLE QUOTATION MARK
=28 U+0028 LEFT PARENTHESIS
=29 U+0029 RIGHT PARENTHESIS
=2A U+002A ASTERISK
=2B U+002B PLUS SIGN
=2C U+002C COMMA
=2D U+002D HYPHEN-MINUS
=2E U+002E FULL STOP
=2F U+002F SOLIDUS
=30 U+0030 DIGIT ZERO
=31 U+0031 DIGIT ONE
=32 U+0032 DIGIT TWO
=33 U+0033 DIGIT THREE
=34 U+0034 DIGIT FOUR
=35 U+0035 DIGIT FIVE
=36 U+0036 DIGIT SIX
=37 U+0037 DIGIT SEVEN
=38 U+0038 DIGIT EIGHT
=39 U+0039 DIGIT NINE
=3A U+003A COLON
=3B U+003B SEMICOLON
=3C U+003C LESS-THAN SIGN
=3D U+003D EQUALS SIGN
=3E U+003E GREATER-THAN SIGN
=3F U+003F QUESTION MARK
=40 U+0040 COMMERCIAL AT
=41 U+0041 LATIN CAPITAL LETTER A
=42 U+0042 LATIN CAPITAL LETTER B
=43 U+0043 LATIN CAPITAL LETTER C
=44 U+0044 LATIN CAPITAL LETTER D
=45 U+0045 LATIN CAPITAL LETTER E
=46 U+0046 LATIN CAPITAL LETTER F
=47 U+0047 LATIN CAPITAL LETTER G
=48 U+0048 LATIN CAPITAL LETTER H
=49 U+0049 LATIN CAPITAL LETTER I
=4A U+004A LATIN CAPITAL LETTER J
=4B U+004B LATIN CAPITAL LETTER K
=4C U+004C LATIN CAPITAL LETTER L
=4D U+004D LATIN CAPITAL LETTER M
=4E U+004E LATIN CAPITAL LETTER N
=4F U+004F LATIN CAPITAL LETTER O
=50 U+0050 LATIN CAPITAL LETTER P
=51 U+0051 LATIN CAPITAL LETTER Q
=52 U+0052 LATIN CAPITAL LETTER R
=53 U+0053 LATIN CAPITAL LETTER S
=54 U+0054 LATIN CAPITAL LETTER T
=55 U+0055 LATIN CAPITAL LETTER U
=56 U+0056 LATIN CAPITAL LETTER V
=57 U+0057 LATIN CAPITAL LETTER W
=58 U+0058 LATIN CAPITAL LETTER X
=59 U+0059 LATIN CAPITAL LETTER Y
=5A U+005A LATIN CAPITAL LETTER Z
=5B U+005B LEFT SQUARE BRACKET
=5C U+005C REVERSE SOLIDUS
=5D U+005D RIGHT SQUARE BRACKET
=5E U+005E CIRCUMFLEX ACCENT
=5F U+005F LOW LINE
=60 U+2018 LEFT SINGLE QUOTATION MARK
=61 U+0061 LATIN SMALL LETTER A
=62 U+0062 LATIN SMALL LETTER B
=63 U+0063 LATIN SMALL LETTER C
=64 U+0064 LATIN SMALL LETTER D
=65 U+0065 LATIN SMALL LETTER E
=66 U+0066 LATIN SMALL LETTER F
=67 U+0067 LATIN SMALL LETTER G
=68 U+0068 LATIN SMALL LETTER H
=69 U+0069 LATIN SMALL LETTER I
=6A U+006A LATIN SMALL LETTER J
=6B U+006B LATIN SMALL LETTER K
=6C U+006C LATIN SMALL LETTER L
=6D U+006D LATIN SMALL LETTER M
=6E U+006E LATIN SMALL LETTER N
=6F U+006F LATIN SMALL LETTER O
=70 U+0070 LATIN SMALL LETTER P
=71 U+0071 LATIN SMALL LETTER Q
=72 U+0072 LATIN SMALL LETTER R
=73 U+0073 LATIN SMALL LETTER S
=74 U+0074 LATIN SMALL LETTER T
=75 U+0075 LATIN SMALL LETTER U
=76 U+0076 LATIN SMALL LETTER V
=77 U+0077 LATIN SMALL LETTER W
=78 U+0078 LATIN SMALL LETTER X
=79 U+0079 LATIN SMALL LETTER Y
=7A U+007A LATIN SMALL LETTER Z
=7B U+007B LEFT CURLY BRACKET
=7C U+007C VERTICAL LINE
=7D U+007D RIGHT CURLY BRACKET
=7E U+007E TILDE
=A1 U+00A1 INVERTED EXCLAMATION MARK
=A2 U+00A2 CENT SIGN
=A3 U+00A3 POUND SIGN
=A4 U+2044 FRACTION SLASH
=A5 U+00A5 YEN SIGN
=A6 U+0192 LATIN SMALL LETTER F WITH HOOK
=A7 U+00A7 SECTION SIGN
=A8 U+00A4 CURRENCY SIGN
=A9 U+0027 APOSTROPHE
=AA U+201C LEFT DOUBLE QUOTATION MARK
=AB U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
=AC U+2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK
=AD U+203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
=AE U+FB01 LATIN SMALL LIGATURE FI
=AF U+FB02 LATIN SMALL LIGATURE FL
=B1 U+2013 EN DASH
=B2 U+2020 DAGGER
=B3 U+2021 DOUBLE DAGGER
=B4 U+00B7 MIDDLE DOT
=B6 U+00B6 PILCROW SIGN
=B7 U+2022 BULLET
=B8 U+201A SINGLE LOW-9 QUOTATION MARK
=B9 U+201E DOUBLE LOW-9 QUOTATION MARK
=BA U+201D RIGHT DOUBLE QUOTATION MARK
=BB U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
=BC U+2026 HORIZONTAL ELLIPSIS
=BD U+2030 PER MILLE SIGN
=BF U+00BF INVERTED QUESTION MARK
=C1 U+0060 GRAVE ACCENT
=C2 U+00B4 ACUTE ACCENT
=C3 U+02C6 MODIFIER LETTER CIRCUMFLEX ACCENT
=C4 U+02DC SMALL TILDE
=C5 U+00AF MACRON
=C6 U+02D8 BREVE
=C7 U+02D9 DOT ABOVE
=C8 U+00A8 DIAERESIS
=CA U+02DA RING ABOVE
=CB U+00B8 CEDILLA
=CD U+02DD DOUBLE ACUTE ACCENT
=CE U+02DB OGONEK
=CF U+02C7 CARON
=D0 U+2014 EM DASH
=E1 U+00C6 LATIN CAPITAL LETTER AE
=E3 U+00AA FEMININE ORDINAL INDICATOR
=E8 U+0141 LATIN CAPITAL LETTER L WITH STROKE
=E9 U+00D8 LATIN CAPITAL LETTER O WITH STROKE
=EA U+0152 LATIN CAPITAL LIGATURE OE
=EB U+00BA MASCULINE ORDINAL INDICATOR
=F1 U+00E6 LATIN SMALL LETTER AE
=F5 U+0131 LATIN SMALL LETTER DOTLESS I
=F8 U+0142 LATIN SMALL LETTER L WITH STROKE
=F9 U+00F8 LATIN SMALL LETTER O WITH STROKE
=FA U+0153 LATIN SMALL LIGATURE OE
=FB U+00DF LATIN SMALL LETTER SHARP S
// unencoded characters:
=100 U+00E7 LATIN SMALL LETTER C WITH CEDILLA
=101 U+00FF LATIN SMALL LETTER Y WITH DIAERESIS
=102 U+00E3 LATIN SMALL LETTER A WITH TILDE
=103 U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX
=104 U+00B3 SUPERSCRIPT THREE
=105 U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX
=106 U+00FE LATIN SMALL LETTER THORN
=107 U+00E8 LATIN SMALL LETTER E WITH GRAVE
=108 U+00B2 SUPERSCRIPT TWO
=109 U+00E9 LATIN SMALL LETTER E WITH ACUTE
=10A U+00F5 LATIN SMALL LETTER O WITH TILDE
=10B U+00C1 LATIN CAPITAL LETTER A WITH ACUTE
=10C U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX
=10D U+00FD LATIN SMALL LETTER Y WITH ACUTE
=10E U+00FC LATIN SMALL LETTER U WITH DIAERESIS
=10F U+00BE VULGAR FRACTION THREE QUARTERS
=110 U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX
=111 U+00D0 LATIN CAPITAL LETTER ETH
=112 U+00EB LATIN SMALL LETTER E WITH DIAERESIS
=113 U+00F9 LATIN SMALL LETTER U WITH GRAVE
=114 U+2122 TRADE MARK SIGN
=115 U+00F2 LATIN SMALL LETTER O WITH GRAVE
=116 U+0161 LATIN SMALL LETTER S WITH CARON
=117 U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS
=118 U+00FA LATIN SMALL LETTER U WITH ACUTE
=119 U+00E0 LATIN SMALL LETTER A WITH GRAVE
=11A U+00F1 LATIN SMALL LETTER N WITH TILDE
=11B U+00E5 LATIN SMALL LETTER A WITH RING ABOVE
=11C U+017E LATIN SMALL LETTER Z WITH CARON
=11D U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX
=11E U+00D1 LATIN CAPITAL LETTER N WITH TILDE
=11F U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX
=120 U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX
=121 U+00CD LATIN CAPITAL LETTER I WITH ACUTE
=122 U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA
=123 U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS
=124 U+0160 LATIN CAPITAL LETTER S WITH CARON
=125 U+00CC LATIN CAPITAL LETTER I WITH GRAVE
=126 U+00E4 LATIN SMALL LETTER A WITH DIAERESIS
=127 U+00D2 LATIN CAPITAL LETTER O WITH GRAVE
=128 U+00C8 LATIN CAPITAL LETTER E WITH GRAVE
=129 U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS
=12A U+00AE REGISTERED SIGN
=12B U+00D5 LATIN CAPITAL LETTER O WITH TILDE
=12C U+00BC VULGAR FRACTION ONE QUARTER
=12D U+00D9 LATIN CAPITAL LETTER U WITH GRAVE
=12E U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX
=12F U+00DE LATIN CAPITAL LETTER THORN
=130 U+00F7 DIVISION SIGN
=131 U+00C3 LATIN CAPITAL LETTER A WITH TILDE
=132 U+00DA LATIN CAPITAL LETTER U WITH ACUTE
=133 U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX
=134 U+00AC NOT SIGN
=135 U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE
=136 U+00EF LATIN SMALL LETTER I WITH DIAERESIS
=137 U+00ED LATIN SMALL LETTER I WITH ACUTE
=138 U+00E1 LATIN SMALL LETTER A WITH ACUTE
=139 U+00B1 PLUS-MINUS SIGN
=13A U+00D7 MULTIPLICATION SIGN
=13B U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS
=13C U+2212 MINUS SIGN
=13D U+00B9 SUPERSCRIPT ONE
=13E U+00C9 LATIN CAPITAL LETTER E WITH ACUTE
=13F U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX
=140 U+00A9 COPYRIGHT SIGN
=141 U+00C0 LATIN CAPITAL LETTER A WITH GRAVE
=142 U+00F6 LATIN SMALL LETTER O WITH DIAERESIS
=143 U+00F3 LATIN SMALL LETTER O WITH ACUTE
=144 U+00B0 DEGREE SIGN
=145 U+00EC LATIN SMALL LETTER I WITH GRAVE
=146 U+00B5 MICRO SIGN
=147 U+00D3 LATIN CAPITAL LETTER O WITH ACUTE
=148 U+00F0 LATIN SMALL LETTER ETH
=149 U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
=14A U+00DD LATIN CAPITAL LETTER Y WITH ACUTE
=14B U+00A6 BROKEN BAR
=14C U+00BD VULGAR FRACTION ONE HALF

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1181
pdf/lib/ttf2ufm/src/maps/cugb.map Executable file

File diff suppressed because it is too large Load Diff

3185
pdf/lib/ttf2ufm/src/maps/cugbk.map Executable file

File diff suppressed because it is too large Load Diff

2184
pdf/lib/ttf2ufm/src/maps/ubig5.map Executable file

File diff suppressed because it is too large Load Diff

1236
pdf/lib/ttf2ufm/src/maps/ugb.map Executable file

File diff suppressed because it is too large Load Diff

3295
pdf/lib/ttf2ufm/src/maps/ugbk.map Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,158 @@
# this file is a sample Unicode map description.
# It describes which glyphs are to be included in the font
# and at which character position they are to be put.
# If the character position is greater than 255, the glyph is included, but
# does not appear in the encoding table (you must then use font reencoding
# to use this glyph).
# That makes it possible to have more than 256 glyphs in a font.
# Currently the maximum supported number of glyphs is 1024.
# Use this file as the argument to ttf2pt1's -L option.
# 1999-11-24 Thomas.Henlich@mailbox.tu-dresden.de
# 2000-03-01 Sergey Babkin: added 3rd format
# comment lines start with '#' or '%' or '//'
# The default source encoding table in the TTF file is Unicode (pid=3,eid=1).
# However a map may specify another source encoding with the "id <pid> <eid>"
# directive. If this directive is used at the beginning of the map file,
# it applies to the whole file. If it is used after a "plane" directive,
# then it sets the source encoding for this particular destination plane
# (possibly overriding the file-wide id directive). The user can also
# specify the source encoding explicitly at the comman line in the
# argument to the option -L. This used-specified source encoding overrides
# any id directives in the map file.
# examples:
# same as Unicode (default)
id 3 1
# One file may contain multiple actual translation tables. Each particular
# table within a file is named a plane. The primary use of planes is
# for multi-plane Eastern fonts with over 256 glyphs: for them one TTF
# file gets converted into multiple Type1 files, with each resulting file
# containing one plane of the original font. But they may also be used
# in other creative ways. Each plane may be specified in different format
# although this is not recommended for aesthetical reasons. If a map file
# contains any specifications of planes then the plane argument MUST
# be specified to the converter with that map file. If a map file
# contains no specifications of planes then the plane argument MUST NOT
# be specified to the converter with that map file.
#
# The plane maps start from the plane directive and continue to the next
# plane directive or end of file. The plane directive must be located
# at the very beginning of a separate string and contain the word "plane"
# followed by whitespace and the plane name. The whitespace characters
# are not allowed in the plane names. Non-alphanumeric characters are
# discouraged in the plane names as well.
# examples:
plane 81
=27 U+0027 APOSTROPHE
plane otherplane
0, 1, 2
% There is one code assignment per line.
// Three formats are recognized:
# 1. optional whitespace, followed by '=', followed by a hex number
# (character position), followed by optional whitespace, followed by
# 'U+', followed by a four-digit hex number (the Unicode of the glyph we want
# here), followed by any number of characters.
// example:
=20 U+0020 SPACE
=48 U+0021 EXCLAMATION MARK
=22 U+0022 QUOTATION MARK
=23 U+0023 NUMBER SIGN
=24 U+0024 DOLLAR SIGN
=25 U+0025 PERCENT SIGN
=26 U+0026 AMPERSAND
=27 U+0027 APOSTROPHE
=E0 U+042E CYRILLIC CAPITAL LETTER YU
=E1 U+0410 CYRILLIC CAPITAL LETTER A
=E2 U+0411 CYRILLIC CAPITAL LETTER BE
=E3 U+0426 CYRILLIC CAPITAL LETTER TSE
=E4 U+0414 CYRILLIC CAPITAL LETTER DE
=E5 U+0415 CYRILLIC CAPITAL LETTER IE
=E6 U+0424 CYRILLIC CAPITAL LETTER EF
=E7 U+0413 CYRILLIC CAPITAL LETTER GHE
% 2. optional whitespace, followed by '<', followed by one or more
% non-whitespace characters,
% followed by optional whitespace, followed by '/x', followed by
% a hex number (character position), followed by optional
% whitespace, followed by '<U', followed by a four-digit hex number
% (the Unicode of the glyph we want here), followed by '>' and any number
% of characters.
# example:
<I> /x40 <U0049> LATIN CAPITAL LETTER I
<t> /x41 <U0074> LATIN SMALL LETTER T
<r> /x43 <U0072> LATIN SMALL LETTER R
<o> /x44 <U006F> LATIN SMALL LETTER O
<c> /x45 <U0063> LATIN SMALL LETTER C
<k> /x46 <U006B> LATIN SMALL LETTER K
<s> /x47 <U0073> LATIN SMALL LETTER S
<Eu> /xA4 <U20AC> EURO SIGN
# 3. optional whitespace, followed by '!', followed by a hex number
# (character position), followed by optional whitespace, followed by
# 'U+', followed by a four-digit hex number (the Unicode of the glyph we want
# here), followed by the name of the glyph that will be used in the
# output file.
# example:
!20 U+0020 space
!21 U+0021 exclam
!22 U+0022 quotedbl
!23 U+0023 numbersign
!24 U+0024 dollar
!25 U+0025 percent
# 4. compact format: just list of unicodes separated by commas or ranges
# denoted by a dash between unicodes. These unicodes are mapped to
# the output codes starting from 0 and continuously increasing.
# It is possible to reset the current code by using the "at" directive
# which must start at beginning of the line and give the new current
# output code (which will be assigned to the next occuring unicode)
# as decimal, hexadecimal or octal in C notation. The "at directive must
# take a separate line. The spaces around unicodes don't matter.
# example:
# map unicodes 0x40, 0x400, 0x4000 to the output codes 0, 1, 2 and unicodes
# 0xf010 - 0xf020, 0xf030 to the output codes 0x11-0x22
0, 1, 2
at 0x11
0xf010- 0xf020, 0xf030
# the first format is used by Roman Czyborra on his fine WWW pages:
# http://czyborra.com/charsets/iso8859.html
# the second format is used in the Linux locale charmaps files:
# /usr/share/i18n/charmaps/*
# we don't need those glyphs in the encoding table
=100 U+0030 DIGIT ZERO
=101 U+0031 DIGIT ONE
=102 U+0032 DIGIT TWO
=103 U+0033 DIGIT THREE
=104 U+0034 DIGIT FOUR
=105 U+0035 DIGIT FIVE
=106 U+0036 DIGIT SIX
=107 U+0037 DIGIT SEVEN
=108 U+0039 DIGIT NINE
=109 U+0038 DIGIT EIGHT

View File

@@ -0,0 +1,20 @@
PROGS= bz cmpf dmpf
BZOBJS= bz.o bzscreen.o
CFLAGS= -g
all: $(PROGS)
clean:
rm -f $(PROGS) *.o *.core core.* core
bz: $(BZOBJS)
$(CC) $(CFLAGS) -o bz $(BZOBJS)
cmpf: cmpf.c bmpfont.h
$(CC) $(CFLAGS) -o cmpf -I/usr/local/include -L/usr/local/lib cmpf.c -lt1 -lm
dmpf: dmpf.c bmpfont.h
$(CC) $(CFLAGS) -o dmpf -I/usr/local/include -L/usr/local/lib dmpf.c -lt1 -lm

127
pdf/lib/ttf2ufm/src/other/README Executable file
View File

@@ -0,0 +1,127 @@
Supplements for True Type to PostScript Type 1 Converter
(Do not edit this file, it is generated from README.html!!!)
bz
--
A small program to draw the Bezier curves on an alphanumeric display.
The recommended way of uing it is to run it from xterm with "Tiny"
(if you want higher magnification) or "Unreadable" (if you want
higher resolution) font and as big window size as possible. The size
of the window can be obtained by running "stty -a". For everything else
just "Use the source, Luke!"
cmpf
----
A small program to compare the rendering of two supposedly
nearly-identical fonts at low resolutions. It requires the
T1LIB library. This program may be used to compare the
effect of various options of the converter on the resulting
fonts. Create two .pfa files, one with one set of options,
another with another set of options, then use this program
to compare them.
dmpf
----
A small program to dump the bitmaps of all glyphs of the font
at low pixel sizes, up to 20 pixels. It requires the
T1LIB library. This program may be used to compare the
effect of changes in the T1LIB rasterizer and just for visual
search for rendering anomalies.
lst.pl
------
A simple PERL script that generates an HTML file
with the full list of all characters in all
possible styles of the Variable-width and Fixed-width
fonts. This file is quite convenient to look
at the converted fonts in Netscape (or other
graphical browser).
cntstems.pl
------
A simple PERL script that counts the required hint stack in the
interpreter to rasterize the glyphs of the font. May be quite
useful in search for missing glyphs which may be aborted due to
insufficient stack depth.
showg
-----
A PERL script that draws the glyphs and their interesting
metrics (such as coordinates of the dots, hints and blue zones)
in PostScript. It works only with un-encoded font files generated
by ttf2pt1. The intended use is like:
showg [-c <fontfile.t1a>]... <fontfile.t1a> <glyph-to-draw>... >file.ps
gv file.ps # start the Ghostscript viewer
As you can see, multiple glyphs may be specified. The glyphs may be
specified in one of three ways:
- as a decimal code (for example, 43 )
- as a glyph name preceded by a slash (for example, /plus )
- as a literal character preceded by a dot (for example, .+ )
So for example the following command would draw the same glyph "left
parenthesis" three times:
showg file.t1a 40 /parenleft .\( >/file.ps
Don't forget that some characters have to be protected from the shell
by backslash as shown above, or else the shell would try to interpret
them before passing to the program.
One file (given as the first argument) is considered the main file
but multiple files can be specified with option -c for visual comparison
of the outlines. The glyphs from the main file are drawn in black
and supplemented with coordinate grid and sidebars for hints. The
glyphs from the comparison files are drawn in slightly lighter colors
(red, cyan, brown) and no supplemental information is provided for them.
Each use of option -c adds one comparison file, this option may be used
multiple times. If there are more than 3 comparison files the colors
repeat cyclically.
So for example the following command would draw the same glyph "left
parenthesis" from three files on the same page:
showg -c fileA.t1a -c fileB.t1a file.t1a .\( >/file.ps
This program is quite valuable it you want to take a close-up view at
the font.
The outlines are drawn in black, the ends of the curves and
lines are marked as dots, the first dots of the outlines
are fatter. The Blue Zones are drawn in light blue. The
substituted hints are marked in red, the global hints are
marked in blue. The coordinate grid is drawn in green.
The stems and the values of coordinates are for convenience
marked twice, on each size of the picture.
showdf
------
A Perl script to find a list of differing glyphs in two versions of a font
file (for example, converted with different versions of ttf2pt1 or
with different options given to ttf2pt1) and feed this list into the showg
program for display. The intended use is like:
showdf <showg-location> <fontfile1.t1a> <fontfile2.t1a> >file.ps
gv file.ps # start the Ghostscript viewer
If both showdf and showg scripts are located in the
same directory, the command would look like:
./showdf ./showg font1.t1a font2.t1a >file.ps
For decent results both font files should be converted from the same original
font and contain the same glyphs with the same names in the same order.
Otherwise most probably all the glyphs will be included, or a failure may
happen if some glyph is not found in one of the files. It is also a good
idea to convert the fonts for comparison with hinting disabled, otherwise
the differences in hinting may trigger the otherwise equal glyphs to be shown.

View File

@@ -0,0 +1,176 @@
<HTML>
<HEAD>
<TITLE>
Supplements for True Type to PostScript Type 1 Converter
</TITLE>
</HEAD>
<BODY>
<H2>
Supplements for True Type to PostScript Type 1 Converter
</H2>
<!
(Do not edit this file, it is generated from README.html!!!)
>
<h4><tt>bz</tt></h4>
<!
--
>
A small program to draw the Bezier curves on an alphanumeric display.
The recommended way of uing it is to run it from xterm with "Tiny"
(if you want higher magnification) or "Unreadable" (if you want
higher resolution) font and as big window size as possible. The size
of the window can be obtained by running "<tt>stty -a</tt>". For everything else
just "Use the source, Luke!"
<p>
<h4><tt>cmpf</tt></h4>
<!
----
>
A small program to compare the rendering of two supposedly
nearly-identical fonts at low resolutions. It requires the
T1LIB library. This program may be used to compare the
effect of various options of the converter on the resulting
fonts. Create two <tt>.pfa</tt> files, one with one set of options,
another with another set of options, then use this program
to compare them.
<p>
<h4><tt>dmpf</tt></h4>
<!
----
>
A small program to dump the bitmaps of all glyphs of the font
at low pixel sizes, up to 20 pixels. It requires the
T1LIB library. This program may be used to compare the
effect of changes in the T1LIB rasterizer and just for visual
search for rendering anomalies.
<p>
<h4><tt>lst.pl</tt></h4>
<!
------
>
A simple PERL script that generates an HTML file
with the full list of all characters in all
possible styles of the Variable-width and Fixed-width
fonts. This file is quite convenient to look
at the converted fonts in Netscape (or other
graphical browser).
<h4><tt>cntstems.pl</tt></h4>
<!
------
>
A simple PERL script that counts the required hint stack in the
interpreter to rasterize the glyphs of the font. May be quite
useful in search for missing glyphs which may be aborted due to
insufficient stack depth.
<h4><tt>showg</tt></h4>
<!
-----
>
A PERL script that draws the glyphs and their interesting
metrics (such as coordinates of the dots, hints and blue zones)
in PostScript. It works only with un-encoded font files generated
by <tt>ttf2pt1</tt>. The intended use is like:
<p>
&nbsp;&nbsp;<tt>showg [-c <i>&lt;fontfile.t1a&gt;</i>]... <i>&lt;fontfile.t1a&gt; &lt;glyph-to-draw&gt;</i>... &gt;file.ps</tt><br>
&nbsp;&nbsp;<tt>gv file.ps # start the Ghostscript viewer</tt>
<p>
As you can see, multiple glyphs may be specified. The glyphs may be
specified in one of three ways:
<br>
&nbsp;&nbsp;- as a decimal code (for example, <tt>43</tt> )
<br>
&nbsp;&nbsp;- as a glyph name preceded by a slash (for example, <tt>/plus</tt> )
<br>
&nbsp;&nbsp;- as a literal character preceded by a dot (for example, <tt>.+</tt> )
<p>
So for example the following command would draw the same glyph "left
parenthesis" three times:
<p>
&nbsp;&nbsp;<tt>showg file.t1a 40 /parenleft .\( >/file.ps</tt>
<p>
Don't forget that some characters have to be protected from the shell
by backslash as shown above, or else the shell would try to interpret
them before passing to the program.
<p>
One file (given as the first argument) is considered the main file
but multiple files can be specified with option <b>-c</b> for visual comparison
of the outlines. The glyphs from the main file are drawn in black
and supplemented with coordinate grid and sidebars for hints. The
glyphs from the comparison files are drawn in slightly lighter colors
(red, cyan, brown) and no supplemental information is provided for them.
Each use of option <b>-c</b> adds one comparison file, this option may be used
multiple times. If there are more than 3 comparison files the colors
repeat cyclically.
<p>
So for example the following command would draw the same glyph "left
parenthesis" from three files on the same page:
<p>
&nbsp;&nbsp;<tt>showg -c fileA.t1a -c fileB.t1a file.t1a .\( >/file.ps</tt>
<p>
This program is quite valuable it you want to take a close-up view at
the font.
<p>
The outlines are drawn in black, the ends of the curves and
lines are marked as dots, the first dots of the outlines
are fatter. The Blue Zones are drawn in light blue. The
substituted hints are marked in red, the global hints are
marked in blue. The coordinate grid is drawn in green.
The stems and the values of coordinates are for convenience
marked twice, on each size of the picture.
<p>
<h4><tt>showdf</tt></h4>
<!
------
>
A Perl script to find a list of differing glyphs in two versions of a font
file (for example, converted with different versions of <tt>ttf2pt1</tt> or
with different options given to ttf2pt1) and feed this list into the <tt>showg</tt>
program for display. The intended use is like:
<p>
&nbsp;&nbsp;<tt>showdf <i>&lt;showg-location&gt;</i> <i>&lt;fontfile1.t1a&gt;</i> <i>&lt;fontfile2.t1a&gt;</i> &gt;file.ps</tt><br>
&nbsp;&nbsp;<tt>gv file.ps # start the Ghostscript viewer</tt>
<p>
If both <tt>showdf</tt> and <tt>showg</tt> scripts are located in the
same directory, the command would look like:
<p>
&nbsp;&nbsp;<tt>./showdf ./showg font1.t1a font2.t1a &gt;file.ps</tt><br>
<p>
For decent results both font files should be converted from the same original
font and contain the same glyphs with the same names in the same order.
Otherwise most probably all the glyphs will be included, or a failure may
happen if some glyph is not found in one of the files. It is also a good
idea to convert the fonts for comparison with hinting disabled, otherwise
the differences in hinting may trigger the otherwise equal glyphs to be shown.
<p>
</BODY>
</HTML>

View File

@@ -0,0 +1,338 @@
/*
* see COPYRIGHT
*/
fchkneg(file, line, rc, cmd)
char *file;
int line;
int rc;
char *cmd;
{
if(rc<0) {
fprintf(stderr,"%s: fatal error on line %d of %s: %d\n",
PROGNAME, line, file, rc);
fprintf(stderr,"%s\n", cmd);
exit(1);
}
}
fchknull(file, line, rc, cmd)
char *file;
int line;
void *rc;
char *cmd;
{
if(rc==NULL) {
fprintf(stderr,"%s: fatal error on line %d of %s: NULL\n",
PROGNAME, line, file);
fprintf(stderr,"%s\n", cmd);
exit(1);
}
}
#define chkneg(f) fchkneg(__FILE__,__LINE__,(f),#f)
#define chknull(f) fchknull(__FILE__,__LINE__,(f),#f)
#define MYPAD 8
#define CHRNONE ' '
#define CHRBOTH '.'
#define CHRONE '1'
#define CHRTWO '2'
#define MINSIZE 8
#define MAXSIZE 20
#define LINEWIDTH 80 /* screen line width in chars */
#define MAXLINES (MAXSIZE*(MAXSIZE-MINSIZE+1))
static char map[MAXLINES][LINEWIDTH+1];
static char mbase, mx, mend;
/* returns 0 if the same, -1 if different */
int
cmpglyphs(g1, g2)
GLYPH *g1, *g2;
{
int wd1, wd2;
int ht1, ht2;
int i, j;
char *p1, *p2;
wd1=g1->metrics.rightSideBearing - g1->metrics.leftSideBearing;
ht1=g1->metrics.ascent - g1->metrics.descent;
wd2=g2->metrics.rightSideBearing - g2->metrics.leftSideBearing;
ht2=g2->metrics.ascent - g2->metrics.descent;
if(g1->bits==NULL && g2->bits!=NULL
|| g1->bits!=NULL && g2->bits==NULL)
return -1;
if(g1->metrics.ascent != g2->metrics.ascent)
return -1;
if(g1->metrics.descent != g2->metrics.descent)
return -1;
if( wd1 != wd2 )
return -1;
if( (p1=g1->bits) !=NULL && (p2=g2->bits) !=NULL )
for(i=0; i<ht1; i++) {
for(j=0; j<wd1; j+=8) {
if( *p1++ != *p2++)
return -1;
}
}
return 0;
}
void
resetmap()
{
int i, j;
for(i=0; i<MAXLINES; i++)
for(j=0; j<LINEWIDTH; j++)
map[i][j]=' ';
mbase=mx=mend=0;
}
void
drawdot(row, col, val)
unsigned row, col, val;
{
if(row < MAXLINES && col < LINEWIDTH-1) {
map[row][col]=val;
if(row > mend)
mend=row;
}
}
void
drawdotg1(row, col, val)
unsigned row, col, val;
{
if(row < MAXLINES && col < LINEWIDTH-1) {
if(val)
map[row][col]=CHRONE;
else
map[row][col]=CHRNONE;
if(row > mend)
mend=row;
}
}
void
drawdotg2(row, col, val)
unsigned row, col, val;
{
if(row < MAXLINES && col < LINEWIDTH-1) {
if(val)
if(map[row][col]==CHRONE)
map[row][col]=CHRBOTH;
else
map[row][col]=CHRTWO;
else if(map[row][col]!=CHRONE)
map[row][col]=CHRNONE;
if(row > mend)
mend=row;
}
}
void
drawglyf(size, g1)
int size;
GLYPH *g1;
{
int wd1, wd2, wdm;
int ht1, ht2, ascm, desm;
int i, j, k, val;
char *p;
int off1, off2;
wd1=g1->metrics.rightSideBearing - g1->metrics.leftSideBearing;
ht1=g1->metrics.ascent - g1->metrics.descent;
wdm=wd1;
ascm=g1->metrics.ascent;
desm= -g1->metrics.descent;
if(mbase==0)
mbase=ascm+1;
else if(LINEWIDTH-mx <= wdm+1) {
mx=0; mbase=mend+ascm+2;
}
drawdot(mbase-ascm-1, mx, (size/10)%10+'0');
drawdot(mbase-ascm-1, mx+1, size%10+'0');
if( (p=g1->bits) !=NULL)
for(i=0; i<ht1; i++) {
for(j=0; j<wd1; j+=8) {
val = *p++;
for(k=0; k<8 && j+k<wd1; k++, val>>=1)
drawdot(i+mbase-g1->metrics.ascent, mx+j+k, (val&1)?CHRBOTH:CHRNONE);
}
}
wdm++;
if(wdm<3)
wdm=3;
mx+=wdm;
drawdot(mbase, mx-1, '-');
}
void
drawdiff(size, g1, g2)
int size;
GLYPH *g1, *g2;
{
int wd1, wd2, wdm;
int ht1, ht2, ascm, desm;
int i, j, k, val;
char *p;
int off1, off2;
wd1=g1->metrics.rightSideBearing - g1->metrics.leftSideBearing;
ht1=g1->metrics.ascent - g1->metrics.descent;
wd2=g2->metrics.rightSideBearing - g2->metrics.leftSideBearing;
ht2=g2->metrics.ascent - g2->metrics.descent;
if(wd1>wd2) {
wdm=wd1;
off1=0; off2=wd1-wd2;
} else {
wdm=wd2;
off2=0; off1=wd2-wd1;
}
if(g1->metrics.ascent > g2->metrics.ascent)
ascm=g1->metrics.ascent;
else
ascm=g2->metrics.ascent;
if(g1->metrics.descent < g2->metrics.descent)
desm= -g1->metrics.descent;
else
desm= -g2->metrics.descent;
if(mbase==0)
mbase=ascm+1;
else if(LINEWIDTH-mx <= wdm+1) {
mx=0; mbase=mend+ascm+2;
}
drawdot(mbase-ascm-1, mx, (size/10)%10+'0');
drawdot(mbase-ascm-1, mx+1, size%10+'0');
/* check which alignment is better */
if(off1!=0 || off2!=0) {
int cntl,cntr;
int a1, a2, d1, d2;
int val1, val2;
int rstep1, rstep2;
cntl=cntr=0;
rstep1=(wd1+7)/8;
rstep2=(wd2+7)/8;
a1=g1->metrics.ascent;
d1=g1->metrics.descent;
a2=g2->metrics.ascent;
d2=g2->metrics.descent;
#ifdef dbgoff
printf("size: %d\n", size);
#endif
for(i=ascm; i>= -desm; i--) {
for(j=0; j<wdm; j++) {
/* first the left alignment */
if(i>a1 || i<d1 || j>=wd1)
val1=0;
else
val1=( g1->bits[ (a1-i)*rstep1+j/8 ] >> (j%8) ) & 1;
if(i>a2 || i<d2 || j>=wd2)
val2=0;
else
val2=( g2->bits[ (a2-i)*rstep2+j/8 ] >> (j%8) ) & 1;
cntl += (val1 ^ val2);
#ifdef dbgoff
putchar(val1?'1':' ');
putchar(val2?'2':' ');
putchar('.');
#endif
/* now the right alignment */
if(i>a1 || i<d1 || j-off1>=wd1 || j<off1)
val1=0;
else
val1=( g1->bits[ (a1-i)*rstep1+(j-off1)/8 ] >> ((j-off1)%8) ) & 1;
if(i>a2 || i<d2 || j-off2>=wd2)
val2=0;
else
val2=( g2->bits[ (a2-i)*rstep2+(j-off2)/8 ] >> ((j-off2)%8) ) & 1;
cntr += (val1 ^ val2);
#ifdef dbgoff
putchar(val1?'1':' ');
putchar(val2?'2':' ');
putchar('|');
#endif
}
#ifdef dbgoff
putchar('\n');
#endif
}
#ifdef dbgoff
printf("size %d: left %d right %d\n",size, cntl, cntr);
#endif
if(cntl <= cntr) /* left is better or the same */
off1=off2=0;
}
if( (p=g1->bits) !=NULL)
for(i=0; i<ht1; i++) {
for(j=0; j<wd1; j+=8) {
val = *p++;
for(k=0; k<8 && j+k<wd1; k++, val>>=1)
drawdotg1(i+mbase-g1->metrics.ascent, mx+j+k+off1, val&1);
}
}
if( (p=g2->bits) !=NULL)
for(i=0; i<ht2; i++) {
for(j=0; j<wd2; j+=8) {
val = *p++;
for(k=0; k<8 && j+k<wd2; k++, val>>=1)
drawdotg2(i+mbase-g2->metrics.ascent, mx+j+k+off2, val&1);
}
}
wdm++;
if(wdm<3)
wdm=3;
mx+=wdm;
drawdot(mbase, mx-1, '-');
}
void
printmap(f)
FILE *f;
{
int i, j;
for(i=0; i<=mend; i++) {
for(j=LINEWIDTH-1; j>=0 && map[i][j]==' '; j--)
{}
map[i][j+1]='\n';
map[i][j+2]=0;
fputs(map[i], f);
}
}

78
pdf/lib/ttf2ufm/src/other/bz.c Executable file
View File

@@ -0,0 +1,78 @@
/*
* see COPYRIGHT
*/
#include <stdio.h>
#include <stdlib.h>
#include "bzscreen.h"
/* size of the screen in "physical pixels" */
#define PHYSX 980
#define PHYSY 310
/* the bounding box of the drawing in "logical pixels" */
/* the base point - set to 0, 0 for absolute coordinates */
#define BASEX 19
#define BASEY 122
/* the maximal point */
#define MAXX 450
#define MAXY 481
main(argc,argv)
int argc;
char **argv;
{
initscreen(PHYSX, PHYSY, PHYSX, PHYSY, 0, 0, BASEX, BASEY, MAXX, MAXY);
/*
drawcurve('#', 0,0, 51,0, 1,49, 45,98);
drawcurve('1', 5,28, 8,37, 16,65, 45,98);
drawcurve('3', 0,0, 0,24, 30,68, 80,72);
drawcurve('1', 0,0, 0,5, 1,10, 2,15);
drawcurve('2', 2,15, 8,42, 30,68, 80,72);
drawcurve('4', 0,0, 0,37, 22,67, 80,72);
*/
/* final */
/*
drawcurve('#', 324, 481, 390, 481, 448, 475, 448, 404 );
drawcurve('#', 448, 404, 448, 404, 448, 324, 448, 324 );
drawcurve('#', 448, 324, 402, 245, 19, 338, 19, 122 );
*/
/* 3 */
/*
*/
drawcurve('*', 450, 404, 450, 397, 450, 390, 448, 384 );
drawcurve('*', 448, 384, 446, 378, 444, 370, 443, 360 );
drawcurve('.', 443, 360, 309, 356, 206, 341, 132, 304 );
drawcurve('.', 132, 304, 57, 266, 19, 208, 19, 122 );
/* 4 */
drawcurve('#', 324, 481, 390, 481, 450, 475, 450, 404 );
drawcurve('#', 450, 404, 450, 397, 450, 390, 448, 384 );
drawcurve('#', 448, 384, 402, 245, 19, 338, 19, 122 );
/*
drawcurve('.', 324, 481, 361, 481, 391, 478, 414, 466 );
drawcurve('.', 414, 466, 436, 454, 450, 436, 450, 404 );
drawcurve('.', 450, 404, 450, 390, 447, 378, 443, 360 );
drawcurve('.', 443, 360, 309, 356, 206, 341, 132, 304 );
drawcurve('.', 132, 304, 57, 266, 19, 208, 19, 122 );
*/
printscreen(stdout);
}
sumcurves(dx11, dy11, dx12, dy12, dx13, dy13,
dx21, dy21, dx22, dy22, dx23, dy23)
{
}

View File

@@ -0,0 +1,220 @@
/*
* see COPYRIGHT
*/
#include <stdio.h>
#include <stdlib.h>
#include "bzscreen.h"
/*
* functions to draw the bezier curves in text mode
*/
double
fmin(a,b)
double a, b;
{
if(a<b)
return a;
else
return b;
}
int
abs(x)
int x;
{
if(x<0)
return -x;
else
return x;
}
void
initscreen(physx, physy, cols, rows, xoff, yoff, minx, miny, maxx, maxy)
unsigned physx, physy, cols, rows, xoff, yoff, minx, miny, maxx, maxy;
{
int i,j;
double yxscale;
if(screen.dots != NULL)
free(screen.dots);
if(physx==0 || physy==0 || rows==0 || cols==0) {
fprintf(stderr, "*** negative or zero screen size\n");
exit(1);
}
if(physx+xoff > cols || physy+yoff > rows) {
fprintf(stderr, "*** drawable area out of screen\n");
exit(1);
}
if(minx>maxx || miny>maxy) {
fprintf(stderr, "*** empty drawable area\n");
exit(1);
}
screen.physx = physx;
screen.physy = physy;
screen.rows = rows;
screen.cols = cols+2; /* for '\n\0' */
screen.xoff = xoff;
screen.yoff = yoff;
screen.minx = minx;
screen.miny = miny;
if(( screen.dots=malloc(screen.rows*screen.cols) )==NULL) {
perror("*** no memory for screen: ");
exit(1);
}
j=screen.rows*screen.cols;
for(i=0; i<j; i++)
screen.dots[i]=' ';
/* scale of Y to X on the screen, i.e. x=YXSCALE*y */
/* 3/4 is the approx. ratio of Y/X sizes of the physical screen */
yxscale = ((double)physx/(double)physy*3.0/4.0);
/* scale of "logical" to "physical", i.e. physical=PHYSSCALE*logical */
screen.yscale = fmin( ((double)physy-0.51)/(maxy+1-miny),
((double)physx-0.51)/yxscale/(maxx+1-minx) );
screen.xscale = yxscale * screen.yscale;
}
void
drawcurve(mark, ax,ay, bx,by, cx,cy, dx,dy)
int mark, ax,ay, bx,by, cx,cy, dx,dy;
{
int i,j,n,c;
int maxn=(screen.physx + screen.physy)*2;
ax-=screen.minx; bx-=screen.minx; cx-=screen.minx; dx-=screen.minx;
ay-=screen.miny; by-=screen.miny; cy-=screen.miny; dy-=screen.miny;
for(i=0; i<=maxn; i++) {
double t, t2, t3, nt, nt2, nt3;
t=(double)i/(double)maxn; t2=t*t; t3=t2*t;
nt=1-t; nt2=nt*nt; nt3=nt2*nt;
setfdot(
mark,
( ax*t3 + bx*3*t2*nt + cx*3*t*nt2 + dx*nt3 ),
( ay*t3 + by*3*t2*nt + cy*3*t*nt2 + dy*nt3 )
);
}
}
/* draw curve and mark direction at the ends */
void
drawcurvedir(mark, ax,ay, bx,by, cx,cy, dx,dy)
int mark, ax,ay, bx,by, cx,cy, dx,dy;
{
int i,j,n,c;
int maxn=(screen.physx + screen.physy)*2;
double t, t2, t3, nt, nt2, nt3;
int markb, marke;
ax-=screen.minx; bx-=screen.minx; cx-=screen.minx; dx-=screen.minx;
ay-=screen.miny; by-=screen.miny; cy-=screen.miny; dy-=screen.miny;
if(bx==ax && by==ay) {
markb=mark;
} else if( abs(by-ay) > abs(bx-ax) ) {
if(by>ay)
markb='^';
else
markb='v';
} else {
if(bx>ax)
markb='>';
else
markb='<';
}
if(dx==cx && dy==cy) {
marke=mark;
} else if( abs(dy-cy) > abs(dx-cx) ) {
if(dy>cy)
marke='^';
else
marke='v';
} else {
if(dx>cx)
marke='>';
else
marke='<';
}
for(i=1; i<maxn; i++) {
t=(double)i/(double)maxn; t2=t*t; t3=t2*t;
nt=1-t; nt2=nt*nt; nt3=nt2*nt;
setfdot(
mark,
( ax*t3 + bx*3*t2*nt + cx*3*t*nt2 + dx*nt3 ),
( ay*t3 + by*3*t2*nt + cy*3*t*nt2 + dy*nt3 )
);
}
/* mark the ends */
setfdot( markb, (double)ax, (double)ay );
setfdot( marke, (double)dx, (double)dy );
}
void
drawdot(mark, x, y)
int mark;
int x, y;
{
x=(int)((x-screen.minx)*screen.xscale+0.5);
y=(int)((y-screen.miny)*screen.yscale+0.5);
if(y<0 || y>=screen.physy || x<0 || x>=screen.physx)
return;
screendot(x,y)=mark;
}
void
setabsdot(mark, x, y)
int x, y, mark;
{
if(y<0 || y>=screen.rows || x<0 || x>=screen.cols-2)
return;
screenabsdot(x,y)=mark;
}
void
setfdot(mark, fx, fy)
int mark;
double fx, fy;
{
int x, y;
x=(int)(fx*screen.xscale+0.5);
y=(int)(fy*screen.yscale+0.5);
if(y<0 || y>=screen.physy || x<0 || x>=screen.physx)
return;
screendot(x,y)=mark;
}
/* destructive */
void
printscreen(f)
FILE *f;
{
int r;
char *pi, *pc;
for(r=screen.rows-1; r>=0; r--) {
pc=&screenabsdot(0,r);
for(pi=&screenabsdot(-2,r+1); pi>=pc && *pi == ' '; pi--)
{}
pi[1]='\n';
pi[2]=0;
fputs(pc, f);
}
}

View File

@@ -0,0 +1,40 @@
/*
* see COPYRIGHT
*/
/*
* Screen for drawing the Bezier curves in text mode
*/
struct screen {
unsigned physx;
unsigned physy;
unsigned cols;
unsigned rows;
unsigned xoff;
unsigned yoff;
unsigned minx;
unsigned miny;
char *dots;
double xscale;
double yscale;
} screen;
#define screenabsdot(x,y) (screen.dots[(y)*screen.cols+(x)])
#define screendot(x,y) screenabsdot((x)+screen.xoff, (y)+screen.yoff)
/* prototypes */
double fmin(double a, double b);
int abs(int x);
void initscreen(unsigned physx, unsigned physy,
unsigned cols, unsigned rows, unsigned xoff, unsigned yoff,
unsigned minx, unsigned miny, unsigned maxx, unsigned maxy);
void drawcurve(int mark, int ax,int ay,
int bx,int by, int cx,int cy, int dx,int dy);
void drawcurvedir(int mark, int ax,int ay,
int bx,int by, int cx,int cy, int dx,int dy);
void drawdot(int mark, int x, int y);
void setabsdot(int mark, int x, int y);
void setfdot(int mark, double x, double y);
void printscreen(FILE *f);

View File

@@ -0,0 +1,67 @@
/*
* see COPYRIGHT
*/
#include <stdio.h>
#include <ctype.h>
#include "t1lib.h"
/*
* compare two [ almost the same ] fonts
*/
#define PROGNAME "cmpf"
#include "bmpfont.h"
main(ac, av)
int ac;
char **av;
{
int fontid1, fontid2;
GLYPH *g1, *g2;
int chr, size, diff, offset;
if(ac!=3) {
fprintf(stderr,"Use: %s font1 font2\n", PROGNAME);
exit(1);
}
chkneg(T1_SetBitmapPad(MYPAD));
chkneg(T1_InitLib(NO_LOGFILE|IGNORE_CONFIGFILE|IGNORE_FONTDATABASE));
chkneg(fontid1=T1_AddFont(av[1]));
chkneg(fontid2=T1_AddFont(av[2]));
resetmap();
for(chr=0; chr<256; chr++) {
diff=0;
for(size=MAXSIZE; size>=MINSIZE; size--) {
chknull( g1=T1_CopyGlyph(T1_SetChar( fontid1, chr, (float)size, NULL)) );
chknull( g2=T1_CopyGlyph(T1_SetChar( fontid2, chr, (float)size, NULL)) );
if( cmpglyphs(g1, g2) ) {
/* printf("%d %d - diff\n", chr, size); */
diff=1;
drawdiff(size, g1, g2);
}
/*
else
fprintf(stderr, "%d %d - same\n", chr, size);
*/
chkneg(T1_FreeGlyph(g1));
chkneg(T1_FreeGlyph(g2));
}
if(diff) {
printf("*** Difference for %d==0x%x %c\n", chr, chr,
isprint(chr) ? chr : ' ');
printmap(stdout);
diff=0;
resetmap();
}
}
printf("All done!\n");
}

View File

@@ -0,0 +1,50 @@
#!/usr/bin/perl
#
# Copyright (c) 2000 by Sergey Babkin
# (see COPYRIGHT for full copyright notice)
#
# script to calculate the total number of stems used by the
# glyphs in case if stems are always pushed to the stack and
# never popped (as X11 does)
$insubrs = 0;
$inchars = 0;
while(<>)
{
if(/\/Subrs/) {
$insubrs = 1;
} elsif(/\/CharStrings/) {
$insubrs = 0;
$inchars = 1;
}
if($insubrs && /^dup (\d+)/) {
$cursubr = $1;
$substems[$cursubr] = 0;
} elsif (/^dup (\d+) \/(\S+) put/) {
$codeof{$2} = $1;
}
if($inchars) {
if(/^\/(\S+)\s+\{/) {
$curchar = $1;
$charstems = 0;
} elsif( /endchar/ ) {
printf("%d:%s\t%d\n", $codeof{$curchar}, $curchar, $charstems);
} elsif( /(\d+)\s+4\s+callsubr/) {
$charstems += $substems[$1+0];
}
}
if(/[hv]stem3/) {
if($insubrs) {
$substems[$cursubr] += 3;
} elsif($inchars) {
$charstems += 3;
}
} elsif( /[hv]stem/ ) {
if($insubrs) {
$substems[$cursubr]++;
} elsif($inchars) {
$charstems++;
}
}
}

View File

@@ -0,0 +1,53 @@
/*
* see COPYRIGHT
*/
#include <stdio.h>
#include <ctype.h>
#include "t1lib.h"
/*
* Dump a rasterizarion of the font at small size
*/
#define PROGNAME "dmpf"
#include "bmpfont.h"
main(ac, av)
int ac;
char **av;
{
int fontid1, fontid2;
GLYPH *g1, *g2;
int chr, size, diff, offset;
if(ac!=2) {
fprintf(stderr,"Use: %s font\n", PROGNAME);
exit(1);
}
chkneg(T1_SetBitmapPad(MYPAD));
chkneg(T1_InitLib(NO_LOGFILE|IGNORE_CONFIGFILE|IGNORE_FONTDATABASE));
chkneg(fontid1=T1_AddFont(av[1]));
resetmap();
for(chr=0; chr<256; chr++) {
for(size=MAXSIZE; size>=MINSIZE; size--) {
chknull( g1=T1_CopyGlyph(T1_SetChar( fontid1, chr, (float)size, NULL)) );
drawglyf(size, g1);
chkneg(T1_FreeGlyph(g1));
}
printf("*** Glyph %d==0x%x %c\n", chr, chr,
isprint(chr) ? chr : ' ');
printmap(stdout);
resetmap();
}
printf("All done!\n");
}

View File

@@ -0,0 +1,65 @@
#!/usr/bin/perl
#
# script to create HTML file with character table
# in plain, italic, bold, bold-italic
#
# see COPYRIGHT
#
# width of tables
$step=16;
# commands to enable and disable the font modes
# (the fastest changing is first)
@matrix = (
[ "Roman", "Italic", "</i>", "<i>" ],
[ "Medium", "Bold", "</b>", "<b>" ],
[ "Variable", "Fixed", "</tt>", "<tt>" ],
);
sub printall
{
local $i, $j;
printf("<table border=\"0\" >\n");
for($j=32; $j<256; $j+=$step) {
printf("<tr>\n");
for $i ($j..$j+$step-1) {
$c=chr($i);
if($c eq "<") {
$c="&lt;";
} elsif($c eq ">") {
$c="&gt;";
}
printf("<td><font color=\"gray\">%03d</font></td><td>\n", $i);
printf("<font color=\"white\">%s%s%s</font>\n", $enmode, $c, $dismode);
printf("</td>\n");
}
printf("</tr>\n");
}
printf("</table><p>\n");
}
printf("<HTML><HEAD></HEAD><BODY bgcolor=\"black\">\n<font color=\"white\"><p>\n");
for $mask (0.. (1<<@matrix)-1) {
#printf("<table><tr>");
$mode = $enmode = $dismode = "";
for $bit (0.. $#matrix) {
$val = ($mask >> $bit) & 1;
$mode = $matrix[$bit]->[$val] . "<br>" . $mode;
if( $val ) {
$enmode = $matrix[$bit]->[3] . $enmode;
$dismode = $dismode . $matrix[$bit]->[2];
}
#printf("=== %d %s %s %s\n", $val, $mode, $enmode, $dismode);
}
#printf("%x %s %s %s\n", $mask, $mode, $enmode, $dismode);
printf("<table border=\"0\"><tr><td>\n");
&printall();
printf("</td><td valign=top><font size=\"+1\" color=\"yellow\"><b>\n");
printf("%s\n", $mode);
printf("</b></font></td></tr></table>\n");
}
printf("</font></BODY></HTML>\n");

View File

@@ -0,0 +1,58 @@
#!/usr/bin/perl
if (@ARGV != 3) {
print STDERR "Use:\n";
print STDERR " showdf <showg-script> <old-file> <new-file>\n";
print STDERR "to create a showg diagram of glyphs differing in two files\n";
exit 1;
}
$cmd = shift @ARGV;
$oldf = shift @ARGV;
$newf = shift @ARGV;
open(O, "<$oldf") or die "Unable to open '$oldf'\n";
open(N, "<$newf") or die "Unable to open '$newf'\n";
while(<O>) {
last if(/CharStrings/);
}
while(<N>) {
last if(/CharStrings/);
}
undef @symlist;
$sym = '';
$inlist = 0;
$nstop = 0;
while($so = <O>) {
if($so =~ m|^(/\S+)\s+\{|) {
$sym = $1;
$inlist = 0;
#printf STDERR "found sym $sym\n";
if (!$nstop || $sn !~ m|^$sym\s+\{|) {
while($sn = <N>) {
#print STDERR "+$sn";
last if($sn =~ m|^${sym}\s+\{|);
}
}
$nstop = 0;
} elsif(!$nstop) {
$sn = <N>;
#print STDERR "<$so>$sn\n";
if($so ne $sn) {
if(!$inlist) {
$inlist = 1;
push(@symlist, $sym);
}
if($sn =~ m|^(/\S+)\s+\{|) {
$nstop = 1;
#printf STDERR "stop at $1\n";
}
}
}
}
unshift(@symlist, $cmd, '-c', $oldf, $newf);
#printf("%s\n", join(' ', @symlist));
exec @symlist;

633
pdf/lib/ttf2ufm/src/other/showg Executable file
View File

@@ -0,0 +1,633 @@
#!/usr/bin/perl
my @cmpfiles;
while($ARGV[0] eq "-c") {
shift(@ARGV);
push(@cmpfiles, shift(@ARGV));
}
if( $#ARGV < 1) {
die("Usage: $0 [-c file]... file glyph-code...\n");
}
$fname=shift @ARGV;
# storage for files
my %fontname;
my %fbbox;
my %fblues;
my %fenc;
my %frevenc;
my %fsubrs;
my %fchars;
my @cmnbbox; # common bounding box covering all files
@cmnbbox = (100, 100, 100, 100);
# read all files into memory
for $f (@cmpfiles, $fname) {
open(FILE, "<$f") or die("no such file $f");
while(<FILE>) {
if(/FontBBox\s+\{\s*(.*)\s*}/) {
@bbox=split(/\s+/, $1);
push(@{$fbbox{$f}}, @bbox);
if($bbox[0] < $cmnbbox[0]) {
$cmnbbox[0] = $bbox[0];
}
if($bbox[1] < $cmnbbox[1]) {
$cmnbbox[1] = $bbox[1];
}
if($bbox[2] > $cmnbbox[2]) {
$cmnbbox[2] = $bbox[2];
}
if($bbox[3] > $cmnbbox[3]) {
$cmnbbox[3] = $bbox[3];
}
} elsif( /BlueValues\s+\[\s*(.*)\s*\]/ || /OtherBlues\s+\[\s*(.*)\s*\]/ ) {
@blues=split(/\s+/, $1);
push(@{$fblues{$f}}, @blues);
} elsif( /^dup\s+(\d+)\s+\/(\S+)\s+put/ ) {
$fenc{$f}{$1} = $2;
if( ! defined $frevenc{$f}{$2} ) {
$frevenc{$f}{$2} = $1;
}
} elsif( /^dup\s+(\d+)\s+\{\s*$/ ) {
$key = $1;
$bf = $_;
while(<FILE>) {
$bf .= $_;
if( /\}\s+NP/ ) {
last;
}
}
$fsubrs{$f}{$key} = $bf;
} elsif( /^\/(\S+)\s+\{\s*$/ ) {
$key = $1;
$bf = $_;
while(<FILE>) {
$bf .= $_;
if( /endchar/ ) {
last;
}
}
$fchars{$f}{$key} = $bf;
} elsif( /^\/FontName\s+(\S+)/ ) {
$fontname{$f} = $1;
}
}
close(FILE);
}
######################## Prolog ###################################
print("%%!PS-Adobe-1.0
%%DocumentNeededResources: font Courier
%%Pages: (atend)
%%EndComments
%%BeginProlog
/cmpfcolorarray [
[ 1 0.2 0.2 ] % slightly lighter red
[ 0 0.7 0.7 ] % cyan
[ 0.7 0.7 0 ] % brown-yellow
] def
/cmpfcolor { % number -> .
cmpfcolorarray length mod % get the subarray number
cmpfcolorarray exch get aload pop setrgbcolor
} bind def
/contourcolor { 0 0 0 setrgbcolor } bind def % black
/bluezonecolor { 0.95 0.95 1 setrgbcolor } bind def % very light blue
/coordcolor { 0 1 0 setrgbcolor } bind def % green
/textcolor { 0 0 0 setrgbcolor } bind def % black
/stemcolor { 1 0 0 setrgbcolor } bind def % red
/mainstemcolor { 0 0 1 setrgbcolor } bind def % blue
% /fnt2pt { 72 5 mul 1000 div } bind def
/linehor { % . font_y -> .
gsave
0 72 translate
72 fnt2pt scale
newpath
0 exch moveto
7 0 rlineto
stroke
grestore
} bind def
/linevert { % . font_x -> .
gsave
72 0 translate
fnt2pt 72 scale
newpath
0 moveto
0 7 rlineto
stroke
grestore
} bind def
/bluezone { % . font_y_1 font_y_2 -> .
gsave
bluezonecolor
0 72 translate
72 fnt2pt scale
newpath
0 exch moveto
7 0 rlineto
7 exch lineto
-7 0 rlineto
closepath
fill
grestore
} bind def
/drawstem { % . xwidth ywidth x0 y0 -> .
gsave
72 72 translate fnt2pt fnt2pt scale xorg yorg translate
newpath
moveto
dup 0 exch rlineto
exch 0 rlineto
neg 0 exch rlineto
closepath fill
grestore
} bind def
/getlen {
dup stringwidth pop
} bind def
/compressfont 0.8 def
/label { % . string stringwd y -> .
dup lasty lt {
dup lasty fontsz sub le
} {
dup lasty fontsz add ge
} ifelse {
/curx 0 store
} if
dup /lasty exch store
0 exch moveto
compressfont mul dup curx add maxx gt {
/curx 0 store
} if
curx 0 rmoveto
dup 0 rlineto
stroke
gsave
curx lasty moveto
curx add /curx exch store
compressfont 1 scale
show
grestore
} bind def
");
@bbox=@cmnbbox;
$nx=$bbox[2]-$bbox[0];
$ny=$bbox[3]-$bbox[1];
$maxsz= ($nx>$ny) ? $nx : $ny;
$fnt2pt= 72*5/$maxsz;
printf("/fnt2pt 72 5 mul %d div def\n", $maxsz);
$xorg= -($bbox[0]-($maxsz-$nx)/2);
$yorg= -($bbox[1]-($maxsz-$ny)/2);
printf("/xorg %d def /yorg %d def\n", $xorg, $yorg);
print("
%%EndProlog
");
######################## Subroutines ##############################
sub bluezone # from to
{
my ($a, $b)=@_;
printf("%d %d bluezone\n",$a+$yorg, $b+$yorg);
$ycoord{$a+0}=1;
$ycoord{$b+0}=1;
}
sub linehor # x
{
my $a=$_[0];
printf("%d linehor\n",$a+$yorg);
$ycoord{$a+0}=1;
}
sub linevert # x
{
my $a=$_[0];
printf("%d linevert\n",$a+$xorg);
$xcoord{$a+0}=1;
}
sub hstem # from width
{
my ($from, $width)=@_;
$stemhused=1;
printf("%d %d %d %d drawstem %% %d %d h \n", -$stemwd, $width,
$bbox[0]-2-$stemhgrp*$stemwd, $from,
$from, $width);
printf("%d %d %d %d drawstem %% %d %d h \n", $stemwd, $width,
$bbox[2]+2+$stemhgrp*$stemwd, $from,
$from, $width);
}
sub vstem # from width
{
my ($from, $width)=@_;
$stemvused=1;
printf("%d %d %d %d drawstem %% %d %d v \n", $width, -$stemwd,
$from, $bbox[1]-2-$stemhgrp*$stemwd,
$from, $width);
printf("%d %d %d %d drawstem %% %d %d v \n", $width, $stemwd,
$from, $bbox[3]+2+$stemhgrp*$stemwd,
$from, $width);
}
sub nextstemgrp
{
if($stemhused || $stemvused) {
$stemhgrp++;
$stemhused=0;
$stemvgrp++;
$stemvused=0;
}
}
sub substems # fname subrlist
{
my $fname = shift;
my $i, $cmd, @vals;
print("\nstemcolor\n");
for $i (@_) {
&nextstemgrp();
for $_ (split(/\n/, $fsubrs{$fname}{$i})) {
s/^\s+//;
@vals=split(/\s+/, $_);
$cmd=$vals[$#vals];
if($cmd eq "hstem") {
&hstem($vals[0], $vals[1]);
} elsif($cmd eq "vstem") {
&vstem($vals[0], $vals[1]);
}
}
}
print("\n");
}
sub drawcharwstems # charstring
{
my($x,$y)=(0,0);
my @vals, $cmd, $i;
print("\nmainstemcolor\n");
&nextstemgrp();
for $_ (split(/\n/, $_[0])) {
s/^\s+//;
@vals=split(/\s+/, $_);
$cmd=$vals[$#vals];
if($cmd eq "hsbw") {
$x=$vals[0]+0;
} elsif($cmd eq "hstem") {
&hstem($vals[0], $vals[1]);
} elsif($cmd eq "hstem3") {
&hstem($vals[0], $vals[1]);
&hstem($vals[2], $vals[3]);
&hstem($vals[4], $vals[5]);
} elsif($cmd eq "vstem") {
&vstem($vals[0], $vals[1]);
} elsif($cmd eq "vstem3") {
&vstem($vals[0], $vals[1]);
&vstem($vals[2], $vals[3]);
&vstem($vals[4], $vals[5]);
} elsif($cmd eq "rmoveto") {
# a shortcut
last;
}
}
&drawchar("drawchar", 1, "contourcolor", $_[0]);
}
sub drawchar #procname wantgrid color charstring
{
my($procname, $wantgrid, $color, $charstring) = @_;
my($x,$y)=(0,0);
my @vals, $cmd, $i;
my %xv=();
my %yv=();
printf("\n/%s {\n",$procname);
printf("\ngsave 72 72 translate fnt2pt fnt2pt scale %d %d translate\n", $xorg, $yorg);
printf("%s 1 setlinewidth newpath\n", $color);
for $_ (split(/\n/, $charstring)) {
s/^\s+//;
@vals=split(/\s+/, $_);
$cmd=$vals[$#vals];
if($cmd eq "callsubr" && $vals[1] == 4) {
push(@subrlist, $vals[0]);
} elsif($cmd eq "amoveto") {
$x=$vals[0]+0;
$y=$vals[1]+0;
$xv{$x+0}=1; $yv{$y+0}=1;
printf("%d %d moveto\n", $x, $y);
printf("%d %d 5 0 360 arc %d %d moveto\n", $x, $y, $x, $y);
} elsif($cmd eq "rmoveto") {
$x+=$vals[0];
$y+=$vals[1];
$xv{$x+0}=1; $yv{$y+0}=1;
printf("%d %d moveto\n", $x, $y);
printf("%d %d 5 0 360 arc %d %d moveto\n", $x, $y, $x, $y);
} elsif($cmd eq "hmoveto") {
$x+=$vals[0];
$xv{$x+0}=1; $yv{$y+0}=1;
printf("%d %d moveto\n", $x, $y);
printf("%d %d 5 0 360 arc %d %d moveto\n", $x, $y, $x, $y);
} elsif($cmd eq "vmoveto") {
$y+=$vals[0];
$xv{$x+0}=1; $yv{$y+0}=1;
printf("%d %d moveto\n", $x, $y);
printf("%d %d 5 0 360 arc %d %d moveto\n", $x, $y, $x, $y);
} elsif($cmd eq "alineto") {
$x=$vals[0]+0;
$y=$vals[1]+0;
$xv{$x+0}=1; $yv{$y+0}=1;
printf("%d %d lineto\n", $x, $y);
printf("%d %d 3 0 360 arc %d %d moveto\n", $x, $y, $x, $y);
} elsif($cmd eq "rlineto") {
$x+=$vals[0];
$y+=$vals[1];
$xv{$x+0}=1; $yv{$y+0}=1;
printf("%d %d lineto\n", $x, $y);
printf("%d %d 3 0 360 arc %d %d moveto\n", $x, $y, $x, $y);
} elsif($cmd eq "hlineto") {
$x+=$vals[0];
$xv{$x+0}=1; $yv{$y+0}=1;
printf("%d %d lineto\n", $x, $y);
printf("%d %d 3 0 360 arc %d %d moveto\n", $x, $y, $x, $y);
} elsif($cmd eq "vlineto") {
$y+=$vals[0];
$xv{$x+0}=1; $yv{$y+0}=1;
printf("%d %d lineto\n", $x, $y);
printf("%d %d 3 0 360 arc %d %d moveto\n", $x, $y, $x, $y);
} elsif($cmd eq "arcurveto") {
for $i (0,2,4) {
$x=$vals[$i]+0;
$y=$vals[$i+1]+0;
printf("%d %d ", $x, $y);
}
$xv{$x+0}=1; $yv{$y+0}=1;
printf("curveto\n");
printf("%d %d 3 0 360 arc %d %d moveto\n", $x, $y, $x, $y);
} elsif($cmd eq "rrcurveto") {
for $i (0,2,4) {
$x+=$vals[$i];
$y+=$vals[$i+1];
printf("%d %d \n", $x, $y);
}
$xv{$x+0}=1; $yv{$y+0}=1;
printf("curveto\n");
printf("%d %d 3 0 360 arc %d %d moveto\n", $x, $y, $x, $y);
} elsif($cmd eq "hvcurveto") {
$x+=$vals[0];
printf("%d %d \n", $x, $y);
$x+=$vals[1];
$y+=$vals[2];
printf("%d %d \n", $x, $y);
$y+=$vals[3];
printf("%d %d \n", $x, $y);
$xv{$x+0}=1; $yv{$y+0}=1;
printf("curveto\n");
printf("%d %d 3 0 360 arc %d %d moveto\n", $x, $y, $x, $y);
} elsif($cmd eq "vhcurveto") {
$y+=$vals[0];
printf("%d %d \n", $x, $y);
$x+=$vals[1];
$y+=$vals[2];
printf("%d %d \n", $x, $y);
$x+=$vals[3];
printf("%d %d \n", $x, $y);
$xv{$x+0}=1; $yv{$y+0}=1;
printf("curveto\n");
printf("%d %d 3 0 360 arc %d %d moveto\n", $x, $y, $x, $y);
} elsif($cmd eq "closepath") {
printf("closepath stroke newpath\n");
}
}
printf("grestore } bind def\n");
if($wantgrid) {
printf("coordcolor\n");
for $x (keys %xv) {
&linevert($x);
}
for $y (keys %yv) {
&linehor($y);
}
}
}
$pages=0;
for $arg (@ARGV) {
undef $name, $code;
if( $arg =~ /^\/(.*)/ ) {
$name=$1;
} elsif( $arg =~ /^\.(.)/ ) {
$code=ord($1);
} else {
$code=$arg;
}
$pages++;
$stemhgrp=0;
$stemhused=0;
$stemvgrp=0;
$stemvused=0;
$stemwd=10;
undef %xcoord;
undef %ycoord;
if( defined $name ) {
$xname = $name;
$xcode = $frevenc{$fname}{$name};
if( $xcode eq "" ) {
$xcode = "**UNKNOWN**";
}
} else {
$xname = $fenc{$fname}{$code};
if( $xname eq "" ) {
$xname = "**UNKNOWN**";
}
$xcode = $code;
}
printf("%%%%Page: %d %d\n", $pages, $pages);
printf("gsave
0 setlinewidth
36 72 translate
gsave
contourcolor
72 72 scale
newpath
0 0 moveto
7 0 rlineto
0 7 rlineto
-7 0 rlineto
closepath
stroke
1 1 translate
newpath
0 0 moveto
5 0 rlineto
0 5 rlineto
-5 0 rlineto
closepath
stroke
grestore
");
undef @subrlist;
@bbox=@{$fbbox{$fname}};
print("coordcolor\n");
printf("0 linehor %d linehor %d linehor\n", $bbox[1]+$yorg, $bbox[3]+$yorg);
printf("%d linevert %d linevert\n", $bbox[0]+$xorg, $bbox[2]+$xorg);
%vals=@{$fblues{$fname}};
for $i (keys %vals) {
&bluezone($i, $vals{$i});
}
$havechar = 1;
if( defined $fchars{$fname}{$xname} ) {
&drawcharwstems($fchars{$fname}{$xname});
} else {
$havechar = 0;
if(defined $name) {
printf(STDERR "WARNING: %s nas no character with name \"%s\"\n", $fname, $name);
} else {
printf(STDERR "WARNING: %s nas no character with code \"%s\"\n", $fname, $code);
}
}
&substems($fname, @subrlist);
printf(STDERR "glyph name:%s code:%s (%d substituted stem groups)\n", $xname, $xcode, scalar @subrlist);
$cmpfidx = 0;
for $cmpf(@cmpfiles) {
undef $cname, $ccode;
if( defined $name ) {
if ( ! defined $fchars{$cmpf}{$name} && defined $fenc{$cmpf}{$xcode}) {
printf(STDERR " NOTE: %s nas no glyph with name \"%s\", guessed by code\n", $cmpf, $name);
$cname = $fenc{$cmpf}{$xcode};
if( $cname eq "" ) {
$cname = "**UNKNOWN**";
}
$ccode = $xcode;
} else {
$cname = $name;
$ccode = $frevenc{$cmpf}{$name};
if( $ccode eq "" ) {
$ccode = "**UNKNOWN**";
}
}
} else {
$cname = $fenc{$cmpf}{$code};
if( $cname eq "" ) {
$cname = "**UNKNOWN**";
}
$ccode = $code;
}
if( defined $fchars{$cmpf}{$cname} ) {
&drawchar("drawcmpchar", 0, sprintf("%d cmpfcolor", $cmpfidx),
$fchars{$cmpf}{$cname});
printf("drawcmpchar\n\n");
printf(STDERR " in %s glyph name:%s code:%s\n", $cmpf, $cname, $ccode);
} else {
if(defined $name) {
printf(STDERR " WARNING: %s nas no character with name \"%s\"\n", $cmpf, $name);
} else {
printf(STDERR " WARNING: %s nas no character with code \"%s\"\n", $cmpf, $code);
}
}
$cmpfidx++;
}
if($havechar) {
printf("drawchar\n\n");
}
# flush the last group
&nextstemgrp();
# the values of coordinates
printf("/fontsz 8 fnt2pt div def\n");
printf("/Myfont /Courier findfont fontsz scalefont def\n\n");
printf("contourcolor Myfont setfont\n");
for $org (0, $xorg+$bbox[2]+$stemwd*$stemhgrp+72/$fnt2pt) {
printf("gsave\n");
printf("/maxx 72 fnt2pt div %d sub def /curx 0 def /lasty -10000 def\n",
2+$stemhgrp*$stemwd-$xorg-$bbox[0]);
printf("0 72 translate fnt2pt fnt2pt scale %f yorg translate 1 setlinewidth\n", $org);
for $y (sort {$a <=> $b} keys %ycoord) {
printf("(%d) getlen %d label\n", $y, $y);
}
printf("grestore\n");
}
for $org (0, $yorg+$bbox[3]+$stemwd*$stemvgrp+72/$fnt2pt) {
printf("gsave\n");
printf("/maxx 72 fnt2pt div %d sub def /curx 0 def /lasty -10000 def\n",
2+$stemvgrp*$stemwd-$yorg-$bbox[1]);
printf("72 0 translate fnt2pt fnt2pt scale xorg %f translate 90 rotate 1 setlinewidth\n", $org);
for $x (sort {$a <=> $b} keys %xcoord) {
printf("(%d) getlen %d label\n", $x, -$x);
}
printf("grestore\n");
}
printf("gsave 0 %d translate\n", 7.5*72 );
printf("contourcolor /Courier findfont 12 scalefont setfont\n");
$line = 0;
$cmpfidx = $#cmpfiles;
if( $cmpfidx > (2.5*72/15)-4 ) {
$cmpfidx = (2.5*72/15)-4;
}
for(; $cmpfidx>=0; $cmpfidx--) {
$cmpf = $cmpfiles[$cmpfidx];
printf("%d cmpfcolor\n", $cmpfidx);
printf("newpath 20 %d moveto 0 10 rlineto 10 0 rlineto 0 -10 rlineto closepath fill\n",
15*$line, $cmpf);
printf("contourcolor 40 %d moveto (%s %s) show\n", 15*$line, $cmpf, $fontname{$cmpf});
$line++;
}
if( $#cmpfiles >=0 ) {
printf("0 %d moveto (Comparison files:) show\n", 15*$line++);
}
printf("0 %d moveto (code: %d name: %s) show\n", 15*$line++, $xcode, $xname);
printf("0 %d moveto (%s) show\n", 15*$line++, $fname);
printf("0 %d moveto (%s) show\n", 15*$line++, $fontname{$fname});
printf("grestore\n\n");
printf("showpage grestore\n\n");
}
printf("%%%%Pages: %d\n", $pages);

7390
pdf/lib/ttf2ufm/src/pt1.c Executable file

File diff suppressed because it is too large Load Diff

262
pdf/lib/ttf2ufm/src/pt1.h Executable file
View File

@@ -0,0 +1,262 @@
/*
* 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;
/* becnjcarson: allow glyphs to have multiple character codes. This isn't 100%
perfect, but should be enough for most normal fonts. */
#define GLYPH_MAX_ENCODINGS (4)
typedef struct glyph {
int char_no;/* Encoding of glyph */
int orig_code[GLYPH_MAX_ENCODINGS]; /* code(s) 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( FILE *afm_file, int code, int glyphno);
void print_glyph_metrics_ufm( FILE *ufm_file, 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);

61
pdf/lib/ttf2ufm/src/runt1asm.c Executable file
View File

@@ -0,0 +1,61 @@
/*
* 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

View File

@@ -0,0 +1,367 @@
#!/bin/sh
#
# Copyright (c) 1998-2000
# Sergey A. Babkin. 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.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# Sergey A. Babkin (sab123@hotmail.com, babkin@bellatlantic.net)
#
# Use : convert [cfgfile]
# Convert TTF fonts from source directory to Type1 fonts in the destination
# directory, converted to the specified encodings. Also generate the
# fonts.scale, fonts.dir and fonts.alias files in the destination directory.
# clean some variables so that they won't be inherited from environment
ENCDIR=
MAPDIR=
# path to the configuration file
if [ $# -eq 1 ]
then
CFGFILE=$1
else
CFGFILE=`pwd`/convert.cfg
fi
# these setting would be edited during installation
TTF2PT1_BINDIR=
TTF2PT1_LIBXDIR=
TTF2PT1_SHAREDIR=
[ -z "$TTF2PT1_BINDIR" ] && {
TTF2PT1_BINDIR=`pwd`/..
}
[ -z "$TTF2PT1_LIBXDIR" ] && {
TTF2PT1_LIBXDIR=`pwd`/..
}
[ -z "$TTF2PT1_SHAREDIR" ] && {
TTF2PT1_SHAREDIR=`pwd`/..
}
# directory from where we are started
RUNDIR=`pwd`
# paths to various utilities
T1ASM=$TTF2PT1_LIBXDIR/t1asm
[ -f $T1ASM -a -x $T1ASM ] || {
# if it's not in libxdir, use whatever t1asm the system provides
T1ASM=t1asm
}
TTF2PT1=$TTF2PT1_BINDIR/ttf2pt1
TRANS=$TTF2PT1_SHAREDIR/scripts/trans
T1FDIR=$TTF2PT1_SHAREDIR/scripts/t1fdir
FORCEISO=$TTF2PT1_SHAREDIR/scripts/forceiso
X2GS=$TTF2PT1_SHAREDIR/scripts/x2gs
SUFFIX="pfa"
MYSELF=convert
# include the configuration
if [ -r $CFGFILE ]
then {
. $CFGFILE
} else {
echo "
Can't find the configuration file
$CFGFILE
Please look at the sample file convert.cfg.sample,
copy it to convert.cfg and modify for
you actual configuration." >&2
exit 1
} fi
# path to the directory with descriptions of encodings
[ -z "$ENCDIR" ] && {
ENCDIR=$TTF2PT1_SHAREDIR/encodings
}
# directory with the external Unicode maps
[ -z "$MAPDIR" ] && {
MAPDIR=$TTF2PT1_SHAREDIR/maps
}
LOG=$DSTDIR/convert.log
# configure the ttf2pt1 options from our options
# artefact of backwards-compatibility with .cfg
[ -z "$CORRECTWIDTH" -a YES != "$DONTCORRECTWIDTH" ] && {
TTF2PT1="$TTF2PT1 -OW"
}
[ YES = "$CORRECTWIDTH" ] && {
TTF2PT1="$TTF2PT1 -OW"
}
[ YES != "$HINTSUBST" ] && {
TTF2PT1="$TTF2PT1 -Ou" # meaning changed past 3.22
}
[ YES = "$ALLGLYPHS" -a YES = "$ENFORCEISO" ] && {
echo "$MYSELF: options ALLGLYPHS and ENFORCEISO are mutually exclusive" >&2
exit 1
}
[ YES = "$ALLGLYPHS" ] && {
TTF2PT1="$TTF2PT1 -a"
}
[ YES = "$GENUID" ] && {
TTF2PT1="$TTF2PT1 -uA"
}
[ YES != "$ENFORCEISO" ] && {
FORCEISO=cat
}
[ YES = "$CREATEPFB" ] && {
T1ASM="$T1ASM -b"
SUFFIX="pfb"
}
# parse the information about the source files
eval "`echo \"$SRCDIRS\" | awk '
BEGIN { n=0; }
/^ *$/ { next; }
{
if(n>9) {
printf(\"echo \\\"Only 9 encodings are supported at once!\\\" >&2\n\");
printf(\"exit 1\\n\");
} else {
printf(\"SRCDIR%d=%s\n\",n,$1);
printf(\"SRCLANG%d=%s\n\",n,$2);
printf(\"SRCENC%d=%s\n\",n,$3);
printf(\"SRCMAP%d=%s\n\",n,$4);
n++;
}
}'`"
# check whether we have the directories
mkdir $DSTDIR 2>/dev/null >/dev/null
[ -d $DSTDIR -a -r $DSTDIR -a -w $DSTDIR -a -x $DSTDIR ] || {
echo "$MYSELF: can't access the directory $DSTDIR" >&2
exit 1
}
# go to our destination directory
cd $DSTDIR || {
echo "$MYSELF: can't chdir to $DSTDIR" >&2
exit 1
}
rm -f ./* 2>/dev/null
>$LOG
for dirno in 0 1 2 3 4 5 6 7 8 9
do {
SRCDIR=`eval "echo \\\$SRCDIR$dirno"`
SRCLANG=`eval "echo \\\$SRCLANG$dirno"`
SRCENC=`eval "echo \\\$SRCENC$dirno"`
SRCMAP=`eval "echo \\\$SRCMAP$dirno"`
DSTENC=`eval "echo \\\$DSTENC$SRCLANG"`
echo $SRCDIR
echo $SRCENC
[ -z "$SRCDIR" ] && break;
[ "`ls $SRCDIR/*.[tT][tT][fF] 2>/dev/null |wc -l`" -gt 0 ] || {
echo "$MYSELF: no TTF files in $SRCDIR" >&2
exit 1
}
# check whether we have the encoding tables
[ -n "$SRCENC" ] || {
echo "$MYSELF: you must specify some source encoding" >&2
exit 1
}
[ unknown = "$SRCLANG" -o -n "$DSTENC" ] || {
echo "$MYSELF: you must specify some destination encodings" >&2
exit 1
}
# handle aliases of the destination encodings
XDSTENC=
DSTALIAS=
[ -r $ENCDIR/$SRCLANG/encodings.alias ] && {
for i in $DSTENC
do {
TO=`awk '$1=="'$i'" { print $2; }' <$ENCDIR/$SRCLANG/encodings.alias`
if [ -n "$TO" ]
then {
[ -f $ENCDIR/$SRCLANG/$i.tbl -a -r $ENCDIR/$SRCLANG/$i.tbl ] && {
echo "WARNING: $SRCLANG encoding $i found as both table and alias" >&2
echo "WARNING: The alias takes precedence" >&2
}
DSTALIAS="$TO $i
$DSTALIAS"
XDSTENC="$TO
$XDSTENC"
} else {
XDSTENC="$i
$XDSTENC"
} fi
} done
DSTENC=`echo "$XDSTENC" | sort -u | tr '
' ' '`
}
[ unknown != "$SRCLANG" ] && {
for i in $SRCENC $DSTENC
do {
[ -f $ENCDIR/$SRCLANG/$i.tbl -a -r $ENCDIR/$SRCLANG/$i.tbl ] || {
echo "$MYSELF: can't read $ENCDIR/$SRCLANG/$i.tbl" >&2
exit 1
}
} done
}
# OK convert the files
for file in $SRCDIR/*.[tT][tT][fF]
do {
name=`echo $file | tr A-Z a-z`
name=`basename $name .ttf`
echo "Converting $name"
# generate the assembler code
echo "******* $name -> t1a ************" >>$LOG
if [ -n "$SRCMAP" ]
then {
$TTF2PT1 -L $MAPDIR/$SRCMAP $file ./$name.$SRCENC 2>>$LOG
} else {
$TTF2PT1 -l $SRCLANG $file ./$name.$SRCENC 2>>$LOG
} fi
[ -s ./$name.$SRCENC.t1a ] || {
echo "$MYSELF: can't generate Type1 assembler code for $name" >&2
continue;
}
[ -s ./$name.$SRCENC.afm ] || {
echo "$MYSELF: can't generate AFM metrics file for $name" >&2
continue;
}
mv ./$name.$SRCENC.afm ./$name.$SRCENC.xafm
psname=`$T1FDIR -g $FOUNDRY " " -f ./$name.$SRCENC.t1a \
| awk '{print substr($1,2);}'`
# now for each destination encoding generate a .pfa/b file
# and record for fonts.scale
if [ unknown != "$SRCLANG" ]
then {
for enc in $DSTENC
do {
echo "******* $name -> $enc ************" >>$LOG
sed 's|^\/FontName.*$|/FontName /'$psname$enc' def|' <./$name.$SRCENC.t1a \
| $TRANS $ENCDIR/$SRCLANG/$SRCENC.tbl $ENCDIR/$SRCLANG/$enc.tbl \
| $FORCEISO | $T1ASM >./$name.$enc.$SUFFIX
[ -s ./$name.$enc.$SUFFIX ] || {
echo "$MYSELF: can't convert/assemble Type1 file for $name.$enc" >&2
continue;
}
sed 's|^FontName.*$|FontName '$psname$enc'|' <./$name.$SRCENC.xafm \
| $TRANS $ENCDIR/$SRCLANG/$SRCENC.tbl $ENCDIR/$SRCLANG/$enc.tbl \
| uniq | $FORCEISO >./$name.$enc.afm
[ -s ./$name.$enc.afm ] || {
echo "$MYSELF: can't convert AFM file for $name.$enc" >&2
}
aliases=`echo "$DSTALIAS" | grep "^$enc" | cut -d\ -f2`
echo "******* aliases: $aliases" >>$LOG
$T1FDIR -d fonts.ttf fonts.alias $FOUNDRY $enc $aliases -f ./$name.$enc.$SUFFIX
echo "/$psname$enc ($name.$enc.$SUFFIX) ;" >>Fontmap.ttf
} done
} else {
enc="$SRCENC"
echo "******* $name -> $enc ************" >>$LOG
sed 's|^\/FontName.*$|/FontName /'$psname$enc' def|' <./$name.$SRCENC.t1a \
| $FORCEISO | $T1ASM >./$name.$enc.$SUFFIX
[ -s ./$name.$enc.$SUFFIX ] || {
echo "$MYSELF: can't convert/assemble Type1 file for $name.$enc" >&2
continue;
}
sed 's|^FontName.*$|FontName '$psname$enc'|' <./$name.$SRCENC.xafm \
| uniq | $FORCEISO >./$name.$enc.afm
[ -s ./$name.$enc.afm ] || {
echo "$MYSELF: can't convert AFM file for $name.$enc" >&2
}
$T1FDIR -d fonts.ttf fonts.alias $FOUNDRY $enc -f ./$name.$enc.$SUFFIX
echo "/$psname$enc ($name.$enc.$SUFFIX) ;" >>Fontmap.ttf
} fi
[ YES = "$REMOVET1A" ] && {
rm -f ./$name.$SRCENC.t1a
rm -f ./$name.$SRCENC.xafm
}
} done
} done
wc -l <fonts.ttf >fonts.scale
cat fonts.ttf >>fonts.scale
mkfontdir
[ YES = "$GENUID" ] && {
echo "Checking for duplicate UniqueIDs..."
for id in `find . -name "*.$SUFFIX" -exec grep UniqueID {} \; \
| cut -d" " -f2 | sort | uniq -d`
do {
echo "Warning: duplicate UniqueID $id in files:" | tee -a $LOG
find . -name "*.$SUFFIX" -exec grep -l "UniqueID $id " {} \; 2>&1 | tee -a $LOG
} done
}
[ -n "$GSDIR" ] || {
echo "$MYSELF: The Ghostscript base directory is not specified.\n" >&2
echo "$MYSELF: Installation of the Ghostscript fonts is deferred.\n" >&2
echo "$MYSELF: You can do it later by running x2gs\n" >&2
exit 0
}
echo "Installing the Ghostscript fonts"
cd $RUNDIR
$X2GS $CFGFILE || {
echo "$MYSELF: Installation of the Ghostscript fonts has failed.\n" >&2
echo "$MYSELF: You can correct the problem and run x2gs to repeat\n" >&2
exit 0
}

View File

@@ -0,0 +1,192 @@
#!/bin/sh
#
# Copyright (c) 1998, 1999
# Sergey A. Babkin. 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.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# Sergey A. Babkin (sab123@hotmail.com, babkin@bellatlantic.net)
#
# Configuration file for the conversion script.
# Convert TTF fonts from source directory to Type1 fonts in the destination
# directory, converted to the specified encodings. Also generate the
# fonts.scale, fonts.dir and fonts.alias files in the destination
# directory.
# This file is an example of configuration. It contains
# the examples of settings for all the supported languages.
# Please check the settings and change them for
# your needs.
# The directories with source TTF files.
# The lines are formatted in 3 columns:
# - directory path
# - language name
# - encoding of the fonts in this directory
# - optional Unicode map file name
# There should be a separate directory for each input encoding.
# No more than 10 encodings are supported now for
# one conversion.
#
# If the Unicode map file name is specified then this
# external map file will be used to encode the resulting
# font. Otherwise the built-in table for this language
# will be used. If you have some special encoding map that
# does not conform to any of the defined languages, set the
# language name to 'unknown' and encoding name to whatever
# you want to see in the X11 logical font description.
#
# NOTES:
# For Russian, Bulgarian and English (as a subset of
# Western) languages you may pile together the Unicode
# fonts and the fonts in the Windows encoding into the same
# directory, they will be sorted out automatically. For
# the Russian and Bulgarian Unicode fonts set the
# source encoding to ibm-1251.
#
# For Turkish, Baltic, Central European and other Western
# European languages the resulting fonts will be in
# a proper iso8859 encoding only if the source fonts
# are in Unicode.
#
# AdobeStd encoding will work only
# for the source font in Unicode encoding which
# either have proper character names or map the
# Adobe character extensions to the expected codes
# (or both).
#
# The external maps work only if the source fonts
# are in Unicode, otherwise the original font's
# encoding will be preserved.
#
# Better don't use the map adobe-standard-encoding.map,
# unless you really need it, it's very incomplete.
#
# The map planes are not supported in the scripts yet.
SRCDIRS="
/SOME_DIR_WITH_cyrillic_windows_TTF_FONTS cyrillic ibm-1251
/SOME_DIR_WITH_cyrillic_koi_TTF_FONTS cyrillic koi8-r
/SOME_DIR_WITH_unicode_TTF_FONTS latin4 iso8859-4
/SOME_DIR_WITH_unicode_TTF_FONTS latin5 iso8859-9
/SOME_DIR_WITH_unicode_TTF_FONTS latin2 iso8859-2
/SOME_DIR_WITH_western_TTF_FONTS latin1 iso8859-1
/SOME_DIR_WITH_unicode_TTF_FONTS adobestd adobe-std
/SOME_DIR_WITH_weird_unicode_TTF_FONTS adobestd adobe-std adobe-standard-encoding.map
/SOME_DIR_WITH_unicode_TTF_FONTS unknown my-special some-very-special.map
"
# the directory for converted X11 fonts
DSTDIR=/usr/X11R6/lib/X11/fonts/fromttf
# The base directory of Ghostscript;
# set it to empty space if you don't want the Ghostscript fonts installed.
# For some systems the directory is /usr/share/ghostscript.
GSDIR=/usr/local/share/ghostscript
# The font directory of Ghostscript;
# should work for all the versions of Ghostscript. Except (as always) the one
# packaged with Red Hat Linux 6.0. For RH6.0 it should be set to either
# /usr/share/fonts/default/ghostscript or /usr/share/fonts/default/Type1.
GSFONTDIR=$GSDIR/fonts
# The configuration directory of Ghostscript where the Fontmap file is stored;
# the example is for Ghostscript 6.0, change for the version you actually
# have. This directory is used only to reach the Fontmap file, so if your
# installation stores the Fontmap files in the same directory as fonts
# (like Debian Linux does - isn't Linux wonderful in its differences?)
# then set it to the same value as GSFONTDIR.
GSCONFDIR=$GSDIR/6.0
# The encodings of generated files by languages
# (see the whole list of possible encodings for each
# language in the directories encoding/<language> )
#
# Here prefer windows-1251 over ibm-1251: it aliases
# to the same thing but is the name expected by
# Netscape Navigator. For the same reason prefer
# cp-866 over ibm-866.
DSTENCcyrillic="koi8-r windows-1251 iso8859-1"
DSTENClatin1="iso8859-1"
DSTENClatin2="iso8859-2"
DSTENClatin4="iso8859-4"
DSTENClatin5="iso8859-9"
DSTENCadobestd="adobe-std"
# name of foundry for generated fonts
# (for HP-UX or if you just want to use an
# honest name change to "misc")
FOUNDRY=fromttf
# If you want to use non-standard directories with encoding
# maps and tables then set these values
MAPDIR=
ENCDIR=
# Options:
# set the value to YES to enable, NO (or anything else) to disable
# CORRECTWIDTH - use the option "-w" of converter. Set this
# option to NO if your fonts are well-designed. At least some
# freeware fonts have the width metrics broken and the letters
# look smashed into each other. If this option is set to "YES"
# the converter tries to correct this defect but this may have slight
# side effects on the well-designed fonts: the characters that
# are designed to be close to each other will get wider spacing.
# REMOVET1A - remove the un-encoded .t1a files after they are converted
# and assembled if this option set to YES
# INSTALLFONTMAP - if set to YES install the entries for the converted
# fonts right into the Ghostscript Fontmap file. Otherwise just
# symlink the font files and copy Fontmap.ttf to the Ghostscript
# directories.
# HINTSUBST - enable the hint substitution (option "-H" of
# converter). You may want to compare the looks of the fonts with and
# without this option and decide what is better (see the discussion in
# the README file). If the fonts with this option set to YES look
# completely empty in X11 then set this option to NO or install
# the supplied patches.
# ENFORCEISO - try to disguise the character names according to
# the ISOLatin1 encoding table. Set it to YES if some program
# expects strictly the ISO names but the fonts have different
# character names (this is not the case for X11 any more).
# Options ENFORCEISO and ALLGLYPHS can't be both set to YES.
# ALLGLYPHS - include all the glyphs (characters) from the source
# fonts into the resulting fonts, even if those are not
# included into the encoding tables. If the supplied X11
# patches are not installed this may cause font size overflow
# in X11. So if you are not sure better leave it as NO.
# For more details see the discussion of the option "-a".
# GENUID - automatically generate UniqueID for all the fonts.
# Setting it to YES may be useful only for the fonts to
# be loaded the fonts into a printer with hard disk. Be
# advised that although unlikely the generated UniqueIDs
# for two fonts may coincide, then the consequences will
# be unpredictable.
# CREATEPFB - if set to YES create .pfb font files, otherwise
# .pfa font files. The .pfb files take somewhat less disk
# space but contain 8-bit binary data.
CORRECTWIDTH=YES
REMOVET1A=YES
INSTALLFONTMAP=YES
HINTSUBST=NO
ENFORCEISO=NO
ALLGLYPHS=NO
GENUID=NO
CREATEPFB=YES
# End of the configuration file

View File

@@ -0,0 +1,450 @@
#!/usr/bin/perl
#
# Copyright (c) 1998
# Sergey A. Babkin. 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.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# Sergey A. Babkin (sab123@hotmail.com, babkin@bellatlantic.net)
#
#
# Force the font to use the encoding as close to ISO Latin-1 as possible
#
# Use:
# forceiso [format] <file1.t1a >file2.t1a
# where format is a printf-type format used to select names for the
# glyphs without standard Latin-1 names. It must expect one argument,
# the character code. The default format is "_%d".
%latin1=(
0, "",
1, "",
2, "",
3, "",
4, "",
5, "",
6, "",
7, "",
8, "",
9, "",
10, "",
11, "",
12, "",
13, "",
14, "",
15, "",
16, "",
17, "",
18, "",
19, "",
20, "",
21, "",
22, "",
23, "",
24, "",
25, "",
26, "",
27, "",
28, "",
29, "",
30, "",
31, "",
32, "space",
33, "exclam",
34, "quotedbl",
35, "numbersign",
36, "dollar",
37, "percent",
38, "ampersand",
39, "quoteright",
40, "parenleft",
41, "parenright",
42, "asterisk",
43, "plus",
44, "comma",
45, "hyphen",
46, "period",
47, "slash",
48, "zero",
49, "one",
50, "two",
51, "three",
52, "four",
53, "five",
54, "six",
55, "seven",
56, "eight",
57, "nine",
58, "colon",
59, "semicolon",
60, "less",
61, "equal",
62, "greater",
63, "question",
64, "at",
65, "A",
66, "B",
67, "C",
68, "D",
69, "E",
70, "F",
71, "G",
72, "H",
73, "I",
74, "J",
75, "K",
76, "L",
77, "M",
78, "N",
79, "O",
80, "P",
81, "Q",
82, "R",
83, "S",
84, "T",
85, "U",
86, "V",
87, "W",
88, "X",
89, "Y",
90, "Z",
91, "bracketleft",
92, "backslash",
93, "bracketright",
94, "asciicircum",
95, "underscore",
96, "grave",
97, "a",
98, "b",
99, "c",
100, "d",
101, "e",
102, "f",
103, "g",
104, "h",
105, "i",
106, "j",
107, "k",
108, "l",
109, "m",
110, "n",
111, "o",
112, "p",
113, "q",
114, "r",
115, "s",
116, "t",
117, "u",
118, "v",
119, "w",
120, "x",
121, "y",
122, "z",
123, "braceleft",
124, "bar",
125, "braceright",
126, "asciitilde",
127, "",
128, "",
129, "",
130, "",
131, "",
132, "",
133, "",
134, "",
135, "",
136, "",
137, "",
138, "",
139, "",
140, "",
141, "",
142, "",
143, "",
144, "",
145, "",
146, "",
147, "",
148, "",
149, "",
150, "",
151, "",
152, "",
153, "",
154, "",
155, "",
156, "",
157, "",
158, "",
159, "",
160, "",
161, "exclamdown",
162, "cent",
163, "sterling",
164, "currency",
165, "yen",
166, "brokenbar",
167, "section",
168, "dieresis",
169, "copyright",
170, "ordfeminine",
171, "guillemotleft",
172, "logicalnot",
173, "minus",
174, "registered",
175, "macron",
176, "degree",
177, "plusminus",
178, "twosuperior",
179, "threesuperior",
180, "acute",
181, "mu",
182, "paragraph",
183, "periodcentered",
184, "cedilla",
185, "onesuperior",
186, "ordmasculine",
187, "guillemotright",
188, "onequarter",
189, "onehalf",
190, "threequarters",
191, "questiondown",
192, "Agrave",
193, "Aacute",
194, "Acircumflex",
195, "Atilde",
196, "Adieresis",
197, "Aring",
198, "AE",
199, "Ccedilla",
200, "Egrave",
201, "Eacute",
202, "Ecircumflex",
203, "Edieresis",
204, "Igrave",
205, "Iacute",
206, "Icircumflex",
207, "Idieresis",
208, "Eth",
209, "Ntilde",
210, "Ograve",
211, "Oacute",
212, "Ocircumflex",
213, "Otilde",
214, "Odieresis",
215, "multiply",
216, "Oslash",
217, "Ugrave",
218, "Uacute",
219, "Ucircumflex",
220, "Udieresis",
221, "Yacute",
222, "Thorn",
223, "germandbls",
224, "agrave",
225, "aacute",
226, "acircumflex",
227, "atilde",
228, "adieresis",
229, "aring",
230, "ae",
231, "ccedilla",
232, "egrave",
233, "eacute",
234, "ecircumflex",
235, "edieresis",
236, "igrave",
237, "iacute",
238, "icircumflex",
239, "idieresis",
240, "eth",
241, "ntilde",
242, "ograve",
243, "oacute",
244, "ocircumflex",
245, "otilde",
246, "odieresis",
247, "divide",
248, "oslash",
249, "ugrave",
250, "uacute",
251, "ucircumflex",
252, "udieresis",
253, "yacute",
254, "thorn",
255, "ydieresis"
);
# how to treat the unknown characters
$unk = "_%d";
if($#ARGV >= 0) {
$unk = $ARGV[0];
}
# fill in the unnamed characters
if( sprintf($unk, 0) eq sprintf($unk, 1) ) {
die "The format for unnamed characters must not be a constant"
}
for($i=0; $i < 256; $i++) {
if($latin1{$i} eq "") {
$latin1{$i} = sprintf($unk, $i);
}
}
while(<STDIN>) {
print $_;
if(/^\/Encoding\s+.*\s+array/) {
$fontfile=1;
last;
}
if(/^StartCharMetrics\s+/) {
$fontfile=0;
last;
}
}
$ndups=0;
if($fontfile) { # .t1a file
while(<STDIN>) {
if($_ !~ /^dup\s+(\d+)\s+\/(\S+)\s+put/) {
print $_;
last;
}
$code=$1+0;
$name=$2;
if($name eq ".notdef") {
print $_;
} else {
printf("dup %d /%s put\n",$code,$latin1{$code});
if($trans{$name}) { # two or more references to the same glyph
$ndups++;
#printf(STDERR "forceiso: %d dups\n", $ndups);
if($copies{$name} eq "") {
$copies{$name} = $latin1{$code};
} else {
$copies{$name} .= "|" . $latin1{$code};
}
} else {
$trans{$name}=$latin1{$code};
}
}
}
while(<STDIN>) {
if( /\/CharStrings\s+(\d+)\s/) {
$nchars=$1+$ndups;
#printf(STDERR "forceiso: %d dups %d chars\n", $ndups, $nchars);
$_ =~ s|/CharStrings\s+\d+\s|/CharStrings $nchars |;
print $_;
last;
}
print $_;
}
while(<STDIN>) {
if(/^\/(\S+)/) {
$name=$1;
$to=$trans{$name};
$header=$_;
$body="";
if($to ne "") {
$_ =~ s/^\/\S+/\/$to/;
}
print $_;
} elsif(/endchar/) {
print $_;
if($copies{$name}) {
for $to (split(/\|/,$copies{$name})) {
$header =~ s/^\/\S+/\/$to/;
print($header, $body, $_);
}
}
} else {
print $_;
$body .= $_;
}
}
} else { # .afm file
while(<STDIN>) {
if($_ !~ /^C\s+(\d+)(\s*;.*N\s+)(\S+)(\s*;.*)\n/) {
print $_;
last;
}
$code=$1+0;
$name=$3;
$part2=$2;
$part4=$4;
if($name eq ".notdef") {
print $_;
} else {
printf("C %d%s%s%s\n",$code,$part2,$latin1{$code},$part4);
if($copies{$name} eq "") {
$copies{$name} = $latin1{$code};
} else {
$copies{$name} .= "|" . $latin1{$code};
$ndups++;
#printf(STDERR "forceiso: %d dups\n", $ndups);
}
}
}
while(<STDIN>) {
if(/^StartKernPairs\s+(\d+)/) {
last;
}
print $_;
}
$npairs=0;
$kps="";
while(<STDIN>) {
if(/^KPX\s+(\S+)\s+(\S+)\s+(.*)\n/) {
$name1=$1;
$name2=$2;
$metric=$3;
$cp1=$copies{$name1};
if($cp1 eq "") {
$cp1=$name1;
}
$cp2=$copies{$name2};
if($cp2 eq "") {
$cp2=$name2;
}
for $to1 (split(/\|/,$cp1)) {
for $to2 (split(/\|/,$cp2)) {
$kps .= sprintf("KPX %s %s %s\n", $to1, $to2, $metric);
$npairs++;
}
}
} else {
if($npairs!=0) {
printf("StartKernPairs %d\n", $npairs);
printf("%s", $kps);
$npairs=0;
$kps="";
}
print $_;
}
}
}

View File

@@ -0,0 +1,24 @@
#!/usr/bin/perl
#
# A script to convert a Unicode character map to
# the C code
#
sub fromhex
{
return eval "0x".$_[0];
}
$inmap=0;
while(<>)
{
if(/^CHARMAP/) {
$inmap=1;
} elsif(/^END CHARMAP/) {
$inmap=0;
} elsif($inmap
&& /^\s*\S+\s+\/x([0-9a-fA-F][0-9a-fA-F])\s+\<U([0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])/) {
$map[fromhex($1)]=fromhex($2);
}
}

View File

@@ -0,0 +1,231 @@
#!/usr/bin/perl
#
# See COPYRIGHT
#
# Script to generate a pod file from an html source (the same one as for text files too)
# and later this pod file it passed through pod2man
#
# Use:
# html2man [ <man-dir> [<version-dir>] ] <file.html
#
# <Man-dir> is the directory where the man pages will be created
# (current directory by default). If a file name is given instead of
# directory then the directory of that file is used.
# <Version-dir> is the directory containing the ttf2pt1 files version.h
# and CHANGES.html which are used to generate the release name and date
# for the man page (by default looks in current directory and then in up to
# 5 ancestor directories).
# If the version files can not be found then the release defaults to
# "current" and the date defaults to today.
#
# Special formatting in the html file is:
# All controls are hidden within HTML comments that must occupy a whole separate line
# Such a line looks like:
# <!-- =<html2man_directive> <arguments> -->
# <!-- ==<pod_directive> <arguments> -->
# Any sort of directive must be followed by a space. The pod directives are
# automatically surrounded by empty lines in the output file.
# The html2man directives are:
#
# <!-- =defdoc <docid> <file> <section> -->
# Define a man page. Multiple man pages can be defined in the same HTML
# file. <Docid> is a short name by which this man page will be referred in the
# other directives. <File> is the name of the man page, and <section> is the
# section of the manual (do not confuse with sections within a man page).
#
# <!-- =section <docid> <page_section_name> -->
# All the text following this directive is copied (with translation)
# into the specified section of the specified man page. The sections
# may appear in arbitrary order, they will be rearranged to the standard
# order before output. Only standard section names are permitted (see @stdsect
# below). The pod directives which occur outside of man sections are ignored,
# just like the common text. The translation of HTML tags is:
#
# <br> - to paragraph break
# <b> - to B<>
# <i> - to I<>
# <tt> - to C<>
# <a href> - to F<>
# <ul>, <li>, </ul> - to =over 2, =item *, =back
# &nbsp;, &amp;, &lt;, &gt - to their symbols, appropriately encoded
#
# The rest of HTML tags is removed
#
# If the same section is started more than once, the text from the
# second appearance will be added to the first, etc.
#
# <!-- =stop -->
# Stop copying text to the man page.
#
# <!-- =cont -->
# Continue copying text to the man page, same section as before.
#
# <!-- =text <text> -->
# Insert this <text> into the man page (works only when copying is enabled).
# Characters &lt;, &gt;, &amp; are converted as usual.
@mons = qw(January February March April May June July August September October November December);
$dir = $ARGV[0];
$maindir = $ARGV[1];
if($dir eq "") {
$dir = ".";
} elsif( ! -d $dir ) {
if( ! ($dir =~ s|\/[^/]*$||) ) {
$dir = ".";
}
}
if($maindir eq "") {
$maindir = ".";
for($i=0; $i<5; $i++) {
if(-f "$maindir/version.h") {
last;
}
$maindir = "../$maindir";
}
}
if( open(VERFILE, "<$maindir/version.h") ) {
while(<VERFILE>) {
if( /^\s*\#define\s+TTF2PT1_VERSION\s+\"(.*)\"/ ) {
$release = "version $1";
}
}
close(VERFILE);
if( $release =~ /SNAP-([0-9][0-9])([0-9][0-9])([0-9][0-9])/ ) {
$date = sprintf("%s %d, 20%02d", $mons[$2-1], $3, $1);
} elsif( open(CFILE, "<$maindir/CHANGES.html") ) {
while(<CFILE>) {
if( /\<H4\>/) {
last;
}
}
$_ = <CFILE>;
chomp;
if( $_ =~ s/^.*?-- // ) {
$date = $_;
}
close(CFILE);
}
}
if($release eq "") {
$release = "current";
}
if($date eq "") {
@lt = localtime(time);
$date = sprintf("%s %d, %d", $mons[$lt[4]], $lt[3], 1900+$lt[5]);
}
#printf(STDERR "date=%s release=%s\n", $date, $release);
$writemode = 0;
while(<STDIN>) {
if( s/^\<\!\-\- \=(\S+)\s+//) {
$cmd = $1;
s/\s*--\>\s*$//;
#printf(STDERR "cmd=%s args=%s\n", $cmd, $_);
if($cmd =~ /^=/) {
if($writemode) {
$text{$tosect} .= "\n\n$cmd $_\n\n";
}
} elsif($cmd eq "defdoc") {
@sl = split;
push(@allids, $sl[0]);
$file{$sl[0]} = $sl[1];
$mansect{$sl[0]} = $sl[2];
} elsif($cmd eq "section") {
# tosect includes the file id
$tosect = $_;
$text{$tosect} .= "\n\n";
$writemode = 1;
} elsif($cmd eq "stop") {
$writemode = 0;
$text{$tosect} .= "\n";
} elsif($cmd eq "cont") {
$writemode = 1;
} elsif($cmd eq "text") {
if($writemode) {
s/\&lt\;/</gi;
s/\&gt\;/>/gi;
s/\&amp\;/\&/gi;
$text{$tosect} .= "$_\n";
}
}
} elsif($writemode) {
s/^\s+//;
s/\{/\&lbr;/g;
s/\}/\&rbr;/g;
s/\<br\>/\n\n/gi;
#s/\<blockquote\>/\n\n=over 4\n\n/gi;
#s/\<\/blockquote\>/\n\n=back\n\n/gi;
s/\<ul\>/\n\n=over 4\n\n/gi;
s/\<\/ul\>/\n\n=back\n\n/gi;
s/\<li\>\s*/\n\n=item \*\n\n/gi;
s/\<i\>(.*?)\<\/i\>/I\{\1\}/gi;
s/\<b\>(.*?)\<\/b\>/B\{\1\}/gi;
s/\<tt\>(.*?)\<\/tt\>/C\{\1\}/gi;
s/\<a href\=\.*?\>(.*?)\<\/a\>/F\{\1\}/gi;
s/\<.*?\>//g;
s/\{/\</g;
s/\}/\>/g;
s/\&nbsp\;/S< >/gi;
s/\&amp\;/\&/gi;
s/\&lt\;/E<lt>/gi;
s/\&gt\;/E<gt>/gi;
#s/\|/E<verbar>/g;
#s/\//E<sol>/g;
s/\&lbr\;/\{/g;
s/\&rbr\;/\}/g;
#printf(STDERR "section=%s add=%s", $tosect, $_);
$text{$tosect} .= $_;
}
}
@stdsect = (
"NAME",
"SYNOPSIS",
"DESCRIPTION",
"OPTIONS",
"RETURN VALUE",
"ERRORS",
"EXAMPLES",
"ENVIRONMENT",
"FILES",
"SEE ALSO",
"NOTES",
"CAVEATS",
"DIAGNOSTICS",
"BUGS",
"RESTRICTIONS",
"AUTHOR",
"HISTORY" );
#printf(STDERR "allids= @allids\n");
for $id (@allids) {
#print(STDERR "creating man page $id $file{$id} $mansect{$id}\n\n");
die "Unable to create pod file $dir/$file{$id}.pod"
unless open(PODF, ">$dir/$file{$id}.pod");
print(PODF "=pod\n\n");
for $sect (@stdsect) {
$sid = "$id $sect";
#printf(STDERR "trying %s\n", $sid);
if(defined $text{$sid}) {
print(PODF "=head1 $sect\n\n$text{$sid}\n\n");
}
}
print(PODF "=cut\n");
close(PODF);
die "Unable to generate the man page $dir/$file{$id}.1"
if system("pod2man --section=\"$mansect{$id}\" --release=\"$release\" "
. "--center=\"TTF2PT1 Font Converter\" --date=\"$date\" "
. "$dir/$file{$id}.pod >$dir/$file{$id}.1");
unlink("$dir/$file{$id}.pod");
}

View File

@@ -0,0 +1,43 @@
#!/usr/bin/perl
#
# Script to create a directory for installation
#
# (c) 2000 by The TTF2PT1 Project
# See COPYRIGHT for full license
#
if( $#ARGV!=0 && $#ARGV !=3) {
die "Use: $0 dir-name [owner group mode]\n"
}
if( $#ARGV==3 ) {
$owner = $ARGV[1];
$group = $ARGV[2];
eval "\$mode = 0$ARGV[3];";
} else {
$owner = "root";
$group = "bin";
$mode = 0755;
}
@sl = split(/\//, $ARGV[0]);
$prefix = shift(@sl);
if($prefix eq "") {
$prefix = "/" . shift(@sl);
}
while(1) {
if( ! -d "$prefix" ) {
die "Unable to create directory $prefix:\n$!\n"
unless mkdir($prefix, $mode);
die "Unable to change owner of $prefix to $owner\n"
if system("chown $owner $prefix");
die "Unable to change group of $prefix to $group\n"
if system("chgrp $group $prefix");
}
if($#sl < 0) {
last;
}
$prefix .= "/" . shift(@sl);
}
exit(0);

Some files were not shown because too many files have changed in this diff Show More