summaryrefslogtreecommitdiff
path: root/Build/source/texk/ttfdump
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
committerKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
commit487ca4806cc046076293cf6cc5fbba0db282bac7 (patch)
tree847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/ttfdump
parenta3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff)
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/ttfdump')
-rw-r--r--Build/source/texk/ttfdump/COPYING339
-rw-r--r--Build/source/texk/ttfdump/ChangeLog125
-rw-r--r--Build/source/texk/ttfdump/ILX45
-rw-r--r--Build/source/texk/ttfdump/INSTALL181
-rw-r--r--Build/source/texk/ttfdump/Makefile.in147
-rw-r--r--Build/source/texk/ttfdump/NOTE8
-rw-r--r--Build/source/texk/ttfdump/README70
-rw-r--r--Build/source/texk/ttfdump/README.bg552
-rw-r--r--Build/source/texk/ttfdump/TODO29
-rw-r--r--Build/source/texk/ttfdump/config.h.in28
-rw-r--r--Build/source/texk/ttfdump/configure1909
-rw-r--r--Build/source/texk/ttfdump/configure.in29
-rw-r--r--Build/source/texk/ttfdump/docs/ttfdump.1124
-rw-r--r--Build/source/texk/ttfdump/docs/ttfdump.dvibin0 -> 3832 bytes
-rw-r--r--Build/source/texk/ttfdump/docs/ttfdump.html169
-rw-r--r--Build/source/texk/ttfdump/docs/ttfdump.ps282
-rw-r--r--Build/source/texk/ttfdump/include/gcache.h24
-rw-r--r--Build/source/texk/ttfdump/include/gstate.h86
-rw-r--r--Build/source/texk/ttfdump/include/loadtable.h105
-rw-r--r--Build/source/texk/ttfdump/include/os2_P.h197
-rw-r--r--Build/source/texk/ttfdump/include/protos.h22
-rw-r--r--Build/source/texk/ttfdump/include/tables.h585
-rw-r--r--Build/source/texk/ttfdump/include/ttc.h25
-rw-r--r--Build/source/texk/ttfdump/include/ttf.h187
-rw-r--r--Build/source/texk/ttfdump/include/ttfutil.h19
-rw-r--r--Build/source/texk/ttfdump/install-sh238
-rw-r--r--Build/source/texk/ttfdump/libttf/Makefile.in102
-rw-r--r--Build/source/texk/ttfdump/libttf/cmap.c748
-rw-r--r--Build/source/texk/ttfdump/libttf/cvt.c68
-rw-r--r--Build/source/texk/ttfdump/libttf/depend.mak386
-rw-r--r--Build/source/texk/ttfdump/libttf/disasm.c22
-rw-r--r--Build/source/texk/ttfdump/libttf/fixed.c16
-rw-r--r--Build/source/texk/ttfdump/libttf/font.c160
-rw-r--r--Build/source/texk/ttfdump/libttf/fpgm.c53
-rw-r--r--Build/source/texk/ttfdump/libttf/gasp.c95
-rw-r--r--Build/source/texk/ttfdump/libttf/gcache.c423
-rw-r--r--Build/source/texk/ttfdump/libttf/glyf.c438
-rw-r--r--Build/source/texk/ttfdump/libttf/gstate.c43
-rw-r--r--Build/source/texk/ttfdump/libttf/hdmx.c110
-rw-r--r--Build/source/texk/ttfdump/libttf/head.c108
-rw-r--r--Build/source/texk/ttfdump/libttf/hhea.c95
-rw-r--r--Build/source/texk/ttfdump/libttf/hmtx.c111
-rw-r--r--Build/source/texk/ttfdump/libttf/interp.c864
-rw-r--r--Build/source/texk/ttfdump/libttf/kern.c179
-rw-r--r--Build/source/texk/ttfdump/libttf/loca.c110
-rw-r--r--Build/source/texk/ttfdump/libttf/ltsh.c82
-rw-r--r--Build/source/texk/ttfdump/libttf/maxp.c92
-rw-r--r--Build/source/texk/ttfdump/libttf/name.c182
-rw-r--r--Build/source/texk/ttfdump/libttf/os2.c181
-rw-r--r--Build/source/texk/ttfdump/libttf/pclt.c113
-rw-r--r--Build/source/texk/ttfdump/libttf/post.c178
-rw-r--r--Build/source/texk/ttfdump/libttf/prep.c53
-rw-r--r--Build/source/texk/ttfdump/libttf/stack.c101
-rw-r--r--Build/source/texk/ttfdump/libttf/tabledir.c121
-rw-r--r--Build/source/texk/ttfdump/libttf/ttc.c97
-rw-r--r--Build/source/texk/ttfdump/libttf/ttfread.c129
-rw-r--r--Build/source/texk/ttfdump/libttf/ttfutil.c57
-rw-r--r--Build/source/texk/ttfdump/libttf/vdmx.c157
-rw-r--r--Build/source/texk/ttfdump/libttf/vhea.c102
-rw-r--r--Build/source/texk/ttfdump/libttf/vmtx.c115
-rw-r--r--Build/source/texk/ttfdump/libttf/win32.mak57
-rw-r--r--Build/source/texk/ttfdump/src/Makefile.in114
-rw-r--r--Build/source/texk/ttfdump/src/depend.mak14
-rw-r--r--Build/source/texk/ttfdump/src/ttfdump.c600
-rw-r--r--Build/source/texk/ttfdump/src/win32.mak55
-rw-r--r--Build/source/texk/ttfdump/win32.mak31
66 files changed, 11787 insertions, 0 deletions
diff --git a/Build/source/texk/ttfdump/COPYING b/Build/source/texk/ttfdump/COPYING
new file mode 100644
index 00000000000..a43ea2126fb
--- /dev/null
+++ b/Build/source/texk/ttfdump/COPYING
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ 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 of the License, 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.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/Build/source/texk/ttfdump/ChangeLog b/Build/source/texk/ttfdump/ChangeLog
new file mode 100644
index 00000000000..ca615638ed3
--- /dev/null
+++ b/Build/source/texk/ttfdump/ChangeLog
@@ -0,0 +1,125 @@
+Mon Jul 6 06:07:01 1998 Werner Lemberg <wl@gnu.org>
+
+ * include/gcache.h,
+ include/gstate.h,
+ include/loadtable.h,
+ include/os2_P.h,
+ include/tables.h,
+ include/ttc.h,
+ include/ttf.h,
+ include/ttfutil.h,
+ libttf/os2.c,
+ src/Attic/action.c,
+ src/Attic/mkttfdir.c,
+ src/Attic/rasben.c:
+
+ action.c, mkttfdir.c, rasben.c are empty.
+
+ Correcting spelling errors, formatting.
+
+Sat Jul 4 13:17:52 1998 Werner Lemberg <wl@gnu.org>
+
+ * src/ttfdump.c,
+ Makefile.in,
+ include/ttc.h,
+ include/ttf.h,
+ libttf/Makefile.in,
+ libttf/tabledir.c,
+ libttf/ttfread.c,
+ src/Makefile.in:
+
+ Diffs from Nelson Beebe:
+
+ new target `check' for Makefile, `install' improved
+
+ #include <unistd.h> in ttf.h
+
+ ttfread.c: workaround for egcs bug
+
+ ttfdump.c: `int main' instead of `void main'
+ use of EXIT_SUCCESS and EXIT_FAILURE
+ added Strdup() since strdup() doesn't exist everywhere
+
+ formatting of ttfdump.c
+
+Sat Jun 6 12:55:53 1998 Werner Lemberg <wl@gnu.org>
+
+ * libttf/post.c: Oops! Not 26.6 but 16.16 format. Added comment.
+
+ * libttf/post.c: fixed overflow bugs and a wrong 26.6 number.
+
+Sat Jan 4 19:23:56 1997 <ollie@ms1.hinet.net>
+
+ * libttf/cmap.c (ttfLoadCMAP6): Fixed a fatal bug cause segment fault
+
+ * src/ttfdump.c (main): add TrueType collection support
+
+Fri Nov 29 15:34:29 1996 <ollie@ms1.hinet.net>
+
+ * ttfdump :
+ Unrecoverable disaster had happened. The old developing version was
+ destoried during Red Hat Linux upgrading (it is my fault :~~(. ).
+ Resume to the public releease version.
+
+Tue Sep 24 21:47:05 1996 Li-Da Lho <ollie@ms1.hinet.net>
+
+ * font.c (ttfInitFont): The final layer of abstraction is complete.
+ Application programs only need to do the fellowing things to use
+ True Type Font:
+ 1. Load the font by calling ttfInitFont(char *font_filename)
+ 2. choose a encoding scheme.
+ 3. load the glyf by ttfLoadGlyphIndex or ttfLoadglyphCode
+ 4. do anythings the application wants about the outline data
+ (i.e. rendering ,showing).
+ 4. after all this, release the font by ttfFreeFont(TTFontPtr font).
+
+ * gcache.c: The implementation of glyph cache is completed. Start to
+ add the final layer of TTFont abstraction.
+ * glyf.c: It has been proved that av*.ttf is created by brain damaged
+ programmers. Lots of LOCA entries point to End Of File.
+
+ Benchmark: All Glyf data are loaded but not printed.
+ time ttfdump times.ttf >/dev/null
+ 0.080u 0.000s 0:00.19 42.1% 0+0k 0+0io 91pf+0w
+ time ttfdump /mnt/dos/windows/fonts/dftt-fs.ttf > /dev/null
+ 2.410u 0.560s 0:03.53 84.1% 0+0k 0+0io 70pf+0w
+ time ttfdump /mnt/dos/windows/fonts/dftt-sk5.ttf > /dev/null
+ 2.850u 0.550s 0:03.95 86.0% 0+0k 0+0io 70pf+0w
+ time ttfdump /mnt/dos/windows/fonts/kai.ttf > /dev/null
+ 1.920u 0.530s 0:02.85 85.9% 0+0k 0+0io 70pf+0w
+ time ttfdump /mnt/dos/windows/fonts/Dflihm.ttf > /dev/null
+ 2.850u 0.460s 0:03.87 85.5% 0+0k 0+0io 70pf+0w
+
+
+Thu Aug 1 21:11:36 1996 Li-Da Lho <ollie@ms1.hinet.net>
+ * glyf.c: composite glyph added but not completed yet,does not works
+ on av*.ttf any more but fine for others (is it a bug in av*.ttf or
+ my fault ??)
+ * glyf.c (ttfLoadGlyphIndex): removed the offset parameter
+ and add the glyphOffset entry in TTFont structure,which contain
+ the address of the start of glyf table, almost the same speed.
+
+Tue Jul 30 08:37:59 1996 Li-Da Lho <ollie@ms1.hinet.net>
+
+ * post.c : created
+ add postscript information,format 2.0 ,2.5 not implemented yet
+
+ * Release Version 0.4:
+ Almost all required tables in True Type Font Specitication are
+ implemented, except "post", "OS/2" and format 2,4,6 of "cmap".
+ Composite glyph and instruction disassembler are not supported yet.
+ Works fine on times.ttf,dftt-fs.ttf, unexpected EOF on avbbv.ttf,
+ avov.ttf. (possible wrong ttf file)
+
+ There are still some possible memory leak, clean then up when
+ freezing stage.
+
+ Benchmark:
+ time ttfdump times.ttf > /dev/null
+ 0.680u 0.020s 0:00.80 87.5% 0+0k 0+0io 94pf+0w
+ time ttfdump /mnt/dos/ttf/avov.ttf > /dev/null
+ 276.210u 1.710s 4:50.43 95.6% 0+0k 0+0io 73pf+0w
+ time ttfdump /mnt/dos/windows/fonts/dftt-fs.ttf > /dev/null
+ 27.440u 0.700s 0:29.49 95.4% 0+0k 0+0io 73pf+0w
+ time ttfdump /mnt/dos/windows/fonts/dflihm.ttf > /dev/null
+ 105.400u 0.830s 1:49.17 97.3% 0+0k 0+0io 73pf+0w
diff --git a/Build/source/texk/ttfdump/ILX b/Build/source/texk/ttfdump/ILX
new file mode 100644
index 00000000000..ef3710f8b1a
--- /dev/null
+++ b/Build/source/texk/ttfdump/ILX
@@ -0,0 +1,45 @@
+Project ILX
+
+1. What is ILX ?
+ ILX is th abber of "Internationalized and Localized X-window system".
+ Its main goal is to provid a internationalized and localized application
+ envoriment for X-window system.
+
+2. Why ILX ?
+ The reason that UNIX like operation systems can't compitete with M$ Windows
+ are that:
+ a) UNIX like systems lack GUI applications which make non-programmers
+ diffcult to use.
+ b) UNIX like systems are not internationalized nor localized enough
+ which makes it even harder for non-English speaking users to use
+ it.
+
+3. What will ILX have ??
+ ILX have three major steps, and for each major step there are some minor
+ stages to be complete.
+ Step 1. In the first step we have to make the more well avaliable
+ True Type font displayed by the X server. Most of easten fonts
+ are provided by the font vendors in True Type font format. In
+ order to provide a working True Type Font server we have to
+ complete the fellowing stages:
+ a) ttfdump: A true type font dumping program to explore the
+ definition of a true type font.
+ b) ttfshow: A true type font showing program to provide a test
+ bed for true type font rasterization.
+ c) fileview: Viewing a non ASCII file in the specified
+ encoding scheme. This program further explore the capacity of
+ the ttf rasterizer.
+ d) ttfedit: A true type font editor lets users to make their
+ new true type fonts.(optional)
+ e) ttfs: True Type Font Server, a font server comform to X11R6
+ font server protocols which can provide rasterizing True Type
+ fontsas well as other font format currently prrovided.
+
+ Step 2. In the second step we have to provide a easily extened Input
+ an Output Server for localized characters to be inputed and
+ displayed.
+
+ Step 3. In the third and final step we will provide a fully
+ internationalized and localized working enviroment, which
+ includes a CDE like desk top manamger, a document editor,
+ or even other things like spreadsheet or database mananger. \ No newline at end of file
diff --git a/Build/source/texk/ttfdump/INSTALL b/Build/source/texk/ttfdump/INSTALL
new file mode 100644
index 00000000000..a2c8722ccaf
--- /dev/null
+++ b/Build/source/texk/ttfdump/INSTALL
@@ -0,0 +1,181 @@
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+ The file `configure.in' is used to create `configure' by a program
+called `autoconf'. You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. You can give `configure'
+initial values for variables by setting them in the environment. Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+ CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+ env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory. After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on. Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+ CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+ If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+ Use and save the results of the tests in FILE instead of
+ `./config.cache'. Set FILE to `/dev/null' to disable caching, for
+ debugging `configure'.
+
+`--help'
+ Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made.
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--version'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
diff --git a/Build/source/texk/ttfdump/Makefile.in b/Build/source/texk/ttfdump/Makefile.in
new file mode 100644
index 00000000000..f8f85c25556
--- /dev/null
+++ b/Build/source/texk/ttfdump/Makefile.in
@@ -0,0 +1,147 @@
+# Makefile for Autoconf.
+# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+
+# 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# @configure_input@
+
+SHELL = /bin/sh
+
+#### Start of system configuration section. ####
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+# If you use gcc, you should either run the fixincludes script that
+# comes with it or else use gcc with the -traditional option. Otherwise
+# ioctl calls will be compiled incorrectly on some systems.
+CC = @CC@
+AR = ar
+
+# set make command
+@SET_MAKE@
+
+# Set RANLIB = echo if your system doesn't have or need ranlib.
+RANLIB = @RANLIB@
+
+# Use cp if you don't have install.
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+DEFS = @DEFS@
+LIBS = @LIBS@
+
+INCLUDES = -I@top_srcdir@/include
+CFLAGS = @CFLAGS@
+LDFLAGS = @LDFLAGS@
+
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+# Where to install the executables.
+bindir = $(exec_prefix)/bin
+
+# Where to put the include header
+includedir = $(prefix)/include
+
+# Where to put the Info files
+infodir = $(prefix)/info
+
+# Where to put the library file
+libdir = $(prefix)/lib
+
+# Where to put the manual pages.
+mandir = $(prefix)/man
+
+#### End of system configuration section. ####
+
+SUBDIRS = libttf src
+
+# Set default target.
+all:
+
+.PHONY: all install uninstall
+all check install uninstall: config.h Makefile all-local
+ @for subdir in $(SUBDIRS); do \
+ echo "making $@ in $$subdir"; \
+ ( cd $$subdir && $(MAKE) $(FLAGS_TO_PASS) $@ ) || exit 1; \
+ done
+
+.PHONY: all-local
+all-local:
+
+.PHONY: clean
+clean: clean-local
+ @for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir && $(MAKE) $(FLAGS_TO_PASS) $@ || exit 1; cd ..; done
+
+.PHONY: distclean
+distclean: distclean-local
+ @for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir && $(MAKE) $(FLAGS_TO_PASS) $@ || exit 1; cd ..; done
+ rm -f config.status
+
+.PHONY: realclean
+realclean: realclean-local
+ @for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir && $(MAKE) $(FLAGS_TO_PASS) $@ || exit 1; cd ..; done
+ rm -f config.status
+
+.PHONY: mostlyclean-local
+mostlyclean-local:
+ rm -f *~
+
+.PHONY: clean-local
+clean-local: mostlyclean-local
+
+.PHONY: distclean-local
+distclean-local: clean-local
+ rm -f Makefile config.cache config.h config.log stamp-h
+ rm -f tags TAGS
+
+.PHONY: realclean-local
+realclean-local: distclean-local
+
+#distclean: clean
+# rm -f Makefile config.log config.cache config.status config.h stamp-h *~
+
+# For the justification of the following Makefile rules, see node
+# `Automatic Remaking' in GNU Autoconf documentation.
+Makefile: Makefile.in config.status
+ CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
+config.status: configure
+ ./config.status --recheck
+# The rules to run autoconf and autoheader are commented out. This is because
+# when the user unpacks a tarfile, configure.in might end up newer than
+# configure, but the user might not have (and does not need to have) autoconf
+# installed.
+#configure: configure.in #aclocal.m4
+# cd $(srcdir); autoconf
+
+config.h: stamp-h
+
+# This used to do a ./config.status --recheck, to update config.status with
+# any new #defines from config.h.in. The problem was that the rule itself
+# depends on config.status, so that the --recheck would get run several
+# times, which is bad if the user was trying to specify CFLAGS manually.
+# It was a big pain in the neck.
+stamp-h: config.h.in config.status
+ CONFIG_FILES=$@ CONFIG_HEADERS=config.h ./config.status
+
+#config.h.in: stamp-h.in
+#stamp-h.in: configure.in #aclocal.m4 acconfig.h
+# cd $(srcdir); autoheader
+# date > $(srcdir)/stamp-h.in \ No newline at end of file
diff --git a/Build/source/texk/ttfdump/NOTE b/Build/source/texk/ttfdump/NOTE
new file mode 100644
index 00000000000..2c5a5365bfc
--- /dev/null
+++ b/Build/source/texk/ttfdump/NOTE
@@ -0,0 +1,8 @@
+
+The phases of rendering a True Type font glyph
+phase 1. loading
+phase 2. scale from FUnit space to pixel space
+phase 3. instruction are appleid
+phase 4. subdivision of curve into line segments
+phase 5. scan-convert -- filling polygons
+phase 6. drop out control \ No newline at end of file
diff --git a/Build/source/texk/ttfdump/README b/Build/source/texk/ttfdump/README
new file mode 100644
index 00000000000..4dd3fccbf88
--- /dev/null
+++ b/Build/source/texk/ttfdump/README
@@ -0,0 +1,70 @@
+Introduction
+ Ttfdump is a TrueType font dumper. The man purpose of ttfdump is to
+dump the various table in a TrueType font file in ASCII form. Ttfdump is the
+first step in my ILX (Internationalized and Localized X-window) project. For
+more information about ILX project please read the file ILX.
+
+Features
+ Now ttfdump can load and parse all the required tables and most of the
+optional tables defined in the TrueType Specification. The following is a list
+of tables that ttfdump currently implemented.
+
+ Required Tables Optional Tables
+ cmap cvt
+ glyf@ fpgm@
+ head gasp
+ hhea hdmx
+ hmtx kern*
+ loca LTSH
+ maxp prep@
+ name VDMX
+ post vhea*
+ OS/2 vmtx*
+
+ Note:
+ *: The tables with "*" marks are newly implemented in this
+ version.
+ @: The tables with "@" marks are partialy implemented in this
+ version.
+
+File List:
+ ttfdump-0.5.0/
+ |
+ |
+ |---- include/*.h included header file
+ |
+ |
+ |---- libttf/*.c c programs for ttfdump
+ |
+ |
+ |---- src/ttfdump.c the main program
+
+Installation:
+ Ttfdump is integrated with Autoconf so it is very easy to compile the
+package. You need only type configure in the top directory and then make.
+
+Usage:
+ Ttfdump now has better command line options and is easier to use.
+
+ To dump all information in the TrueType font file times.ttf:
+ ttfdump times.ttf
+ To dump the required table \fIcmap\fP in the file:
+ ttfdump -t cmap times.ttf
+ To dump a single glyph with index 50:
+ ttfdump -g 50 times.ttf
+
+Portabality:
+ Ttfdump has been tested under those platforms:
+
+ Linux 2.0.9
+ OSF1 V3.0
+ AIX 3.2.5
+ IRIX 5.3
+
+Avaliablity:
+ Ttfdump can be downloaded form the URL
+ ftp://sansan.phy.ncu.edu.tw/pub/ttfdump/
+
+BUGS report:
+ Please send any bugs report or suggestion to ollie@ms1.hinet.net
+
diff --git a/Build/source/texk/ttfdump/README.bg5 b/Build/source/texk/ttfdump/README.bg5
new file mode 100644
index 00000000000..17e2404f27d
--- /dev/null
+++ b/Build/source/texk/ttfdump/README.bg5
@@ -0,0 +1,52 @@
+Subject: ¤½§i: ttfdump-0.5.5 -- TrueType ¶É¦Lµ{¦¡
+Newsgroups: tw.bbs.comp.linux tw.bbs.comp.unix tw.bbs.comp.tex tw.bbs.comp.xwindow
+Summary:
+Keywords: TrueType font, X fonts server
+
+ ¤j®a¦n!!³oª©ªº ttfdump ¤S·s¼W¥[¤F¤@¨Ç optional tables ,¦P®É¤]§ï¶iªº
+command line option ªº¥\¯àÅý¨Ï¥ÎªÌ¯à§ó¤è«K¦a¶É¦L¥X TrueType font fileªº¤º®e.
+°£¦¹¤§¥~ÁÙ¦h¤F man page ªº»¡©ú¤å¥ó
+
+Introduction:
+ Ttfdump ¬O¤@­Ó TrueType font file ªº¶É¦Lµ{¦¡,¨ä¥D­n¥\¥Î¦b©ó±N­ì¥ý¥H¤G¶i
+¨î©Ò³B¦sªº¦r«¬¸ê®Æ¥H¤å¦rªº¤è¦¡¦C¦L.
+
+Features:
+ Ttfdump ¥Ø«e¥i¥H¶É¦L¥H¤Uªº table.
+
+ Required Tables Optional Tables
+ cmap cvt
+ glyf@ fpgm@
+ head gasp
+ hhea hdmx
+ hmtx LTSH
+ loca prep@
+ maxp VDMX
+ name
+ post
+ OS/2
+
+ Note:
+ *: The tables with "*" marks are newly implemented in this
+ version.
+ @: The tables with "@" marks are partialy implemented in this
+ version.
+
+Installation:
+ Ttfdump §Q¥Î¤F Autoconf ¨Ó¼W¥[²¾´Ó©Ê,¥u»Ý­n¦b½sĶ«e¤U¹F configure ªº©R
+¥O,±µµÛ¦A¥´ make §Y¥i
+
+
+Portabality:
+ ttfdump ¤w¸g¦b¥H¤Uªº¨t²Î¤¤½sĶ¤Î´ú¸Õ¹L
+ Linux 2.0.9
+ OSF1 V3.0
+ AIX 3.2.5
+ IRIX 5.3
+
+Avaliablity:
+ ttfdump ¥i¥H¦b³o¸Ì download
+ ftp://sansan.phy.ncu.edu.tw/pub/ttfdump/
+
+BUGS report:
+ ¦pªG¤j®a¦³¥ô¦ó·N¨£Åwªï e-mail ¦Ü ollie@ms1.hinet.net
diff --git a/Build/source/texk/ttfdump/TODO b/Build/source/texk/ttfdump/TODO
new file mode 100644
index 00000000000..a5d8f532f70
--- /dev/null
+++ b/Build/source/texk/ttfdump/TODO
@@ -0,0 +1,29 @@
+v. 0.45
+glyf.c:
+ how to deal with zero contours and zero instructions ??
+cmap.c:
+ format 2 4 6
+post.c:
+ format 2.0 ,2.5
+os2 table
+
+table init methods are not implemented
+modify Makefile
+remove possibel memory leak by dmalloc
+check the program by lint
+problem:
+ the various tables have interdependency with each other, how can we de-couple them ??
+ should the table init method load the entries of each table ?? or just return a memory
+ space ??
+ should we change the interface from xxxYYYZZZ(file,ZZZ,ofset) into
+ xxxYYYZZZ(TTFontPtr font) ??
+v 0.5
+try to port to different machine
+use autoconf
+optional tables
+
+instruction dissasembler
+instruction interpreter
+final layer of abstraction for TTFont structure
+
+glyph and bitmap buffer cache \ No newline at end of file
diff --git a/Build/source/texk/ttfdump/config.h.in b/Build/source/texk/ttfdump/config.h.in
new file mode 100644
index 00000000000..4740da0d039
--- /dev/null
+++ b/Build/source/texk/ttfdump/config.h.in
@@ -0,0 +1,28 @@
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* Define as __inline if that's what the C compiler calls it. */
+#undef inline
+
+/* Define if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define if your processor stores words with the most significant
+ byte first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
+
+/* The number of bytes in a int. */
+#undef SIZEOF_INT
+
+/* The number of bytes in a long. */
+#undef SIZEOF_LONG
+
+/* The number of bytes in a long long. */
+#undef SIZEOF_LONG_LONG
+
+/* Define if you have the strstr function. */
+#undef HAVE_STRSTR
+
+#ifdef WIN32
+#include <kpathsea/c-auto.h>
+#include <kpathsea/c-memstr.h>
+#endif \ No newline at end of file
diff --git a/Build/source/texk/ttfdump/configure b/Build/source/texk/ttfdump/configure
new file mode 100644
index 00000000000..1a5bfefac9e
--- /dev/null
+++ b/Build/source/texk/ttfdump/configure
@@ -0,0 +1,1909 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+ac_config_files=
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: invalid variable name: $ac_envvar" 1>&2; exit 1; }
+ fi
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=include/ttf.h
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:540: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:571: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:623: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:656: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 667 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:698: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:703: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:712: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:731: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ case $ac_dir in
+ /*|[A-z]:/*) ac_aux_dir=$ac_dir;;
+ *) ac_aux_dir=`pwd`/$ac_dir;;
+ esac
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ case $ac_dir in
+ /*|[A-z]:/*) ac_aux_dir=$ac_dir;;
+ *) ac_aux_dir=`pwd`/$ac_dir;;
+ esac
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:799: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ # Hack for MSDOS and descendants.
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test $ac_x $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:856: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:885: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:914: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 929 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:935: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 946 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:952: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 963 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:969: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:994: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 999 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1007: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1024 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1042 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1063 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:1074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+
+
+echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
+echo "configure:1100: checking whether byte ordering is bigendian" >&5
+if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_c_bigendian=unknown
+# See if sys/param.h defines the BYTE_ORDER macro.
+cat > conftest.$ac_ext <<EOF
+#line 1107 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:1118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+cat > conftest.$ac_ext <<EOF
+#line 1122 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:1133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_bigendian=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_c_bigendian=no
+fi
+rm -f conftest*
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+if test $ac_cv_c_bigendian = unknown; then
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1153 "configure"
+#include "confdefs.h"
+main () {
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long l;
+ char c[sizeof (long)];
+ } u;
+ u.l = 1;
+ exit (u.c[sizeof (long) - 1] == 1);
+}
+EOF
+if { (eval echo configure:1166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_c_bigendian=no
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_c_bigendian=yes
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_c_bigendian" 1>&6
+if test $ac_cv_c_bigendian = yes; then
+ cat >> confdefs.h <<\EOF
+#define WORDS_BIGENDIAN 1
+EOF
+
+fi
+
+echo $ac_n "checking size of int""... $ac_c" 1>&6
+echo "configure:1190: checking size of int" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1198 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(int));
+ exit(0);
+}
+EOF
+if { (eval echo configure:1209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_int=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_int=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_int" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+EOF
+
+
+echo $ac_n "checking size of long""... $ac_c" 1>&6
+echo "configure:1229: checking size of long" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1237 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(long));
+ exit(0);
+}
+EOF
+if { (eval echo configure:1248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_long=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_long=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_long" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+EOF
+
+
+echo $ac_n "checking size of long long""... $ac_c" 1>&6
+echo "configure:1268: checking size of long long" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1276 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(long long));
+ exit(0);
+}
+EOF
+if { (eval echo configure:1287: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_long_long=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_long_long=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+EOF
+
+
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:1307: checking for inline" >&5
+if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat > conftest.$ac_ext <<EOF
+#line 1314 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:1321: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_inline=$ac_kw; break
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+
+fi
+
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+ inline | yes) ;;
+ no) cat >> confdefs.h <<\EOF
+#define inline
+EOF
+ ;;
+ *) cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
+EOF
+ ;;
+esac
+
+
+for ac_func in strstr
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1350: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1355 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1378: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+ac_config_files="$ac_config_files libttf/Makefile src/Makefile Makefile"
+
+trap 'rm -fr `echo "$ac_config_files config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@CC@%$CC%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@RANLIB@%$RANLIB%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@CPP@%$CPP%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"$ac_config_files"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*|[A-z]:/*) # Absolute path.
+ srcdir="$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ "") ;;
+ [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ rm -f conftest.in
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"`
+ cat $ac_file_inputs > conftest.in
+ #
+ # Replace lines of the form ac_include foo with the contents of foo:
+ # first, from the ac_include lines construct a list of file names.
+ # From that list, we construct a second list of those files that exist.
+ # Then we construct lists of sed commands for including those files,
+ # and a sed command that removes the ac_include lines. We don't attempt
+ # to read non-existent files because some (buggy) versions of sed choke
+ # on this. Have to use sed because old (Ultrix, SunOS) awk does not support
+ # getline or system. (Anyway, configure scripts aren't supposed to use awk.)
+ # Can't use only one -e and commands {dr foo} because foo has to be last.
+ # Be careful, because the filename may contain /. Be careful with
+ # whitespace; we need to use echo.
+ #
+ file_substs=`sed -n '/^ac_include/s%ac_include[ ]*\(.*\)%\1%p' conftest.in`
+ # Create the sed command line ...
+ if test -n "$file_substs"; then
+ echo "configure: warning: ac_include is obsolete; instead use kpse_include" 1>&2
+ file_subst_cmd="sed -e 's/^ac_include/kpse_include/'"
+ else
+ file_subst_cmd='sed'
+ fi
+ kpse_substs=`sed -n '/^kpse_include/s%kpse_include[ ]*\(.*\)%\1%p' conftest.in`
+ for ac_inc in $file_substs $kpse_substs; do
+ if test -f "$ac_given_srcdir/$ac_inc"; then
+ ac_mung=`echo $ac_inc | sed 's,/,%,g'`
+ file_subst_cmd="$file_subst_cmd -e '/^kpse_include $ac_mung$/r $ac_given_srcdir/$ac_inc'"
+ fi
+ done
+ file_subst_cmd="$file_subst_cmd -e '/^kpse_include/d'"
+ # ... and fix the whitespace and escaped slashes.
+ file_subst_cmd=`echo "$file_subst_cmd" | sed -e 's,%,\\\/,g' \
+-e 's/kpse_include /kpse_include[ ]*/g'`
+ # I can't find any way to do variable substitution in the sed commands
+ # (so the user could have, e.g., $top_srcdir in their ac_include line).
+ (eval $file_subst_cmd conftest.in) \
+ | sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s* conftest.in
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ].*$%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS=" config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+
+test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+if test "$no_recursion" != yes; then
+
+ # Remove --cache-file and --srcdir arguments so they do not pile up.
+ ac_sub_configure_args=
+ ac_prev=
+ for ac_arg in $ac_configure_args; do
+ if test -n "$ac_prev"; then
+ ac_prev=
+ continue
+ fi
+ case "$ac_arg" in
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ ;;
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ ;;
+ *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
+ esac
+ done
+
+ for ac_config_dir in : $subdirs; do
+
+ # Do not complain, so a configure script can configure whichever
+ # parts of a large source tree are present.
+ if test ! -d $srcdir/$ac_config_dir; then
+ continue
+ fi
+
+ echo configuring in $ac_config_dir
+
+ case "$srcdir" in
+ .) ;;
+ *)
+ if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :;
+ else
+ { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; }
+ fi
+ ;;
+ esac
+
+ ac_popdir=`pwd`
+ cd $ac_config_dir
+
+ # A "../" for each directory in /$ac_config_dir.
+ ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
+
+ case "$srcdir" in
+ .) # No --srcdir option. We are building in place.
+ ac_sub_srcdir=$srcdir ;;
+ /*|[A-z]:/*) # Absolute path.
+ ac_sub_srcdir=$srcdir/$ac_config_dir ;;
+ *) # Relative path.
+ ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
+ esac
+
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f ./configure; then
+ ac_sub_configure=./configure
+ elif test -f $ac_sub_srcdir/configure; then
+ ac_sub_configure=$ac_sub_srcdir/configure
+ elif test -f $ac_sub_srcdir/configure.in; then
+ ac_sub_configure=$ac_configure
+ else
+ echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2
+ ac_sub_configure=
+ fi
+
+ # The recursion is here.
+ if test -n "$ac_sub_configure"; then
+
+ # Make the cache file name correct relative to the subdirectory.
+ case "$cache_file" in
+ /*|[A-z]:/*) ac_sub_cache_file=$cache_file ;;
+ *) # Relative path.
+ ac_sub_cache_file="$ac_dots$cache_file" ;;
+ esac
+ case "$ac_given_INSTALL" in
+ "") ;;
+ [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir"
+ # The eval makes quoting arguments work.
+ if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
+ then :
+ else
+ { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; }
+ fi
+ fi
+
+ cd $ac_popdir
+ done
+fi
+
diff --git a/Build/source/texk/ttfdump/configure.in b/Build/source/texk/ttfdump/configure.in
new file mode 100644
index 00000000000..b8045b7c8d5
--- /dev/null
+++ b/Build/source/texk/ttfdump/configure.in
@@ -0,0 +1,29 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(include/ttf.h)
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_RANLIB
+AC_PROG_MAKE_SET
+
+dnl Checks for libraries.
+
+dnl Checks for header files.
+AC_HEADER_STDC
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CROSS
+AC_C_BIGENDIAN
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
+AC_C_INLINE
+
+dnl Checks for library functions.
+AC_CHECK_FUNCS(strstr)
+
+
+AC_CONFIG_HEADER(config.h)
+AC_OUTPUT(libttf/Makefile src/Makefile Makefile,
+[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])
diff --git a/Build/source/texk/ttfdump/docs/ttfdump.1 b/Build/source/texk/ttfdump/docs/ttfdump.1
new file mode 100644
index 00000000000..e3916ecb211
--- /dev/null
+++ b/Build/source/texk/ttfdump/docs/ttfdump.1
@@ -0,0 +1,124 @@
+.TH TTFDUMP 1 "18 Feb 1997" "ILX Project"
+.SH NAME
+ttfdump \- Dumping the contents of a TrueType Font file
+.SH SYNOPSIS
+\fBttfdump\fR [-h] [-t \fItablename\fP] [-g \fIglyphnumber\fP] [-c \fIcollection\fP] [-i] \fIttfile\fR [-o \fIdumpfile\fR]
+.SH DESCRIPTION
+\fBttfdump\fP dumps the contents of a TrueType font file in ASCII form.
+A TrueType font file is consist of various tables. Those table are divided into
+two categories - \fIRequired Tables\fP and \fIOptional Tables\fP. Mulitiple
+TrueType fonts and be merged to a TrueType Collection.
+.SS Options
+.TP
+\fB-h\fP
+Print a help message on standard output and exit.
+.TP
+\fB-t\fI tablename\fR
+If this option is specified then dump the table \fI"tablename"\fP, otherwise
+dump every tables in \fIttfile\fP.
+\fITablename\fP can be one of the following:
+.RS
+.TP
+\fBRequired Tables\fR
+.TP
+\fIcmap\fP
+character to glhph mapping table
+.TP
+\fIglyf\fP
+glyph data
+.TP
+\fIhead\fP
+font header
+.TP
+\fIhhea\fP
+horizontal header
+.TP
+\fIhmtx\fP
+horizontal metrics
+.TP
+\fIloca\fP
+index to location
+.TP
+\fImaxp\fP
+maximum profile
+.TP
+\fIname\fP
+naming table
+.TP
+\fIpost\fP
+PostScript information
+.TP
+\fIOS/2\fP
+OS/2 and windows specific metrics
+.TP
+\fBOptional Tables\fR
+.TP
+\fIcvt\fP
+control value table
+.TP
+\fIfpgm\fP
+font program; \fInot implemented yet.\fP
+.TP
+\fIgasp\fP
+grid-fitting and scan conversion procedure (grayscale)
+.TP
+\fIhdmx\fP
+horizontal device metrics
+.TP
+\fIkern\fP
+kerning table
+.TP
+\fILTSH\fP
+Linear threshold table
+.TP
+\fIprep\fP
+CVT program; \fInot implemented yet\fP
+.TP
+\fIPCLT\fP
+PCL5 table
+.TP
+\fIVDMX\fP
+Vertical Device Metrics table
+.TP
+\fIvhea\fP
+vertical metrics header
+.TP
+\fIvmtx\fP
+vertical metrics
+.RE
+.TP
+\fB-g\fI glyphnumber\fR
+If this option is specified then dump the glyph with index \fIglyphnumber\fP,
+otherwise dump all glyphs in \fIttfile\fP.
+.TP
+\fB-c\fI collection\fR
+Select a TrueType font in a TrueType Collection.
+.TP
+\fB-i\fI ttfile\fR
+TrueType font file to be dumped.
+.TP
+\fB-o\fI dumpfile\fR
+Output of the dump. If this option is not specified, dump to stdout.
+.RE
+.SH EXAMPLE
+To dump all information in the TrueType font file times.ttf:
+.RS
+ttfdump times.ttf
+.RE
+
+To dump the required table \fIcmap\fP in the file:
+.RS
+ttfdump -t cmap times.ttf
+.RE
+
+To dump a single glyph with index 50:
+.RS
+ttfdump -g 50 times.ttf
+.RE
+
+.SH SEE ALSO
+TrueType 1.0 Font Files, \fI Technical Specification Revision 1.66 November 1995\fR
+.SH NOTE
+Instruction disassembler in not implemented.
+.SH AOTHOR
+Li-Da Lho, ollie@ms1.hinet.net
diff --git a/Build/source/texk/ttfdump/docs/ttfdump.dvi b/Build/source/texk/ttfdump/docs/ttfdump.dvi
new file mode 100644
index 00000000000..0eaad1723c3
--- /dev/null
+++ b/Build/source/texk/ttfdump/docs/ttfdump.dvi
Binary files differ
diff --git a/Build/source/texk/ttfdump/docs/ttfdump.html b/Build/source/texk/ttfdump/docs/ttfdump.html
new file mode 100644
index 00000000000..650fe4f0b6f
--- /dev/null
+++ b/Build/source/texk/ttfdump/docs/ttfdump.html
@@ -0,0 +1,169 @@
+<!-- manual page source format generated by PolyglotMan v3.0.9, -->
+<!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->
+
+<HTML>
+<HEAD>
+<TITLE> manual page</TITLE>
+</HEAD>
+<BODY bgcolor=white>
+<A HREF="#toc">Table of Contents</A><P>
+
+<H2><A NAME="sect0" HREF="#toc0">Name</A></H2>
+ttfdump - Dumping the contents of a TrueType Font file
+<H2><A NAME="sect1" HREF="#toc1">Synopsis</A></H2>
+<B>ttfdump</B>
+[-h] [-t <I>tablename</I>] [-g <I>glyphnumber</I>] [-c <I>collection</I>] [-i] <I>ttfile</I> [-o <I>dumpfile</I>]
+
+<H2><A NAME="sect2" HREF="#toc2">Description</A></H2>
+<B>ttfdump</B> dumps the contents of a TrueType font file in ASCII
+form. A TrueType font file is consist of various tables. Those table are
+divided into two categories - <I>Required Tables</I> and <I>Optional Tables</I>. Mulitiple
+ TrueType fonts and be merged to a TrueType Collection.
+<H3><A NAME="sect3" HREF="#toc3">Options</A></H3>
+
+<DL>
+
+<DT><B>-h</B> </DT>
+<DD>Print a
+help message on standard output and exit. </DD>
+
+<DT><B>-t<I> tablename</I></B> </DT>
+<DD>If this option is
+specified then dump the table <I>"tablename"</I>, otherwise dump every tables
+in <I>ttfile</I>. <I>Tablename</I> can be one of the following: <blockquote></DD>
+
+<DT><B>Required Tables</B> </DT>
+<DD></DD>
+
+<DT><I>cmap</I>
+</DT>
+<DD>character to glhph mapping table </DD>
+
+<DT><I>glyf</I> </DT>
+<DD>glyph data </DD>
+
+<DT><I>head</I> </DT>
+<DD>font header </DD>
+
+<DT><I>hhea</I>
+</DT>
+<DD>horizontal header </DD>
+
+<DT><I>hmtx</I> </DT>
+<DD>horizontal metrics </DD>
+
+<DT><I>loca</I> </DT>
+<DD>index to location </DD>
+
+<DT><I>maxp</I> </DT>
+<DD>maximum
+profile </DD>
+
+<DT><I>name</I> </DT>
+<DD>naming table </DD>
+
+<DT><I>post</I> </DT>
+<DD>PostScript information </DD>
+
+<DT><I>OS/2</I> </DT>
+<DD>OS/2 and windows
+specific metrics </DD>
+
+<DT><B>Optional Tables</B> </DT>
+<DD></DD>
+
+<DT><I>cvt</I> </DT>
+<DD>control value table </DD>
+
+<DT><I>fpgm</I> </DT>
+<DD>font program;
+<I>not implemented yet.</I> </DD>
+
+<DT><I>gasp</I> </DT>
+<DD>grid-fitting and scan conversion procedure (grayscale)
+</DD>
+
+<DT><I>hdmx</I> </DT>
+<DD>horizontal device metrics </DD>
+
+<DT><I>kern</I> </DT>
+<DD>kerning table </DD>
+
+<DT><I>LTSH</I> </DT>
+<DD>Linear threshold
+table </DD>
+
+<DT><I>prep</I> </DT>
+<DD>CVT program; <I>not implemented yet</I> </DD>
+
+<DT><I>PCLT</I> </DT>
+<DD>PCL5 table </DD>
+
+<DT><I>VDMX</I> </DT>
+<DD>Vertical
+Device Metrics table </DD>
+
+<DT><I>vhea</I> </DT>
+<DD>vertical metrics header </DD>
+
+<DT><I>vmtx</I> </DT>
+<DD></DD>
+</DL>
+vertical metrics
+</blockquote>
+
+<DL>
+
+<DT><B>-g<I> glyphnumber</I></B> </DT>
+<DD>If this option is specified then dump the glyph with index
+<I>glyphnumber</I>, otherwise dump all glyphs in <I>ttfile</I>. </DD>
+
+<DT><B>-c<I> collection</I></B> </DT>
+<DD>Select a
+TrueType font in a TrueType Collection. </DD>
+
+<DT><B>-i<I> ttfile</I></B> </DT>
+<DD>TrueType font file to be
+dumped. </DD>
+
+<DT><B>-o<I> dumpfile</I></B> </DT>
+<DD>Output of the dump. If this option is not specified, dump
+to stdout. </DD>
+</DL>
+</blockquote>
+
+<H2><A NAME="sect4" HREF="#toc4">Example</A></H2>
+To dump all information in the TrueType font file times.ttf:
+<blockquote>ttfdump times.ttf </blockquote>
+<P>
+ To dump the required table <I>cmap</I> in the file: <blockquote>ttfdump
+-t cmap times.ttf </blockquote>
+<P>
+ To dump a single glyph with index 50: <blockquote>ttfdump -g 50 times.ttf
+</blockquote>
+<P>
+
+<H2><A NAME="sect5" HREF="#toc5">See Also</A></H2>
+TrueType 1.0 Font Files, <I> Technical Specification Revision 1.66
+November 1995</I>
+<H2><A NAME="sect6" HREF="#toc6">Note</A></H2>
+Instruction disassembler in not implemented.
+<H2><A NAME="sect7" HREF="#toc7">Aothor</A></H2>
+Li-Da
+Lho, ollie@ms1.hinet.net <P>
+
+<HR><P>
+<A NAME="toc"><B>Table of Contents</B></A><P>
+<UL>
+<LI><A NAME="toc0" HREF="#sect0">Name</A></LI>
+<LI><A NAME="toc1" HREF="#sect1">Synopsis</A></LI>
+<LI><A NAME="toc2" HREF="#sect2">Description</A></LI>
+<UL>
+<LI><A NAME="toc3" HREF="#sect3">Options</A></LI>
+</UL>
+<LI><A NAME="toc4" HREF="#sect4">Example</A></LI>
+<LI><A NAME="toc5" HREF="#sect5">See Also</A></LI>
+<LI><A NAME="toc6" HREF="#sect6">Note</A></LI>
+<LI><A NAME="toc7" HREF="#sect7">Aothor</A></LI>
+</UL>
+</BODY></HTML>
diff --git a/Build/source/texk/ttfdump/docs/ttfdump.ps b/Build/source/texk/ttfdump/docs/ttfdump.ps
new file mode 100644
index 00000000000..71bed265f30
--- /dev/null
+++ b/Build/source/texk/ttfdump/docs/ttfdump.ps
@@ -0,0 +1,282 @@
+%!PS-Adobe-3.0
+%%Creator: groff version 1.10
+%%CreationDate: Thu Mar 04 15:39:20 1999
+%%DocumentNeededResources: font Times-Roman
+%%+ font Times-Bold
+%%+ font Times-Italic
+%%DocumentSuppliedResources: procset grops 1.10 0
+%%Pages: 2
+%%PageOrder: Ascend
+%%Orientation: Portrait
+%%EndComments
+%%BeginProlog
+%%BeginResource: procset grops 1.10 0
+/setpacking where{
+pop
+currentpacking
+true setpacking
+}if
+/grops 120 dict dup begin
+/SC 32 def
+/A/show load def
+/B{0 SC 3 -1 roll widthshow}bind def
+/C{0 exch ashow}bind def
+/D{0 exch 0 SC 5 2 roll awidthshow}bind def
+/E{0 rmoveto show}bind def
+/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
+/G{0 rmoveto 0 exch ashow}bind def
+/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/I{0 exch rmoveto show}bind def
+/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
+/K{0 exch rmoveto 0 exch ashow}bind def
+/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/M{rmoveto show}bind def
+/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
+/O{rmoveto 0 exch ashow}bind def
+/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/Q{moveto show}bind def
+/R{moveto 0 SC 3 -1 roll widthshow}bind def
+/S{moveto 0 exch ashow}bind def
+/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/SF{
+findfont exch
+[exch dup 0 exch 0 exch neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/MF{
+findfont
+[5 2 roll
+0 3 1 roll
+neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/level0 0 def
+/RES 0 def
+/PL 0 def
+/LS 0 def
+/MANUAL{
+statusdict begin/manualfeed true store end
+}bind def
+/PLG{
+gsave newpath clippath pathbbox grestore
+exch pop add exch pop
+}bind def
+/BP{
+/level0 save def
+1 setlinecap
+1 setlinejoin
+72 RES div dup scale
+LS{
+90 rotate
+}{
+0 PL translate
+}ifelse
+1 -1 scale
+}bind def
+/EP{
+level0 restore
+showpage
+}bind def
+/DA{
+newpath arcn stroke
+}bind def
+/SN{
+transform
+.25 sub exch .25 sub exch
+round .25 add exch round .25 add exch
+itransform
+}bind def
+/DL{
+SN
+moveto
+SN
+lineto stroke
+}bind def
+/DC{
+newpath 0 360 arc closepath
+}bind def
+/TM matrix def
+/DE{
+TM currentmatrix pop
+translate scale newpath 0 0 .5 0 360 arc closepath
+TM setmatrix
+}bind def
+/RC/rcurveto load def
+/RL/rlineto load def
+/ST/stroke load def
+/MT/moveto load def
+/CL/closepath load def
+/FL{
+currentgray exch setgray fill setgray
+}bind def
+/BL/fill load def
+/LW/setlinewidth load def
+/RE{
+findfont
+dup maxlength 1 index/FontName known not{1 add}if dict begin
+{
+1 index/FID ne{def}{pop pop}ifelse
+}forall
+/Encoding exch def
+dup/FontName exch def
+currentdict end definefont pop
+}bind def
+/DEFS 0 def
+/EBEGIN{
+moveto
+DEFS begin
+}bind def
+/EEND/end load def
+/CNT 0 def
+/level1 0 def
+/PBEGIN{
+/level1 save def
+translate
+div 3 1 roll div exch scale
+neg exch neg exch translate
+0 setgray
+0 setlinecap
+1 setlinewidth
+0 setlinejoin
+10 setmiterlimit
+[]0 setdash
+/setstrokeadjust where{
+pop
+false setstrokeadjust
+}if
+/setoverprint where{
+pop
+false setoverprint
+}if
+newpath
+/CNT countdictstack def
+userdict begin
+/showpage{}def
+}bind def
+/PEND{
+clear
+countdictstack CNT sub{end}repeat
+level1 restore
+}bind def
+end def
+/setpacking where{
+pop
+setpacking
+}if
+%%EndResource
+%%IncludeResource: font Times-Roman
+%%IncludeResource: font Times-Bold
+%%IncludeResource: font Times-Italic
+grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
+def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron
+/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
+/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
+/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
+/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
+/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
+/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
+/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
+/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
+/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
+/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
+/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
+/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
+/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
+/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
+/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
+/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
+/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
+/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
+/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
+/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
+/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
+/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
+/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
+/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE
+/Times-Roman@0 ENC0/Times-Roman RE
+%%EndProlog
+%%Page: 1 1
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman@0 SF 348.84(TTFDUMP\(1\) TTFDUMP\(1\))72 48 R/F1 9
+/Times-Bold@0 SF -.18(NA)72 84 S(ME).18 E F0
+(ttfdump \255 Dumping the contents of a T)108 96 Q(rueT)-.35 E(ype F)-.8
+E(ont \214le)-.15 E F1(SYNOPSIS)72 112.8 Q/F2 10/Times-Bold@0 SF
+(ttfdump)108 124.8 Q F0([-h] [-t)2.5 E/F3 10/Times-Italic@0 SF
+(tablename)2.5 E F0 2.5(][)C(-g)-2.5 E F3(glyphnumber)2.5 E F0 2.5(][)C
+(-c)-2.5 E F3(collection)2.5 E F0 2.5(][)C(-i])-2.5 E F3(tt\214le)2.5 E
+F0([-o)2.5 E F3(dump\214le)2.5 E F0(])A F1(DESCRIPTION)72 141.6 Q F2
+(ttfdump)108 153.6 Q F0 .169(dumps the contents of a T)2.669 F(rueT)-.35
+E .169(ype font \214le in ASCII form.)-.8 F 2.669(AT)5.169 G(rueT)-3.019
+E .169(ype font \214le is consist of v)-.8 F(ari-)-.25 E 1.149
+(ous tables. Those table are di)108 165.6 R 1.149(vided into tw)-.25 F
+3.649(oc)-.1 G(ate)-3.649 E 1.149(gories -)-.15 F F3(Requir)3.649 E 1.15
+(ed T)-.37 F(ables)-.92 E F0(and)3.65 E F3 1.15(Optional T)3.65 F(ables)
+-.92 E F0 3.65(.M)C(ulitiple)-3.65 E -.35(Tr)108 177.6 S(ueT).35 E
+(ype fonts and be mer)-.8 E(ged to a T)-.18 E(rueT)-.35 E
+(ype Collection.)-.8 E F2(Options)87 194.4 Q(-h)108 206.4 Q F0
+(Print a help message on standard output and e)27.11 E(xit.)-.15 E F2
+(-t)108 223.2 Q F3(tablename)2.5 E F0 .702
+(If this option is speci\214ed then dump the table)144 235.2 R F3
+("tablename")3.202 E F0 3.202(,o)C .702(therwise dump e)-3.202 F -.15
+(ve)-.25 G .702(ry tables in).15 F F3(tt\214le)3.202 E F0(.)A F3 -.92
+(Ta)144 247.2 S(blename).92 E F0(can be one of the follo)2.5 E(wing:)
+-.25 E F2(Requir)144 264 Q(ed T)-.18 E(ables)-.92 E F3(cmap)144 280.8 Q
+F0(character to glhph mapping table)14.34 E F3(glyf)144 297.6 Q F0
+(glyph data)21 E F3(head)144 314.4 Q F0(font header)16.56 E F3(hhea)144
+331.2 Q F0(horizontal header)16.56 E F3(hmtx)144 348 Q F0
+(horisontal metrics)16.56 E F3(loca)144 364.8 Q F0(inde)18.78 E 2.5(xt)
+-.15 G 2.5(ol)-2.5 G(ocation)-2.5 E F3(maxp)144 381.6 Q F0
+(maximum pro\214le)14.34 E F3(name)144 398.4 Q F0(naming table)14.34 E
+F3(post)144 415.2 Q F0(PostScript information)19.33 E F3(OS/2)144 432 Q
+F0(OS/2 and windo)16 E(ws speci\214c metrics)-.25 E F2(Optional T)144
+448.8 Q(ables)-.92 E F3(cvt)144 465.6 Q F0(control v)24.34 E(alue table)
+-.25 E F3(fpgm)144 482.4 Q F0(font program;)16 E F3
+(not implemented yet.)2.5 E(gasp)144 499.2 Q F0
+(grid-\214tting and scan con)17.11 E -.15(ve)-.4 G
+(rsion procedure \(grayscale\)).15 E F3(hdmx)144 516 Q F0(horizontal de)
+14.34 E(vice metrics)-.25 E F3 -.1(ke)144 532.8 S(rn).1 E F0 -.1(ke)
+18.33 G(rning table).1 E F3 -.2(LT)144 549.6 S(SH).2 E F0
+(Linear threshold table)12.86 E F3(pr)144 566.4 Q(ep)-.37 E F0
+(CVT program;)18.04 E F3(not implemented yet)2.5 E(PCL)144 583.2 Q(T)-.2
+E F0(PCL5 table)12.3 E F3(VDMX)144 600 Q F0 -1.11(Ve)8.23 G(rtical De)
+1.11 E(vice Metrics table)-.25 E F3(vhea)144 616.8 Q F0 -.15(ve)17.12 G
+(rtical metrics header).15 E F3(vmtx)144 633.6 Q F0 -.15(ve)17.12 G
+(rtical metrics).15 E F2(-g)108 650.4 Q F3(glyphnumber)2.5 E F0 .077
+(If this option is speci\214ed then dump the glyph with inde)144 662.4 R
+(x)-.15 E F3(glyphnumber)2.578 E F0 2.578(,o)C .078
+(therwise dump all glyphs)-2.578 F(in)144 674.4 Q F3(tt\214le)2.5 E F0
+(.)A F2(-c)108 691.2 Q F3(collection)2.5 E F0(Select a T)144 703.2 Q
+(rueT)-.35 E(ype font in a T)-.8 E(rueT)-.35 E(ype Collection.)-.8 E
+(ILX Project)72 768 Q(18 Feb 1997)161.51 E(1)204 E EP
+%%Page: 2 2
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman@0 SF 348.84(TTFDUMP\(1\) TTFDUMP\(1\))72 48 R/F1 10
+/Times-Bold@0 SF(-i)108 84 Q/F2 10/Times-Italic@0 SF(tt\214le)2.5 E F0
+-.35(Tr)9.61 G(ueT).35 E(ype font \214le to be dumped.)-.8 E F1(-o)108
+100.8 Q F2(dump\214le)2.5 E F0
+(Output of the dump. If this option is not speci\214ed, dump to stdout.)
+144 112.8 Q/F3 9/Times-Bold@0 SF(EXAMPLE)72 129.6 Q F0 1.6 -.8(To d)108
+141.6 T(ump all information in the T).8 E(rueT)-.35 E
+(ype font \214le times.ttf:)-.8 E(ttfdump times.ttf)144 153.6 Q 1.6 -.8
+(To d)108 177.6 T(ump the required table).8 E F2(cmap)2.5 E F0
+(in the \214le:)2.5 E(ttfdump -t cmap times.ttf)144 189.6 Q 1.6 -.8
+(To d)108 213.6 T(ump a single glyph with inde).8 E 2.5(x5)-.15 G(0:)
+-2.5 E(ttfdump -g 50 times.ttf)144 225.6 Q F3(SEE ALSO)72 254.4 Q F0
+-.35(Tr)108 266.4 S(ueT).35 E(ype 1.0 F)-.8 E(ont Files,)-.15 E F2 -.92
+(Te)5 G -.15(ch).92 G(nical Speci\214cation Re).15 E(vision 1.66 No)-.15
+E(vember 1995)-.1 E F3(NO)72 283.2 Q(TE)-.36 E F0
+(Instruction disassembler in not implemented.)108 295.2 Q F3 -1.8 -.405
+(AO T)72 312 T(HOR).405 E F0(Li-Da Lho, ollie@ms1.hinet.net)108 324 Q
+(ILX Project)72 768 Q(18 Feb 1997)161.51 E(2)204 E EP
+%%Trailer
+end
+%%EOF
diff --git a/Build/source/texk/ttfdump/include/gcache.h b/Build/source/texk/ttfdump/include/gcache.h
new file mode 100644
index 00000000000..e8785e306bd
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/gcache.h
@@ -0,0 +1,24 @@
+#ifndef __TTF_GCACHE_H
+#define __TTF_GCACHE_H
+
+#include "tables.h"
+
+/* $Id: gcache.h,v 1.2 1998/07/06 06:07:01 werner Exp $ */
+
+typedef struct _gcache
+{
+ ULONG offset; /* offset of the glyph; this is the key
+ * for sorting/searching with the glyph
+ * cache */
+ struct _gcache *prev, *next; /* pointer to previous and next element on
+ * the LRU list */
+ struct _gcache *left, *right; /* pointer to left and right subtree on
+ * the binary search tree */
+ GLYF glyf; /* the actual place to hold the glyph data */
+}
+GlyphCache, *GlyphCachePtr;
+
+#endif /* __TTF_GCACHE_H */
+
+
+/* end of gcache.h */
diff --git a/Build/source/texk/ttfdump/include/gstate.h b/Build/source/texk/ttfdump/include/gstate.h
new file mode 100644
index 00000000000..b1ed1f840d7
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/gstate.h
@@ -0,0 +1,86 @@
+/* gstate.h -- define data structures for Graphics State, graphics states are
+ * mananged by font instructions.
+ * Copyright (C) 1996 Li-Da Lho, All right reserved.
+ */
+
+#ifndef __TTF_GSTATE_H
+#define __TTF_GSTATE_H
+
+/* $Id: gstate.h,v 1.2 1998/07/06 06:07:01 werner Exp $ */
+
+/* unit vectors used for directional purposes */
+#define F2Dot14_ONE 1<<14
+#define F2Dot14_EPSILON 1
+
+#define F26Dot6_ONE 1L<<26
+#define F26Dot6_EPSILON 1L
+
+typedef struct
+{
+ F2Dot14 x;
+ F2Dot14 y;
+}
+TTFUnitVector;
+
+/* Unit vectors pointing into x and y direction */
+#define UnitX {F2Dot14_ONE,0}
+#define UnitY {0,F2Dot14_ONE}
+
+/* vectors used as positional vectors */
+typedef struct
+{
+ F26Dot6 x;
+ F26Dot6 y;
+}
+TTFVector;
+
+/* the types of the following fields are not well defined in the True Type
+ * Font specification.
+ * We can define them as we like.
+ */
+typedef struct
+{
+ /* boolean values */
+ BYTE auto_flip;
+
+ BYTE scan_control;
+ USHORT instruction_control;
+ SHORT round_state;
+
+ F26Dot6 control_value_cut_in;
+ F26Dot6 minimum_distance;
+ F26Dot6 single_width_cut_in;
+ FWord single_width_value;
+
+ ULONG delta_base;
+ ULONG delta_shift;
+
+ /* unit vectors */
+ TTFUnitVector dual_projection_vector;
+ TTFUnitVector freedom_vector;
+ TTFUnitVector projection_vector;
+
+ /* reference points */
+ ULONG rp0;
+ ULONG rp1;
+ ULONG rp2;
+
+ /* zone pointers: take only 0 or 1 as values */
+ ULONG zp0;
+ ULONG zp1;
+ ULONG zp2;
+
+ SHORT gep0;
+ SHORT gep1;
+ SHORT gep2;
+
+ ULONG loop;
+}
+GraphicsState;
+
+#define GS_DEFAULT
+
+#endif /* __TTF_GSTATE_H */
+
+
+/* end of gstate.h */
diff --git a/Build/source/texk/ttfdump/include/loadtable.h b/Build/source/texk/ttfdump/include/loadtable.h
new file mode 100644
index 00000000000..9bf74f0b5ab
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/loadtable.h
@@ -0,0 +1,105 @@
+#ifndef __TTF_LOADTABLE_H
+#define __TTF_LOADTABLE_H
+
+#include "tables.h"
+
+/* $Id: loadtable.h,v 1.2 1998/07/06 06:07:01 werner Exp $ */
+
+void ttfLoadRequiredTables(TTFontPtr font);
+void ttfFreeRequiredTables(TTFontPtr font);
+void ttfLoadOptionalTables(TTFontPtr font);
+void ttfFreeOptionalTables(TTFontPtr font);
+
+void ttfInitTableDir(TTFontPtr font, ULONG offset);
+void ttfPrintTableDir(FILE *fp, TableDirPtr p);
+void ttfFreeTableDir(TableDirPtr p);
+TableDirPtr ttfLookUpTableDir(ULONG tag, TTFontPtr font);
+
+void ttfInitCMAP(TTFontPtr font);
+void ttfPrintCMAP(FILE *fp, CMAPPtr cmap);
+USHORT ttfLookUpCMAP(SubTablePtr subTable, USHORT cc);
+SubTablePtr ttfSelectCMAP(CMAPPtr cmap, USHORT PlatformID, USHORT EncodingID);
+void ttfFreeCMAP(CMAPPtr cmap);
+
+void ttfInitGLYF(TTFontPtr font);
+void ttfLoadGLYF(FILE *fp, GLYFPtr glyf, ULONG offset);
+void ttfPrintGLYF(FILE *fp, GLYFPtr glyf);
+void ttfFreeGLYF(GLYFPtr glyf);
+GLYFPtr ttfLoadGlyphIndex(TTFont * font, USHORT idx);
+GLYFPtr ttfLoadGlyphCode(TTFont * fnt, USHORT cc);
+
+void ttfInitGlyphCache(TTFontPtr font);
+void ttfCleanUpGlyphCache(TTFontPtr font);
+GLYFPtr ttfLoadGlyphCached(TTFontPtr font, ULONG offset);
+
+void ttfInitHEAD(TTFontPtr font);
+void ttfPrintHEAD(FILE *, HEADPtr head);
+void ttfFreeHEAD(HEADPtr head);
+
+void ttfInitHHEA(TTFontPtr font);
+void ttfPrintHHEA(FILE *fp, HHEAPtr hhea);
+void ttfFreeHHEA(HHEAPtr hhea);
+
+void ttfInitHMTX(TTFontPtr font);
+void ttfPrintHMTX(FILE *fp, HMTXPtr hmtx);
+void ttfFreeHMTX(HMTXPtr hmtx);
+
+void ttfInitLOCA(TTFontPtr font);
+void ttfPrintLOCA(FILE *fp, LOCAPtr loca);
+void ttfFreeLOCA(LOCAPtr loca);
+ULONG ttfLookUpGlyfLOCA(LOCAPtr loca, USHORT idx);
+
+void ttfInitMAXP(TTFontPtr font);
+void ttfPrintMAXP(FILE *fp, MAXPPtr maxp);
+void ttfFreeMAXP(MAXPPtr maxp);
+
+void ttfInitNAME(TTFontPtr font);
+void ttfPrintNAME(FILE *fp, NAMEPtr name);
+void ttfFreeNAME(NAMEPtr name);
+
+void ttfInitPOST(TTFontPtr fot);
+void ttfPrintPOST(FILE *fp, POSTPtr post);
+void ttfFreePOST(POSTPtr post);
+
+void ttfInitOS2(TTFontPtr font);
+void ttfPrintOS2(FILE *fp, OS_2Ptr os2);
+void ttfFreeOS2(OS_2Ptr os2);
+
+void ttfInitCVT(TTFontPtr font);
+void ttfPrintCVT(FILE *fp, FWord * cvt, USHORT cvtLength);
+void ttfFreeCVT(FWord * cvt);
+
+void ttfInitFPGM(TTFontPtr font);
+void ttfPrintFPGM(FILE *fp, BYTE * fpgm, USHORT length);
+void ttfFreeFPGM(BYTE * fpgm);
+
+void ttfInitGASP(TTFontPtr font);
+void ttfPrintGASP(FILE *fp, GASPPtr gasp);
+void ttfFreeGASP(GASPPtr gasp);
+
+void ttfInitHDMX(TTFontPtr font);
+void ttfPrintHDMX(FILE *fp, HDMXPtr hdmx);
+void ttfFreeHDMX(HDMXPtr hdmx);
+
+void ttfInitPREP(TTFontPtr font);
+void ttfPrintPREP(FILE *fp, BYTE * prep, USHORT length);
+void ttfFreePREP(BYTE * prep);
+
+void ttfInitLTSH(TTFontPtr font);
+void ttfPrintLTSH(FILE *fp, LTSHPtr ltsh);
+void ttfFreeLTSH(LTSHPtr ltsh);
+
+void ttfInitVDMX(TTFontPtr font);
+void ttfPrintVDMX(FILE *fp, VDMXPtr vdmx);
+void ttfFreeVDMX(VDMXPtr vdmx);
+
+void ttfInitGraphicsState(TTFontPtr font);
+void ttfInitStack(TTFontPtr font);
+void ttfInitStorageArea(TTFontPtr font);
+
+void ttfPrintInstructions(FILE *fp, BYTE * ins);
+
+#endif /* __TTF_LOADTABLE_H */
+
+
+/* end of loadtable.h */
diff --git a/Build/source/texk/ttfdump/include/os2_P.h b/Build/source/texk/ttfdump/include/os2_P.h
new file mode 100644
index 00000000000..6d4cf46a48b
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/os2_P.h
@@ -0,0 +1,197 @@
+/* Private header file for os2.c */
+#ifdef __TTF_OS2
+#ifndef __TTF_OS2_H
+#define __TTF_OS2_H
+
+static char *WeightClassName[] =
+{
+ "Thin", /* Ultra-light */
+ "Extra-light",
+ "Light",
+ "Normal", /* Semi-light */
+ "Medium",
+ "Semi-bold",
+ "Bold",
+ "Extra-Bold",
+ "Black" /* Ultra-bold */
+};
+
+static char *WidthClassName[] =
+{
+ "Ultra-condensed",
+ "Extra-condensed",
+ "Condensed",
+ "Semi-condensed",
+ "Medium",
+ "Semi-expanded",
+ "Expanded",
+ "Extra-expanded",
+ "Ultra-expanded"
+};
+
+static char *PanoseFamily[] =
+{
+ "Any",
+ "No Fit",
+ "Text and Display",
+ "Script",
+ "Decorative",
+ "Pictorial"
+};
+
+static char *PanoseSerif[] =
+{
+ "Any",
+ "No Fit",
+ "Cove",
+ "Obtuse Cove",
+ "Square Cove",
+ "Obtuse Square Cove",
+ "Square",
+ "Thin",
+ "Bone",
+ "Exaggerated",
+ "Triangle",
+ "Normal Sans",
+ "Obtuse Sans",
+ "Perp Sans",
+ "Flared",
+ "Rounded"
+};
+
+static char *PanoseWeight[] =
+{
+ "Any",
+ "No Fit",
+ "Very Light",
+ "Ligth",
+ "Thin",
+ "Book",
+ "Medium",
+ "Demi",
+ "Bold",
+ "Heavy",
+ "Black",
+ "Nord",
+};
+
+static char *PanoseProportion[] =
+{
+ "Any",
+ "No Fit",
+ "Old Style",
+ "Modern",
+ "Even Width",
+ "Expanded",
+ "Condensed",
+ "Very Expanded",
+ "Very Condensed",
+ "Monospaced"
+};
+
+static char *PanoseContrast[] =
+{
+ "Any",
+ "No Fit",
+ "None",
+ "Very Low",
+ "Low",
+ "Medium Low",
+ "Medium",
+ "Medium High",
+ "High",
+ "Very High",
+};
+
+static char *PanoseStroke[] =
+{
+ "Any",
+ "No Fit",
+ "Gradual/Diagonal",
+ "Gradual/Transitional",
+ "Gradual/Vertical",
+ "Gradual/Horizontal",
+ "Rapid/Vertical",
+ "Rapid/Horizontal",
+ "Rapid/Vertical"
+};
+
+static char *PanoseArm[] =
+{
+ "Any",
+ "No Fit"
+ "Straight Arms/Horizontal",
+ "Straight Arms/Wedge",
+ "Straight Arms/Vertical",
+ "Straight Arms/Single Serif",
+ "Straight Arms/Double Serif",
+ "Non-Straight Arms/Horizontal",
+ "Non-Straight Arms/Wedge",
+ "Non-Straight Arms/Vertical",
+ "Non-Straight Arms/Single Serif",
+ "Non-Straight Arms/Double Serif"
+};
+
+static char *PanoseLetterform[] =
+{
+ "Any",
+ "No Fit",
+ "Normal/Contact",
+ "Normal/Weighted",
+ "Normal/Boxed",
+ "Normal/Flttened",
+ "Normal/Rounded",
+ "Normal/Off Center",
+ "Normal/Square",
+ "Oblique/Contact",
+ "Oblique/Weighted",
+ "Oblique/Boxed",
+ "Oblique/Flattened",
+ "Oblique/Rounded",
+ "Oblique/Off Center",
+ "Oblique/Square"
+};
+
+static char *PanoseMidline[] =
+{
+ "Any",
+ "No Fit",
+ "Standard/Trimmed",
+ "Standard/Pointed",
+ "Standard/Serifed",
+ "High/Trimmed",
+ "High/Pointed"
+ "High/Serifed",
+ "Constant/Trimmed",
+ "Constant/Pointed",
+ "Constant/Serifed",
+ "Low/Trimmed"
+ "Low/Pointed",
+ "Low/Serifed",
+};
+
+static char *PanoseXHeight[] =
+{
+ "Any",
+ "No Fit",
+ "Constant/Small",
+ "Constant/Standard"
+ "Constant/Large"
+ "Ducking/Small",
+ "Ducking/Standard",
+ "Ducking/Large"
+};
+
+#define FS_FLAGS_ITALIC 0x01
+#define FS_FLAGS_UNDERSCORE 0x02
+#define FS_FLAGS_NEGATIVE 0x04
+#define FS_FLAGS_OUTLINED 0x08
+#define FS_FLAGS_STRIKEOUT 0x10
+#define FS_FLAGS_BOLD 0x20
+#define FS_FLAGS_REGULAR 0x40
+
+#endif /* __TTF_OS2_H */
+#endif /* __TTF_OS2 */
+
+
+/* end of os2_P.h */
diff --git a/Build/source/texk/ttfdump/include/protos.h b/Build/source/texk/ttfdump/include/protos.h
new file mode 100644
index 00000000000..66523ab808f
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/protos.h
@@ -0,0 +1,22 @@
+#ifndef __PROTOS_H
+#define __PROTOS_H
+
+extern void ttfInitKERN(TTFontPtr);
+extern void ttfInitPCLT(TTFontPtr);
+extern void ttfInitVHEA(TTFontPtr);
+extern void ttfInitVMTX(TTFontPtr);
+extern void ttfFreeKERN(KERNPtr);
+extern void ttfFreePCLT(PCLTPtr);
+extern void ttfFreeVHEA(VHEAPtr);
+extern void ttfFreeVMTX(VMTXPtr);
+extern void ttfPrintKERN(FILE*, KERNPtr);
+extern void ttfPrintPCLT(FILE*, PCLTPtr);
+extern void ttfPrintVHEA(FILE*, VHEAPtr);
+extern void ttfPrintVMTX(FILE*, VMTXPtr);
+extern BYTE ttfGetBYTE(FILE*);
+extern BYTE GetBYTE(VirtualMachine *);
+extern SHORT GetSHORT(VirtualMachine *);
+extern void Push(VirtualMachine *, LONG);
+extern LONG Pop(VirtualMachine *);
+
+#endif
diff --git a/Build/source/texk/ttfdump/include/tables.h b/Build/source/texk/ttfdump/include/tables.h
new file mode 100644
index 00000000000..cef49726cb9
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/tables.h
@@ -0,0 +1,585 @@
+/* table.h -- define data structures for various ttf file internal tables
+ * See Also: True Type Font Specification
+ */
+
+#ifndef __TTF_TABLE_H
+#define __TTF_TABLE_H
+
+/* $Id: tables.h,v 1.2 1998/07/06 06:07:01 werner Exp $ */
+
+/* Offset Table:
+ * Into the beginning of a True Type font file
+ */
+typedef struct _OffsetTable
+{
+ Fixed version;
+ USHORT numTables;
+ USHORT searchRange;
+ USHORT entrySelector;
+ USHORT rangeShift;
+}
+OffsetTable, *OffsetTablePtr;
+
+/* Table Directory:
+ * The directory to find each table in a True Type font file
+ */
+typedef struct _TableDir
+{
+ ULONG tag;
+ ULONG checksum;
+ ULONG offset;
+ ULONG length;
+}
+TableDir, *TableDirPtr;
+
+
+/* cmap: Character to Glyph Index Mapping Table
+ * There are four kinds of cmap, format 0, 2, 4, and 6. They are defined
+ * as follows
+ */
+typedef struct
+{
+ BYTE glyphIndexArray[256];
+}
+CMAP0;
+
+typedef struct _subHeaders
+{
+ USHORT firstCode;
+ USHORT entryCount;
+ SHORT idDelta;
+ USHORT idRangeOffset;
+}
+SubHeader, *SubHeaderPtr;
+
+typedef struct
+{
+ USHORT subHeaderKeys[256];
+ SubHeaderPtr subHeaders;
+ USHORT *glyphIndexArray;
+}
+CMAP2;
+
+typedef struct
+{
+ USHORT segCountX2;
+ USHORT searchRange;
+ USHORT entrySelector;
+ USHORT rangeShift;
+ USHORT *endCount;
+ USHORT reservedPad;
+ USHORT *startCount;
+ USHORT *idDelta;
+ USHORT *idRangeOffset;
+ USHORT *glyphIndexArray;
+}
+
+CMAP4;
+typedef struct
+{
+ USHORT firstCode;
+ USHORT entryCount;
+ USHORT *glyphIndexArray;
+}
+CMAP6;
+
+/* SubTable: one for each encoding scheme */
+typedef struct
+{
+ /* encoding table */
+ USHORT PlatformID;
+ USHORT EncodingID;
+ ULONG offset;
+
+ USHORT format;
+ USHORT length;
+ USHORT version;
+ union
+ {
+ CMAP0 *cmap0;
+ CMAP2 *cmap2;
+ CMAP4 *cmap4;
+ CMAP6 *cmap6;
+ }
+ map;
+}
+SubTable, *SubTablePtr;
+
+typedef struct _cmap
+{
+ USHORT version;
+ USHORT numberOfEncodings;
+ SubTablePtr subTables; /* size = numberOfEncodings */
+}
+CMAP, *CMAPPtr;
+
+/* glyf: Glyph Data table
+ * It is necessary to load "loca" table first to know where to load a specific
+ * glyph; the "loca" table itself depends on "head" and "maxp" tables
+ */
+typedef F2Dot14 SCALE;
+
+typedef struct
+{
+ F2Dot14 xscale;
+ F2Dot14 yscale;
+}
+VECTOR;
+
+typedef struct
+{
+ F2Dot14 xscale;
+ F2Dot14 scale01;
+ F2Dot14 scale10;
+ F2Dot14 yscale;
+}
+TENSOR;
+
+typedef struct
+{
+ SHORT args[2]; /* need reconsideration */
+ union
+ {
+ SCALE scale;
+ VECTOR vector;
+ TENSOR tensor;
+ }
+ transform;
+}
+CompositeData;
+
+typedef struct _component
+{
+ USHORT flags;
+ USHORT glyphIndex;
+ CompositeData data;
+ struct _component *next, *previous; /* linked list used, no way to know
+ * how many components in advance */
+}
+Component;
+
+typedef struct
+{
+ SHORT numberOfContours;
+ FWord xMin;
+ FWord yMin;
+ FWord xMax;
+ FWord yMax;
+ /* simple glyph data */
+ USHORT *endPtsOfContours; /* size = numberOfContours */
+ USHORT instructionLength;
+ BYTE *instructions; /* size = instructionLength */
+ BYTE *flags; /* size = the total # of x,y
+ * coordinates, i.e. last number
+ * of endPtsOfContour */
+ SHORT *xCoordinates;
+ SHORT *yCoordinates;
+ Component *comp; /* a pointer to a linked list of
+ * composite components */
+}
+GLYF, *GLYFPtr;
+
+/* Flags for Coordinates */
+#define FLAGS_ON_CURVE 1
+#define FLAGS_X_SHORT_VECTOR 2
+#define FLAGS_Y_SHORT_VECTOR 4
+#define FLAGS_REPEAT 8
+#define FLAGS_X_SAME 0x10
+#define FLAGS_Y_SAME 0x20
+
+/* Flags for Composite Glyph */
+#define ARG_1_AND_2_ARE_WORDS 0x001
+#define ARGS_ARE_XY_VALUES 0x002
+#define ROUND_XY_TO_GRID 0x004
+#define WE_HAVE_A_SCALE 0x008
+#define RESERVE 0x010
+#define NO_OVERLAP 0x010
+#define MORE_COMPONENT 0x020
+#define WE_HAVE_AN_X_AND_Y_SCALE 0x040
+#define WE_HAVE_A_TWO_BY_TWO 0x080
+#define WE_HAVE_INSTRUCTIONS 0x100
+#define USE_MY_METRICS 0x200
+#define OVERLAP_COMPOUND 0x400 /* from Apple's TTF specs */
+
+typedef struct
+{
+ Fixed version;
+ Fixed fontRevision;
+ ULONG checkSumAdj;
+ ULONG magicNumber;
+ USHORT flags;
+ USHORT unitsPerEm;
+ BYTE created[8];
+ BYTE modified[8];
+ FWord xMin;
+ FWord yMin;
+ FWord xMax;
+ FWord yMax;
+ USHORT macStyle;
+ USHORT lowestRecPPEM;
+ SHORT fontDirectionHint;
+ SHORT indexToLocFormat; /* 0 => ushort, 1 => ulong */
+ SHORT glyphDataFormat;
+}
+HEAD, *HEADPtr;
+
+#define FLAGS_Y_0 1
+#define FLAGS_X_0 2
+#define FLAGS_SIZE_DEP 4
+#define FLAGS_INT_PPEM 8
+#define FLAGS_ALT_WIDTH 0x10
+#define MAC_STYLE_BOLD 1
+#define MAC_STYLE_ITALIC 2
+#define FONT_DIR_MIX 0
+#define FONT_DIR_L2R 1
+#define FONT_DIR_L2R_NEUTRALS 2
+#define FONT_DIR_R2L -1
+#define FONT_DIR_R2L_NEUTRALS -2
+#define LOCA_OFFSET_SHORT 0
+#define LOCA_OFFSET_LONG 1
+
+typedef struct
+{
+ Fixed version;
+ FWord Ascender;
+ FWord Descender;
+ FWord LineGap;
+ uFWord advanceWidthMax;
+ FWord minLeftSideBearing;
+ FWord minRightSideBearing;
+ FWord xMaxExtent;
+ SHORT caretSlopeRise;
+ SHORT caretSlopeRun;
+ SHORT reserved[5];
+ SHORT metricDataFormat;
+ USHORT numberOfHMetrics;
+}
+HHEA, *HHEAPtr;
+
+/* for a new created HMTX, one have to fill numberofHMetrics manually for
+ * hhea */
+typedef struct _longHorMetric
+{
+ uFWord advanceWidth;
+ FWord lsb;
+}
+longHorMetric;
+
+typedef struct
+{ /* depends on hhea */
+ USHORT numberOfHMetrics; /* defined in hhea */
+ USHORT numberOfLSB; /* numGlyph - numberOfHMetrics */
+ longHorMetric *hMetrics;
+ FWord *leftSideBearing;
+}
+HMTX, *HMTXPtr;
+
+/* for a newly created LOCA, one have to fill indexToLocFormat from head and
+ * numGlyphs from maxp manually */
+typedef struct
+{ /* depends on head and maxp */
+ SHORT indexToLocFormat; /* defined in head */
+ USHORT numGlyphs; /* defined in maxp */
+ ULONG *offset;
+}
+LOCA, *LOCAPtr;
+
+typedef struct
+{
+ Fixed version;
+ USHORT numGlyphs;
+ USHORT maxPoints;
+ USHORT maxContours;
+ USHORT maxCompositePoints;
+ USHORT maxCompositeContours;
+ USHORT maxZones;
+ USHORT maxTwilightPoints;
+ USHORT maxStorage;
+ USHORT maxFunctionDefs;
+ USHORT maxInstructionDefs;
+ USHORT maxStackElements;
+ USHORT maxSizeOfInstructions;
+ USHORT maxComponentElements;
+ USHORT maxComponentDepth;
+}
+MAXP, *MAXPPtr;
+
+typedef struct
+{
+ USHORT PlatformID;
+ USHORT EncodingID;
+ USHORT LanguageID;
+ USHORT NameID;
+ USHORT length;
+ USHORT offset;
+ char *data;
+}
+NameRecord, *NameRecordPtr;
+
+typedef struct
+{
+ USHORT format;
+ USHORT numberOfRecords;
+ USHORT offset;
+ NameRecordPtr NameRecords;
+}
+NAME, *NAMEPtr;
+
+typedef struct
+{
+ USHORT numGlyphs; /* Should be the same as numGlyphs defined in maxp */
+ USHORT *glyphNameIndex;
+ CHAR **GlyphName;
+}
+Format20;
+
+typedef struct
+{
+ char *offset;
+}
+Format25;
+
+typedef struct
+{
+ Fixed format;
+ Fixed italicAngle;
+ FWord underlinePosition;
+ FWord underlineThickness;
+ ULONG isFixedPitch;
+ ULONG minMemType42;
+ ULONG maxMemType42;
+ ULONG minMemType1;
+ ULONG maxMemType1;
+ /* the elements below exist only for 2.0 and 2.5 format */
+ union
+ {
+ Format20 *format20;
+ Format25 *format25;
+ }
+ name;
+}
+POST, *POSTPtr;
+
+typedef struct
+{
+ USHORT version;
+ SHORT xAvgCharWidth;
+ USHORT usWeightClass;
+ USHORT usWidthClass;
+ USHORT fsType;
+ SHORT ySubscriptXSize;
+ SHORT ySubscriptYSize;
+ SHORT ySubscriptXOffset;
+ SHORT ySubscriptYOffset;
+ SHORT ySuperscriptXSize;
+ SHORT ySuperscriptYSize;
+ SHORT ySuperscriptXOffset;
+ SHORT ySuperscriptYOffset;
+ SHORT yStrikeoutSize;
+ SHORT yStrikeoutPosition;
+ SHORT sFamilyClass;
+ CHAR panose[10];
+ ULONG ulUnicodeRange1;
+ ULONG ulUnicodeRange2;
+ ULONG ulUnicodeRange3;
+ ULONG ulUnicodeRange4;
+ CHAR achVendID[5];
+ USHORT fsSelection;
+ USHORT usFirstCharIndex;
+ USHORT usLastCharIndex;
+ SHORT sTypoAscender;
+ SHORT sTypoDescender;
+ SHORT sTypoLineGap;
+ USHORT usWinAscent;
+ USHORT usWinDescent;
+ ULONG ulCodePageRange1;
+ ULONG ulCodePageRange2;
+}
+OS_2, *OS_2Ptr;
+
+typedef struct
+{
+ USHORT rangeMaxPPEM;
+ USHORT rangeGaspBehavior;
+}
+GASPRANGE;
+
+typedef struct
+{
+ USHORT version;
+ USHORT numRanges;
+ GASPRANGE *gaspRange; /* length = numRanges */
+}
+GASP, *GASPPtr;
+
+/* flags for gasp */
+#define GASP_GRIDFIT 0x0001
+#define GASP_DOGRAY 0x0002
+
+typedef struct
+{
+ BYTE PixelSize;
+ BYTE MaxWidth;
+ BYTE *Width; /* length = numGlyphs */
+}
+DeviceRecord;
+
+typedef struct
+{
+ USHORT numGlyphs; /* defined in maxp, artifitial */
+ USHORT version;
+ SHORT numDevices;
+ LONG size;
+ DeviceRecord *Records;
+}
+HDMX, *HDMXPtr;
+
+typedef struct
+{
+ USHORT version;
+ USHORT length;
+ USHORT coverage;
+ union
+ {
+ struct
+ {
+ USHORT nPairs;
+ USHORT searchRange;
+ USHORT entrySelector;
+ USHORT rangeShift;
+ struct kernpair
+ {
+ USHORT left;
+ USHORT right;
+ FWord value;
+ }
+ *pairs;
+ }
+ kern0;
+
+ struct
+ {
+ USHORT rowWidth;
+ USHORT leftClassTable;
+ USHORT rightClassTable;
+ USHORT array;
+ }
+ kern2;
+ }
+ kern;
+}
+KernSubtable;
+
+typedef struct
+{
+ USHORT version;
+ USHORT nTables;
+ KernSubtable *subtable;
+}
+KERN, *KERNPtr;
+
+typedef struct
+{
+ USHORT version;
+ USHORT numGlyphs;
+ BYTE *yPels; /* length = numGlyphs */
+}
+LTSH, *LTSHPtr;
+
+typedef struct
+{
+ Fixed version;
+ ULONG FontNumber;
+ USHORT Pitch;
+ USHORT xHeight;
+ USHORT Style;
+ USHORT TypeFamily;
+ USHORT CapHeight;
+ USHORT SymbolSet;
+ CHAR Typeface[16];
+ CHAR CharacterComplement[8];
+ CHAR FileName[6];
+ CHAR StrokeWeight;
+ CHAR WidthType;
+ BYTE SerifStyle;
+ BYTE reserved;
+}
+PCLT, *PCLTPtr;
+
+typedef struct
+{
+ BYTE CharSet;
+ BYTE xRatio;
+ BYTE yStartRatio;
+ BYTE yEndRatio;
+}
+Ratios;
+
+typedef struct
+{
+ USHORT yPelHeight;
+ SHORT yMax;
+ SHORT yMin;
+}
+vTable;
+
+typedef struct
+{
+ USHORT recs;
+ BYTE startsz;
+ BYTE endsz;
+ vTable *entry;
+}
+Vdmx;
+
+typedef struct
+{
+ USHORT version;
+ USHORT numRecs;
+ USHORT numRatios;
+ Ratios *ratRange; /* length = numRatios */
+ USHORT *offset; /* length = numRatios */
+ Vdmx *groups;
+}
+VDMX, *VDMXPtr;
+
+typedef struct
+{
+ Fixed version;
+ SHORT ascent;
+ SHORT descent;
+ SHORT lineGap;
+ SHORT advanceHeightMax;
+ SHORT minTopSideBearing;
+ SHORT minBottomSideBearing;
+ SHORT yMaxExtent;
+ SHORT caretSlopeRise;
+ SHORT caretSlopeRun;
+ SHORT caretOffset;
+ SHORT reserved[4];
+ SHORT metricDataFormat;
+ USHORT numOfLongVerMetrics;
+}
+VHEA, *VHEAPtr;
+
+typedef struct
+{
+ uFWord advanceHeight;
+ FWord topSideBearing;
+}
+longVerMetric;
+
+typedef struct
+{
+ /* depends on vhea */
+ USHORT numOfLongVerMetrics; /* defined in vhea */
+ USHORT numOfTSB; /* numGlyph - numberOfHMetrics */
+ longVerMetric *vMetrics;
+ FWord *topSideBearing;
+}
+VMTX, *VMTXPtr;
+
+#endif /* __TTF_TABLE_H */
+
+
+/* end of tables.h */
diff --git a/Build/source/texk/ttfdump/include/ttc.h b/Build/source/texk/ttfdump/include/ttc.h
new file mode 100644
index 00000000000..7350114cec5
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/ttc.h
@@ -0,0 +1,25 @@
+#ifndef __TTF_TTC_H
+#define __TTF_TTC_H
+
+/* $Id: ttc.h,v 1.3 1998/07/06 06:07:01 werner Exp $ */
+
+#include "ttf.h"
+
+typedef struct
+{
+ ULONG TTCTag;
+ Fixed version;
+ ULONG DirCount;
+ ULONG *offset; /* length = DirCount */
+ TTFontPtr font;
+}
+TTCHeader, *TTCHeaderPtr;
+
+TTCHeaderPtr ttfLoadTTCHeader(char *filename);
+void ttfLoadTTCFont(TTCHeaderPtr ttc, FILE *fp);
+void ttfFreeTTCFont(TTCHeaderPtr ttc);
+
+#endif /* __TTF_TTC_H */
+
+
+/* end of ttc.h */
diff --git a/Build/source/texk/ttfdump/include/ttf.h b/Build/source/texk/ttfdump/include/ttf.h
new file mode 100644
index 00000000000..34c53a3f298
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/ttf.h
@@ -0,0 +1,187 @@
+/* ttf.h -- header file that defines the top level abstraction of a True Type font, as
+ * well as the usual typedefs in TTF spec.
+ * Copyright (C) 1996-1998 Li-Da Lho, All right reserved.
+ */
+
+#ifndef __TTF_H
+#define __TTF_H
+
+#include <stdio.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#include "config.h"
+
+/* $Id: ttf.h,v 1.3 1998/07/06 06:07:01 werner Exp $ */
+
+typedef unsigned char BYTE;
+typedef signed char CHAR;
+typedef unsigned short USHORT;
+typedef signed short SHORT;
+
+
+#if SIZEOF_INT==4
+typedef unsigned int ULONG;
+typedef signed int LONG;
+typedef ULONG Fixed; /* 16.16 fixed point number used for
+ * version information */
+
+#elif SIZEOF_LONG==4
+typedef unsigned long ULONG;
+typedef signed long LONG;
+typedef ULONG Fixed; /* 16.16 fixed point number used for
+ * version information */
+#endif
+
+typedef USHORT FUnit;
+typedef SHORT FWord; /* pixel position in the unit of FUnit */
+typedef USHORT uFWord;
+typedef SHORT F2Dot14; /* 2.14 fixed point number used for
+ * unit vectors */
+typedef LONG F26Dot6; /* 26.6 fixed point number to specify
+ * pixel positions */
+
+#ifndef inline
+extern inline BYTE
+ttfGetBYTE(FILE *fp)
+{
+ int cc;
+
+
+ if ((cc = fgetc (fp)) == EOF)
+ {
+#if 0
+ if (feof(fp) != 0)
+ ttfError("Unexpected EOF \n");
+ else
+ ttfError("Error Getting BYTE\n");
+#endif
+ }
+ return (BYTE) cc;
+}
+#endif
+
+CHAR ttfGetCHAR(FILE *fp);
+USHORT ttfGetUSHORT(FILE *fp);
+USHORT ttfGetSHORT(FILE *fp);
+ULONG ttfGetULONG(FILE *fp);
+LONG ttfGetLONG(FILE *fp);
+Fixed ttfGetFixed(FILE *fp);
+FUnit ttfGetFUnit(FILE *fp);
+FWord ttfGetFWord(FILE *fp);
+uFWord ttfGetuFWord(FILE *fp);
+F2Dot14 ttfGetF2Dot14(FILE *fp);
+
+short ttfGetLSB16(FILE *fp);
+int ttfGetLSB32(FILE *fp);
+
+#include "tables.h"
+#include "gcache.h"
+#include "gstate.h"
+
+typedef struct
+{
+ BYTE opcode;
+ BYTE *iStream;
+}
+InstructionDef;
+
+typedef struct
+{
+ BYTE fun;
+ BYTE *iStream;
+}
+FunctionDef;
+
+typedef struct
+{
+ /* data for instructions */
+ BYTE *iStream; /* instruction stream */
+ USHORT ip; /* instruction pointer */
+ USHORT insLength; /* instruction length */
+ LONG *StorageArea; /* storage area */
+ LONG *Stack; /* stack */
+ USHORT sp; /* stack pointer */
+ USHORT stklimit; /* stack limit */
+ /* data about point size and resolution */
+ ULONG ppem; /* pixel per em */
+ ULONG xres; /* x resolution in dpi */
+ ULONG yres; /* y resolution in dpi */
+ F26Dot6 pointsize; /* the point size of the font */
+ /* data for grahpics stat and cvt */
+ F26Dot6 *cvt; /* Control value table, scaled form cvt in
+ * TTFont */
+ GraphicsState gstate; /* graphics state used for instructions */
+ GraphicsState gstate_init; /* initial graphics state after fpgm and cvt
+ * programs are executed */
+#if 0
+ /* user definded instructions and functions */
+ InstructionDef iDef; /* instruction definitions */
+ FunctionDef fDef; /* function definitions */
+#endif
+
+ int Error_State; /* error state indicate the error */
+}
+VirtualMachine;
+
+typedef struct
+{
+ /* misc informations */
+ FILE *fp;
+ char *ttfname;
+ int *refcount; /* how many instances of this font */
+ Fixed version;
+ USHORT numTables; /* it seems not necessary to hold all the
+ * OffsetTables */
+ ULONG glyphOffset; /* where the glyph table starts */
+ TableDirPtr dir; /* Pointer to Table Directories */
+ SubTablePtr encoding; /* `encoding' is the currently used encoding
+ * table */
+ USHORT numCacheElements; /* number of glyph cache elements */
+
+ VirtualMachine vm; /* the virtual machine */
+
+ GlyphCachePtr gcache; /* pointer to glyph cache */
+
+ /* required tables */
+ CMAPPtr cmap;
+ HEADPtr head;
+ HHEAPtr hhea;
+ HMTXPtr hmtx;
+ LOCAPtr loca;
+ MAXPPtr maxp;
+ NAMEPtr name;
+ POSTPtr post;
+ OS_2Ptr os2;
+
+ /* optional tables */
+ FWord *cvt; /* control value table, not scaled yet */
+ USHORT cvtLength; /* number of FWords of CVT */
+ BYTE *fpgm; /* font program */
+ USHORT fpgmLength; /* number of bytes of fpgm */
+ BYTE *prep; /* cvt program */
+ USHORT prepLength; /* number of bytes of prep */
+
+ /* those optional tables seem not to be necessary for a True Type font
+ * server */
+ GASPPtr gasp;
+ HDMXPtr hdmx;
+ KERNPtr kern;
+ LTSHPtr ltsh;
+ PCLTPtr pclt;
+ VDMXPtr vdmx;
+ VHEAPtr vhea;
+ VMTXPtr vmtx;
+}
+TTFont, *TTFontPtr;
+
+TTFontPtr ttfInitFont(char *filename);
+void ttfLoadFont(TTFontPtr font, ULONG offset);
+void ttfFreeFont(TTFontPtr font);
+
+#include "loadtable.h"
+
+#endif /* __TTF_H */
+
+
+/* end of ttf.h */
diff --git a/Build/source/texk/ttfdump/include/ttfutil.h b/Build/source/texk/ttfdump/include/ttfutil.h
new file mode 100644
index 00000000000..c29d4c5b535
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/ttfutil.h
@@ -0,0 +1,19 @@
+#ifndef __TTF_UTIL_H
+#define __TTF_UTIL_H
+
+#include "ttf.h"
+
+/* $Id: ttfutil.h,v 1.2 1998/07/06 06:07:01 werner Exp $ */
+
+void FixedSplit(Fixed f, int b[]);
+void TwoByteSwap(unsigned char *buf, int nbytes);
+void FourByteSwap(unsigned char *buf, int nbytes);
+void FourByteSwap(unsigned char *buf, int nbytes);
+void ttfError(char *msg);
+
+#include "protos.h"
+
+#endif /* __TTF_UTIL_H */
+
+
+/* end of ttfutil.h */
diff --git a/Build/source/texk/ttfdump/install-sh b/Build/source/texk/ttfdump/install-sh
new file mode 100644
index 00000000000..58719246f04
--- /dev/null
+++ b/Build/source/texk/ttfdump/install-sh
@@ -0,0 +1,238 @@
+#! /bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/Build/source/texk/ttfdump/libttf/Makefile.in b/Build/source/texk/ttfdump/libttf/Makefile.in
new file mode 100644
index 00000000000..4781a8c015e
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/Makefile.in
@@ -0,0 +1,102 @@
+# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+
+# 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# @configure_input@
+
+SHELL = /bin/sh
+
+#### Start of system configuration section. ####
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+# If you use gcc, you should either run the fixincludes script that
+# comes with it or else use gcc with the -traditional option. Otherwise
+# ioctl calls will be compiled incorrectly on some systems.
+CC = @CC@
+AR = ar
+
+# set make command
+@SET_MAKE@
+
+# Set RANLIB = echo if your system doesn't have or need ranlib.
+RANLIB = @RANLIB@
+
+# Use cp if you don't have install.
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+DEFS = @DEFS@
+LIBS = @LIBS@
+
+INCLUDES = -I@top_srcdir@ -I@top_srcdir@/include
+CFLAGS = @CFLAGS@ $(INCLUDES)
+LDFLAGS = @LDFLAGS@
+
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+# Where to install the executables.
+bindir = $(exec_prefix)/bin
+
+# Where to put the include header
+includedir = $(prefix)/include
+
+# Where to put the Info files
+infodir = $(prefix)/info
+
+# Where to put the library file
+libdir = $(prefix)/lib
+
+# Where to put the manual pages.
+mandir = $(prefix)/man
+
+#### End of system configuration section. ####
+
+#CFLAGS = -g -pg -Wall -m486 -DMEMCHECK -DTESTCODE -DCOPYDELETE -I/usr/local/include
+#CFLAGS = -O3 -Wall -m486 -DTESTCODE -DCOPYDELETE -I/usr/local/include -I../ -I../include
+#LDFLAGS = -L/usr/local/lib
+#LIBS = -ldmalloc
+#LIBS = -lefence
+#LIBS = -lc_p
+OBJS = ttfread.o tabledir.o ttfutil.o font.o cmap.o glyf.o gcache.o \
+ head.o hhea.o hmtx.o loca.o maxp.o name.o os2.o post.o \
+ cvt.o fpgm.o gasp.o hdmx.o kern.o ltsh.o prep.o pclt.o vdmx.o vhea.o \
+ vmtx.o gstate.o stack.o interp.o disasm.o ttc.o
+
+all: libttf.a
+
+libttf.a: ${OBJS}
+ $(AR) r $@ $?
+ ranlib $@ || $(AR) ts $@ || true
+
+clean:
+ rm -f *.a *.o *~
+.PHONY: clean
+
+distclean: clean
+ rm -f tags TAGS Makefile
+.PHONY: distclean
+
+install:
+ @echo Nothing to install from this directory
+
+check:
+ @echo Nothing to check in this directory
diff --git a/Build/source/texk/ttfdump/libttf/cmap.c b/Build/source/texk/ttfdump/libttf/cmap.c
new file mode 100644
index 00000000000..3374829b4d8
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/cmap.c
@@ -0,0 +1,748 @@
+/* cmap.c -- Load and Print the content of cmap table
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ *
+ * The structure of a cmap is really complex, it depends on which format the
+ * cmap is and loading a cmap is a kind of confusing thing.
+ * The structure of CMAP:
+ * A cmap begins with a general description of the table
+ * USHORT version indicates the version of this cmap.
+ * USHORT numEncodings is the number of encodings in the cmap table.
+ * Then follow 'numEncodings' of encoding tables, each of which contains
+ * the following informations for each subtable. The subtable contains the
+ * true data to map character code to glyph index
+ * USHORT PlatformID shows which platform the subtable is to be used
+ * (e.g. Mac, PC)
+ * USHORT Platfrom specofic EncodingID shows what kind of encoding scheme
+ * this table uses (e.g. Big5, iso8859, Unicode etc.)
+ * ULONG offset is the offset from the beginning of the whole cmap table
+ * to the beginning of the corresponding subtable
+ * ----------------------- --- ---
+ * | USHORT version | ^ ^
+ * ----------------------- | |
+ * | USHORT numEncodings | | |
+ * ----------------------- | |
+ * | Encoding Table 1 | | |
+ * | USHORT PlatformID | | |
+ * | USHORT EncodingID | | |
+ * | ULONG offset 1 |------ | |
+ * ----------------------- | | offset 1 | offset 2
+ * | Encoding Table 2 | | | |
+ * | USHORT PlatformID | | | |
+ * | USHORT EncodingID | | | |
+ * | ULONG offset 2 |--- | v |
+ * ----------------------- | | --- |
+ * | Subtable 1 |<----- |
+ * | with format 0 | | v
+ * ----------------------- | ---
+ * | Subtable 2 |<--
+ * | with format 2 |
+ * ----------------------|
+ *
+ * Problem with Character Code vs. Byte Endianess.
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: cmap.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: cmap.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static CMAPPtr ttfAllocCMAP(TTFontPtr font);
+static void ttfLoadCMAP(FILE *fp,CMAPPtr cmap,ULONG offset);
+
+static void ttfLoadEncodingTable(FILE *fp,SubTablePtr subTable,ULONG offset);
+static SubTablePtr ttfAllocSubTable(CMAPPtr cmap);
+static void ttfLoadSubTable(FILE *fp,SubTablePtr subTable,ULONG offset);
+static void ttfPrintSubTable(FILE* fp,SubTablePtr ptable);
+static void ttfFreeSubTable(SubTablePtr ptable);
+
+static CMAP0 * ttfAllocCMAP0(SubTablePtr subTable);
+static void ttfLoadCMAP0(FILE *fp,SubTablePtr subTable,ULONG offset);
+static void ttfPrintCMAP0(FILE *fp,SubTablePtr subTable);
+static USHORT ttfLookUpCMAP0(SubTablePtr subTable,USHORT cc);
+static void ttfFreeCMAP0(SubTablePtr subTable);
+
+static void ttfLoadCMAP2(FILE *fp,SubTablePtr subTable,ULONG offset);
+static void ttfPrintCMAP2(FILE *fp,SubTablePtr subTable);
+static USHORT ttfLookUpCMAP2(SubTablePtr subTable,USHORT cc);
+static void ttfFreeCMAP2(SubTablePtr subTable);
+
+static void ttfLoadCMAP4(FILE *fp,SubTablePtr subTable,ULONG offset);
+static void ttfPrintCMAP4(FILE *fp,SubTablePtr subTable);
+static USHORT ttfLookUpCMAP4(SubTablePtr subTable,USHORT cc);
+static void ttfFreeCMAP4(SubTablePtr subTable);
+
+static void ttfLoadCMAP6(FILE *fp,SubTablePtr subTable,ULONG offset);
+static void ttfPrintCMAP6(FILE *fp, SubTablePtr sbuTable);
+static USHORT ttfLookUpCMAP6(SubTablePtr subTable,USHORT cc);
+static void ttfFreeCMAP6(SubTablePtr subTable);
+
+void ttfInitCMAP(TTFontPtr font)
+{
+ ULONG tag = 'c' | 'm' << 8 | 'a' << 16 | 'p' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->cmap = ttfAllocCMAP(font);
+ ttfLoadCMAP(font->fp,font->cmap,ptd->offset);
+ }
+}
+static CMAPPtr ttfAllocCMAP(TTFontPtr font)
+{
+ CMAPPtr cmap;
+ if ((cmap = (CMAPPtr) calloc(1,sizeof(CMAP))) == NULL)
+ {
+ ttfError("Out Of Memory in __FILE_ : __LINE__ \n");
+ return NULL;
+ }
+ return cmap;
+}
+static void ttfLoadCMAP(FILE *fp,CMAPPtr cmap,ULONG offset)
+{
+ USHORT i,n;
+ ULONG posEnc; /* beginning of the Encoding Table */
+ ULONG baseSub = offset; /* base of SubTable offset */
+
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLOADCMAP \n");
+
+ cmap->version = ttfGetUSHORT(fp);
+ cmap->numberOfEncodings = n = ttfGetUSHORT(fp);
+ cmap->subTables = ttfAllocSubTable(cmap);
+
+ posEnc = baseSub + sizeof(USHORT)*2; /* step over the beginning of encoding
+ * table */
+
+ /* for each encoding scheme, load the encoding table (EncodingTable) and
+ * the real cmap data (SubTable) */
+ for (i=0;i<n;i++,posEnc += 8)
+ { /* 8 == ushort*2 + ulong*1 */
+ ttfLoadEncodingTable(fp,cmap->subTables+i,posEnc);
+ ttfLoadSubTable(fp,cmap->subTables+i,baseSub);
+ }
+}
+void ttfPrintCMAP(FILE *fp,CMAPPtr cmap)
+{
+ USHORT i;
+
+ fprintf(fp,"'cmap' Table - Character to Glyph Index Mapping Table\n");
+ fprintf(fp,"-----------------------------------------------------\n");
+ fprintf(fp,"\t 'cmap' version: %d\n",cmap->version);
+ fprintf(fp,"\t number of encoding: %d\n\n",cmap->numberOfEncodings);
+
+ for (i=0;i<cmap->numberOfEncodings;i++)
+ {
+ fprintf(fp,"Subtable %3d.\t",i);
+ ttfPrintSubTable(fp,cmap->subTables+i);
+ fprintf(fp,"\n");
+ }
+}
+USHORT ttfLookUpCMAP(SubTablePtr subTable,USHORT cc)
+{
+ USHORT idx,format = subTable->format;
+
+ switch (format)
+ {
+ case 0:
+ idx = ttfLookUpCMAP0(subTable,cc);
+ break;
+ case 2:
+ idx = ttfLookUpCMAP2(subTable,cc);
+ break;
+ case 4:
+ idx = ttfLookUpCMAP4(subTable,cc);
+ break;
+ case 6:
+ idx = ttfLookUpCMAP6(subTable,cc);
+ break;
+ default:
+ ttfError("Unrecognized CMAP format\n");
+ return 0;
+ }
+ return idx;
+}
+SubTablePtr ttfSelectCMAP(CMAPPtr cmap, USHORT PlatformID, USHORT EncodingID)
+{
+ USHORT i;
+
+ for (i=0;i<cmap->numberOfEncodings;i++)
+ {
+ if ((cmap->subTables+i)->PlatformID == PlatformID &&
+ (cmap->subTables+i)->EncodingID == EncodingID)
+ return cmap->subTables+i;
+ }
+ return NULL;
+}
+void ttfFreeCMAP(CMAPPtr cmap)
+{
+ USHORT i;
+
+ for (i=0;i<cmap->numberOfEncodings;i++)
+ ttfFreeSubTable(cmap->subTables+i);
+
+ free(cmap->subTables);
+ free(cmap);
+}
+
+/* actually, EncodingTable is a part of SubTable */
+static void ttfLoadEncodingTable(FILE *fp,SubTablePtr subTable,ULONG offset)
+{
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLoadEncodingTable \n");
+
+ subTable->PlatformID = ttfGetUSHORT(fp);
+ subTable->EncodingID = ttfGetUSHORT(fp);
+ subTable->offset = ttfGetULONG(fp);
+}
+static SubTablePtr ttfAllocSubTable(CMAPPtr cmap)
+{
+ SubTablePtr subTable;
+
+ if ((subTable = (SubTablePtr) calloc(cmap->numberOfEncodings,sizeof(SubTable))) == NULL)
+ {
+ ttfError("Out Of Memory in __FILE__ : __LINE__ \n");
+ return NULL;
+ }
+ return subTable;
+}
+/* should this one be static ? */
+static void ttfLoadSubTable(FILE *fp,SubTablePtr subTable,ULONG base)
+{
+ ULONG pos;
+ USHORT format;
+
+ /* seek to the actuall position for this subtable
+ * base: beginning of cmap
+ * offset: offset field of each encoding table */
+ pos = base + subTable->offset;
+ if (fseek(fp,pos,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLoadSubTable\n");
+
+ subTable->format = format = ttfGetUSHORT(fp);
+ subTable->length = ttfGetUSHORT(fp);
+ subTable->version = ttfGetUSHORT(fp);
+
+ pos += 6;/* step over format independent data,USHORT*3 */
+
+ switch(format)
+ {
+ case 0:
+ ttfLoadCMAP0(fp,subTable,pos);
+ break;
+ case 2:
+ ttfLoadCMAP2(fp,subTable,pos);
+ break;
+ case 4:
+ ttfLoadCMAP4(fp,subTable,pos);
+ break;
+ case 6:
+ ttfLoadCMAP6(fp,subTable,pos);
+ break;
+ default:
+ ttfError("Unrecognized CMAP format\n");
+ }
+}
+static void ttfPrintSubTable(FILE* fp,SubTablePtr ptable)
+{
+ USHORT format = ptable->format;
+
+ /* print encoding table */
+ fprintf(fp, " PlatformID: %2d\n",ptable->PlatformID);
+ fprintf(fp,"\t\t EcodingID: %2d\n",ptable->EncodingID);
+ fprintf(fp,"\t\t 'cmap' Offset: 0x%08x\n",ptable->offset);
+
+ /* print SubTable part */
+ fprintf(fp,"\t\t Length: %6d\n",ptable->length);
+ fprintf(fp,"\t\t Version: %6d\n",ptable->version);
+
+ switch(format)
+ {
+ case 0:
+ fprintf(fp,"\t\t Format 0 - Byte encoding table\n");
+ ttfPrintCMAP0(fp,ptable);
+ break;
+ case 2:
+ fprintf(fp,"\t\t Format 2 - High-byte mapping through table\n");
+ ttfPrintCMAP2(fp,ptable);
+ break;
+ case 4:
+ fprintf(fp,"\t\t Format 4 - Segment mapping to delta values\n");
+ ttfPrintCMAP4(fp,ptable);
+ break;
+ case 6:
+ fprintf(fp,"\t\t Format 6 - Trimmed table mapping\n");
+ ttfPrintCMAP6(fp,ptable);
+ break;
+ default:
+ ttfError("Unrecognized CMAP format\n");
+ }
+}
+static void ttfFreeSubTable(SubTablePtr ptable)
+{
+ USHORT format = ptable->format;
+
+ switch(format)
+ {
+ case 0:
+ ttfFreeCMAP0(ptable);
+ break;
+ case 2:
+ ttfFreeCMAP2(ptable);
+ break;
+ case 4:
+ ttfFreeCMAP4(ptable);
+ break;
+ case 6:
+ ttfFreeCMAP6(ptable);
+ break;
+ }
+}
+
+static CMAP0 * ttfAllocCMAP0(SubTablePtr subTable)
+{
+ CMAP0 * cmap0;
+
+ if ((cmap0 = (CMAP0 *) calloc(1,sizeof(CMAP0))) == NULL)
+ {
+ ttfError("Out Of Memory in __FILE__ : __LINE__ \n");
+ return NULL;
+ }
+ return cmap0;
+}
+static void ttfLoadCMAP0(FILE *fp,SubTablePtr subTable,ULONG offset)
+{
+ BYTE * array;
+
+ subTable->map.cmap0 = ttfAllocCMAP0(subTable);
+ array = subTable->map.cmap0->glyphIndexArray;
+
+ if (fseek(fp,offset,SEEK_SET) != 0)
+ ttfError("Fseek Failed in ttfLoadCMAP0 \n");
+
+ /* Attention: we get lots of bytes at once as a work around of the
+ * usual ttfGet*, this cause byte sex trouble as will be seen
+ * in the fellowing procedures */
+ if (fread(array,sizeof(BYTE),256,fp) != 256)
+ ttfError("Error when getting glyphIndexArray \n");
+}
+static void ttfPrintCMAP0(FILE *fp,SubTablePtr subTable)
+{
+ USHORT index;
+ int i;
+
+ for (i=0;i<256;i++)
+ {
+ index = ttfLookUpCMAP(subTable,i);
+ fprintf(fp,"\t\t Char %3d -> Index %4d \n",i,index);
+ }
+}
+static USHORT ttfLookUpCMAP0(SubTablePtr subTable,USHORT cc)
+{
+ return subTable->map.cmap0->glyphIndexArray[cc & 0x00ff];
+}
+static void ttfFreeCMAP0(SubTablePtr subTable)
+{
+ free(subTable->map.cmap0);
+}
+
+static void ttfLoadCMAP2(FILE *fp,SubTablePtr subTable,ULONG offset)
+{
+ USHORT * array,i,n = 0;
+ USHORT numGlyphId;
+ SubHeaderPtr header;
+
+ if (fseek(fp,offset,SEEK_SET) != 0)
+ ttfError("Fseek Failed in ttfLoadCMAP2 \n");
+
+ subTable->map.cmap2 = (CMAP2 *) calloc(1,sizeof(CMAP2));
+ array = subTable->map.cmap2->subHeaderKeys;
+
+ if (fread(array,sizeof(USHORT),256,fp) != 256)
+ ttfError("Error when getting subHeaderKeys \n");
+#ifndef WORDS_BIGENDIAN
+ TwoByteSwap((unsigned char *) array,256*sizeof(USHORT));
+#endif
+
+ for (i=0;i<256;i++)
+ {
+ array[i] /= 8;
+ if (n< array[i])
+ n = array[i]; /* find the max of subHeaderKeys */
+ }
+ n += 1; /* the number of subHeaders is one plus the max of subHeaderKeys */
+
+ subTable->map.cmap2->subHeaders = header =
+ (SubHeaderPtr) calloc(n,sizeof(SubHeader));
+ for (i=0;i<n;i++)
+ {
+ (header+i)->firstCode = ttfGetUSHORT(fp);
+ (header+i)->entryCount = ttfGetUSHORT(fp);
+ (header+i)->idDelta = ttfGetSHORT(fp);
+ (header+i)->idRangeOffset = ttfGetUSHORT(fp);
+
+ /* it makes things easier to let the offset starts from
+ * the beginning of glyphIndexArray */
+ if ((header+i)->idRangeOffset != 0)
+ (header+i)->idRangeOffset -= (sizeof(USHORT) +
+ (n-i-1) * sizeof(SubHeader)) ;
+ }
+
+ /* caculate the length of glyphIndexArray, this is ugly, there should be
+ * a better way to get this information. */
+ numGlyphId =
+ subTable->length - (256 + 3) * sizeof(USHORT) - n * sizeof(SubHeader);
+ numGlyphId /= sizeof(USHORT);
+ subTable->map.cmap2->glyphIndexArray =
+ (USHORT *) calloc(numGlyphId,sizeof(USHORT));
+ for (i=0;i<numGlyphId;i++)
+ {
+ subTable->map.cmap2->glyphIndexArray[i] = ttfGetUSHORT(fp);
+ }
+}
+static void ttfPrintCMAP2(FILE *fp,SubTablePtr subTable)
+{
+ USHORT i,j,numGlyphId;
+ USHORT *array,n=0,index;
+ SubHeaderPtr header;
+ unsigned short cc;
+
+ array = subTable->map.cmap2->subHeaderKeys;
+ header = subTable->map.cmap2->subHeaders;
+
+ for (i=0;i<256;i++)
+ {
+ /* find the number of subHeader */
+ if (n< array[i])
+ n = array[i];
+ fprintf(fp,"\t\t subHeaderKeys[%d] = %d\n",i,array[i]);
+ }
+ n += 1; /* the number of subHeaders is one plus the max of subHeaderKeys */
+ fprintf(fp,"\t\t Number of SubHeaders is %d\n",n);
+
+ for (i=0;i<=n;i++)
+ {
+ fprintf(fp,"\t\t SubHeader[%d]\n",i);
+ fprintf(fp,"\t\t firstCode \t 0x%04x\n",(header+i)->firstCode);
+ fprintf(fp,"\t\t entryCount \t %d\n",(header+i)->entryCount);
+ fprintf(fp,"\t\t idDelta \t %d\n",(header+i)->idDelta);
+ fprintf(fp,"\t\t idRangeOffset \t 0x%04x\n\n",
+ (header+i)->idRangeOffset);
+ }
+
+ /* caculate the length of glyphIndexArray, this is ugly, there should be
+ * a better way to get this information. */
+ numGlyphId =
+ subTable->length - (256 + 3) * sizeof(USHORT) - n * sizeof(SubHeader);
+ numGlyphId /= sizeof(USHORT);
+ fprintf(fp,"Number of glyphIndex: %d\n", numGlyphId);
+ for (i=0;i<numGlyphId;i++)
+ {
+ fprintf(fp,"\t\t glyphIdArray[%d] = %4d\n",i,
+ subTable->map.cmap2->glyphIndexArray[i]);
+ }
+
+ i = 0;
+ fprintf(fp,"\t\t First Byte:\t %2x\n",i);
+ for(j=0;j<=255;j++)
+ {
+#ifndef WORDS_BIGENDIAN
+ cc = i + (j << 8);
+#else
+ cc = j + (i << 8);
+#endif
+ index = ttfLookUpCMAP2(subTable,cc);
+ fprintf(fp,"\t\t Char %2x -> Index %d\n",j,index);
+ }
+ for (i=128;i<=255;i++)
+ {
+ fprintf(fp,"\t\t First Byte:\t %2x\n",i);
+ for(j=0;j<=255;j++)
+ {
+#ifndef WORDS_BIGENDIAN
+ cc = i + (j << 8);
+#else
+ cc = j + (i << 8);
+#endif
+ index = ttfLookUpCMAP2(subTable,cc);
+ fprintf(fp,"\t\t Char %2x -> Index %d\n",j,index);
+ }
+ }
+}
+static USHORT ttfLookUpCMAP2(SubTablePtr subTable,USHORT cc)
+{
+ USHORT index,idx = 0;
+ USHORT *array = subTable->map.cmap2->subHeaderKeys;
+ SubHeaderPtr headers = subTable->map.cmap2->subHeaders;
+ SHORT idDelta;
+ USHORT firstCode, entryCount, idRangeOffset;
+ unsigned char first,second;
+
+
+ /* On little endian platforms "low byte" is the "first byte".
+ * It determines that if it is necessary to use the second byte to
+ * fully interprete the character code, for expamle, if the first byte
+ * is obivously an ASCII character then it is not necessary to
+ * interpret the second byte, on the other hand, if the first byte is
+ * zero then the second byte is a ASCII char, when the first byte
+ * is not an ASCII char nor zero, those two bytes together determine
+ * the meanning of the character code
+ */
+#ifndef WORDS_BIGENDIAN
+ first = cc & 0x00ff;
+ second = cc >> 8;
+#else
+ first = cc >> 8;
+ second = cc & 0x00ff;
+#endif
+
+ /* select which subHeader to use */
+ idx = array[first];
+
+ firstCode = (headers+idx)->firstCode;
+ entryCount = (headers+idx)->entryCount;
+ idDelta = (headers+idx)->idDelta;
+ idRangeOffset = (headers+idx)->idRangeOffset / sizeof (USHORT);
+
+ if (second >= firstCode && second < firstCode+entryCount)
+ {
+ /* use idRangeOffset to find where in the glyphIndexArray
+ * the correspinding index is */
+ idRangeOffset += (second - firstCode);
+ index = subTable->map.cmap2->glyphIndexArray[idRangeOffset];
+ if (index != 0)
+ /* if the character is not a missing character then
+ * add idDelta to it */
+ index += idDelta;
+ }
+ else
+ /* The second code is out ranged then return the
+ * missing glyph character */
+ index = 0;
+
+ return index;
+}
+static void ttfFreeCMAP2(SubTablePtr subTable)
+{
+ free(subTable->map.cmap2->subHeaders);
+ free(subTable->map.cmap2->glyphIndexArray);
+ free(subTable->map.cmap2);
+}
+
+static void ttfLoadCMAP4(FILE *fp,SubTablePtr subTable,ULONG offset)
+{
+ USHORT segCount;
+ USHORT * array,len;
+
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLoadCMAP4 \n");
+
+ subTable->map.cmap4 = (CMAP4 *) calloc(1,sizeof(CMAP4));
+
+ subTable->map.cmap4->segCountX2 = segCount = ttfGetUSHORT(fp);
+ subTable->map.cmap4->searchRange = ttfGetUSHORT(fp);
+ subTable->map.cmap4->entrySelector = ttfGetUSHORT(fp);
+ subTable->map.cmap4->rangeShift = ttfGetUSHORT(fp);
+
+ segCount /= 2;
+ subTable->map.cmap4->endCount = array =
+ (USHORT *) calloc(segCount,sizeof(USHORT));
+ if (fread(array,sizeof(USHORT),segCount,fp) != segCount)
+ ttfError("Error when getting endCount\n");
+#ifndef WORDS_BIGENDIAN
+ TwoByteSwap((unsigned char *) array,segCount*sizeof(USHORT));
+#endif
+
+ subTable->map.cmap4->reservedPad = ttfGetUSHORT(fp);
+
+ subTable->map.cmap4->startCount = array =
+ (USHORT *) calloc(segCount,sizeof(USHORT));
+ if (fread(array,sizeof(USHORT),segCount,fp) != segCount)
+ ttfError("Error when getting startCount\n");
+#ifndef WORDS_BIGENDIAN
+ TwoByteSwap((unsigned char *) array,segCount*sizeof(USHORT));
+#endif
+
+ subTable->map.cmap4->idDelta = array =
+ (USHORT *) calloc(segCount,sizeof(USHORT));
+ if (fread(array,sizeof(USHORT),segCount,fp) != segCount)
+ ttfError("Error when getting idDelta\n");
+#ifndef WORDS_BIGENDIAN
+ TwoByteSwap((unsigned char *) array,segCount*sizeof(USHORT));
+#endif
+
+ subTable->map.cmap4->idRangeOffset = array =
+ (USHORT *) calloc(segCount,sizeof(USHORT));
+ if (fread(array,sizeof(USHORT),segCount,fp) != segCount)
+ ttfError("Error when getting idRangeOffset\n");
+#ifndef WORDS_BIGENDIAN
+ TwoByteSwap((unsigned char *) array,segCount*sizeof(USHORT));
+#endif
+
+ /* caculate the length of glyphIndexArray, this is ugly, there should be
+ * a better way to get this information. */
+ len = subTable->length - 8*sizeof(USHORT) - 4*segCount*sizeof(USHORT);
+ len /= sizeof(USHORT);
+ subTable->map.cmap4->glyphIndexArray = array =
+ (USHORT *) calloc(len,sizeof(USHORT));
+ if (fread(array,sizeof(USHORT),len,fp) != len)
+ ttfError("Error when getting idRangeOffset\n");
+#ifndef WORDS_BIGENDIAN
+ TwoByteSwap((unsigned char *) array,len*sizeof(USHORT));
+#endif
+}
+static void ttfPrintCMAP4(FILE *fp,SubTablePtr subTable)
+{
+ USHORT i;
+ USHORT segCount,len;
+
+ segCount = subTable->map.cmap4->segCountX2/2;
+ fprintf(fp, "\t\t segCount:\t %d\n", segCount);
+ fprintf(fp, "\t\t searchRange:\t %d\n", subTable->map.cmap4->searchRange);
+ fprintf(fp, "\t\t entrySelector:\t %d\n", subTable->map.cmap4->entrySelector);
+ fprintf(fp, "\t\t rangeShift:\t %d\n", subTable->map.cmap4->rangeShift);
+
+ for (i=0;i<segCount;i++)
+ {
+ fprintf(fp, "\t\t Seg %3d :", i);
+ fprintf(fp, " St = %04x,", subTable->map.cmap4->startCount[i]);
+ fprintf(fp, " En = %04x,", subTable->map.cmap4->endCount[i]);
+ /* should this filed be SHORT or USHORT ?? */
+ fprintf(fp, " D = %6d," ,
+ (subTable->map.cmap4->idDelta[i]));
+ fprintf(fp, " RO = %6d," , subTable->map.cmap4->idRangeOffset[i]);
+
+ /* find the glyphIndex correpsonding to this segment */
+ if (subTable->map.cmap4->idRangeOffset[i] != 0)
+ {
+ USHORT j;
+ j = subTable->map.cmap4->segCountX2/2 - i;
+ j = subTable->map.cmap4->idRangeOffset[i] -
+ j*sizeof(USHORT);
+ fprintf(fp, " gId# = %d\n",j/sizeof(USHORT));
+ }
+ else
+ fprintf(fp, " gId# = N/A\n");
+ }
+
+ /* caculate the length of glyphIndexArray, this is ugly, there should be
+ * a better way to get this information. */
+ len = subTable->length - 8*sizeof(USHORT) - 4*segCount*sizeof(USHORT);
+ len /= sizeof(USHORT);
+ fprintf(fp,"\t\t Number of glyphIndex %d\n",len);
+ for (i=0;i<len;i++)
+ {
+ fprintf(fp,"\t\t glyphIdArray[%d] = %d\n",i,
+ subTable->map.cmap4->glyphIndexArray[i]);
+ }
+
+ for (i=0;i<segCount;i++)
+ {
+ int j,index;
+ fprintf(fp,"Segment %d:\n",i);
+ for (j=subTable->map.cmap4->startCount[i];
+ j<=subTable->map.cmap4->endCount[i];j++)
+ {
+ index = ttfLookUpCMAP4(subTable,j);
+ fprintf(fp,"\t\tChar 0x%04x -> Index %d\n",j,index);
+ }
+ }
+}
+static USHORT ttfLookUpCMAP4(SubTablePtr subTable,USHORT cc)
+{
+ USHORT i;
+ USHORT index=0, segCount = subTable->map.cmap4->segCountX2/2;
+
+ for (i=0;i<segCount;i++)
+ {
+ if (cc <= subTable->map.cmap4->endCount[i] &&
+ cc >= subTable->map.cmap4->startCount[i])
+ {
+ USHORT j;
+ if (subTable->map.cmap4->idRangeOffset[i] != 0)
+ {
+ j = subTable->map.cmap4->idRangeOffset[i] -
+ (segCount - i)*sizeof(USHORT);
+ j = cc - subTable->map.cmap4->startCount[i] + j/2;
+ index = subTable->map.cmap4->glyphIndexArray[j];
+ if (index != 0)
+ index += subTable->map.cmap4->idDelta[i];
+ }
+ else
+ {
+ index = cc + subTable->map.cmap4->idDelta[i];
+ }
+ break;
+ }
+ }
+
+ return index;
+}
+static void ttfFreeCMAP4(SubTablePtr subTable)
+{
+ free(subTable->map.cmap4->endCount);
+ free(subTable->map.cmap4->startCount);
+ free(subTable->map.cmap4->idDelta);
+ free(subTable->map.cmap4->idRangeOffset);
+ free(subTable->map.cmap4->glyphIndexArray);
+ free(subTable->map.cmap4);
+}
+
+static void ttfLoadCMAP6(FILE *fp,SubTablePtr subTable,ULONG offset)
+{
+ USHORT * array,len;
+
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLoadCMAP6 \n");
+
+ subTable->map.cmap6 = (CMAP6 *) calloc(1,sizeof(CMAP6));
+ subTable->map.cmap6->firstCode = ttfGetUSHORT(fp);
+ subTable->map.cmap6->entryCount = len = ttfGetUSHORT(fp);
+ subTable->map.cmap6->glyphIndexArray = array =
+ (USHORT *) calloc(subTable->map.cmap6->entryCount,sizeof(USHORT));
+
+ if (fread(array,sizeof(USHORT),len,fp) != len)
+ ttfError("Error when getting idRangeOffset\n");
+#ifndef WORDS_BIGENDIAN
+ TwoByteSwap((unsigned char *) array,len*sizeof(USHORT));
+#endif
+}
+static void ttfPrintCMAP6(FILE *fp, SubTablePtr subTable)
+{
+ USHORT i;
+ fprintf(fp,"\t\t First Code: 0x%04x\n",subTable->map.cmap6->firstCode);
+ fprintf(fp,"\t\t Entry Count: %d\n",subTable->map.cmap6->entryCount);
+
+ for (i=0;i<subTable->map.cmap6->entryCount;i++)
+ {
+ fprintf(fp,"\t\t glyphIdArray[%d] = %d\n",i,
+ subTable->map.cmap6->glyphIndexArray[i]);
+ }
+}
+static USHORT ttfLookUpCMAP6(SubTablePtr subTable,USHORT cc)
+{
+ USHORT index;
+
+ index = cc - subTable->map.cmap6->firstCode;
+ if (index < subTable->map.cmap6->entryCount)
+ return subTable->map.cmap6->glyphIndexArray[index];
+ else
+ /* index out of range, return missing glyph */
+ return 0;
+}
+static void ttfFreeCMAP6(SubTablePtr subTable)
+{
+ free(subTable->map.cmap6->glyphIndexArray);
+ free(subTable->map.cmap6);
+}
+
diff --git a/Build/source/texk/ttfdump/libttf/cvt.c b/Build/source/texk/ttfdump/libttf/cvt.c
new file mode 100644
index 00000000000..364ae66f21a
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/cvt.c
@@ -0,0 +1,68 @@
+/* cvt.c -- Control Value Table
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: cvt.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: cvt.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+static void ttfLoadCVT(FILE *fp,FWord *cvt,USHORT lenght,ULONG offset);
+
+void ttfInitCVT(TTFontPtr font)
+{
+ ULONG tag = 'c' | 'v' << 8 | 't' << 16 | ' ' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->cvtLength = ptd->length / sizeof(FWord);
+ font->cvt = (FWord *) calloc(font->cvtLength, sizeof(FWord));
+ if (font->cvt != NULL)
+ ttfLoadCVT(font->fp,font->cvt,font->cvtLength,ptd->offset);
+ }
+}
+
+static void ttfLoadCVT(FILE *fp,FWord *cvt,USHORT length,ULONG offset)
+{
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLoadCVT \n");
+
+ if (fread(cvt, sizeof(FWord), length, fp) != length)
+ ttfError("Error when getting CVT\n");
+
+#ifndef WORDS_BIGENDIAN
+ TwoByteSwap((unsigned char *) cvt,length*sizeof(FWord));
+#endif
+}
+
+void ttfPrintCVT(FILE *fp, FWord *cvt, USHORT cvtLength)
+{
+ USHORT i;
+
+ fprintf(fp,"'cvt ' Table - Control Value Table\n");
+ fprintf(fp,"----------------------------------\n");
+ fprintf(fp,"Size = %d bytes, %d entries\n",cvtLength*sizeof(FWord),
+ cvtLength);
+
+ for (i=0;i<cvtLength;i++)
+ {
+ fprintf(fp,"\t %4d. \t %d\n",i,cvt[i]);
+ }
+ fprintf(fp,"\n");
+}
+
+void ttfFreeCVT(FWord *cvt)
+{
+ if (cvt != NULL)
+ free(cvt);
+}
diff --git a/Build/source/texk/ttfdump/libttf/depend.mak b/Build/source/texk/ttfdump/libttf/depend.mak
new file mode 100644
index 00000000000..21e51bc79bc
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/depend.mak
@@ -0,0 +1,386 @@
+$(objdir)/interp.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/gcache.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/prep.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/ttfutil.obj: \
+ ../include/ttf.h \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/tabledir.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/maxp.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/os2.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h \
+ ../include/os2_P.h
+
+$(objdir)/fpgm.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/name.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/ttfread.obj: \
+ ../include/ttf.h \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/ltsh.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/vdmx.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/cmap.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/cvt.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/pclt.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/fixed.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/hdmx.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/vmtx.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/disasm.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/head.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/glyf.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/stack.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/font.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/ttc.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h \
+ ../include/ttc.h
+
+$(objdir)/hhea.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/kern.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/hmtx.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/loca.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/gasp.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/gstate.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/post.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
+$(objdir)/vhea.obj: \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h
+
diff --git a/Build/source/texk/ttfdump/libttf/disasm.c b/Build/source/texk/ttfdump/libttf/disasm.c
new file mode 100644
index 00000000000..fc263ddcda9
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/disasm.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: disasm.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: disasm.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+void ttfPrintInstructions(FILE *fp, BYTE * ins)
+{
+ /* not implemented yet */
+}
+
+/* Pushing data onto the interpreter stack */
diff --git a/Build/source/texk/ttfdump/libttf/fixed.c b/Build/source/texk/ttfdump/libttf/fixed.c
new file mode 100644
index 00000000000..3b5276ff209
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/fixed.c
@@ -0,0 +1,16 @@
+/* fixed.c -- dealing with fixed point arithmetic
+ * Copyright (C) 1996 Li-Da Lho, All right reserved.
+ */
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: fixed.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: fixed.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
diff --git a/Build/source/texk/ttfdump/libttf/font.c b/Build/source/texk/ttfdump/libttf/font.c
new file mode 100644
index 00000000000..474d4f008e4
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/font.c
@@ -0,0 +1,160 @@
+/* font.c -- general font init and clean up codes
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+#include "protos.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: font.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: font.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static void ttfInitInterpreter(TTFontPtr font);
+
+TTFontPtr ttfInitFont(char *filename)
+{
+ TTFontPtr font;
+
+ font = (TTFontPtr) calloc(1,sizeof(TTFont));
+
+ font->ttfname = filename;
+ if ((font->fp = fopen (filename,"r")) == NULL)
+ {
+ fprintf(stderr,"Can't open ttf file %s\n",filename);
+ free(font);
+ return NULL;
+ }
+
+ ttfLoadFont(font, 0);
+ return font;
+}
+void ttfLoadFont(TTFontPtr font, ULONG offset)
+{
+ if (fseek(font->fp,offset,SEEK_SET) != 0)
+ ttfError("Fseek Failed\n");
+
+ /* offset table */
+ font->version = ttfGetFixed(font->fp);
+ font->numTables = ttfGetUSHORT(font->fp);
+
+ ttfInitTableDir(font,offset);
+
+ ttfLoadRequiredTables(font);
+ ttfLoadOptionalTables(font);
+
+ ttfInitInterpreter(font);
+
+ /* initialize the reference count to 1 */
+ font->refcount = (int *) calloc(1, sizeof(int));
+ *(font->refcount) = 1;
+}
+void ttfFreeFont(TTFontPtr font)
+{
+ ttfFreeRequiredTables(font);
+
+ ttfFreeOptionalTables(font);
+
+ ttfFreeTableDir(font->dir);
+ free(font->refcount);
+ free(font);
+}
+
+void ttfLoadRequiredTables(TTFontPtr font)
+{
+ ttfInitCMAP(font);
+ ttfInitNAME(font);
+
+ ttfInitMAXP(font);
+ ttfInitHEAD(font);
+ ttfInitLOCA(font);
+
+ ttfInitGlyphCache(font);
+ ttfInitGLYF(font);
+
+ ttfInitHHEA(font);
+ ttfInitHMTX(font);
+
+ ttfInitPOST(font);
+ ttfInitOS2(font);
+}
+
+void ttfFreeRequiredTables(TTFontPtr font)
+{
+ ttfFreeCMAP(font->cmap);
+ ttfFreeNAME(font->name);
+
+ ttfCleanUpGlyphCache(font);
+ ttfFreeLOCA(font->loca);
+ ttfFreeHEAD(font->head);
+ ttfFreeMAXP(font->maxp);
+
+ ttfFreeHMTX(font->hmtx);
+ ttfFreeHHEA(font->hhea);
+
+ ttfFreePOST(font->post);
+ ttfFreeOS2(font->os2);
+}
+
+void ttfLoadOptionalTables(TTFontPtr font)
+{
+ ttfInitCVT(font);
+ ttfInitFPGM(font);
+ ttfInitGASP(font);
+ ttfInitHDMX(font);
+ ttfInitKERN(font);
+ ttfInitPREP(font);
+ ttfInitLTSH(font);
+ ttfInitPCLT(font);
+ ttfInitVDMX(font);
+ ttfInitVHEA(font);
+ ttfInitVMTX(font);
+}
+void ttfFreeOptionalTables(TTFontPtr font)
+{
+ ttfFreeCVT(font->cvt);
+ ttfFreeFPGM(font->fpgm);
+ ttfFreeGASP(font->gasp);
+ ttfFreeHDMX(font->hdmx);
+ ttfFreeKERN(font->kern);
+ ttfFreePREP(font->prep);
+ ttfFreeLTSH(font->ltsh);
+ ttfFreePCLT(font->pclt);
+ ttfFreeVDMX(font->vdmx);
+ ttfFreeVHEA(font->vhea);
+ ttfFreeVMTX(font->vmtx);
+}
+
+/* make a clone of the origional font
+ * This is use for fonts that support more than one encoding scheme
+ *
+ * Problems:
+ * 1. which of those members can be shared between two instances
+ * 2. How can we free a font safely
+ */
+TTFontPtr ttfCloneFont(TTFontPtr font)
+{
+ TTFontPtr newfont;
+
+ newfont = (TTFontPtr) calloc(1,sizeof(TTFont));
+
+ memcpy(newfont, font, sizeof(TTFont));
+ newfont->refcount += 1;
+
+ return newfont;
+}
+static void ttfInitInterpreter(TTFontPtr font)
+{
+ ttfInitStorageArea(font);
+ ttfInitStack(font);
+ ttfInitGraphicsState(font);
+}
diff --git a/Build/source/texk/ttfdump/libttf/fpgm.c b/Build/source/texk/ttfdump/libttf/fpgm.c
new file mode 100644
index 00000000000..ad6ed3ee68d
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/fpgm.c
@@ -0,0 +1,53 @@
+/* fpgm.c -- Font Program
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: fpgm.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: fpgm.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+static void ttfLoadFPGM(FILE *fp,BYTE *fpgm,USHORT lenght,ULONG offset);
+
+void ttfInitFPGM(TTFontPtr font)
+{
+ ULONG tag = 'f' | 'p' << 8 | 'g' << 16 | 'm' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->fpgmLength = ptd->length;
+ font->fpgm = (BYTE *) calloc(font->fpgmLength, sizeof(BYTE));
+ if (font->fpgm != NULL)
+ ttfLoadFPGM(font->fp,font->fpgm,font->fpgmLength,ptd->offset);
+ }
+}
+
+static void ttfLoadFPGM(FILE *fp,BYTE *fpgm,USHORT length,ULONG offset)
+{
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLoadCVT \n");
+
+ if (fread(fpgm, sizeof(BYTE), length, fp) != length)
+ ttfError("Error when getting CVT\n");
+}
+
+void ttfPrintFPGM(FILE *fp, BYTE *fpgm, USHORT length)
+{
+ ttfPrintInstructions(fp, fpgm);
+}
+
+void ttfFreeFPGM(BYTE *fpgm)
+{
+ if (fpgm != NULL)
+ free(fpgm);
+}
diff --git a/Build/source/texk/ttfdump/libttf/gasp.c b/Build/source/texk/ttfdump/libttf/gasp.c
new file mode 100644
index 00000000000..4ab1aaaf11e
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/gasp.c
@@ -0,0 +1,95 @@
+/* gasp.c -- Grid-fitting And Scan-conversion Procedure
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: gasp.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: gasp.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static GASPPtr ttfAllocGASP(TTFontPtr font);
+static void ttfLoadGASP(FILE *fp,GASPPtr gasp,ULONG offset);
+
+void ttfInitGASP(TTFontPtr font)
+{
+ ULONG tag = 'g' | 'a' << 8 | 's' << 16 | 'p' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->gasp = ttfAllocGASP(font);
+ ttfLoadGASP(font->fp,font->gasp,ptd->offset);
+ }
+}
+static GASPPtr ttfAllocGASP(TTFontPtr font)
+{
+ GASPPtr gasp;
+
+ if ((gasp = (GASPPtr) calloc(1,sizeof(GASP))) == NULL)
+ {
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return gasp;
+}
+static void ttfLoadGASP (FILE *fp,GASPPtr gasp,ULONG offset)
+{
+ int i;
+
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLoadGASP \n");
+
+ gasp->version = ttfGetUSHORT(fp);
+ gasp->numRanges = ttfGetUSHORT(fp);
+
+ gasp->gaspRange = (GASPRANGE *) calloc(gasp->numRanges, sizeof(GASPRANGE));
+
+ if (gasp->gaspRange == NULL)
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ else
+ for (i=0;i<gasp->numRanges;i++)
+ {
+ gasp->gaspRange[i].rangeMaxPPEM = ttfGetUSHORT(fp);
+ gasp->gaspRange[i].rangeGaspBehavior = ttfGetUSHORT(fp);
+ }
+}
+
+void ttfPrintGASP(FILE *fp,GASPPtr gasp)
+{
+ int i;
+
+ fprintf(fp,"'gasp' Table - Grid-fitting And Scan-conversion Procedure\n");
+ fprintf(fp,"---------------------------------------------------------\n");
+
+ fprintf(fp,"'gasp' version:\t %d\n",gasp->version);
+ fprintf(fp,"numRanges: \t %d\n\n",gasp->numRanges);
+
+ for (i=0;i<gasp->numRanges;i++)
+ {
+ fprintf(fp,"\t gasp Range %d\n",i);
+ fprintf(fp,"\t rangeMaxPPEM:\t %d\n",
+ gasp->gaspRange[i].rangeMaxPPEM);
+ fprintf(fp,"\t rangeGaspBehavior:\t 0x%04x\n\n",
+ gasp->gaspRange[i].rangeGaspBehavior);
+ }
+ fprintf(fp,"\n");
+}
+
+void ttfFreeGASP(GASPPtr gasp)
+{
+ if (gasp != NULL)
+ {
+ free(gasp->gaspRange);
+ free(gasp);
+ }
+}
diff --git a/Build/source/texk/ttfdump/libttf/gcache.c b/Build/source/texk/ttfdump/libttf/gcache.c
new file mode 100644
index 00000000000..d926bebd680
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/gcache.c
@@ -0,0 +1,423 @@
+/*
+ * gcache.c -- Provide the cache mechanicsm for outlines
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ *
+ * This file is a little bit more complicated, the structure of the cache is
+ * described as fellow:
+ * Basically the cache can be divided onto two parts, the first one is a
+ * linear part which is a least recently utilitied list (LRU),
+ * the second part is the nonlinear one which is a binary serach tree.
+ * Normally each cache element is one the LRU as well as on the BST.
+ * Those glyph elements are allocated at once as an array of glyph cache
+ * elements at the init phase of glyph cache.
+ *
+ * font->gcache--
+ * |
+ * ________|
+ * |
+ * v
+ * ------------------------------------------------------------------
+ * |element 0| 1 | 2 | 3 | 4 | 5 | 6 | 7 | ...
+ * ------------------------------------------------------------------
+ * The first element of the glyph cache array serves as a dummy header
+ * for two purposes, one is for the head and tail of the LRU, the other is
+ * to point to the root of the BST. As a pointer to the root of the
+ * BST, the right subtree points to the root of the BST while the left one is
+ * not used and arbitrarly points to itself.
+ *
+ * After initialization, all the glyph cache element are on the LRU but
+ * none of them is on the BST.
+ *
+ * |-----------------------------------------------------------|
+ * | ------------- ------ ------ |
+ * |-> |head & tail| <-----> | |<-----> ...<----->| | <--|
+ * ------------- ------ ------
+ * / \ / \ / \
+ * / \ / \ / \
+ * left=self right=root left right left right
+ *
+ * The cached data are pointed by the entries of the glyph cache element
+ * in a strait forward fashion.
+ *
+ * |-----------------------------------------------------------|
+ * | ------------- ------ ------ |
+ * |-> |head & tail| <-----> | |<-----> ...<----->| | <--|
+ * ------------- ------ ------
+ * | | -------------|--|--------------------------------
+ * | |---->| | |-> array for flag, instruction|
+ * | -------------|-----------------------------------
+ * | -------------|-----------------------------------
+ * |------->| |----> xcoordinates, ycoordinates|
+ * -------------------------------------------------
+ * Implementation in this way is effecient for the reason that when we
+ * need to free the cache, we only need to do the two things
+ * 1. free the data pointed by the entries in the dummy header
+ * 2. free the dummy header
+ *
+ * Every time a glyph outline is required and ttfLoadGlyphCached is called,
+ * the glyph is searched on the BST with its offset as a key.
+ * If the glyph is on the BST then the address of the glyph cache is returned
+ * and the glyph cache is moved to the tail of the LRU such that the order of
+ * LRU is mantained.
+ * When the glyph required is not on the BST, something more complicated should
+ * be done.
+ * 1. Remove the first element on the LRU from the BST.
+ * 2. Load the glyph data to the cache element.
+ * 3. Insert the element back to the BST.
+ * 4. Move the element to the tail of the LRU.
+ *
+ * The only problem remain is how to deal with composite components.
+ * The asnwer simply is not to support cache for composite components at the
+ * current stage for the two reasons:
+ * 1. It will makes the code an order of magnitude more complicate to support
+ * composite glyf cache.
+ * 2. The space occupied by composite glyf is not very much
+ *
+ * It is not clear right now if it is wise to add tree balancing code.
+ * The overhaed introduced by BST seems minimal for 256 elements cache.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: gcache.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: gcache.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static GlyphCachePtr ttfAllocCache(TTFontPtr font);
+static void ttfInitCache(TTFontPtr font);
+static void ttfFreeCache(TTFontPtr font);
+static void ttfRotateCache(TTFontPtr font);
+static void ttfAllocCacheData(TTFontPtr font);
+static void ttfInitCacheData(TTFontPtr font);
+static void ttfFreeCacheData(TTFontPtr font);
+static void ttfInsertBST(TTFontPtr font,GlyphCachePtr gcache);
+static GlyphCachePtr ttfSearchBST(TTFontPtr font,ULONG offset);
+static void ttfDeleteBST(TTFontPtr font,ULONG offset);
+static void merge(GlyphCachePtr *root);
+static void copy(GlyphCachePtr *root);
+
+void ttfInitGlyphCache(TTFontPtr font)
+{
+ /* this should be made configurable */
+ if (font->maxp->numGlyphs > 256)
+ font->numCacheElements = 128;
+ else
+ font->numCacheElements = 64;
+
+ font->gcache = ttfAllocCache(font);
+ ttfInitCache(font);
+
+ ttfAllocCacheData(font);
+ ttfInitCacheData(font);
+}
+void ttfCleanUpGlyphCache(TTFontPtr font)
+{
+ ttfFreeCacheData(font);
+ ttfFreeCache(font);
+}
+
+/* provide cache mechanism for glyph */
+GLYFPtr ttfLoadGlyphCached(TTFontPtr font,ULONG offset)
+{
+#ifdef OLDCODE
+ GLYFPtr glyf;
+
+ glyf = &(font->gcache->next->glyf);
+ font->gcache->next->offset = offset;
+ ttfRotateCache(font);
+ ttfLoadGLYF(font->fp,glyf,offset);
+ return glyf;
+
+#else
+ GlyphCachePtr gcache;
+
+ if ((gcache = ttfSearchBST(font,offset)) == NULL)
+ {
+ /* if the glyph is not in the cache */
+ ttfDeleteBST(font,font->gcache->next->offset);
+ gcache = font->gcache->next;
+ font->gcache->next->offset = offset;
+ ttfRotateCache(font);
+ ttfLoadGLYF(font->fp,&gcache->glyf,offset);
+ ttfInsertBST(font,gcache);
+ }
+ return &gcache->glyf;
+#endif
+}
+
+/* alloc GlyphCache headers */
+static GlyphCachePtr ttfAllocCache(TTFontPtr font)
+{
+ USHORT numCache = font->numCacheElements+1;
+ GlyphCachePtr gcache;
+
+ if ((gcache = (GlyphCachePtr) calloc(numCache,sizeof(GlyphCache))) == NULL)
+ {
+ ttfError("Out of Memory");
+ return NULL;
+ }
+ return gcache;
+}
+/* threading glyph cache headers */
+static void ttfInitCache(TTFontPtr font)
+{
+ USHORT i,numCache = font->numCacheElements;
+ GlyphCachePtr cur,tmp;
+
+ cur = tmp = font->gcache;
+ tmp++;
+ /* there are numGlyph+1 of cache header, the first one is for
+ * mark as the head and tail of the queue */
+ for (i=0;i<numCache;i++)
+ {
+ cur->right = cur->left = NULL;
+ cur->next = tmp;
+ tmp->prev = cur;
+ cur = tmp;
+ tmp++;
+ }
+
+ /* make the LRU circular */
+ cur->next = font->gcache;
+ font->gcache->prev = cur;
+
+ /* make the dummy header point to it self on the BST */
+ font->gcache->left = font->gcache;
+ font->gcache->offset = 0;
+}
+static void ttfFreeCache(TTFontPtr font)
+{
+ free(font->gcache);
+}
+/* move the first element on the LRU the the tail */
+static void ttfRotateCache(TTFontPtr font)
+{
+ GlyphCachePtr gcache = font->gcache, tmp = font->gcache->next;
+
+ /* remove the first element */
+ gcache->next = tmp->next;
+ tmp->next->prev = gcache;
+ /* add the element to the tail */
+ tmp->next = gcache;
+ tmp->prev = gcache->prev;
+ gcache->prev->next = tmp;
+ gcache->prev = tmp;
+}
+static void ttfAllocCacheData(TTFontPtr font)
+{
+ USHORT numCache = font->numCacheElements+1;
+ USHORT maxPoints = font->maxp->maxPoints;
+ USHORT maxContours = font->maxp->maxContours;
+ USHORT insLength = font->maxp->maxSizeOfInstructions;
+
+ font->gcache->glyf.endPtsOfContours = (USHORT *) calloc(numCache*maxContours,
+ sizeof(USHORT));
+ font->gcache->glyf.instructions = (BYTE *) calloc(numCache*insLength,
+ sizeof(BYTE));
+ font->gcache->glyf.flags = (BYTE *) calloc(numCache*maxPoints,
+ sizeof(BYTE));
+ font->gcache->glyf.xCoordinates = (SHORT *) calloc(numCache*maxPoints,
+ sizeof(SHORT));
+ font->gcache->glyf.yCoordinates = (SHORT *) calloc(numCache*maxPoints,
+ sizeof(SHORT));
+ font->gcache->glyf.comp = NULL;
+}
+static void ttfInitCacheData(TTFontPtr font)
+{
+ USHORT i;
+ USHORT numCache = font->numCacheElements;
+ USHORT maxPoints = font->maxp->maxPoints;
+ USHORT maxContours = font->maxp->maxContours;
+ USHORT insLength = font->maxp->maxSizeOfInstructions;
+ GlyphCachePtr cur,tmp;
+
+ tmp = font->gcache;
+ cur = font->gcache->next;
+
+ for (i=0;i<numCache;i++)
+ {
+ /* makes the pointer in the cache element point to correct
+ * addresses in the data area */
+ cur->glyf.endPtsOfContours = tmp->glyf.endPtsOfContours + maxContours;
+ cur->glyf.instructions = tmp->glyf.instructions + insLength;
+ cur->glyf.flags = tmp->glyf.flags + maxPoints;
+ cur->glyf.xCoordinates = tmp->glyf.xCoordinates + maxPoints;
+ cur->glyf.yCoordinates = tmp->glyf.yCoordinates + maxPoints;
+ tmp = cur;
+ cur = cur++;
+ }
+}
+static void ttfFreeCacheData(TTFontPtr font)
+{
+ USHORT i,numCache = font->numCacheElements;
+ GlyphCachePtr cur = font->gcache+1;
+
+ /* free components of composite glyfs */
+ for (i=0;i<numCache;i++)
+ {
+ ttfFreeGLYF(&cur->glyf);
+ cur++;
+ }
+ free(font->gcache->glyf.endPtsOfContours);
+ free(font->gcache->glyf.instructions);
+ free(font->gcache->glyf.flags);
+ free(font->gcache->glyf.xCoordinates);
+ free(font->gcache->glyf.yCoordinates);
+}
+
+/* code to deal with nonlinear part of glyph cache */
+static void ttfInsertBST(TTFontPtr font,GlyphCachePtr gcache)
+{
+ GlyphCachePtr root,parent;
+
+ parent = font->gcache;
+ root = parent->right;
+
+ while (root)
+ {
+ parent = root;
+ if (root->offset > gcache->offset)
+ root = root->left;
+ else
+ root = root->right;
+ }
+
+ if (parent->offset > gcache->offset)
+ parent->left = gcache;
+ else
+ parent->right = gcache;
+}
+static GlyphCachePtr ttfSearchBST(TTFontPtr font,ULONG offset)
+{
+ GlyphCachePtr root = font->gcache->right;
+
+ while (root)
+ {
+ if (root->offset == offset)
+ return root;
+ if (root->offset > offset)
+ root = root->left;
+ else
+ root = root->right;
+ }
+ return NULL;
+}
+/* Deleting a node form a BST is a little bit tricky.
+ * Basically, there are three different situations for deleteing a node
+ * 1. The node to delete is a leaf, then just delete the node and make the
+ * node's parent point to null.
+ * 2. The node has one subtree, the let the node's parent adopt it.
+ * 3. The node has both subtrees, in this situation, there are two
+ * alternatives
+ * a. let the parent adopt one of the subtree and the subtree adopt the
+ * other. (delete by merge)
+ * b. replace the node with its precedeer, and leave the topology almost
+ * unchanged.
+ */
+static void ttfDeleteBST(TTFontPtr font,ULONG offset)
+{
+ GlyphCachePtr root,parent;
+
+ parent = font->gcache;
+ root = parent->right;
+
+ /* find the node to delete */
+ while (root)
+ {
+ if (root->offset == offset)
+ break;
+ parent = root;
+ if (root->offset > offset)
+ root = root->left;
+ else
+ root = root->right;
+ }
+ if (root != NULL)
+ {
+ /* the node to be deleted is on the tree */
+ if (root->glyf.numberOfContours < 0)
+ /* a composite glyf with components */
+ ttfFreeGLYF(&root->glyf);
+
+#ifdef MERGEDELETE
+ if (parent == font->gcache)
+ /* delete root */
+ merge(&parent->right);
+ else if (parent->left == root)
+ merge(&parent->left);
+ else
+ merge(&parent->right);
+#else
+ if (parent == font->gcache)
+ /* delete root */
+ copy(&parent->right);
+ else if (parent->left == root)
+ copy(&parent->left);
+ else
+ copy(&parent->right);
+#endif
+
+ root->left = root->right = NULL;
+ }
+ else
+ ; /* the tree is empty or the node is not on the tree */
+
+}
+
+static void merge(GlyphCachePtr *root)
+{
+ GlyphCachePtr tmp;
+
+ if ((*root)->right == NULL)
+ *root = (*root)->left;
+ else if ((*root)->left == NULL)
+ *root = (*root)->right;
+ else
+ {
+ /* the node to be attached has both left and right
+ * subtrees */
+ tmp = (*root)->left;
+ while (tmp->right)
+ {
+ tmp = tmp->right;
+ }
+ tmp->right = (*root)->right;
+ *root = (*root)->left;
+ }
+}
+static void copy(GlyphCachePtr *root)
+{
+ GlyphCachePtr tmp, parent;
+
+ if ((*root)->right == NULL)
+ *root = (*root)->left;
+ else if ((*root)->left == NULL)
+ *root = (*root)->right;
+ else
+ {
+ tmp = (*root)->left;
+ parent = *root;
+ while (tmp->right)
+ {
+ parent = tmp;
+ tmp = tmp->right;
+ }
+ tmp->right = (*root)->right;
+ if (parent != *root)
+ {
+ parent->right = tmp->left;
+ tmp->left = parent;
+ }
+ *root = tmp;
+ }
+}
diff --git a/Build/source/texk/ttfdump/libttf/glyf.c b/Build/source/texk/ttfdump/libttf/glyf.c
new file mode 100644
index 00000000000..e19eb7fb170
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/glyf.c
@@ -0,0 +1,438 @@
+/* glyf.c -- Load and print Glyf outline data
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: glyf.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: glyf.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static void ttfLoadSimpleGlyph(FILE *fp,GLYFPtr glyf,ULONG offset);
+static void ttfPrintSimpleGlyph(FILE *fp,GLYFPtr glyf);
+static void ttfLoadCompositeGlyph(FILE *fp,GLYFPtr glyf,ULONG offset);
+static void ttfPrintCompositeGlyph(FILE*fp,GLYFPtr glyf);
+static void ttfFreeCompositeGlyph(GLYFPtr glyf);
+double fix2dbl(F2Dot14 fixed);
+
+/* Naming convention about GLYF and Glyph:
+ * High level functions which are exported should have their name
+ * contain GLYF, on the other hand, low level function (or structures)
+ * which is not intended to be exported should have their name
+ * contain Glyph
+ */
+void ttfInitGLYF(TTFontPtr font)
+{
+ ULONG tag = 'g' | 'l' << 8 | 'y' << 16 | 'f' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag, font)) != NULL)
+ {
+ font->glyphOffset = ptd->offset;
+ }
+}
+/* offset: where the specified glyph really starts
+ * callers should compute this themself form the loca tables */
+void ttfLoadGLYF(FILE *fp, GLYFPtr glyf, ULONG offset)
+{
+ if (fseek(fp, offset, SEEK_SET) != 0)
+ ttfError("Fseek Failed in ttfLoadGLYF\n");
+
+ glyf->numberOfContours = ttfGetSHORT(fp);
+ glyf->xMin = ttfGetFWord(fp);
+ glyf->yMin = ttfGetFWord(fp);
+ glyf->xMax = ttfGetFWord(fp);
+ glyf->yMax = ttfGetFWord(fp);
+
+ offset += sizeof(USHORT) + 4*sizeof(FWord);
+
+ if (glyf->numberOfContours >= 0)
+ ttfLoadSimpleGlyph(fp, glyf, offset);
+ else
+ ttfLoadCompositeGlyph(fp, glyf, offset);
+}
+void ttfPrintGLYF(FILE *fp, GLYFPtr glyf)
+{
+ fprintf(fp,"\t numberOfContours:\t %d %s\n", glyf->numberOfContours,
+ glyf->numberOfContours == -1 ? "(Composite)": "");
+ fprintf(fp,"\t xMin:\t\t\t %d\n", glyf->xMin);
+ fprintf(fp,"\t yMin:\t\t\t %d\n", glyf->yMin);
+ fprintf(fp,"\t xMax:\t\t\t %d\n", glyf->xMax);
+ fprintf(fp,"\t yMax:\t\t\t %d\n\n", glyf->yMax);
+
+ if (glyf->numberOfContours >= 0)
+ ttfPrintSimpleGlyph(fp, glyf);
+ else
+ ttfPrintCompositeGlyph(fp, glyf);
+}
+void ttfFreeGLYF(GLYFPtr glyf)
+{
+ if (glyf->numberOfContours < 0)
+ ttfFreeCompositeGlyph(glyf);
+}
+static void ttfLoadSimpleGlyph(FILE *fp, GLYFPtr glyf, ULONG offset)
+{
+ SHORT nCnts = glyf->numberOfContours;
+ USHORT i,nIns,nPts;
+
+ if (fseek(fp, offset, SEEK_SET) != 0)
+ ttfError("Fseek Failed in ttfLoadSimpleGlyph\n");
+
+ if (fread(glyf->endPtsOfContours, sizeof(USHORT), nCnts, fp) != nCnts)
+ ttfError("Error when getting endPtsOfContours\n");
+#ifndef WORDS_BIGENDIAN
+ TwoByteSwap((unsigned char *) glyf->endPtsOfContours,
+ nCnts*sizeof(USHORT));
+#endif
+
+ if (nCnts != 0)
+ nPts = (glyf->endPtsOfContours)[nCnts-1]+1;
+ else
+ /* there seems to be something wrong with my interpretation of
+ * NOGLYPH chars, doing this way in case there is a char that has
+ * zero contour */
+ nPts = 0;
+
+ /* how to deal with zero instruction glyf properly ?? */
+ glyf->instructionLength = nIns = ttfGetUSHORT(fp);
+ if (nIns != 0)
+ {
+ if (fread(glyf->instructions, sizeof(BYTE), nIns, fp) != nIns)
+ ttfError("Error when getting instructions\n");
+ }
+
+ for (i=0;i<nPts;i++)
+ {
+ BYTE j,c;
+ if (((glyf->flags)[i] = c = ttfGetBYTE(fp)) & FLAGS_REPEAT)
+ { /* if this flag should be repeated */
+ j = ttfGetBYTE(fp); /* j times */
+ while (j--)
+ {
+ i++;
+ (glyf->flags)[i] = c;
+
+ }
+ }
+ }
+
+ for (i=0;i<nPts;i++)
+ {
+ BYTE flag;
+ flag = (glyf->flags)[i];
+
+ if (flag & FLAGS_X_SHORT_VECTOR)
+ { /* if the coordinate is a BYTE */
+ if (flag & FLAGS_X_SAME)
+ (glyf->xCoordinates)[i] = (SHORT) ttfGetBYTE(fp);
+ else
+ (glyf->xCoordinates)[i] = (SHORT) -ttfGetBYTE(fp);
+ }
+ else
+ { /* the coordiante is a SHORT */
+ if (flag & FLAGS_X_SAME)
+ (glyf->xCoordinates)[i] = 0;
+ else
+ (glyf->xCoordinates)[i] = ttfGetSHORT(fp);
+ }
+ }
+ for (i=0;i<nPts;i++)
+ {
+ BYTE flag;
+ flag = (glyf->flags)[i];
+
+ if (flag & FLAGS_Y_SHORT_VECTOR)
+ { /* if the coordinate is a BYTE */
+ if (flag & FLAGS_Y_SAME)
+ (glyf->yCoordinates)[i] = (SHORT) ttfGetBYTE(fp);
+ else
+ (glyf->yCoordinates)[i] = (SHORT) -ttfGetBYTE(fp);
+ }
+ else
+ { /* the coordiante is a SHORT */
+ if (flag & FLAGS_Y_SAME)
+ (glyf->yCoordinates)[i] = 0;
+ else
+ (glyf->yCoordinates)[i] = ttfGetSHORT(fp);
+ }
+ }
+}
+static void ttfPrintSimpleGlyph(FILE *fp, GLYFPtr glyf)
+{
+ USHORT i, nPts, nCnts;
+ SHORT x=0, y=0;
+
+ nPts = (glyf->endPtsOfContours)[glyf->numberOfContours-1]+1;
+ nCnts = glyf->numberOfContours;
+
+ fprintf(fp,"\t EndPoints\n");
+ fprintf(fp,"\t ---------\n");
+ for (i=0;i<nCnts;i++)
+ fprintf(fp,"\t %d: %2d\n",i,(glyf->endPtsOfContours)[i]);
+ fprintf(fp,"\n");
+
+ fprintf(fp,"\t Length of Instructions: %2d\n\n",glyf->instructionLength);
+ ttfPrintInstructions(fp,glyf->instructions);
+
+ fprintf(fp,"\t Flags\n");
+ fprintf(fp,"\t -----\n");
+ for (i=0;i<nPts;i++)
+ {
+ BYTE flag;
+ char buf[80];
+
+ flag = (glyf->flags)[i];
+
+ if (flag & FLAGS_Y_SAME)
+ sprintf(buf,"YDual ");
+ else
+ sprintf(buf," ");
+ if (flag & FLAGS_X_SAME)
+ strcat(buf,"XDual ");
+ else
+ strcat(buf," ");
+ if (flag & FLAGS_REPEAT)
+ strcat(buf,"Repeat ");
+ else
+ strcat(buf," ");
+ if (flag & FLAGS_Y_SHORT_VECTOR)
+ strcat(buf,"Y-Short ");
+ else
+ strcat(buf," ");
+ if (flag & FLAGS_X_SHORT_VECTOR)
+ strcat(buf,"X-Short ");
+ else
+ strcat(buf," ");
+ if (flag & FLAGS_ON_CURVE)
+ strcat(buf,"On \n");
+ else
+ strcat(buf,"Off\n");
+
+ fprintf(fp,"\t %2d: %s",i,buf);
+ }
+ fprintf(fp,"\n");
+ fprintf(fp,"\t Coordinates\n");
+ fprintf(fp,"\t -----------\n");
+ for (i=0;i<nPts;i++)
+ {
+ x += (glyf->xCoordinates)[i];
+ y += (glyf->yCoordinates)[i];
+ fprintf(fp,"\t %2d Rel ( %6d, %6d) -> Abs ( %6d, %6d)\n", i,
+ (glyf->xCoordinates)[i], (glyf->yCoordinates)[i], x, y);
+ }
+ fprintf(fp,"\n");
+}
+
+static void ttfLoadCompositeGlyph(FILE *fp, GLYFPtr glyf, ULONG offset)
+{
+ USHORT nIns,flags;
+ Component *cur;
+
+ if (fseek(fp, offset, SEEK_SET) != 0)
+ ttfError("Fseek Failed in ttfLoadCompositeGlyph\n");
+
+ if((glyf->comp = cur = (Component *) calloc(1, sizeof(Component))) == NULL)
+ ttfError("Out Of Memory\n");
+ cur->previous = NULL; /* beginning of a linked list */
+
+ do {
+ cur->flags = flags = ttfGetUSHORT(fp);
+ cur->glyphIndex = ttfGetUSHORT(fp);
+ if (flags & ARG_1_AND_2_ARE_WORDS)
+ {
+ (cur->data).args[0] = ttfGetSHORT(fp);
+ (cur->data).args[1] = ttfGetSHORT(fp);
+ }
+ else
+ (cur->data).args[0] = ttfGetUSHORT(fp);
+
+ if (flags & WE_HAVE_A_SCALE)
+ {
+ (cur->data).transform.scale = ttfGetF2Dot14(fp);
+ }
+ else if (flags & WE_HAVE_AN_X_AND_Y_SCALE)
+ {
+ (cur->data).transform.vector.xscale = ttfGetF2Dot14(fp);
+ (cur->data).transform.vector.yscale = ttfGetF2Dot14(fp);
+ }
+ else if (flags & WE_HAVE_A_TWO_BY_TWO)
+ {
+ (cur->data).transform.tensor.xscale = ttfGetF2Dot14(fp);
+ (cur->data).transform.tensor.scale01 = ttfGetF2Dot14(fp);
+ (cur->data).transform.tensor.scale10 = ttfGetF2Dot14(fp);
+ (cur->data).transform.tensor.yscale = ttfGetF2Dot14(fp);
+ }
+ /* allocate next component */
+ if ((cur->next = (Component *) calloc(1, sizeof(Component))) == NULL)
+ ttfError("Out Of Memory\n");
+
+ cur->next->previous = cur;
+ cur = cur->next; /* move to next component */
+ } while (flags & MORE_COMPONENT);
+ cur->next = NULL; /* end of the linked list */
+
+ if (flags & WE_HAVE_INSTRUCTIONS)
+ {
+ glyf->instructionLength = nIns = ttfGetUSHORT(fp);
+ if (fread(glyf->instructions, sizeof(BYTE), nIns, fp) != nIns)
+ ttfError("Error when loading instructions\n");
+ }
+ else
+ {
+ glyf->instructionLength = 0;
+ }
+}
+static void ttfPrintCompositeGlyph(FILE *fp, GLYFPtr glyf)
+{
+ int i = 0;
+ char buf[80];
+ USHORT flags;
+ Component *cur;
+
+ cur = glyf->comp;
+
+ do {
+ flags = cur->flags;
+ fprintf(fp, "\t %d: Flags:\t 0x%x\n", i, flags);
+ fprintf(fp, "\t Glyf Index:\t %d\n", cur->glyphIndex);
+ if (flags & ARGS_ARE_XY_VALUES)
+ {
+ if (flags & ARG_1_AND_2_ARE_WORDS)
+ {
+ fprintf(fp, "\t X WOffset:\t %d\n", (cur->data).args[0]);
+ fprintf(fp, "\t Y WOffset:\t %d\n", (cur->data).args[1]);
+ }
+ else
+ {
+ fprintf(fp, "\t X BOffset:\t %d\n",
+ (signed char) ((cur->data).args[0] >> 8 & 0xff));
+ fprintf(fp, "\t Y BOffset:\t %d\n",
+ (signed char) ((cur->data).args[0] & 0xff));
+ }
+ }
+ else
+ {
+ /* what the hell are the "patch points" ?? */
+ }
+
+ if (flags & WE_HAVE_A_SCALE)
+ {
+ fprintf(fp, "\t X,Y Scale:\t %f\n",
+ fix2dbl((cur->data).transform.scale));
+ }
+ else if (flags & WE_HAVE_AN_X_AND_Y_SCALE)
+ {
+ fprintf(fp, "\t X Scale:\t %f\n",
+ fix2dbl((cur->data).transform.vector.xscale));
+ fprintf(fp, "\t Y Scale:\t %f\n",
+ fix2dbl((cur->data).transform.vector.yscale));
+ }
+ else if (flags & WE_HAVE_A_TWO_BY_TWO)
+ {
+ fprintf(fp, "\t X Scale:\t %f\n",
+ fix2dbl((cur->data).transform.tensor.xscale));
+ fprintf(fp, "\t X,Y Scale:\t %f\n",
+ fix2dbl((cur->data).transform.tensor.scale01));
+ fprintf(fp, "\t Y,X Scale:\t %f\n",
+ fix2dbl((cur->data).transform.tensor.scale10));
+ fprintf(fp, "\t Y Scale:\t %f\n",
+ fix2dbl((cur->data).transform.tensor.yscale));
+ }
+
+ if (flags & ROUND_XY_TO_GRID)
+ sprintf(buf, "Round X,Y to Grid ");
+ else
+ sprintf(buf, " ");
+
+ if (flags & NO_OVERLAP)
+ strcat(buf, "NO Overlap ");
+ else
+ strcat(buf, " ");
+
+ if (flags & USE_MY_METRICS)
+ strcat(buf, "Use My Metrics ");
+ else
+ strcat(buf, " ");
+
+ fprintf(fp, "\t Others:\t %s\n\n", buf);
+
+ i++;
+ cur = cur->next;
+ } while (cur->next != NULL);
+
+ fprintf(fp, "\n");
+
+ if (flags & WE_HAVE_INSTRUCTIONS)
+ {
+ fprintf(fp,"\t Length of Instructions: %2d\n\n",
+ glyf->instructionLength);
+ ttfPrintInstructions(fp, glyf->instructions);
+ }
+}
+static void ttfFreeCompositeGlyph(GLYFPtr glyf)
+{
+ Component *cur,*next;
+
+ cur = glyf->comp;
+
+ do {
+ next = cur->next;
+ free(cur);
+ cur = next;
+ } while (cur != NULL);
+}
+
+/* what I want:
+ * outter procedures should not have any ideas about where the glyph starts,
+ *
+ * it just provide the TTFont structure and the character code or the index
+ * of that glyph. Procedures below should do:
+ * 1. look up where the glyph data is.
+ * 2. provided some glyph cache mechanism for the reason that
+ * a. it is not necessary to load all glyph into memory, especially for
+ * eastern languages.
+ * b. if a glyph data has been loaded previously, it is not necessary to
+ * load it again.
+ * c. malloc and free are SLOW !!
+ */
+/* Load a glyph by glyph index */
+GLYFPtr ttfLoadGlyphIndex(TTFont *font, USHORT idx)
+{
+ ULONG pos;
+ GLYFPtr glyf;
+
+ /* compute the actual place where the glyph stored */
+ pos = font->glyphOffset + ttfLookUpGlyfLOCA(font->loca, idx);
+ glyf = ttfLoadGlyphCached(font, pos);
+
+ return glyf;
+}
+/* Load a glyph by character code in the current encoding scheme */
+GLYFPtr ttfLoadGlyphCode(TTFont *font,USHORT cc)
+{
+ USHORT index;
+
+ index = ttfLookUpCMAP(font->encoding,cc);
+ return ttfLoadGlyphIndex(font,index);
+}
+
+double fix2dbl(F2Dot14 fixed)
+{
+ double mantissa, fraction;
+
+ mantissa = (double) (fixed >> 14);
+
+ fraction = (double) (double)(fixed & 0x3fff) / 16384.0;
+
+ return mantissa+fraction;
+}
diff --git a/Build/source/texk/ttfdump/libttf/gstate.c b/Build/source/texk/ttfdump/libttf/gstate.c
new file mode 100644
index 00000000000..ba94ca69c79
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/gstate.c
@@ -0,0 +1,43 @@
+/* gstate.c -- manage graphics state
+ * Copyright (C) 1996 Li-Da Lho, All right reserved.
+ */
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: gstate.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: gstate.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+GraphicsState gsdefault;
+
+void ttfInitGraphicsState(TTFontPtr font)
+{
+ /*font->gstate = GS_DEFAULT;
+ font->gstate_init = GS_DEFAULT;*/
+
+ /*ttfExecuteInstruction(font, font->fpgm);
+ ttfExecuteInstruction(font, font->prep);*/
+}
+
+void ttfInitStack(TTFontPtr font)
+{
+ font->vm.sp = 0;
+ font->vm.Stack = (LONG *) calloc (font->maxp->maxStackElements, sizeof(LONG));
+ if (font->vm.Stack == NULL)
+ ttfError("Out of memory\n");
+}
+
+void ttfInitStorageArea(TTFontPtr font)
+{
+ font->vm.StorageArea = (LONG *) calloc (font->maxp->maxStorage, sizeof(LONG));
+ if (font->vm.StorageArea == NULL)
+ ttfError("Out of memory\n");
+}
diff --git a/Build/source/texk/ttfdump/libttf/hdmx.c b/Build/source/texk/ttfdump/libttf/hdmx.c
new file mode 100644
index 00000000000..a1bd36d6ae7
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/hdmx.c
@@ -0,0 +1,110 @@
+/* hdmx.c -- Horizontal Device Metrics
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: hdmx.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: hdmx.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static HDMXPtr ttfAllocHDMX(TTFontPtr font);
+static void ttfLoadHDMX(FILE *fp,HDMXPtr hdmx,ULONG offset);
+
+void ttfInitHDMX(TTFontPtr font)
+{
+ ULONG tag = 'h' | 'd' << 8 | 'm' << 16 | 'x' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->hdmx = ttfAllocHDMX(font);
+ font->hdmx->numGlyphs = font->maxp->numGlyphs;
+ ttfLoadHDMX(font->fp,font->hdmx,ptd->offset);
+ }
+}
+static HDMXPtr ttfAllocHDMX(TTFontPtr font)
+{
+ HDMXPtr hdmx;
+
+ if ((hdmx = (HDMXPtr) calloc(1,sizeof(HDMX))) == NULL)
+ {
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return hdmx;
+}
+static void ttfLoadHDMX (FILE *fp,HDMXPtr hdmx,ULONG offset)
+{
+ int i;
+
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLoadHDMX \n");
+
+ hdmx->version = ttfGetUSHORT(fp);
+ hdmx->numDevices = ttfGetUSHORT(fp);
+ hdmx->size = ttfGetLONG(fp);
+
+ hdmx->Records = (DeviceRecord *) calloc(hdmx->numDevices,
+ sizeof(DeviceRecord));
+
+ if (hdmx->Records == NULL)
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ else
+ for (i=0;i<hdmx->numDevices;i++)
+ {
+ hdmx->Records[i].PixelSize = ttfGetBYTE(fp);
+ hdmx->Records[i].MaxWidth = ttfGetBYTE(fp);
+ hdmx->Records[i].Width = (BYTE *) calloc(hdmx->size,
+ sizeof(BYTE));
+ fread ((hdmx->Records+i)->Width, sizeof(BYTE),
+ hdmx->numGlyphs+1,fp);
+ }
+}
+
+void ttfPrintHDMX(FILE *fp,HDMXPtr hdmx)
+{
+ int i;
+
+ fprintf(fp,"'hdmx' Table - Horizontal Device Metrics\n");
+ fprintf(fp,"----------------------------------------\n");
+
+ fprintf(fp,"\t 'hdmx' version:\t %d\n",hdmx->version);
+ fprintf(fp,"\t # device records:\t %d\n",hdmx->numDevices);
+ fprintf(fp,"\t Record length:\t %d\n",hdmx->size);
+
+ for (i=0;i<hdmx->numDevices;i++)
+ {
+ int j;
+ fprintf(fp,"\t DevRec %d: ppem = %d, maxWid = %d\n",
+ i,hdmx->Records[i].PixelSize,hdmx->Records[i].MaxWidth);
+
+ for (j=0;j<hdmx->numGlyphs;j++)
+ fprintf(fp,"\t %d. \t %d\n",j,(hdmx->Records+i)->Width[j]);
+ fprintf(fp,"\n");
+ }
+ fprintf(fp,"\n");
+}
+
+void ttfFreeHDMX(HDMXPtr hdmx)
+{
+ int i;
+
+ if (hdmx != NULL)
+ {
+ for (i=0;i<hdmx->numDevices;i++)
+ free(hdmx->Records[i].Width);
+
+ free(hdmx->Records);
+ free(hdmx);
+ }
+}
diff --git a/Build/source/texk/ttfdump/libttf/head.c b/Build/source/texk/ttfdump/libttf/head.c
new file mode 100644
index 00000000000..93365d8f485
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/head.c
@@ -0,0 +1,108 @@
+/* head.c -- Header Table
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: head.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: head.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static HEADPtr ttfAllocHEAD(TTFontPtr font);
+static void ttfLoadHEAD(FILE *fp,HEADPtr head,ULONG offset);
+
+void ttfInitHEAD(TTFontPtr font)
+{
+ ULONG tag = 'h' | 'e' << 8 | 'a' << 16 | 'd' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->head = ttfAllocHEAD(font);
+ ttfLoadHEAD(font->fp,font->head,ptd->offset);
+ }
+}
+static HEADPtr ttfAllocHEAD(TTFontPtr font)
+{
+ HEADPtr head;
+
+ if ((head = (HEADPtr) calloc(1,sizeof(HEAD))) == NULL)
+ {
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return head;
+}
+static void ttfLoadHEAD(FILE *fp,HEADPtr head,ULONG offset)
+{
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLoadHEAD \n");
+
+ head->version = ttfGetFixed(fp);
+ head->fontRevision = ttfGetFixed(fp);
+ head->checkSumAdj = ttfGetULONG(fp);
+ head->magicNumber = ttfGetULONG(fp);
+ head->flags = ttfGetUSHORT(fp);
+ head->unitsPerEm = ttfGetUSHORT(fp);
+
+ fread(head->created,sizeof(char),8,fp);
+ fread(head->modified,sizeof(char),8,fp);
+
+ head->xMin = ttfGetFWord(fp);
+ head->yMin = ttfGetFWord(fp);
+ head->xMax = ttfGetFWord(fp);
+ head->yMax = ttfGetFWord(fp);
+
+ head->macStyle = ttfGetUSHORT(fp);
+ head->lowestRecPPEM = ttfGetUSHORT(fp);
+
+ head->fontDirectionHint = ttfGetSHORT(fp);
+ head->indexToLocFormat = ttfGetSHORT(fp);
+ head->glyphDataFormat = ttfGetSHORT(fp);
+}
+
+void ttfPrintHEAD(FILE *fp,HEADPtr head)
+{
+ int b1[2],b2[2];
+
+ FixedSplit(head->version,b1);
+ FixedSplit(head->fontRevision,b2);
+
+ fprintf(fp,"'head' Table - Font Header\n");
+ fprintf(fp,"--------------------------\n");
+ fprintf(fp,"\t 'head' version:\t %2d.%2d\n",b1[1],b1[0]);
+ fprintf(fp,"\t fontReversion:\t\t %2d.%2d\n",b2[1],b2[0]);
+ fprintf(fp,"\t checkSumAdjustment:\t 0x%08x\n",head->checkSumAdj);
+ fprintf(fp,"\t magicNumber:\t\t 0x%08x\n",head->magicNumber);
+ fprintf(fp,"\t flags:\t\t\t 0x%04x\n",head->flags);
+ fprintf(fp,"\t unitsPerEm:\t\t %d\n",head->unitsPerEm);
+
+ /* don't know how to compute */
+ fprintf(fp,"\t created:\n");
+ fprintf(fp,"\t modified:\n");
+
+ fprintf(fp,"\t xMin:\t\t\t %d\n",head->xMin);
+ fprintf(fp,"\t yMin:\t\t\t %d\n",head->yMin);
+ fprintf(fp,"\t xMax:\t\t\t %d\n",head->xMax);
+ fprintf(fp,"\t yMax:\t\t\t %d\n",head->yMax);
+ fprintf(fp,"\t macStyle bits:\t\t 0x%04x\n",head->macStyle);
+ fprintf(fp,"\t lowestRecPPEM:\t\t %d\n",head->lowestRecPPEM);
+ fprintf(fp,"\t fontDirectionHint:\t %d\n",head->fontDirectionHint);
+ fprintf(fp,"\t indexToLocFormat:\t %d\n",head->indexToLocFormat);
+ fprintf(fp,"\t glyphDataFormat:\t %d\n",head->glyphDataFormat);
+ fprintf(fp,"\n");
+}
+
+void ttfFreeHEAD(HEADPtr head)
+{
+ free(head);
+}
diff --git a/Build/source/texk/ttfdump/libttf/hhea.c b/Build/source/texk/ttfdump/libttf/hhea.c
new file mode 100644
index 00000000000..086f3b7c300
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/hhea.c
@@ -0,0 +1,95 @@
+/* hhea.c -- Horizontal header
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: hhea.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: hhea.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static HHEAPtr ttfAllocHHEA(TTFontPtr font);
+static void ttfLoadHHEA(FILE *fp,HHEAPtr hhea,ULONG offset);
+
+void ttfInitHHEA(TTFontPtr font)
+{
+ ULONG tag = 'h' | 'h' << 8 | 'e' << 16 | 'a' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->hhea = ttfAllocHHEA(font);
+ ttfLoadHHEA(font->fp,font->hhea,ptd->offset);
+ }
+}
+static HHEAPtr ttfAllocHHEA(TTFontPtr font)
+{
+ HHEAPtr hhea;
+
+ if ((hhea = (HHEAPtr) calloc(1,sizeof(HHEA))) == NULL)
+ {
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return hhea;
+}
+static void ttfLoadHHEA (FILE *fp,HHEAPtr hhea,ULONG offset)
+{
+ int i;
+
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLOADCMAP \n");
+
+ hhea->version = ttfGetFixed(fp);
+ hhea->Ascender = ttfGetFWord(fp);
+ hhea->Descender = ttfGetFWord(fp);
+ hhea->LineGap = ttfGetFWord(fp);
+ hhea->advanceWidthMax = ttfGetuFWord(fp);
+ hhea->minLeftSideBearing = ttfGetFWord(fp);
+ hhea->minRightSideBearing = ttfGetFWord(fp);
+ hhea->xMaxExtent = ttfGetFWord(fp);
+ hhea->caretSlopeRise = ttfGetSHORT(fp);
+ hhea->caretSlopeRun = ttfGetSHORT(fp);
+ for(i=0;i<5;i++)
+ (hhea->reserved)[i] = ttfGetSHORT(fp);
+ hhea->metricDataFormat = ttfGetSHORT(fp);
+ hhea->numberOfHMetrics = ttfGetUSHORT(fp);
+}
+
+void ttfPrintHHEA(FILE *fp,HHEAPtr hhea)
+{
+ int i,b[2];
+
+ FixedSplit(hhea->version,b);
+
+ fprintf(fp,"'hhea' Table - Horizontal Header\n");
+ fprintf(fp,"--------------------------\n");
+ fprintf(fp,"\t 'hhea' version:\t %2d.%2d\n",b[1],b[0]);
+ fprintf(fp,"\t yAscender:\t\t %d\n",hhea->Ascender);
+ fprintf(fp,"\t yDescender:\t\t %d\n",hhea->Descender);
+ fprintf(fp,"\t yLineGap:\t\t %d\n",hhea->LineGap);
+ fprintf(fp,"\t advanceWidthMax:\t %d\n",hhea->advanceWidthMax);
+ fprintf(fp,"\t minLeftSideBearing:\t %d\n",hhea->minLeftSideBearing);
+ fprintf(fp,"\t minRightSideBearing:\t %d\n",hhea->minRightSideBearing);
+ fprintf(fp,"\t xMaxExtent:\t\t %d\n",hhea->xMaxExtent);
+ fprintf(fp,"\t caretSlopeRise:\t %d\n",hhea->caretSlopeRise);
+ fprintf(fp,"\t caretSlopeRun:\t\t %d\n",hhea->caretSlopeRun);
+ for (i=0;i<5;i++)
+ fprintf(fp,"\t reserved%d:\t\t %d\n",i,(hhea->reserved)[i]);
+ fprintf(fp,"\t metricDataFormat:\t %d\n",hhea->metricDataFormat);
+ fprintf(fp,"\t numberOfHMetrics:\t %d\n",hhea->numberOfHMetrics);
+}
+
+void ttfFreeHHEA(HHEAPtr hhea)
+{
+ free(hhea);
+}
diff --git a/Build/source/texk/ttfdump/libttf/hmtx.c b/Build/source/texk/ttfdump/libttf/hmtx.c
new file mode 100644
index 00000000000..4d71edfe956
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/hmtx.c
@@ -0,0 +1,111 @@
+/* hmtx.c -- Horizontal Metrics Table
+ * Copyright (C) 1997 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: hmtx.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: hmtx.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static HMTXPtr ttfAllocHMTX(TTFontPtr font);
+static void ttfLoadHMTX(FILE *fp,HMTXPtr hmtx,ULONG offset);
+
+/* Caution: Because of interdependency between tables,
+ * table hhea and maxp should be well initalized before
+ * ttfInitHMTX is been called
+ */
+void ttfInitHMTX(TTFontPtr font)
+{
+ ULONG tag = 'h' | 'm' << 8 | 't' << 16 | 'x' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->hmtx = ttfAllocHMTX(font);
+ font->hmtx->numberOfHMetrics = font->hhea->numberOfHMetrics;
+ font->hmtx->numberOfLSB = font->maxp->numGlyphs -
+ font->hhea->numberOfHMetrics;
+ ttfLoadHMTX(font->fp,font->hmtx,ptd->offset);
+ }
+}
+static HMTXPtr ttfAllocHMTX(TTFontPtr font)
+{
+ HMTXPtr hmtx;
+
+ if ((hmtx = (HMTXPtr) calloc(1,sizeof(HMTX))) == NULL)
+ {
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return hmtx;
+}
+static void ttfLoadHMTX(FILE *fp,HMTXPtr hmtx,ULONG offset)
+{
+ USHORT i,n = hmtx->numberOfHMetrics,m=hmtx->numberOfLSB;
+
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLOADHMTX \n");
+
+ if ((hmtx->hMetrics = (longHorMetric *) calloc(n,sizeof(longHorMetric))) != NULL)
+ {
+ for (i=0;i<n;i++)
+ {
+ (hmtx->hMetrics+i)->advanceWidth = ttfGetuFWord(fp);
+ (hmtx->hMetrics+i)->lsb = ttfGetFWord(fp);
+ }
+ }
+ else
+ {
+ ttfError("Out Of Memory in __FILE__ : __LINE__\n");
+ }
+
+ /* codes dealing with leftSideBearing entry */
+ if (m && ((hmtx->leftSideBearing = (FWord *) calloc(m,sizeof(FWord))) != NULL))
+ {
+ for (i=0;i<m;i++)
+ {
+ (hmtx->leftSideBearing)[i] = ttfGetFWord(fp);
+ }
+ }
+}
+
+void ttfPrintHMTX(FILE *fp,HMTXPtr hmtx)
+{
+ int i;
+
+ fprintf(fp,"'hmtx' Table - Horizontal Metrics\n");
+ fprintf(fp,"---------------------------------\n");
+
+ for (i=0;i<hmtx->numberOfHMetrics;i++)
+ {
+ fprintf(fp,"\t %4d. advWid: %4d, LSBear: %4d\n",i,
+ (hmtx->hMetrics+i)->advanceWidth,
+ (hmtx->hMetrics+i)->lsb);
+ }
+
+ for (i=0;i<hmtx->numberOfLSB;i++)
+ {
+ fprintf(fp,"\t %4d. LSbear: %4d\n",i+hmtx->numberOfHMetrics,
+ (hmtx->leftSideBearing)[i]);
+ }
+}
+
+void ttfFreeHMTX(HMTXPtr hmtx)
+{
+ free(hmtx->hMetrics);
+
+ if (hmtx->numberOfLSB)
+ free(hmtx->leftSideBearing);
+
+ free(hmtx);
+}
diff --git a/Build/source/texk/ttfdump/libttf/interp.c b/Build/source/texk/ttfdump/libttf/interp.c
new file mode 100644
index 00000000000..6adfbee38bc
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/interp.c
@@ -0,0 +1,864 @@
+/* interp.c -- Instruction Interpreter
+ * Copyright (C) 1996 Li-Da Lho, All right reserved.
+ */
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: interp.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: interp.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+/* A bit about error checking: The execution of a TrueType instruction is
+ * "atomic" which mean that we don't process the error until a single
+ * instruction is fully decoded and exectued */
+
+/* Pushing data onto the interpreter stack */
+
+void Interp_NPUSHB (VirtualMachine *vm)
+{
+ BYTE i,n;
+ ULONG l;
+
+ n = GetBYTE(vm);
+
+ for (i=1;i<=n;i++)
+ {
+ /* unsigned extension to four bytes */
+ l = (ULONG) GetBYTE(vm);
+ Push(vm, l);
+ }
+}
+
+void Interp_NPUSHW(VirtualMachine *vm)
+{
+ BYTE i,n;
+ LONG l;
+
+ n = GetBYTE(vm);
+
+ for (i=1;i<=n;i++)
+ {
+ /* signed extension to four bytes */
+ l = (LONG) GetSHORT(vm);
+ Push(vm, l);
+ }
+
+}
+
+void Interp_PUSHB(VirtualMachine *vm)
+{
+ BYTE opcode,n,i;
+ ULONG l;
+
+ opcode = (vm->iStream)[vm->ip];
+ n = opcode - 0xB0;
+
+ for (i=0;i<=n;i++)
+ {
+ l = (ULONG) GetBYTE(vm);
+ Push(vm, l);
+ }
+}
+/* PUSHW[abc] Push Words
+ * Code Range 0xB8 - 0x0BF
+ * From IS w0,w1,...wn
+ * Pushes w0,w1,...wn */
+void Interp_PUSHW(VirtualMachine *vm)
+{
+ BYTE opcode,n,i;
+ LONG l;
+
+ opcode = (vm->iStream)[vm->ip];
+ n = opcode - 0xB8;
+
+ for (i=0;i<=n;i++)
+ {
+ l = (LONG) GetSHORT(vm);
+ Push(vm,l);
+ }
+}
+
+/* Managing the Storage Area */
+
+/* RS[] Read Store
+ * Code Range 0x43
+ * Pops location: Storage Area location (ULONG)
+ * Pushes value: Storage Area value (ULONG)
+ * Gets Storage Area value */
+void Interp_RS(VirtualMachine *vm)
+{
+ ULONG location,value;
+
+ location = Pop(vm);
+ value = (vm->StorageArea)[location];
+ Push(vm,value);
+}
+/* WS[] Write Store
+ * Code Range 0x42
+ * Pops value: Storage Area value (ULONG)
+ * location: Storage Area location (ULONG)
+ * Pushes -
+ * Sets Storage Area */
+void Interp_WS(VirtualMachine *vm)
+{
+ ULONG location,value;
+
+ value = Pop(vm);
+ location = Pop(vm);
+ (vm->StorageArea)[location] = value;
+}
+
+/* Managing the Control Value Table */
+
+/* WCVTP[] Write control Value Table in Pixel units
+ * Code Range 0x44
+ * Pops value: number in pixels (F26Dot6)
+ * location: Control Value Table location (ULONG)
+ * Pushes -
+ * Sets Control Value Table entry */
+void Interp_WCVTP(VirtualMachine *vm)
+{
+ F26Dot6 value;
+ ULONG location;
+
+ value = Pop(vm);
+ location = Pop(vm);
+
+ (vm->cvt)[location] = value;
+}
+/* WCVTF[] Write Control Value Table in FUnits
+ * Code Range 0x70
+ * Pops value: number in FUnits (ULONG) (LONG actually,i think)
+ * location: Control Value (ULONG)
+ * Pushes -
+ * Sets Control Value Table entry
+ */
+void Interp_WCVTF(VirtualMachine *vm)
+{
+ ULONG location;
+ LONG value;
+
+ value = Pop(vm);
+ location = Pop(vm);
+
+ value = ScaleToPoints(vm,value);
+ (vm->cvt)[location] = value;
+}
+/* RCVT[] Read Control Value Table
+ * Code Range 0x45
+ * Pops location: CVT entry number (ULONG)
+ * Pushes value: CVT value (F26Dot6)
+ * Gets Control Value Table entry
+ */
+void Interp_RCVT(VirtualMachine *vm)
+{
+ ULONG location;
+ F26Dot6 value;
+
+ location = Pop(vm);
+ value = (vm->cvt)[location];
+ Push(vm,value);
+}
+
+/* Managing Graphics State */
+
+/* SVTCA[a] Set freedom and projection vector to Coordinate Axia
+ * Code Range 0x00 - 0x01
+ * a 0: set to y axis
+ * 1: set to x axis
+ * Pops -
+ * Pushes -
+ * Sets projection_vector
+ * freedom_vector
+ */
+void Interp_SVTCA(VirtualMachine *vm)
+{
+ BYTE opcode;
+ TTFUnitVector vect;
+
+ opcode = (vm->iStream)[vm->ip];
+ switch (opcode)
+ {
+ case 0x00:
+ vect.x = 0;
+ vect.y = F2Dot14_ONE;
+ break;
+ case 0x01:
+ vect.x = F2Dot14_ONE;
+ vect.y = 0;
+ break;
+ }
+ vm->gstate.projection_vector = vm->gstate.freedom_vector = vect;
+}
+/* SPVCA[a] Set projection vector to coordinate axis
+ * Code Range 0x02 - 0x03
+ * a 0: set to y axis
+ * 1: set to x axis
+ * Pops -
+ * Pushes -
+ * Sets projection vector
+ */
+void Interp_SPVTCA(VirtualMachine *vm)
+{
+ BYTE opcode;
+ TTFUnitVector vect;
+
+ opcode = (vm->iStream)[vm->ip];
+ switch (opcode)
+ {
+ case 0x02:
+ vect.x = 0;
+ vect.y = F2Dot14_ONE;
+ break;
+ case 0x03:
+ vect.x = F2Dot14_ONE;
+ vect.y = 0;
+ break;
+ }
+ vm->gstate.projection_vector = vect;
+}
+/* SFVTCA[a] Set freedom vector to coordinate axis
+ * Code Range 0x04 - 0x05
+ * a 0: set to y axis
+ * 1: set to x axis
+ * Pops -
+ * Pushes -
+ * Sets freedom vector
+ */
+void Interp_SFVTCA(VirtualMachine *vm)
+{
+ BYTE opcode;
+ TTFUnitVector vect;
+
+ opcode = (vm->iStream)[vm->ip];
+ switch (opcode)
+ {
+ case 0x04:
+ vect.x = 0;
+ vect.y = F2Dot14_ONE;
+ break;
+ case 0x05:
+ vect.x = F2Dot14_ONE;
+ vect.y = 0;
+ break;
+ }
+ vm->gstate.freedom_vector = vect;
+}
+/* SPVTL[a] Set projection vector to line
+ * Code Range 0x06 - 0x07
+ * a 0: set projection_vector to be parallel to line segment from p1
+ * to p2
+ * 1: set projection_vector to be perpendicular to line segment from
+ * p1 to p2; the vector is retated counter clockwise 90 degrees
+ * Pops p1: point number (ULONG)
+ * p2: point number (ULONG)
+ * Pushes -
+ * Uses point p1 in the zone pointed at by zp2
+ * point p2 in the zone pointed at by zp1
+ * Sets projection vector
+ */
+void Interp_SPVTL(VirtualMachine *vm)
+{
+ ULONG p1,p2;
+ BYTE opcode;
+ TTFUnitVector vect;
+
+ opcode = (vm->iStream)[vm->ip];
+ p1 = Pop(vm);
+ p2 = Pop(vm);
+
+ switch (opcode)
+ {
+ /* not finished yet */
+ case 0x06:
+ break;
+ case 0x07:
+ break;
+ }
+ vm->gstate.projection_vector = vect;
+}
+/* SFVTL[a] Set freedom vector to line
+ * Code Range 0x08 - 0x09
+ * a 0: set freedom_vector to be parallel to line segment from p1
+ * to p2
+ * 1: set freedom_vector to be perpendicular to line segment from
+ * p1 to p2; the vector is retated counter clockwise 90 degrees
+ * Pops p1: point number (ULONG)
+ * p2: point number (ULONG)
+ * Pushes -
+ * Uses point p1 in the zone pointed at by zp2
+ * point p2 in the zone pointed at by zp1
+ * Sets freedom vector
+ */
+void Interp_SFVTL(VirtualMachine *vm)
+{
+ ULONG p1,p2;
+ BYTE opcode;
+ TTFUnitVector vect;
+
+ opcode = (vm->iStream)[vm->ip];
+ p1 = Pop(vm);
+ p2 = Pop(vm);
+ switch (opcode)
+ {
+ /* not finished yet */
+ case 0x08:
+ break;
+ case 0x09:
+ break;
+ }
+ vm->gstate.freedom_vector = vect;
+}
+/* SFVTPV[] Set freedom vector to projection vector
+ * Code Range 0x0E
+ * Pops -
+ * Pushes -
+ * Sets freedom vector
+ */
+void Interp_SFVTPV(VirtualMachine *vm)
+{
+ vm->gstate.freedom_vector = vm->gstate.projection_vector;
+}
+/* SDPVTL[a] Set dual projection vector to line
+ * Code Range 0x86 - 0x87
+ * a 0: vectors are parallel to line
+ * 1: vectors are perpendicular to line
+ * Pops p1: first point number (ULONG)
+ * p2: second point number (ULONG)
+ * Pushes -
+ * Sets dual_projection_vector and projection_vector
+ * Uses point p1 in the zone pointed by zp2
+ * point p2 in the zone pointed by zp1
+ */
+void Interp_SDPVTL(VirtualMachine *vm)
+{
+ ULONG p1,p2;
+ BYTE opcode;
+ TTFUnitVector vect;
+
+ opcode = (vm->iStream)[vm->ip];
+ p1 = Pop(vm);
+ p2 = Pop(vm);
+ switch (opcode)
+ {
+ /* not finished yet */
+ case 0x86:
+ break;
+ case 0x87:
+ break;
+ }
+ vm->gstate.dual_projection_vector = vm->gstate.projection_vector = vect;
+}
+/* SPVFS[] Set projection vector from stack
+ * Code Range 0x0A
+ * Pops y: y component of projection vector (2.14 padded with zeros)
+ * x: x component of projection vector (2.14 padded with zeros)
+ * Pushes -
+ * Sets projection_vector
+ */
+void Inpterp_SPVFS(VirtualMachine *vm)
+{
+ F2Dot14 x,y;
+
+ x = Pop(vm);
+ y = Pop(vm);
+
+ vm->gstate.projection_vector.x = x;
+ vm->gstate.projection_vector.y = y;
+ /* vm->gstate.projection = Normalize(vm->gstate.projection); ?? */
+}
+/* SFVFS[] Set freedom vector form stack
+ * Code Range 0x0B
+ * Pops y: y component of freedom vector (2.14 padded with zeros)
+ * x: x component of freedom vector (2.14 padded with zeros)
+ * Pushes -
+ * Sets freedom_vector
+ */
+void Inpterp_SFVFS(VirtualMachine *vm)
+{
+ F2Dot14 x,y;
+
+ x = Pop(vm);
+ y = Pop(vm);
+
+ vm->gstate.freedom_vector.x = x;
+ vm->gstate.freedom_vector.y = y;
+ /* vm->gstate.freedom = Normalize(vm->gstate.freedom); ?? */
+}
+/* GPV[] Get projection vector
+ * Code Range 0x0C
+ * Pops -
+ * Pushes x: x component of projection vector (2.14 padded with zeros)
+ * y: y component of projection vector (2.14 padded with zeros)
+ * Gets projection vector
+ */
+void Interp_GPV(VirtualMachine *vm)
+{
+ ULONG l;
+
+ l = (ULONG) vm->gstate.projection_vector.x;
+ Push(vm,l);
+ l = (ULONG) vm->gstate.projection_vector.y;
+ Push(vm,l);
+}
+/* GFV[] Get freedom vector
+ * Code Range 0x0D
+ * Pops -
+ * Pushes x: x component of freedom vector (2.14 padded with zeros)
+ * y: y component of freedom vector (2.14 padded with zeros)
+ * Gets freedom vector
+ */
+void Interp_GFV(VirtualMachine *vm)
+{
+ ULONG l;
+
+ l = (ULONG) vm->gstate.freedom_vector.x;
+ Push(vm,l);
+ l = (ULONG) vm->gstate.freedom_vector.y;
+ Push(vm,l);
+}
+/* SRP0[] Set reference point 0
+ * Code Range 0x10
+ * Pops p: point number (ULONG)
+ * Pushes -
+ * Sets rp0
+ * Affects IP,MDAP,MIAP,MIRP,MSIRP,SHC,SHE,SHP
+ */
+void Inpter_SRP0(VirtualMachine *vm)
+{
+ vm->gstate.rp0 = Pop(vm);
+}
+/* SRP1[] Set reference point 1
+ * Code Range 0x11
+ * Pops p: point number (ULONG)
+ * Pushes -
+ * Sets rp1
+ * Affects IP,MDAP,MIAP,MIRP,MSIRP,SHC,SHE,SHP
+ */
+void Inpter_SRP1(VirtualMachine *vm)
+{
+ vm->gstate.rp1 = Pop(vm);
+}
+/* SRP2[] Set reference point 2
+ * Code Range 0x12
+ * Pops p: point number (ULONG)
+ * Pushes -
+ * Sets rp2
+ * Affects IP,MDAP,MIAP,MIRP,MSIRP,SHC,SHE,SHP
+ */
+void Inpter_SRP2(VirtualMachine *vm)
+{
+ vm->gstate.rp2 = Pop(vm);
+}
+/* SZP0[] Set zone pointer 0
+ * Code Range 0x13
+ * Pops n: zone number (ULONG)
+ * Pushes -
+ * Sets zp0
+ * Affects ALIGNPTS,ALIGNRP,DELTAP1,DELTAP2,DELTAP3,IP,ISECT,MD,MDAP,MIAP,
+ * MIRP,MSIRP,SHC,SHE,SHP,UTP
+ */
+void Inpterp_SZP0(VirtualMachine *vm)
+{
+ vm->gstate.zp0 = Pop(vm);
+}
+/* SZP1[] Set zone pointer 1
+ * Code Range 0x14
+ * Pops n: zone number (ULONG)
+ * Pushes -
+ * Sets zp1
+ * Affects ALIGNPTS,ALIGNRP,DELTAP1,DELTAP2,DELTAP3,IP,ISECT,MD,MDAP,MIAP,
+ * MIRP,MSIRP,SHC,SHE,SHP,UTP
+ */
+void Inpterp_SZP1(VirtualMachine *vm)
+{
+ vm->gstate.zp1 = Pop(vm);
+}
+/* SZP2[] Set zone pointer 2
+ * Code Range 0x15
+ * Pops n: zone number (ULONG)
+ * Pushes -
+ * Sets zp2
+ * Affects ALIGNPTS,ALIGNRP,DELTAP1,DELTAP2,DELTAP3,IP,ISECT,MD,MDAP,MIAP,
+ * MIRP,MSIRP,SHC,SHE,SHP,UTP
+ */
+void Inpterp_SZP2(VirtualMachine *vm)
+{
+ vm->gstate.zp2 = Pop(vm);
+}
+/* SZPS[] Set zone pointerS
+ * Code Range 0x16
+ * Pops n: zone number (ULONG)
+ * Pushes -
+ * Sets zp0,zp1,zp2
+ * Affects ALIGNPTS,ALIGNRP,DELTAP1,DELTAP2,DELTAP3,IP,ISECT,MD,MDAP,MIAP,
+ * MIRP,MSIRP,SHC,SHE,SHP,UTP
+ */
+void Inpterp_SZPS(VirtualMachine *vm)
+{
+ vm->gstate.zp0 = vm->gstate.zp1 = vm->gstate.zp2 = Pop(vm);
+}
+/* RTHG[] Round to half grid
+ * Code Range 0x19
+ * Pops -
+ * Pushes -
+ * Sets round_state
+ * Affects MDAP,MDRP,MDIAP,MIRP,ROUND
+ * Uses freedom_vector, projection_vetor
+ */
+void Interp_RTHG(VirtualMachine *vm)
+{
+ vm->gstate.round_state = 0;
+}
+/* RTG[] Round to grid
+ * Code Range 0x18
+ * Pops -
+ * Pushes -
+ * Sets round_state
+ * Affects MDAP,MDRP,MDIAP,MIRP,ROUND
+ * Uses freedom_vector, projection_vetor
+ */
+void Interp_RTG(VirtualMachine *vm)
+{
+ vm->gstate.round_state = 1;
+}
+/* RTDG[] Round to double grid
+ * Code Range 0x3D
+ * Pops -
+ * Pushes -
+ * Sets round_state
+ * Affects MDAP,MDRP,MDIAP,MIRP,ROUND
+ * Uses freedom_vector, projection_vetor
+ */
+void Interp_RTDG(VirtualMachine *vm)
+{
+ vm->gstate.round_state = 2;
+}
+/* RTHG[] Round down to grid
+ * Code Range 0x7D
+ * Pops -
+ * Pushes -
+ * Sets round_state
+ * Affects MDAP,MDRP,MDIAP,MIRP,ROUND
+ * Uses freedom_vector, projection_vetor
+ */
+void Interp_RDTG(VirtualMachine *vm)
+{
+ vm->gstate.round_state = 3;
+}
+/* RUTG[] Round up to grid
+ * Code Range 0x7C
+ * Pops -
+ * Pushes -
+ * Sets round_state
+ * Affects MDAP,MDRP,MDIAP,MIRP,ROUND
+ * Uses freedom_vector, projection_vetor
+ */
+void Interp_RUTG(VirtualMachine *vm)
+{
+ vm->gstate.round_state = 4;
+}
+/* ROFF[] Round off
+ * Code Range 0x7A
+ * Pops -
+ * Pushes -
+ * Sets round_state
+ * Affects MDAP,MDRP,MDIAP,MIRP,ROUND
+ * Uses freedom_vector, projection_vetor
+ */
+void Interp_ROFF(VirtualMachine *vm)
+{
+ vm->gstate.round_state = 5;
+}
+/* SROUND[] Super round
+ * Code Range 0x76
+ * Pops n: number (ULONG) decomposed to obtain period, phase, threshold
+ * Pushes -
+ * Sets round_state
+ * Affects MDAP,MDRP,MIAP,MIRP,ROUND
+ */
+void Interp_SROUND(VirtualMachine *vm)
+{
+ ULONG n;
+
+ n = Pop(vm);
+ /* not finished yet */
+}
+/* S45ROUND[] Super round 45 degrees
+ * Code Range 0x77
+ * Pops n: number (ULONG) decomposed to obtain period, phase, threshold
+ * Pushes -
+ * Sets round_state
+ * Affects MDAP,MDRP,MIAP,MIRP,ROUND
+ */
+void Interp_S45ROUND(VirtualMachine *vm)
+{
+ ULONG n;
+
+ n = Pop(vm);
+ /* not finished yet */
+}
+/* SLOOP[] Set LOOP variable
+ * Code Range 0x17
+ * Pops n: value for loop graphics state variable
+ * Pushes -
+ * Set loop
+ * Affects ALIGNRP,FLIPPT,IP,SHP,SHIP
+ */
+void Interp_SLOOP(VirtualMachine *vm)
+{
+ vm->gstate.loop = Pop(vm);
+}
+/* SMD[] Set minimum_distance
+ * Code Range 0x1a
+ * Pops distance: value for minimum_distance (F26Dot6)
+ * Pushes -
+ * Sets minimum_distance
+ */
+void Interp_SMD(VirtualMachine *vm)
+{
+ vm->gstate.minimum_distance = Pop(vm);
+}
+/* INSTCTRL[] Instruction execution control
+ * Code Range 0x8E
+ * Pops s: selector flags
+ * value: USHORT padded to 32 bits used to set value of
+ * instruction control
+ * Pushes -
+ * Sets instruction_control
+ */
+void Interp_INSTCTRL(VirtualMachine *vm)
+{
+ ULONG flag;
+
+ flag = Pop(vm);
+ vm->gstate.instruction_control = Pop(vm);
+ /* not finished yet */
+}
+/* SCANCTRL[] Scan conversion cotrol
+ * Code Range 0x85
+ * Pops n: flags indication when to turn on dropout mode (16 bits padded
+ * to 32 bits)
+ * Pushes -
+ * Sets scan_control
+ */
+void Interp_SCANCTRL(VirtualMachine *vm)
+{
+ USHORT flag;
+
+ flag = Pop(vm);
+ /* not finished yet */
+}
+/* SCANTYPE[] Scantype
+ * Code Range 0x8D
+ * Pops n: 16 bit interger
+ * Pushes -
+ * Sets scan_control
+ */
+void Interp_SCANTYPE(VirtualMachine *vm)
+{
+ /* not finished yet */
+}
+/* SCVTCI[] Set control value table cut in
+ * Code Range 0x1D
+ * Pops n: value for cut_in (F26Dot6)
+ * Pushes -
+ * Sets control_value_cut_in
+ * Affects MIAP,MIRP
+ */
+void Interp_SCVTCI(VirtualMachine *vm)
+{
+ vm->gstate.control_value_cut_in = Pop(vm);
+}
+/* SSWCI[] Single width cut in
+ * Code Range 0x1E
+ * Pops n: value for single_width_cut_in
+ * Pushes -
+ * Sets signel_width_cut_in
+ * Affects MIAP,MIRP
+ */
+void Interp_SSWCI(VirtualMachine *vm)
+{
+ vm->gstate.single_width_cut_in = Pop(vm);
+}
+/* SSW[] Set single width
+ * Code Range 0x1F
+ * Pops n: value for single_width_value (FUnits)
+ * Pushes -
+ * Sets single_width_value
+ */
+void Interp_SSW(VirtualMachine *vm)
+{
+ vm->gstate.single_width_cut_in = Pop(vm);
+}
+/* FLIPON[] Set the auto_flip on
+ * Code Range 0x4D
+ * Pops -
+ * Pushes -
+ * Sets auto_flip
+ * Affects MIRP
+ */
+void Interp_FLIPON(VirtualMachine *vm)
+{
+ vm->gstate.auto_flip = 1;
+}
+/* FLIPOFF[] Set the auto_flip off
+ * Code Range 0x4E
+ * Pops -
+ * Pushes -
+ * Sets auto_flip
+ * Affects MIRP
+ */
+void Interp_FLIPOFF(VirtualMachine *vm)
+{
+ vm->gstate.auto_flip = 0;
+}
+/* SDB Set delta_base in the graphics state
+ * Code Range 0x5E
+ * Pops n: value for delta_base (ULONG)
+ * Pushes -
+ * Sets delta_base
+ * Affects DELTAP1,DELTAP2,DELTAP3,DELTAC1,DELTAC2,DELTAC3
+ */
+void Interp_SDB(VirtualMachine *vm)
+{
+ vm->gstate.delta_base = Pop(vm);
+}
+/* SDS Set delta_shift in the graphics state
+ * Code Range 0x5F
+ * Pops n: value for delat_shift (ULONG)
+ * Sets delta_shift
+ * Affects DELTAP1,DELTAP2,DELTAP3,DELATC1,DELTAC2,DELTAC3
+ */
+void Interp_SDS(VirtualMachine *vm)
+{
+ vm->gstate.delta_shift = Pop(vm);
+}
+
+/* Reading and writing data */
+
+/* GC[a] Get coordinate projected on to the projection_vector
+ * Code Range 0x46 - 0x47
+ * a 0: use current position of point p
+ * 1: use the position of point p in the original outline
+ * Pops p: point number (ULONG)
+ * Pushes value: coordinate location (F26Dot6)
+ * Uses zp2,projection
+ */
+void Interp_GC(VirtualMachine *vm)
+{
+ ULONG point;
+ TTFVector pos;
+
+ point = Pop(vm);
+
+ /* not finished yet */
+}
+/* SCFS[] Sets coordinate from the stack using projection_vector and
+ * freedom_vector
+ * Code Range 0x48
+ * Pops value: distance from origin to move point (F26Dot6)
+ * p: point number (ULONG)
+ * Pushes -
+ * Uses zp2, freedom_vector, projection_vector
+ */
+void Interp_SCFS(VirtualMachine *vm)
+{
+#ifdef WIN32
+ __int64 tmp;
+#else
+ long long tmp;
+#endif
+ F26Dot6 value;
+ ULONG point;
+
+ value = Pop(vm);
+ point = Pop(vm);
+ /* not finished yet */
+}
+/* MD[a] Measure Distance
+ *
+ * Code Range 0x49-0x4A
+ * a 0: measure distance in grid-fitted outline
+ * 1: measure distance in original outline
+ * Pops p1: point number (ULONG)
+ * p2: point number (ULONG);
+ * Pushes distance (F26Dot6)
+ * uses zp1 with point p1, zp2 withe point p2, projection_vector
+ */
+void Interp_MD(VirtualMachine *vm)
+{
+ ULONG p1,p2;
+ BYTE opcode;
+ TTFUnitVector vect;
+
+ opcode = (vm->iStream)[vm->ip];
+ p1 = Pop(vm);
+ p2 = Pop(vm);
+ switch (opcode)
+ {
+ /* not finished yet */
+ case 0x49:
+ break;
+ case 0x4A:
+ break;
+ }
+ /* not finished yet */
+}
+/* MPPEM[] Measure Pixel Per EM
+ *
+ * Code Range 0x4B
+ * Pops -
+ * Pushes ppem:pixel per em (ULONG)
+ */
+void Interp_MPPEM(VirtualMachine *vm)
+{
+ /* not finished yet */
+}
+/* MPS[] Measure Point Size
+ *
+ * Code Range 0x4C
+ * Pops -
+ * Pushes pointSize: the size in points of the current glyph (F26Dot6)
+ */
+void Interp_MPS(VirtualMachine *vm)
+{
+ F26Dot6 pointSize = vm->pointsize;
+
+ Push(vm,pointSize);
+}
+
+/* Mananging Outlines */
+
+/* FLIPPT[] Flip point
+ * Code Range 0x80
+ * Pops p: point number (ULONG)
+ * Pushes -
+ * Uses loop, p is referenced in zp0
+ */
+void Interp_FLIPPT(VirtualMachine *vm)
+{
+ ULONG point;
+
+ point = Pop(vm);
+
+ /* not finished yet */
+}
+/* FLIPRGON[] Filp range on
+ * Code Range 0x81
+ * Pops hightpoint: highest point number in range of points to be flipped
+ * lowpoint: lowest point number in range of points to be flipped
+ * both are ULONG
+ * Pushes -
+ */
+void Interp_FLIPRGON(VirtualMachine *vm)
+{
+
+}
diff --git a/Build/source/texk/ttfdump/libttf/kern.c b/Build/source/texk/ttfdump/libttf/kern.c
new file mode 100644
index 00000000000..79e8cb6ebd3
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/kern.c
@@ -0,0 +1,179 @@
+/* kern.c -- Kerning Table
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: kern.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: kern.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static KERNPtr ttfAllocKERN(TTFontPtr font);
+static void ttfLoadKERN(FILE *fp,KERNPtr kern,ULONG offset);
+
+void ttfInitKERN(TTFontPtr font)
+{
+ ULONG tag = 'k' | 'e' << 8 | 'r' << 16 | 'n' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->kern = ttfAllocKERN(font);
+ ttfLoadKERN(font->fp,font->kern,ptd->offset);
+ }
+}
+static KERNPtr ttfAllocKERN(TTFontPtr font)
+{
+ KERNPtr kern;
+
+ if ((kern = (KERNPtr) calloc(1,sizeof(KERN))) == NULL)
+ {
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return kern;
+}
+static void ttfLoadKERN (FILE *fp,KERNPtr kern,ULONG offset)
+{
+ int i;
+
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLoadKERN \n");
+
+ kern->version = ttfGetUSHORT(fp);
+ kern->nTables = ttfGetUSHORT(fp);
+
+ kern->subtable = (KernSubtable *) calloc(kern->nTables,
+ sizeof(KernSubtable));
+
+ for (i=0;i<kern->nTables;i++)
+ {
+ struct kernpair *pairs;
+ int j,n;
+ (kern->subtable+i)->version = ttfGetUSHORT(fp);
+ (kern->subtable+i)->length = ttfGetUSHORT(fp);
+ (kern->subtable+i)->coverage = ttfGetUSHORT(fp);
+
+ switch ((kern->subtable+i)->coverage >> 8)
+ {
+ case 0:
+ (kern->subtable+i)->kern.kern0.nPairs = n =
+ ttfGetUSHORT(fp);
+ (kern->subtable+i)->kern.kern0.searchRange =
+ ttfGetUSHORT(fp);
+ (kern->subtable+i)->kern.kern0.entrySelector =
+ ttfGetUSHORT(fp);
+ (kern->subtable+i)->kern.kern0.rangeShift =
+ ttfGetUSHORT(fp);
+ (kern->subtable+i)->kern.kern0.pairs = pairs =
+ (struct kernpair *) calloc(n,sizeof (struct kernpair));
+
+ for (j=0;j<n;j++)
+ {
+ (pairs+j)->left = ttfGetUSHORT(fp);
+ (pairs+j)->right = ttfGetUSHORT(fp);
+ (pairs+j)->value = ttfGetFWord(fp);
+ }
+ break;
+ case 2:
+ /* not implemented yet */
+ break;
+ default:
+ /* do nothing */
+ break;
+ }
+ }
+}
+
+void ttfPrintKERN(FILE *fp,KERNPtr kern)
+{
+ int i;
+
+ fprintf(fp,"'kern' Table - Kerning Data\n");
+ fprintf(fp,"---------------------------\n");
+ fprintf(fp,"'kern' Version:\t %d\n", kern->version);
+ fprintf(fp,"Number of subtables:\t %d\n\n",kern->nTables);
+
+ for (i=0;i<kern->nTables;i++)
+ {
+ struct kernpair *pairs;
+ int j,n;
+
+ fprintf(fp,"\t Subtable format \t %d\n",
+ (kern->subtable+i)->coverage >> 8);
+ fprintf(fp,"\t Subtable version \t %d\n",
+ (kern->subtable+i)->version);
+ fprintf(fp,"\t Bytes in subtable \t %d\n",
+ (kern->subtable+i)->length);
+ fprintf(fp,"\t Coverage bits \t 0x%x \n",
+ (kern->subtable+i)->coverage);
+ switch ((kern->subtable+i)->coverage >> 8)
+ {
+ case 0:
+ n = (kern->subtable+i)->kern.kern0.nPairs;
+ pairs = (kern->subtable+i)->kern.kern0.pairs;
+
+ fprintf(fp,"\t Number of pairs %d\n",n);
+ fprintf(fp,"\t Search Range %d\n",
+ (kern->subtable+i)->kern.kern0.searchRange);
+ fprintf(fp,"\t Entry Selector %d\n",
+ (kern->subtable+i)->kern.kern0.entrySelector);
+ fprintf(fp,"\t Range Shift %d\n",
+ (kern->subtable+i)->kern.kern0.rangeShift);
+
+ fprintf(fp,"\t Left Glyph \t Right Glyph \t Kern Move\n");
+ fprintf(fp,"\t ---------- \t ----------- \t ---------\n");
+
+ for (j=0;j<n;j++)
+ {
+ fprintf(fp,"\t\t %d \t\t %d \t\t %d\n",
+ (pairs+j)->left,(pairs+j)->right,
+ (pairs+j)->value);
+ }
+ break;
+ case 2:
+ /* not implemented yet */
+ break;
+ default:
+ /* do nothing */
+ break;
+ }
+ fprintf(fp,"\n");
+ }
+
+}
+
+void ttfFreeKERN(KERNPtr kern)
+{
+ int i;
+
+ if (kern != NULL)
+ {
+ for (i=0;i<kern->nTables;i++)
+ {
+ switch ((kern->subtable+i)->coverage >> 8)
+ {
+ case 0:
+ free((kern->subtable+i)->kern.kern0.pairs);
+ break;
+ case 2:
+ /* not implemented yet */
+ break;
+ default:
+ /* do nothing */
+ break;
+ }
+ }
+ free(kern->subtable);
+ free(kern);
+ }
+}
diff --git a/Build/source/texk/ttfdump/libttf/loca.c b/Build/source/texk/ttfdump/libttf/loca.c
new file mode 100644
index 00000000000..3d09b8959a8
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/loca.c
@@ -0,0 +1,110 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: loca.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: loca.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static LOCAPtr ttfAllocLOCA(TTFontPtr font);
+static void ttfLoadLOCA(FILE *fp,LOCAPtr loca,ULONG offset);
+
+void ttfInitLOCA(TTFontPtr font)
+{
+ ULONG tag = 'l' | 'o' << 8 | 'c' << 16 | 'a' <<24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->loca = (LOCAPtr) ttfAllocLOCA(font);
+ ttfLoadLOCA(font->fp,font->loca,ptd->offset);
+ }
+}
+static LOCAPtr ttfAllocLOCA(TTFontPtr font)
+{
+ USHORT n=0;
+ LOCAPtr loca;
+
+ if ((loca = (LOCAPtr) calloc(1,sizeof(LOCA))) == NULL)
+ {
+ ttfError("Out of Memory\n");
+ }
+ else
+ {
+ loca->indexToLocFormat = font->head->indexToLocFormat;
+ loca->numGlyphs = n = font->maxp->numGlyphs;
+ }
+
+ n += 1;/* the number of loca entry is numberOfGlyph+1 */
+ if ((loca->offset = (ULONG *) calloc(n,sizeof(ULONG))) == NULL)
+ {
+ ttfError("Out Of Memory\n");
+ free (loca);
+ return NULL;
+ }
+
+ return loca;
+}
+static void ttfLoadLOCA(FILE *fp,LOCAPtr loca,ULONG offset)
+{
+ /* warrning: the number of loca entry is numberOfGlyph+1 !! */
+ USHORT i,n = loca->numGlyphs+1;
+
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLOADLOCA \n");
+
+ switch (loca->indexToLocFormat)
+ {
+ case LOCA_OFFSET_SHORT:
+ for (i=0;i<n;i++)
+ {
+ (loca->offset)[i] = (ULONG) ttfGetUSHORT(fp)*2;
+ }
+ break;
+ case LOCA_OFFSET_LONG:
+ if (fread(loca->offset,sizeof(ULONG),n,fp) != n)
+ ttfError("Error reading loca data\n");
+#ifndef WORDS_BIGENDIAN
+ FourByteSwap((unsigned char *) loca->offset,n*sizeof(ULONG));
+#endif
+ break;
+ }
+}
+
+void ttfPrintLOCA(FILE *fp,LOCAPtr loca)
+{
+ USHORT i;
+
+ fprintf(fp,"'loca' Table - Index to Location\n");
+ fprintf(fp,"--------------------------------\n");
+ for (i=0;i<loca->numGlyphs;i++)
+ {
+ fprintf(fp,"\t Idx %6d -> GlyphOffset 0x%08x\n",i,
+ (loca->offset)[i]);
+ }
+ fprintf (fp,"\t Ended at 0x%08x\n",(loca->offset)[loca->numGlyphs]);
+}
+
+void ttfFreeLOCA(LOCAPtr loca)
+{
+ free (loca->offset);
+ free (loca);
+}
+
+ULONG ttfLookUpGlyfLOCA(LOCAPtr loca,USHORT idx)
+{
+ /* out of bound or it is a non-glyph character */
+ if (idx >= loca->numGlyphs ||
+ loca->offset[idx] == loca->offset[idx+1])
+ return (loca->offset)[0];
+
+ return (loca->offset)[idx];
+}
diff --git a/Build/source/texk/ttfdump/libttf/ltsh.c b/Build/source/texk/ttfdump/libttf/ltsh.c
new file mode 100644
index 00000000000..7f50b22f73b
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/ltsh.c
@@ -0,0 +1,82 @@
+/* ltsh.c -- Linear Threshold table
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: ltsh.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: ltsh.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static LTSHPtr ttfAllocLTSH(TTFontPtr font);
+static void ttfLoadLTSH(FILE *fp,LTSHPtr ltsh,ULONG offset);
+
+void ttfInitLTSH(TTFontPtr font)
+{
+ ULONG tag = 'L' | 'T' << 8 | 'S' << 16 | 'H' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->ltsh = ttfAllocLTSH(font);
+ ttfLoadLTSH(font->fp,font->ltsh,ptd->offset);
+ }
+}
+static LTSHPtr ttfAllocLTSH(TTFontPtr font)
+{
+ LTSHPtr ltsh;
+
+ if ((ltsh = (LTSHPtr) calloc(1,sizeof(LTSH))) == NULL)
+ {
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return ltsh;
+}
+static void ttfLoadLTSH (FILE *fp,LTSHPtr ltsh,ULONG offset)
+{
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLoadLTSH \n");
+
+ ltsh->version = ttfGetUSHORT(fp);
+ ltsh->numGlyphs = ttfGetUSHORT(fp);
+
+ ltsh->yPels = (BYTE *) calloc(ltsh->numGlyphs, sizeof(BYTE));
+
+ if(fread(ltsh->yPels, sizeof(BYTE), ltsh->numGlyphs, fp) != ltsh->numGlyphs)
+ ttfError("Error when getting yPels\n");
+}
+
+void ttfPrintLTSH(FILE *fp,LTSHPtr ltsh)
+{
+ int i;
+
+ fprintf(fp,"'LTSH' Table - Linear Threshold Table\n");
+ fprintf(fp,"-------------------------------------\n");
+ fprintf(fp,"'LTSH' Version:\t %d\n",ltsh->version);
+ fprintf(fp,"Number of Glyphs:\t %d\n",ltsh->numGlyphs);
+ fprintf(fp,"\t Glyph # \t Threshold\n");
+
+ for (i=0;i<ltsh->numGlyphs;i++)
+ {
+ fprintf(fp,"\t %d. \t\t %d\n",i,ltsh->yPels[i]);
+ }
+}
+
+void ttfFreeLTSH(LTSHPtr ltsh)
+{
+ if (ltsh != NULL)
+ {
+ free(ltsh->yPels);
+ free(ltsh);
+ }
+}
diff --git a/Build/source/texk/ttfdump/libttf/maxp.c b/Build/source/texk/ttfdump/libttf/maxp.c
new file mode 100644
index 00000000000..8a8a81eb74a
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/maxp.c
@@ -0,0 +1,92 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: maxp.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: maxp.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static MAXPPtr ttfAllocMAXP(TTFontPtr font);
+static void ttfLoadMAXP(FILE *fp,MAXPPtr maxp,ULONG offset);
+
+void ttfInitMAXP(TTFontPtr font)
+{
+ ULONG tag = 'm' | 'a' << 8 | 'x' << 16 | 'p' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->maxp = ttfAllocMAXP(font);
+ ttfLoadMAXP(font->fp,font->maxp,ptd->offset);
+ }
+}
+static MAXPPtr ttfAllocMAXP(TTFontPtr font)
+{
+ MAXPPtr maxp;
+
+ if ((maxp = (MAXPPtr) calloc(1,sizeof(MAXP))) == NULL)
+ {
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return maxp;
+}
+static void ttfLoadMAXP(FILE *fp,MAXPPtr maxp,ULONG offset)
+{
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLOADCMAP \n");
+
+ maxp->version = ttfGetFixed(fp);
+ maxp->numGlyphs = ttfGetUSHORT(fp);
+ maxp->maxPoints = ttfGetUSHORT(fp);
+ maxp->maxContours = ttfGetUSHORT(fp);
+ maxp->maxCompositePoints = ttfGetUSHORT(fp);
+ maxp->maxCompositeContours = ttfGetUSHORT(fp);
+ maxp->maxZones = ttfGetUSHORT(fp);
+ maxp->maxTwilightPoints = ttfGetUSHORT(fp);
+ maxp->maxStorage = ttfGetUSHORT(fp);
+ maxp->maxFunctionDefs = ttfGetUSHORT(fp);
+ maxp->maxInstructionDefs = ttfGetUSHORT(fp);
+ maxp->maxStackElements = ttfGetUSHORT(fp);
+ maxp->maxSizeOfInstructions = ttfGetUSHORT(fp);
+ maxp->maxComponentElements = ttfGetUSHORT(fp);
+ maxp->maxComponentDepth = ttfGetUSHORT(fp);
+}
+
+void ttfPrintMAXP(FILE *fp,MAXPPtr maxp)
+{
+ int b[2];
+
+ FixedSplit(maxp->version,b);
+
+ fprintf(fp,"'maxp' Table - Maximum Profile\n");
+ fprintf(fp,"------------------------------\n");
+ fprintf(fp,"\t 'maxp' version:\t %2d.%2d\n",b[1],b[0]);
+ fprintf(fp,"\t numGlyphs:\t\t %d\n",maxp->numGlyphs);
+ fprintf(fp,"\t maxPoints:\t\t %d\n",maxp->maxPoints);
+ fprintf(fp,"\t maxContours:\t\t %d\n",maxp->maxContours);
+ fprintf(fp,"\t maxCompositePoints:\t %d\n",maxp->maxCompositePoints);
+ fprintf(fp,"\t maxCompositeContours:\t %d\n",maxp->maxCompositeContours);
+ fprintf(fp,"\t maxZones:\t\t %d\n",maxp->maxZones);
+ fprintf(fp,"\t maxTwilightPoints:\t %d\n",maxp->maxTwilightPoints);
+ fprintf(fp,"\t maxStorage:\t\t %d\n",maxp->maxStorage);
+ fprintf(fp,"\t maxFunctionDefs:\t %d\n",maxp->maxFunctionDefs);
+ fprintf(fp,"\t maxInstructionDefs:\t %d\n",maxp->maxInstructionDefs);
+ fprintf(fp,"\t maxStackElements:\t %d\n",maxp->maxStackElements);
+ fprintf(fp,"\t maxSizeOfInstructions:\t %d\n",maxp->maxSizeOfInstructions);
+ fprintf(fp,"\t maxComponentElements:\t %d\n",maxp->maxComponentElements);
+ fprintf(fp,"\t maxCompoenetDepth:\t %d\n",maxp->maxComponentDepth);
+}
+
+void ttfFreeMAXP(MAXPPtr maxp)
+{
+ free(maxp);
+}
diff --git a/Build/source/texk/ttfdump/libttf/name.c b/Build/source/texk/ttfdump/libttf/name.c
new file mode 100644
index 00000000000..968af094c7e
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/name.c
@@ -0,0 +1,182 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: name.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: name.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static NAMEPtr ttfAllocNAME(TTFontPtr font);
+static void ttfLoadNAME(FILE *fp,NAMEPtr name,ULONG offset);
+static void ttfLoadNameRecord(FILE *fp,NameRecordPtr rec,ULONG offset);
+static void ttfPrintNameRecord(FILE *fp,NameRecordPtr rec);
+static void ttfLoadNameRecordData(FILE *fp,NameRecordPtr rec,ULONG offset);
+static void ttfPrintNameRecordData(FILE *fp,NameRecordPtr rec);
+static void ttfFreeNameRecordData(NameRecordPtr rec);
+static void HexDump(char *p,char *hex,char *asc,int len);
+
+void ttfInitNAME(TTFontPtr font)
+{
+ ULONG tag = 'n' | 'a' << 8 | 'm' << 16 | 'e' <<24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->name = ttfAllocNAME(font);
+ ttfLoadNAME(font->fp,font->name,ptd->offset);
+ }
+}
+static NAMEPtr ttfAllocNAME(TTFontPtr font)
+{
+ NAMEPtr name;
+
+ if((name = (NAMEPtr) calloc(1,sizeof(NAME))) == NULL)
+ {
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return name;
+}
+static void ttfLoadNAME(FILE *fp,NAMEPtr name,ULONG offset)
+{
+ USHORT i,n;
+ ULONG pos;
+
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLOADNAME \n");
+
+ name->format = ttfGetUSHORT(fp);
+ name->numberOfRecords = n = ttfGetUSHORT(fp);
+ name->offset = ttfGetUSHORT(fp);
+
+ if ((name->NameRecords = (NameRecordPtr) calloc(n,sizeof(NameRecord))) == NULL)
+ ttfError("Out Of Memory\n");
+
+ pos = offset + sizeof(USHORT)*3;
+
+ for(i=0;i<n;i++,pos+=12 /*sizeof(NameRecord)*/)
+ {
+ ttfLoadNameRecord(fp,name->NameRecords+i,pos);
+ ttfLoadNameRecordData(fp,name->NameRecords+i,offset+name->offset);
+ }
+}
+void ttfPrintNAME(FILE *fp,NAMEPtr name)
+{
+ USHORT i;
+
+ fprintf(fp,"'name' Table - Naming Table\n");
+ fprintf(fp,"---------------------------\n");
+ fprintf(fp,"\t Format:\t\t %d\n",name->format);
+ fprintf(fp,"\t Number of Record:\t %d\n",name->numberOfRecords);
+ fprintf(fp,"\t Storage offset:\t %d\n",name->offset);
+
+ for (i=0;i<name->numberOfRecords;i++)
+ {
+ fprintf(fp,"Name table %3d.\t",i);
+ ttfPrintNameRecord(fp,name->NameRecords+i);
+ }
+
+}
+void ttfFreeNAME(NAMEPtr name)
+{
+ USHORT i;
+ for (i=0;i<name->numberOfRecords;i++)
+ ttfFreeNameRecordData(name->NameRecords+i);
+ free(name->NameRecords);
+ free(name);
+}
+/* offset: address of the beginning of the name record */
+static void ttfLoadNameRecord(FILE *fp,NameRecordPtr rec,ULONG offset)
+{
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLoadNameRecord \n");
+
+ rec->PlatformID = ttfGetUSHORT(fp);
+ rec->EncodingID = ttfGetUSHORT(fp);
+ rec->LanguageID = ttfGetUSHORT(fp);
+ rec->NameID = ttfGetUSHORT(fp);
+ rec->length = ttfGetUSHORT(fp);
+ rec->offset = ttfGetUSHORT(fp);
+}
+static void ttfPrintNameRecord(FILE *fp,NameRecordPtr rec)
+{
+ fprintf(fp," PlatformID:\t %d\n",rec->PlatformID);
+ fprintf(fp,"\t\t EncodingID:\t %d\n",rec->EncodingID);
+ fprintf(fp,"\t\t LanguageID:\t %d\n",rec->LanguageID);
+ fprintf(fp,"\t\t NameID:\t %d\n",rec->NameID);
+ fprintf(fp,"\t\t Length:\t %d\n",rec->length);
+ fprintf(fp,"\t\t Offset:\t %d\n",rec->offset);
+ ttfPrintNameRecordData(fp,rec);
+}
+/* ULONG offset: address of the beginning of the actual data (base actually)
+ * base: start of data storage, specified by NAME.offset
+ * offset: specified by NameRecord.offset */
+static void ttfLoadNameRecordData(FILE *fp,NameRecordPtr rec,ULONG offset)
+{
+ ULONG pos;
+
+ pos = offset + rec->offset;
+ if (fseek(fp,pos,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLoadSubTable\n");
+
+ if ((rec->data = (char *) calloc(rec->length,sizeof(char))) == NULL)
+ ttfError("Out Of Memory\n");
+ if (fread(rec->data,sizeof(char),rec->length,fp) != rec->length)
+ ttfError("Error when getting Name Record Data\n");
+}
+
+static void ttfPrintNameRecordData(FILE *fp,NameRecordPtr rec)
+{
+ USHORT i,j;
+ char hexbuf[100],ascbuf[100],*p;
+
+ p = rec->data;
+ for (i=0;i<rec->length/10;i++,p+=10)
+ {
+ HexDump(p,hexbuf,ascbuf,10);
+ fprintf(fp,"\t\t %s > %s\n",hexbuf,ascbuf);
+ }
+ HexDump(p,hexbuf,ascbuf,rec->length % 10);
+ /* i know that this is ugly, but this makes output beautiful */
+ i = strlen(hexbuf);
+ for (j=i;j<30;j++)
+ {
+ hexbuf[j] = ' ';
+ }
+ fprintf(fp,"\t\t %s > %s\n",hexbuf,ascbuf);
+
+}
+static void HexDump(char *p,char *hex,char *asc,int len)
+{
+ int i;
+ unsigned char c;
+ char buf[100];
+
+ *hex = '\0';
+ *asc = '\0';
+ for (i=0;i<len;i++)
+ {
+ c = *(p+i);
+ sprintf(buf,"%02x ",c);
+ strcat(hex,buf);
+ if (isprint(c))
+ *(asc+i) = c;
+ else
+ *(asc+i) = '.';
+ }
+ *(asc+len) = *(hex+len*3) = '\0';
+}
+static void ttfFreeNameRecordData(NameRecordPtr rec)
+{
+ free(rec->data);
+}
diff --git a/Build/source/texk/ttfdump/libttf/os2.c b/Build/source/texk/ttfdump/libttf/os2.c
new file mode 100644
index 00000000000..b6d21072e5f
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/os2.c
@@ -0,0 +1,181 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#define __TTF_OS2
+#include "os2_P.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: os2.c,v 1.2 1998/07/06 06:07:01 werner Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: os2.c,v 1.2 1998/07/06 06:07:01 werner Exp $";
+#endif /* lint */
+
+static OS_2Ptr ttfAllocOS2(TTFontPtr font);
+static void ttfLoadOS2(FILE *fp, OS_2Ptr os2, ULONG offset);
+
+void ttfInitOS2(TTFontPtr font)
+{
+ ULONG tag = 'O' | 'S' << 8 | '/' << 16 | '2' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag, font)) != NULL)
+ {
+ font->os2 = ttfAllocOS2(font);
+ ttfLoadOS2(font->fp, font->os2, ptd->offset);
+ }
+}
+
+static OS_2Ptr ttfAllocOS2(TTFontPtr font)
+{
+ OS_2Ptr os2;
+
+ if ((os2 = (OS_2Ptr) calloc(1, sizeof(OS_2))) == NULL)
+ {
+ ttfError("Out of Memofy in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return os2;
+}
+
+static void ttfLoadOS2(FILE *fp, OS_2Ptr os2, ULONG offset)
+{
+ if (fseek(fp, offset, SEEK_SET) != 0)
+ ttfError("Fseek Failed in ttfLoadGLYF\n");
+
+ os2->version = ttfGetUSHORT(fp);
+ os2->xAvgCharWidth = ttfGetSHORT(fp);
+ os2->usWeightClass = ttfGetUSHORT(fp);
+ os2->usWidthClass = ttfGetUSHORT(fp);
+ os2->fsType = ttfGetUSHORT(fp);
+ os2->ySubscriptXSize = ttfGetSHORT(fp);
+ os2->ySubscriptYSize = ttfGetSHORT(fp);
+ os2->ySubscriptXOffset = ttfGetSHORT(fp);
+ os2->ySubscriptYOffset = ttfGetSHORT(fp);
+ os2->ySuperscriptXSize = ttfGetSHORT(fp);
+ os2->ySuperscriptYSize = ttfGetSHORT(fp);
+ os2->ySuperscriptXOffset = ttfGetSHORT(fp);
+ os2->ySuperscriptYOffset = ttfGetSHORT(fp);
+ os2->yStrikeoutSize = ttfGetSHORT(fp);
+ os2->yStrikeoutPosition = ttfGetSHORT(fp);
+ os2->sFamilyClass = ttfGetSHORT(fp);
+
+ if (fread(os2->panose, sizeof(CHAR), 10, fp) != 10)
+ ttfError("Error readind PANOSE\n");
+
+ os2->ulUnicodeRange1 = ttfGetULONG(fp);
+ os2->ulUnicodeRange2 = ttfGetULONG(fp);
+ os2->ulUnicodeRange3 = ttfGetULONG(fp);
+ os2->ulUnicodeRange4 = ttfGetULONG(fp);
+
+ if (fread(os2->achVendID, sizeof(CHAR), 4, fp) != 4)
+ ttfError("Error readind achVendID\n");
+ os2->achVendID[4] = 0x0;
+
+ os2->fsSelection = ttfGetUSHORT(fp);
+ os2->usFirstCharIndex = ttfGetUSHORT(fp);
+ os2->usLastCharIndex = ttfGetUSHORT(fp);
+ os2->sTypoAscender = ttfGetSHORT(fp);
+ os2->sTypoDescender = ttfGetSHORT(fp);
+ os2->sTypoLineGap = ttfGetSHORT(fp);
+ os2->usWinAscent = ttfGetUSHORT(fp);
+ os2->usWinDescent = ttfGetUSHORT(fp);
+ os2->ulCodePageRange1 = ttfGetULONG(fp);
+ os2->ulCodePageRange2 = ttfGetULONG(fp);
+}
+
+void ttfPrintOS2(FILE *fp,OS_2Ptr os2)
+{
+ char buf[80];
+
+ fprintf(fp,"'OS/2' Table - OS/2 and Windows Metrics\n");
+ fprintf(fp,"---------------------------------------\n");
+
+ fprintf(fp,"\t 'OS/2' version:\t %d\n",os2->version);
+ fprintf(fp,"\t xAvgCharWidth:\t\t %d\n",os2->xAvgCharWidth);
+ fprintf(fp,"\t usWeightClass:\t\t %d \t '%s'\n",os2->usWeightClass,
+ WeightClassName[os2->usWeightClass/100 - 1] );
+ fprintf(fp,"\t usWidthClass:\t\t %d \t '%s'\n",os2->usWidthClass,
+ WidthClassName[os2->usWidthClass - 1]);
+ fprintf(fp,"\t fsType:\t\t %d\n",os2->fsType);
+ fprintf(fp,"\t ySubscriptXSize:\t %d\n",os2->ySubscriptXSize);
+ fprintf(fp,"\t ySubscriptYSize:\t %d\n",os2->ySubscriptYSize);
+ fprintf(fp,"\t ySubscriptXOffset:\t %d\n",os2->ySubscriptXOffset);
+ fprintf(fp,"\t ySubscriptYOffset:\t %d\n",os2->ySubscriptYOffset);
+ fprintf(fp,"\t ySuperscriptXSize:\t %d\n",os2-> ySuperscriptXSize);
+ fprintf(fp,"\t ySuperscriptYSize:\t %d\n",os2->ySuperscriptYSize);
+ fprintf(fp,"\t ySuperscriptXOffset:\t %d\n",os2->ySuperscriptXOffset);
+ fprintf(fp,"\t ySuperscriptYOffset:\t %d\n",os2->ySuperscriptYOffset);
+ fprintf(fp,"\t yStrikeoutSize:\t %d\n",os2->yStrikeoutSize);
+ fprintf(fp,"\t yStrikeoutPosition\t %d\n",os2->yStrikeoutPosition);
+ fprintf(fp,"\t sFamilyClass:\t %d \t subclass = %d\n",
+ (os2->sFamilyClass) >> 8,(os2->sFamilyClass) & 0x00ff);
+ fprintf(fp,"\t PANOSE:\n");
+ fprintf(fp,"\t\t Family Kind:\t %d \t '%s'\n",os2->panose[0],
+ PanoseFamily[os2->panose[0]]);
+ fprintf(fp,"\t\t Serif Style:\t %d \t '%s'\n",os2->panose[1],
+ PanoseSerif[os2->panose[1]]);
+ fprintf(fp,"\t\t Weight:\t %d \t '%s'\n",os2->panose[2],
+ PanoseWeight[os2->panose[2]]);
+ fprintf(fp,"\t\t Proportion:\t %d \t '%s'\n",os2->panose[3],
+ PanoseProportion[os2->panose[3]]);
+ fprintf(fp,"\t\t Contrast:\t %d \t '%s'\n",os2->panose[4],
+ PanoseContrast[os2->panose[4]]);
+ fprintf(fp,"\t\t Stroke:\t %d \t '%s'\n",os2->panose[5],
+ PanoseStroke[os2->panose[5]]);
+ fprintf(fp,"\t\t Arm Style:\t %d \t '%s'\n",os2->panose[6],
+ PanoseArm[os2->panose[6]]);
+ fprintf(fp,"\t\t Lettreform:\t %d \t '%s'\n",os2->panose[7],
+ PanoseLetterform[os2->panose[7]]);
+ fprintf(fp,"\t\t Midline:\t %d \t '%s'\n",os2->panose[8],
+ PanoseMidline[os2->panose[8]]);
+ fprintf(fp,"\t\t X-height:\t %d \t '%s'\n",os2->panose[9],
+ PanoseXHeight[os2->panose[9]]);
+ fprintf(fp,"\t Unicode Range 1( Bits 0 - 31 ): \t 0x%08x\n",
+ os2->ulUnicodeRange1);
+ fprintf(fp,"\t Unicode Range 2( Bits 32 - 63 ): \t 0x%08x\n",
+ os2->ulUnicodeRange2);
+ fprintf(fp,"\t Unicode Range 3( Bits 64 - 95 ): \t 0x%08x\n",
+ os2->ulUnicodeRange3);
+ fprintf(fp,"\t Unicode Range 4( Bits 96 - 128 ): \t 0x%08x\n",
+ os2->ulUnicodeRange4);
+
+ fprintf(fp,"\t achVendID:\t\t '%s'\n",os2->achVendID);
+
+ buf[0] = 0x0;
+ if (os2->fsSelection & FS_FLAGS_REGULAR)
+ {
+ strcat(buf,"Regular ");
+ }
+ else
+ {
+ if (os2->fsSelection & FS_FLAGS_BOLD)
+ strcat(buf,"Bold ");
+ if (os2->fsSelection & FS_FLAGS_ITALIC)
+ strcat(buf,"Italic ");
+ }
+ fprintf(fp,"\t fsSelection:\t\t 0x%04x \t '%s'\n",os2->fsSelection,buf);
+ fprintf(fp,"\t usFirstCharIndex:\t 0x%04x\n ",os2->usFirstCharIndex);
+ fprintf(fp,"\t usLastCharIndex:\t 0x%04x\n",os2->usLastCharIndex);
+ fprintf(fp,"\t sTypoAscender:\t\t %d\n",os2->sTypoAscender);
+ fprintf(fp,"\t sTypoDescender:\t %d\n",os2->sTypoDescender);
+ fprintf(fp,"\t sTypoLineGap:\t\t %d\n",os2->sTypoLineGap);
+ fprintf(fp,"\t usWinAscent:\t\t %d\n",os2->usWinAscent);
+ fprintf(fp,"\t usWinDescent:\t\t %d\n",os2->usWinDescent);
+ fprintf(fp,"\t CodePage Range 1( Bits 0 - 31 ):\t 0x%08x\n",
+ os2->ulCodePageRange1);
+ fprintf(fp,"\t CodePage Range 2( Bits 32- 63 ):\t 0x%08x\n",
+ os2->ulCodePageRange2);
+}
+
+void ttfFreeOS2(OS_2Ptr os2)
+{
+ free(os2);
+}
diff --git a/Build/source/texk/ttfdump/libttf/pclt.c b/Build/source/texk/ttfdump/libttf/pclt.c
new file mode 100644
index 00000000000..e62574a7f04
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/pclt.c
@@ -0,0 +1,113 @@
+/* pclt.c -- PCL5 Table
+ * Copyright (C) 1997 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: pclt.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: pclt.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static PCLTPtr ttfAllocPCLT(TTFontPtr font);
+static void ttfLoadPCLT(FILE *fp,PCLTPtr pclt,ULONG offset);
+
+void ttfInitPCLT(TTFontPtr font)
+{
+ ULONG tag = 'P' | 'C' << 8 | 'L' << 16 | 'T' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->pclt = ttfAllocPCLT(font);
+ ttfLoadPCLT(font->fp,font->pclt,ptd->offset);
+ }
+}
+static PCLTPtr ttfAllocPCLT(TTFontPtr font)
+{
+ PCLTPtr pclt;
+
+ if ((pclt = (PCLTPtr) calloc(1,sizeof(PCLT))) == NULL)
+ {
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return pclt;
+}
+static void ttfLoadPCLT(FILE *fp,PCLTPtr pclt,ULONG offset)
+{
+ int i;
+
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLOADCMAP \n");
+
+ pclt->version = ttfGetFixed(fp);
+ pclt->FontNumber = ttfGetULONG(fp);
+ pclt->Pitch = ttfGetUSHORT(fp);
+ pclt->xHeight = ttfGetUSHORT(fp);
+ pclt->Style = ttfGetUSHORT(fp);
+ pclt->TypeFamily = ttfGetUSHORT(fp);
+ pclt->CapHeight = ttfGetUSHORT(fp);
+ pclt->SymbolSet = ttfGetUSHORT(fp);
+ for (i=0;i<16;i++)
+ pclt->Typeface[i] = ttfGetCHAR(fp);
+ for (i=0;i<8;i++)
+ pclt->CharacterComplement[i] = ttfGetCHAR(fp);
+ for (i=0;i<6;i++)
+ pclt->FileName[i] = ttfGetCHAR(fp);
+ pclt->StrokeWeight = ttfGetCHAR(fp);
+ pclt->WidthType = ttfGetCHAR(fp);
+ pclt->SerifStyle = ttfGetBYTE(fp);
+}
+
+void ttfPrintPCLT(FILE *fp,PCLTPtr pclt)
+{
+ int i;
+ int b[2];
+
+ FixedSplit(pclt->version,b);
+
+ fprintf(fp,"`PCLT' Table - Printer Command Language Table\n");
+ fprintf(fp,"---------------------------------------------\n");
+ fprintf(fp,"\t version \t %d.%d\n",b[1],b[0]);
+ fprintf(fp,"\t fontNumber \t %d (0x%x) \n",pclt->FontNumber,
+ pclt->FontNumber );
+ fprintf(fp,"\t pitch \t %d\n",pclt->Pitch);
+ fprintf(fp,"\t xHeight \t %d\n",pclt->xHeight);
+ fprintf(fp,"\t style \t %d\n",pclt->Style);
+ fprintf(fp,"\t typeFamily \t %x\n",pclt->TypeFamily);
+ fprintf(fp,"\t capHeight \t %d\n",pclt->CapHeight);
+ fprintf(fp,"\t symbolSet \t %d\n",pclt->SymbolSet);
+ fprintf(fp,"\t typeFace \t ");
+ for (i=0;i<6;i++)
+ fprintf(fp,"%c",pclt->Typeface[i]);
+ fprintf(fp,"\n");
+
+ fprintf(fp,"\t characterComplement 0x");
+ for (i=0;i<8;i++)
+ fprintf(fp,"%02hx",(unsigned char)pclt->CharacterComplement[i]);
+ fprintf(fp,"\n");
+
+ fprintf(fp,"\t fileName \t ");
+ for (i=0;i<6;i++)
+ fprintf(fp,"%c",pclt->FileName[i]);
+ fprintf(fp,"\n");
+
+ fprintf(fp,"\t strokeWeight \t %d\n",pclt->StrokeWeight);
+ fprintf(fp,"\t widthType \t %d\n",pclt->WidthType);
+ fprintf(fp,"\t serifStyle \t %d\n",pclt->SerifStyle);
+}
+
+void ttfFreePCLT(PCLTPtr pclt)
+{
+ if (pclt != NULL)
+ free(pclt);
+}
diff --git a/Build/source/texk/ttfdump/libttf/post.c b/Build/source/texk/ttfdump/libttf/post.c
new file mode 100644
index 00000000000..6757ddd5979
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/post.c
@@ -0,0 +1,178 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: post.c,v 1.3 1998/06/06 12:55:53 werner Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: post.c,v 1.3 1998/06/06 12:55:53 werner Exp $";
+#endif /* lint */
+
+static POSTPtr ttfAllocPOST(TTFontPtr font);
+static void ttfLoadPOST(FILE *fp, POSTPtr post, ULONG offset);
+
+void ttfInitPOST(TTFontPtr font)
+{
+ ULONG tag = 'p' | 'o' << 8 | 's' << 16 | 't' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag, font)) != NULL)
+ {
+ font->post = ttfAllocPOST(font);
+ ttfLoadPOST(font->fp, font->post, ptd->offset);
+ }
+}
+static POSTPtr ttfAllocPOST(TTFontPtr font)
+{
+ POSTPtr post;
+
+ if ((post = (POSTPtr) calloc(1, sizeof(POST))) == NULL)
+ {
+ ttfError("Out of Memofy in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return post;
+}
+static void ttfLoadPOST(FILE *fp, POSTPtr post, ULONG offset)
+{
+ USHORT i,numGlyphs;
+ if (fseek(fp, offset, SEEK_SET) != 0)
+ ttfError("Fseek Failed in ttfLoadPOST\n");
+
+ post->format = ttfGetFixed(fp);
+ post->italicAngle = ttfGetFixed(fp);
+ post->underlinePosition = ttfGetFWord(fp);
+ post->underlineThickness = ttfGetFWord(fp);
+ post->isFixedPitch = ttfGetULONG(fp);
+ post->minMemType42 = ttfGetULONG(fp);
+ post->maxMemType42 = ttfGetULONG(fp);
+ post->minMemType1 = ttfGetULONG(fp);
+ post->maxMemType1 = ttfGetULONG(fp);
+
+ switch (post->format)
+ {
+ case 0x00020000:
+ post->name.format20 = (Format20 *) calloc(1, sizeof(Format20));
+ post->name.format20->numGlyphs = numGlyphs = ttfGetUSHORT(fp);
+ post->name.format20->glyphNameIndex =
+ (USHORT *) calloc(numGlyphs, sizeof(USHORT));
+ post->name.format20->GlyphName =
+ (CHAR **) calloc(numGlyphs, sizeof(CHAR *));
+ fread(post->name.format20->glyphNameIndex, sizeof(USHORT),
+ numGlyphs, fp);
+#ifndef WORDS_BIGENDIAN
+ TwoByteSwap((unsigned char *) post->name.format20->glyphNameIndex,
+ numGlyphs*sizeof(USHORT));
+#endif
+
+ for (i=0;i<numGlyphs;i++)
+ {
+ unsigned char len;
+ if (post->name.format20->glyphNameIndex[i] <= 257)
+ {
+ /* do nothing for standard Mac glyf name */
+ }
+ else if (post->name.format20->glyphNameIndex[i] <= 32767)
+ {
+ /* non-standard glyf name is stored as a Pascal
+ * string in the file i.e.
+ * the first byte is the length of the string
+ * but the string is not ended with a null
+ * character */
+ len = (unsigned char) ttfGetCHAR(fp);
+ post->name.format20->GlyphName[i] =
+ (CHAR *) calloc(len+1, sizeof(CHAR));
+ if (len)
+ fread(post->name.format20->GlyphName[i],
+ sizeof(CHAR), len, fp);
+ post->name.format20->GlyphName[i][len] = 0x0;
+ }
+ }
+ break;
+ case 0x00028000: /* 2.5 in 16.16 format */
+ /* not implemented yet */
+ break;
+ default:
+ /* do nothing */ ;
+ }
+}
+
+void ttfPrintPOST(FILE *fp,POSTPtr post)
+{
+ int b[2],b1[2];
+ USHORT i,numGlyphs;
+
+ FixedSplit(post->format, b);
+ FixedSplit(post->italicAngle, b1);
+ fprintf(fp,"'post' Table - PostScript\n");
+ fprintf(fp,"-------------------------\n");
+ fprintf(fp,"\t 'post' format:\t\t %d.%d\n", b[1], b[0]);
+ fprintf(fp,"\t italicAngle:\t\t %d.%d\n", b1[1], b1[0]);
+ fprintf(fp,"\t underlinePosition:\t %d\n", post->underlinePosition);
+ fprintf(fp,"\t underlineThichness:\t %d\n", post->underlineThickness);
+ fprintf(fp,"\t isFixedPitch:\t\t %ud\n", post->isFixedPitch);
+ fprintf(fp,"\t minMemType42:\t\t %ud\n", post->minMemType42);
+ fprintf(fp,"\t maxMemType42:\t\t %ud\n", post->maxMemType42);
+ fprintf(fp,"\t minMemType1:\t\t %ud\n", post->minMemType1);
+ fprintf(fp,"\t maxMemType1:\t\t %ud\n", post->maxMemType1);
+
+ switch (post->format)
+ {
+ case 0x00020000:
+ numGlyphs = post->name.format20->numGlyphs;
+ fprintf(fp, "\t Format 2.0: Non-Standard (for PostScript) TrueType Glyph Set.\n");
+ fprintf(fp,"\t\t numGlyphs:\t %d\n",
+ post->name.format20->numGlyphs);
+ for (i=0;i<numGlyphs;i++)
+ {
+ if (post->name.format20->glyphNameIndex[i] < 257)
+ {
+ fprintf(fp,"\t\t Glyf %3d -> Mac Glyph # %3d\n", i,
+ post->name.format20->glyphNameIndex[i]);
+ }
+ else if (post->name.format20->glyphNameIndex[i] < 32767)
+ {
+ fprintf(fp,"\t\t Glyf %3d -> PSGlyf Name # %3d, '%s'\n",
+ i, post->name.format20->glyphNameIndex[i] - 257,
+ post->name.format20->GlyphName[i]);
+ }
+ }
+ break;
+ case 0x00020005:
+ /* not implemented yet */
+ break;
+ default:
+ /* do nothing */;
+ }
+}
+
+void ttfFreePOST(POSTPtr post)
+{
+ USHORT i, numGlyphs;
+ switch (post->format)
+ {
+ case 0x00020000:
+ numGlyphs = post->name.format20->numGlyphs;
+ for (i=0;i<numGlyphs;i++)
+ {
+ if (post->name.format20->glyphNameIndex[i] > 257)
+ free(post->name.format20->GlyphName[i]);
+ }
+ free(post->name.format20->glyphNameIndex);
+ free(post->name.format20->GlyphName);
+ free(post->name.format20);
+ break;
+ case 0x00020005:
+ /* not implemented yet */
+ break;
+ default:
+ /* do nothing */;
+ }
+ free(post);
+}
diff --git a/Build/source/texk/ttfdump/libttf/prep.c b/Build/source/texk/ttfdump/libttf/prep.c
new file mode 100644
index 00000000000..55d674b7521
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/prep.c
@@ -0,0 +1,53 @@
+/* prep.c -- Control Value Program
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: prep.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: prep.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+static void ttfLoadPREP(FILE *fp,BYTE *prep,USHORT lenght,ULONG offset);
+
+void ttfInitPREP(TTFontPtr font)
+{
+ ULONG tag = 'p' | 'r' << 8 | 'e' << 16 | 'p' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->prepLength = ptd->length;
+ font->prep = (BYTE *) calloc(font->prepLength, sizeof(BYTE));
+ if (font->prep != NULL)
+ ttfLoadPREP(font->fp,font->prep,font->prepLength,ptd->offset);
+ }
+}
+
+static void ttfLoadPREP(FILE *fp,BYTE *prep,USHORT length,ULONG offset)
+{
+ if (fseek(fp,offset,SEEK_SET) != 0)
+ ttfError("Fseek Failed in ttfLoadPREP \n");
+
+ if (fread(prep, sizeof(BYTE), length, fp) != length)
+ ttfError("Error when getting PREP\n");
+}
+
+void ttfPrintPREP(FILE *fp, BYTE *prep, USHORT length)
+{
+ ttfPrintInstructions(fp, prep);
+}
+
+void ttfFreePREP(BYTE *prep)
+{
+ if (prep != NULL)
+ free(prep);
+}
diff --git a/Build/source/texk/ttfdump/libttf/stack.c b/Build/source/texk/ttfdump/libttf/stack.c
new file mode 100644
index 00000000000..e47b3b0af09
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/stack.c
@@ -0,0 +1,101 @@
+/* stack.c -- primitives for managing instruction stack and stream
+ * Copyright (C) 1996 Li-Da Lho, All right reserved.
+ */
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: stack.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: stack.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+#define stack (vm->Stack)
+#define sp (vm->sp)
+#define limit (vm->stklimit)
+#define ins (vm->iStream)
+#define ip (vm->ip)
+
+enum TTF_ERROR {StackOverflow ,InstructionOverflow};
+
+/* Push LONG l onto the stack of vm */
+inline void Push(VirtualMachine *vm, LONG l)
+{
+ if (sp < limit)
+ {
+ stack[sp] = l;
+ sp += 1;
+ }
+ else
+ vm->Error_State = StackOverflow;
+}
+/* Pop LONG from the stack of vm and store in l */
+inline LONG Pop(VirtualMachine *vm)
+{
+ LONG l;
+
+ if (sp > 0)
+ {
+ l = stack[sp];
+ sp -= 1;
+ return l;
+ }
+ else
+ {
+ vm->Error_State = StackOverflow;
+ return 0;
+ }
+}
+
+/* read one byte from the instruction stream */
+inline BYTE GetBYTE(VirtualMachine *vm)
+{
+ if (ip < vm->insLength+1)
+ return ins[ip++];
+ else
+ {
+ vm->Error_State = InstructionOverflow;
+ return 0;
+ }
+}
+/* read two bytes from the instruction stream */
+inline SHORT GetSHORT(VirtualMachine *vm)
+{
+ SHORT n = 0;
+
+ if (ip < vm->insLength + 2)
+ {
+ n = ins[ip++] << 8;
+ n |= ins[ip++];
+ return n;
+ }
+ else
+ {
+ vm->Error_State = InstructionOverflow;
+ return 0;
+ }
+}
+/* read four bytes from the instruction steam */
+inline LONG GetLONG(VirtualMachine *vm)
+{
+ LONG n = 0;
+
+ if (ip < vm->insLength + 4)
+ {
+ n = ins[ip++] << 24;
+ n |= ins[ip++] << 16;
+ n |= ins[ip++] << 8;
+ n |= ins[ip++] ;
+ return n;
+ }
+ else
+ {
+ vm->Error_State = InstructionOverflow;
+ return 0;
+ }
+}
diff --git a/Build/source/texk/ttfdump/libttf/tabledir.c b/Build/source/texk/ttfdump/libttf/tabledir.c
new file mode 100644
index 00000000000..2e2f328beb1
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/tabledir.c
@@ -0,0 +1,121 @@
+/* loadtable.c
+ * Load the tables of the Table Directory of a True Type font file
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: tabledir.c,v 1.2 1998/07/04 13:17:51 werner Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: tabledir.c,v 1.2 1998/07/04 13:17:51 werner Exp $";
+#endif /* lint */
+
+static TableDirPtr ttfAllocTableDir(TTFontPtr font);
+static void ttfLoadTableDir(FILE *fp,TableDirPtr p,ULONG offset);
+
+#define Offset 12 /* start point of table dir */
+
+void ttfInitTableDir(TTFontPtr font, ULONG offset)
+{
+ int i,pos; /* table directory starts form position 12 */
+
+ font->dir = ttfAllocTableDir(font);
+ pos = Offset + offset;
+ for (i=0;i<font->numTables;i++)
+ {
+ ttfLoadTableDir(font->fp,font->dir+i,pos);
+ pos += sizeof(TableDir);
+ }
+}
+
+static TableDirPtr ttfAllocTableDir(TTFontPtr font)
+{
+ TableDirPtr ptable;
+
+ if ((ptable = (TableDirPtr) calloc(font->numTables,sizeof(TableDir))) == NULL)
+ {
+ ttfError("Out Of memory\n in __FILE__:__LINE__");
+ return NULL;
+ }
+ return ptable;
+}
+
+static void ttfLoadTableDir(FILE *fp,TableDirPtr p,ULONG offset)
+{
+ if (fseek(fp,offset,SEEK_SET) != 0)
+ ttfError("Fseek Failed\n");
+
+ p -> tag = (ULONG) ttfGetLSB32(fp);
+ p -> checksum = ttfGetULONG(fp);
+ p -> offset = ttfGetULONG(fp);
+ p -> length = ttfGetULONG(fp);
+}
+
+void ttfPrintTableDir(FILE *fp,TableDirPtr p)
+{
+ char tagname[5];
+
+ /* make ULONG tag names more like a string */
+ bcopy(&(p->tag),tagname,4);
+ tagname[4] = '\0';
+#ifdef WORDS_BIGENDIAN
+ FourByteSwap((unsigned char *)tagname,4);
+#endif
+
+ fprintf(fp,"'%s' - chechsum = 0x%08x, offset = 0x%08x, len = %9u \n",
+ tagname,p->checksum,p->offset,p->length);
+}
+
+void ttfFreeTableDir(TableDirPtr p)
+{
+ free(p);
+}
+
+/* ttfLookUpTableDir
+ * lookup the specified table in an array of TableDir
+ * Linear search at present, should change to binary search in the
+ * future to improve effcience
+ * The tag name are sorted in ascent order in ttf file.
+ */
+TableDirPtr ttfLookUpTableDir(ULONG tagname,TTFontPtr font)
+{
+ USHORT i,n = font->numTables;
+ TableDirPtr ptable = font->dir;
+
+ for (i=0;i<n;i++,ptable++)
+ {
+ if (ptable->tag == tagname)
+ return ptable;
+ }
+ return NULL;
+}
+
+/* calculate table check sum */
+/* can't be done until the data abstraction have been finished */
+/* not finished yet */
+ULONG ttfCalcTableCheckSum(ULONG tagname,TTFontPtr font)
+{
+ ULONG sum = 0L,Length;
+ TableDirPtr ptable;
+
+ Length = ((ptable->length+3) & ~3) / sizeof(ULONG);
+
+ ptable = ttfLookUpTableDir(tagname, font);
+ fseek(font->fp,ptable->offset,SEEK_SET);
+
+ while (Length--)
+ {
+ sum += ttfGetULONG(font->fp);
+ }
+
+ return sum;
+}
diff --git a/Build/source/texk/ttfdump/libttf/ttc.c b/Build/source/texk/ttfdump/libttf/ttc.c
new file mode 100644
index 00000000000..853fcc103b5
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/ttc.c
@@ -0,0 +1,97 @@
+/* ttc.c -- True Type Collection Support
+ * Copyright (C) 1997 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+#include "ttc.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: ttc.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: ttc.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+TTCHeaderPtr ttfLoadTTCHeader(char * filename)
+{
+ ULONG tag = 't' | 't' << 8 | 'c' << 16 | 'f' << 24;
+ TTCHeaderPtr ttc;
+ FILE *fp;
+
+ if ((fp = fopen (filename,"r")) == NULL)
+ {
+ fprintf(stderr,"Can't open ttc file %s\n",filename);
+ return NULL;
+ }
+ ttc = (TTCHeaderPtr) calloc(1, sizeof(TTCHeader));
+
+ /* True Type Collection's TTCHeader */
+ if ((ttc->TTCTag = (ULONG) ttfGetLSB32(fp)) == tag)
+ {
+ ttc->version = ttfGetFixed(fp);
+ ttc->DirCount = (USHORT) ttfGetULONG(fp);
+ ttc->offset = (ULONG *) calloc(ttc->DirCount,
+ sizeof(ULONG));
+ if (fread(ttc->offset, sizeof(ULONG),
+ ttc->DirCount,fp) != ttc->DirCount)
+ {
+ ttfError("Error when reading Table Direcotry Offset/n");
+ }
+#ifndef WORDS_BIGENDIAN
+ FourByteSwap((unsigned char *) ttc->offset,
+ ttc->DirCount*sizeof(ULONG));
+#endif
+ ttfLoadTTCFont(ttc,fp);
+ return ttc;
+ }
+ else
+ /* a file with ttc in name but no ttc tag in it */
+ return NULL;
+}
+
+void ttfLoadTTCFont(TTCHeaderPtr ttc,FILE *fp)
+{
+ int i;
+
+ ttc->font = (TTFontPtr) calloc(ttc->DirCount, sizeof(TTFont));
+
+ if (ttc->font == NULL)
+ {
+ ttfError("Out of Memory");
+ return;
+ }
+ /* currently, we are loading all fonts in a TTC file.
+ * I still can't find a good way to share the data. */
+ for (i=0;i<ttc->DirCount;i++)
+ {
+ (ttc->font+i) -> fp = fp;
+ ttfLoadFont((ttc->font+i),(ttc->offset)[i]);
+ }
+}
+
+void ttfFreeTTCFont(TTCHeaderPtr ttc)
+{
+ int i;
+
+ for (i=0;i<ttc->DirCount;i++)
+ {
+ ttfFreeRequiredTables(ttc->font+i);
+
+ ttfFreeOptionalTables(ttc->font+i);
+
+ ttfFreeTableDir((ttc->font+i)->dir);
+ free((ttc->font+i)->refcount);
+ }
+
+ free(ttc->offset);
+ free(ttc->font);
+ free(ttc);
+}
diff --git a/Build/source/texk/ttfdump/libttf/ttfread.c b/Build/source/texk/ttfdump/libttf/ttfread.c
new file mode 100644
index 00000000000..5315509ce21
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/ttfread.c
@@ -0,0 +1,129 @@
+/* ttfread.c
+ * read data element form ttf file
+ * swap byte order carefully for MSBFirst
+ * presume that int is 32 bits
+ */
+#include <stdio.h>
+
+#if defined(__GNUC__) && defined(_IBMR2)
+/* Workaround for missing typedef in gcc (egcs-2.90.27 980315 (egcs-1.0.2 release)) */
+typedef long blkcnt_t; /* number of blocks in the file */
+#endif
+
+#include "ttf.h"
+#include "ttfutil.h"
+
+/* $Id: ttfread.c,v 1.2 1998/07/04 13:17:51 werner Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: ttfread.c,v 1.2 1998/07/04 13:17:51 werner Exp $";
+#endif /* lint */
+
+inline BYTE ttfGetBYTE(FILE *fp)
+{
+ int cc;
+ if ((cc = fgetc(fp)) == EOF)
+ {
+ /*if (feof(fp) != 0)
+ ttfError("Unexpected EOF \n");
+ else
+ ttfError("Error Getting BYTE\n");*/
+ }
+ return (BYTE) cc;
+}
+short ttfGetLSB16(FILE *fp)
+{
+ int cc;
+ cc = ttfGetBYTE(fp);
+ cc |= ttfGetBYTE(fp) <<8;
+ return cc;
+}
+
+int ttfGetLSB32(FILE *fp)
+{
+ int cc;
+ cc = ttfGetBYTE(fp);
+ cc |= ttfGetBYTE(fp) << 8;
+ cc |= ttfGetBYTE(fp) << 16;
+ cc |= ttfGetBYTE(fp) << 24;
+ return cc;
+}
+
+CHAR ttfGetCHAR(FILE *fp)
+{
+ int cc;
+ if ((cc = fgetc(fp)) == EOF)
+ {
+ if (feof(fp) != 0)
+ ttfError("Unexpected EOF \n");
+ else
+ ttfError("Error Getting CHAR\n");
+ }
+ return (CHAR) cc;
+}
+
+USHORT ttfGetUSHORT(FILE *fp)
+{
+ int cc;
+ cc = ttfGetBYTE(fp) << 8;
+ cc |= ttfGetBYTE(fp);
+
+ return (USHORT) cc;
+}
+
+USHORT ttfGetSHORT(FILE *fp)
+{
+ int cc;
+ cc = ttfGetBYTE(fp) << 8;
+ cc |= ttfGetBYTE(fp);
+
+ return (SHORT) cc;
+}
+
+ULONG ttfGetULONG(FILE *fp)
+{
+ int cc;
+ cc = ttfGetBYTE(fp) << 24;
+ cc |= ttfGetBYTE(fp) << 16;
+ cc |= ttfGetBYTE(fp) << 8;
+ cc |= ttfGetBYTE(fp);
+
+ return (ULONG) cc;
+}
+
+LONG ttfGetLONG(FILE *fp)
+{
+ int cc;
+ cc = ttfGetBYTE(fp) << 24;
+ cc |= ttfGetBYTE(fp) << 16;
+ cc |= ttfGetBYTE(fp) << 8;
+ cc |= ttfGetBYTE(fp);
+
+ return (LONG) cc;
+}
+
+Fixed ttfGetFixed(FILE *fp)
+{
+ return (Fixed) ttfGetULONG(fp);
+}
+
+FUnit ttfGetFUnit(FILE *fp)
+{
+ return (FUnit) ttfGetUSHORT(fp);
+}
+
+FWord ttfGetFWord(FILE *fp)
+{
+ return (FWord) ttfGetSHORT(fp);
+}
+
+uFWord ttfGetuFWord(FILE *fp)
+{
+ return (uFWord) ttfGetUSHORT(fp);
+}
+
+F2Dot14 ttfGetF2Dot14(FILE *fp)
+{
+ return (F2Dot14) ttfGetUSHORT(fp);
+}
+
diff --git a/Build/source/texk/ttfdump/libttf/ttfutil.c b/Build/source/texk/ttfdump/libttf/ttfutil.c
new file mode 100644
index 00000000000..d2ae4f31580
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/ttfutil.c
@@ -0,0 +1,57 @@
+#include <stdio.h>
+#include "ttf.h"
+#include "ttfutil.h"
+
+/* $Id: ttfutil.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: ttfutil.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+/* FixedSplit: split Fixed in to two interger (16.16) */
+void FixedSplit(Fixed f,int b[])
+{
+ b[0] = f & 0xff00;
+ b[1] = f >> 16;
+}
+
+/*
+ * Invert byte order within each 16-bits of an array.
+ */
+void
+TwoByteSwap(unsigned char *buf, int nbytes)
+{
+ register unsigned char c;
+
+ for (; nbytes > 0; nbytes -= 2, buf += 2)
+ {
+ c = buf[0];
+ buf[0] = buf[1];
+ buf[1] = c;
+ }
+}
+
+/*
+ * Invert byte order within each 32-bits of an array.
+ */
+
+void
+FourByteSwap(unsigned char *buf, int nbytes)
+{
+ register unsigned char c;
+
+ for (; nbytes > 0; nbytes -= 4, buf += 4)
+ {
+ c = buf[0];
+ buf[0] = buf[3];
+ buf[3] = c;
+ c = buf[1];
+ buf[1] = buf[2];
+ buf[2] = c;
+ }
+}
+
+void ttfError(char * msg)
+{
+ fprintf(stderr,"%s",msg);
+}
diff --git a/Build/source/texk/ttfdump/libttf/vdmx.c b/Build/source/texk/ttfdump/libttf/vdmx.c
new file mode 100644
index 00000000000..ad5629acfe7
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/vdmx.c
@@ -0,0 +1,157 @@
+/* vdmx.c -- Vertical Device Metrics
+ * Copyright (C) 1996 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: vdmx.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: vdmx.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static VDMXPtr ttfAllocVDMX(TTFontPtr font);
+static void ttfLoadVDMX(FILE *fp,VDMXPtr vdmx,ULONG offset);
+
+void ttfInitVDMX(TTFontPtr font)
+{
+ ULONG tag = 'V' | 'D' << 8 | 'M' << 16 | 'X' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->vdmx = ttfAllocVDMX(font);
+ ttfLoadVDMX(font->fp,font->vdmx,ptd->offset);
+ }
+}
+static VDMXPtr ttfAllocVDMX(TTFontPtr font)
+{
+ VDMXPtr vdmx;
+
+ if ((vdmx = (VDMXPtr) calloc(1,sizeof(VDMX))) == NULL)
+ {
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return vdmx;
+}
+static void ttfLoadVDMX (FILE *fp,VDMXPtr vdmx,ULONG offset)
+{
+ int i;
+
+ if (fseek(fp,offset,SEEK_SET) != 0)
+ ttfError("Fseek Failed in ttfLoadVDMX \n");
+
+ vdmx->version = ttfGetUSHORT(fp);
+ vdmx->numRecs = ttfGetUSHORT(fp);
+ vdmx->numRatios = ttfGetUSHORT(fp);
+ vdmx->ratRange = (Ratios *) calloc(vdmx->numRatios, sizeof(Ratios));
+ vdmx->offset = (USHORT *) calloc(vdmx->numRatios, sizeof(USHORT));
+ vdmx->groups = (Vdmx *) calloc(vdmx->numRecs, sizeof(Vdmx));
+
+ for (i=0;i<vdmx->numRatios;i++)
+ {
+ (vdmx->ratRange+i)->CharSet = ttfGetBYTE(fp);
+ (vdmx->ratRange+i)->xRatio = ttfGetBYTE(fp);
+ (vdmx->ratRange+i)->yStartRatio = ttfGetBYTE(fp);
+ (vdmx->ratRange+i)->yEndRatio = ttfGetBYTE(fp);
+
+ }
+ if (fread(vdmx->offset, sizeof(USHORT), vdmx->numRatios,fp) !=
+ vdmx->numRatios)
+ ttfError("Error when getting Offset\n");
+#ifndef WORDS_BIGENDIAN
+ TwoByteSwap((unsigned char *) vdmx->offset,
+ vdmx->numRatios*sizeof(USHORT));
+#endif
+
+ for (i=0;i<vdmx->numRecs;i++)
+ {
+ int j;
+ (vdmx->groups+i)->recs = ttfGetUSHORT(fp);
+ (vdmx->groups+i)->startsz = ttfGetBYTE(fp);
+ (vdmx->groups+i)->endsz = ttfGetBYTE(fp);
+
+ (vdmx->groups+i)->entry =
+ (vTable *) calloc((vdmx->groups+i)->recs, sizeof(vTable));
+
+ for (j=0;j<(vdmx->groups+i)->recs;j++)
+ {
+ ((vdmx->groups+i)->entry+j)->yPelHeight = ttfGetUSHORT(fp);
+ ((vdmx->groups+i)->entry+j)->yMax = ttfGetSHORT(fp);
+ ((vdmx->groups+i)->entry+j)->yMin = ttfGetSHORT(fp);
+ }
+ }
+}
+
+void ttfPrintVDMX(FILE *fp,VDMXPtr vdmx)
+{
+ int i;
+
+ fprintf(fp,"'VDMX' Table - Precomputed Vertical Device Metrics\n");
+ fprintf(fp,"--------------------------------------------------\n");
+
+
+ fprintf(fp,"Version:\t %d\n", vdmx->version);
+ fprintf(fp,"Number of Hgt Records:\t %d\n",vdmx->numRecs);
+ fprintf(fp,"Number of Ratio Records:\t %d\n",vdmx->numRecs);
+
+ for (i=0;i<vdmx->numRatios;i++)
+ {
+ fprintf(fp,"\t Ratio Record #%d\n",i+1);
+ fprintf(fp,"\t\t CharSetId \t %d\n",(vdmx->ratRange+i)->CharSet);
+ fprintf(fp,"\t\t xRatio \t %d\n",(vdmx->ratRange+i)->xRatio);
+ fprintf(fp,"\t\t yStartRatio \t %d\n",(vdmx->ratRange+i)->yStartRatio);
+ fprintf(fp,"\t\t yEndRatio \t %d\n",(vdmx->ratRange+i)->yEndRatio);
+ fprintf(fp,"\t\t Record Offset %d (group #%d)\n\n",vdmx->offset[i],i);
+ }
+
+ fprintf(fp,"\t VDMX Height Record Groups\n");
+ fprintf(fp,"\t -------------------------\n\n");
+
+ for (i=0;i<vdmx->numRecs;i++)
+ {
+ int j;
+
+ fprintf(fp,"\t %d. Number of Hgt Records %d\n",i,
+ (vdmx->groups+i)->recs);
+ fprintf(fp,"\t Starting Y Pel Height %d\n",
+ (vdmx->groups+i)->startsz);
+ fprintf(fp,"\t Ending Y Pel Height %d\n",
+ (vdmx->groups+i)->endsz);
+
+ for (j=0;j<(vdmx->groups+i)->recs;j++)
+ {
+ fprintf(fp,"\t\t %d. Pel Height= %d\n",j+1,
+ ((vdmx->groups+i)->entry+j)->yPelHeight);
+ fprintf(fp,"\t\t yMax= \t %d\n",
+ ((vdmx->groups+i)->entry+j)->yMax);
+ fprintf(fp,"\t\t yMin= \t %d\n\n",
+ ((vdmx->groups+i)->entry+j)->yMin);
+ }
+ }
+
+}
+
+void ttfFreeVDMX(VDMXPtr vdmx)
+{
+ int i;
+ if (vdmx != NULL)
+ {
+ for (i=0;i<vdmx->numRecs;i++)
+ {
+ free((vdmx->groups+i)->entry);
+ }
+ free(vdmx->ratRange);
+ free(vdmx->offset);
+ free(vdmx->groups);
+ free(vdmx);
+ }
+}
diff --git a/Build/source/texk/ttfdump/libttf/vhea.c b/Build/source/texk/ttfdump/libttf/vhea.c
new file mode 100644
index 00000000000..e00c4f2268f
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/vhea.c
@@ -0,0 +1,102 @@
+/* vhea.c -- Vertical Header Table
+ * Copyright (C) 1997 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: vhea.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: vhea.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+
+static VHEAPtr ttfAllocVHEA(TTFontPtr font);
+static void ttfLoadVHEA(FILE *fp,VHEAPtr vhea,ULONG offset);
+
+void ttfInitVHEA(TTFontPtr font)
+{
+ ULONG tag = 'v' | 'h' << 8 | 'e' << 16 | 'a' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->vhea = ttfAllocVHEA(font);
+ ttfLoadVHEA(font->fp,font->vhea,ptd->offset);
+ }
+}
+static VHEAPtr ttfAllocVHEA(TTFontPtr font)
+{
+ VHEAPtr vhea;
+
+ if ((vhea = (VHEAPtr) calloc(1,sizeof(VHEA))) == NULL)
+ {
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return vhea;
+}
+static void ttfLoadVHEA (FILE *fp,VHEAPtr vhea,ULONG offset)
+{
+ int i;
+
+ if (fseek(fp,offset,SEEK_SET) != 0)
+ ttfError("Fseek Failed in ttfLoadVHEA \n");
+
+ vhea->version = ttfGetFixed(fp);
+ vhea->ascent = ttfGetSHORT(fp);
+ vhea->descent = ttfGetSHORT(fp);
+ vhea->lineGap = ttfGetSHORT(fp);
+ vhea->advanceHeightMax = ttfGetSHORT(fp);
+ vhea->minTopSideBearing = ttfGetSHORT(fp);
+ vhea->minBottomSideBearing = ttfGetSHORT(fp);
+ vhea->yMaxExtent = ttfGetSHORT(fp);
+ vhea->caretSlopeRise = ttfGetSHORT(fp);
+ vhea->caretSlopeRun = ttfGetSHORT(fp);
+ vhea->caretOffset = ttfGetSHORT(fp);
+ for(i=0;i<4;i++)
+ (vhea->reserved)[i] = ttfGetSHORT(fp);
+ vhea->metricDataFormat = ttfGetSHORT(fp);
+ vhea->numOfLongVerMetrics = ttfGetUSHORT(fp);
+}
+
+void ttfPrintVHEA(FILE *fp,VHEAPtr vhea)
+{
+ int i,b[2];
+
+ fprintf(fp,"'VHEA' - Vertical Header Table\n");
+ fprintf(fp,"------------------------------\n");
+
+ FixedSplit(vhea->version,b);
+
+ fprintf(fp,"\t version:\t %d.%d\n",b[1],b[0]);
+ fprintf(fp,"\t ascent:\t %d\n",vhea->ascent);
+ fprintf(fp,"\t descent:\t %d\n",vhea->descent);
+ fprintf(fp,"\t lineGap:\t %d\n",vhea->lineGap);
+ fprintf(fp,"\t advanceHeightMax: %d\n",vhea->advanceHeightMax);
+ fprintf(fp,"\t minTopSideBearing: %d\n",vhea->minTopSideBearing);
+ fprintf(fp,"\t minBottomBearing: %d\n",vhea->minBottomSideBearing);
+ fprintf(fp,"\t yMaxExtent:\t %d\n",vhea->yMaxExtent);
+ fprintf(fp,"\t caretSlopeRise: %d\n", vhea->caretSlopeRise);
+ fprintf(fp,"\t caretSlopeRun: %d\n", vhea->caretSlopeRun);
+ fprintf(fp,"\t caretOffset:\t %d\n", vhea->caretOffset);
+ for(i=0;i<4;i++)
+ fprintf(fp,"\t reserved %d:\t %d\n",i,(vhea->reserved)[i]);
+ fprintf(fp,"\t metricDataFormat:\t %d\n", vhea->metricDataFormat);
+ fprintf(fp,"\t numOfLongVerMetrics: %d\n",vhea->numOfLongVerMetrics);
+}
+
+void ttfFreeVHEA(VHEAPtr vhea)
+{
+ if (vhea != NULL)
+ {
+ free(vhea);
+ }
+}
diff --git a/Build/source/texk/ttfdump/libttf/vmtx.c b/Build/source/texk/ttfdump/libttf/vmtx.c
new file mode 100644
index 00000000000..990f824a66a
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/vmtx.c
@@ -0,0 +1,115 @@
+/* vmtx.c -- Vertical Metrics Table
+ * Copyright (C) 1997 Li-Da Lho, All right reserved
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+/* $Id: vmtx.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
+
+#ifndef lint
+static char vcid[] = "$Id: vmtx.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
+#endif /* lint */
+
+static VMTXPtr ttfAllocVMTX(TTFontPtr font);
+static void ttfLoadVMTX(FILE *fp,VMTXPtr vmtx,ULONG offset);
+
+/* Caution: Because of interdependency between tables,
+ * table vhea and maxp should be well initalized before
+ * ttfInitVMTX has been called
+ */
+void ttfInitVMTX(TTFontPtr font)
+{
+ ULONG tag = 'v' | 'm' << 8 | 't' << 16 | 'x' << 24;
+ TableDirPtr ptd;
+
+ if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
+ {
+ font->vmtx = ttfAllocVMTX(font);
+ font->vmtx->numOfLongVerMetrics =
+ font->vhea->numOfLongVerMetrics;
+ font->vmtx->numOfTSB = font->maxp->numGlyphs -
+ font->vhea->numOfLongVerMetrics;
+ ttfLoadVMTX(font->fp,font->vmtx,ptd->offset);
+ }
+}
+static VMTXPtr ttfAllocVMTX(TTFontPtr font)
+{
+ VMTXPtr vmtx;
+
+ if ((vmtx = (VMTXPtr) calloc(1,sizeof(VMTX))) == NULL)
+ {
+ ttfError("Out of Memory in __FILE__:__LINE__\n");
+ return NULL;
+ }
+ return vmtx;
+}
+static void ttfLoadVMTX(FILE *fp,VMTXPtr vmtx,ULONG offset)
+{
+ USHORT i,n = vmtx->numOfLongVerMetrics,m=vmtx->numOfTSB;
+
+ if (fseek(fp,offset,SEEK_SET) !=0)
+ ttfError("Fseek Failed in ttfLOADVMTX \n");
+
+ if ((vmtx->vMetrics = (longVerMetric *) calloc(n,sizeof(longVerMetric))) != NULL)
+ {
+ for (i=0;i<n;i++)
+ {
+ (vmtx->vMetrics+i)->advanceHeight = ttfGetuFWord(fp);
+ (vmtx->vMetrics+i)->topSideBearing = ttfGetFWord(fp);
+ }
+ }
+ else
+ {
+ ttfError("Out Of Memory in __FILE__ : __LINE__\n");
+ }
+
+ /* codes dealing with leftSideBearing entry */
+ if (m && ((vmtx->topSideBearing = (FWord *) calloc(m,sizeof(FWord))) != NULL))
+ {
+ for (i=0;i<m;i++)
+ {
+ (vmtx->topSideBearing)[i] = ttfGetFWord(fp);
+ }
+ }
+}
+
+void ttfPrintVMTX(FILE *fp,VMTXPtr vmtx)
+{
+ int i;
+
+ fprintf(fp,"'vmtx' Table - Vertical Metrics\n");
+ fprintf(fp,"---------------------------------\n");
+
+ for (i=0;i<vmtx->numOfLongVerMetrics;i++)
+ {
+ fprintf(fp,"\t %4d. advWid: %4d, TSBear: %4d\n",i,
+ (vmtx->vMetrics+i)->advanceHeight,
+ (vmtx->vMetrics+i)->topSideBearing);
+ }
+
+ for (i=0;i<vmtx->numOfTSB;i++)
+ {
+ fprintf(fp,"\t %4d. TSBear: %4d\n",i+vmtx->numOfLongVerMetrics,
+ (vmtx->topSideBearing)[i]);
+ }
+}
+
+void ttfFreeVMTX(VMTXPtr vmtx)
+{
+ if (vmtx != NULL)
+ {
+ free(vmtx->vMetrics);
+
+ if (vmtx->numOfTSB)
+ free(vmtx->topSideBearing);
+
+ free(vmtx);
+ }
+}
diff --git a/Build/source/texk/ttfdump/libttf/win32.mak b/Build/source/texk/ttfdump/libttf/win32.mak
new file mode 100644
index 00000000000..8a93b0bf86a
--- /dev/null
+++ b/Build/source/texk/ttfdump/libttf/win32.mak
@@ -0,0 +1,57 @@
+################################################################################
+#
+# Makefile : TtfDump / Lib TTF
+# Author : Fabrice Popineau <Fabrice.Popineau@supelec.fr>
+# Platform : Win32, Microsoft VC++ 6.0, depends upon fpTeX 0.5 sources
+# Time-stamp: <02/01/21 12:08:28 popineau>
+#
+################################################################################
+root_srcdir = ..\..\..
+!ifdef DEVELOPMENT
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk.development
+!else
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk
+!endif
+
+USE_GNUW32 = 1
+USE_KPATHSEA = 1
+
+!include <msvc/common.mak>
+
+DEFS = -I..\include -I. -I.. $(DEFS)
+
+objects = $(objdir)\ttfread.obj $(objdir)\tabledir.obj $(objdir)\ttfutil.obj \
+ $(objdir)\font.obj $(objdir)\cmap.obj $(objdir)\glyf.obj \
+ $(objdir)\gcache.obj $(objdir)\head.obj $(objdir)\hhea.obj \
+ $(objdir)\hmtx.obj $(objdir)\loca.obj $(objdir)\maxp.obj \
+ $(objdir)\name.obj $(objdir)\os2.obj $(objdir)\post.obj \
+ $(objdir)\cvt.obj $(objdir)\fpgm.obj $(objdir)\gasp.obj \
+ $(objdir)\hdmx.obj $(objdir)\kern.obj $(objdir)\ltsh.obj \
+ $(objdir)\prep.obj $(objdir)\pclt.obj $(objdir)\vdmx.obj \
+ $(objdir)\vhea.obj $(objdir)\vmtx.obj $(objdir)\gstate.obj \
+ $(objdir)\stack.obj $(objdir)\interp.obj $(objdir)\disasm.obj \
+ $(objdir)\ttc.obj
+
+default: all
+
+all: $(objdir) $(objdir)\libttf.lib
+
+$(objdir)\libttf.lib: $(objects)
+ $(archive) $(objects)
+
+..\config.h:
+ pushd .. & $(make) config.h & popd
+
+!include <msvc/config.mak>
+!include <msvc/install.mak>
+
+!include <msvc/clean.mak>
+!include <msvc/rdepend.mak>
+!include "./depend.mak"
+
+#
+# Local Variables:
+# mode: makefile
+# End:
+
+
diff --git a/Build/source/texk/ttfdump/src/Makefile.in b/Build/source/texk/ttfdump/src/Makefile.in
new file mode 100644
index 00000000000..8a23f2e6a35
--- /dev/null
+++ b/Build/source/texk/ttfdump/src/Makefile.in
@@ -0,0 +1,114 @@
+# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+
+# 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# @configure_input@
+
+SHELL = /bin/sh
+
+#### Start of system configuration section. ####
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+# If you use gcc, you should either run the fixincludes script that
+# comes with it or else use gcc with the -traditional option. Otherwise
+# ioctl calls will be compiled incorrectly on some systems.
+CC = @CC@
+AR = ar
+
+# set make command
+@SET_MAKE@
+
+# Set RANLIB = echo if your system doesn't have or need ranlib.
+RANLIB = @RANLIB@
+
+# Use cp if you don't have install.
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+DEFS = @DEFS@
+LIBS = @LIBS@
+
+INCLUDES = -I@top_srcdir@ -I@top_srcdir@/include
+CFLAGS = @CFLAGS@ $(INCLUDES) $(DEFS)
+LDFLAGS = @LDFLAGS@
+
+MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+# Where to install the executables.
+bindir = $(exec_prefix)/bin
+
+# Where to put the include header
+includedir = $(prefix)/include
+
+# Where to put the Info files
+infodir = $(prefix)/info
+
+# Where to put the library file
+libdir = $(prefix)/lib
+
+# Where to put the manual pages.
+mandir = $(prefix)/man
+
+#### End of system configuration section. ####
+#CC = gcc
+#CFLAGS = -g -pg -Wall -m486 -DMEMCHECK -DTESTCODE -DCOPYDELETE -I/usr/local/include
+#CFLAGS = -O3 -Wall -m486 -DTESTCODE -DCOPYDELETE -I../ -I../include -I/usr/local/include
+#LDFLAGS = -L/usr/local/lib
+#LIBS = -ldmalloc
+#LIBS = -lefence
+#LIBS = -lc_p
+OBJS = ttfdump.o
+
+all: ttfdump
+
+ttfdump:${OBJS} ../libttf/libttf.a
+ ${CC} ${CFLAGS} -o $@ ${OBJS} ../libttf/libttf.a ${LIBS}
+
+test:ttfdump
+ -./ttfdump times.ttf times.txt
+ @echo There should be no differences found:
+ diff times.txt times.ok
+
+depend:
+ co RCS/*
+ makedepend *.c *.h
+ rcsclean
+clean:
+ rm -f *.o *~ core gmon.out times.txt ttfdump logfile
+.PHONY: clean
+
+distclean: clean
+ rm -f tags TAGS Makefile
+
+.PHONY: distclean
+
+check: test
+
+install: ttfdump
+ $(INSTALL_PROGRAM) ttfdump $(bindir)/ttfdump
+ strip $(bindir)/ttfdump || true
+ chmod 775 $(bindir)/ttfdump
+ $(INSTALL_DATA) ../docs/ttfdump.1 $(mandir)/man1/ttfdump.1
+ chmod 664 $(mandir)/man1/ttfdump.1
+ @-rm -f $(mandir)/cat1/ttfdump.1
+ @echo Installed files...
+ ls -l $(bindir)/ttfdump $(mandir)/man1/ttfdump.1
diff --git a/Build/source/texk/ttfdump/src/depend.mak b/Build/source/texk/ttfdump/src/depend.mak
new file mode 100644
index 00000000000..0984e0ea81b
--- /dev/null
+++ b/Build/source/texk/ttfdump/src/depend.mak
@@ -0,0 +1,14 @@
+$(objdir)/ttfdump.obj: \
+ $(kpathseadir)/getopt.h \
+ ../config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-memstr.h \
+ ../include/ttf.h \
+ ../include/tables.h \
+ ../include/gcache.h \
+ ../include/gstate.h \
+ ../include/loadtable.h \
+ ../include/ttfutil.h \
+ ../include/protos.h \
+ ../include/ttc.h
+
diff --git a/Build/source/texk/ttfdump/src/ttfdump.c b/Build/source/texk/ttfdump/src/ttfdump.c
new file mode 100644
index 00000000000..d1848a08e95
--- /dev/null
+++ b/Build/source/texk/ttfdump/src/ttfdump.c
@@ -0,0 +1,600 @@
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef WIN32
+#include <kpathsea/getopt.h>
+#else
+#include <unistd.h>
+#endif
+
+#include "config.h"
+#include "ttf.h"
+#include "ttfutil.h"
+#include "ttc.h"
+
+#ifdef MEMCHECK
+#include <dmalloc.h>
+#endif
+
+
+/* $Id: ttfdump.c,v 1.2 1998/07/04 13:17:52 werner Exp $ */
+
+
+#ifndef lint
+
+static char vcid[] = "$Id: ttfdump.c,v 1.2 1998/07/04 13:17:52 werner Exp $";
+
+#endif /* lint */
+
+
+#define MAXLEN 256
+#define ALL_GLYF -1
+#define NO_GLYF -2
+
+static char ttfname[MAXLEN], dumpname[MAXLEN];
+static TTFontPtr font;
+
+static void print_ttc(TTCHeaderPtr ttc, FILE *out);
+static void print_prologue(FILE *out);
+static void print_offset(FILE *out);
+static void print_dir(FILE *out);
+static void print_all_tables(FILE *dp_file);
+static void print_table(FILE *out, char *tablename);
+
+static void print_cmap(FILE *out);
+static void print_glyf(FILE *out, ULONG index);
+static void print_all_glyfs(FILE *out);
+static void print_head(FILE *out);
+static void print_hhea(FILE *out);
+static void print_hmtx(FILE *out);
+static void print_loca(FILE *out);
+static void print_maxp(FILE *out);
+static void print_name(FILE *out);
+static void print_post(FILE *out);
+static void print_os2(FILE *out);
+
+static void print_cvt(FILE *out);
+static void print_fpgm(FILE *out);
+static void print_gasp(FILE *out);
+static void print_hdmx(FILE *out);
+static void print_kern(FILE *out);
+static void print_ltsh(FILE *out);
+static void print_pclt(FILE *out);
+static void print_prep(FILE *out);
+static void print_vdmx(FILE *out);
+static void print_vhea(FILE *out);
+static void print_vmtx(FILE *out);
+
+static void dialog (int argc, char *argv[]);
+static void usage (void);
+static void add_suffix (char *name, char *suffix);
+
+
+#if !defined(EXIT_FAILURE)
+#define EXIT_FAILURE 1
+#endif
+
+#if !defined(EXIT_SUCCESS)
+#define EXIT_SUCCESS 0
+#endif
+
+
+/* strdup() is not available on all platforms; this version has been
+ * contributed by Nelson Beebe. */
+
+char *
+Strdup(const char *s)
+{
+ char *p;
+
+
+ p = malloc(((s == (const char *)NULL) ? 0 : strlen (s)) + 1);
+ if (p == (char *)NULL)
+ {
+ (void)fprintf(stderr, "Out of memory in Strdup()\n");
+ exit(EXIT_FAILURE);
+ }
+ return strcpy(p, s);
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ FILE *tt_file, *dp_file;
+ TTCHeaderPtr ttc;
+
+ int c;
+ extern int optind;
+ extern char *optarg;
+ char *options, *value;
+
+ char *tablename = NULL;
+
+
+ /* print all glyphs by default */
+ int glyphnum = ALL_GLYF, collection = 0;
+
+ if (argc < 2)
+ {
+ usage();
+ exit(EXIT_FAILURE);
+ }
+
+ while ((c = getopt(argc, argv, "t:g:c:i:o:h")) != EOF)
+ {
+ switch (c)
+ {
+ case 't':
+ tablename = Strdup(optarg);
+ break;
+ case 'g':
+ if (strcmp(optarg, "x") == 0)
+ glyphnum = NO_GLYF;
+ else
+ glyphnum = atoi(optarg);
+ break;
+ case 'c':
+ collection = atoi(optarg);
+ break;
+ case 'i':
+ strcpy(ttfname, optarg);
+ break;
+ case 'o':
+ strcpy(dumpname, optarg);
+ break;
+ case 'h':
+ case '?':
+ usage();
+ exit(EXIT_FAILURE);
+ break;
+ }
+ }
+
+ /* processing ttf file if -i flag is not given */
+ if (*ttfname == 0 && optind < argc)
+ {
+ strcpy(ttfname, argv[optind]);
+ }
+
+ /* processing dumping file if -o flag is not given */
+ if (*dumpname == 0)
+ {
+ if (optind + 1 < argc)
+ {
+ /* no -o flag but dumping filename specified */
+ strcpy(dumpname, argv[optind + 1]);
+ }
+ else
+ strcpy(dumpname, "-");
+ }
+ if (!strcmp(dumpname, "-"))
+ {
+ dp_file = stdout;
+ }
+ else if ((dp_file = fopen(dumpname, "wt")) == NULL)
+ {
+ fprintf(stderr, "Can't open dumping file\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (strstr (ttfname, "ttc") != NULL)
+ {
+ ttc = ttfLoadTTCHeader(ttfname);
+ if (collection < ttc->DirCount)
+ font = ttc->font + collection;
+ else
+ fprintf (stderr, "TrueType collection number too large\n"
+ "should between 0 and %d\n", ttc->DirCount - 1);
+ }
+ else
+ font = ttfInitFont(ttfname);
+
+ if (font == NULL)
+ exit(EXIT_FAILURE);
+
+ print_prologue(dp_file);
+ if (strstr(ttfname, "ttc") != NULL)
+ {
+ print_ttc(ttc, dp_file);
+ }
+ print_offset(dp_file);
+ print_dir(dp_file);
+
+ if (tablename == NULL)
+ {
+ /* no table specified */
+ print_all_tables(dp_file);
+ if (glyphnum == ALL_GLYF)
+ print_all_glyfs(dp_file);
+ else if (glyphnum == NO_GLYF)
+ ;
+ else
+ print_glyf(dp_file, glyphnum);
+ }
+ else
+ {
+ /* table specified */
+ print_table(dp_file, tablename);
+ if (!strcmp(tablename, "glyf"))
+ {
+ if (glyphnum == ALL_GLYF)
+ print_all_glyfs(dp_file);
+ else if (glyphnum == NO_GLYF)
+ ;
+ else
+ print_glyf(dp_file, glyphnum);
+ }
+ }
+
+ if (strstr(ttfname, "ttc") != NULL)
+ {
+ ttfFreeTTCFont(ttc);
+ }
+ else
+ {
+ ttfFreeFont(font);
+ }
+ exit(EXIT_SUCCESS);
+}
+
+
+static void
+print_table(FILE *out, char *tablename)
+{
+ if (!strcmp(tablename, "cmap"))
+ print_cmap(out);
+ if (!strcmp(tablename, "head"))
+ print_head(out);
+ if (!strcmp(tablename, "hhea"))
+ print_hhea(out);
+ if (!strcmp(tablename, "hmtx"))
+ print_hmtx(out);
+ if (!strcmp(tablename, "loca"))
+ print_loca(out);
+ if (!strcmp(tablename, "maxp"))
+ print_maxp(out);
+ if (!strcmp(tablename, "name"))
+ print_name(out);
+ if (!strcmp(tablename, "post"))
+ print_post(out);
+ if (!strcmp(tablename, "OS/2"))
+ print_os2(out);
+ if (!strcmp(tablename, "cvt"))
+ print_cvt(out);
+ if (!strcmp(tablename, "fpgm"))
+ print_fpgm(out);
+ if (!strcmp(tablename, "gasp"))
+ print_gasp(out);
+ if (!strcmp(tablename, "hdmx"))
+ print_hdmx(out);
+ if (!strcmp(tablename, "kern"))
+ print_kern(out);
+ if (!strcmp(tablename, "LTSH"))
+ print_ltsh(out);
+ if (!strcmp(tablename, "prep"))
+ print_prep(out);
+ if (!strcmp(tablename, "VDMX"))
+ print_vdmx(out);
+ if (!strcmp(tablename, "vhea"))
+ print_vhea(out);
+ if (!strcmp(tablename, "vmtx"))
+ print_vmtx(out);
+}
+
+
+static void
+print_all_tables(FILE *dp_file)
+{
+ print_cmap(dp_file);
+ print_head(dp_file);
+ print_hhea(dp_file);
+ print_hmtx(dp_file);
+ print_loca(dp_file);
+ print_maxp(dp_file);
+ print_name(dp_file);
+ print_post(dp_file);
+ print_os2(dp_file);
+
+ /*optional tables */
+ print_cvt(dp_file);
+ print_gasp(dp_file);
+ print_hdmx(dp_file);
+ print_kern(dp_file);
+ print_ltsh(dp_file);
+ print_pclt(dp_file);
+ print_vdmx(dp_file);
+ print_vhea(dp_file);
+ print_vmtx(dp_file);
+}
+
+
+static void
+print_ttc(TTCHeaderPtr ttc, FILE *out)
+{
+ int i, b[2];
+
+
+ FixedSplit(ttc->version, b);
+
+ fprintf(out, "TrueType Collection Header\n");
+ fprintf(out, "--------------------------\n");
+ fprintf(out, "TTC version: \t\t %d.%d\n", b[1], b[0]);
+ fprintf(out, "Number of fonts:\t %d\n", ttc->DirCount);
+ for (i = 0; i < ttc->DirCount; i++)
+ fprintf(out, "Offset of Directory #%d:\t %d\n", i, ttc->offset[i]);
+ fprintf(out, "\n");
+}
+
+
+static void
+print_prologue(FILE *out)
+{
+ fprintf(out, "True Type Font File Dumper: v 0.5.5\n");
+ fprintf(out, "Copyright 1996-1998 ollie@ms1.hinet.net \n");
+ fprintf(out, "Dumping File:%s\n\n\n", font->ttfname);
+}
+
+
+static void
+print_offset(FILE *out)
+{
+ fprintf(out, "Offset Table \n");
+ fprintf(out, "------------ \n");
+ fprintf(out, "\t sfnt version:\n");
+ fprintf(out, "\t number of tables: %d\n", font->numTables);
+}
+
+
+static void
+print_dir(FILE *out)
+{
+ int i;
+
+
+ for (i = 0; i < font->numTables; i++)
+ {
+ fprintf(out, " %2d. ", i);
+ ttfPrintTableDir(out, font->dir + i);
+ }
+ fprintf(out, "\n");
+}
+
+static void
+print_cmap(FILE *out)
+{
+ ttfPrintCMAP(out, font->cmap);
+ fprintf(out, "\n");
+}
+
+static void
+print_glyf(FILE *out, ULONG index)
+{
+ GLYFPtr glyf;
+
+
+ glyf = ttfLoadGlyphIndex(font, index);
+ fprintf(out, "Glyph %6d.\n", index);
+ ttfPrintGLYF(out, glyf);
+}
+
+
+static void
+print_all_glyfs(FILE *out)
+{
+ int i;
+ GLYFPtr glyf;
+
+
+ for (i = 0; i < font->maxp->numGlyphs; i++)
+ {
+ glyf = ttfLoadGlyphIndex(font, i);
+ fprintf(out, "Glyph %6d.\n", i);
+ ttfPrintGLYF(out, glyf);
+ }
+}
+
+
+static void
+print_head(FILE *out)
+{
+ ttfPrintHEAD(out, font->head);
+ fprintf(out, "\n");
+}
+
+
+static void
+print_hhea(FILE *out)
+{
+ ttfPrintHHEA(out, font->hhea);
+ fprintf(out, "\n");
+}
+
+
+static void
+print_hmtx(FILE *out)
+{
+ /* because of interdependencies between tables
+ * we have to init hhea and maxp before hmtx */
+ ttfPrintHMTX(out, font->hmtx);
+ fprintf(out, "\n");
+}
+
+
+static void
+print_loca(FILE *out)
+{
+ /* because of interdependencies between tables
+ * we have to init head and maxp before loca */
+ ttfPrintLOCA(out, font->loca);
+ fprintf(out, "\n");
+}
+
+
+static void
+print_maxp(FILE *out)
+{
+ ttfPrintMAXP(out, font->maxp);
+ fprintf(out, "\n");
+}
+
+
+static void
+print_name(FILE *out)
+{
+ ttfPrintNAME(out, font->name);
+ fprintf(out, "\n");
+}
+
+
+static void
+print_post(FILE *out)
+{
+ ttfPrintPOST(out, font->post);
+}
+
+static void
+print_os2(FILE *out)
+{
+ ttfPrintOS2(out, font->os2);
+}
+
+
+static void
+print_cvt(FILE *out)
+{
+ if (font->cvt != NULL)
+ ttfPrintCVT(out, font->cvt, font->cvtLength);
+}
+
+
+static void
+print_fpgm(FILE *out)
+{
+ if (font->fpgm != NULL)
+ ttfPrintFPGM(out, font->fpgm, font->fpgmLength);
+}
+
+
+static void
+print_gasp(FILE *out)
+{
+ if (font->gasp != NULL)
+ ttfPrintGASP(out, font->gasp);
+}
+
+
+static void
+print_hdmx(FILE *out)
+{
+ if (font->hdmx != NULL)
+ ttfPrintHDMX(out, font->hdmx);
+}
+
+
+static void
+print_kern(FILE *out)
+{
+ if (font->kern != NULL)
+ ttfPrintKERN(out, font->kern);
+}
+
+
+static void
+print_ltsh(FILE *out)
+{
+ if (font->ltsh != NULL)
+ ttfPrintLTSH(out, font->ltsh);
+}
+
+
+static void
+print_pclt(FILE *out)
+{
+ if (font->pclt != NULL)
+ ttfPrintPCLT(out, font->pclt);
+}
+
+
+static void
+print_prep(FILE *out)
+{
+ if (font->prep != NULL)
+ ttfPrintPREP(out, font->prep, font->prepLength);
+}
+
+
+static void
+print_vdmx(FILE *out)
+{
+ if (font->vdmx != NULL)
+ ttfPrintVDMX(out, font->vdmx);
+}
+
+
+static void
+print_vhea(FILE *out)
+{
+ if (font->vhea != NULL)
+ ttfPrintVHEA(out, font->vhea);
+}
+
+
+static void
+print_vmtx(FILE *out)
+{
+ if (font->vmtx != NULL)
+ ttfPrintVMTX(out, font->vmtx);
+}
+
+
+static void
+dialog(int argc, char *argv[])
+{
+ if (--argc < 1)
+ usage();
+
+ strcpy(ttfname, *++argv);
+ add_suffix(ttfname, "ttf");
+
+ if (--argc < 1)
+ strcpy(dumpname, "-");
+ else
+ strcpy(dumpname, *++argv);
+}
+
+
+static void
+usage(void)
+{
+ fprintf(stderr, "Usage: ttfdump ttfname dumpname [options]\n");
+ exit(EXIT_FAILURE);
+}
+
+
+static void
+add_suffix(char *name, char *suffix)
+{
+ int haveext = 0;
+
+
+ if (name && strcmp(name, "-"))
+ {
+ while (*name)
+ {
+ if (*name == '/')
+ haveext = 0;
+ else if (*name == '.')
+ haveext = 1;
+ name++;
+ }
+ if (!haveext)
+ {
+ *name++ = '.';
+ strcpy(name, suffix);
+ }
+ }
+}
+
+
+/* end of ttfdump.c */
diff --git a/Build/source/texk/ttfdump/src/win32.mak b/Build/source/texk/ttfdump/src/win32.mak
new file mode 100644
index 00000000000..03f365a0168
--- /dev/null
+++ b/Build/source/texk/ttfdump/src/win32.mak
@@ -0,0 +1,55 @@
+################################################################################
+#
+# Makefile : TtfDump / Src
+# Author : Fabrice Popineau <Fabrice.Popineau@supelec.fr>
+# Platform : Win32, Microsoft VC++ 6.0, depends upon fpTeX 0.5 sources
+# Time-stamp: <01/11/28 09:07:08 popineau>
+#
+################################################################################
+root_srcdir = ..\..\..
+!ifdef DEVELOPMENT
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk.development
+!else
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk
+!endif
+
+# Makefile for ttfdump
+
+USE_GNUW32 = 1
+USE_KPATHSEA = 1
+
+!include <msvc/common.mak>
+
+DEFS = -I.. -I../include -I../libttf $(DEFS) -UKPSE_DLL
+
+manfiles = ..\docs\ttfdump.1
+objects = $(objdir)\ttfdump.obj
+libdump = ..\libttf\$(objdir)\libttf.lib
+program = $(objdir)\ttfdump.exe
+programs = $(program)
+
+default: all
+
+all: $(objdir) $(programs)
+
+$(program): $(libdump) $(objects) $(gnuw32lib)
+ $(link) $(**) $(conlibs)
+
+$(libdump):
+ pushd ..\libtff & $(make) all & popd
+
+!include <msvc/config.mak>
+!include <msvc/install.mak>
+
+install:: install-exec install-man
+
+!include <msvc/clean.mak>
+
+!include <msvc/rdepend.mak>
+!include "./depend.mak"
+
+#
+# Local variables:
+# page-delimiter: "^# \f"
+# mode: Makefile
+# End:
diff --git a/Build/source/texk/ttfdump/win32.mak b/Build/source/texk/ttfdump/win32.mak
new file mode 100644
index 00000000000..82152534225
--- /dev/null
+++ b/Build/source/texk/ttfdump/win32.mak
@@ -0,0 +1,31 @@
+################################################################################
+#
+# Makefile : TTFDump
+# Author : Fabrice Popineau <Fabrice.Popineau@supelec.fr>
+# Platform : Win32, Microsoft VC++ 6.0, depends upon fpTeX 0.5 sources
+# Time-stamp: <02/01/18 23:27:01 popineau>
+#
+################################################################################
+root_srcdir = ..\..
+!ifdef DEVELOPMENT
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk.development
+!else
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk
+!endif
+
+!include <msvc/common.mak>
+
+# Package subdirectories, the library, and all subdirectories.
+subdirs = libttf src
+
+default:: all
+
+all:: config.h
+
+!include <msvc/subdirs.mak>
+!include <msvc/config.mak>
+!include <msvc/clean.mak>
+
+# Local Variables:
+# mode: Makefile
+# End: