diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-17 21:41:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-17 21:41:51 +0000 |
commit | 487ca4806cc046076293cf6cc5fbba0db282bac7 (patch) | |
tree | 847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/dvipng | |
parent | a3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff) |
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipng')
43 files changed, 16693 insertions, 0 deletions
diff --git a/Build/source/texk/dvipng/COPYING b/Build/source/texk/dvipng/COPYING new file mode 100644 index 00000000000..d60c31a97a5 --- /dev/null +++ b/Build/source/texk/dvipng/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 + + 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) <year> <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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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) year 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/dvipng/ChangeLog b/Build/source/texk/dvipng/ChangeLog new file mode 100644 index 00000000000..ebb1afbb4e8 --- /dev/null +++ b/Build/source/texk/dvipng/ChangeLog @@ -0,0 +1,655 @@ +2005-06-27 Jan-Ake Larsson <jalar@mai.liu.se> + + * RELEASE: Report what fixes have been done + + * dvipng.texi: Document xcolor adaptations + + * misc.c: Add 'Transparent' in the quick-help + + * special.c: Cosmetics, do a _small_ message for bop-hook redef + +2005-06-16 Jan-Ake Larsson <jalar@mai.liu.se> + + * dvipng.h: + * dvipng.c: + * color.c: Revamp colorname interpreter for xcolor + +2005-06-14 Jan-Ake Larsson <jalar@mai.liu.se> + + * misc.c: Adjust MIKTeX stuff + +2005-06-13 Jan-Ake Larsson <jalar@mai.liu.se> + + * color.c: Don't use strtok, adjust for xcolor + + * special.c: Don't use strtok + +2005-04-25 Jan-Ake Larsson <jalar@mai.liu.se> + + * config.h.in: + * configure.ac: + * set.c: Don't do alpha blending in truecolor mode, write alpha + channel to file + +2005-04-20 Jan-Ake Larsson <jalar@mai.liu.se> + + * dvipng.texi: Add Credits + +2005-04-19 Jan-Ake Larsson <jalar@mai.liu.se> + + * dvipng.h: Fix for sys/types.h conflict in old IRIX systems + + * special.c: Adjust tightpage test + +2005-04-04 Jan-Ake Larsson <jalar@mai.liu.se> + + * special.c: Make tightpage option backwards compatible + + * RELEASE: Prepare for 1.6 + + * dvipng.1: Regenerate man page + + * configure.ac: + * dvipng.texi: + * miktex.h: Update version info + + * configure.ac: + * dvipng.texi: + * README: + * readme.texi: Update mailing list address + + * configure.ac: + * config.h.in: + * special.c: Simplify string search + +2005-04-03 Jan-Ake Larsson <jalar@mai.liu.se> + + * special.c: Try to detect all preview-latex versions tightpage + code + +2005-03-02 Jan-Ake Larsson <jalar@mai.liu.se> + + * set.c: Remove extra debug printout + + * t1.c: Sizes are given in big points in T1lib, in TeX points in + DVI files + + * ft.c: Sizes are given in big points in FreeType, in TeX points + in DVI files + + * dvipng.h: Fix boolean type again + +2005-02-10 Jan-Ake Larsson <jalar@mai.liu.se> + + * config.h.in: + * configure.ac: + * dvipng.texi: + * dvipng.h: + * misc.c: + * set.c: Add proper alpha channel + +2005-02-04 Jan-Ake Larsson <jalar@mai.liu.se> + + * color.c: + * draw.c: + * dvi.c: + * dvipng.c: + * font.c: + * ft.c: + * misc.c: + * papersiz.c: + * pk.c: + * set.c: + * special.c: + * t1.c: + * tfm.c: + * vf.c: Cosmetic changes to warnings and fatals + + * Release 1.5 + + * RELEASE: Prepare for 1.5 + + * INSTALL: + * Makefile.in: + * README: + * color.c: + * commands.h: + * configure.ac: + * draw.c: + * dvi.c: + * dvipng.1: + * dvipng.c: + * dvipng.h: + * dvipng.texi: + * enc.c: + * font.c: + * fontmap.c: + * ft.c: + * install.texi: + * macros.texi: + * miktex.h: + * misc.c: + * papersiz.c: + * pk.c: + * ppagelist.c: + * readme.texi: + * set.c: + * special.c: + * t1.c: + * test_dvipng.tex: + * tfm.c: + * vf.c: Update Copyright, set version 1.5 + +2005-02-03 Jan-Ake Larsson <jalar@mai.liu.se> + + * draw.c: + * dvipng.h: + * set.c: Fix bug in --picky mode + +2005-01-27 Jan-Ake Larsson <jalar@mai.liu.se> + + * dvipng.c: Restore --mfmode and --bdpi functionality + +2005-01-25 Jan-Ake Larsson <jalar@mai.liu.se> + + * color.c: Fix segfault when trying to find nonexisting dvipsnam + color + + * dvipng.c: Make dvipsnam colors available on command line + +2004-12-10 Jan-Ake Larsson <jalar@mai.liu.se> + + * Release 1.4 + + * RELEASE: + * configure.ac: + * dvipng.1: + * dvipng.texi: Set version 1.4 + + * README: Fix formatting + + * misc.c: Use mmap test. Hopefully, it will fail on ULTRIX, mmap + only works on character special devices (and not on regular files) + +2004-12-02 Jan-Ake Larsson <jalar@mai.liu.se> + + * config.h.in: + * configure.ac: + * dvipng.h: Move int64_t and uint64_t tests entirely to autoconf + + * dvi.c: Fix signedness + +2004-11-30 Jan-Ake Larsson <jalar@mai.liu.se> + + * misc.c: Fix NULL dereference. + +2004-11-25 Jan-Ake Larsson <jalar@mai.liu.se> + + * Release 1.3 + + * Makefile.in, README, dvipng.1, readme.texi: Fix dvigif + installation and docs + + * INSTALL: + * README: Add license + + * dvipng.c: Remove duplicate copyright + + * config.h.in: + * configure.ac: Add some tests + + * dvipng.1: + * dvipng.texi: Add some minor things + +2004-11-24 Jan-Ake Larsson <jalar@mai.liu.se> + + * config.h.in: + * configure.ac: Test for 64-bit types. + + * dvipng.h: Use char* arithmetic, not void*. And enable use of + gcc -ansi -pedantic. + + * special.c: Don't use C++ comments. + + * papersiz.c: Rewrite + + * draw.c: + * dvi.c: + * font.c: + * ft.c: + * misc.c: + * pk.c: + * tfm.c: + * vf.c: Fix signedness + +2004-11-15 Reiner Steib <Reiner.Steib@gmx.de> + + * draw.c, dvipng.c, enc.c, font.c, ft.c, pk.c, special.c, t1.c: + Don't use C++ comments. + +2004-11-05 David Kastrup <dakas@users.sourceforge.net> + + * Makefile.in (install-dvigif): Don't fail if dvigif already + exists. + +2004-11-02 Jan-Åke Larsson <jalar@mai.liu.se> + + * dvipng.h: Fix boolean type + +2004-11-01 Jan-Åke Larsson <jalar@mai.liu.se> + + * RELEASE: Update for 1.3 + + * dvipng.h: Load alloca.h when available + + * font.c: + * fontmap.c: Remove inline + + * Makefile.in: + * commands.h: + * config.h.in: + * configure.ac: + * install.texi: + * macros.texi: + * miktex.h: + * readme.texi: + * test_dvipng.tex: Add copyright notice + + * color.c: + * draw.c: + * dvi.c: + * dvipng.c: + * dvipng.h: + * enc.c: + * font.c: + * fontmap.c: + * ft.c: + * misc.c: + * papersiz.c: + * pk.c: + * ppagelist.c: + * set.c: + * special.c: + * t1.c: + * tfm.c: + * vf.c: Change c-in-a-circle to (C) + +2004-10-27 Jan-Åke Larsson <jalar@mai.liu.se> + + * dvipng.1: + * dvipng.texi: Amend docs + + * misc.c: Amend helptext + +2004-10-26 Jan-Åke Larsson <jalar@mai.liu.se> + + * set.c: + * misc.c: + * dvipng.h: Change background transparency + + * configure.ac: Bump version, add test for libz + +2004-10-07 Jan-Åke Larsson <jalar@mai.liu.se> + + * dvipng.texi: document change in -o switch + +2004-10-06 Jan-Åke Larsson <jalar@mai.liu.se> + + * set.c: Allow longer pagenumbers in output file (e.g., %06d) + +2004-08-18 Jan-Åke Larsson <jalar@mai.liu.se> + + * Release 1.2 + + * RELEASE: Change for 1.2 + + * config.h.in: Update + + * dvipng.1: change help text + + * dvipng.texi: update mailing list text. And version. + + * README: + * readme.texi: update info and todo list + + * draw.c, misc.c, dvipng.c, dvipng.h: + Add an intermediate exit status + +2004-08-17 Jan-Åke Larsson <jalar@mai.liu.se> + + * misc.c: add --gamma switch + + * special.c: Fix comment + + * set.c: + * dvipng.h: new Gamma function + + * configure.ac: libm is needed by new gamma code + + * dvipng.1: + * dvipng.texi: document new switches + + * draw.c: change name of picky flag + + * special.c: do not call ghostscript when switch given + + * misc.c: add picky and ghostscript switches + + * dvipng.h: add picky and ghostscript flags + +2004-08-06 Jan-Åke Larsson <jalar@mai.liu.se> + + * dvipng.texi: Document --png, --gif, and --picky + + * .cvsignore: Add *.gif + + * Makefile.in: Install 'dvigif' if we have GIF support + + * configure.ac: Test for gdImageGif and 'ln -s' + + * config.h.in: GIF support + + * set.c: GIF writing + + * misc.c: basename fixes, --png and --gif fixes, + --no-image-on-warn changes name to --picky + + * dvi.c: basename fixes + + * dvipng.h: Portability fixes, add GIF image flag + +2004-08-02 Jan-Åke Larsson <jalar@mai.liu.se> + + * draw.c: Fix behaviour of --no-image-on-warn + +2004-07-01 Jan-Åke Larsson <jalar@mai.liu.se> + + * miktex.mak: New, for MIKTeX + + * dvi.c: + * dvipng.c: + * dvipng.h: + * special.c: Adjust for MIKTeX + + * color.c: + * enc.c: + * font.c: + * fontmap.c: + * misc.c: + * pk.c: + * tfm.c: + * vf.c: Move file-mmapping to misc.c, adjust it for MIKTeX + +2004-06-29 Jan-Åke Larsson <jalar@mai.liu.se> + + * configure.ac: + * dvipng.h: inttypes.h not available on all platforms + + * special.c: Remove snprintf, not available on certain platforms + +2004-06-27 Jan-Åke Larsson <jalar@mai.liu.se> + + * dvipng.c: Fix case of missing font libs + + * fontmap.c: Remove debug printf + + * draw.c: Fix for case of absent font lib(s), correct typo + +2004-06-24 Jan-Åke Larsson <jalar@mai.liu.se> + + * fontmap.c: + * pk.c: + * vf.c: More memory fixes + +2004-06-21 Jan-Åke Larsson <jalar@mai.liu.se> + + * config.h.in: + * configure.ac: Test for stdbool, munmap and strtol + + * test_dvipng.tex: Change color test + + * dvipng.h: + * misc.c: + * ppagelist.c: Fix -r switch + + * dvipng.h: + * font.c: + * misc.c: + * ppagelist.c: + * special.c: + * t1.c: + * tfm.c: Use stdbool + + * color.c: + * dvi.c: + * dvipng.c: + * dvipng.h: + * enc.c: + * font.c: + * fontmap.c: + * ppagelist.c: + * special.c: Fix memory leak(s) + + * color.c: + * draw.c: + * dvi.c: + * dvipng.h: + * misc.c: + * set.c: + * special.c: Fix color stack + + * draw.c: + * dvipng.h: + * ft.c: + * pk.c: + * set.c: + * t1.c: + * tfm.c: + * vf.c: Simplify char structs + + * color.c: + * draw.c: + * dvi.c: + * dvipng.c: + * dvipng.h: + * enc.c: + * font.c: + * fontmap.c: + * ft.c: + * misc.c: + * papersiz.c: + * pk.c: + * ppagelist.c: + * set.c: + * special.c: + * t1.c: + * tfm.c: + * vf.c: Add copyright notice + +2004-05-31 Jan-Åke Larsson <jalar@mai.liu.se> + + * dvipng.1: + * configure.ac: + * RELEASE: + * INSTALL: Release 1.1 + +2004-05-26 Jan-Åke Larsson <jalar@mai.liu.se> + + * special.c: Handle source specials + + * test_dvipng.tex: Add failing special and color test + + * dvipng.c: Adjust coment about SELFAUTO... + + * dvi.c: Fix possible overflow + +2004-05-24 Jan-Åke Larsson <jalar@mai.liu.se> + + * misc.c: Remove -t, it is not implemented yet + + * dvipng.h: Undef malloc, if defined + +2004-05-18 Jan-Åke Larsson <jalar@mai.liu.se> + + * dvipng.texi: Fix build + +2004-05-14 Jan-Åke Larsson <jalar@mai.liu.se> + + * config.h.in: Use more tests + + * dvipng.1: Add documentation + + * dvipng.texi: Fix build. Revert to four-argument @node, my + makeinfo cannot handle the one-argument form (yet). + +2004-05-11 Jan-Åke Larsson <jalar@mai.liu.se> + + * configure.ac: More tests + +2004-05-09 Jan-Åke Larsson <jalar@mai.liu.se> + + * install.texi: T1lib docs + + * dvipng.1: + * dvipng.texi: Add documentation, and spellcheck + + * special.c: + * color.c: Make colors work again. + +2004-05-08 David Kastrup <dakas@users.sourceforge.net> + + * Create new ChangeLog for dvipng + +2004-05-05 Jan-Åke Larsson <jalar@mai.liu.se> + + * fontmap.c: Use both kpse_fontmap_format and + _dvips_header_ + + * enc.c: Use configure test + + * configure.ac: Add test for kpse_enc_format, reorder gd + and png tests + + * aclocal.m4: Add test for kpse_enc_format + + * special.c: More informative warnings + +2004-05-04 Jan-Åke Larsson <jalar@mai.liu.se> + + * enc.c: + Use the new kpathsea search format kpse_enc_format if available, + otherwise use kpse_tex_ps_header_format + + * fontmap.c: + Fix new kpathsea search type kpse_fontmap_format, use + kpse_dvips_config_format if not available + + * ft.c: Fix sizing + + * draw.c: Simplify LoadT1 call + + * t1.c: Shorten call, fix sizing + + * dvipng.h: Simplify char-storing structure + +2004-05-03 Jan-Åke Larsson <jalar@mai.liu.se> + + * fontmap.c, font.c, t1.c, ft.c: + Fix for ps fonts not in psfontmap + +2004-05-02 Jan-Åke Larsson <jalar@mai.liu.se> + + * Makefile.in: + * config.h.in: + * configure.ac: + * draw.c: + * dvipng.c: + * dvipng.h: + * enc.c: + * font.c: + * fontmap.c: + * ft.c: + * t1.c: + * misc.c: Add t1lib support + +2004-04-05 Jan-Åke Larsson <jalar@mai.liu.se> + + * dvipng.1: + * readme.texi: + * dvipng.texi: + * Makefile.in: Add man page + +2004-03-27 Jan-Åke Larsson <jalar@mai.liu.se> + + * dvipng.texi: Fix debug documentations + + * dvipng.c: Dont fail on --mode without --bdpi, output a warning. + +2004-03-26 Jan-Åke Larsson <jalar@mai.liu.se> + + * papersiz.c: Remove compiler warning + + * dvipng.texi: + * misc.c: Change year + +2004-03-25 Jan-Åke Larsson <jalar@mai.liu.se> + + * special.c: Revert change, not only resolution but also + offset is needed when generating png from ps + + * misc.c: Change helptext + + * configure.ac: Change version number + + * README: Checkin updated README + + * pk.c: + * ft.c: Speed up color cache + + * dvipng.texi: Add info on resolution, change version number + +2004-03-24 Jan-Åke Larsson <jalar@mai.liu.se> + + * special.c: Fix missing 'showpage' and a memory leak + + * font.c: Adjust error message + + * dvipng.h: + * ft.c: + * pk.c: Change ink darkness map + + * draw.c: Output page numbers more often. If the user has a + slow terminal he's to blame himself, not me. + + * tfm.c: Include alloca.h if present + +2004-03-23 Jan-Åke Larsson <jalar@mai.liu.se> + + * dvipng.texi: Adjust for the new -D option + +2004-03-19 dakas <dakas@users.sourceforge.net> + + * RELEASE: Remove spurious blanks. + +2004-03-19 Jan-Åke Larsson <jalar@mai.liu.se> + + * RELEASE: Update, shorten + +2004-03-18 Jan-Åke Larsson <jalar@mai.liu.se> + + * RELEASE: + * dvi.c: + * dvipng.c: + * dvipng.h: + * font.c: + * misc.c: + * papersiz.c: + * special.c: Change the behaviour of the -D switch + +2004-03-08 Jan-Åke Larsson <jalar@mai.liu.se> + + * font.c: Don't retry on PK generation failure + +2004-03-02 David Kastrup <dakas@users.sourceforge.net> + + * dvi.c (DVIOpen): Fix a buffer overrun error. diff --git a/Build/source/texk/dvipng/ChangeLog.0 b/Build/source/texk/dvipng/ChangeLog.0 new file mode 100644 index 00000000000..3c4689ad8c4 --- /dev/null +++ b/Build/source/texk/dvipng/ChangeLog.0 @@ -0,0 +1,903 @@ +2004-01-16 Jan-Åke Larsson <jalar@mai.liu.se> + + * font.c: fix compile without FT2 + +2004-01-12 Jan-Ake Larsson <jalar@mai.liu.se> + + * RELEASE: Prepare for 0.9 + + * misc.c: Enable --expand-bbox + + * color.c: + * draw.c: + * dvipng.h: + * font.c: + * misc.c: + * special.c: Enable --no-image-on-warn + + * draw.c: + * dvi.c: + * dvipng.c: + * dvipng.h: + * readme.texi: + * special.c: Fix tightpage behaviour + +2004-01-09 Jan-Ake Larsson <jalar@mai.liu.se> + + * special.c: Add preview-latex's "tightpage" code + +2004-01-08 Jan-Ake Larsson <jalar@mai.liu.se> + + * dvipng.texi: + * configure.ac: Prepare for 0.9 + + * Makefile.in: clean target + +2004-01-07 Jan-Ake Larsson <jalar@mai.liu.se> + + * color.c: + * draw.c: + * dvi.c: + * dvipng.c: + * dvipng.h: + * enc.c: + * font.c: + * fontmap.c: + * ft.c: + * pk.c: + * set.c: + * special.c: + * tfm.c: + * vf.c: Speedup DEBUG + + * pk.c: Fix subpixel offsets + + * dvipng.c: + * dvipng.h: + * font.c: + * misc.c: + * set.c: + * special.c: Fix flags + + * draw.c: Fix bbox + + * dvipng.h: Adjust for freetype >= 2.1.6 + +2003-12-15 Jan-Ake Larsson <jalar@mai.liu.se> + + * tfm.c: + * fontmap.c: + * font.c: Fix freeeeeeeeeing + +2003-12-08 Jan-Ake Larsson <jalar@mai.liu.se> + + * dvipng.texi: + * configure.ac: + * RELEASE: Prepare for 0.8 + + * ft.c: Fix debug output + + * draw.c: + * dvipng.h: + * dvipng.texi: + * misc.c: Add --height option + + * test_dvipng.tex: A nice equation is true. Behave! + +2003-12-07 Jan-Ake Larsson <jalar@mai.liu.se> + + * enc.c: Encodings are _ps_header_s + +2003-12-05 Jan-Åke Larsson <jalar@mai.liu.se> + + * misc.c: + * dvipng.texi: + * dvipng.h: + * draw.c: Change --baseline to --depth + +2003-12-01 Jan-Ake Larsson <jalar@mai.liu.se> + + * draw.c: + * dvipng.h: + * misc.c: Change to physical pagenumbers, instead of DVI + pagenumbers. DVI pagenumbers will be indicated on STDOUT if they + differ from physical pagenumbers, but the numbering of PNG files + is physical pagenumbers. Old behaviour can be chosen with the + option -dvinum. + + * ppagelist.c: + * misc.c: + * dvipng.texi: Make negative pages render. Now -pp handles + negative pages gracefully too. Remove -pp code taken from dvips. + +2003-11-30 Jan-Ake Larsson <jalar@mai.liu.se> + + * draw.c: + * dvipng.c: + * dvipng.h: + * font.c: + * ft.c: + * misc.c: + * pk.c: + * set.c: + * tfm.c: + * vf.c: Include alloca.h when necessary, start preparing + transition to subpixel rendering, do proper cleanup on exit + +2003-11-18 Jan-Åke Larsson <jalar@mai.liu.se> + + * enc.c: Fix bug + + * ft.c: + * tfm.c: + * font.c: + * dvipng.h: Add fallback from FT to PK + +2003-11-14 Jan-Åke Larsson <jalar@mai.liu.se> + + * Makefile.in: Use $DESTDIR + +2003-11-06 Jan-Åke Larsson <jalar@mai.liu.se> + + * special.c: Fix postscript inclusion: placement and + background color + +2003-10-17 Jan-Åke Larsson <jalar@mai.liu.se> + + * misc.c: + * font.c: + * dvipng.texi: + * dvipng.h: Add option for freetype activation + + * configure.ac: Add message when freetype is present + + * ft.c: Apparently FreeType hinting is a no-no. Load glyphs + with FT_LOAD_NO_HINTING. Only then output is acceptable. + +2003-10-15 Jan-Åke Larsson <jalar@mai.liu.se> + + * fontmap.c: Remove erroneous match + +2003-10-13 Jan-Åke Larsson <jalar@mai.liu.se> + + * font.c: Fix font searching order + + * RELEASE: Prepare for 0.7 + + * fontmap.c: + * psfontmap.c: + * configure.ac: Rename psfontmap.c to fontmap.c + +2003-10-08 Jan-Ake Larsson <jalar@mai.liu.se> + + * psfontmap.c: Add third bare word: encoding + +2003-10-07 Jan-Ake Larsson <jalar@mai.liu.se> + + * misc.c: + * dvipng.texi: Allow for -- on options + + * configure.ac: Prepare for 0.7 + + * Makefile.in: Adjust hint + + * configure.ac: + * config.h.in: Fix helptext in config.h.in + + * test_dvipng.tex: Add some tests for ligatures and sizes + +2003-10-03 Jan-Åke Larsson <jalar@mai.liu.se> + + * readme.texi: Document new font support and switches + + * psfontmap.c: Redesign psfontmap loading to use the syntax + from dvips' docs + + * font.c: Enhance TrueType font finding + + * draw.c: Warn if setting char from null font + + * dvipng.h: + * color.c: Load and use psnames.def + +2003-09-28 Jan-Ake Larsson <jalar@mai.liu.se> + + * misc.c: Warn for all bad options + +2003-09-24 Jan-Ake Larsson <jalar@mai.liu.se> + + * dvipng.texi: + * install.texi: + * misc.c: Fix documentation + +2003-09-23 Jan-Ake Larsson <jalar@mai.liu.se> + + * ft.c: + * enc.c: + * dvipng.h: Only load encodings once + +2003-09-18 Jan-Åke Larsson <jalar@mai.liu.se> + + * draw.c: + * dvipng.h: + * misc.c: Add -baseline switch + +2003-09-17 Jan-Ake Larsson <jalar@mai.liu.se> + + * font.c: Remove compiler warning + + * config.h.in: + * psfontmap.c: + * dvipng.c: + * configure.ac: Fix SELFAUTO... variables if dvipng is not + being installed in main texmf tree. This will make it find config + files and fonts anyway. + +2003-09-16 Jan-Ake Larsson <jalar@mai.liu.se> + + * tfm.c: + * psfontmap.c: + * ft.c: + * enc.c: Added for postscript font handling with freetype + + * font.c: Use freetype font loading + + * dvipng.h: Add freetype-related types and declarations, + and simplify glyph rendering + + * pk.c: Simplify glyph rendering + + * dvipng.c: Init freetype + + * dvi.c: Fix strlen bugs + + * draw.c: Add FONT_TYPE_FT drawing + + * configure.ac: + * config.h.in: + * Makefile.in: Adjust for freetype things + +2003-08-29 Jan-Åke Larsson <jalar@mai.liu.se> + + * special.c: fix color handling + + * dvipng.c: Increase TIMING output + + * misc.c: + * draw.c: small speedups + + * dvipng.h: + * configure.ac: + * config.h.in: + * Makefile.in: Change handling of the DEBUG and TIMING + flags + +2003-08-26 Jan-Åke Larsson <jalar@mai.liu.se> + + * RELEASE, dvipng.texi, configure.ac: + prepare for 0.6 + + * Makefile.in: another install-docs fix + +2003-08-13 Jan-Åke Larsson <jalar@mai.liu.se> + + * configure.ac: new test (ps inclusion speedup) + + * draw.c: simplify preprocessor processing, fix SetSpecial + call + + * special.c: speedup for ps image inclusion, fix SetSpecial + call + + * Makefile.in: fix install-docs + +2003-08-04 Jan-Åke Larsson <jalar@mai.liu.se> + + * special.c: Argh!, fix compilation for non-truecolor version + + * dvipng.h: Argh!, fix image cache + + * dvipng.texi: + * configure.ac: + * RELEASE: Prepare for 0.5 + + * misc.c: + * dvipng.h: + * set.c: Add preliminary truecolor support + + * pk.c: Benchmark truecolor rendering, no real code change + + * special.c: + * misc.c: + * dvipng.h: Add preliminary image cacheing + + * draw.c: Small adjustments + +2003-07-30 Jan-Åke Larsson <jalar@mai.liu.se> + + * draw.c: Fix two bugs so that bounding box again is + correct + + * configure.ac: configuration printout improved + + +2003-07-02 Jan-Åke Larsson <jalar@mai.liu.se> + + * dvipng.h: Add prototypes + + * draw.c: minor change + + * RELEASE: prepare for 0.4 + +2003-07-01 Jan-Åke Larsson <jalar@mai.liu.se> + + * draw.c, set.c: + Fix rules (again), this time taking maxdrift into account. + + * pk.c: Unfortunately gdImageColorResolveAlpha only works + on truecolor images. Some other day, then. I did fix the + performance of PROPER_OVERSTRIKE, though. + + * readme.texi: Add todo + +2003-06-30 Jan-Åke Larsson <jalar@mai.liu.se> + + * dvipng.texi: small fixes + + * vf.c: Speedup macro start/end + + * set.c: Handle offset in draw.c only, allow choice of + compression if gd can do this + + * pk.c: Handle overstrike, either with gd alpha level, if + support exists for that, or "manually". The latter is active if + PROPER_OVERSTRIKE is #defined, currently yes, at roughly 5% + performance loss. + + * misc.c: -z option: choose compression if gd can do this + + * dvipng.h: Proper rounding, gd bells and whistles + + * draw.c: Allow drift a la dvitype, maxdrift=1, handle + offset here only, speedup vf macro start/end + + * config.h.in: + * configure.ac: New tests for gd bells and whistles + + * Makefile.in: Clean README + + * .cvsignore: More files + +2003-06-23 Jan-Åke Larsson <jalar@mai.liu.se> + + * configure.ac: + * config.h.in: Added tests for newly added C code + + * Makefile.in: + * dvipng.texi: Reflect move of readme + + * README: + * readme.texi: Moved from README to readme.texi + +2003-06-19 Jan-Åke Larsson <jalar@mai.liu.se> + + * special.c: Fix crash on file not found + + * set.c: Code reformatting + + * misc.c: Fix switches, and send warnings/errors to stderr. + + * vf.c: + * pk.c: + * draw.c: Include header only used in this file, here. + + * commands.h: Make draw.c compile without -DDEBUG + + * Makefile.in: Use --disable-debug, fix docs + generation/install, and add 'test' target. + + * README: Update info + + * configure.ac: Add --disable-debug + + * install.texi: Minor changes + + * dvipng.texi: Document difference between -pp and -p + -l + + * dvipng.h: Fix FreeBSD non-C99 header issue + +2003-06-12 Jan-Åke Larsson <jalar@mai.liu.se> + + * Makefile.in: Fix SunOS make suffix rule wierdness + + * color.c: Change comment + + * dvi.c (DVIOpen): bugfix ".dvi" completion + + * dvipng.h (PIXROUND): Round down instead of up, SetRule + now has its own rounding mechanism + + * set.c (SetRule): Refine rule drawing, make sure rule is + inside bounding box + +2003-06-10 Jan-Åke Larsson <jalar@mai.liu.se> + + * README: + * RELEASE: + * Makefile.in: + * configure.ac: + * dvipng.texi: Prepare for 0.3 + + * vf.c: + * set.c: + * pk.c: + * font.c: + * dvi.c: + * draw.c: simplify DEBUG_PRINT + + * configure.ac: Look for gs + + * special.c: Fixes to gs interaction + + * set.c: Enable -o for output file, no segfault on empty + image, reposition rule to match dvips + + * draw.c: simplify DEBUG_PRINT macro + + * dvi.c: + * misc.c: Enable -o for output file + + * dvipng.h: Enable -o for output file, simplify DEBUG_PRINT + macro + +2003-04-17 Jan-Ake Larsson <jalar@mai.liu.se> + + * install.texi: + * dvipng.texi: Rewrite stuff + + * dvipng.h: New debug flag + + * configure.ac: + * config.h.in: Configure GS_PATH + + * special.c: No tempfiles anymore. Communicate with child + through two pipes. + + * configure.ac: + * Makefile.in: Make docs + +2003-04-15 Jan-Åke Larsson <jalar@mai.liu.se> + + * macros.texi: Added + + * install.texi, dvipng.texi: Initial version + +2003-03-28 Jan-Åke Larsson <jalar@mai.liu.se> + + * README: + * RELEASE: Release 0.2, PostScript type1 font support and + PostScript inclusion. + + * configure.ac: Added configure error message about where + to find libgd. + + * dvipng.h: + * draw.c (DrawCommand): + * special.c (SetSpecial): Postscript inclusion now works. + + * misc.c (DecodeArgs): Fix --help message + + * COPYING: + * RELEASE: + * README: Added files to repository + +2003-03-12 Jan-Åke Larsson <jalar@mai.liu.se> + + * dvi.c (DVIFollowToggle): + * misc.c (DecodeArgs): + * dvipng.h: Added '-follow' switch, and code that + implements a follow mode. + +2003-02-27 Jan-Åke Larsson <jalar@mai.liu.se> + + * draw.c (DrawPages): + * misc.c (Message): Speed up slightly when not in DEBUG + mode. + + * misc.c (DecodeArgs): Adjust copyright notice. + + * set.c (SetRule): Reposition rules, one dot up. + +2003-01-30 Jan-Åke Larsson <jalar@mai.liu.se> + + * Makefile.in: + * configure.ac: Fix includes and linking + + * draw.c: + * font.c: + * pk.c: + * vf.c: + * dvipng.h (font_entry): remove unnamed union + + * dvipng.h: simplify includes + +2003-01-15 Jan-Ake Larsson <jalar@mai.liu.se> + + * misc.c: Use autoconf's stuff, use atoi, fix warning + message + + * dvipng.c: + * dvipng.h: Localize position and spacing to draw.c. Fix + timing + + * pk.c: + * set.c: + * special.c: + * vf.c: + * draw.c: Localize position and spacing to draw.c + + * configure.ac: Require gd and kpathsea + +2002-12-03 Jan-Ake Larsson <jalar@mai.liu.se> + + * draw.c: unfinished change: repairing + + * draw.c: + * font.c: + * vf.c: use void* in function call + + * dvipng.h: + * draw.c: + * color.c: + * set.c: change names of some functions + + * dvipng.h: + * draw.c: + * dvi.c: + * ppagelist.c: make dvi data more local + + * .cvsignore: + * dvipng.h: + * special.c: + * font.c: + * misc.c: + * dvipng.c: + * configure.ac: + * config.h.in: + * Makefile.in: autoconfiscate + +2002-11-07 Jan-Ake Larsson <jalar@mai.liu.se> + + * dvipng.h: + * dvipng.c (main): + * dvi.c (DVIReOpen): Don't re-init, re-open + +2002-10-31 Jan-Ake Larsson <jalar@mai.liu.se> + + * dvipng.h: + * dvi.c: Remove globals and Reopen DVI on change (check + mtime) + + * dvipng.c: Reopen DVI on change (check mtime) + +2002-10-30 Jan-Ake Larsson <jalar@mai.liu.se> + + * pk.c: Declaration moved here from dvipng.h + + * Makefile: No io.c, no pagequeue.c but ppagelist.c + + * dvipng.h: Rearranged, some new declarations + + * dvipng.c (main): minor changes + + * draw.c (DoPages): use new page-finding mechanisms + + * dvi.c: outfilename handling fixed, page-finding + mechanisms added. + + * misc.c: Ppagelist handling improved, outfilename now + works, added functionality from io.c + + * ppagelist.c: Added. Functionality slightly different from + pagequeue.c + + * pagequeue.c: Revamped. Functionality changed and moved to + ppagelist.c + + * io.c: Removed. Functionality in misc.c + + * .cvsignore: Additions + +2002-10-24 Jan-Ake Larsson <jalar@mai.liu.se> + + * dvipng.c (main): + * dvipng.h: + * misc.c (DecodeString): Improve stdin parser + +2002-10-21 Jan-Ake Larsson <jalar@mai.liu.se> + + * dvipng.h: Remove globals, fix message output + + * vf.c (SetVF, InitVF), + * font.c (FontDef), + * draw.c (DrawCommand): Bugfix VF handling, fix message + output + + * pk.c (SetPK, InitPK), + * dvi.c (DVIOpen): Fix message output + + * papersiz.c: use int32_t, fix overflow + + * misc.c (DecodeArgs, Message): Fix -d option, remove + globals, fix message output + +2002-10-16 Jan-Ake Larsson <jalar@mai.liu.se> + + * dvipng.h: Remove globals + + * dvipng.c (main): Remove globals, improve stdin parser + + * misc.c (DecodeArgs): remove globals, fix helptext + + * pagequeue.c (FindQdPage, QueuePage, QueueParse): + remove globals + + * dvi.c (FindPage): Remove unnecessary test + + * draw.c (DoPages): Do more normal read-ahead + +2002-10-15 Jan-Ake Larsson <jalar@mai.liu.se> + + * pk.c, font.c: Minor change + + * misc.c: Simplify, remove (some) globals, fix helptext + + * pagequeue.c, dvipng.h, dvipng.c, + dvi.c, draw.c: Simplify, remove (some) globals + +2002-10-14 Jan-Ake Larsson <jalar@mai.liu.se> + + * misc.c, dvipng.h, draw.c: + Added '-T tight' switch + +2002-10-11 Angus Leeming <leeming@lyx.org> + + * draw.c: + * dvi.c: + * dvipng.[ch]: + * font.c: + * io.c: + * misc.c: + * pagequeue.c: + * papersiz.c: + * pk.c: + * set.c: + * special.c: + * vf.c: remove function prototype macros. + + * dvi.c (DVIGetCommand, CommandLength): + * set.c (SetChar): add a 'break' to the end of the switch + statements (prevents a warning with gcc 3.2). + +2002-10-11 Jan-Ake Larsson <jalar@mai.liu.se> + + * special.c: Fix DEBUG, prototypes, and code pruning + + * vf.c, set.c, pk.c, io.c, + font.c, draw.c: Fix DEBUG + + * misc.c, dvi.c, pagequeue.c, + dvipng.h, dvipng.c: Fix pagelist and DEBUG + + +2002-09-20 Jan-Ake Larsson <jalar@imf.au.dk> + + * dvipng.h: change font structures, add dvi struct, remove old + global variables, include relevant bits of config.h, restructure + somewhat + + * dvipng.c: remove explicit vf stack + + * special.c: use dvi struct + + * misc.c: minor changes + + * io.c: close file descriptors, not FILE pointers. + + * draw.c: simplify, remove explicit vf stack. + + * set.c: use dvi struct, remove explicit dvi stack. + + * vf.c: use mmap, remove explicit vf stack. + + * pk.c: use mmap + + * font.c: enable dvi struct, prepare for mmap (file descriptors, + not FILE pointers), explicit vf stack removed. + + * dvi.c: use dvi struct + + * Makefile: config.h removed + + * config.h, klibtool, klibtool.config: removed. + +2002-08-30 Jan-Ake Larsson <jalar@imf.au.dk> + + * dvi.c: fix bug in STRSIZE zap + + * vf.c: simplify, fix debug info, zap STRSIZE limit + + * misc.c: Fix background transparency + + * dvipng.h, draw.c: Fix FormFeed bug (outfilename + wrong) + + * set.c: Fix FormFeed bug (outfilename wrong), and background + transparency + +2002-08-29 Jan-Ake Larsson <jalar@imf.au.dk> + + * dvipng.h: type changes, dvi-io abstraction + + * color.c: comment changed + + * dvipng.c: dvi-io abstraction + + * font.c: type changes, STRSIZE killed + + * io.c: ReadCommand and CommandLength moved to dvi.c, preparations + for mmap + + * set.c: type changes + + * vf.c, pk.c: prepare for mmap, type changes + + * pagequeue.c: type change + + * misc.c: dvi fopen moved to dvi.c, type changes + + * Makefile: pagelist.o gone, dvi.o new + + * draw.c: SetVF moved to vf.c, type and dvi-io abstraction + changes + + * commands.h: added length and debug texts + + * dvi.c: Functionality moved from pagelist.c and misc.c to + dvi.c. Still needs work, but is initial stab at proper abstraction + of dvi-reading stuff. STRSIZE killed. + + * pagelist.c: Functionality moved to dvi.c + + * special.c: DoSpecial now takes a const char* argument, as + opposed to before. + +2002-08-19 Jan-Ake Larsson <jalar@imf.au.dk> + + * misc.c: Added -mode switch + +2002-08-14 Jan-Ake Larsson <jalar@imf.au.dk> + + * dvipng.h: VF additions, general cleanup + + * dvipng.c: Small adjustments connected to the VF support + + * config.h: Remove unnecessary things + + * pagelist.c: Simplifications + + * color.c: Comment changed + + * special.c, set.c: Scale always equal h/v + + * Makefile: Make vf.o + + * io.c: Start pre-conversion to mmap. Much still to be done. + + * misc.c, set.c, font.c, pk.c, draw.c: Adjust for VF support + + * vf.c: VF support added to dvipng + +2002-06-24 Jan-Ake Larsson <jalar@imf.au.dk> + + * Makefile: Cleaned. Vacuumed, in fact. + +2002-06-19 Jan-Ake Larsson <jalar@imf.au.dk> + + * pagelist.c: remove Debug bug (!) + +2002-06-13 Jan-Ake Larsson <jalar@imf.au.dk> + + * Makefile: new object files + + * special.c, set.c, dvipng.h: cleanup + + * misc.c (ActualFactor): moved to font.c + cleanup + + * font.c (ActualFactor): moved here from misc.c + + * draw.c, dvipng.c, pagelist.c: functionality from dvipng.c spread + to these three + + * pagequeue.c, pages.c: functionality moved from pages.c to + pagequeue.c + + * commands.h: minor adjustments + +2002-06-12 Jan-Ake Larsson <jalar@imf.au.dk> + + * special.c: on unimplemented \special, give pixel position + + * misc.c: Bugfix + literal response on stdin interface + + * font.c, dvipng.h: Font handling fixed + + * dvipng.c: prompt on stdin interface + +2002-06-11 Jan-Ake Larsson <jalar@imf.au.dk> + + * set.c (SetChar): load chars on PASS_DRAW <sigh> + -T -O bug fixed + +2002-06-11 Jan-Ake Larsson <jalar@imf.au.dk> + + * set.c: Cleanup. Still buggy wrt -O, though. + + * Makefile: DEBUG on for now, postamble.? removed + + * postamble.c: Postamble is no longer read + + * pages.c: Improve page handling: now a queue, not an unordered + set + + * font.c: Improve font handling: search for fonts only when used + + * dvipng.h: Cleanup + + * dvipng.c: Major rewrite: page handling improved + + * misc.c: Fix DVI init + cleanup + +2002-05-30 Jan-Ake Larsson <jalar@imf.au.dk> + + * misc.c: Transparent border: '-bd' + + * dvipng.h, set.c: Tiding up + transparent border + + * dvipng.c, font.c: Tidying up + +2002-05-29 Jan-Ake Larsson <jalar@imf.au.dk> + + * color.c: Fix cmyk->rgb. + + * misc.c: Add '-fg' and '-bg'. + + * font.c: Tidy up + +2002-05-29 Jan-Ake Larsson <jalar@imf.au.dk> + + * dvipng.h: Tidying up, and new global vars + + * io.c: Tidying up + + * papersiz.c: Pagesize matters, adapted from dvips + + * pages.c: Page choosing, from dvips. Not sufficient for our + purposes, but a start + + * dvipng.c, color.c, Makefile, misc.c, set.c: Changed to make + pagesize (-T), offset (-O), page choosing (-pp), and output file + (-o) work. + +2002-05-27 Jan-Ake Larsson <jalar@imf.au.dk> + + * pk.c: Changed comments + + * .cvsignore, special.c, set.c, postamble.c, pk.c, misc.c, io.c, + font.c, dvipng.c, color.c, commands.h, dvipng.h: Initial version + + * config.h, Makefile: Initial version, to be replaced by + autoconf'ism + + * klibtool.config, klibtool: Included for now. To be + removed. diff --git a/Build/source/texk/dvipng/INSTALL b/Build/source/texk/dvipng/INSTALL new file mode 100644 index 00000000000..2fd46254d2e --- /dev/null +++ b/Build/source/texk/dvipng/INSTALL @@ -0,0 +1,153 @@ +Installing dvipng +***************** + +Installing dvipng should be simple: merely `./configure', `make', and +`make install'. + +Prerequisites +============= + + * The GD Graphics Draw library, libgd + + The drawing library `libgd' is necessary, and is downloadable at + `http://www.boutell.com/gd', and there are binary packages for + most operating systems from their respective distributors. In any + case, the latest version of the library installs using `autoconf' + so it should not be difficult for you to install it from source, + and then proceed with installing dvipng. + + * The path-searching library kpathsea + + Kpathsea is most likely included in your LaTeX installation, but it + may happen that ./configure does not find it; see below. If you do + not have it, download it from `http://www.ctan.org' and compile it. + I have no experience with this, so I cannot help much here. + + * FreeType 2 and/or T1lib + + While not strictly necessary, you may want to have FreeType 2 or + T1lib available. Their presence will enable direct support for + PostScript fonts in dvipng, rather than using `gsftopk' for + rendering the fonts. If you have PostScript versons of Computer + Modern installed, there will be no need to generate bitmapped + variants on disk of these. Then, you can render images at + different (and unusual) resolutions without cluttering the disk + with lots of bitmapped fonts. If both FreeType 2 and T1lib are + present, FreeType will be internally preferred by dvipng, but + T1lib can be chosen at runtime. + + * libpng and libz + + To be able to compress and write PNG files to disk, dvipng (or + really libgd) uses libpng which in turn uses libz. These should be + available on any modern system, if not, download them and install + them. + + * The `texinfo' package + + This is needed for building the documentation. + +Configure +========= + + The first step is to configure the source code, telling it where +various files will be. To do so, run + + ./configure OPTIONS + + (Note: if you have fetched dvipng from CVS rather than a regular +release, you will have to first generate `./configure' by running +`autoconf' 2.53 or later in the `preview' directory.) + + On many machines, you will not need to specify any options, but if +`configure' cannot determine something on its own, you'll need to help +it out. For a list of the options type + + ./configure --help + + On some machines, the libraries will be installed in directories that +are not in the linker's search path. This will generate an error when +running `./configure', indicating that it cannot find libgd or +libkpathsea (most likely). You then need to specify the path to the +respective library's object files. They are typically called e.g., +`libgd.a' or `libgd.so'. If they are located in e.g., `/sw/local/lib', +do + + ./configure LDFLAGS=-L/sw/local/lib + + If the library is available as a shared object file (`.so'), the +runtime linker may also need to be told where to find the library, then +use + + ./configure LDFLAGS='-L/sw/local/lib -R/sw/local/lib' + + When either of these is necessary, it is likely that the C header +files are also installed in directories that are not in the C +preprocessor's search path. This will also generate an error when +running `./configure', indicating that it cannot find e.g., `gd.h' or +`kpathsea.h' (most likely). You then need to specify the path to the +respective library's C header files. If they are located in e.g., +`/sw/local/include', do + + ./configure CPPFLAGS=-I/sw/local/include + + On my SUN Solaris workstation, I had to combine this into + + ./configure CPPFLAGS='-I/sw/local/include -I/sw/tex/teTeX/1.0/include'\ + LDFLAGS='-L/sw/local/lib -R/sw/local/lib -L/sw/tex/teTeX/1.0/lib/' + +where the backslash denotes a continuation of the line. + +Build/install +============= + + Once `configure' has been run, simply enter + + make + +at the prompt to compile the C code, and build the documentation files. +To install the files into the locations chosen earlier, type + + make install + +You may need special privileges to install, e.g., if you are installing +into system directories. + +Installation outside the texmf tree +=================================== + + In some cases, a dvipng binary installed outside the texmf tree will +not be able to find virtual fonts, or the PostScript font maps +(normally used by dvips). This may be because *only* $SELFAUTOLOC, +$SELFAUTODIR, and $SELFAUTOPARENT are used in the texmf tree +configuration file `texmf.cnf'. If so, give the switch +`--enable-selfauto-set' to `./configure'. This will make dvipng adjust +these three internally so that kpathsea thinks that dvipng *is* +installed in the texmf tree. + +Installation for non-privileged users +===================================== + + Often people without system administration privileges want to install +software for their private use. In that case you need to specify more +options to the `configure' script, usually this is done by using the +`--prefix' option to the `configure' script, and let it point to the +personal home directory. In that way, resulting binaries will be +installed under the `bin' subdirectory of your home directory, manual +pages under `man' and so on. That way, it is reasonably easy to +maintain a bunch of additional packages, since the prefix argument is +supported by most `configure' scripts. + + You'll have to add something like `/home/myself/bin' to your `PATH' +shell variable, if it isn't there already, and similarly set the +`INFOPATH' variable to be able to access the documentation. + +Copying +======= + + This program is released under the GNU General Public License, see +the COPYING file in the dvipng distribution or +`http://www.gnu.org/licenses/gpl.html'. + + Copyright (C) 2002-2005 Jan-AAke Larsson + diff --git a/Build/source/texk/dvipng/Makefile.in b/Build/source/texk/dvipng/Makefile.in new file mode 100644 index 00000000000..213891cb9e5 --- /dev/null +++ b/Build/source/texk/dvipng/Makefile.in @@ -0,0 +1,114 @@ +# Thomas Esser, for teTeX. All settings here are my fault, don't blame +# the dvipng maintainers for it. + +kpse_include ../make/paths.mk +kpse_include ../make/common.mk +kpse_include ../make/programs.mk +kpse_include ../make/cross.mk + +ZLIBDIR = ../../libs/zlib +ZLIBSRCDIR = $(srcdir)/$(ZLIBDIR) +ZLIBDEP = @ZLIBDEP@ +LDZLIB = @LDZLIB@ + +LIBPNGDIR = ../../libs/libpng +LIBPNGSRCDIR = $(srcdir)/$(LIBPNGDIR) +LIBPNGDEP = @LIBPNGDEP@ +LDLIBPNG = @LDLIBPNG@ + +GDDIR = ../../libs/gd +GDSRCDIR = $(srcdir)/$(GDDIR) +GDDEP = @GDDEP@ +LDGD = @LDGD@ + +LDLIBT1=@LDLIBT1@ +LIBT1CPPFLAGS=@LIBT1CPPFLAGS@ +LIBT1DEP=@LIBT1DEP@ +LIBT1DIR = ../../libs/t1lib +LIBTYPE1DIR = $(LIBT1DIR)/../type1 +LIBT1SRCDIR = $(srcdir)/$(LIBT1DIR) + +LD_ALL_LIBS = $(LDGD) $(LDLIBT1) $(LDLIBPNG) $(LDZLIB) +ALL_LIBS_DEP = $(ZLIBDEP) $(LIBPNGDEP) $(GDDEP) $(LIBT1DEP) + +program = dvipng +programs = $(program) +default all: $(programs) + +prog_cflags = -DHAVE_KPSE_ENC_FORMATS -DHAVE_PNG_H \ + -DHAVE_T1LIB_H -DHAVE_LIBKPATHSEA -DHAVE_LIBT1 -DHAVE_GD_H \ + -DHAVE_LIBGD -DHAVE_GDIMAGEPNGEX -DHAVE_GDIMAGECREATETRUECOLOR \ + -DHAVE_GDIMAGETRUECOLORTOPALETTE @LIBPNGCPPFLAGS@ @ZLIBCPPFLAGS@ \ + -DDEBUG=1 -DHAVE_GDIMAGEGIF \ + $(LIBT1CPPFLAGS) @GDCPPFLAGS@ + +objects=dvipng.o color.o draw.o dvi.o font.o misc.o pk.o \ + set.o special.o papersiz.o ppagelist.o \ + vf.o @PSFONTS_O@ +$(program): $(objects) $(kpathsea) $(ALL_LIBS_DEP) + $(kpathsea_link) $(objects) $(LD_ALL_LIBS) $(LOADLIBES) + +$(LIBPNGDIR)/libpng.a: + cd $(LIBPNGDIR); $(MAKE) + +$(ZLIBDIR)/libz.a: + cd $(ZLIBDIR); $(MAKE) + +$(GDDIR)/libgd.a: + cd $(GDDIR); $(MAKE) + +$(LIBT1DIR)/libt1.a: + cd $(LIBT1DIR); $(MAKE) $(makeargs) libt1.a + +$(LIBTYPE1DIR)/libtype1.a: + cd $(LIBTYPE1DIR); $(MAKE) $(makeargs) libtype1.a + +dvipng.help: dvipng + -./dvipng > dvipng.tmp + (test -r $(srcdir)/dvipng.help \ + && diff dvipng.tmp $(srcdir)/dvipng.help) \ + || cp dvipng.tmp $(srcdir)/dvipng.help + rm -f dvipng.tmp + + +install: install-exec install-data +uninstall: uninstall-exec uninstall-data + +distclean:: + $(RM) config.h + +install-exec: + $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) + $(INSTALL_LIBTOOL_PROG) $(program) $(bindir) + (cd $(bindir) && rm -f dvigif && ln -s $(program) dvigif) + +uninstall-exec: + cd $(bindir); rm -f $(programs) + +install-data: + $(SHELL) $(top_srcdir)/../mkinstalldirs $(man1dir) $(infodir) + $(INSTALL_DATA) $(srcdir)/$(program).1 $(man1dir)/$(program).$(manext) + cd $(srcdir) && for i in $(program).i*; do \ + $(INSTALL_DATA) $$i $(infodir)/$$i; done + $(POST_INSTALL) + if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \ + install-info --info-dir=$(infodir) $(infodir)/$(program).info; \ + else true; fi + +uninstall-data: + $(PRE_UNINSTALL) + if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \ + install-info --delete --info-dir=$(infodir) $(infodir)/$(program).info ; \ + else true; fi + $(NORMAL_UNINSTALL) + rm -f $(man1dir)/dvipng.$(manext) + rm -f $(infodir)/$(program).i* + +kpse_include ../make/config.mk + +info dvi check: + +kpse_include ../make/clean.mk +kpse_include ../make/tkpathsea.mk +kpse_include ../make/rdepend.mk +kpse_include depend.mk diff --git a/Build/source/texk/dvipng/README b/Build/source/texk/dvipng/README new file mode 100644 index 00000000000..55ec5e55329 --- /dev/null +++ b/Build/source/texk/dvipng/README @@ -0,0 +1,114 @@ +dvipng +****** + +This program makes PNG and/or GIF graphics from DVI files as obtained +from TeX and its relatives. + + If GIF support is enabled, GIF output is chosen by using the +`dvigif' binary or with the `--gif' option. + + It is intended to produce anti-aliased screen-resolution images as +fast as is possible. The target audience is people who need to generate +and regenerate many images again and again. The primary target is the +preview-latex (X)Emacs package, a package to preview formulas from +within (X)Emacs. Yes, you get to see your formulas in the (X)Emacs +buffer, see `http://preview-latex.sf.net'. + + Another example is WeBWorK, an internet-based method for delivering +homework problems to students over the internet, giving students +instant feedback as to whether or not their answers are correct, see +`http://webwork.math.rochester.edu'. + + Other applications may also benefit, like web applications as +latex2html and WYSIWYG editors like LyX. + +Benefits of dvipng +================== + + The benefits of `dvipng'/`dvigif' include + + * Speed. It is a very fast bitmap-rendering code for DVI files. On a + fairly low-end laptop, it takes less than a second to generate 150 + one-formula images. This makes dvipng suitable for generating large + amounts of images on-the-fly, as needed in preview-latex, WeBWorK + and others. + + * It does not read the postamble, so it can be started before TeX + finishes. There is a -follow switch that makes dvipng wait at EOF + for further output, unless it finds the POST marker that indicates + the end of the DVI. + + * Interactive query of options. dvipng can read options interactively + through stdin, and all options are usable. It is even possible to + change the input file through this interface. + + * Supports PK, VF, PostScript Type1, and TrueType fonts, color + specials and simple PostScript inclusion specials. + + * and more... + +Installation +============ + + Read `INSTALL', included in the distribution. + +Usage +===== + + To use dvipng at its simplest, simply type + + dvipng foo + +where `foo.dvi' is the output of TeX that you want to convert to PNG +format. If there are four pages in `foo.dvi', those pages will be +output as `foo1.png', `foo2.png', `foo3.png', and `foo4.png', +respectively. + + Many options are available (see the info manual). For a brief +summary of available options, just type + + dvipng --help + +Availability +============ + + The dvipng package is available at Savannah, from the project page of +dvipng `http://savannah.nongnu.org/projects/dvipng'. Instructions for +anonymous CVS access can be found at +`http://savannah.nongnu.org/cvs/?group=dvipng'. + +Contacts +======== + + Bug reports should be sent to <dvipng@nongnu.org>. + + Questions, suggestions for new features, pleas for help, and/or +praise should go to <dvipng@nongnu.org>. For more information on this +mailing list, send a message with just the word `help' as subject or +body to <dvipng-request@nongnu.org> or look at +`http://lists.nongnu.org/mailman/listinfo/dvipng'. + + Offers to support further development will be appreciated. For +developer access, ask on <dvipng@nongnu.org>. + +Copying +======= + + This program is released under the GNU General Public License, see +the COPYING file in the dvipng distribution or +`http://www.gnu.org/licenses/gpl.html'. + + Copyright (C) 2002-2005 Jan-AAke Larsson + +Todo +==== + + * Test the FreeType interface so that TrueType fonts work properly. + + * Further speed improvements. + + * Other output specials and source specials. + + * Remove kpathsea dependence, use dvips' environment variables (this + is maybe less of an issue now with working MiKTeX support). + diff --git a/Build/source/texk/dvipng/RELEASE b/Build/source/texk/dvipng/RELEASE new file mode 100644 index 00000000000..ab132f80edf --- /dev/null +++ b/Build/source/texk/dvipng/RELEASE @@ -0,0 +1,13 @@ +Release notes for version 1.6 of the dvipng package: + +This program makes PNG graphics from DVI files as obtained from TeX +and its relatives. + + +The 1.6 release adds proper alpha channel support and xcolor support. +It also reestablishes identification of preview-latex' tightpage mode +option. + + +It has been tested to a fair degree. Note the disclaimer in the +COPYING file. Report any bugs you find, see README for instructions. diff --git a/Build/source/texk/dvipng/acconfig.h b/Build/source/texk/dvipng/acconfig.h new file mode 100644 index 00000000000..f9c72de53f6 --- /dev/null +++ b/Build/source/texk/dvipng/acconfig.h @@ -0,0 +1,17 @@ +/* ... */ +#undef PACKAGE_NAME + +/* ... */ +#undef PACKAGE_VERSION + +/* ... */ +#undef PACKAGE_STRING + +/* ... */ +#undef int64_t + +/* ... */ +#undef uint64_t + +/* Define to 1 if you have the <kpathsea/kpathsea.h> header file. */ +#undef HAVE_KPATHSEA_KPATHSEA_H diff --git a/Build/source/texk/dvipng/aclocal.m4 b/Build/source/texk/dvipng/aclocal.m4 new file mode 100644 index 00000000000..f35e7fa0df6 --- /dev/null +++ b/Build/source/texk/dvipng/aclocal.m4 @@ -0,0 +1,205 @@ +# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*- + +# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Configure paths for FreeType2 +# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor + +dnl AC_CHECK_FT2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for FreeType2, and define FT2_CFLAGS and FT2_LIBS +dnl +AC_DEFUN(AC_CHECK_FT2, +[dnl +dnl Get the cflags and libraries from the freetype-config script +dnl +AC_ARG_WITH(ft-prefix, +[ --with-ft-prefix=PREFIX + Prefix where FreeType is installed (optional)], + ft_config_prefix="$withval", ft_config_prefix="") +AC_ARG_WITH(ft-exec-prefix, +[ --with-ft-exec-prefix=PREFIX + Exec prefix where FreeType is installed (optional)], + ft_config_exec_prefix="$withval", ft_config_exec_prefix="") +AC_ARG_ENABLE(freetypetest, +[ --disable-freetypetest Do not try to compile and run + a test FreeType program], + [], enable_fttest=yes) + +if test x$ft_config_exec_prefix != x ; then + ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix" + if test x${FT2_CONFIG+set} != xset ; then + FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config + fi +fi +if test x$ft_config_prefix != x ; then + ft_config_args="$ft_config_args --prefix=$ft_config_prefix" + if test x${FT2_CONFIG+set} != xset ; then + FT2_CONFIG=$ft_config_prefix/bin/freetype-config + fi +fi +AC_PATH_PROG(FT2_CONFIG, freetype-config, no) + +min_ft_version=ifelse([$1], ,6.1.0,$1) +AC_MSG_CHECKING(for FreeType - version >= $min_ft_version) +no_ft="" +if test "$FT2_CONFIG" = "no" ; then + no_ft=yes +else + FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags` + FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs` + ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + ft_min_major_version=`echo $min_ft_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + ft_min_minor_version=`echo $min_ft_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + ft_min_micro_version=`echo $min_ft_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test x$enable_fttest = xyes ; then + ft_config_is_lt="" + if test $ft_config_major_version -lt $ft_min_major_version ; then + ft_config_is_lt=yes + else + if test $ft_config_major_version -eq $ft_min_major_version ; then + if test $ft_config_minor_version -lt $ft_min_minor_version ; then + ft_config_is_lt=yes + else + if test $ft_config_minor_version -eq $ft_min_minor_version ; then + if test $ft_config_micro_version -lt $ft_min_micro_version ; then + ft_config_is_lt=yes + fi + fi + fi + fi + fi + if test x$ft_config_is_lt = xyes ; then + no_ft=yes + else + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $FT2_CFLAGS" + LIBS="$FT2_LIBS $LIBS" +dnl +dnl Sanity checks for the results of freetype-config to some extent +dnl + AC_TRY_RUN([ +#include <ft2build.h> +#include FT_FREETYPE_H +#include <stdio.h> +#include <stdlib.h> + +int +main() +{ + FT_Library library; + FT_Error error; + + error = FT_Init_FreeType(&library); + + if (error) + return 1; + else + { + FT_Done_FreeType(library); + return 0; + } +} +],, no_ft=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi # test $ft_config_version -lt $ft_min_version + fi # test x$enable_fttest = xyes +fi # test "$FT2_CONFIG" = "no" +if test x$no_ft = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) +else + AC_MSG_RESULT(no) + if test "$FT2_CONFIG" = "no" ; then + echo "*** The freetype-config script installed by FreeType 2 could not be found." + echo "*** If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the FT2_CONFIG environment variable to the" + echo "*** full path to freetype-config." + else + if test x$ft_config_is_lt = xyes ; then + echo "*** Your installed version of the FreeType 2 library is too old." + echo "*** If you have different versions of FreeType 2, make sure that" + echo "*** correct values for --with-ft-prefix or --with-ft-exec-prefix" + echo "*** are used, or set the FT2_CONFIG environment variable to the" + echo "*** full path to freetype-config." + else + echo "*** The FreeType test program failed to run. If your system uses" + echo "*** shared libraries and they are installed outside the normal" + echo "*** system library path, make sure the variable LD_LIBRARY_PATH" + echo "*** (or whatever is appropiate for your system) is correctly set." + fi + fi + FT2_CFLAGS="" + FT2_LIBS="" + ifelse([$3], , :, [$3]) +fi +AC_SUBST(FT2_CFLAGS) +AC_SUBST(FT2_LIBS) +]) + + +dnl +dnl MAKEINFO_CHECK_MACRO( MACRO, [ACTION-IF-FOUND +dnl [, ACTION-IF-NOT-FOUND]]) +dnl +AC_DEFUN(MAKEINFO_CHECK_MACRO, +[if test -n "$MAKEINFO" -a "$makeinfo" != ":"; then + AC_MSG_CHECKING([if $MAKEINFO understands @$1{}]) + echo \\\\input texinfo > conftest.texi + echo @$1{test} >> conftest.texi + if $MAKEINFO conftest.texi > /dev/null 2> /dev/null; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + ifelse([$3], , :, [$3]) + fi + rm -f conftest.texi conftest.info +fi +]) + +dnl +dnl MAKEINFO_CHECK_MACROS( MACRO ... [, ACTION-IF-FOUND +dnl [, ACTION-IF-NOT-FOUND]]) +dnl +AC_DEFUN(MAKEINFO_CHECK_MACROS, +[for ac_macro in $1; do + MAKEINFO_CHECK_MACRO($ac_macro, $2, + [MAKEINFO_MACROS="-D no-$ac_macro $MAKEINFO_MACROS" + $3])dnl + done +AC_SUBST(MAKEINFO_MACROS) +]) + + +dnl +dnl Check for enc, cmap, sfd formats +dnl +AC_DEFUN(AC_HAS_KPSE_ENC_FORMATS, + [AC_MSG_CHECKING([whether kpse_enc_format is in kpathsea/tex-file.h]) + AC_TRY_COMPILE([ + #include <stdio.h> + #include <kpathsea/tex-file.h>], + [kpse_enc_format;kpse_cmap_format;kpse_sfd_format], + [AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_KPSE_ENC_FORMATS, 1, + [Define to 1 if your kpathsea has kpse_enc_format])], + [AC_MSG_RESULT(no)])]) diff --git a/Build/source/texk/dvipng/color.c b/Build/source/texk/dvipng/color.c new file mode 100644 index 00000000000..fe0bb66c86e --- /dev/null +++ b/Build/source/texk/dvipng/color.c @@ -0,0 +1,379 @@ +/* color.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif + +/* + * Color. We delete and recreate the gdImage for each new page. This + * means that the stack must contain rgb value not color index. + * Besides, the current antialiasing implementation needs rgb anyway. +*/ + +struct colorname { + struct colorname *next; + char* color; + char name[1]; +} *dvipsnam=NULL,*svgnam=NULL,*xcolor=NULL; + + +void initcolor() +{ + csp = 1; + cstack[0].red=255; + cstack[0].green=255; + cstack[0].blue=255; + cstack[1].red=0; + cstack[1].green=0; + cstack[1].blue=0; +} + +struct colorname * NewColor(char* name, int nname, + char* model, int nmodel, + char* values, int nvalues) +{ + struct colorname *tmp = + malloc(sizeof(struct colorname)+3+nname+nmodel+nvalues); + if (tmp==NULL) + Fatal("Cannot allocate space for color name"); + tmp->color=tmp->name+nname+1; + strncpy(tmp->name,name,nname); + tmp->name[nname]='\0'; + strncpy(tmp->color,model,nmodel); + tmp->color[nmodel]=' '; + strncpy(tmp->color+nmodel+1,values,nvalues); + tmp->color[nmodel+nvalues+1]='\0'; + model=tmp->color; + while(*model!='\0') { + if (*model==',') + *model=' '; + model++; + } + DEBUG_PRINT(DEBUG_COLOR,("\n COLOR NAME:\t'%s' '%s'", + tmp->name,tmp->color)); + return(tmp); +} + +#define FINDWORD(s) while(s<max && \ + (*s=='{'||*s==' '||*s=='%'||*s=='\n'||*s==';')) s++ +#define FINDARG(s) while(s<max && *s!='{') s++; FINDWORD(s) +#define FINDMODELEND(s,n) n=0; while(s<max && *s!='}') { s++; n++; } +#define FINDNAMEEND(s,n) n=0; while(s<max && *s!='}' && *s!=',') { s++; n++; } +#define FINDVALEND(s,n) n=0; while(s<max && *s!='}' && *s!=';') { s++; n++; } +#define BLANKCOMMAS(s) + +struct colorname* LoadColornameFile(char* filename, bool should_exist) +{ + struct colorname *list=NULL,*tmp=NULL; + char *filepath,*pos,*max; + char *name,*values,*model; + int nname,nvalues,nmodel; + struct filemmap fmmap; + + TEMPSTR(filepath,kpse_find_file(filename,kpse_tex_format,false)); + if (filepath == NULL) { + if (should_exist) + Warning("color name file '%s' could not be found",filename); + return NULL; + } + DEBUG_PRINT(DEBUG_COLOR,("\n OPEN COLOR NAMES:\t'%s'", filepath)); + if (MmapFile(filepath,&fmmap)) return NULL; + pos=fmmap.mmap; + max=fmmap.mmap+fmmap.size; + while (pos<max && *pos!='\\') pos++; + while(pos+9<max && strncmp(pos,"\\endinput",9)!=0) { + if (pos+17<max && strncmp(pos,"\\DefineNamedColor",17)==0) { + model=NULL; + nname=nmodel=nvalues=0; + FINDARG(pos); /* skip first argument */ + FINDARG(pos); /* find second argument: color name */ + name=pos; + FINDNAMEEND(pos,nname); + FINDARG(pos); /* find third argument: color model */ + model=pos; + FINDMODELEND(pos,nmodel); + FINDARG(pos); /* find fourth argument: color values */ + values=pos; + FINDVALEND(pos,nvalues); + tmp=NewColor(name,nname,model,nmodel,values,nvalues); + tmp->next=list; + list=tmp; + } else if (pos+15<max && strncmp(pos,"\\definecolorset",15)==0) { + char *model; + FINDARG(pos); /* find first argument: color model */ + model=pos; + FINDMODELEND(pos,nmodel); + FINDARG(pos); /* skip second argument */ + FINDARG(pos); /* skip third argument */ + FINDARG(pos); /* find fourth argument: names, values */ + while(pos<max && *pos!='}'){ + name=pos; + FINDNAMEEND(pos,nname); + pos++; + values=pos; + FINDVALEND(pos,nvalues); + NewColor(name,nname,model,nmodel,values,nvalues); + tmp->next=list; + list=tmp; + FINDWORD(pos); + } + } else { + pos++; + while (pos<max && *pos!='\\') pos++; + } + } + UnMmapFile(&fmmap); + return(list); +} + +void ClearColorNames(void) +{ + struct colorname *tmp=dvipsnam,*next=NULL; + while (tmp!=NULL) { + next=tmp->next; + free(tmp); + tmp=next; + } + dvipsnam=NULL; + tmp=svgnam; + while (tmp!=NULL) { + next=tmp->next; + free(tmp); + tmp=next; + } + svgnam=NULL; + tmp=xcolor; + while (tmp!=NULL) { + next=tmp->next; + free(tmp); + tmp=next; + } + xcolor=NULL; +} + +#define FTO255(a) ((int) (255*a+0.5)) +#define WARN_IF_FAILED(a,b) if (a==b) { flags |= PAGE_GAVE_WARN; \ + Warning("missing color-specification value, treated as zero"); } + +#define SKIPSPACES(s) while(s && *s==' ' && *s!='\0') s++ +#define NEXTFLOAT255(c) FTO255(strtod(c,&end)); WARN_IF_FAILED(c,end); c=end +#define NEXTFLOAT(c) strtod(c,&end); WARN_IF_FAILED(c,end); c=end +#define NEXTINT(c) strtol(c,&end,10); WARN_IF_FAILED(c,end); c=end +#define NEXTHEX(c) strtol(c,&end,16); WARN_IF_FAILED(c,end); c=end + +void stringrgb(char* color,int *r,int *g,int *b) +{ + char* end; + + DEBUG_PRINT(DEBUG_COLOR,("\n COLOR SPEC:\t'%s' (",color)); + SKIPSPACES(color); + if (strcmp(color,"Black")==0) { + *r = *g = *b = 0; + } else if (strcmp(color,"White")==0) { + *r = *g = *b = 255; + } else if (strncmp(color,"gray ",5)==0) { + color+=5; + *r = *g = *b = NEXTFLOAT255(color); + } else if (strncmp(color,"rgb ",4)==0) { + color+=4; + *r = NEXTFLOAT255(color); + *g = NEXTFLOAT255(color); + *b = NEXTFLOAT255(color); + } else if (strncmp(color,"Gray ",5)==0) { + color+=5; + *r = *g = *b = NEXTINT(color); + } else if (strncmp(color,"RGB ",4)==0) { + color+=4; + *r = NEXTINT(color); + *g = NEXTINT(color); + *b = NEXTINT(color); + } else if (strncmp(color,"HTML ",5)==0) { + color+=5; + *b = NEXTHEX(color); + *r = *b/65536; + *g = *b/256; + *b -= *g*256; + *g -= *r*256; + } else if (strncmp(color,"cmy ",4)==0 + || strncmp(color,"cmyk ",5)==0) { + int c,m,y,k; + color+=3; + k=(*color=='k'); + if (k) + color++; + c = NEXTFLOAT255(color); + m = NEXTFLOAT255(color); + y = NEXTFLOAT255(color); + if (k) + k = NEXTFLOAT255(color); + *r = c+k<255 ? 255-(c+k) : 0; + *g = m+k<255 ? 255-(m+k) : 0; + *b = y+k<255 ? 255-(y+k) : 0; + } else if (strncmp(color,"hsb ",4)==0 + || strncmp(color,"HSB ",4)==0) { + /* The hsb and HSB models really need more presicion. + Use double and convert back*/ + double hu,sa,br,f,R,G,B; + int i; + if (*color=='h') { + color+=4; + hu = NEXTFLOAT(color); + sa = NEXTFLOAT(color); + br = NEXTFLOAT(color); + } else { + color+=4; + hu = (float)NEXTINT(color); hu /= 255; + sa = (float)NEXTINT(color); sa /= 255; + br = (float)NEXTINT(color); br /= 255; + } + i=6*hu; + f=6*hu-i; + switch(i) { + case 0: + R = br*(1-sa*0); G = br*(1-sa*(1-f)); B = br*(1-sa*1); break; + case 1: + R = br*(1-sa*f); G = br*(1-sa*0); B = br*(1-sa*1); break; + case 2: + R = br*(1-sa*1); G = br*(1-sa*0); B = br*(1-sa*(1-f)); break; + case 3: + R = br*(1-sa*1); G = br*(1-sa*f); B = br*(1-sa*0); break; + case 4: + R = br*(1-sa*(1-f)); G = br*(1-sa*1); B = br*(1-sa*0); break; + case 5: + R = br*(1-sa*0); G = br*(1-sa*1); B = br*(1-sa*f); break; + default: + R = br*(1-sa*0); G = br*(1-sa*1); B = br*(1-sa*1); + } + *r=FTO255(R); + *g=FTO255(G); + *b=FTO255(B); + } else { + /* Model not found, probably a color name */ + struct colorname *tmp; + + if (dvipsnam==NULL) + dvipsnam=LoadColornameFile("dvipsnam.def",true); + tmp=dvipsnam; + while(tmp!=NULL && tmp->name!=NULL && strcmp(color,tmp->name)) + tmp=tmp->next; + if (tmp==NULL) { + if (svgnam==NULL) + svgnam=LoadColornameFile("svgnam.def",false); + tmp=svgnam; + while(tmp!=NULL && tmp->name!=NULL && strcmp(color,tmp->name)) + tmp=tmp->next; + if (tmp==NULL) { + if (xcolor==NULL) + xcolor=LoadColornameFile("xcolor.sty",false); + tmp=xcolor; + while(tmp!=NULL && tmp->name!=NULL && strcmp(color,tmp->name)) + tmp=tmp->next; + } + } + if (tmp!=NULL) { + /* Found: one-level recursion */ + DEBUG_PRINT(DEBUG_COLOR,("\n ---RECURSION--- ")) + stringrgb(tmp->color,r,g,b); + } else { + /* Not found, warn */ + flags |= PAGE_GAVE_WARN; + Warning("unimplemented color specification '%s'",color); + } + } + DEBUG_PRINT(DEBUG_COLOR,("%d %d %d) ",*r,*g,*b)) +} + +void background(char* p) +{ + stringrgb(p, &cstack[0].red, &cstack[0].green, &cstack[0].blue); + DEBUG_PRINT(DEBUG_COLOR,("\n BACKGROUND:\t(%d %d %d) ", + cstack[0].red, cstack[0].green, cstack[0].blue)); +} + +void pushcolor(char * p) +{ + if ( ++csp == STACK_SIZE ) + Fatal("out of color stack space") ; + stringrgb(p, &cstack[csp].red, &cstack[csp].green, &cstack[csp].blue); + DEBUG_PRINT(DEBUG_COLOR,("\n COLOR PUSH:\t(%d %d %d) ", + cstack[csp].red, cstack[csp].green, cstack[csp].blue)) +} + +void popcolor() +{ + if (csp > 1) csp--; /* Last color is global */ + DEBUG_PRINT(DEBUG_COLOR,("\n COLOR POP\t")) +} + +void resetcolorstack(char * p) +{ + if ( csp > 1 ) + Warning("global color change within nested colors"); + csp=0; + pushcolor(p) ; + DEBUG_PRINT(DEBUG_COLOR,("\n RESET COLOR:\tbottom of stack:")) +} + +void StoreColorStack(struct page_list *tpagep) +{ + int i=0; + + DEBUG_PRINT(DEBUG_COLOR,("\n STORE COLOR STACK:\t %d ", csp)); + tpagep->csp=csp; + while ( i <= csp ) { + DEBUG_PRINT(DEBUG_COLOR,("\n COLOR STACK:\t %d (%d %d %d) ",i, + cstack[i].red, cstack[i].green, cstack[i].blue)); + tpagep->cstack[i].red = cstack[i].red; + tpagep->cstack[i].green = cstack[i].green; + tpagep->cstack[i].blue = cstack[i].blue; + i++; + } +} + +void ReadColorStack(struct page_list *tpagep) +{ + int i=0; + + DEBUG_PRINT(DEBUG_COLOR,("\n READ COLOR STACK:\t %d ", tpagep->csp)); + csp=tpagep->csp; + while ( i <= tpagep->csp ) { + DEBUG_PRINT(DEBUG_COLOR,("\n COLOR STACK:\t %d (%d %d %d) ",i, + cstack[i].red, cstack[i].green, cstack[i].blue)); + cstack[i].red = tpagep->cstack[i].red; + cstack[i].green = tpagep->cstack[i].green; + cstack[i].blue = tpagep->cstack[i].blue; + i++; + } +} + +void StoreBackgroundColor(struct page_list *tpagep) +{ + /* Background color changes affect the _whole_ page */ + tpagep->cstack[0].red = cstack[0].red; + tpagep->cstack[0].green = cstack[0].green; + tpagep->cstack[0].blue = cstack[0].blue; +} diff --git a/Build/source/texk/dvipng/commands.h b/Build/source/texk/dvipng/commands.h new file mode 100644 index 00000000000..ea1691808f1 --- /dev/null +++ b/Build/source/texk/dvipng/commands.h @@ -0,0 +1,197 @@ +/* commands.h */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +/* DVI COMMANDS */ +#define DVIFORMAT 2 + +#define SETC_000 0 /* typeset character 0 and move right */ +#define SETC_127 127 /* typeset character 127 and move right */ +#define SET1 128 /* typeset a character and move right */ +#define SET2 129 /* ??? */ +#define SET3 130 /* ??? */ +#define SET4 131 /* ??? */ +#define SET_RULE 132 /* typeset a rule and move right */ +#define PUT1 133 /* typeset a character */ +#define PUT2 134 /* ??? */ +#define PUT3 135 /* ??? */ +#define PUT4 136 /* ??? */ +#define PUT_RULE 137 /* typeset a rule */ +#define NOP 138 /* no operation */ +#define BOP 139 /* beginning of page */ +#define EOP 140 /* ending of page */ +#define PUSH 141 /* save the current positions */ +#define POP 142 /* restore previous positions */ +#define RIGHT1 143 /* move right */ +#define RIGHT2 144 /* ??? */ +#define RIGHT3 145 /* ??? */ +#define RIGHT4 146 /* ??? */ +#define W0 147 /* move right by |w| */ +#define W1 148 /* move right and set |w| */ +#define W2 149 /* ??? */ +#define W3 150 /* ??? */ +#define W4 151 /* ??? */ +#define X0 152 /* move right by |x| */ +#define X1 153 /* move right and set |x| */ +#define X2 154 /* ??? */ +#define X3 155 /* ??? */ +#define X4 156 /* ??? */ +#define DOWN1 157 /* move down */ +#define DOWN2 158 /* ??? */ +#define DOWN3 159 /* ??? */ +#define DOWN4 160 /* ??? */ +#define Y0 161 /* move down by |y| */ +#define Y1 162 /* move down and set |y| */ +#define Y2 163 /* ??? */ +#define Y3 164 /* ??? */ +#define Y4 165 /* ??? */ +#define Z0 166 /* move down by |z| */ +#define Z1 167 /* move down and set |z| */ +#define Z2 168 /* ??? */ +#define Z3 169 /* ??? */ +#define Z4 170 /* ??? */ +#define FONT_00 171 /* set current font to 0 */ +#define FONT_63 234 /* set current font to 63 */ +#define FNT1 235 /* set current font */ +#define FNT2 236 /* Same as FNT1, except that arg is 2 bytes */ +#define FNT3 237 /* Same as FNT1, except that arg is 3 bytes */ +#define FNT4 238 /* Same as FNT1, except that arg is 4 bytes */ +#define XXX1 239 /* extension to \.DVI primitives */ +#define XXX2 240 /* Like XXX1, but 0<=k<65536 */ +#define XXX3 241 /* Like XXX1, but 0<=k<@t$2^{24}$@> */ +#define XXX4 242 /* potentially long extension to \.DVI + primitives */ +#define FNT_DEF1 243 /* define the meaning of a font number */ +#define FNT_DEF2 244 /* ??? */ +#define FNT_DEF3 245 /* ??? */ +#define FNT_DEF4 246 /* ??? */ +#define PRE 247 /* preamble */ +#define POST 248 /* postamble beginning */ +#define POST_POST 249 /* postamble ending */ + +/* undefined_commands 250,251,252,253,254,255 */ + +EXTERN const int8_t dvi_commandlength[256] +#ifdef MAIN +={ + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1, /* SETC_000 --- SETC_127 */ + 2,3,4,5,9, /* SET1 --- SET4, SET_RULE */ + 2,3,4,5,9, /* PUT1 --- PUT4, PUT_RULE */ + 1,45,1,1,1, /* NOP, BOP, EOP, PUSH, POP */ + 2,3,4,5, /* RIGHT1 --- RIGHT4 */ + 1,2,3,4,5, /* W0 --- W4 */ + 1,2,3,4,5, /* X0 --- X4 */ + 2,3,4,5, /* DOWN1 --- DOWN4 */ + 1,2,3,4,5, /* Y0 --- Y4 */ + 1,2,3,4,5, /* Z0 --- Z4 */ + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1, /* FONT_00 --- FONT_63 */ + 2,3,4,5, /* FNT1 --- FNT4 */ + 2,3,4,5, /* XXX1 --- XXX4 + special string */ + 16,17,18,19, /* FNT_DEF1 --- FNT_DEF4 + font name */ + 15, /* PRE + TeX comment */ + 29, /* POST */ + 10, /* POST_POST minimum */ + -1,-1,-1,-1,-1,-1 /* undefined */ +} +#endif +; + +EXTERN const char* dvi_commands[256] +#ifdef MAIN +={ +"SETC_000","SETC_001","SETC_002","SETC_003","SETC_004", +"SETC_005","SETC_006","SETC_007","SETC_008","SETC_009", +"SETC_010","SETC_011","SETC_012","SETC_013","SETC_014", +"SETC_015","SETC_016","SETC_017","SETC_018","SETC_019", +"SETC_020","SETC_021","SETC_022","SETC_023","SETC_024", +"SETC_025","SETC_026","SETC_027","SETC_028","SETC_029", +"SETC_030","SETC_031","SETC_032","SETC_033","SETC_034", +"SETC_035","SETC_036","SETC_037","SETC_038","SETC_039", +"SETC_040","SETC_041","SETC_042","SETC_043","SETC_044", +"SETC_045","SETC_046","SETC_047","SETC_048","SETC_049", +"SETC_050","SETC_051","SETC_052","SETC_053","SETC_054", +"SETC_055","SETC_056","SETC_057","SETC_058","SETC_059", +"SETC_060","SETC_061","SETC_062","SETC_063","SETC_064", +"SETC_065","SETC_066","SETC_067","SETC_068","SETC_069", +"SETC_070","SETC_071","SETC_072","SETC_073","SETC_074", +"SETC_075","SETC_076","SETC_077","SETC_078","SETC_079", +"SETC_080","SETC_081","SETC_082","SETC_083","SETC_084", +"SETC_085","SETC_086","SETC_087","SETC_088","SETC_089", +"SETC_090","SETC_091","SETC_092","SETC_093","SETC_094", +"SETC_095","SETC_096","SETC_097","SETC_098","SETC_099", +"SETC_100","SETC_101","SETC_102","SETC_103","SETC_104", +"SETC_105","SETC_106","SETC_107","SETC_108","SETC_109", +"SETC_110","SETC_111","SETC_112","SETC_113","SETC_114", +"SETC_115","SETC_116","SETC_117","SETC_118","SETC_119", +"SETC_120","SETC_121","SETC_122","SETC_123","SETC_124", +"SETC_125","SETC_126","SETC_127", +"SET1","SET2","SET3","SET4","SET_RULE", +"PUT1","PUT2","PUT3","PUT4","PUT_RULE", +"NOP","BOP","EOP","PUSH","POP", +"RIGHT1","RIGHT2","RIGHT3","RIGHT4", +"W0","W1","W2","W3","W4", +"X0","X1","X2","X3","X4", +"DOWN1","DOWN2","DOWN3","DOWN4", +"Y0","Y1","Y2","Y3","Y4", +"Z0","Z1","Z2","Z3","Z4", +"FONT_00","FONT_01","FONT_02","FONT_03","FONT_04", +"FONT_05","FONT_06","FONT_07","FONT_08","FONT_09", +"FONT_10","FONT_11","FONT_12","FONT_13","FONT_14", +"FONT_15","FONT_16","FONT_17","FONT_18","FONT_19", +"FONT_20","FONT_21","FONT_22","FONT_23","FONT_24", +"FONT_25","FONT_26","FONT_27","FONT_28","FONT_29", +"FONT_30","FONT_31","FONT_32","FONT_33","FONT_34", +"FONT_35","FONT_36","FONT_37","FONT_38","FONT_39", +"FONT_40","FONT_41","FONT_42","FONT_43","FONT_44", +"FONT_45","FONT_46","FONT_47","FONT_48","FONT_49", +"FONT_50","FONT_51","FONT_52","FONT_53","FONT_54", +"FONT_55","FONT_56","FONT_57","FONT_58","FONT_59", +"FONT_60","FONT_61","FONT_62","FONT_63", +"FNT1","FNT2","FNT3","FNT4", +"XXX1","XXX2","XXX3","XXX4", +"FNT_DEF1","FNT_DEF2","FNT_DEF3","FNT_DEF4", +"PRE","POST","POST_POST", +"UNDEF_250","UNDEF_251","UNDEF_252","UNDEF_253","UNDEF_254","UNDEF_255" +} +#endif +; + diff --git a/Build/source/texk/dvipng/config.h.in b/Build/source/texk/dvipng/config.h.in new file mode 100644 index 00000000000..9206914889e --- /dev/null +++ b/Build/source/texk/dvipng/config.h.in @@ -0,0 +1,132 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define if using alloca.c. */ +#undef C_ALLOCA + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +#undef CRAY_STACKSEG_END + +/* Define if you have alloca, as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* Define if you don't have vprintf but do have _doprnt. */ +#undef HAVE_DOPRNT + +/* Define if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define if you have the vprintf function. */ +#undef HAVE_VPRINTF + +/* Define to `int' if <sys/types.h> doesn't define. */ +#undef pid_t + +/* Define to `unsigned' if <sys/types.h> doesn't define. */ +#undef size_t + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown + */ +#undef STACK_DIRECTION + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#undef TIME_WITH_SYS_TIME + +/* ... */ +#undef PACKAGE_NAME + +/* ... */ +#undef PACKAGE_VERSION + +/* ... */ +#undef PACKAGE_STRING + +/* Define to 1 if you have the <kpathsea/kpathsea.h> header file. */ +#undef HAVE_KPATHSEA_KPATHSEA_H + +/* Define if you have the dup2 function. */ +#undef HAVE_DUP2 + +/* Define if you have the ftime function. */ +#undef HAVE_FTIME + +/* Define if you have the getpagesize function. */ +#undef HAVE_GETPAGESIZE + +/* Define if you have the gettimeofday function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define if you have the memchr function. */ +#undef HAVE_MEMCHR + +/* Define if you have the memset function. */ +#undef HAVE_MEMSET + +/* Define if you have the munmap function. */ +#undef HAVE_MUNMAP + +/* Define if you have the putenv function. */ +#undef HAVE_PUTENV + +/* Define if you have the strchr function. */ +#undef HAVE_STRCHR + +/* Define if you have the strrchr function. */ +#undef HAVE_STRRCHR + +/* Define if you have the strtol function. */ +#undef HAVE_STRTOL + +/* Define if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define if you have the <gd.h> header file. */ +#undef HAVE_GD_H + +/* Define if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define if you have the <stdbool.h> header file. */ +#undef HAVE_STDBOOL_H + +/* Define if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H + +/* Define if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the <zlib.h> header file. */ +#undef HAVE_ZLIB_H + +/* Define if you have the gd library (-lgd). */ +#undef HAVE_LIBGD + +/* Define if you have the gen library (-lgen). */ +#undef HAVE_LIBGEN + +/* Define if you have the m library (-lm). */ +#undef HAVE_LIBM + +/* Define if you have the z library (-lz). */ +#undef HAVE_LIBZ + +/* Define as the path to GhostScript. */ +#undef GS_PATH + diff --git a/Build/source/texk/dvipng/configure b/Build/source/texk/dvipng/configure new file mode 100755 index 00000000000..00c05f4fde5 --- /dev/null +++ b/Build/source/texk/dvipng/configure @@ -0,0 +1,3642 @@ +#! /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: +ac_help="$ac_help + --with-system-zlib use installed zlib library" +ac_help="$ac_help + --with-zlib-libdir=DIR + Specify directory where the zlib.a resides." +ac_help="$ac_help + --with-zlib-include=DIR + Specify the zlib header files location." +ac_help="$ac_help + --with-system-pnglib use installed pnglib library" +ac_help="$ac_help + --with-pnglib-libdir=DIR + Specify directory where the png library (libpng.a) resides." +ac_help="$ac_help + --with-pnglib-include=DIR + Specify the pnglib header files location." +ac_help="$ac_help + --with-system-t1lib Use installed T1lib" +ac_help="$ac_help + --with-t1lib-libdir=DIR + Specify the location of T1lib library files (libt1.a)" +ac_help="$ac_help + --with-t1lib-include=DIR + Specify the location of T1lib header files" +ac_help="$ac_help + --with-system-gd use installed gd library" +ac_help="$ac_help + --with-gd-libdir=DIR + Specify directory where the gd library resides." +ac_help="$ac_help + --with-gd-include=DIR + Specify the gd header files location." +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --without-mktexmf-default do not run mktexmf if MF source missing" +ac_help="$ac_help + --without-mktexpk-default do not run mktexpk if PK font missing" +ac_help="$ac_help + --without-mktextfm-default do not run mktextfm if TFM file missing" +ac_help="$ac_help + --without-mkocp-default do not run mkocp if OCP file missing" +ac_help="$ac_help + --without-mkofm-default do not run mkofm if OFM file missing" +ac_help="$ac_help + --with-mktexfmt-default run mktexfmt if format file missing" +ac_help="$ac_help + --with-mktextex-default run mktextex if TeX source missing" + +# 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=dvipng.c + +# 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 + + +cat >> confdefs.h <<\EOF +#define PACKAGE_NAME "dvipng" +EOF + +cat >> confdefs.h <<\EOF +#define PACKAGE_VERSION "1.6" +EOF + +cat >> confdefs.h <<\EOF +#define PACKAGE_STRING "dvipng 1.6" +EOF + + +# Checks for programs. +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:600: 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 + +# 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:629: 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:660: 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:712: 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:745: 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 756 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:761: \"$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:787: 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:792: 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:801: \"$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:820: 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:888: 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 "gs", so it can be a program name with args. +set dummy gs; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:945: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GS" in + /*|[A-z]:/*) + ac_cv_path_GS="$GS" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GS="$GS" # Let the user override the test with a dos path. + ;; + *) + 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_path_GS="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GS" && ac_cv_path_GS=":" + ;; +esac +fi +GS="$ac_cv_path_GS" +if test -n "$GS"; then + echo "$ac_t""$GS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +cat >> confdefs.h <<EOF +#define GS_PATH "$GS" +EOF + + +ac_cv_lib_t1_T1_InitLib=yes +PSFONTS_O="" +if test "$ac_cv_lib_t1_T1_InitLib" = yes; then + PSFONTS_O="t1.o" +fi + + +if test -n "$PSFONTS_O"; then + PSFONTS_O="$PSFONTS_O enc.o fontmap.o tfm.o" +fi +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:995: 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 1010 "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:1016: \"$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 1027 "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:1033: \"$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 1044 "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:1050: \"$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:1075: 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 1080 "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:1088: \"$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 1105 "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 1123 "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 1144 "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:1155: \"$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 for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 +echo "configure:1179: checking for sys/wait.h that is POSIX.1 compatible" >&5 +if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1184 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/wait.h> +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif +int main() { +int s; +wait (&s); +s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; +; return 0; } +EOF +if { (eval echo configure:1200: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_sys_wait_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_sys_wait_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 +if test $ac_cv_header_sys_wait_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SYS_WAIT_H 1 +EOF + +fi + +echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 +echo "configure:1221: checking whether time.h and sys/time.h may both be included" >&5 +if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1226 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/time.h> +#include <time.h> +int main() { +struct tm *tp; +; return 0; } +EOF +if { (eval echo configure:1235: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_time=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_time" 1>&6 +if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF + +fi + +for ac_hdr in inttypes.h fcntl.h sys/time.h stdbool.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1259: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1264 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1269: \"$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* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +# Checks for typedefs, structures, and compiler characteristics. +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:1298: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1303 "configure" +#include "confdefs.h" + +int main() { + +/* Ultrix mips cc rejects this. */ +typedef int charset[2]; const charset x; +/* SunOS 4.1.1 cc rejects this. */ +char const *const *ccp; +char **p; +/* NEC SVR4.0.2 mips cc rejects this. */ +struct point {int x, y;}; +static struct point const zero = {0,0}; +/* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in an arm + of an if-expression whose if-part is not a constant expression */ +const char *g = "string"; +ccp = &g + (g ? g-g : 0); +/* HPUX 7.0 cc rejects these. */ +++ccp; +p = (char**) ccp; +ccp = (char const *const *) p; +{ /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; +} +{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; +} +{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; +} +{ /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:1352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for pid_t""... $ac_c" 1>&6 +echo "configure:1373: checking for pid_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1378 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +#if HAVE_STDINT_H +#include <stdint.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_pid_t=yes +else + rm -rf conftest* + ac_cv_type_pid_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_pid_t" 1>&6 +if test $ac_cv_type_pid_t = no; then + cat >> confdefs.h <<\EOF +#define pid_t int +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:1409: checking for size_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1414 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +#if HAVE_STDINT_H +#include <stdint.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + + +#if test "$ac_cv_header_inttypes_h" = yes; then + # Sometimes we want to use gcc -ansi -pedantic as a portability test + # The typedef of int64_t is not in the system header file in that + # case. Then, #define int64_t as "long long", which is non-ansi, but + # is present in most modern compilers. Using a #define rather than a + # typedef can be a problem, but in dvipng int64_t only is used as + # typecast, and there are no problems. + +# MY_CHECK_TYPE(int64_t, long long) +# MY_CHECK_TYPE(uint64_t, unsigned long long) +#fi + +# Checks for library functions. +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 +echo "configure:1461: checking for working alloca.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1466 "configure" +#include "confdefs.h" +#include <alloca.h> +int main() { +char *p = alloca(2 * sizeof(int)); +; return 0; } +EOF +if { (eval echo configure:1473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_header_alloca_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_alloca_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 +if test $ac_cv_header_alloca_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA_H 1 +EOF + +fi + +echo $ac_n "checking for alloca""... $ac_c" 1>&6 +echo "configure:1494: checking for alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1499 "configure" +#include "confdefs.h" + +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include <malloc.h> +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +int main() { +char *p = (char *) alloca(1); +; return 0; } +EOF +if { (eval echo configure:1527: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_alloca_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_alloca_works=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 +if test $ac_cv_func_alloca_works = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA 1 +EOF + +fi + +if test $ac_cv_func_alloca_works = no; then + # The SVR3 libPW and SVR4 libucb both contain incompatible functions + # that cause trouble. Some versions do not even contain alloca or + # contain a buggy version. If you still want to use their alloca, + # use ar to extract alloca.o from them instead of compiling alloca.c. + ALLOCA=alloca.${ac_objext} + cat >> confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + + +echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +echo "configure:1559: checking whether alloca needs Cray hooks" >&5 +if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1564 "configure" +#include "confdefs.h" +#if defined(CRAY) && ! defined(CRAY2) +webecray +#else +wenotbecray +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "webecray" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_os_cray=yes +else + rm -rf conftest* + ac_cv_os_cray=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_os_cray" 1>&6 +if test $ac_cv_os_cray = yes; then +for ac_func in _getb67 GETB67 getb67; do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1589: 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 1594 "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:1617: \"$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 + cat >> confdefs.h <<EOF +#define CRAY_STACKSEG_END $ac_func +EOF + + break +else + echo "$ac_t""no" 1>&6 +fi + +done +fi + +echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 +echo "configure:1644: checking stack direction for C alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat > conftest.$ac_ext <<EOF +#line 1652 "configure" +#include "confdefs.h" +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +} +EOF +if { (eval echo configure:1671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_stack_direction=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_stack_direction=-1 +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 +cat >> confdefs.h <<EOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +EOF + +fi + +for ac_hdr in unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1696: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1701 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1706: \"$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* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in getpagesize +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1735: 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 1740 "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:1763: \"$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 + +echo $ac_n "checking for working mmap""... $ac_c" 1>&6 +echo "configure:1788: checking for working mmap" >&5 +if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_fixed_mapped=no +else + cat > conftest.$ac_ext <<EOF +#line 1796 "configure" +#include "confdefs.h" + +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the filesystem buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propogated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ +#include <sys/types.h> +#include <fcntl.h> +#include <sys/mman.h> + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif + +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +#ifdef __cplusplus +extern "C" { void *malloc(unsigned); } +#else +char *malloc(); +#endif + +int +main() +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 0600); + if (fd < 0) + exit(1); + if (write(fd, data, pagesize) != pagesize) + exit(1); + close(fd); + + /* + * Next, try to mmap the file at a fixed address which + * already has something else allocated at it. If we can, + * also make sure that we see the same garbage. + */ + fd = open("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + data2 = malloc(2 * pagesize); + if (!data2) + exit(1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit(1); + + /* + * Finally, make sure that changes to the mapped area + * do not percolate back to the file as seen by read(). + * (This is a bug on some variants of i386 svr4.0.) + */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = malloc(pagesize); + if (!data3) + exit(1); + if (read(fd, data3, pagesize) != pagesize) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit(1); + close(fd); + unlink("conftestmmap"); + exit(0); +} + +EOF +if { (eval echo configure:1936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_mmap_fixed_mapped=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_mmap_fixed_mapped=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 +if test $ac_cv_func_mmap_fixed_mapped = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MMAP 1 +EOF + +fi + +echo $ac_n "checking for vprintf""... $ac_c" 1>&6 +echo "configure:1959: checking for vprintf" >&5 +if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1964 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char vprintf(); 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 vprintf(); + +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_vprintf) || defined (__stub___vprintf) +choke me +#else +vprintf(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_vprintf=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_vprintf=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_VPRINTF 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +if test "$ac_cv_func_vprintf" != yes; then +echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 +echo "configure:2011: checking for _doprnt" >&5 +if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2016 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char _doprnt(); 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 _doprnt(); + +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__doprnt) || defined (__stub____doprnt) +choke me +#else +_doprnt(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func__doprnt=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func__doprnt=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_DOPRNT 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +fi + +for ac_func in dup2 strchr strrchr memchr memset putenv munmap strtol +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2066: 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 2071 "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:2094: \"$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 + +if test "$enable_timing" = "yes"; then + for ac_func in ftime gettimeofday +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2122: 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 2127 "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:2150: \"$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 + +fi + +# Check whether --with-system_zlib or --without-system_zlib was given. +if test "${with_system_zlib+set}" = set; then + withval="$with_system_zlib" + : +fi + + +# Check whether --with-zlib_libdir or --without-zlib_libdir was given. +if test "${with_zlib_libdir+set}" = set; then + withval="$with_zlib_libdir" + : +fi + + +# Check whether --with-zlib_include or --without-zlib_include was given. +if test "${with_zlib_include+set}" = set; then + withval="$with_zlib_include" + : +fi + + +if test "$needs_zlib" = no; then + ZLIBCPPFLAGS= + LDZLIB= + ZLIBDEP= +else + EXTRA_ZLIB_INCLUDE= + EXTRA_ZLIB_LIBDIR= + + if test "$with_system_zlib" = yes; then + if test "x$with_zlib_libdir" != x; then + EXTRA_ZLIB_LIBDIR="-L$with_zlib_libdir" + fi + if test "x$with_zlib_include" != x; then + EXTRA_ZLIB_INCLUDE="-I$with_zlib_include" + fi + fi + + OLD_LDFLAGS=$LDFLAGS + OLD_CPP=$CPP + OLD_LIBS=$LIBS + + LDFLAGS="$LDFLAGS $EXTRA_ZLIB_LIBDIR" + CPP="$CPP $EXTRA_ZLIB_INCLUDE" + + if test "$with_system_zlib" = yes; then + echo $ac_n "checking for inflate in -lz""... $ac_c" 1>&6 +echo "configure:2223: checking for inflate in -lz" >&5 +ac_lib_var=`echo z'_'inflate | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lz $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2231 "configure" +#include "confdefs.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 inflate(); + +int main() { +inflate() +; return 0; } +EOF +if { (eval echo configure:2242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo z | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lz $LIBS" + +else + echo "$ac_t""no" 1>&6 +echo "configure: warning: Standard ZLIB library not found. Compiling my own." 1>&2 + with_system_zlib=no +fi + + fi + + if test "$with_system_zlib" = yes; then + for ac_hdr in zlib.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2278: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2283 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2288: \"$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* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + if test "$ac_cv_header_zlib_h" != yes; then + echo "configure: warning: zlib.h not found. Using my own zlib sources." 1>&2 + with_system_zlib=no + fi + fi + + LDFLAGS=$OLD_LDFLAGS + CPP=$OLD_CPP + LIBS=$OLD_LIBS + + if test "$with_system_zlib" != yes; then + ZLIBCPPFLAGS='-I$(ZLIBDIR) -I$(ZLIBSRCDIR)' + LDZLIB='$(ZLIBDIR)/libz.a' + ZLIBDEP='$(ZLIBDIR)/libz.a' + using_system_zlib=no + else + ZLIBCPPFLAGS="$EXTRA_ZLIB_INCLUDE" + LDZLIB="$EXTRA_ZLIB_LIBDIR -lz" + ZLIBDEP= + using_system_zlib=yes + fi +fi + + + + + +# Check whether --with-system-pnglib or --without-system-pnglib was given. +if test "${with_system_pnglib+set}" = set; then + withval="$with_system_pnglib" + : +fi + + +# Check whether --with-pnglib_libdir or --without-pnglib_libdir was given. +if test "${with_pnglib_libdir+set}" = set; then + withval="$with_pnglib_libdir" + : +fi + + +# Check whether --with-pnglib_include or --without-pnglib_include was given. +if test "${with_pnglib_include+set}" = set; then + withval="$with_pnglib_include" + : +fi + + +if test "$needs_pnglib" = no; then + LIBPNGCPPFLAGS= + LDLIBPNG= + LIBPNGDEP= +else + EXTRA_LIBPNG_INCLUDE= + EXTRA_LIBPNG_LIBDIR= + + if test "$with_system_pnglib" = yes; then + if test "x$with_pnglib_libdir" != x; then + EXTRA_LIBPNG_LIBDIR="-L$with_pnglib_libdir" + fi + if test "x$with_pnglib_include" != x; then + EXTRA_LIBPNG_INCLUDE="-I$with_pnglib_include" + fi + fi + + OLD_LDFLAGS=$LDFLAGS + OLD_CPP=$CPP + OLD_LIBS=$LIBS + + LDFLAGS="$LDFLAGS $EXTRA_LIBPNG_LIBDIR" + CPP="$CPP $EXTRA_LIBPNG_INCLUDE" + + if test "$with_system_pnglib" = yes; then + echo $ac_n "checking for png_set_read_fn in -lpng""... $ac_c" 1>&6 +echo "configure:2388: checking for png_set_read_fn in -lpng" >&5 +ac_lib_var=`echo png'_'png_set_read_fn | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpng -lz -lm $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2396 "configure" +#include "confdefs.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 png_set_read_fn(); + +int main() { +png_set_read_fn() +; return 0; } +EOF +if { (eval echo configure:2407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + pnglib=-lpng +else + echo "$ac_t""no" 1>&6 +echo "configure: warning: Standard PNG library not found. Compiling my own." 1>&2 + with_system_pnglib=no +fi + + fi + + LDFLAGS=$OLD_LDFLAGS + CPP=$OLD_CPP + LIBS=$OLD_LIBS + + if test "$with_system_pnglib" != yes; then + LIBPNGCPPFLAGS='-I$(LIBPNGDIR) -I$(LIBPNGSRCDIR)' + LDLIBPNG='$(LIBPNGDIR)/libpng.a' + LIBPNGDEP='$(LIBPNGDIR)/libpng.a' + using_system_pnglib=no + else + LIBPNGCPPFLAGS="$EXTRA_LIBPNG_INCLUDE" + LDLIBPNG="$EXTRA_LIBPNG_LIBDIR -lpng" + LIBPNGDEP= + using_system_pnglib=yes + fi +fi + + + + + +# Check whether --with-system-t1lib or --without-system-t1lib was given. +if test "${with_system_t1lib+set}" = set; then + withval="$with_system_t1lib" + : +fi + + +# Check whether --with-t1lib_libdir or --without-t1lib_libdir was given. +if test "${with_t1lib_libdir+set}" = set; then + withval="$with_t1lib_libdir" + : +fi + + +# Check whether --with-t1lib_include or --without-t1lib_include was given. +if test "${with_t1lib_include+set}" = set; then + withval="$with_t1lib_include" + : +fi + + +if test "$needs_libt1" = no; then + LIBT1CPPFLAGS= + LDLIBT1= + LIBT1DEP= +else + EXTRA_LIBT1_INCLUDE= + EXTRA_LIBT1_LIBDIR= + + if test "$with_system_t1lib" = yes; then + if test "x$with_t1lib_libdir" != x; then + EXTRA_LIBT1_LIBDIR="-L$with_t1lib_libdir" + fi + if test "x$with_t1lib_include" != x; then + EXTRA_LIBT1_INCLUDE="-I$with_t1lib_include" + fi + fi + + OLD_LDFLAGS=$LDFLAGS + OLD_CPP=$CPP + OLDCPPFLAGS=$CPPFLAGS + OLD_LIBS=$LIBS + + LDFLAGS="$LDFLAGS $EXTRA_LIBT1_LIBDIR" + CPP="$CPP $EXTRA_LIBT1_INCLUDE" + CPPFLAGS="$CPPFLAGS $EXTRA_LIBT1_INCLUDE" + + if test "$with_system_t1lib" = yes; then + echo $ac_n "checking for T1_AddFont in -lt1""... $ac_c" 1>&6 +echo "configure:2501: checking for T1_AddFont in -lt1" >&5 +ac_lib_var=`echo t1'_'T1_AddFont | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lt1 -lz -lm $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2509 "configure" +#include "confdefs.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 T1_AddFont(); + +int main() { +T1_AddFont() +; return 0; } +EOF +if { (eval echo configure:2520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + t1lib=-lt1 +else + echo "$ac_t""no" 1>&6 +echo "configure: warning: Standard T1 library not found. Compiling my own." 1>&2 + with_system_t1lib=no +fi + + fi + + LIBS="-lt1 -lm $LIBS" + if test "$with_system_t1lib" = yes; then + echo $ac_n "checking whether installed T1 lib is >= v 5.0.0 ""... $ac_c" 1>&6 +echo "configure:2547: checking whether installed T1 lib is >= v 5.0.0 " >&5 + if test "$cross_compiling" = yes; then + ac_compile_t1lib=1 + ] +else + cat > conftest.$ac_ext <<EOF +#line 2553 "configure" +#include "confdefs.h" + +#include <stdlib.h> +#include "t1lib.h" +#define BUFLEN 128 +int main() { + char *t1libId = T1_GetLibIdent(); + char testbuf[BUFLEN]; + char *p = testbuf; + int i; + int version_num; + /* T1_GetLibIdent() might return something like '0.8-beta2'; + convert the leading numbers to a single digit: */ + for (i = 0; i < BUFLEN - 1; i++) { + if (t1libId[i] >= '0' && t1libId[i] <= '9') + *p++ = t1libId[i]; + else if (t1libId[i] != '.' && t1libId[i] != '_' && t1libId[i] != '-') + break; + } + *p = '\0'; + version_num = strtoul(testbuf, (char **)NULL, 10); + /* xdvik needs >= 5.0.0. + Try to deal with version strings with 1 or more digits. */ + if (version_num >= 500 + || (version_num < 100 && version_num >= 50) + || (version_num < 10 && version_num >= 5)) + exit(0); + exit(1); +} + +EOF +if { (eval echo configure:2585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_compile_t1lib=0 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_compile_t1lib=1 +fi +rm -fr conftest* +fi + + if test $ac_compile_t1lib = 0; then + echo "$ac_t""yes" 1>&6 + else + echo "$ac_t""no, will compile my own version" 1>&6 + with_system_t1lib=no + fi + fi + + LDFLAGS=$OLD_LDFLAGS + CPP=$OLD_CPP + CPPFLAGS=$OLDCPPFLAGS + LIBS=$OLD_LIBS + + if test "$with_system_t1lib" != yes; then + LIBT1CPPFLAGS='-I$(LIBT1DIR) -I$(LIBT1SRCDIR) -I$(LIBT1DIR)/../type1 -I$(LIBT1SRCDIR)/../type1' + LDLIBT1='$(LIBT1DIR)/libt1.a $(LIBT1DIR)/../type1/libtype1.a' + LIBT1DEP='$(LIBT1DIR)/libt1.a $(LIBT1DIR)/../type1/libtype1.a' + using_system_t1lib=no + else + LIBT1CPPFLAGS="$EXTRA_LIBT1_INCLUDE" + LDLIBT1="$EXTRA_LIBT1_LIBDIR -lt1" + LIBT1DEP= + using_system_t1lib=yes + fi +fi + + + + + +# Check whether --with-system_gd or --without-system_gd was given. +if test "${with_system_gd+set}" = set; then + withval="$with_system_gd" + : +fi + + +# Check whether --with-gd_libdir or --without-gd_libdir was given. +if test "${with_gd_libdir+set}" = set; then + withval="$with_gd_libdir" + : +fi + + +# Check whether --with-gd_include or --without-gd_include was given. +if test "${with_gd_include+set}" = set; then + withval="$with_gd_include" + : +fi + + +if test "$needs_gd" = no; then + GDCPPFLAGS= + LDGD= + GDDEP= +else + EXTRA_GD_INCLUDE= + EXTRA_GD_LIBDIR= + + if test "$with_system_gd" = yes; then + if test "x$with_gd_libdir" != x; then + EXTRA_GD_LIBDIR="-L$with_gd_libdir" + fi + if test "x$with_gd_include" != x; then + EXTRA_GD_INCLUDE="-I$with_gd_include" + fi + fi + + OLD_LDFLAGS=$LDFLAGS + OLD_CPP=$CPP + OLD_LIBS=$LIBS + + LDFLAGS="$LDFLAGS $EXTRA_GD_LIBDIR" + CPP="$CPP $EXTRA_GD_INCLUDE" + + if test "$with_system_gd" = yes; then + echo $ac_n "checking for gdImageCreateFromPng in -lgd""... $ac_c" 1>&6 +echo "configure:2674: checking for gdImageCreateFromPng in -lgd" >&5 +ac_lib_var=`echo gd'_'gdImageCreateFromPng | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lgd $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2682 "configure" +#include "confdefs.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 gdImageCreateFromPng(); + +int main() { +gdImageCreateFromPng() +; return 0; } +EOF +if { (eval echo configure:2693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo gd | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lgd $LIBS" + +else + echo "$ac_t""no" 1>&6 +echo "configure: warning: Standard gd library not found. Compiling my own." 1>&2 + with_system_gd=no +fi + + fi + + if test "$with_system_gd" = yes; then + echo $ac_n "checking for gdImageGif in -lgd""... $ac_c" 1>&6 +echo "configure:2726: checking for gdImageGif in -lgd" >&5 +ac_lib_var=`echo gd'_'gdImageGif | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lgd $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2734 "configure" +#include "confdefs.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 gdImageGif(); + +int main() { +gdImageGif() +; return 0; } +EOF +if { (eval echo configure:2745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo gd | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lgd $LIBS" + +else + echo "$ac_t""no" 1>&6 +echo "configure: warning: gd library does not have the necessary gif support. Compiling my own." 1>&2 + with_system_gd=no +fi + + fi + + if test "$with_system_gd" = yes; then + for ac_hdr in gd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2781: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2786 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2791: \"$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* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + if test "$ac_cv_header_gd_h" != yes; then + echo "configure: warning: gd.h not found. Using my own gd sources." 1>&2 + with_system_gd=no + fi + fi + + LDFLAGS=$OLD_LDFLAGS + CPP=$OLD_CPP + LIBS=$OLD_LIBS + + if test "$with_system_gd" != yes; then + GDCPPFLAGS='-I$(GDDIR) -I$(GDSRCDIR)' + LDGD='$(GDDIR)/libgd.a' + GDDEP='$(GDDIR)/libgd.a' + using_system_gd=no + else + GDCPPFLAGS="$EXTRA_GD_INCLUDE" + LDGD="$EXTRA_GD_LIBDIR -lgd" + GDDEP= + using_system_gd=yes + fi +fi + + + + + + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:2846: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + if test "x$USE_MAINTAINER_MODE" = xyes; then + MAINT= + else + MAINT='#M#' + fi + + + +echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6 +echo "configure:2865: checking for loader (symbol LD)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$LD" && LD=ld +cf_cv_subst_LD=$LD +fi + +LD=${cf_cv_subst_LD} +echo "$ac_t""$LD" 1>&6 + + +echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6 +echo "configure:2879: checking for archiver (symbol AR)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$AR" && AR=ar +cf_cv_subst_AR=$AR +fi + +AR=${cf_cv_subst_AR} +echo "$ac_t""$AR" 1>&6 + + +echo $ac_n "checking for archiver options (symbol ARFLAGS)""... $ac_c" 1>&6 +echo "configure:2893: checking for archiver options (symbol ARFLAGS)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_ARFLAGS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$ARFLAGS" && ARFLAGS=rc +cf_cv_subst_ARFLAGS=$ARFLAGS +fi + +ARFLAGS=${cf_cv_subst_ARFLAGS} +echo "$ac_t""$ARFLAGS" 1>&6 + + + +# Check whether --with-mktexmf-default or --without-mktexmf-default was given. +if test "${with_mktexmf_default+set}" = set; then + withval="$with_mktexmf_default" + : +else + with_mktexmf_default=yes +fi + +# Check whether --with-mktexpk-default or --without-mktexpk-default was given. +if test "${with_mktexpk_default+set}" = set; then + withval="$with_mktexpk_default" + : +else + with_mktexpk_default=yes +fi + +# Check whether --with-mktextfm-default or --without-mktextfm-default was given. +if test "${with_mktextfm_default+set}" = set; then + withval="$with_mktextfm_default" + : +else + with_mktextfm_default=yes +fi + +# Check whether --with-mkocp-default or --without-mkocp-default was given. +if test "${with_mkocp_default+set}" = set; then + withval="$with_mkocp_default" + : +else + with_mkocp_default=yes +fi + +# Check whether --with-mkofm-default or --without-mkofm-default was given. +if test "${with_mkofm_default+set}" = set; then + withval="$with_mkofm_default" + : +else + with_mkofm_default=yes +fi + +# Check whether --with-mktexfmt-default or --without-mktexfmt-default was given. +if test "${with_mktexfmt_default+set}" = set; then + withval="$with_mktexfmt_default" + : +fi + +# Check whether --with-mktextex-default or --without-mktextex-default was given. +if test "${with_mktextex_default+set}" = set; then + withval="$with_mktextex_default" + with_mktextex_default=yes +else + with_mktextex_default=no +fi + + +echo $ac_n "checking where the main texmf tree is located""... $ac_c" 1>&6 +echo "configure:2963: checking where the main texmf tree is located" >&5 +texmfmain= +if test "x$datadir" != 'x${prefix}/share'; then + # First case, datadir is defined... + eval p=\"$datadir\" + # Unconditionally set the directory, but... + texmfmain=`echo "$p/texmf" | sed 's,//*,/,g'` + # ... do complain if it wasn't found. + if test -d "$texmfmain"; then + echo "$ac_t"""$texmfmain"" 1>&6 + else + echo "$ac_t""not found" 1>&6 + echo "configure: warning: No texmf tree found at $texmfmain. + ***************************************************************** + * Error: The main texmf tree was not found. * + * If you do not have the files, you should be able to them from * + * the same place you got these sources from, or from one of the * + * CTAN hosts. * + ***************************************************************** + Winging it." 1>&2 + fi +else + # Second case, datadir is default... + if test "x$prefix" = "xNONE"; then + p="$ac_default_prefix" + else + eval p=\"$prefix\" + fi + for e in share/texmf lib/texmf texmf; do + if test -d "$p/$e"; then + texmfmain='${prefix}'/"$e" + break + fi + done + if test -z "$texmfmain" && test "x$prefix" = "xNONE"; then + # Still no texmfmain found, no prefix set, perhaps kpsewhich is + # installed and can help us out. + texmfmain=`kpsewhich --expand-path='$TEXMFMAIN'` 2>/dev/null + fi + texmfmain=`echo "$texmfmain" | sed 's,//*,/,g'` + if test -n "$texmfmain"; then + echo "$ac_t"""$texmfmain"" 1>&6 + else + eval texmfmain="$datadir/texmf" + echo "$ac_t""not found" 1>&6 + echo "configure: warning: The main texmf tree was not found at $texmfmain. + ***************************************************************** + * Error: The main texmf tree was not found. * + * Use the --datadir option to specify its parent directory. * + * If you do not have the files, you should be able to them from * + * the same place you got these sources from, or from one of the * + * CTAN hosts. * + ***************************************************************** + Winging it by pretending $texmfmain is correct." 1>&2 + fi +fi + + + +cat >> confdefs.h <<\EOF +#define HAVE_KPATHSEA_KPATHSEA_H 1 +EOF + + +echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 +echo "configure:3028: checking for main in -lm" >&5 +ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lm $LIBS" +cat > conftest.$ac_ext <<EOF +#line 3036 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:3043: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lm $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for basename in -lgen""... $ac_c" 1>&6 +echo "configure:3071: checking for basename in -lgen" >&5 +ac_lib_var=`echo gen'_'basename | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lgen $LIBS" +cat > conftest.$ac_ext <<EOF +#line 3079 "configure" +#include "confdefs.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 basename(); + +int main() { +basename() +; return 0; } +EOF +if { (eval echo configure:3090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo gen | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lgen $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + + + +ac_config_files="$ac_config_files Makefile" + +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" + + +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%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@GS@%$GS%g +s%@PSFONTS_O@%$PSFONTS_O%g +s%@CPP@%$CPP%g +s%@ALLOCA@%$ALLOCA%g +s%@ZLIBCPPFLAGS@%$ZLIBCPPFLAGS%g +s%@LDZLIB@%$LDZLIB%g +s%@ZLIBDEP@%$ZLIBDEP%g +s%@LIBPNGCPPFLAGS@%$LIBPNGCPPFLAGS%g +s%@LDLIBPNG@%$LDLIBPNG%g +s%@LIBPNGDEP@%$LIBPNGDEP%g +s%@LIBT1CPPFLAGS@%$LIBT1CPPFLAGS%g +s%@LDLIBT1@%$LDLIBT1%g +s%@LIBT1DEP@%$LIBT1DEP%g +s%@GDCPPFLAGS@%$GDCPPFLAGS%g +s%@LDGD@%$LDGD%g +s%@GDDEP@%$GDDEP%g +s%@MAINT@%$MAINT%g +s%@LD@%$LD%g +s%@AR@%$AR%g +s%@ARFLAGS@%$ARFLAGS%g +s%@texmfmain@%$texmfmain%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 + + + +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/dvipng/configure.in b/Build/source/texk/dvipng/configure.in new file mode 100644 index 00000000000..ff7aed99499 --- /dev/null +++ b/Build/source/texk/dvipng/configure.in @@ -0,0 +1,75 @@ +# Thomas Esser, for teTeX. All settings here are my fault, don't blame +# the dvipng maintainers for it. + +# Process this file with autoconf to produce a configure script. +AC_INIT(dvipng.c) +AC_DEFINE(PACKAGE_NAME, ["dvipng"]) +AC_DEFINE(PACKAGE_VERSION, ["1.6"]) +AC_DEFINE(PACKAGE_STRING, ["dvipng 1.6"]) + +# Checks for programs. +AC_SET_MAKE +AC_PROG_CC +AC_PROG_INSTALL +AC_PATH_PROG(GS, gs, :) +AC_DEFINE_UNQUOTED(GS_PATH, "$GS", [Define as the path to GhostScript.]) + +ac_cv_lib_t1_T1_InitLib=yes +PSFONTS_O="" +if test "$ac_cv_lib_t1_T1_InitLib" = yes; then + PSFONTS_O="t1.o" +fi +AC_SUBST(PSFONTS_O) + +if test -n "$PSFONTS_O"; then + PSFONTS_O="$PSFONTS_O enc.o fontmap.o tfm.o" +fi +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_HEADER_TIME +AC_CHECK_HEADERS([inttypes.h fcntl.h sys/time.h stdbool.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_PID_T +AC_TYPE_SIZE_T + +#if test "$ac_cv_header_inttypes_h" = yes; then + # Sometimes we want to use gcc -ansi -pedantic as a portability test + # The typedef of int64_t is not in the system header file in that + # case. Then, #define int64_t as "long long", which is non-ansi, but + # is present in most modern compilers. Using a #define rather than a + # typedef can be a problem, but in dvipng int64_t only is used as + # typecast, and there are no problems. + +# MY_CHECK_TYPE(int64_t, long long) +# MY_CHECK_TYPE(uint64_t, unsigned long long) +#fi + +# Checks for library functions. +AC_FUNC_ALLOCA +AC_FUNC_MMAP +AC_FUNC_VPRINTF +AC_CHECK_FUNCS([dup2 strchr strrchr memchr memset putenv munmap strtol]) +if test "$enable_timing" = "yes"; then + AC_CHECK_FUNCS([ftime gettimeofday]) +fi + +sinclude(../../libs/zlib/withenable.ac) +sinclude(../../libs/zlib/zlib.ac) +sinclude(../../libs/libpng/withenable.ac) +sinclude(../../libs/libpng/libpng.ac) +sinclude(../../libs/t1lib/withenable.ac) +sinclude(../../libs/t1lib/t1lib.ac) +sinclude(../../libs/gd/withenable.ac) +sinclude(../../libs/gd/gd.ac) +sinclude(../kpathsea/withenable.ac) + +AC_DEFINE(HAVE_KPATHSEA_KPATHSEA_H) + +AC_CHECK_LIB(m, main) +AC_CHECK_LIB(gen, basename) + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES(Makefile) +AC_OUTPUT diff --git a/Build/source/texk/dvipng/draw.c b/Build/source/texk/dvipng/draw.c new file mode 100644 index 00000000000..14eaadaf80f --- /dev/null +++ b/Build/source/texk/dvipng/draw.c @@ -0,0 +1,434 @@ +/* draw.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" + +/* #define NO_DRIFT */ + +#ifdef DEBUG +#include <ctype.h> /* isprint */ +#endif + +struct stack_entry { + dviunits h, v, w, x, y, z; /* stack entry */ +#ifndef NO_DRIFT + subpixels hh,vv; +#endif +} stack[STACK_SIZE]; /* stack */ +int sp = 0; /* stack pointer */ + +dviunits h; /* current horizontal position */ +dviunits v; /* current vertical position */ +dviunits w=0; /* current horizontal spacing */ +dviunits x=0; /* current horizontal spacing */ +dviunits y=0; /* current vertical spacing */ +dviunits z=0; /* current vertical spacing */ +#ifndef NO_DRIFT +subpixels hh; /* current rounded horizontal position */ +subpixels vv; /* current rounded vertical position */ +#else +# define hh PIXROUND(h,dvi->conv*shrinkfactor) +# define vv PIXROUND(v,dvi->conv*shrinkfactor) +#endif + + +#ifndef NO_DRIFT +#define MAXDRIFT 1 +#define CHECK_MAXDRIFT(x,xx) if ( xx-PIXROUND(x,dvi->conv*shrinkfactor) < -MAXDRIFT ) { \ + DEBUG_PRINT(DEBUG_DVI,(" add 1 to")); \ + xx += 1; \ + } \ + if ( xx-PIXROUND(x,dvi->conv*shrinkfactor) > MAXDRIFT ) { \ + DEBUG_PRINT(DEBUG_DVI,(" sub 1 to")); \ + xx -= 1; \ + } \ + if (PIXROUND(h,dvi->conv*shrinkfactor) != hh \ + || PIXROUND(v,dvi->conv*shrinkfactor) != vv) \ + DEBUG_PRINT(DEBUG_DVI,(" drift (%d,%d)", \ + hh-PIXROUND(h,dvi->conv*shrinkfactor), \ + vv-PIXROUND(v,dvi->conv*shrinkfactor))); +#define MoveRight(x) temp=x; h += temp; \ + if ( currentfont==NULL \ + || temp > currentfont->s/6 || temp < -currentfont->s/6*4 ) \ + hh = PIXROUND(h,dvi->conv*shrinkfactor); \ + else \ + hh += PIXROUND( temp,dvi->conv*shrinkfactor ); \ + CHECK_MAXDRIFT(h,hh) +#define MoveDown(x) temp=x; v += temp; \ + if ( currentfont==NULL \ + || temp > currentfont->s/6*5 || temp < currentfont->s/6*(-5) ) \ + vv = PIXROUND(v,dvi->conv*shrinkfactor); \ + else \ + vv += PIXROUND( temp,dvi->conv*shrinkfactor ); \ + CHECK_MAXDRIFT(v,vv) +#else +#define MoveRight(b) h += (dviunits) b +#define MoveDown(a) v += (dviunits) a +#endif + + +#define DO_VFCONV(a) ((((struct font_entry*) parent)->type==DVI_TYPE)?a:\ + (dviunits)((int64_t) a * ((struct font_entry*) parent)->s / (1 << 20))) + + +dviunits SetChar(int32_t c) +{ + struct char_entry* ptr; + + if (currentfont==NULL) + Fatal("faulty DVI, trying to set character from null font"); + ptr = currentfont->chr[c]; +#ifdef DEBUG + switch (currentfont->type) { + case FONT_TYPE_VF: DEBUG_PRINT(DEBUG_DVI,("\n VF CHAR:\t")); break; + case FONT_TYPE_PK: DEBUG_PRINT(DEBUG_DVI,("\n PK CHAR:\t")); break; + case FONT_TYPE_T1: DEBUG_PRINT(DEBUG_DVI,("\n T1 CHAR:\t")); break; + case FONT_TYPE_FT: DEBUG_PRINT(DEBUG_DVI,("\n FT CHAR:\t")); break; + } + if (isprint(c)) + DEBUG_PRINT(DEBUG_DVI,("'%c' ",c)); + DEBUG_PRINT(DEBUG_DVI,("%d at (%d,%d) tfmw %d", c,hh,vv,ptr->tfmw)); +#endif + if (currentfont->type==FONT_TYPE_VF) { + return(SetVF(c)); + } else if (ptr) { + if (ptr->data == NULL) + switch(currentfont->type) { + case FONT_TYPE_PK: LoadPK(c, ptr); break; +#ifdef HAVE_LIBT1 + case FONT_TYPE_T1: LoadT1(c, ptr); break; +#endif +#ifdef HAVE_FT2 + case FONT_TYPE_FT: LoadFT(c, ptr); break; +#endif + default: + Fatal("undefined fonttype %d",currentfont->type); + } + if (page_imagep != NULL) + return(SetGlyph(c, hh, vv)); + else { + /* Expand bounding box if necessary */ + min(x_min,hh - ptr->xOffset/shrinkfactor); + min(y_min,vv - ptr->yOffset/shrinkfactor); + max(x_max,hh - ptr->xOffset/shrinkfactor + ptr->w); + max(y_max,vv - ptr->yOffset/shrinkfactor + ptr->h); + return(ptr->tfmw); + } + } + return(0); +} + +void DrawCommand(unsigned char* command, void* parent /* dvi/vf */) + /* To be used both in plain DVI drawing and VF drawing */ +{ + dviunits temp; + + if (/*command >= SETC_000 &&*/ *command <= SETC_127) { + temp = SetChar((int32_t)*command); + h += temp; +#ifndef NO_DRIFT + hh += PIXROUND(temp,dvi->conv*shrinkfactor); + CHECK_MAXDRIFT(h,hh); +#endif + } else if (*command >= FONT_00 && *command <= FONT_63) { + SetFntNum((int32_t)*command - FONT_00,parent); + } else switch (*command) { + case PUT1: case PUT2: case PUT3: case PUT4: + DEBUG_PRINT(DEBUG_DVI,(" %d", + UNumRead(command+1, dvi_commandlength[*command]-1))); + (void) SetChar(UNumRead(command+1, dvi_commandlength[*command]-1)); + break; + case SET1: case SET2: case SET3: case SET4: + DEBUG_PRINT(DEBUG_DVI,(" %d", + UNumRead(command+1, dvi_commandlength[*command]-1))); + { + temp = SetChar(UNumRead(command+1, dvi_commandlength[*command]-1)); + h += temp; +#ifndef NO_DRIFT + hh += PIXROUND(temp,dvi->conv*shrinkfactor); + CHECK_MAXDRIFT(h,hh); +#endif + } + break; + case SET_RULE: + DEBUG_PRINT(DEBUG_DVI,(" %d %d", + UNumRead(command+1, 4), UNumRead(command+5, 4))); + temp = SetRule(DO_VFCONV(UNumRead(command+1, 4)), + DO_VFCONV(UNumRead(command+5, 4)), + hh, vv); + h += temp; +#ifndef NO_DRIFT + hh += PIXROUND(temp,dvi->conv*shrinkfactor); + CHECK_MAXDRIFT(h,hh); +#endif + break; + case PUT_RULE: + DEBUG_PRINT(DEBUG_DVI,(" %d %d", + UNumRead(command+1, 4), UNumRead(command+5, 4))); + (void) SetRule(DO_VFCONV(UNumRead(command+1, 4)), + DO_VFCONV(UNumRead(command+5, 4)), + hh, vv); + break; + case BOP: + Fatal("BOP occurs within page"); + break; + case EOP: + break; + case PUSH: + if (sp >= STACK_SIZE) + Fatal("DVI stack overflow"); + stack[sp].h = h; + stack[sp].v = v; + stack[sp].w = w; + stack[sp].x = x; + stack[sp].y = y; + stack[sp].z = z; +#ifndef NO_DRIFT + stack[sp].hh = hh; + stack[sp].vv = vv; +#endif + sp++; + break; + case POP: + --sp; + if (sp < 0) + Fatal("DVI stack underflow"); + h = stack[sp].h; + v = stack[sp].v; + w = stack[sp].w; + x = stack[sp].x; + y = stack[sp].y; + z = stack[sp].z; +#ifndef NO_DRIFT + hh = stack[sp].hh; + vv = stack[sp].vv; +#endif + break; + case RIGHT1: case RIGHT2: case RIGHT3: case RIGHT4: + DEBUG_PRINT(DEBUG_DVI,(" %d", + SNumRead(command+1, dvi_commandlength[*command]-1))); + MoveRight(DO_VFCONV(SNumRead(command+1, dvi_commandlength[*command]-1))); + break; + case W1: case W2: case W3: case W4: + w = SNumRead(command+1, dvi_commandlength[*command]-1); + DEBUG_PRINT(DEBUG_DVI,(" %d",w)); + case W0: + MoveRight(DO_VFCONV(w)); + break; + case X1: case X2: case X3: case X4: + x = SNumRead(command+1, dvi_commandlength[*command]-1); + DEBUG_PRINT(DEBUG_DVI,(" %d",x)); + case X0: + MoveRight(DO_VFCONV(x)); + break; + case DOWN1: case DOWN2: case DOWN3: case DOWN4: + DEBUG_PRINT(DEBUG_DVI,(" %d", + SNumRead(command+1, dvi_commandlength[*command]-1))); + MoveDown(DO_VFCONV(SNumRead(command+1, dvi_commandlength[*command]-1))); + break; + case Y1: case Y2: case Y3: case Y4: + y = SNumRead(command+1, dvi_commandlength[*command]-1); + DEBUG_PRINT(DEBUG_DVI,(" %d",y)); + case Y0: + MoveDown(DO_VFCONV(y)); + break; + case Z1: case Z2: case Z3: case Z4: + z = SNumRead(command+1, dvi_commandlength[*command]-1); + DEBUG_PRINT(DEBUG_DVI,(" %d",z)); + case Z0: + MoveDown(DO_VFCONV(z)); + break; + case FNT1: case FNT2: case FNT3: case FNT4: + DEBUG_PRINT(DEBUG_DVI,(" %d", + UNumRead(command+1, dvi_commandlength[*command]-1))); + SetFntNum(UNumRead(command+1, dvi_commandlength[*command]-1),parent); + break; + case XXX1: case XXX2: case XXX3: case XXX4: + DEBUG_PRINT(DEBUG_DVI,(" %d", + UNumRead(command+1, dvi_commandlength[*command]-1))); + SetSpecial((char*)command + dvi_commandlength[*command], + UNumRead(command+1, dvi_commandlength[*command]-1), + hh,vv); + break; + case FNT_DEF1: case FNT_DEF2: case FNT_DEF3: case FNT_DEF4: + if (((struct font_entry*)parent)->type==DVI_TYPE) { + FontDef(command, parent); + } else { + Fatal("%s within VF macro from %s",dvi_commands[*command], + ((struct font_entry*)parent)->name); + } + break; + case PRE: case POST: case POST_POST: + Fatal("%s occurs within page",dvi_commands[*command]); + break; + case NOP: + break; + default: + Fatal("%s is an undefined command",dvi_commands[*command]); + break; + } +} + +void BeginVFMacro(struct font_entry* currentvf) +{ + if (sp >= STACK_SIZE) + Fatal("stack overflow"); + stack[sp].h = h; + stack[sp].v = v; + stack[sp].w = w; + stack[sp].x = x; + stack[sp].y = y; + stack[sp].z = z; +#ifndef NO_DRIFT + stack[sp].hh = hh; + stack[sp].vv = vv; +#endif + sp++; + w = x = y = z = 0; + DEBUG_PRINT(DEBUG_DVI,("\n START VF:\tPUSH, W = X = Y = Z = 0")); + SetFntNum(currentvf->defaultfont,currentvf); +} + +void EndVFMacro(void) +{ + --sp; + if (sp < 0) + Fatal("stack underflow"); + h = stack[sp].h; + v = stack[sp].v; + w = stack[sp].w; + x = stack[sp].x; + y = stack[sp].y; + z = stack[sp].z; +#ifndef NO_DRIFT + hh = stack[sp].hh; + vv = stack[sp].vv; +#endif + DEBUG_PRINT(DEBUG_DVI,("\n END VF:\tPOP ")); +} + + +void DrawPage(dviunits hoffset, dviunits voffset) + /* To be used after having read BOP and will exit cleanly when + * encountering EOP. + */ +{ + unsigned char* command; /* current command */ + + h = hoffset; + v = voffset; + w = x = y = z = 0; +#ifndef NO_DRIFT + hh = PIXROUND( h , dvi->conv*shrinkfactor ); + vv = PIXROUND( v , dvi->conv*shrinkfactor ); +#endif + currentfont = NULL; /* No default font */ + + command=DVIGetCommand(dvi); + DEBUG_PRINT(DEBUG_DVI,("DRAW CMD:\t%s", dvi_commands[*command])); + while (*command != EOP) { + DrawCommand(command,dvi); + command=DVIGetCommand(dvi); + DEBUG_PRINT(DEBUG_DVI,("DRAW CMD:\t%s", dvi_commands[*command])); + } +} + +void DrawPages(void) +{ + struct page_list *dvi_pos; + pixels x_width,y_width,x_offset,y_offset; + + dvi_pos=NextPPage(dvi,NULL); + if (dvi_pos!=NULL) { + while(dvi_pos!=NULL) { + SeekPage(dvi,dvi_pos); + Message(BE_NONQUIET,"[%d", dvi_pos->count[(flags & DVI_PAGENUM)?0:10]); + if (dvi_pos->count[(flags & DVI_PAGENUM)?0:10]!=dvi_pos->count[0]) + Message(BE_NONQUIET," (%d)", dvi_pos->count[0]); + x_max = y_max = INT32_MIN; + x_min = y_min = INT32_MAX; + DrawPage((dviunits)0,(dviunits)0); + /* Store background color. Background color of a page is given + by the color at EOP rather than the color at BOP. */ + StoreBackgroundColor(dvi_pos); + /* Store pagesize */ + if (flags & PREVIEW_LATEX_TIGHTPAGE) { + x_width_def=x_width_tightpage; + y_width_def=y_width_tightpage; + x_offset_def=x_offset_tightpage; + y_offset_def=y_offset_tightpage; + } + if (x_width_def >= 0) { /* extend BBOX */ + min(x_min,-x_offset_def); + max(x_max,x_min + x_width_def); + min(y_min,-y_offset_def); + max(y_max,y_min + y_width_def); + } + if (x_width_def <= 0 || flags & EXPAND_BBOX) { + x_width = x_max-x_min; + y_width = y_max-y_min; + x_offset = -x_min; /* offset by moving topleft corner */ + y_offset = -y_min; /* offset by moving topleft corner */ + } else { + x_width=x_width_def; + y_width=y_width_def; + x_offset=x_offset_def; + y_offset=y_offset_def; + } + DEBUG_PRINT(DEBUG_DVI,("\n IMAGE:\t%dx%d",x_width,y_width)); + SeekPage(dvi,dvi_pos); + CreateImage(x_width,y_width); +#ifdef DEBUG + DEBUG_PRINT(DEBUG_DVI,("\n@%d PAGE START:\tBOP",dvi_pos->offset)); + { + int i; + for (i=0;i<10;i++) + DEBUG_PRINT(DEBUG_DVI,(" %d",dvi_pos->count[i])); + DEBUG_PRINT(DEBUG_DVI,(" (%d)\n",dvi_pos->count[10])); + } +#endif + Message(REPORT_DEPTH," depth=%d", y_width-y_offset-1); + Message(REPORT_HEIGHT," height=%d", y_offset+1); + DrawPage(x_offset*dvi->conv*shrinkfactor, + y_offset*dvi->conv*shrinkfactor); + if ( ! (flags & MODE_PICKY && flags & PAGE_GAVE_WARN )) { + WriteImage(dvi->outname,dvi_pos->count[(flags & DVI_PAGENUM)?0:10]); +#ifdef TIMING + ++ndone; +#endif + } else { + exitcode=EXIT_FAILURE; + Message(BE_NONQUIET,"(page not rendered)"); + DestroyImage(); + } + Message(BE_NONQUIET,"] "); + fflush(stdout); + flags &= ~PAGE_GAVE_WARN; + dvi_pos=NextPPage(dvi,dvi_pos); + } + Message(BE_NONQUIET,"\n"); + ClearPpList(); + } +} diff --git a/Build/source/texk/dvipng/dvi.c b/Build/source/texk/dvipng/dvi.c new file mode 100644 index 00000000000..26ae6f0ed03 --- /dev/null +++ b/Build/source/texk/dvipng/dvi.c @@ -0,0 +1,440 @@ +/* dvi.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#ifdef MIKTEX +# include <gnu-miktex.h> +# define SLEEP Sleep(1000) +#else /* MIKTEX */ +# ifdef HAVE_LIBGEN_H +# include <libgen.h> +# else +# define basename xbasename +#endif +# define SLEEP sleep(1) +#endif /* MIKTEX */ +#include <sys/stat.h> + +bool followmode=0; + +bool DVIFollowToggle() +{ + return followmode = ! followmode; +} + +static unsigned char fgetc_follow(FILE* fp) +{ + int got=fgetc(fp); + + while(followmode && got==EOF) { + SLEEP; + got=fgetc(fp); + } + if (got==EOF) + Fatal("DVI file ends prematurely"); + return (unsigned char)got; +} + +void DVIInit(struct dvi_data* dvi) +{ + int k; + unsigned char* pre; + struct stat stat; + + fseek(dvi->filep,0,SEEK_SET); + pre=DVIGetCommand(dvi); + if (*pre != PRE) { + Fatal("PRE does not occur first - are you sure this is a DVI file?"); + } + k = UNumRead(pre+1,1); + DEBUG_PRINT(DEBUG_DVI,("DVI START:\tPRE %d",k)); + if (k != DVIFORMAT) { + Fatal("DVI format = %d, can only process DVI format %d files", + k, DVIFORMAT); + } + dvi->num = UNumRead(pre+2, 4); + dvi->den = UNumRead(pre+6, 4); + DEBUG_PRINT(DEBUG_DVI,(" %d/%d",dvi->num,dvi->den)); + dvi->mag = UNumRead(pre+10, 4); /*FIXME, see font.c*/ + DEBUG_PRINT(DEBUG_DVI,(" %d",dvi->mag)); + if ( usermag > 0 && usermag != dvi->mag ) { + Warning("DVI magnification of %d over-ridden by user (%ld)", + (long)dvi->mag, usermag ); + dvi->mag = usermag; + } + dvi->conv = (1.0/(((double)dvi->num / (double)dvi->den) * + ((double)dvi->mag / 1000.0) * + ((double)dpi*shrinkfactor/254000.0)))+0.5; + DEBUG_PRINT(DEBUG_DVI,(" (%d)",dvi->conv)); + k = UNumRead(pre+14,1); + DEBUG_PRINT(DEBUG_DVI,(" '%.*s'",k,pre+15)); + Message(BE_VERBOSE,"'%.*s' -> %s\n",k,pre+15,dvi->outname); + fstat(fileno(dvi->filep), &stat); + dvi->mtime = stat.st_mtime; + dvi->pagelistp=NULL; +} + +struct dvi_data* DVIOpen(char* dviname,char* outname) +{ + char* tmpstring; + struct dvi_data* dvi; + + if ((dvi = calloc(1,sizeof(struct dvi_data)))==NULL) + Fatal("cannot allocate memory for DVI struct"); + + dvi->type = DVI_TYPE; + dvi->fontnump=NULL; + + dvi->name = malloc(strlen(dviname)+5); + if (dvi->name==NULL) + Fatal("cannot allocate space for DVI filename"); + strcpy(dvi->name, dviname); + tmpstring = strrchr(dvi->name, '.'); + if (tmpstring == NULL || strcmp(tmpstring,".dvi") != 0) + strcat(dvi->name, ".dvi"); + + if (outname==NULL) { + dvi->outname = malloc(strlen(basename(dviname))+7); + if (dvi->outname==NULL) { + free(dvi->name); + free(dvi); + Fatal("cannot allocate space for output filename"); + } + strcpy(dvi->outname,basename(dviname)); + tmpstring = strrchr(dvi->outname, '.'); + if (tmpstring != NULL) + *tmpstring = '\0'; + strcat(dvi->outname, "%d.png"); + } else { + dvi->outname = malloc(strlen(outname)+1); + if (dvi->outname==NULL) { + free(dvi->name); + free(dvi); + Fatal("cannot allocate space for output filename"); + } + strcpy(dvi->outname,outname); + } + + if ((dvi->filep = fopen(dvi->name,"rb")) == NULL) { + /* do not insist on .dvi */ + tmpstring = strrchr(dvi->name, '.'); + *tmpstring='\0'; + dvi->filep = fopen(dvi->name,"rb"); + } + while((dvi->filep == NULL) && followmode) { + SLEEP; + *tmpstring='.'; + if ((dvi->filep = fopen(dvi->name,"rb")) == NULL) { + /* do not insist on .dvi */ + *tmpstring='\0'; + dvi->filep = fopen(dvi->name,"rb"); + } + } + if (dvi->filep == NULL) { + free(dvi->name); + free(dvi->outname); + free(dvi); + perror(dviname); + exit (EXIT_FAILURE); + } + DEBUG_PRINT(DEBUG_DVI,("OPEN FILE\t%s", dvi->name)); + DVIInit(dvi); + return(dvi); +} + +unsigned char* DVIGetCommand(struct dvi_data* dvi) + /* This function reads in and stores the next dvi command. */ + /* Mmap is not appropriate here, we may want to read from + half-written files. */ +{ + static unsigned char command[STRSIZE]; + static unsigned char* lcommand = command; + unsigned char *current = command; + int length; + uint32_t strlength=0; + + DEBUG_PRINT(DEBUG_DVI,("\n@%ld ", ftell(dvi->filep))); + *(current++) = fgetc_follow(dvi->filep); + length = dvi_commandlength[*command]; + if (length < 0) + Fatal("undefined DVI op-code %d",*command); + while(current < command+length) + *(current++) = fgetc_follow(dvi->filep); + switch (*command) { + case XXX4: + strlength = *(current - 4); + case XXX3: + strlength = strlength * 256 + *(current - 3); + case XXX2: + strlength = strlength * 256 + *(current - 2); + case XXX1: + strlength = strlength * 256 + *(current - 1); + break; + case FNT_DEF1: case FNT_DEF2: case FNT_DEF3: case FNT_DEF4: + strlength = *(current - 1) + *(current - 2); + break; + case PRE: + strlength = *(current - 1); + break; + } + if (strlength > 0) { /* Read string */ + if (lcommand!=command) { + free(lcommand); + lcommand=command; + } + if (strlength + (uint32_t)length > (uint32_t)STRSIZE) { + /* string + command length exceeds that of buffer */ + if ((lcommand=malloc(length+strlength+1))==NULL) + Fatal("cannot allocate memory for DVI command"); + memcpy(lcommand,command,length); + current = lcommand + length; + } + while(current < lcommand+length+strlength) + *(current++) = fgetc_follow(dvi->filep); + return(lcommand); + } else + return(command); +} + + +uint32_t CommandLength(unsigned char* command) +{ + /* generally 2^32+5 bytes max, but in practice 32 bit numbers suffice */ + uint32_t length=0; + + length = dvi_commandlength[*command]; + switch (*command) { + case XXX1: case XXX2: case XXX3: case XXX4: + length += UNumRead(command + 1,length - 1); + break; + case FNT_DEF1: case FNT_DEF2: case FNT_DEF3: case FNT_DEF4: + length += *(command + length - 1) + *(command + length - 2); + break; + case PRE: + length += *(command + length - 1); + break; + } + return(length); +} + +void SkipPage(struct dvi_data* dvi) +{ + /* Skip present page */ + unsigned char* command; + + command=DVIGetCommand(dvi); + while (*command != EOP) { + switch (*command) { + case FNT_DEF1: case FNT_DEF2: case FNT_DEF3: case FNT_DEF4: + DEBUG_PRINT(DEBUG_DVI,("NOSKIP CMD:\t%s", dvi_commands[*command])); + FontDef(command,dvi); + break; + case XXX1: case XXX2: case XXX3: case XXX4: + DEBUG_PRINT(DEBUG_DVI,("NOSKIP CMD:\t%s %d", dvi_commands[*command], + UNumRead(command+1, dvi_commandlength[*command]-1))); + SetSpecial((char*)command + dvi_commandlength[*command], + UNumRead(command+1, dvi_commandlength[*command]-1), + 0,0); + break; + case BOP: case PRE: case POST: case POST_POST: + Fatal("%s occurs within page", dvi_commands[*command]); + break; +#ifdef DEBUG + default: + DEBUG_PRINT(DEBUG_DVI,("SKIP CMD:\t%s", dvi_commands[*command])); +#endif + } + command=DVIGetCommand(dvi); + } /* while */ + DEBUG_PRINT(DEBUG_DVI,("SKIP CMD:\t%s", dvi_commands[*command])); +} + +struct page_list* InitPage(struct dvi_data* dvi) +{ + /* Find page start, return pointer to page_list entry if found */ + struct page_list* tpagelistp=NULL; + unsigned char* command; + + command=DVIGetCommand(dvi); + /* Skip until page start or postamble */ + while((*command != BOP) && (*command != POST)) { + switch(*command) { + case FNT_DEF1: case FNT_DEF2: case FNT_DEF3: case FNT_DEF4: + DEBUG_PRINT(DEBUG_DVI,("NOPAGE CMD:\t%s", dvi_commands[*command])); + FontDef(command,dvi); + break; + case NOP: + DEBUG_PRINT(DEBUG_DVI,("NOPAGE CMD:\tNOP")); + break; + default: + Fatal("%s occurs outside page", dvi_commands[*command]); + } + command=DVIGetCommand(dvi); + } + if ((tpagelistp = + malloc(sizeof(struct page_list)+(csp+1-2)*sizeof(struct dvi_color)))==NULL) + Fatal("cannot allocate memory for new page entry"); + tpagelistp->next = NULL; + if ( *command == BOP ) { /* Init page */ + int i; + DEBUG_PRINT(DEBUG_DVI,("PAGE START:\tBOP")); + StoreColorStack(tpagelistp); + tpagelistp->offset = ftell(dvi->filep)-45; + for (i = 0; i <= 9; i++) { + tpagelistp->count[i] = UNumRead(command + 1 + i*4, 4); + DEBUG_PRINT(DEBUG_DVI,(" %d",tpagelistp->count[i])); + } + if (dvi->pagelistp==NULL) + tpagelistp->count[10] = 1; + else + tpagelistp->count[10] = dvi->pagelistp->count[10]+1; + DEBUG_PRINT(DEBUG_DVI,(" (%d)", tpagelistp->count[10])); + } else { + DEBUG_PRINT(DEBUG_DVI,("DVI END:\tPOST")); + tpagelistp->offset = ftell(dvi->filep)-1; + tpagelistp->count[0] = PAGE_POST; /* POST */ + tpagelistp->count[10] = PAGE_POST; /* POST */ + } + return(tpagelistp); +} + +int SeekPage(struct dvi_data* dvi, struct page_list* page) +{ + ReadColorStack(page); + return(fseek(dvi->filep, + page->offset+((page->count[0]==PAGE_POST) ? 1L : 45L), + SEEK_SET)); +} + +struct page_list* NextPage(struct dvi_data* dvi, struct page_list* page) +{ + struct page_list* tpagelistp; + + /* if page points to POST there is no next page */ + if (page!=NULL && page->count[0]==PAGE_POST) + return(NULL); + + /* If we have read past the last page in our current list or the + * list is empty, sneak a look at the next page + */ + if (dvi->pagelistp==NULL + || dvi->pagelistp->offset+45L < ftell(dvi->filep)) { + tpagelistp=dvi->pagelistp; + dvi->pagelistp=InitPage(dvi); + dvi->pagelistp->next=tpagelistp; + } + + if (page!=dvi->pagelistp) { + /* also works if page==NULL, we'll get the first page then */ + tpagelistp=dvi->pagelistp; + while(tpagelistp!=NULL && tpagelistp->next!=page) + tpagelistp=tpagelistp->next; + } else { + /* dvi->pagelistp points to the last page we've read so far, + * the last page that we know where it is, so to speak + * So look at the next + */ + (void)SeekPage(dvi,dvi->pagelistp); + SkipPage(dvi); + tpagelistp=dvi->pagelistp; + dvi->pagelistp=InitPage(dvi); + dvi->pagelistp->next=tpagelistp; + tpagelistp=dvi->pagelistp; + } + return(tpagelistp); +} + +struct page_list* PrevPage(struct dvi_data* dvi, struct page_list* page) +{ + return(page->next); +} + + +struct page_list* FindPage(struct dvi_data* dvi, int32_t pagenum, bool abspage) + /* Find first page of certain number, + absolute number if abspage is set */ +{ + struct page_list* page=NextPage(dvi, NULL); + + if (pagenum==PAGE_LASTPAGE || pagenum==PAGE_POST) { + while(page!=NULL && page->count[0]!=PAGE_POST) + page=NextPage(dvi,page); + if (pagenum==PAGE_LASTPAGE) + page=PrevPage(dvi,page); + } else + if (pagenum!=PAGE_FIRSTPAGE) + while(page != NULL && pagenum != page->count[abspage ? 0 : 10]) + page=NextPage(dvi,page); + return(page); +} + + +void DelPageList(struct dvi_data* dvi) +{ + struct page_list* temp; + + /* Delete the page list */ + + temp=dvi->pagelistp; + while(temp!=NULL) { + dvi->pagelistp=dvi->pagelistp->next; + free(temp); + temp=dvi->pagelistp; + } +} + +void DVIClose(struct dvi_data* dvi) +{ + if (dvi!=NULL) { + fclose(dvi->filep); + DelPageList(dvi); + free(dvi->outname); + free(dvi->name); + free(dvi); + } +} + +bool DVIReOpen(struct dvi_data* dvi) +{ + struct stat stat; + fstat(fileno(dvi->filep), &stat); + if (dvi->mtime != stat.st_mtime) { + fclose(dvi->filep); + dvi->filep=NULL; + DelPageList(dvi); + while(((dvi->filep = fopen(dvi->name,"rb")) == NULL) && followmode) { + SLEEP; + } + if (dvi->filep == NULL) { + perror(dvi->name); + exit(EXIT_FAILURE); + } + Message(PARSE_STDIN,"Reopened file\n"); + DEBUG_PRINT(DEBUG_DVI,("\nREOPEN FILE\t%s", dvi->name)); + DVIInit(dvi); + return(true); + } + return(false); +} diff --git a/Build/source/texk/dvipng/dvipng.1 b/Build/source/texk/dvipng/dvipng.1 new file mode 100644 index 00000000000..a0862bd5abe --- /dev/null +++ b/Build/source/texk/dvipng/dvipng.1 @@ -0,0 +1,483 @@ +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. | will give a +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to +.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' +.\" expand to `' in nroff, nothing in troff, for use with C<>. +.tr \(*W-|\(bv\*(Tr +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.hy 0 +.if n .na +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "DVIPNG 1" +.TH DVIPNG 1 "2005-04-04" "dvipng 1.6" "User commands" +.SH "NAME" +dvipng \- A DVI\-to\-PNG translator +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +dvipng [options] filename +.PP +dvipng [options] [filename] \- +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This program makes \s-1PNG\s0 and/or \s-1GIF\s0 graphics from \s-1DVI\s0 files as obtained +from TeX and its relatives. +.PP +If \s-1GIF\s0 support is enabled, \s-1GIF\s0 output is chosen by using the +\&\fBdvigif\fR binary or with the \fB\-\-gif\fR option. +.PP +The benefits of \fBdvipng\fR/\fBdvigif\fR include +.IP "\(bu" 4 +Speed. It is a very fast bitmap-rendering code for \s-1DVI\s0 files. On a +fairly low-end laptop, it takes less than a second to generate 150 +one-formula images. This makes dvipng suitable for generating large +amounts of images on\-the\-fly, as needed in preview\-latex, WeBWorK and +others. +.IP "\(bu" 4 +It does not read the postamble, so it can be started before TeX +finishes. There is a \-\-follow switch that makes dvipng wait at \s-1EOF\s0 for +further output, unless it finds the \s-1POST\s0 marker that indicates the end +of the \s-1DVI\s0. +.IP "\(bu" 4 +Interactive query of options. dvipng can read options interactively +through stdin, and all options are usable. It is even possible to change +the input file through this interface. +.IP "\(bu" 4 +Supports \s-1PK\s0, \s-1VF\s0, PostScript Type1, and TrueType fonts, color specials +and simple PostScript inclusion specials. +.IP "\(bu" 4 +and more... +.SH "OPTIONS" +.IX Header "OPTIONS" +Many of the parameterless options listed here can be turned off by +suffixing the option with a zero (\fB0\fR); for instance, to turn off +page reversal, use \fB\-r0\fR. Such options are marked with a trailing +\&\fB*\fR. +.IP "\fB\-\fR" 4 +.IX Item "-" +Read additional options from standard input after processing the command +line. +.IP "\fB\-\-help\fR" 4 +.IX Item "--help" +Print a usage message and exit. +.IP "\fB\-\-version\fR" 4 +.IX Item "--version" +Print the version number and exit. +.IP "\fB\-bd\fR \fInum\fR" 4 +.IX Item "-bd num" +.PD 0 +.IP "\fB\-bd\fR \fIcolor_spec\fR" 4 +.IX Item "-bd color_spec" +.IP "\fB\-bd '\fR\fInum\fR\fB \fR\fIcolor_spec\fR\fB'\fR" 4 +.IX Item "-bd 'num color_spec'" +.PD +Set the pixel width of the transparent border (default 0). Using this +option will make the image edges transparent, but it only affects pixels +with the background color. Giving a \fIcolor_spec\fR will set the +fallback color, to be used in viewers that cannot handle transparency +(the default is the background color). The color spec should be in +TeX color \especial syntax, e.g., 'rgb 1.0 0.0 0.0'. Setting the +fallback color makes the default border width 1 px. +.IP "\fB\-\-bdpi\fR \fInum\fR" 4 +.IX Item "--bdpi num" +Set the base (Metafont) resolution, both horizontal and vertical, to +\&\fInum\fR dpi (dots per inch). This option is necessary when manually +selecting Metafont mode with the \-\-mode option (see below). +.IP "\fB\-bg\fR \fIcolor_spec\fR" 4 +.IX Item "-bg color_spec" +Choose background color for the images. This option will be ignored if +there is a background color \especial in the \s-1DVI\s0. The color spec should +be in TeX color \especial syntax, e.g., 'rgb 1.0 0.0 0.0'. You can +also specify 'Transparent' or 'transparent' which will give you a +transparent background with the normal background as a fallback color. A +capitalized 'Transparent' will give a full-alpha transparency, while an +all-lowercase 'transparent' will give a simple fully transparent +background with non-transparent antialiased pixels. The latter would be +suitable for viewers who cannot cope with a true alpha channel. \s-1GIF\s0 +images do not support full alpha transparency, so in case of \s-1GIF\s0 output, +both variants will use the latter behaviour. +.IP "\fB\-d\fR \fInum\fR" 4 +.IX Item "-d num" +Set the debug flags, showing what dvipng (thinks it) is doing. This will +work unless dvipng has been compiled without the \fB\s-1DEBUG\s0\fR option +(not recommended). Set the flags as you need them, use \fB\-d \-1\fR as +the first option for maximum output. +.IP "\fB\-D\fR \fInum\fR" 4 +.IX Item "-D num" +Set the output resolution, both horizontal and vertical, to \fInum\fR +dpi (dots per inch). +.Sp +One may want to adjust this to fit a certain text font size (e.g., on +a web page), and for a text font height of \fIfont_px\fR pixels (in +Mozilla) the correct formula is +.Sp +.Vb 1 +\& <dpi> = <font_px> * 72.27 / 10 [px * TeXpt/in / TeXpt] +.Ve +.Sp +The last division by ten is due to the standard font height 10pt in +your document, if you use 12pt, divide by 12. Unfortunately, some +proprietary browsers have font height in pt (points), not pixels. You +have to rescale that to pixels, using the screen resolution (default +is usually 96 dpi) which means the formula is +.Sp +.Vb 1 +\& <font_px> = <font_pt> * 96 / 72 [pt * px/in / (pt/in)] +.Ve +.Sp +On some high-res screens, the value is instead 120 dpi. Good luck! +.IP "\fB\-\-depth*\fR" 4 +.IX Item "--depth*" +Report the depth of the image. This only works reliably when the +LaTeX style \fBpreview.sty\fR from preview-latex is used. It +reports the number of pixels from the bottom of the image to the +baseline of the image. This can be used for vertical positioning of the +image in, e.g., web documents, where one would use (Cascading +StyleSheets 1) +.Sp +.Vb 1 +\& <IMG SRC="<filename.png>" STYLE="vertical\-align: \-<depth>px"> +.Ve +.Sp +The depth is a negative offset in this case, so the minus sign is +necessary, and the unit is pixels (px). +.IP "\fB\-\-dvinum*\fR" 4 +.IX Item "--dvinum*" +Set this option to make the output page number be the TeX page +numbers rather than the physical page number. See the \fB\-o\fR switch. +.IP "\fB\-fg\fR \fIcolor_spec\fR" 4 +.IX Item "-fg color_spec" +Choose foreground color for the images. This option will be ignored if +there is a foreground color \especial in the \s-1DVI\s0. The color spec should +be in TeX color \especial syntax, e.g., 'rgb 1.0 0.0 0.0'. +.IP "\fB\-\-follow*\fR" 4 +.IX Item "--follow*" +Enable follow mode. One of the benefits of dvipng is that it does not +read the postamble, so it can be started before TeX finishes. This +switch makes dvipng wait at \s-1EOF\s0 for further output, unless it finds the +\&\s-1POST\s0 marker that indicates the end of the \s-1DVI\s0. This is similar to +\&\fBtail \-f\fR but for DVI-to-PNG conversion. +.IP "\fB\-\-freetype*\fR" 4 +.IX Item "--freetype*" +Enable/disable FreeType font rendering (default on). This option is +available if the FreeType2 font library was present at compilation time. +If this is the case, dvipng will have direct support for PostScript +Type1 and TrueType fonts internally, rather than using \fBgsftopk\fR +for rendering the fonts. If you have PostScript versions of Computer +Modern installed, there will be no need to generate bitmapped variants +on disk of these. Then, you can render images at different (and unusual) +resolutions without cluttering the disk with lots of bitmapped fonts. +Note that if you have both FreeType and T1lib on your system, FreeType +will be preferred by dvipng. If you for some reason would want to use +T1lib rendering, use this option. +.IP "\fB\-\-gamma\fR \fInum\fR" 4 +.IX Item "--gamma num" +Control the interpolation of colors in the greyscale anti-aliasing +color palette. Default value is 1.0. For 0 < \fInum\fR < 1, the +fonts will be lighter (more like the background), and for \fInum\fR > +1, the fonts will be darker (more like the foreground). +.IP "\fB\-\-gif*\fR" 4 +.IX Item "--gif*" +The images are output in the \s-1GIF\s0 format, if \s-1GIF\s0 support is +enabled. This is the default for the \fBdvigif\fR binary, which only +will be available when \s-1GIF\s0 support is enabled. See also the +\&\fB\-\-png\fR option. +.IP "\fB\-\-height*\fR" 4 +.IX Item "--height*" +Report the height of the image. This only works reliably when the +LaTeX style \fBpreview.sty\fR from preview-latex is used. It +reports the number of pixels from the top of the image to the +baseline of the image. The total height of the image is obtained as the +sum of the values reported from \-\-height and the \-\-depth. +.IP "\fB\-l [=]\fR\fInum\fR" 4 +.IX Item "-l [=]num" +The last page printed will be the first one numbered \fInum\fR. Default +is the last page in the document. If \fInum\fR is prefixed by an equals +sign, then it (and the argument to the \fB\-p\fR option, if specified) +is treated as a physical (absolute) page number, rather than a value to +compare with the TeX \fB\ecount0\fR values stored in the \s-1DVI\s0 file. +Thus, using \fB\-l =9\fR will end with the ninth page of the document, +no matter what the pages are actually numbered. +.IP "\fB\-\-mode\fR \fImode\fR" 4 +.IX Item "--mode mode" +Use \fImode\fR as the Metafont device name for the \s-1PK\s0 fonts (both for +path searching and font generation). This needs to be augmented with the +base device resolution, given with the \fB\-\-bdpi\fR option. See the +file <\fBftp://ftp.tug.org/tex/modes.mf\fR> for a list of resolutions and +mode names for most devices. +.IP "\fB\-M*\fR" 4 +.IX Item "-M*" +Turns off automatic \s-1PK\s0 font generation (\fImktexpk\fR). This will have +no effect when using PostScript fonts, since no \s-1PK\s0 font generation will +be done anyway. +.IP "\fB\-\-noghostscript*\fR" 4 +.IX Item "--noghostscript*" +This switch prohibits the internal call to GhostScript for displaying +PostScript specials. \fB\-\-noghostscript0\fR turns the call back on. +.IP "\fB\-\-nogssafer*\fR" 4 +.IX Item "--nogssafer*" +Normally, if GhostScript is used to render PostScript specials, the +GhostScript interpreter is run with the option \fB\-dSAFER\fR. The +\&\fB\-nogssafer\fR option runs GhostScript without \fB\-dSAFER\fR. The +\&\fB\-dSAFER\fR option in Ghostscript disables PostScript operators such +as deletefile, to prevent possibly malicious PostScript programs from +having any effect. +.IP "\fB\-o\fR \fIname\fR" 4 +.IX Item "-o name" +Send output to the file \fIname\fR. A single occurrence of \fB%d\fR or +\&\fB%01d\fR, ..., \fB%09d\fR will be exchanged for the physical +page number (this can be changed, see the \fB\-\-dvinum\fR switch). The +default output filename is \fIfile\fR\fB%d.png\fR where the input \s-1DVI\s0 +file was \fIfile\fR\fB.dvi\fR. +.IP "\fB\-O\fR \fIx\-offset\fR\fB,\fR\fIy\-offset\fR" 4 +.IX Item "-O x-offset,y-offset" +Move the origin by \fIx\-offset\fR,\fIy\-offset\fR, a comma-separated +pair of dimensions such as \fB.1in,\-.3cm\fR. +The origin of the page is shifted from the default position +(of one inch down, one inch to the right from the upper left corner of +the paper) by this amount. +.IP "\fB\-p [=]\fR\fInum\fR" 4 +.IX Item "-p [=]num" +The first page printed will be the first one numbered \fInum\fR. Default +is the first page in the document. If \fInum\fR is prefixed by an +equals sign, then it (and the argument to the \fB\-l\fR option, if +specified) is treated as a physical (absolute) page number, rather than +a value to compare with the TeX \fB\ecount0\fR values stored in the +\&\s-1DVI\s0 file. Thus, using \fB\-p =3\fR will start with the third page of +the document, no matter what the pages are actually numbered. +.IP "\fB\-\-picky*\fR" 4 +.IX Item "--picky*" +No images are output when a warning occurs. Normally, dvipng will +output an image in spite of a warning, but there may be something +missing in this image. One reason to use this option would be if you +have a more complete but slower fallback converter. Mainly, this is +useful for failed figure inclusion and unknown \especial occurrences, +but warnings will also occur for missing or unknown color specs and +missing \s-1PK\s0 fonts. +.IP "\fB\-\-png*\fR" 4 +.IX Item "--png*" +The images are output in the \s-1PNG\s0 format. This is the default for the +\&\fBdvipng\fR binary. See also the \fB\-\-gif\fR option. +.IP "\fB\-pp\fR \fIfirstpage\fR\fB\-\fR\fIlastpage\fR" 4 +.IX Item "-pp firstpage-lastpage" +Print pages \fIfirstpage\fR through \fIlastpage\fR; but not quite +equivalent to \fB\-p\fR \fIfirstpage\fR \fB\-l\fR \fIlastpage\fR. For example, +when rendering a book, there may be several instances of a page in the +\&\s-1DVI\s0 file (one in \f(CW\*(C`\efrontmatter\*(C'\fR, one in \f(CW\*(C`\emainmatter\*(C'\fR, and one +in \f(CW\*(C`\ebackmatter\*(C'\fR). In case of several pages matching, \fB\-pp\fR +\&\fIfirstpage\fR\fB\-\fR\fIlastpage\fR will render \fIall\fR pages that +matches the specified range, while \fB\-p\fR \fIfirstpage\fR \fB\-l\fR +\&\fIlastpage\fR will render the pages from the \fIfirst\fR occurrence +of \fIfirstpage\fR to the \fIfirst\fR occurrence of \fIlastpage\fR. +This is the (undocumented) behaviour of dvips. In dvipng you can give +both kinds of options, in which case you get all pages that matches the +range in \fB\-pp\fR between the pages from \fB\-p\fR to \fB\-l\fR. Also +multiple \fB\-pp\fR options accumulate, unlike \fB\-p\fR and \fB\-l\fR. +The \fB\-\fR separator can also be \fB:\fR. Note that \fB\-pp \-1\fR +will be interpreted as \*(L"all pages up to and including 1\*(R", if you want a +page numbered \-1 (only the table of contents, say) put \fB\-pp \-1\-\-1\fR, +or more readable, \fB\-pp \-1:\-1\fR. +.IP "\fB\-q*\fR" 4 +.IX Item "-q*" +Run quietly. Don't chatter about pages converted, etc. to standard +output; report no warnings (only errors) to standard error. +.IP "\fB\-Q\fR \fInum\fR" 4 +.IX Item "-Q num" +Set the quality to \fInum\fR. That is, choose the number of antialiasing +levels for \s-1PK\s0 and T1lib rendering to be \fInum\fR*\fInum\fR. The default +value is 4 which gives 16 levels of antialiasing for antialiased fonts +from these two. If FreeType is available, its rendering is unaffected by +this option. +.IP "\fB\-r*\fR" 4 +.IX Item "-r*" +Toggle output of pages in reverse/forward order. By default, the first +page in the \s-1DVI\s0 is output first. +.IP "\fB\-T\fR \fIimage_size\fR" 4 +.IX Item "-T image_size" +Set the image size to \fIimage_size\fR which can be either of +\&\fBbbox\fR, \fBtight\fR, or a comma-separated pair of dimensions +\&\fIhsize\fR,\fIvsize\fR such as \fB.1in,.3cm\fR. The default is +\&\fBbbox\fR which produces a \s-1PNG\s0 that includes all ink put on the page +and in addition the \s-1DVI\s0 origin, located 1in from the top and 1in from +the left edge of the paper. This usually gives whitespace above and to +the left in the produced image. The value \fBtight\fR will make dvipng +only include all ink put on the page, producing neat images. +This option overrides any papersize special in the \s-1DVI\s0 file. +.IP "\fB\-\-t1lib*\fR" 4 +.IX Item "--t1lib*" +Enable/disable T1lib font rendering (default on). This option is +available if the T1lib font library was present at compilation time. If +this is the case, dvipng will have direct support for PostScript Type1 +fonts internally, rather than using \fBgsftopk\fR for rendering the +fonts. If you have PostScript versions of Computer Modern installed, +there will be no need to generate bitmapped variants on disk of these. +Then, you can render images at different (and unusual) resolutions +without cluttering the disk with lots of bitmapped fonts. Note that if +you have both FreeType and T1lib on your system FreeType will be +preferred by dvipng, and if you for some reason rather want to use +T1lib, give the option \fB\-\-freetype0\fR (see above). +.IP "\fB\-\-truecolor*\fR" 4 +.IX Item "--truecolor*" +On systems with a fairly new \fBlibgd\fR, one can choose to generate +truecolor output. This will not be necessary in general unless you +include truecolor images via a PostScript special (i.e., the +\&\fBgraphics\fR or \fBgraphicx\fR package). It will lead to longer +execution time, mostly because more data is written to disk. +.IP "\fB\-v*\fR" 4 +.IX Item "-v*" +Enable verbose operation. This will currently indicate what fonts is +used, in addition to the usual output. +.IP "\fB\-x\fR \fInum\fR" 4 +.IX Item "-x num" +Set the x magnification ratio to \fInum\fR/1000. Overrides +the magnification specified in the \s-1DVI\s0 file. Must be between 10 and +100000. It is recommended that you use standard magstep values (1095, +1200, 1440, 1728, 2074, 2488, 2986, and so on) to help reduce the total +number of \s-1PK\s0 files generated. \fInum\fR may be a real number, not an +integer, for increased precision. +.IP "\fB\-z\fR \fInum\fR" 4 +.IX Item "-z num" +Set the \s-1PNG\s0 compression level to \fInum\fR. This option is enabled if +your \fBlibgd\fR is new enough. The default compression level is 1, +which selects maximum speed at the price of slightly larger PNGs. For an +older \fBlibgd\fR, the hard-soldered value 5 is used. The include file +\&\fBpng.h\fR says +``Currently, valid values range from 0 \- 9, corresponding directly to +the zlib compression levels 0 \- 9 (0 \- no compression, 9 \- \*(L"maximal\*(R" +compression). Note that tests have shown that zlib compression levels +3\-6 usually perform as well as level 9 for \s-1PNG\s0 images, and do +considerably fewer calculations. In the future, these values may not +correspond directly to the zlib compression levels.'' +.SH "NOTES" +.IX Header "NOTES" +The full manual is accessible in the info format, on most systems by typing +.PP +.Vb 1 +\& info dvipng +.Ve +.SH "COPYRIGHT" +.IX Header "COPYRIGHT" +This program is released under the \s-1GNU\s0 General Public License, see the +\&\s-1COPYING\s0 file in the dvipng distribution or +<\fBhttp://www.gnu.org/licenses/gpl.html\fR>. +.PP +Copyright (c) 2002\-2005 Jan\-Ake Larsson diff --git a/Build/source/texk/dvipng/dvipng.c b/Build/source/texk/dvipng/dvipng.c new file mode 100644 index 00000000000..e695b39d0cf --- /dev/null +++ b/Build/source/texk/dvipng/dvipng.c @@ -0,0 +1,170 @@ +/* dvipng.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +/********************************************************************** + **************************** Intro ********************************* + ********************************************************************** + * This program translates TeX's DVI-Code into Portable Network Graphics. + * + * Recipe: + * Take a simple dvi2?? converter, dvilj was found suitable. + * Read and relish the code of xdvi and dvips + * Choose a png-drawing library with a simple interface and support + * on many platforms: gd + * Stir, sprinkle with some insights of your own, and enjoy + * + ********************************************************************** + */ + +#define MAIN +#include "dvipng.h" + +#ifdef MIKTEX +# define main __cdecl Main +#endif /* MIKTEX */ +/**********************************************************************/ +/******************************* main *******************************/ +/**********************************************************************/ +int main(int argc, char ** argv) +{ + bool parsestdin; + +#ifdef TIMING +# ifdef HAVE_GETTIMEOFDAY + gettimeofday(&Tp, NULL); + timer = Tp.tv_sec + ((float)(Tp.tv_usec))/ 1000000.0; +# else +# ifdef HAVE_FTIME + ftime(&timebuffer); + timer = timebuffer.time + (float)(timebuffer.millitm) / 1000.0; +# endif +# endif +#endif + /* setbuf(stderr, NULL); */ + +#ifdef HAVE_LIBKPATHSEA + /* Use extra paths as used by dvips */ + kpse_set_program_name(argv[0],"dvips"); + /* If dvipng is not installed in the texmf tree, and _only_ + * SELFAUTO... is used in texmf.cnf, kpathsea will not find a) + * Virtual fonts b) ps2pk.map or psfonts.map c) PostScript fonts + * + * We adjust these things here + */ +# ifdef ENV_SELFAUTOLOC + putenv(ENV_SELFAUTOLOC); +# endif +# ifdef ENV_SELFAUTODIR + putenv(ENV_SELFAUTODIR); +# endif +# ifdef ENV_SELFAUTOPARENT + putenv(ENV_SELFAUTOPARENT); +# endif + kpse_set_program_enabled (kpse_pk_format, makeTexPK, kpse_src_compile); +#endif + + initcolor(); + parsestdin = DecodeArgs(argc, argv); + +#ifdef HAVE_LIBKPATHSEA + if (user_mfmode) + if (user_bdpi) + kpse_init_prog("DVIPNG", user_bdpi, user_mfmode, "cmr10"); + else { + Warning("--mfmode given without --bdpi"); + /* this will give a lot of warnings but... */ + kpse_init_prog("DVIPNG", 300, user_mfmode, "cmr10"); + } + else + kpse_init_prog("DVIPNG", 300, "cx", "cmr10"); +#endif + +#ifdef HAVE_FT2_OR_LIBT1 + InitPSFontMap(); +#endif + + DrawPages(); + + if (parsestdin) { + char line[STRSIZE]; + + printf("%s> ",dvi!=NULL?dvi->name:""); + fgets(line,STRSIZE,stdin); + while(!feof(stdin)) { + DecodeString(line); + if (dvi!=NULL) { + if (DVIReOpen(dvi)) + flags &= ~PREVIEW_LATEX_TIGHTPAGE; + DrawPages(); + } + printf("%s> ",dvi!=NULL?dvi->name:""); + fgets(line,STRSIZE,stdin); + } + printf("\n"); + } + +#ifdef TIMING +# ifdef HAVE_GETTIMEOFDAY + gettimeofday(&Tp, NULL); + timer = (Tp.tv_sec + (float)(Tp.tv_usec)/1000000.0) - timer; +# else +# ifdef HAVE_FTIME + ftime(&timebuffer); + timer = (timebuffer.time + (float)(timebuffer.millitm)/1000.0) - timer; +# endif +# endif + + if (ndone > 0) + fprintf(stderr, + "Time of complete run: %.2f s, %d page(s), %.4f s/page.\n", + timer, ndone, timer / ndone); + if (my_toc >= 0.0001) + fprintf(stderr, + "Thereof in TIC/TOC region %.5f s.\n",my_toc); +#endif + + ClearFonts(); + DVIClose(dvi); + ClearColorNames(); +#ifdef HAVE_FT2_OR_LIBT1 + ClearPSFontMap(); + ClearEncoding(); +#endif +#ifdef HAVE_FT2 + if (libfreetype!=NULL && FT_Done_FreeType(libfreetype)) + Fatal("an error occured during freetype destruction"); + libfreetype = NULL; +#endif +#ifdef HAVE_LIBT1 + if (libt1!=NULL && T1_CloseLib()) + Fatal("an error occured during t1lib destruction"); + libt1 = NULL; +#endif + + exit(exitcode); +} + + + diff --git a/Build/source/texk/dvipng/dvipng.h b/Build/source/texk/dvipng/dvipng.h new file mode 100644 index 00000000000..81c8556f6af --- /dev/null +++ b/Build/source/texk/dvipng/dvipng.h @@ -0,0 +1,563 @@ +/* dvipng.h */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#ifndef DVIPNG_H +#define DVIPNG_H +#include "config.h" + +#define STRSIZE 255 /* stringsize for file specifications */ + +#define FIRSTFNTCHAR 0 +#define LASTFNTCHAR 255 +#define NFNTCHARS LASTFNTCHAR+1 + +#define STACK_SIZE 100 /* DVI-stack size */ + +#define DEFAULT_GAMMA 1.0 + +/* Name of the program which is called to generate missing pk files */ +#define MAKETEXPK "mktexpk" + +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#else /* HAVE_INTTYPES_H */ +# ifndef __sgi +/* IRIX has the following types typedef'd in sys/types.h already, + * i.e., _old_ IRIX systems; newer ones have a working inttypes.h */ +typedef signed char int8_t; +typedef short int16_t; +typedef int int32_t; +#endif /* ! __sgi */ +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef long long int64_t; +typedef unsigned long long uint64_t; +#endif /* HAVE_INTTYPES_H */ + +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif + +#include <gd.h> + +#ifdef HAVE_KPATHSEA_KPATHSEA_H +# include <kpathsea/kpathsea.h> +#else +# error: kpathsea/kpathsea.h is missing from your system +#endif + +#ifdef HAVE_FT2 +#define HAVE_FT2_OR_LIBT1 +#include <ft2build.h> +#include FT_FREETYPE_H +#endif + +#ifdef HAVE_LIBT1 +#define HAVE_FT2_OR_LIBT1 +#include <t1lib.h> +#endif + +#ifdef HAVE_KPATHSEA_KPATHSEA_H +/* boolean is an enum type from kpathsea/types.h loaded in + kpathsea/kpathsea.h, use it as fallback */ +# define bool boolean +#else +# ifdef HAVE_STDBOOL_H +# include <stdbool.h> +# else +typedef int bool; +# ifndef true +# define true ((bool) 1) +# define false ((bool) 0) +# endif +# ifndef TRUE +# define TRUE true +# define FALSE false +# endif +# endif +#endif + +#ifndef HAVE_VPRINTF +# ifdef HAVE_DOPRNT +# define vfprintf(stream, message, args) _doprnt(message, args, stream) +# else +# error: vfprintf AND _doprnt are missing!!! + /* If we have neither, should fall back to fprintf with fixed args. */ +# endif +#endif + +/* Autoconf may define malloc to rpl_malloc, if the system does not + * have a GNU Libc-compatible malloc (for which malloc(0) gives a + * valid pointer). We don't need that (yet) */ +#ifdef malloc +# undef malloc +#endif + + +/*************************************************************/ +/************************* protos.h ************************/ +/*************************************************************/ + +typedef int pixels; +typedef int32_t subpixels; +typedef int32_t dviunits; + +#define MM_TO_PXL(x) (int)(((x)*resolution*10)/254) +#define PT_TO_PXL(x) (int)((int32_t)((x)*resolution*100l)/7224) +#define PT_TO_DVI(x) (int32_t)((x)*65536l) + +/*#define PIXROUND(x,c) ((((double)x+(double)(c>>1))/(double)c)+0.5)*/ +/*#define PIXROUND(x,c) (((x)+c)/(c))*/ +/*#define PIXROUND(x,c) ((x+c-1)/(c))*/ +/*#define PIXROUND(x,c) ((x)/(c))*/ +/* integer round to the nearest number, not towards zero */ +#define PIXROUND(num,den) ((num)>0 ? ((num)+(den)/2)/(den) : -(((den)/2-(num))/(den))) + +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif +#define TEMPSTR(s,a) { char* tmp=a; \ + if (tmp!=NULL) {\ + s=alloca(strlen(tmp)+1);strcpy(s,tmp);free(tmp);\ + } else \ + s=NULL;} + +/*************************************************************************/ + + +/********************************************************/ +/*********************** dvi.h ************************/ +/********************************************************/ + +#define DVI_TYPE 0 +struct dvi_data { /* dvi entry */ + int type; /* This is a DVI */ + struct dvi_data *next; + uint32_t num, den, mag; /* PRE command parameters */ + int32_t conv; /* computed from num and den */ + /* divide dvi units (sp) with conv to get mf device resolution */ + /* divide further with shrinkfactor to get true resolution */ + char * name; /* full name of DVI file */ + char * outname; /* output filename (basename) */ + FILE * filep; /* file pointer */ + time_t mtime; /* modification time */ + struct font_num *fontnump; /* DVI font numbering */ + struct page_list *pagelistp; /* DVI page list */ +}; + +#define PAGE_POST INT32_MAX +#define PAGE_LASTPAGE INT32_MAX-1 +#define PAGE_MAXPAGE INT32_MAX-2 /* assume no pages out of this range */ +#define PAGE_FIRSTPAGE INT32_MIN +#define PAGE_MINPAGE INT32_MIN+1 /* assume no pages out of this range */ + +struct dvi_color { + int red,green,blue; +}; + +struct page_list { + struct page_list* next; + int offset; /* file offset to BOP */ + int32_t count[11]; /* 10 dvi counters + absolute pagenum in file */ + int csp; /* color stack pointer at BOP */ + struct dvi_color cstack[2]; /* color stack at BOP, may be longer */ +}; + + + + +struct dvi_data* DVIOpen(char*,char*); +void DVIClose(struct dvi_data*); +bool DVIReOpen(struct dvi_data*); +struct page_list*FindPage(struct dvi_data*, int32_t, bool); +struct page_list*NextPage(struct dvi_data*, struct page_list*); +struct page_list*PrevPage(struct dvi_data*, struct page_list*); +int SeekPage(struct dvi_data*, struct page_list*); +bool DVIFollowToggle(void); +unsigned char* DVIGetCommand(struct dvi_data*); +uint32_t CommandLength(unsigned char*); + +/********************************************************/ +/********************** misc.h ************************/ +/********************************************************/ + +struct filemmap { +#ifdef MIKTEX + HANDLE hFile; + HANDLE hMap; +#else /* MIKTEX */ + int fd; +#endif /* MIKTEX */ + char* mmap; + size_t size; +}; + +bool DecodeArgs(int, char *[]); +void DecodeString(char *); +bool MmapFile (char *filename,struct filemmap *fmmap); +void UnMmapFile(struct filemmap* fmmap); + +void Message(int, char *fmt, ...); +void Warning(char *fmt, ...); +void Fatal(char *fmt, ...); + +int32_t SNumRead(unsigned char*, register int); +uint32_t UNumRead(unsigned char*, register int); + +bool MmapFile (char *filename,struct filemmap *fmmap); +void UnMmapFile(struct filemmap* fmmap); + + +/********************************************************/ +/*********************** font.h ***********************/ +/********************************************************/ +struct encoding { + struct encoding* next; + char* name; + char* charname[257]; +}; + +#ifdef HAVE_FT2_OR_LIBT1 +struct psfontmap { + struct psfontmap *next; + char *line,*psfile,*tfmname,*encname,*end; + struct encoding* encoding; +#ifdef HAVE_FT2 + FT_Matrix* ft_transformp; + FT_Matrix ft_transform; +#endif +#ifdef HAVE_LIBT1 + T1_TMATRIX* t1_transformp; + T1_TMATRIX t1_transform; +#endif +}; +#endif + +#define FONT_TYPE_PK 1 +#define FONT_TYPE_VF 2 +#define FONT_TYPE_FT 3 +#define FONT_TYPE_T1 4 +struct char_entry { /* PK/FT/T1 Glyph/VF Macro */ + dviunits tfmw; /* TFM width */ + unsigned char *data; /* glyph data, either pixel data + * (0=transp, 255=max ink) or VF macro */ + uint32_t length; /* Length of PK data or VF macro */ + /* Only used in pixel fonts */ + pixels w,h; /* width and height in pixels */ + subpixels xOffset, yOffset; /* x offset and y offset in subpixels */ + /* Only used in PK fonts */ + unsigned char *pkdata; /* Points to beginning of PK data */ + unsigned char flag_byte; /* PK flagbyte */ +}; + +struct font_entry { /* font entry */ + int type; /* PK/VF/Type1 ... */ + struct font_entry *next; + uint32_t c, s, d; + uint8_t a, l; + char n[STRSIZE]; /* FNT_DEF command parameters */ + int dpi; /* computed from s and d */ + char name[STRSIZE]; /* full name of PK/VF file */ + struct filemmap fmmap; /* file memory map */ + uint32_t magnification; /* magnification read from font file */ + uint32_t designsize; /* design size read from font file */ + void * chr[NFNTCHARS]; /* character information */ +#ifdef HAVE_FT2 + FT_Face face; /* Freetype2 face */ +#endif +#ifdef HAVE_LIBT1 + int T1id; /* T1lib font id */ +#endif +#ifdef HAVE_FT2_OR_LIBT1 + struct psfontmap* psfontmap; /* Font transformation */ +#endif + struct font_num *vffontnump; /* VF local font numbering */ + int32_t defaultfont; /* VF default font number */ +}; + +struct font_num { /* Font number. Different for VF/DVI, and several + font_num can point to one font_entry */ + struct font_num *next; + int32_t k; + struct font_entry *fontp; +}; + +void CheckChecksum(uint32_t, uint32_t, const char*); +void InitPK (struct font_entry *newfontp); +void DonePK(struct font_entry *oldfontp); +void InitVF (struct font_entry *newfontp); +void DoneVF(struct font_entry *oldfontp); + +void FontDef(unsigned char*, void* /* dvi/vf */); +void ClearFonts(void); +void SetFntNum(int32_t, void* /* dvi/vf */); +void FreeFontNumP(struct font_num *hfontnump); + +#ifdef HAVE_FT2_OR_LIBT1 +void InitPSFontMap(void); +void ClearPSFontMap(void); +struct psfontmap* FindPSFontMap(char*); +struct encoding* FindEncoding(char*); +void ClearEncoding(void); +bool ReadTFM(struct font_entry *, char*); +#endif + +#ifdef HAVE_FT2 +bool InitFT(struct font_entry *); +void DoneFT(struct font_entry *tfontp); +void LoadFT(int32_t, struct char_entry *); +#endif + +#ifdef HAVE_LIBT1 +bool InitT1(struct font_entry *); +void DoneT1(struct font_entry *tfontp); +void LoadT1(int32_t, struct char_entry *); +#endif + +/********************************************************/ +/********************* pplist.h ***********************/ +/********************************************************/ + +bool ParsePages(char*); +void FirstPage(int32_t,bool); +void LastPage(int32_t,bool); +void ClearPpList(void); +void Reverse(bool); +struct page_list* NextPPage(void* /* dvi */, struct page_list*); + + + + +#ifdef MAIN +#define EXTERN +#define INIT(x) =x +#else +#define EXTERN extern +#define INIT(x) +#endif + +/********************************************************/ +/********************** draw.h ************************/ +/********************************************************/ +#include "commands.h" + +void CreateImage(pixels width, pixels height); +void DestroyImage(void); +void DrawCommand(unsigned char*, void* /* dvi/vf */); +void DrawPages(void); +void WriteImage(char*, int); +void LoadPK(int32_t, register struct char_entry *); +int32_t SetChar(int32_t); +dviunits SetGlyph(int32_t c, int32_t hh,int32_t vv); +void Gamma(double gamma); +int32_t SetVF(int32_t); +int32_t SetRule(int32_t, int32_t, int32_t, int32_t); +void SetSpecial(char *, int32_t, int32_t, int32_t); +void BeginVFMacro(struct font_entry*); +void EndVFMacro(void); + +/**************************************************/ +void handlepapersize(char*,int32_t*,int32_t*); + +void stringrgb(char* colorstring,int *r,int *g,int *b); +void background(char *); +void initcolor(void); +void popcolor(void); +void pushcolor(char *); +void resetcolorstack(char *); +void StoreColorStack(struct page_list *tpagep); +void ReadColorStack(struct page_list *tpagep); +void StoreBackgroundColor(struct page_list *tpagep); +void ClearColorNames(void); + + +/**********************************************************************/ +/************************* Global Variables *************************/ +/**********************************************************************/ + +#ifdef MAKETEXPK +#ifdef HAVE_LIBKPATHSEA +EXTERN bool makeTexPK INIT(MAKE_TEX_PK_BY_DEFAULT); +#else +EXTERN bool makeTexPK INIT(_TRUE); +#endif +#endif + +EXTERN uint32_t usermag INIT(0); /* user specified magstep */ +EXTERN struct font_entry *hfontptr INIT(NULL); /* font list pointer */ + +EXTERN struct internal_state { + struct font_entry* currentfont; +} current_state; + +#define BE_NONQUIET 1 +#define BE_VERBOSE (1<<1) +#define PARSE_STDIN (1<<2) +#define EXPAND_BBOX (1<<3) +#define TIGHT_BBOX (1<<4) +#define CACHE_IMAGES (1<<5) +#define RENDER_TRUECOLOR (1<<6) +#define USE_FREETYPE (1<<7) +#define USE_LIBT1 (1<<8) +#define REPORT_HEIGHT (1<<9) +#define REPORT_DEPTH (1<<10) +#define DVI_PAGENUM (1<<11) +#define MODE_PICKY (1<<12) +#define PAGE_GAVE_WARN (1<<13) +#define PREVIEW_LATEX_TIGHTPAGE (1<<14) +#define GIF_OUTPUT (1<<15) +#define MODE_STRICT (1<<16) +#define NO_GHOSTSCRIPT (1<<17) +#define NO_GSSAFER (1<<18) +#define BG_TRANSPARENT (1<<19) +#define BG_TRANSPARENT_ALPHA (1<<20) +EXTERN uint32_t flags INIT(BE_NONQUIET | USE_FREETYPE | USE_LIBT1); + +#ifdef DEBUG +EXTERN unsigned int debug INIT(0); +#define DEBUG_PRINT(a,b) if (debug & a) { printf b; fflush(stdout); } +#define DEBUG_DVI 1 +#define DEBUG_VF (1<<1) +#define DEBUG_PK (1<<2) +#define DEBUG_TFM (1<<3) +#define DEBUG_GLYPH (1<<4) +#define DEBUG_FT (1<<5) +#define DEBUG_ENC (1<<6) +#define DEBUG_COLOR (1<<7) +#define DEBUG_T1 (1<<8) +#define DEBUG_GS (1<<9) +#define LASTDEBUG DEBUG_GS +#define DEBUG_DEFAULT DEBUG_DVI +#else +#define DEBUG_PRINT(a,b) +#endif + +/************************timing stuff*********************/ +#ifdef TIMING +#if TIME_WITH_SYS_TIME +# include <sys/time.h> +# include <time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif +EXTERN double timer INIT(0); +EXTERN double my_tic,my_toc INIT(0); +EXTERN int ndone INIT(0); /* number of pages converted */ +# ifdef HAVE_GETTIMEOFDAY +EXTERN struct timeval Tp; +# define TIC { gettimeofday(&Tp, NULL); \ + my_tic= (float)Tp.tv_sec + ((float)(Tp.tv_usec))/ 1000000.0;} +# define TOC { gettimeofday(&Tp, NULL); \ + my_toc += ((float)Tp.tv_sec + ((float)(Tp.tv_usec))/ 1000000.0) - my_tic;} +# else +# ifdef HAVE_FTIME +EXTERN struct timeb timebuffer; +# define TIC() { ftime(&timebuffer); \ + my_tic= timebuffer.time + (float)(timebuffer.millitm) / 1000.0; +# define TOC() { gettimeofday(&Tp, NULL); \ + my_toc += (timebuffer.time + (float)(timebuffer.millitm) / 1000.0) - my_tic;} +# else +# define TIC() +# define TOC() +# endif +# endif +#endif /* TIMING */ + +EXTERN char* user_mfmode INIT(NULL); +EXTERN int user_bdpi INIT(0); +EXTERN int dpi INIT(100); + +#ifdef HAVE_GDIMAGEPNGEX +EXTERN int compression INIT(1); +#endif +#ifdef MIKTEX +#undef min +#undef max +#endif /* MIKTEX */ +# define max(x,y) if ((y)>(x)) x = y +# define min(x,y) if ((y)<(x)) x = y + +/* These are in pixels*/ +EXTERN int x_min INIT(0); +EXTERN int y_min INIT(0); +EXTERN int x_max INIT(0); +EXTERN int y_max INIT(0); + +/* Page size: default set by -T */ +EXTERN int x_width_def INIT(0); +EXTERN int y_width_def INIT(0); + +/* Offset: default set by -O and -T bbox */ +EXTERN int x_offset_def INIT(0); +EXTERN int y_offset_def INIT(0); + +/* Preview-latex's tightpage */ +EXTERN int x_width_tightpage INIT(0); +EXTERN int y_width_tightpage INIT(0); +EXTERN int x_offset_tightpage INIT(0); +EXTERN int y_offset_tightpage INIT(0); + +/* Paper size: set by -t, for cropmark purposes only */ +/* This has yet to be written */ +EXTERN int x_pwidth INIT(0); +EXTERN int y_pwidth INIT(0); + +/* The transparent border preview-latex desires */ +EXTERN int borderwidth INIT(0); + +/* fallback color for transparent background */ +EXTERN bool userbordercolor INIT(FALSE); /* if true, use user-supplied color */ +EXTERN struct dvi_color bordercolor; + + +EXTERN gdImagePtr page_imagep INIT(NULL); +EXTERN int32_t shrinkfactor INIT(4); + +EXTERN struct dvi_color cstack[STACK_SIZE]; +EXTERN int csp INIT(1); + +EXTERN struct font_entry* currentfont; +EXTERN struct dvi_data* dvi INIT(NULL); + +#ifdef HAVE_FT2 +EXTERN FT_Library libfreetype INIT(NULL); +#endif + +#ifdef HAVE_LIBT1 +EXTERN void* libt1 INIT(NULL); +#endif + +#define EXIT_FATAL EXIT_FAILURE+1 +EXTERN int exitcode INIT(EXIT_SUCCESS); + +#endif /* DVIPNG_H */ diff --git a/Build/source/texk/dvipng/dvipng.help b/Build/source/texk/dvipng/dvipng.help new file mode 100644 index 00000000000..3e5983e4a17 --- /dev/null +++ b/Build/source/texk/dvipng/dvipng.help @@ -0,0 +1,45 @@ +This is dvipng 1.6 Copyright 2002-2005 Jan-Ake Larsson + +Usage: dvipng [OPTION]... FILENAME[.dvi] +Options are chosen to be similar to dvips' options where possible: + -d # Debug (# is the debug bitmap, 1 if not given) + -D # Output resolution + -l # Last page to be output + --mode s MetaFont mode (default 'cx') + -M* Don't make PK fonts + -o f Output file, '%d' is pagenumber + -O c Image offset + -p # First page to be output + -pp #,#.. Page list to be output + -q* Quiet operation + -r* Reverse order of pages + -T c Image size (also accepts '-T bbox' and '-T tight') + -v* Verbose operation + -x # Override dvi magnification + - Interactive query of options + +These do not correspond to dvips options: + -bd # Transparent border width in dots + -bd s Transparent border fallback color (TeX-style color) + --bdpi # Set the base (Metafont) resolution + -bg s Background color (TeX-style color or 'Transparent') + --depth* Output the image depth on stdout + --dvinum* Use TeX page numbers in output filenames + -fg s Foreground color (TeX-style color) + --follow* Follow mode + --gamma # Control color interpolation + --gif Output GIF images (dvigif default) + --height* Output the image height on stdout + --noghostscript* Don't use ghostscript for PostScript specials + --nogssafer* Don't use -dSAFER in ghostscript calls + --picky When a warning occurs, don't output image + --png Output PNG images (dvipng default) + --strict When a warning occurs, exit + --t1lib* T1lib font rendering (default on) + --truecolor* Truecolor output + -Q # Quality (T1lib and PK subsampling) + -z # PNG compression level + + # = number f = file s = string * = suffix, '0' to turn off + c = comma-separated dimension pair (e.g., 3.2in,-32.1cm) + diff --git a/Build/source/texk/dvipng/dvipng.info b/Build/source/texk/dvipng/dvipng.info new file mode 100644 index 00000000000..a575c11a9fd --- /dev/null +++ b/Build/source/texk/dvipng/dvipng.info @@ -0,0 +1,977 @@ +This is dvipng.info, produced by makeinfo version 4.8 from dvipng.texi. + +INFO-DIR-SECTION TeX +START-INFO-DIR-ENTRY +* DVI-to-PNG: (dvipng). Translating TeX DVI files to Portable Network Graphics (PNG). +* dvipng: (dvipng). A DVI-to-PNG translator. +END-INFO-DIR-ENTRY + + +File: dvipng.info, Node: Top, Next: Introduction, Up: (dir) + +dvipng +****** + +This manual documents dvipng, a program to translate a DVI (DeVice +Independent) file into PNG (Portable Network Graphics). + + This file documents dvipng version 1.6 + + Corrections or perhaps rewrites of sections are _very welcome_. + + Jan-AAke Larsson + +* Menu: + +* Introduction:: Introduction +* Installation:: How to compile and install dvipng +* Basic usage:: First things first +* Command-line options:: Advanced usage +* Diagnosing problems:: Problems? +* Color:: Using color with dvipng +* Copying:: GNU General Public License +* Credits:: People who have contributed +* Index:: General index + + +File: dvipng.info, Node: Introduction, Next: Installation, Prev: Top, Up: Top + +1 Introduction +************** + +This program makes PNG and/or GIF graphics from DVI files as obtained +from TeX and its relatives. + + If GIF support is enabled, GIF output is chosen by using the +`dvigif' binary or with the `--gif' option. + + It is intended to produce anti-aliased screen-resolution images as +fast as is possible. The target audience is people who need to generate +and regenerate many images again and again. The primary target is the +preview-latex (X)Emacs package, a package to preview formulas from +within (X)Emacs. Yes, you get to see your formulas in the (X)Emacs +buffer, see `http://preview-latex.sf.net'. + + Another example is WeBWorK, an internet-based method for delivering +homework problems to students over the internet, giving students +instant feedback as to whether or not their answers are correct, see +`http://webwork.math.rochester.edu'. + + Other applications may also benefit, like web applications as +latex2html and WYSIWYG editors like LyX. + + The benefits of `dvipng'/`dvigif' include + + * Speed. It is a very fast bitmap-rendering code for DVI files. On a + fairly low-end laptop, it takes less than a second to generate 150 + one-formula images. This makes dvipng suitable for generating large + amounts of images on-the-fly, as needed in preview-latex, WeBWorK + and others. + + * It does not read the postamble, so it can be started before TeX + finishes. There is a -follow switch that makes dvipng wait at EOF + for further output, unless it finds the POST marker that indicates + the end of the DVI. + + * Interactive query of options. dvipng can read options interactively + through stdin, and all options are usable. It is even possible to + change the input file through this interface. + + * Supports PK, VF, PostScript Type1, and TrueType fonts, color + specials and simple PostScript inclusion specials. + + * and more... + + + +File: dvipng.info, Node: Installation, Next: Basic usage, Prev: Introduction, Up: Top + +2 Installation +************** + +Installing dvipng should be simple: merely `./configure', `make', and +`make install'. + +* Menu: + +* Prerequisites:: +* Configure:: +* Build/install:: +* Installation outside the texmf tree:: +* Advice for non-privileged users:: + + +File: dvipng.info, Node: Prerequisites, Next: Configure, Up: Installation + +2.1 Prerequisites +================= + + * The GD Graphics Draw library, libgd + + The drawing library `libgd' is necessary, and is downloadable at + `http://www.boutell.com/gd', and there are binary packages for + most operating systems from their respective distributors. In any + case, the latest version of the library installs using `autoconf' + so it should not be difficult for you to install it from source, + and then proceed with installing dvipng. + + * The path-searching library kpathsea + + Kpathsea is most likely included in your LaTeX installation, but it + may happen that ./configure does not find it; see below. If you do + not have it, download it from `http://www.ctan.org' and compile it. + I have no experience with this, so I cannot help much here. + + * FreeType 2 and/or T1lib + + While not strictly necessary, you may want to have FreeType 2 or + T1lib available. Their presence will enable direct support for + PostScript fonts in dvipng, rather than using `gsftopk' for + rendering the fonts. If you have PostScript versons of Computer + Modern installed, there will be no need to generate bitmapped + variants on disk of these. Then, you can render images at + different (and unusual) resolutions without cluttering the disk + with lots of bitmapped fonts. If both FreeType 2 and T1lib are + present, FreeType will be internally preferred by dvipng, but + T1lib can be chosen at runtime. + + * libpng and libz + + To be able to compress and write PNG files to disk, dvipng (or + really libgd) uses libpng which in turn uses libz. These should be + available on any modern system, if not, download them and install + them. + + * The `texinfo' package + + This is needed for building the documentation. + + +File: dvipng.info, Node: Configure, Next: Build/install, Prev: Prerequisites, Up: Installation + +2.2 Configure +============= + +The first step is to configure the source code, telling it where +various files will be. To do so, run + + ./configure OPTIONS + + (Note: if you have fetched dvipng from CVS rather than a regular +release, you will have to first generate `./configure' by running +`autoconf' 2.53 or later in the `preview' directory.) + + On many machines, you will not need to specify any options, but if +`configure' cannot determine something on its own, you'll need to help +it out. For a list of the options type + + ./configure --help + + On some machines, the libraries will be installed in directories that +are not in the linker's search path. This will generate an error when +running `./configure', indicating that it cannot find libgd or +libkpathsea (most likely). You then need to specify the path to the +respective library's object files. They are typically called e.g., +`libgd.a' or `libgd.so'. If they are located in e.g., `/sw/local/lib', +do + + ./configure LDFLAGS=-L/sw/local/lib + + If the library is available as a shared object file (`.so'), the +runtime linker may also need to be told where to find the library, then +use + + ./configure LDFLAGS='-L/sw/local/lib -R/sw/local/lib' + + When either of these is necessary, it is likely that the C header +files are also installed in directories that are not in the C +preprocessor's search path. This will also generate an error when +running `./configure', indicating that it cannot find e.g., `gd.h' or +`kpathsea.h' (most likely). You then need to specify the path to the +respective library's C header files. If they are located in e.g., +`/sw/local/include', do + + ./configure CPPFLAGS=-I/sw/local/include + + On my SUN Solaris workstation, I had to combine this into + + ./configure CPPFLAGS='-I/sw/local/include -I/sw/tex/teTeX/1.0/include'\ + LDFLAGS='-L/sw/local/lib -R/sw/local/lib -L/sw/tex/teTeX/1.0/lib/' + +where the backslash denotes a continuation of the line. + + +File: dvipng.info, Node: Build/install, Next: Installation outside the texmf tree, Prev: Configure, Up: Installation + +2.3 Build/install +================= + +Once `configure' has been run, simply enter + + make + at the prompt to compile the C code, and build the documentation +files. To install the files into the locations chosen earlier, type + + make install + +You may need special privileges to install, e.g., if you are installing +into system directories. + + +File: dvipng.info, Node: Installation outside the texmf tree, Next: Advice for non-privileged users, Prev: Build/install, Up: Installation + +2.4 Installation outside the texmf tree +======================================= + +In some cases, a dvipng binary installed outside the texmf tree will +not be able to find virtual fonts, or the PostScript font maps +(normally used by dvips). This may be because _only_ $SELFAUTOLOC, +$SELFAUTODIR, and $SELFAUTOPARENT are used in the texmf tree +configuration file `texmf.cnf'. If so, give the switch +`--enable-selfauto-set' to `./configure'. This will make dvipng adjust +these three internally so that kpathsea thinks that dvipng _is_ +installed in the texmf tree. + + +File: dvipng.info, Node: Advice for non-privileged users, Prev: Installation outside the texmf tree, Up: Installation + +2.5 Installation for non-privileged users +========================================= + +Often people without system administration privileges want to install +software for their private use. In that case you need to specify more +options to the `configure' script, usually this is done by using the +`--prefix' option to the `configure' script, and let it point to the +personal home directory. In that way, resulting binaries will be +installed under the `bin' subdirectory of your home directory, manual +pages under `man' and so on. That way, it is reasonably easy to +maintain a bunch of additional packages, since the prefix argument is +supported by most `configure' scripts. + + You'll have to add something like `/home/myself/bin' to your `PATH' +shell variable, if it isn't there already, and similarly set the +`INFOPATH' variable to be able to access the documentation. + + +File: dvipng.info, Node: Basic usage, Next: Command-line options, Prev: Installation, Up: Top + +3 Basic usage of dvipng +*********************** + +To use dvipng at its simplest, simply type + + dvipng foo + +where `foo.dvi' is the output of TeX that you want to convert to PNG +format. If there are four pages in `foo.dvi', those pages will be +output as `foo1.png', `foo2.png', `foo3.png', and `foo4.png', +respectively. + + If you have enabled the PostScript font support (via FreeType or +T1lib), fonts will be rendered as they are needed. Otherwise, if you +use fonts that have not been used on your system before, they may be +automatically generated; this process can take a few minutes, so +progress reports appear by default. The next time the same font is +used, it will have been saved on disk, so rendering will go much +faster. (If dvipng tries to endlessly generate the same fonts over and +over again, something is wrong. *Note Unable to generate fonts: +(kpathsea)Unable to generate fonts.) + + Many options are available (see the next section). For a brief +summary of available options, just type + + dvipng --help + + +File: dvipng.info, Node: Command-line options, Next: Diagnosing problems, Prev: Basic usage, Up: Top + +4 Command-line options +********************** + +dvipng has a plethora of command line options. Reading through this +section will give a good idea of the capabilities of the driver. + +* Menu: + +* Option summary:: Quick listing, from dvipng --help. +* Option details:: More information about each option. + + +File: dvipng.info, Node: Option summary, Next: Option details, Up: Command-line options + +4.1 Option summary +================== + +Here is a handy summary of the options; it is printed out when you run +dvipng with no arguments or with the standard `--help' option. + + This is dvipng 1.6 Copyright 2002-2005 Jan-Ake Larsson + + Usage: dvipng [OPTION]... FILENAME[.dvi] + Options are chosen to be similar to dvips' options where possible: + -d # Debug (# is the debug bitmap, 1 if not given) + -D # Output resolution + -l # Last page to be output + --mode s MetaFont mode (default 'cx') + -M* Don't make PK fonts + -o f Output file, '%d' is pagenumber + -O c Image offset + -p # First page to be output + -pp #,#.. Page list to be output + -q* Quiet operation + -r* Reverse order of pages + -T c Image size (also accepts '-T bbox' and '-T tight') + -v* Verbose operation + -x # Override dvi magnification + - Interactive query of options + + These do not correspond to dvips options: + -bd # Transparent border width in dots + -bd s Transparent border fallback color (TeX-style color) + --bdpi # Set the base (Metafont) resolution + -bg s Background color (TeX-style color or 'Transparent') + --depth* Output the image depth on stdout + --dvinum* Use TeX page numbers in output filenames + -fg s Foreground color (TeX-style color) + --follow* Follow mode + --gamma # Control color interpolation + --gif Output GIF images (dvigif default) + --height* Output the image height on stdout + --noghostscript* Don't use ghostscript for PostScript specials + --nogssafer* Don't use -dSAFER in ghostscript calls + --picky When a warning occurs, don't output image + --png Output PNG images (dvipng default) + --strict When a warning occurs, exit + --t1lib* T1lib font rendering (default on) + --truecolor* Truecolor output + -Q # Quality (T1lib and PK subsampling) + -z # PNG compression level + + # = number f = file s = string * = suffix, '0' to turn off + c = comma-separated dimension pair (e.g., 3.2in,-32.1cm) + + +File: dvipng.info, Node: Option details, Prev: Option summary, Up: Command-line options + +4.2 Option details +================== + +Many of the parameterless options listed here can be turned off by +suffixing the option with a zero (`0'); for instance, to turn off page +reversal, use `-r0'. Such options are marked with a trailing `*'. + +`-' + Read additional options from standard input after processing the + command line. + +`--help' + Print a usage message and exit. + +`--version' + Print the version number and exit. + +`-bd NUM' + +`-bd COLOR_SPEC' + +`-bd 'NUM COLOR_SPEC'' + Set the pixel width of the transparent border (default 0). Using + this option will make the image edges transparent, but it only + affects pixels with the background color. Giving a COLOR_SPEC will + set the fallback color, to be used in viewers that cannot handle + transparency (the default is the background color). The color spec + should be in TeX color \special syntax, e.g., 'rgb 1.0 0.0 0.0'. + Setting the fallback color makes the default border width 1 px. + *Note Color::. + +`--bdpi NUM' + Set the base (Metafont) resolution, both horizontal and vertical, + to NUM dpi (dots per inch). This option is necessary when manually + selecting Metafont mode with the -mode option (see below). + +`-bg COLOR_SPEC' + Choose background color for the images. This option will be + ignored if there is a background color \special in the DVI. The + color spec should be in TeX color \special syntax, e.g., 'rgb 1.0 + 0.0 0.0'. You can also specify 'Transparent' or 'transparent' + which will give you a transparent background with the normal + background as a fallback color. A capitalized 'Transparent' will + give a full-alpha transparency, while an all-lowercase + 'transparent' will give a simple fully transparent background with + non-transparent antialiased pixels. The latter would be suitable + for viewers who cannot cope with a true alpha channel. GIF images + do not support full alpha transparency, so in case of GIF output, + both variants will use the latter behaviour. *Note Color::. + +`-d NUM' + Set the debug flags, showing what dvipng (thinks it) is doing. + This will work unless dvipng has been compiled without the `DEBUG' + option (not recommended). Set the flags as you need them, use `-d + -1' as the first option for maximum output. *Note Debug options::. + +`-D NUM' + Set the output resolution, both horizontal and vertical, to NUM + dpi (dots per inch). + + One may want to adjust this to fit a certain text font size (e.g., + on a web page), and for a text font height of FONT_PX pixels (in + Mozilla) the correct formula is + DPI = FONT_PX * 72.27 / 10 [px * TeXpt/in / TeXpt] + The last division by ten is due to the standard font height 10pt in + your document, if you use 12pt, divide by 12. Unfortunately, some + proprietary browsers have font height in pt (points), not pixels. + You have to rescale that to pixels, using the screen resolution + (default is usually 96 dpi) which means the formula is + FONT_PX = FONT_PT * 96 / 72 [pt * px/in / (pt/in)] + On some high-res screens, the value is instead 120 dpi. Good luck! + +`--depth*' + Report the depth of the image. This only works reliably when the + LaTeX style `preview.sty' from preview-latex is used. It reports + the number of pixels from the bottom of the image to the baseline + of the image. This can be used for vertical positioning of the + image in, e.g., web documents, where one would use (Cascading + StyleSheets 1) + <IMG SRC="FILENAME.PNG" STYLE="vertical-align: -DEPTHpx"> + The depth is a negative offset in this case, so the minus sign is + necessary, and the unit is pixels (px). + +`--dvinum*' + Set this option to make the output page number be the TeX page + numbers rather than the physical page number. See the `-o' switch. + +`-fg COLOR_SPEC' + Choose foreground color for the images. This option will be + ignored if there is a foreground color \special in the DVI. The + color spec should be in TeX color \special syntax, e.g., 'rgb 1.0 + 0.0 0.0'. *Note Color::. + +`--follow*' + Enable follow mode. One of the benefits of dvipng is that it does + not read the postamble, so it can be started before TeX finishes. + This switch makes dvipng wait at EOF for further output, unless it + finds the POST marker that indicates the end of the DVI. This is + similar to `tail -f' but for DVI-to-PNG conversion. + +`--freetype*' + Enable/disable FreeType font rendering (default on). This option is + available if the FreeType2 font library was present at compilation + time. If this is the case, dvipng will have direct support for + PostScript Type1 and TrueType fonts internally, rather than using + `gsftopk' for rendering the fonts. If you have PostScript versions + of Computer Modern installed, there will be no need to generate + bitmapped variants on disk of these. Then, you can render images + at different (and unusual) resolutions without cluttering the disk + with lots of bitmapped fonts. Note that if you have both FreeType + and T1lib on your system, FreeType will be preferred by dvipng. If + you for some reason would want to use T1lib rendering, use this + option. + +`--gamma NUM' + Control the interpolation of colors in the greyscale anti-aliasing + color palette. Default value is 1.0. For 0 < NUM < 1, the fonts + will be lighter (more like the background), and for NUM > 1, the + fonts will be darker (more like the foreground). + +`--gif*' + The images are output in the GIF format, if GIF support is + enabled. This is the default for the `dvigif' binary, which only + will be available when GIF support is enabled. See also the + `--png' option. + +`--height*' + Report the height of the image. This only works reliably when the + LaTeX style `preview.sty' from preview-latex is used. It reports + the number of pixels from the top of the image to the baseline of + the image. The total height of the image is obtained as the sum of + the values reported from -height and the -depth. + +`-l [=]NUM' + The last page printed will be the first one numbered NUM. Default + is the last page in the document. If NUM is prefixed by an equals + sign, then it (and the argument to the `-p' option, if specified) + is treated as a physical (absolute) page number, rather than a + value to compare with the TeX `\count0' values stored in the DVI + file. Thus, using `-l =9' will end with the ninth page of the + document, no matter what the pages are actually numbered. + +`--mode MODE' + Use MODE as the Metafont device name for the PK fonts (both for + path searching and font generation). This needs to be augmented + with the base device resolution, given with the `--bdpi' option. + See the file `ftp://ftp.tug.org/tex/modes.mf' for a list of + resolutions and mode names for most devices. *Note Unable to + generate fonts: (kpathsea)Unable to generate fonts. + +`-M*' + Turns off automatic PK font generation (`mktexpk'). This will have + no effect when using PostScript fonts, since no PK font generation + will be done anyway. + +`--noghostscript*' + This switch prohibits the internal call to GhostScript for + displaying PostScript specials. `--noghostscript0' turns the call + back on. + +`--nogssafer*' + Normally, if GhostScript is used to render PostScript specials, the + GhostScript interpreter is run with the option `-dSAFER'. The + `-nogssafer' option runs GhostScript without `-dSAFER'. The + `-dSAFER' option in Ghostscript disables PostScript operators such + as deletefile, to prevent possibly malicious PostScript programs + from having any effect. + +`-o NAME' + Send output to the file NAME. A single occurrence of `%d' or + `%01d', ..., `%09d' will be exchanged for the physical page number + (this can be changed, see the `--dvinum' switch). The default + output filename is `FILE%d.png' where the input DVI file was + `FILE.dvi'. + +`-O X-OFFSET,Y-OFFSET' + Move the origin by X-OFFSET,Y-OFFSET, a comma-separated pair of + dimensions such as `.1in,-.3cm'. The origin of the page is + shifted from the default position (of one inch down, one inch to + the right from the upper left corner of the paper) by this amount. + +`-p [=]NUM' + The first page printed will be the first one numbered NUM. Default + is the first page in the document. If NUM is prefixed by an + equals sign, then it (and the argument to the `-l' option, if + specified) is treated as a physical (absolute) page number, rather + than a value to compare with the TeX `\count0' values stored in the + DVI file. Thus, using `-p =3' will start with the third page of + the document, no matter what the pages are actually numbered. + +`--picky*' + No images are output when a warning occurs. Normally, dvipng will + output an image in spite of a warning, but there may be something + missing in this image. One reason to use this option would be if + you have a more complete but slower fallback converter. Mainly, + this is useful for failed figure inclusion and unknown \special + occurrences, but warnings will also occur for missing or unknown + color specs and missing PK fonts. + +`--png*' + The images are output in the PNG format. This is the default for + the `dvipng' binary. See also the `--gif' option. + +`-pp FIRSTPAGE-LASTPAGE' + Print pages FIRSTPAGE through LASTPAGE; but not quite equivalent + to `-p FIRSTPAGE -l LASTPAGE'. For example, when rendering a book, + there may be several instances of a page in the DVI file (one in + `\frontmatter', one in `\mainmatter', and one in `\backmatter'). + In case of several pages matching, `-pp FIRSTPAGE-LASTPAGE' will + render _all_ pages that matches the specified range, while `-p + FIRSTPAGE -l LASTPAGE' will render the pages from the _first_ + occurrence of FIRSTPAGE to the _first_ occurrence of LASTPAGE. + This is the (undocumented) behaviour of dvips. In dvipng you can + give both kinds of options, in which case you get all pages that + matches the range in `-pp' between the pages from `-p' to `-l'. + Also multiple `-pp' options accumulate, unlike `-p' and `-l'. The + `-' separator can also be `:'. Note that `-pp -1' will be + interpreted as "all pages up to and including 1", if you want a + page numbered -1 (only the table of contents, say) put `-pp -1--1', + or more readable, `-pp -1:-1'. + +`-q*' + Run quietly. Don't chatter about pages converted, etc. to standard + output; report no warnings (only errors) to standard error. + +`-Q NUM' + Set the quality to NUM. That is, choose the number of antialiasing + levels for PK and T1lib rendering to be NUM*NUM. The default value + is 4 which gives 16 levels of antialiasing for antialiased fonts + from these two. If FreeType is available, its rendering is + unaffected by this option. + +`-r*' + Toggle output of pages in reverse/forward order. By default, the + first page in the DVI is output first. + +`-T IMAGE_SIZE' + Set the image size to IMAGE_SIZE which can be either of `bbox', + `tight', or a comma-separated pair of dimensions HSIZE,VSIZE such + as `.1in,.3cm'. The default is `bbox' which produces a PNG that + includes all ink put on the page and in addition the DVI origin, + located 1in from the top and 1in from the left edge of the paper. + This usually gives whitespace above and to the left in the + produced image. The value `tight' will make dvipng only include + all ink put on the page, producing neat images. This option + overrides any papersize special in the DVI file. + +`--t1lib*' + Enable/disable T1lib font rendering (default on). This option is + available if the T1lib font library was present at compilation + time. If this is the case, dvipng will have direct support for + PostScript Type1 fonts internally, rather than using `gsftopk' for + rendering the fonts. If you have PostScript versions of Computer + Modern installed, there will be no need to generate bitmapped + variants on disk of these. Then, you can render images at + different (and unusual) resolutions without cluttering the disk + with lots of bitmapped fonts. Note that if you have both FreeType + and T1lib on your system FreeType will be preferred by dvipng, and + if you for some reason rather want to use T1lib, give the option + `--freetype0' (see above). + +`--truecolor*' + On systems with a fairly new `libgd', one can choose to generate + truecolor output. This will not be necessary in general unless you + include truecolor images via a PostScript special (i.e., the + `graphics' or `graphicx' package). It will lead to longer + execution time, mostly because more data is written to disk. + +`-v*' + Enable verbose operation. This will currently indicate what fonts + is used, in addition to the usual output. + +`-x NUM' + Set the x magnification ratio to NUM/1000. Overrides the + magnification specified in the DVI file. Must be between 10 and + 100000. It is recommended that you use standard magstep values + (1095, 1200, 1440, 1728, 2074, 2488, 2986, and so on) to help + reduce the total number of PK files generated. NUM may be a real + number, not an integer, for increased precision. + +`-z NUM' + Set the PNG compression level to NUM. This option is enabled if + your `libgd' is new enough. The default compression level is 1, + which selects maximum speed at the price of slightly larger PNGs. + For an older `libgd', the hard-soldered value 5 is used. The + include file `png.h' says + + Currently, valid values range from 0 - 9, corresponding + directly to the zlib compression levels 0 - 9 (0 - no + compression, 9 - "maximal" compression). Note that tests have + shown that zlib compression levels 3-6 usually perform as + well as level 9 for PNG images, and do considerably fewer + calculations. In the future, these values may not correspond + directly to the zlib compression levels. + + +File: dvipng.info, Node: Diagnosing problems, Next: Color, Prev: Command-line options, Up: Top + +5 Diagnosing problems +********************* + +You've gone through all the trouble of installing dvipng, carefully read +all the instructions in this manual, and still can't get something to +work. The following sections provide some helpful hints if you find +yourself in such a situation. + + Bug reports should be sent to <dvipng@nongnu.org>. + + Questions, suggestions for new features, pleas for help, and/or +praise should go to <dvipng@nongnu.org>. For more information on this +mailing list, send a message with just the word `help' as subject or +body to <dvipng-request@nongnu.org> or look at +`http://lists.nongnu.org/mailman/listinfo/dvipng'. + + Offers to support further development will be appreciated. For +developer access, ask on <dvipng@nongnu.org>. + + For details on the TeX path-searching library, and `mktexpk' +problems, *note Common problems: (kpathsea)Common problems. + +* Menu: + +* Debug options:: Getting diagnostics. +* Included graphics problems:: Figures are wrongly rendered. + + +File: dvipng.info, Node: Debug options, Next: Included graphics problems, Up: Diagnosing problems + +5.1 Debug options +================= + +The `-d' flag to dvipng helps in tracking down certain errors. The +parameter to this flag is an integer that tells what errors are +currently being tracked. To track a certain class of debug messages, +simply provide the appropriate number given below; if you wish to track +multiple classes, sum the numbers of the classes you wish to track. To +track all classes, you can use `-1'. + + Some of these debugging options are actually provided by Kpathsea +(*note Debugging: (kpathsea)Debugging.). + + The classes are: +1 + Normal dvi op-codes + +2 + Virtual fonts + +4 + PK fonts + +8 + TFM files + +16 + Glyph rendering + +32 + FreeType calls + +64 + Encoding loads + +128 + Color specials + +256 + GhostScript specials + +512 + T1lib calls + +1024 + Kpathsea `stat' calls + +2048 + Kpathsea hash table lookups + +4096 + Kpathsea path element expansion + +8192 + Kpathsea path searches + + + +File: dvipng.info, Node: Included graphics problems, Prev: Debug options, Up: Diagnosing problems + +5.2 Included graphics problems +============================== + +The most common problem with including graphics is an incorrect bounding +box. Complain to whoever wrote the software that generated the file if +the bounding box is indeed incorrect. + + An additional problem is that the image in dvipng is always clipped +to the bounding box. This is because the image is rendered by +GhostScript by an internal call and then copied to the dvipng image. At +present no workaround is known, but there may be one for a future +GhostScript. We'll see. + + +File: dvipng.info, Node: Color, Next: Copying, Prev: Diagnosing problems, Up: Top + +6 Color +******* + +To support color, dvipng recognizes a certain set of specials. These +specials start with the keyword `color' or the keyword `background', +followed by a color specification. + +* Menu: + +* Color specifications:: +* Color specials:: + + +File: dvipng.info, Node: Color specifications, Next: Color specials, Up: Color + +6.1 Color specifications +======================== + +The color specification supported by dvipng is by-value or by-name. The +by-value spec starts with the name of a color model (one of `rgb', +`hsb', `cmy', `cmyk', or `gray') followed by the appropriate number of +parameters. Thus, the color specification `rgb 0.3 0.4 0.5' would +correspond to the color that is `0.3 0.4 0.5' in its red, blue and +green values. The color used internally in dvipng is `RGB' (discretized +to 256 levels), for details on the formulas used in conversion, see the +`xcolor' documentation. + + By-name color specifications are single (case-dependent) words and +are compared with color names defined in `dvipsnam.def' (from the +`graphics' bundle), `svgnam.def' and `xcolor.sty' (from the `xcolor' +bundle). + + On the command-line, the name `Transparent' can also be used in as +an argument to `--bg' to choose transparent background. *Note Option +details::. + + +File: dvipng.info, Node: Color specials, Prev: Color specifications, Up: Color + +6.2 Color specials +================== + +We will describe `background' first, since it is the simplest. The +`background' keyword must be followed by a color specification. That +color specification is used as a fill color for the background. The +last `background' special on a page is the one that gets used, and is +used for the whole of the page image. (This is possible because the +prescan phase of dvipng notices all of the color specials so that the +appropriate information can be written out during the second phase.) + + The `color' special itself has three forms. The first is just +`color' followed by a color specification. In this case, the current +global color is set to that color; the color stack must be empty when +such a command is executed. + + The second form is `color push' followed by a color specification. +This saves the current color on the color stack and sets the color to be +that given by the color specification. This is the most common way to +set a color. + + The final version of the `color' special is just `color pop', with +no color specification; this says to pop the color last pushed on the +color stack from the color stack and set the current color to be that +color. + + dvipng correctly handles these color specials across pages, even when +the pages are rendered repeatedly or in reverse order. + + +File: dvipng.info, Node: Credits, Next: Index, Prev: Copying, Up: Top + +7 Credits +********* + +A number of persons have contributed, if I forget to mention someone, I +apologize. First and foremost we have David Kastrup whose preview-latex +project provided the incentive to write this program. There is also a +number of people who have contributed by reporting bugs and suggesting +improvements as the thing has evolved. These include but is perhaps not +limited to (in semi-random order): Thomas Esser (teTeX), Christian +Schenk (MIKTeX), Brian R Furry (debian package), Angus Leeming (LyX), +Thomas Boutell (libgd), John Jones (first user report), Uwe Kern +(xcolor), Alan Shutko, Reiner Stieb, Nick Alcock, Adam Buchbinder, +Svend Tollak Munkejord, James Longstreet, Bernhard Simon, Bob McElrath, +Georg Schwarz, Jason Farmer, Brian V. Smith, Samuel Hathaway, Thomas R. +Shemanske, Stephen Gibson, Christian Ridderstro"m, Ezra Peisach, +William H Wheeler, Thomas Klausner, Harald Koenig, Adrian Bunk, Kevin +Smith, and Jason Riedy. + + +File: dvipng.info, Node: Copying, Next: Credits, Prev: Color, Up: Top + +8 Copying +********* + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + + +Copyright (C) 2002-2005 Jan-AAke Larsson + + +File: dvipng.info, Node: Index, Prev: Credits, Up: Top + +Index +***** + + +* Menu: + +* -dSAFER: Option details. (line 164) +* absolute page number, and -l: Option details. (line 137) +* absolute page number, and -p: Option details. (line 185) +* antialiasing levels, number of: Option details. (line 229) +* background color (option): Option details. (line 40) +* base resolution, setting: Option details. (line 35) +* baseline reporting: Option details. (line 76) +* color specifications: Color specifications. + (line 6) +* command-line options: Command-line options. + (line 6) +* compilation: Installation. (line 6) +* compression: Option details. (line 284) +* configuration, of dvipng: Installation. (line 6) +* dark fonts: Option details. (line 118) +* debugging <1>: Diagnosing problems. (line 6) +* debugging: Option details. (line 54) +* debugging options: Debug options. (line 6) +* depth reporting: Option details. (line 76) +* first page printed: Option details. (line 185) +* follow mode: Option details. (line 97) +* font generation, avoiding: Option details. (line 154) +* foreground color (option): Option details. (line 91) +* FreeType font rendering: Option details. (line 104) +* fuzzy images: Option details. (line 118) +* gamma: Option details. (line 118) +* GhostScript and -dSAFER: Option details. (line 164) +* GhostScript, turning off: Option details. (line 159) +* GIF image format: Option details. (line 124) +* graphics inclusion problems: Included graphics problems. + (line 6) +* height reporting: Option details. (line 130) +* installation, of dvipng: Installation. (line 6) +* invoking dvipng: Basic usage. (line 6) +* last page printed: Option details. (line 137) +* light fonts: Option details. (line 118) +* magnification, overriding DVI: Option details. (line 276) +* Metafont mode, specifying: Option details. (line 146) +* mktexpk, avoiding: Option details. (line 154) +* mode name, specifying: Option details. (line 146) +* no erroneous images: Option details. (line 194) +* offset pages: Option details. (line 179) +* option, details of: Option details. (line 6) +* options, debugging: Debug options. (line 6) +* options, dvipng: Command-line options. + (line 6) +* options, reading from standard input: Option details. (line 11) +* options, summary: Option summary. (line 6) +* output resolution, setting: Option details. (line 60) +* output, redirecting: Option details. (line 172) +* page range: Option details. (line 207) +* page, first printed: Option details. (line 185) +* page, last printed: Option details. (line 137) +* physical page number, and -l: Option details. (line 137) +* physical page number, and -p: Option details. (line 185) +* PNG image format: Option details. (line 203) +* problems: Diagnosing problems. (line 6) +* quality: Option details. (line 229) +* quiet operation: Option details. (line 225) +* reverse pagination: Option details. (line 236) +* silent operation: Option details. (line 225) +* standard input, reading options from: Option details. (line 11) +* standard output, output to: Option details. (line 172) +* T1lib font rendering: Option details. (line 251) +* transparent border fallback color: Option details. (line 25) +* transparent border width: Option details. (line 25) +* trouble: Diagnosing problems. (line 6) +* truecolor output: Option details. (line 265) +* warnings, suppressing: Option details. (line 225) + + + +Tag Table: +Node: Top296 +Node: Introduction1115 +Node: Installation3107 +Node: Prerequisites3454 +Node: Configure5337 +Node: Build/install7403 +Node: Installation outside the texmf tree7874 +Node: Advice for non-privileged users8581 +Node: Basic usage9574 +Node: Command-line options10701 +Node: Option summary11136 +Node: Option details13559 +Node: Diagnosing problems27947 +Node: Debug options29059 +Node: Included graphics problems30101 +Node: Color30749 +Node: Color specifications31083 +Node: Color specials32098 +Node: Credits33513 +Node: Copying34542 +Node: Index35369 + +End Tag Table diff --git a/Build/source/texk/dvipng/dvipng.texi b/Build/source/texk/dvipng/dvipng.texi new file mode 100644 index 00000000000..3a000ef78fc --- /dev/null +++ b/Build/source/texk/dvipng/dvipng.texi @@ -0,0 +1,1626 @@ +\input texinfo +@setfilename dvipng.info +@settitle A DVI-to-PNG translator +@ifset man +@c man begin SYNOPSIS +dvipng [options] filename + +dvipng [options] [filename] - +@c man end +@end ifset + +@set version 1.6 +@set month-year June 2005 + +@c Put everything in one index (arbitrarily chosen to be the concept index). +@syncodeindex fn cp +@syncodeindex ky cp +@syncodeindex pg cp +@syncodeindex vr cp + +@include macros.texi +@iftex +@tolerance 10000 @emergencystretch 3em +@end iftex + +@dircategory TeX +@direntry +* DVI-to-PNG: (dvipng). Translating TeX DVI files to Portable Network Graphics (PNG). +* dvipng: (dvipng). A DVI-to-PNG translator. +@end direntry + +@finalout +@titlepage +@title dvipng +@subtitle A DVI-to-PNG Translator +@subtitle Version @value{version} + + +@author by Jan-@AA{}ke Larsson. +@page +@vskip 0pt plus 1filll +Copyright @copyright{} 2002-2005 Jan-@AA{}ke Larsson + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +@ignore +Permission is granted to process this file through TeX and print the +results, provided the printed document carries copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). +@end ignore + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided also that the +section entitled ``Copying'' is included exactly as in the original, and +provided that the entire resulting derived work is distributed under the +terms of a permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation +approved by the Free Software Foundation. +@end titlepage +@page + +@c @summarycontents +@contents + +@ifnottex +@node Top +@top dvipng + +This manual documents dvipng, a program to translate a DVI (DeVice +Independent) file into PNG (Portable Network Graphics). + +This file documents dvipng version @value{version} + +Corrections or perhaps rewrites of sections are @emph{very welcome}. + +Jan-@AA{}ke Larsson + +@end ifnottex + +@menu +* Introduction:: Introduction +* Installation:: How to compile and install dvipng +* Basic usage:: First things first +* Command-line options:: Advanced usage +* Diagnosing problems:: Problems? +* Color:: Using color with dvipng +* Copying:: GNU General Public License +* Credits:: People who have contributed +* Index:: General index +@end menu + + + +@node Introduction +@chapter Introduction + +@c man begin DESCRIPTION +@include readme.texi +@c man end + +@node Installation +@chapter Installation + +@cindex configuration, of dvipng +@cindex compilation +@cindex installation, of dvipng + +@include install.texi + +@node Basic usage +@chapter Basic usage of dvipng + +@cindex invoking dvipng + +To use dvipng at its simplest, simply type + +@example +dvipng foo +@end example + +@noindent +where @file{foo.dvi} is the output of @TeX{} that you want to convert to +PNG format. If there are four pages in @file{foo.dvi}, those pages will +be output as @file{foo1.png}, @file{foo2.png}, @file{foo3.png}, and +@file{foo4.png}, respectively. + +If you have enabled the PostScript font support (via FreeType or T1lib), +fonts will be rendered as they are needed. Otherwise, if you use fonts +that have not been used on your system before, they may be automatically +generated; this process can take a few minutes, so progress reports +appear by default. The next time the same font is used, it will have +been saved on disk, so rendering will go much faster. (If dvipng tries +to endlessly generate the same fonts over and over again, something is +wrong. @xref{Unable to generate fonts,,, kpathsea, Kpathsea}.) + +Many options are available (see the next section). For a brief summary +of available options, just type + +@example +dvipng --help +@end example + +@node Command-line options +@chapter Command-line options + +@cindex command-line options +@cindex options, dvipng + +dvipng has a plethora of command line options. Reading through this +section will give a good idea of the capabilities of the driver. + +@menu +* Option summary:: Quick listing, from dvipng --help. +* Option details:: More information about each option. +@end menu + + +@node Option summary +@section Option summary + +@cindex options, summary +Here is a handy summary of the options; it is printed out when you run +dvipng with no arguments or with the standard @samp{--help} option. + +@example +@include dvipng.help +@end example + + +@node Option details +@section Option details + +@cindex option, details of +@c man begin OPTIONS + +Many of the parameterless options listed here can be turned off by +suffixing the option with a zero (@samp{0}); for instance, to turn off +page reversal, use @samp{-r0}. Such options are marked with a trailing +@samp{*}. + +@table @samp +@item - +@cindex options, reading from standard input +@cindex standard input, reading options from +Read additional options from standard input after processing the command +line. + +@item --help +Print a usage message and exit. + +@item --version +Print the version number and exit. + +@item -bd @var{num} +@item -bd @var{color_spec} +@item -bd '@var{num} @var{color_spec}' +@cindex transparent border width +@cindex transparent border fallback color +Set the pixel width of the transparent border (default 0). Using this +option will make the image edges transparent, but it only affects pixels +with the background color. Giving a @var{color_spec} will set the +fallback color, to be used in viewers that cannot handle transparency +(the default is the background color). The color spec should be in +@TeX{} color \special syntax, e.g., 'rgb 1.0 0.0 0.0'. Setting the +fallback color makes the default border width 1 px. @xref{Color}. + +@item --bdpi @var{num} +@cindex base resolution, setting +Set the base (Metafont) resolution, both horizontal and vertical, to +@var{num} dpi (dots per inch). This option is necessary when manually +selecting Metafont mode with the --mode option (see below). + +@item -bg @var{color_spec} +@cindex background color (option) +Choose background color for the images. This option will be ignored if +there is a background color \special in the DVI. The color spec should +be in @TeX{} color \special syntax, e.g., 'rgb 1.0 0.0 0.0'. You can +also specify 'Transparent' or 'transparent' which will give you a +transparent background with the normal background as a fallback color. A +capitalized 'Transparent' will give a full-alpha transparency, while an +all-lowercase 'transparent' will give a simple fully transparent +background with non-transparent antialiased pixels. The latter would be +suitable for viewers who cannot cope with a true alpha channel. GIF +images do not support full alpha transparency, so in case of GIF output, +both variants will use the latter behaviour. @xref{Color}. + +@item -d @var{num} +@cindex debugging +Set the debug flags, showing what dvipng (thinks it) is doing. This will +work unless dvipng has been compiled without the @samp{DEBUG} option +(not recommended). Set the flags as you need them, use @samp{-d -1} as +the first option for maximum output. @xref{Debug options}. + +@item -D @var{num} +@cindex output resolution, setting +Set the output resolution, both horizontal and vertical, to @var{num} +dpi (dots per inch). + +One may want to adjust this to fit a certain text font size (e.g., on +a web page), and for a text font height of @var{font_px} pixels (in +Mozilla) the correct formula is +@example +@var{dpi} = @var{font_px} * 72.27 / 10 [px * @TeX{}pt/in / @TeX{}pt] +@end example +The last division by ten is due to the standard font height 10pt in +your document, if you use 12pt, divide by 12. Unfortunately, some +proprietary browsers have font height in pt (points), not pixels. You +have to rescale that to pixels, using the screen resolution (default +is usually 96 dpi) which means the formula is +@example +@var{font_px} = @var{font_pt} * 96 / 72 [pt * px/in / (pt/in)] +@end example +On some high-res screens, the value is instead 120 dpi. Good luck! + +@item --depth* +@cindex baseline reporting +@cindex depth reporting +Report the depth of the image. This only works reliably when the +@LaTeX{} style @samp{preview.sty} from @previewlatex{} is used. It +reports the number of pixels from the bottom of the image to the +baseline of the image. This can be used for vertical positioning of the +image in, e.g., web documents, where one would use (Cascading +StyleSheets 1) +@example +<IMG SRC="@var{filename.png}" STYLE="vertical-align: -@var{depth}px"> +@end example +The depth is a negative offset in this case, so the minus sign is +necessary, and the unit is pixels (px). + +@item --dvinum* +Set this option to make the output page number be the @TeX{} page +numbers rather than the physical page number. See the @samp{-o} switch. + +@ignore +@item -e @var{num} +@cindex maxdrift +@cindex accuracy in positioning +@cindex positioning accuracy +Maximum drift in pixels of each character from its `true' +resolution-independent position on the page. The default value of this +parameter is resolution dependent (it is the number of entries in the +list [100, 200, 300, 400, 500, 600, 800, 1000, 1200, 1600, 2000, 2400, +2800, 3200, @dots{}] that are less than or equal to the resolution in +dots per inch). Allowing individual characters to `drift' from their +correctly rounded positions by a few pixels, while regaining the true +position at the beginning of each new word, improves the spacing of +letters in words. + +@item -f* +@cindex filter, running as a +@cindex standard I/O +@cindex pipes, not readable +@vindex PRINTER@r{, avoided with @samp{-f}} +Run as a filter. Read the DVI file from standard input and write the +PostScript to standard output. The standard input must be seekable, so +it cannot be a pipe. If your input must be a pipe, write a shell script +that copies the pipe output to a temporary file and then points dvipng at +this file. This option also disables the automatic reading of the +@code{PRINTER} environment variable; use @samp{-P$PRINTER} after the +@samp{-f} to read it anyway. It also turns off the automatic sending of +control-D if it was turned on with the @samp{-F} option or in the +configuration file; use @samp{-F} after the @samp{-f} to send it anyway. + +@item -k* +@cindex cropmarks +Print crop marks. This option increases the paper size (which should be +specified, either with a paper size special or with the @samp{-T} +option) by a half inch in each dimension. It translates each page by a +quarter inch and draws cross-style crop marks. It is mostly useful with +typesetters that can set the page size automatically. This works by +downloading @file{crop.pro}. +@end ignore + +@item -fg @var{color_spec} +@cindex foreground color (option) +Choose foreground color for the images. This option will be ignored if +there is a foreground color \special in the DVI. The color spec should +be in @TeX{} color \special syntax, e.g., 'rgb 1.0 0.0 0.0'. +@xref{Color}. + +@item --follow* +@cindex follow mode +Enable follow mode. One of the benefits of dvipng is that it does not +read the postamble, so it can be started before @TeX{} finishes. This +switch makes dvipng wait at EOF for further output, unless it finds the +POST marker that indicates the end of the DVI. This is similar to +@samp{tail -f} but for DVI-to-PNG conversion. + +@item --freetype* +@cindex FreeType font rendering +Enable/disable FreeType font rendering (default on). This option is +available if the FreeType2 font library was present at compilation time. +If this is the case, dvipng will have direct support for PostScript +Type1 and TrueType fonts internally, rather than using @samp{gsftopk} +for rendering the fonts. If you have PostScript versions of Computer +Modern installed, there will be no need to generate bitmapped variants +on disk of these. Then, you can render images at different (and unusual) +resolutions without cluttering the disk with lots of bitmapped fonts. +Note that if you have both FreeType and T1lib on your system, FreeType +will be preferred by dvipng. If you for some reason would want to use +T1lib rendering, use this option. + +@item --gamma @var{num} +@cindex gamma +@cindex dark fonts +@cindex light fonts +@cindex fuzzy images +Control the interpolation of colors in the greyscale anti-aliasing +color palette. Default value is 1.0. For 0 < @var{num} < 1, the +fonts will be lighter (more like the background), and for @var{num} > +1, the fonts will be darker (more like the foreground). + +@item --gif* +@cindex GIF image format +The images are output in the GIF format, if GIF support is +enabled. This is the default for the @samp{dvigif} binary, which only +will be available when GIF support is enabled. See also the +@samp{--png} option. + +@item --height* +@cindex baseline reporting +@cindex height reporting +Report the height of the image. This only works reliably when the +@LaTeX{} style @samp{preview.sty} from @previewlatex{} is used. It +reports the number of pixels from the top of the image to the +baseline of the image. The total height of the image is obtained as the +sum of the values reported from --height and the --depth. + +@item -l [=]@var{num} +@cindex last page printed +@cindex page, last printed +@cindex physical page number, and @samp{-l} +@cindex absolute page number, and @samp{-l} +The last page printed will be the first one numbered @var{num}. Default +is the last page in the document. If @var{num} is prefixed by an equals +sign, then it (and the argument to the @samp{-p} option, if specified) +is treated as a physical (absolute) page number, rather than a value to +compare with the @TeX{} @samp{\count0} values stored in the DVI file. +Thus, using @samp{-l =9} will end with the ninth page of the document, +no matter what the pages are actually numbered. + +@item --mode @var{mode} +@cindex mode name, specifying +@cindex Metafont mode, specifying +Use @var{mode} as the Metafont device name for the PK fonts (both for +path searching and font generation). This needs to be augmented with the +base device resolution, given with the @samp{--bdpi} option. See the +file @url{ftp://ftp.tug.org/tex/modes.mf} for a list of resolutions and +mode names for most devices. @xref{Unable to generate fonts,,, kpathsea, +Kpathsea}. + +@item -M* +@cindex font generation, avoiding +@pindex mktexpk@r{, avoiding} +@c this description repeated in kpathsea.texi +Turns off automatic PK font generation (@file{mktexpk}). This will have +no effect when using PostScript fonts, since no PK font generation will +be done anyway. +@ignore +@flindex missfont.log +If @code{mktexpk}, the invocation is appended to a file +@file{missfont.log} (by default) in the current directory. You can then +execute the log file to create the missing files after fixing the +problem. +@vindex TEXMFOUTPUT +@vindex MISSFONT_LOG +If the current directory is not writable and the environment variable or +configuration file value @samp{TEXMFOUTPUT} is set, its value is used. +Otherwise, nothing is written. The name @samp{missfont.log} is +overridden by the @samp{MISSFONT_LOG} environment variable or +configuration file value. +@end ignore + +@item --noghostscript* +@cindex GhostScript, turning off +This switch prohibits the internal call to GhostScript for displaying +PostScript specials. @samp{--noghostscript0} turns the call back on. + +@item --nogssafer* +@cindex GhostScript and -dSAFER +@cindex -dSAFER +Normally, if GhostScript is used to render PostScript specials, the +GhostScript interpreter is run with the option @samp{-dSAFER}. The +@samp{-nogssafer} option runs GhostScript without @samp{-dSAFER}. The +@samp{-dSAFER} option in Ghostscript disables PostScript operators such +as deletefile, to prevent possibly malicious PostScript programs from +having any effect. + +@item -o @var{name} +@cindex output, redirecting +@cindex standard output, output to +Send output to the file @var{name}. A single occurrence of @samp{%d} or +@samp{%01d}, @dots{}, @samp{%09d} will be exchanged for the physical +page number (this can be changed, see the @samp{--dvinum} switch). The +default output filename is @samp{@var{file}%d.png} where the input DVI +file was @samp{@var{file}.dvi}. + +@item -O @var{x-offset},@var{y-offset} +@cindex offset pages +Move the origin by @var{x-offset},@var{y-offset}, a comma-separated +pair of dimensions such as @samp{.1in,-.3cm}. +@c (@pxref{papersize special}). +The origin of the page is shifted from the default position +(of one inch down, one inch to the right from the upper left corner of +the paper) by this amount. + +@item -p [=]@var{num} +@cindex first page printed +@cindex page, first printed +@cindex physical page number, and @samp{-p} +@cindex absolute page number, and @samp{-p} +The first page printed will be the first one numbered @var{num}. Default +is the first page in the document. If @var{num} is prefixed by an +equals sign, then it (and the argument to the @samp{-l} option, if +specified) is treated as a physical (absolute) page number, rather than +a value to compare with the @TeX{} @samp{\count0} values stored in the +DVI file. Thus, using @samp{-p =3} will start with the third page of +the document, no matter what the pages are actually numbered. + +@item --picky* +@cindex no erroneous images +No images are output when a warning occurs. Normally, dvipng will +output an image in spite of a warning, but there may be something +missing in this image. One reason to use this option would be if you +have a more complete but slower fallback converter. Mainly, this is +useful for failed figure inclusion and unknown \special occurrences, +but warnings will also occur for missing or unknown color specs and +missing PK fonts. + +@item --png* +@cindex PNG image format +The images are output in the PNG format. This is the default for the +@samp{dvipng} binary. See also the @samp{--gif} option. + +@item -pp @var{firstpage}-@var{lastpage} +@cindex page range +Print pages @var{firstpage} through @var{lastpage}; but not quite +equivalent to @samp{-p @var{firstpage} -l @var{lastpage}}. For example, +when rendering a book, there may be several instances of a page in the +DVI file (one in @code{\frontmatter}, one in @code{\mainmatter}, and one +in @code{\backmatter}). In case of several pages matching, @samp{-pp +@var{firstpage}-@var{lastpage}} will render @emph{all} pages that +matches the specified range, while @samp{-p @var{firstpage} -l +@var{lastpage}} will render the pages from the @emph{first} occurrence +of @var{firstpage} to the @emph{first} occurrence of @var{lastpage}. +This is the (undocumented) behaviour of dvips. In dvipng you can give +both kinds of options, in which case you get all pages that matches the +range in @samp{-pp} between the pages from @samp{-p} to @samp{-l}. Also +multiple @samp{-pp} options accumulate, unlike @samp{-p} and @samp{-l}. +The @samp{-} separator can also be @samp{:}. Note that @samp{-pp -1} +will be interpreted as "all pages up to and including 1", if you want a +page numbered -1 (only the table of contents, say) put @samp{-pp -1--1}, +or more readable, @samp{-pp -1:-1}. + +@item -q* +@cindex quiet operation +@cindex silent operation +@cindex warnings, suppressing +Run quietly. Don't chatter about pages converted, etc.@: to standard +output; report no warnings (only errors) to standard error. + +@item -Q @var{num} +@cindex antialiasing levels@r{, number of} +@cindex quality +Set the quality to @var{num}. That is, choose the number of antialiasing +levels for PK and T1lib rendering to be @var{num}*@var{num}. The default +value is 4 which gives 16 levels of antialiasing for antialiased fonts +from these two. If FreeType is available, its rendering is unaffected by +this option. + +@item -r* +@cindex reverse pagination +Toggle output of pages in reverse/forward order. By default, the first +page in the DVI is output first. + +@ignore +@item -R +@cindex security +@cindex shell command execution, disabling +@cindex absolute filenames, disabling +@cindex pipes, disabling output to +Run securely. This disables shell command execution in @code{\special} +(via @samp{`}, @pxref{Dynamic creation of graphics}) and config files +(via the @samp{E} option, @pxref{Configuration file commands}), pipes as +output files, and opening of any absolute filenames. + +@item -t @var{papertype} +@cindex paper type +@cindex media +@cindex letter papertype +@cindex legal papertype +@cindex ledger papertype +@cindex a4 papertype +@cindex a3 papertype +@cindex landscape papertype +Set the paper type to @var{papertype}. +@c usually defined in one of the +@c configuration files, along with the appropriate PostScript code to +@c select it (@pxref{Config file paper sizes}). +You can also specify a @var{papertype} of @samp{landscape}, which +rotates a document by 90 degrees. To rotate a document whose paper type +is not the default, you can use the @samp{-t} option twice, once for the +paper type, and once for @samp{landscape}. +@end ignore + +@item -T @var{image_size} +Set the image size to @var{image_size} which can be either of +@samp{bbox}, @samp{tight}, or a comma-separated pair of dimensions +@var{hsize},@var{vsize} such as @samp{.1in,.3cm}. The default is +@samp{bbox} which produces a PNG that includes all ink put on the page +and in addition the DVI origin, located 1in from the top and 1in from +the left edge of the paper. This usually gives whitespace above and to +the left in the produced image. The value @samp{tight} will make dvipng +only include all ink put on the page, producing neat images. +@c (@pxref{papersize special}). +This option overrides any papersize special in the DVI file. + +@item --t1lib* +@cindex T1lib font rendering +Enable/disable T1lib font rendering (default on). This option is +available if the T1lib font library was present at compilation time. If +this is the case, dvipng will have direct support for PostScript Type1 +fonts internally, rather than using @samp{gsftopk} for rendering the +fonts. If you have PostScript versions of Computer Modern installed, +there will be no need to generate bitmapped variants on disk of these. +Then, you can render images at different (and unusual) resolutions +without cluttering the disk with lots of bitmapped fonts. Note that if +you have both FreeType and T1lib on your system FreeType will be +preferred by dvipng, and if you for some reason rather want to use +T1lib, give the option @samp{--freetype0} (see above). + +@item --truecolor* +@cindex truecolor output +On systems with a fairly new @samp{libgd}, one can choose to generate +truecolor output. This will not be necessary in general unless you +include truecolor images via a PostScript special (i.e., the +@samp{graphics} or @samp{graphicx} package). It will lead to longer +execution time, mostly because more data is written to disk. + +@item -v* +Enable verbose operation. This will currently indicate what fonts is +used, in addition to the usual output. + +@item -x @var{num} +@cindex magnification, overriding DVI +Set the @math{x} magnification ratio to @math{@var{num}/1000}. Overrides +the magnification specified in the DVI file. Must be between 10 and +100000. It is recommended that you use standard magstep values (1095, +1200, 1440, 1728, 2074, 2488, 2986, and so on) to help reduce the total +number of PK files generated. @var{num} may be a real number, not an +integer, for increased precision. + +@item -z @var{num} +@cindex compression +Set the PNG compression level to @var{num}. This option is enabled if +your @samp{libgd} is new enough. The default compression level is 1, +which selects maximum speed at the price of slightly larger PNGs. For an +older @samp{libgd}, the hard-soldered value 5 is used. The include file +@samp{png.h} says +@ifclear man +@quotation +Currently, valid values range from 0 - 9, corresponding directly to the +zlib compression levels 0 - 9 (0 - no compression, 9 - "maximal" +compression). Note that tests have shown that zlib compression levels +3-6 usually perform as well as level 9 for PNG images, and do +considerably fewer calculations. In the future, these values may not +correspond directly to the zlib compression levels. +@end quotation +@end ifclear +@ifset man +``Currently, valid values range from 0 - 9, corresponding directly to +the zlib compression levels 0 - 9 (0 - no compression, 9 - "maximal" +compression). Note that tests have shown that zlib compression levels +3-6 usually perform as well as level 9 for PNG images, and do +considerably fewer calculations. In the future, these values may not +correspond directly to the zlib compression levels.'' +@end ifset +@end table +@c man end + +@ignore +@c @node Environment variables +@chapter Environment variables + +@cindex environment variables + +dvipng looks for many environment variables, to define search paths and +other things. The path variables are read as needed, after all +configuration files are read, so they override values in the +configuration files. (Except for @code{TEXCONFIG}, which defines where +the configuration files themselves are found.) + +@xref{Path specifications,,, kpathsea, Kpathsea}, for details of +interpretation of path and other environment variables common to all +Kpathsea-using programs. Only the environment variables specific to +dvipng are mentioned here. + +@vtable @code +@item DVIPSMAKEPK +@pindex mktexpk@r{, changing name} +Overrides @samp{mktexpk} as the name of the program to invoke to +create missing PK fonts. You can change the arguments passed to the +@code{mktexpk} program with the @code{MAKETEXPK} environment +variable; @pxref{MakeTeX script arguments,,, kpathsea, Kpathsea}. + +@item DVIPSRC +Specifies the name of the startup file (@pxref{Configuration file +searching}) which is read after @file{config.ps} but before any +printer-specific configuration files. + +@item TEXPICTS +Path to search for included graphics files. Overrides the @samp{S} +config file option (@pxref{Configuration file commands}). If not set, +@code{TEXINPUTS} is looked for. @xref{Supported file formats,,, +kpathsea, Kpathsea}. + +@end vtable + +@c @node Paper size and landscape +@chapter Paper size and landscape orientation + +@cindex paper size, general + +Most @TeX{} documents at a particular site are designed to use the +standard paper size (letter size in the United States, A4 in Europe). +The dvipng program can be customized either sitewide or for a particular +printer. + +@cindex landscape orientation, defined +But many documents are designed for other paper sizes. For instance, +you may want to design a document that has the long edge of the paper +horizontal. This can be useful when typesetting booklets, brochures, +complex tables, or many other documents. This type of paper orientation +is called @dfn{landscape} orientation (the default orientation is +@dfn{portrait}). Alternatively, a document might be designed for ledger +or A3 paper. + +Since the intended paper size is a document design decision, not a +printing decision, such information should be given in the @TeX{} file +and not on the dvipng command line. For this reason, dvipng supports a +@samp{papersize} special. It is hoped that this special will become +standard over time for @TeX{} previewers, printer drivers, and other DVI +drivers. + +@menu +* papersize special:: Specifying the paper size in TeX. +* Config file paper sizes:: Specifying printer- and site-specific sizes. +@end menu + + +@c @node papersize special +@section @samp{papersize} special + +@findex papersize @r{special} + +The format of the @samp{papersize} special is + +@example +\special@{papersize=@var{width},@var{height}@} +@end example + +@noindent +@var{width} is the horizontal size of the page, and @var{height} is the +vertical size. The dimensions supported are the same as for @TeX{}; +namely, in (inches), cm (centimeters), mm (millimeters), pt (points), sp +(scaled points), bp (big points, the same as the default PostScript +unit), pc (picas), dd (didot points), and cc (ciceros). + +@findex landscape@r{, as @code{\special}} +For a US letter size landscape document, the @code{papersize} would be: +@example +\special@{papersize=11in,8.5in@} +@end example + +@noindent +An alternate specification of @code{landscape}: +@example +\special@{landscape@} +@end example + +@noindent +This is supported for backward compatibility, but it is hoped that +eventually the @code{papersize} comment will dominate. + +Of course, such a @code{\special} only informs dvipng of the desired +paper size; you must also adjust @code{\hsize} and @code{\vsize} in your +@TeX{} document typeset to those dimensions. + +The @code{papersize} special must occur somewhere on the first page of +the document. + + +@c @node Config file paper sizes +@section Configuration file paper size command + +@cindex paper size configuration file command +@cindex configuration file paper size command + +The @samp{@@} command in a configuration file sets the paper size +defaults and options. The first @samp{@@} command defines the default +paper size. It has three possible parameters: + +@example +@@ @r{[}@var{name} @r{[}@var{hsize} @var{vsize}@r{]]} +@end example + +If @samp{@@} is specified on a line by itself, with no parameters, it +instructs dvipng to discard all previous paper size information (possibly +from another configuration file). + +If three parameters are given, with the first parameter being a name and +the second and third being a dimension (as in @samp{8.5in} or +@samp{3.2cc}, just like in the @samp{papersize} special), then the +option is interpreted as starting a new paper size description, where +@var{name} is the name and @var{hsize} and @var{vsize} define the +horizontal and vertical size of the sheet of paper, respectively. For +example: + +@example +@@ letterSize 8.5in 11in +@end example + +If both @var{hsize} and @var{vsize} are zero (you must still specify +units!) then any page size will match. If the @samp{@@} character is +immediately followed by a @samp{+} sign, then the remainder of the line +(after skipping any leading blanks) is treated as PostScript code to +send to the printer, presumably to select that particular paper size: + +@example +@@ letter 8.5in 11in +@@+ %%BeginPaperSize: Letter +@@+ letter +@@+ %%EndPaperSize +@end example + +After all that, if the first character of the line is an exclamation +point, then the line is put in the initial comments section of the final +output file; else, it is put in the setup section of the output file. +For example: + +@example +@@ legal 8.5in 14in +@@+ ! %%DocumentPaperSizes: Legal +@@+ %%BeginPaperSize: Legal +@@+ legal +@@+ %%EndPaperSize +@end example + +When dvipng has a paper format name given on the command line, it looks +for a match by the @var{name}; when it has a @samp{papersize} special, +it looks for a match by dimensions. The first match found (in the order +the paper size information is found in the configuration file) is used. +If nothing matches, a warning is printed and the first paper size is +used. The dimensions must match within a quarter of an inch. Landscape +mode for all paper sizes is automatically supported. + +If your printer has a command to set a special paper size, then give +dimensions of @samp{0in 0in}; the PostScript code that sets the paper +size can refer to the dimensions the user requested as @samp{hsize} and +@samp{vsize}; these will be macros defined in the PostScript that return +the requested size in default PostScript units. Virtually all of the +PostScript commands you use here are device-dependent and degrade the +portability of the file; that is why the default first paper size entry +should not send any PostScript commands down (although a structured +comment or two would be okay). Also, some printers want +@samp{BeginPaperSize} comments and paper size setting commands; others +(such as the NeXT) want @samp{PaperSize} comments and they will handle +setting the paper size. There is no solution I could find that works +for both (except maybe specifying both). + +@flindex mkdvipngpapers +The Perl 5 script @file{contrib/mkdvipngpapers} in the distribution +directory may help in determining appropriate paper size definitions. + +@cindex a4 paper size, as default +If your printers are configured to use A4 paper by default, the +configuration file (probably the global @file{config.ps} in this case) +should include this as the first @samp{@@} command: + +@example +@@ A4size 210mm 297mm +@@+ %%PaperSize: A4 +@end example + +@noindent +so that @code{A4size} is used as the default, and not @code{A4} itself; +thus, no PostScript @code{a4} command is added to the output file, +unless the user explicitly says to use paper size @samp{a4}. That is, +by default, no paper size PostScript command should be put in the +output, but dvipng will still know that the paper size is A4 because +@samp{A4size} is the first (and therefore default) size in the +configuration file. + +Executing the @samp{letter} or @samp{a4} or other PostScript operators +cause the document to be nonconforming and can cause it not to print on +certain printers, so the default paper size should not execute such an +operator if at all possible. + + + +@c @node Interaction with PostScript +@chapter Interaction with PostScript + +@cindex interaction with PostScript +@cindex PostScript interaction + +dvipng supports inclusion of PostScript figure files (e.g., Encapsulated +PostScript), downloading other header files (e.g., fonts), including +literal PostScript code, and hypertext. + +@menu +* PostScript figures:: Including an Encapsulated PostScript figure. +* Header files:: Downloading extra definitions. +* Diagnosing problems:: +@end menu + + +@c @node PostScript figures +@chapter PostScript figures + +Scaling and including PostScript graphics is a breeze---if the PostScript +file is correctly formed. Even if it is not, however, the file can usually +be accommodated with just a little more work. + +@menu +* Bounding box:: The %%BoundingBox EPS comment. +* EPSF macros:: Including the file in TeX. +* psfile special:: The basic special. +* Dynamic creation of graphics:: Handling compressed or generated figures. +* Fonts in figures:: The %*Font comment. +@end menu + + +@c @node Bounding box +@section The bounding box comment + +@cindex bounding box, comment for + +The most important feature of a good PostScript file from the standpoint +of including it in another document is an accurate bounding box comment. +Every well-formed PostScript file has a comment describing where on the +page the graphic is located, and how big that graphic is. + +@cindex big points +@cindex PostScript units +@cindex bounding box, defined +This information is given as the lower left and upper right corners of +the box just enclosing the graphic, and is thus referred to as the +@dfn{bounding box}. These coordinates are given in the default +PostScript units (there are precisely 72 PostScript units to the inch, +like @TeX{} big points) with respect to the lower left corner of the +sheet of paper. + +@findex %%BoundingBox +To see if a PostScript file has a bounding box comment, just look at the +first few lines of the file. PostScript files are standard ASCII, so +you can use any text editor to do this. If within the first few dozen +lines there is a line like + +@example +%%BoundingBox: 25 50 400 300 +@end example + +@noindent +(with any reasonable numbers), chances are very good that the file is +Encapsulated PostScript and will work easily with dvipng. If the file +contains instead a line like + +@findex atend@r{, bounding box specification} +@findex (atend)@r{, bounding box specification} +@example +%%BoundingBox: (atend) +@end example + +@noindent +the file is still probably Encapsulated PostScript, but the bounding box +is given at the end of the file. dvipng needs it at the beginning. You +can move it with that same text editor, or a simple script. (The +bounding box is given in this way when the program that generated the +PostScript couldn't know the size in advance, or was too lazy to compute +it.) + +@pindex bbfig +@cindex bounding box, determining +If the document lacks a @samp{%%BoundingBox:} altogether, you can +determine one in a couple of ways. One is to use the @samp{bbfig} +program distributed with dvipng in the @file{contrib} directory. This can +usually find the correct bounding box automatically; it works best with +Ghostscript. + +@vindex 612 792 @r{bounding box size} +If the comment looks like this: +@example +%%BoundingBox: 0 0 612 792 +@end example + +@noindent +the graphic claims to take up an entire sheet of paper. This is +usually a symptom of a bug in the program that generated it. + +The other is to do it yourself: print the file. Now, take a ruler, and +make the following measurements (in PostScript units, so measure in +inches and multiply by 72): From the left edge of the paper to the +leftmost mark on the paper is @var{llx}, the first number. From the +bottom edge of the paper to the bottommost mark on the paper is +@var{lly}, the second number. From the left edge of the paper to the +rightmost mark on the paper is @var{urx}, the third number. The fourth +and final number, @var{ury}, is the distance from the bottom of the page +to the uppermost mark on the paper. + +Once you have the numbers, add a comment of the following form as the +second line of the document. (The first line should already be a line +starting with the two characters @samp{%!}; if it is not, the file +probably isn't PostScript.) + +@example +%%BoundingBox: @var{llx} @var{lly} @var{urx} @var{ury} +@end example + +@noindent +Or, if you don't want to modify the file, you can simply write these +numbers down in a convenient place and give them in your @TeX{} document +when you import the graphic, as described in the next section. + +If the document does not have such a bounding box, or if the bounding +box is given at the end of the document, or the bounding box is wrong, +please complain to the authors of the software package that generated +the file. + + +@c @node EPSF macros +@section Using the EPSF macros + +@cindex EPSF macros +@cindex macros for epsf inclusion + +Once the figure file has a bounding box comment (see the previous +section,) you are ready it the graphic into a @TeX{} document. Many +packages for using EPS files exist. One distributed with dvipng is the +files @file{epsf.tex} (for plain @TeX{}) and @file{epsf.sty} (for +La@TeX{}). For plain @TeX{}, add a line like this near the top of your +input file: + +@flindex epsf.tex +@example +\input epsf +@end example + +@noindent +If you are using La@TeX{} 2e, use the @samp{graphics} or @samp{graphicx} +package. +@flindex epsf.sty +If you are using La@TeX{} 2.09, add the @samp{epsf} style option, as in: + +@example +\documentstyle[12pt,epsf]@{article@} +@end example + +@noindent +In any case, the above only needs to be done once, no matter how many +figures you plan to include. + +Now, at the point you want to include a file, enter a line such as: + +@example +\epsffile@{foo.eps@} +@end example + +@findex \leavevmode +@cindex bounding box, supplying to @TeX{} +If you are using La@TeX{}, you may need to add @code{\leavevmode} +immediately before the @code{\epsffile} command to get certain +environments to work correctly. If your file does not have a bounding +box comment, you can supply the numbers as determined in the previous +section, in the same order they would have been in a normal bounding box +comment: + +@example +\epsffile[100 100 500 500]@{foo.ps@} +@end example + +@noindent +Now, save your changes and run @TeX{} and dvipng; the output should have +your graphic positioned at precisely the point you indicated, occupying +the proper amount of space. + +@findex \epsffile @r{macro} +@cindex figures, natural size +The @code{\epsffile} macro typesets the figure as a @TeX{} @code{\vbox} +at the point of the page that the command is executed. By default, the +graphic will have its `natural' width (namely, the width of its bounding +box). The @TeX{} box will have depth zero and its natural height. By +default, the graphic will be scaled by any DVI magnification in effect, +just as is everything else in your document. See the next section for +more information on scaling. + +@vindex \epsfverbosetrue +@cindex verbose EPSF processing +If you want @TeX{} to report the size of the figure as a message on your +terminal when it processes each figure, give the command: + +@example +\epsfverbosetrue +@end example + +@menu +* EPSF scaling:: +* EPSF clipping:: +@end menu + + +@c @node EPSF scaling +@subsection EPSF scaling + +@cindex scaling of figures +@cindex figures, scaling + +Usually, you will want to scale an EPSF figure to some size appropriate +for your document, since its natural size is determined by the creator +of the EPS file. + +The best way to do this is to assign the desired size to the @TeX{} +@code{\epsfxsize} or @code{\epsfysize} variables, whichever is more +convenient for you. That is, put + +@vindex \epsfxsize +@example +\epsfxsize=@var{dimen} +@end example + +@noindent +right before the call to @code{\epsffile}. Then the width of the @TeX{} +box will be @var{dimen} and its height will be scaled proportionately. +Similarly, you can set the vertical size with + +@vindex \epsfysize +@example +\epsfysize=@var{dimen} +@end example + +@noindent +in which case the height will be set and the width scaled +proportionally. + +If you set both, both will be honored, but the aspect ratio of the +included graphic may necessarily be distorted, i.e., its contents +stretched in one direction or the other. + +@findex \epsfsize +You can resize graphics in a more general way by redefining the +@code{\epsfsize} macro. @code{\epsffile} calls this with two +parameters: the natural horizontal and vertical sizes of the PostScript +graphic. @code{\epsfsize} must expand to the desired horizontal size, +that is, the width of the @code{\vbox}. Schematically: + +@example +\def\epsfsize#1#2@{@var{body}@} +@end example + +Some useful definitions of @var{body}: + +@table @samp +@item \epsfxsize +This definition (the default) enables the default features listed above, +by setting @code{\epsfxsize} to the same value it had before the macro +was called. + +@item #1 +Force the natural size by returning the first parameter (the original +width). + +@item 0pt +A special case, equivalent to @samp{#1}. + +@item 0.5#1 +Scale to half the natural size. + +@item \hsize +Scale to the current @code{\hsize}. (In La@TeX{}, use @code{\textwidth} +instead of @code{\hsize}.) + +@item \ifnum#1>\hsize\hsize\else#1\fi +If the natural width is greater than the current @code{\hsize}, scale to +@code{\hsize}, otherwise use the natural width. + +@end table + +@cindex DVI magnification +@cindex magnification, DVI +@vindex \magnification +For compatibility with other PostScript drivers, it is possible to turn +off the default scaling of included figures by the DVI magnification +with the following @TeX{} command: + +@vindex /magscale +@example +\special@{! /magscale false def@} +@end example + +@noindent +Use of this command is not recommended because it will make the +@code{\epsffile} graphics the ``wrong'' size if global magnification is +being used, and it will cause any PostScript graphics to appear +improperly scaled and out of position if a DVI to DVI program is used to +scale or otherwise modify the document. + +@findex bop-hook +DVI magnification is not applied to any output from code you write in +@samp{bop-hook} or its ilk (@pxref{PostScript hooks}), + + +@c @node EPSF clipping +@subsection EPSF clipping + +@cindex clipping of EPSF +@cindex bounding box, inaccurate +@cindex text in figures, chopped off +@cindex lines in figures, wrong width + +By default, clipping is disabled for included EPSF images. This is +because clipping to the bounding box dimensions often cuts off a +small portion of the figure, due to slightly inaccurate bounding +box arguments. The problem might be subtle; lines around the boundary +of the image might be half their intended width, or the tops or +bottoms of some text annotations might be sliced off. If you want to +turn clipping on, just use the command + +@example +\epsfclipon +@end example + +@noindent +and to turn clipping back off, use + +@example +\epsfclipoff +@end example + + +@c @node psfile special +@section @samp{psfile} special + +@findex psfile @r{special} + +The basic special for file inclusion is as follows: + +@example +\special@{psfile=@var{filename}.ps @r{[}@var{key}=@var{value}@r{]} @dots{} @} +@end example + +@noindent +This downloads the PostScript file @file{@var{filename}.ps} such that +the current point will be the origin of the PostScript coordinate +system. The optional @var{key}@t{=}@var{value} assignments allow you to +specify transformations on the PostScript. + +The possible @var{key}s are: + +@table @samp + +@item hoffset +The horizontal offset (default 0) +@item voffset +The vertical offset (default 0) +@item hsize +The horizontal clipping size (default 612) +@item vsize +The vertical clipping size (default 792) +@item hscale +The horizontal scaling factor (default 100) +@item vscale +The vertical scaling factor (default 100) +@item angle +The rotation (default 0) +@item clip +Enable clipping to the bounding box +@end table + +The dimension parameters are all given in PostScript units. +The @samp{hscale} and @samp{vscale} are given in non-dimensioned percentage +units, and the rotation value is specified in degrees. +Thus + +@example +\special@{psfile=foo.ps hoffset=72 hscale=90 vscale=90@} +@end example + +@noindent +will shift the graphics produced by file @file{foo.ps} right by one inch +and will draw it at 0.9 times normal size. Offsets are given relative +to the point of the special command, and are unaffected by scaling or +rotation. Rotation is counterclockwise about the origin. The order of +operations is to rotate the figure, scale it, then offset it. + +For compatibility with older PostScript drivers, it is possible to change +the units that @samp{hscale} and @samp{vscale} are given in. This can be +done by redefining @samp{@@scaleunit} +@vindex scaleunit +in @samp{SDict} +@vindex SDict +by a @TeX{} command such as + +@example +\special@{! /@@scaleunit 1 def@} +@end example + +@noindent +The @samp{@@scaleunit} variable, which is by default 100, is what +@samp{hscale} and @samp{vscale} are divided by to yield an absolute +scale factor. + + +@c @node Dynamic creation of graphics +@section Dynamic creation of PostScript graphics files + +@cindex dynamic creation of graphics +@cindex compressed PostScript +@cindex uncompressing PostScript + +PostScript is an excellent page description language---but it does tend +to be rather verbose. Compressing PostScript graphics files can reduce +them by factor of five or more. For this reason, if the name of an +included PostScript file ends with @file{.Z} or @file{.gz}, dvipng +automatically runs @samp{gzip -d}. For example: + +@example +\epsffile[72 72 540 720]@{foo.ps.gz@} +@end example + +@noindent +Since the results of such a command are not accessible to @TeX{}, if you +use this facility with the @file{epsf} macros, you need to supply the +bounding box parameter yourself, as shown. + +More generally, if the filename parameter to one of the graphics +inclusion techniques starts with a left quote (@samp{`}), the parameter +is instead interpreted as a command to execute that will send the actual +file to standard output. For example: + +@example +\special@{psfile="`gnuplot foo"@} +@end example + +@noindent +@flindex gnuplot +to include the file @file{foo}. Of course, the command to be executed +can be anything, including using a file conversion utility such as +@file{tek2ps} or whatever is appropriate. This feature can be disabled +with the @samp{-R} command-line option or @samp{R} configuration option. + + +@c @node Fonts in figures +@section Fonts in figures + +@cindex figures and fonts +@cindex fonts, in PostScript figures +@findex %*Font + +You can use any font available to @TeX{} and dvipng within a graphics +file by putting a @code{%*Font:} line in the leading commentary of the +file. Schematically, this looks like: + +@example +%*Font: @var{tfmname} @var{scaledbp} @var{designbp} @var{hex-start}:@var{hex-bitstring} +@end example + +Here is the meaning of each of these elements: + +@table @var +@item tfmname +The @TeX{} TFM filename, e.g., @file{cmr10}. You can give the same +@var{tfmname} on more than one @samp{%*Font} line; this is useful when +the number of characters from the font used needs a longer +@var{hex-bitstring} (see item below) than conveniently fits on one line. + +@item scaledbp +The size at which you are using the font, in PostScript points (@TeX{} +big points). 72@dmn{bp} = 72.27@dmn{pt} = 1@dmn{in}. + +@item designbp +The designsize of the font, again in PostScript points. This should +match the value in the TFM file @var{tfmname}. Thus, for @file{cmr10}, +it should be @samp{9.96265}. + +@item hex-start +The character code of the first character used from the font, specified +as two ASCII hexadecimal characters, e.g., @samp{4b} or @samp{4B} for +@samp{K}. + +@item hex-bitstring +An arbitrary number of ASCII hexadecimal digits specifying which +characters following (and including) @var{hex-start} are used. This is +treated as a bitmap. For example, if your figure used the single letter +@samp{K}, you would use @samp{4b:8} for @var{hex-start} and +@var{hex-bitstring}. If it used @samp{KLMNP}, you would use +@samp{4b:f4}. + +@end table + +MetaPost's output figures contain lines like this for bitmap fonts used +in a MetaPost label (@pxref{MetaPost,,, web2c, Web2c}). + + +@c @node Header files +@chapter PostScript header files + +@cindex header files, defined +@cindex PostScript header files + +@dfn{Header files} are bits of PostScript included in the output file; +generally they provide support for special features, rather than +producing any printed output themselves. You can explicitly request +downloading header files if necessary for some figure, or to achieve +some special effect. + +@vindex psheaderdir +@flindex .pro @r{prologue files} +@flindex .lpro @r{long prologue files} +dvipng includes some headers on its own initiative, to implement features +such as PostScript font reencoding, bitmap font downloading, handling of +@code{\special}'s, and so on. These standard headers are the +@file{.pro} files (for ``prologue'') in the installation directory +@samp{$(psheaderdir)}; they are created from the @file{.lpro} (``long +prologue'') files in the distribution by stripping +comments, squeezing blank lines, etc., for maximum efficiency. If you +want to peruse one of the standard header files, read the @file{.lpro} +version. + +@vindex userdict@r{, and dictionary files} +@cindex dictionary, @code{userdict} +The PostScript dictionary stack will be at the @samp{userdict} level +when header files are included. + +@end ignore + +@node Diagnosing problems +@chapter Diagnosing problems + +@cindex problems +@cindex trouble +@cindex debugging + +You've gone through all the trouble of installing dvipng, carefully read +all the instructions in this manual, and still can't get something to +work. The following sections provide some helpful hints if you find +yourself in such a situation. + +Bug reports should be sent to +@email{dvipng@@nongnu.org}. + +Questions, suggestions for new features, pleas for help, and/or praise +should go to @email{dvipng@@nongnu.org}. For more information on this +mailing list, send a message with just the word `help' as subject or +body to @email{dvipng-request@@nongnu.org} or look at +@url{http://lists.nongnu.org/mailman/listinfo/dvipng}. + +Offers to support further development will be appreciated. For developer +access, ask on @email{dvipng@@nongnu.org}. + +For details on the @TeX{} path-searching library, and @code{mktexpk} +problems, @pxref{Common problems,,, kpathsea, Kpathsea}. + +@menu +* Debug options:: Getting diagnostics. +* Included graphics problems:: Figures are wrongly rendered. +@end menu + + +@node Debug options +@section Debug options + +@cindex debugging options +@cindex options, debugging + +The @samp{-d} flag to dvipng helps in tracking down certain errors. The +parameter to this flag is an integer that tells what errors are +currently being tracked. To track a certain class of debug messages, +simply provide the appropriate number given below; if you wish to track +multiple classes, sum the numbers of the classes you wish to track. To +track all classes, you can use @code{-1}. + +Some of these debugging options are actually provided by Kpathsea +(@pxref{Debugging, , , kpathsea, Kpathsea}). + +The classes are: +@table @asis +@item 1 +Normal dvi op-codes +@item 2 +Virtual fonts +@item 4 +PK fonts +@item 8 +TFM files +@item 16 +Glyph rendering +@item 32 +FreeType calls +@item 64 +Encoding loads +@item 128 +Color specials +@item 256 +GhostScript specials +@item 512 +T1lib calls +@item 1024 +Kpathsea @code{stat} calls +@item 2048 +Kpathsea hash table lookups +@item 4096 +Kpathsea path element expansion +@item 8192 +Kpathsea path searches +@ignore +@item 16384 +@end ignore + +@end table + +@node Included graphics problems +@section Included graphics problems + +@cindex graphics inclusion problems + +The most common problem with including graphics is an incorrect bounding +box. +@c (@pxref{Bounding box}). +Complain to whoever wrote the software that generated the file if the +bounding box is indeed incorrect. + +An additional problem is that the image in dvipng is always clipped to +the bounding box. This is because the image is rendered by GhostScript +by an internal call and then copied to the dvipng image. At present no +workaround is known, but there may be one for a future GhostScript. +We'll see. + +@ignore +@cindex Illustrator, workaround for +Another possible problem is that the figure you are trying to include +does not nest properly; there are certain rules PostScript applications +must follow when generating files to be included. The dvipng program +includes work-arounds for such errors in Adobe Illustrator and other +programs, but there are certainly applications that haven't been tested. + +One possible thing to try is the @samp{-K} flag which strips the comments +from an included figure. This might be necessary if the PostScript +spooling software does not read the structured comments correctly. Use +of this flag will break graphics from some applications, though, since +some applications read the PostScript file from the input stream, +looking for a particular comment. +@end ignore + +@node Color +@chapter Color + +To support color, dvipng recognizes a certain set of specials. These +specials start with the keyword @samp{color} or the keyword +@samp{background}, followed by a color specification. + +@menu +* Color specifications:: +* Color specials:: +@end menu + + +@node Color specifications +@section Color specifications + +@cindex color specifications + +The color specification supported by dvipng is by-value or by-name. The +by-value spec starts with the name of a color model (one of @samp{rgb}, +@samp{hsb}, @samp{cmy}, @samp{cmyk}, or @samp{gray}) followed by the +appropriate number of parameters. Thus, the color specification +@samp{rgb 0.3 0.4 0.5} would correspond to the color that is @samp{0.3 +0.4 0.5} in its red, blue and green values. The color used internally in +dvipng is @samp{RGB} (discretized to 256 levels), for details on the +formulas used in conversion, see the @samp{xcolor} documentation. + +By-name color specifications are single (case-dependent) words and are +compared with color names defined in @samp{dvipsnam.def} (from the +@samp{graphics} bundle), @samp{svgnam.def} and @samp{xcolor.sty} (from +the @samp{xcolor} bundle). + +On the command-line, the name @samp{Transparent} can also be used in as +an argument to @samp{--bg} to choose transparent background. +@xref{Option details}. + +@node Color specials +@section Color specials + +We will describe @samp{background} first, since it is the simplest. The +@samp{background} keyword must be followed by a color specification. +That color specification is used as a fill color for the background. The +last @samp{background} special on a page is the one that gets used, and +is used for the whole of the page image. (This is possible because the +prescan phase of dvipng notices all of the color specials so that the +appropriate information can be written out during the second phase.) + +The @samp{color} special itself has three forms. The first is just +@samp{color} followed by a color specification. In this case, the +current global color is set to that color; the color stack must be empty +when such a command is executed. + +The second form is @samp{color push} followed by a color specification. +This saves the current color on the color stack and sets the color to be +that given by the color specification. This is the most common way to +set a color. + +The final version of the @samp{color} special is just @samp{color pop}, +with no color specification; this says to pop the color last pushed on +the color stack from the color stack and set the current color to be +that color. + +dvipng correctly handles these color specials across pages, even when +the pages are rendered repeatedly or in reverse order. + +@node Credits +@chapter Credits + +A number of persons have contributed, if I forget to mention someone, I +apologize. First and foremost we have David Kastrup whose +@previewlatex{} project provided the incentive to write this program. +There is also a number of people who have contributed by reporting bugs +and suggesting improvements as the thing has evolved. These include but +is perhaps not limited to (in semi-random order): Thomas Esser +(te@TeX{}), Christian Schenk (MIK@TeX{}), Brian R Furry (debian +package), Angus Leeming (LyX), Thomas Boutell (libgd), John Jones (first +user report), Uwe Kern (xcolor), Alan Shutko, Reiner Stieb, Nick Alcock, +Adam Buchbinder, Svend Tollak Munkejord, James Longstreet, Bernhard +Simon, Bob McElrath, Georg Schwarz, Jason Farmer, Brian V. Smith, Samuel +Hathaway, Thomas R. Shemanske, Stephen Gibson, Christian Ridderstr@"om, +Ezra Peisach, William H Wheeler, Thomas Klausner, Harald Koenig, Adrian +Bunk, Kevin Smith, and Jason Riedy. + +@ifset man +@c man begin NOTES +The full manual is accessible in the info format, on most systems by typing +@example +info dvipng +@end example +@c man end +@c man begin COPYRIGHT +This program is released under the GNU General Public License, see the +COPYING file in the dvipng distribution or +@url{http://www.gnu.org/licenses/gpl.html}. + +Copyright @copyright{} 2002-2005 Jan-@AA{}ke Larsson +@c man end +@end ifset + +@node Copying +@chapter Copying + + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +@sp 2 +@noindent +Copyright @copyright{} 2002-2005 Jan-@AA{}ke Larsson + +@node Index +@unnumbered Index + +@printindex cp +@bye + diff --git a/Build/source/texk/dvipng/enc.c b/Build/source/texk/dvipng/enc.c new file mode 100644 index 00000000000..a5dd1688861 --- /dev/null +++ b/Build/source/texk/dvipng/enc.c @@ -0,0 +1,125 @@ +/* enc.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" + +struct encoding* encodingp=NULL; + +struct encoding* InitEncoding(char* encoding) +{ + char *pos,*max,*buf,*enc_file; + int i; + struct encoding* encp=NULL; + struct filemmap fmmap; + +#ifdef HAVE_KPSE_ENC_FORMATS + TEMPSTR(enc_file,kpse_find_file(encoding,kpse_enc_format,false)); +#else + TEMPSTR(enc_file,kpse_find_file(encoding,kpse_tex_ps_header_format,false)); +#endif + if (enc_file == NULL) { + Warning("encoding file %s could not be found",encoding); + return(NULL); + } + DEBUG_PRINT((DEBUG_FT|DEBUG_ENC),("\n OPEN ENCODING:\t'%s'", enc_file)); + if (MmapFile(enc_file,&fmmap)) return(NULL); + if ((encp = calloc(sizeof(struct encoding)+strlen(encoding)+1 + +fmmap.size,1))==NULL) { + Warning("cannot alloc space for encoding",enc_file); + UnMmapFile(&fmmap); + return(NULL); + } + encp->name=(char*)encp+sizeof(struct encoding); + strcpy(encp->name,encoding); + pos=fmmap.mmap; + max=fmmap.mmap+fmmap.size; + buf=encp->name+strlen(encoding)+1; +#define SKIPCOMMENT(x) if (*x=='%') while (x<max && *x!='\n') x++; + while(pos<max && *pos!='/') { + SKIPCOMMENT(pos); + pos++; + } + pos++; + encp->charname[256]=buf; + while(pos<max && *pos!='[' + && *pos!=' ' && *pos!='\t' && *pos!='\n' && *pos!='%') + *buf++=*pos++; + *buf++='\0'; + DEBUG_PRINT(DEBUG_ENC,("\n PS ENCODING '%s'", + encp->charname[256])); + while (pos < max && *pos!='[') { + SKIPCOMMENT(pos); + pos++; + } + while(pos<max && *pos!='/') { + SKIPCOMMENT(pos); + pos++; + } + i=0; + while(pos<max && *pos!=']') { + pos++; + encp->charname[i++]=buf; + while(pos<max && *pos!=' ' && *pos!='\t' && *pos!='\n' && *pos!='%') + *buf++=*pos++; + *buf++='\0'; + DEBUG_PRINT(DEBUG_ENC,("\n PS ENCODING %d '%s'", + i-1,encp->charname[i-1])); + while(pos<max && *pos!='/' && *pos!=']') { + SKIPCOMMENT(pos); + pos++; + } + } + UnMmapFile(&fmmap); + return(encp); +} + + +struct encoding* FindEncoding(char* encoding) +{ + struct encoding *temp=encodingp; + + /* printf("{%s} \n",encoding); */ + while(temp!=NULL && strcmp(encoding,temp->name)!=0) + temp=temp->next; + if (temp==NULL) { + temp=InitEncoding(encoding); + if (temp!=NULL) { + temp->next=encodingp; + encodingp=temp; + } + } + return(temp); +} + +void ClearEncoding(void) +{ + struct encoding *temp=encodingp; + + while(temp!=NULL) { + encodingp=encodingp->next; + free(temp); + temp=encodingp; + } +} diff --git a/Build/source/texk/dvipng/font.c b/Build/source/texk/dvipng/font.c new file mode 100644 index 00000000000..82079549a48 --- /dev/null +++ b/Build/source/texk/dvipng/font.c @@ -0,0 +1,376 @@ +/* font.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" + +void CheckChecksum(uint32_t c1, uint32_t c2, const char* name) +{ + /* Report a warning if both checksums are nonzero, they don't match, + and the user hasn't turned it off. */ + if (c1 && c2 && c1 != c2 +#ifdef HAVE_LIBKPATHSEA + && !kpse_tex_hush ("checksum") +#endif + ) { + Warning ("checksum mismatch in %s", name) ; + } +} + + +double ActualFactor(uint32_t unmodsize) +/* compute the actual size factor given the approximation */ +/* actually factor * 1000 */ +{ + double realsize; /* the actual magnification factor */ + realsize = (double)unmodsize / 1000.0; + if (abs((int)(unmodsize - 1095l))<2) + realsize = 1.095445115; /*stephalf*/ + else if (abs((int)(unmodsize - 1315l))<2) + realsize = 1.31453414; /*stepihalf*/ + else if (abs((int)(unmodsize - 1577l))<2) + realsize = 1.57744097; /*stepiihalf*/ + else if (abs((int)(unmodsize - 1893l))<2) + realsize = 1.89292916; /*stepiiihalf*/ + else if (abs((int)(unmodsize - 2074l))<2) + realsize = 2.0736; /*stepiv*/ + else if (abs((int)(unmodsize - 2488l))<2) + realsize = 2.48832; /*stepv*/ + else if (abs((int)(unmodsize - 2986l))<2) + realsize = 2.985984; /*stepvi*/ + /* the remaining magnification steps are represented with sufficient + accuracy already */ + return(realsize); +} + + +void FontDef(unsigned char* command, void* parent) +{ + int32_t k; + uint32_t c, s, d; + uint8_t a, l; + unsigned char* current; + struct font_entry *tfontptr; /* temporary font_entry pointer */ + struct font_num *tfontnump = NULL; /* temporary font_num pointer */ + unsigned short i; + + current = command + 1; + k = UNumRead(current, (int)*command - FNT_DEF1 + 1); + current += (int)*command - FNT_DEF1 + 1; + c = UNumRead(current, 4); /* checksum */ + s = UNumRead(current+4, 4); /* space size */ + d = UNumRead(current+8, 4); /* design size */ + a = UNumRead(current+12, 1); /* length for font name */ + l = UNumRead(current+13, 1); /* device length */ + if (((struct font_entry*)parent)->type==FONT_TYPE_VF) { + DEBUG_PRINT(DEBUG_VF,(" %d %d %d",k,c,s)); + /* Rescale. s is relative to the actual scale /(1<<20) */ + s = (uint32_t)((uint64_t) s * (((struct font_entry*) parent)->s) + / (1<<20)); + DEBUG_PRINT(DEBUG_VF,(" (%d) %d",s,d)); + /* Oddly, d differs in the DVI and the VF that my system produces */ + d = (uint32_t)((uint64_t) d * ((struct font_entry*)parent)->d + / ((struct font_entry*)parent)->designsize); + DEBUG_PRINT(DEBUG_VF,(" (%d)",d)); + DEBUG_PRINT(DEBUG_VF,(" %d %d '%.*s'",a,l,a+l,current+14)); +#ifdef DEBUG + } else { + DEBUG_PRINT(DEBUG_DVI,(" %d %d %d %d %d %d '%.*s'",k,c,s,d,a,l, + a+l,current+14)); +#endif + } + if (a+l > STRSIZE-1) + Fatal("too long font name for font %ld",k); + + /* Find entry with this font number in use */ + switch (((struct font_entry*)parent)->type) { + case FONT_TYPE_VF: + tfontnump = ((struct font_entry*)parent)->vffontnump; + break; + case DVI_TYPE: + tfontnump = ((struct dvi_data*)parent)->fontnump; + } + while (tfontnump != NULL && tfontnump->k != k) { + tfontnump = tfontnump->next; + } + /* If found, return if it is correct */ + if (tfontnump!=NULL + && tfontnump->fontp->s == s + && tfontnump->fontp->d == d + && strncmp(tfontnump->fontp->n,(char*)current+14,a+l) == 0) { + DEBUG_PRINT((DEBUG_DVI|DEBUG_VF),("\n FONT %d:\tMatch found",k)); + return; + } + /* If not found, create new */ + if (tfontnump==NULL) { + if ((tfontnump=malloc(sizeof(struct font_num)))==NULL) + Fatal("cannot allocate memory for new font number"); + tfontnump->k=k; + switch (((struct font_entry*)parent)->type) { + case FONT_TYPE_VF: + tfontnump->next=((struct font_entry*)parent)->vffontnump; + ((struct font_entry*)parent)->vffontnump=tfontnump; + break; + case DVI_TYPE: + tfontnump->next=((struct dvi_data*)parent)->fontnump; + ((struct dvi_data*)parent)->fontnump=tfontnump; + } + } + + /* Search font list for possible match */ + tfontptr = hfontptr; + while (tfontptr != NULL + && (tfontptr->s != s + || tfontptr->d != d + || strncmp(tfontptr->n,(char*)current+14,a+l) != 0 ) ) { + tfontptr = tfontptr->next; + } + /* If found, set its number and return */ + if (tfontptr!=NULL) { + DEBUG_PRINT((DEBUG_DVI|DEBUG_VF),("\n FONT %d:\tMatch found, number set",k)); + tfontnump->fontp = tfontptr; + return; + } + + DEBUG_PRINT((DEBUG_DVI|DEBUG_VF),("\n FONT %d:\tNew entry created",k)); + /* No fitting font found, create new entry. */ + if ((tfontptr = calloc(1,sizeof(struct font_entry))) == NULL) + Fatal("cannot malloc space for font_entry"); + tfontptr->next = hfontptr; + hfontptr = tfontptr; + tfontnump->fontp = tfontptr; +#ifndef MIKTEX + tfontptr->fmmap.fd = 0; +#else /* MIKTEX */ + tfontptr->fmmap.hFile = INVALID_HANDLE_VALUE; +#endif + tfontptr->c = c; /* checksum */ + tfontptr->s = s; /* space size */ + tfontptr->d = d; /* design size */ + tfontptr->a = a; /* length for font name */ + tfontptr->l = l; /* device length */ + strncpy(tfontptr->n,(char*)current+14,a+l); /* full font name */ + tfontptr->n[a+l] = '\0'; + + tfontptr->name[0] = '\0'; + for (i = FIRSTFNTCHAR; i <= LASTFNTCHAR; i++) { + tfontptr->chr[i] = NULL; + } + + tfontptr->dpi = + (uint32_t)((ActualFactor((uint32_t)(1000.0*tfontptr->s + /(double)tfontptr->d+0.5)) + * ActualFactor(dvi->mag) * dpi*shrinkfactor) + 0.5); +#ifdef HAVE_FT2_OR_LIBT1 + tfontptr->psfontmap=NULL; +#endif +} + +#ifdef HAVE_FT2_OR_LIBT1 +char* kpse_find_t1_or_tt(char* filename) +{ + char* filepath = kpse_find_file(filename, kpse_type1_format, false); +#ifdef HAVE_FT2 + if ((flags & USE_FREETYPE) && filepath==NULL) + filepath = kpse_find_file(filename, kpse_truetype_format, false); +#endif + return(filepath); +} +#endif + +void FontFind(struct font_entry * tfontptr) +{ +#ifdef HAVE_LIBKPATHSEA + kpse_glyph_file_type font_ret; + char *name; + + /* tfontptr->dpi = kpse_magstep_fix (tfontptr->dpi, resolution, NULL); */ + DEBUG_PRINT(DEBUG_DVI,("\n FIND FONT:\t%s %d",tfontptr->n,tfontptr->dpi)); + + TEMPSTR(name,kpse_find_vf (tfontptr->n)); + if (name!=NULL) { + strcpy (tfontptr->name, name); + InitVF(tfontptr); + } +#ifdef HAVE_FT2_OR_LIBT1 + if ((flags & (USE_FREETYPE | USE_LIBT1)) && name==NULL) { + tfontptr->psfontmap = FindPSFontMap(tfontptr->n); + if (tfontptr->psfontmap!=NULL) { + TEMPSTR(name,kpse_find_t1_or_tt(tfontptr->psfontmap->psfile)); + } else + TEMPSTR(name,kpse_find_t1_or_tt(tfontptr->n)); + if (name!=NULL) { + strcpy (tfontptr->name, name); + TEMPSTR(name,kpse_find_file(tfontptr->n, kpse_tfm_format, false)); + if (name!=NULL) { + if (!ReadTFM(tfontptr,name)) { + Warning("unable to read tfm file %s", name); + name=NULL; + } else +#ifdef HAVE_FT2 + if ((flags & USE_FREETYPE)==0 || !InitFT(tfontptr)) { +#endif +#ifdef HAVE_LIBT1 + if ((flags & USE_LIBT1)==0 || !InitT1(tfontptr)) { +#endif + /* if Freetype or T1 loading fails for some reason, fall + back to PK font */ + name=NULL; + } +#ifdef HAVE_FT2 +#ifdef HAVE_LIBT1 + } +#endif +#endif + } + } + } +#endif /* HAVE_FT2_OR_LIBT1 */ + if (name==NULL) { + TEMPSTR(name,kpse_find_pk (tfontptr->n, tfontptr->dpi, &font_ret)); + if (name!=NULL) { + strcpy (tfontptr->name, name); + if (!FILESTRCASEEQ (tfontptr->n, font_ret.name)) { + flags |= PAGE_GAVE_WARN; + Warning("font %s not found, using %s at %d dpi instead", + tfontptr->n, font_ret.name, font_ret.dpi); + tfontptr->c = 0; /* no checksum warning */ + } else if (!kpse_bitmap_tolerance ((double)font_ret.dpi, (double) tfontptr->dpi)) { + flags |= PAGE_GAVE_WARN; + Warning("font %s at %d dpi not found, using %d dpi instead", + tfontptr->name, tfontptr->dpi, font_ret.dpi); + } + InitPK(tfontptr); + } else { + flags |= PAGE_GAVE_WARN; + Warning("font %s at %d dpi not found, characters will be left blank", + tfontptr->n, tfontptr->dpi); + strcpy (tfontptr->name, "None"); +#ifndef MIKTEX + tfontptr->fmmap.fd = 0; +#else /* MIKTEX */ + tfontptr->fmmap.hFile = INVALID_HANDLE_VALUE; +#endif + tfontptr->magnification = 0; + tfontptr->designsize = 0; + } + } +#else /* not HAVE_LIBKPATHSEA */ + /* Ouch time! findfile not implemented (old cruft from dvilj) */ + /* Total argh, since none of this is adapted to vf and the like */ + if (!(findfile(PXLpath, + tfontptr->n, + tfontptr->dpi, + tfontptr->name, + false, + 0))) { + Warning(tfontptr->name); /* contains error messsage */ +#ifndef MIKTEX + tfontptr->fmmap.fd = 0; +#else /* MIKTEX */ + tfontptr->fmmap.hFile = INVALID_HANDLE_VALUE; +#endif +#ifdef __riscos + MakeMetafontFile(PXLpath, tfontptr->n, tfontptr->dpi); +#endif + } +#endif +} + + +void DoneFont(struct font_entry *tfontp) +{ + switch (tfontp->type) { + case FONT_TYPE_PK: + DonePK(tfontp); + break; + case FONT_TYPE_VF: + DoneVF(tfontp); + break; +#ifdef HAVE_FT2 + case FONT_TYPE_FT: + DoneFT(tfontp); + break; +#endif +#ifdef HAVE_LIBT1 + case FONT_TYPE_T1: + DoneT1(tfontp); + break; +#endif + } +} + + +void FreeFontNumP(struct font_num *hfontnump) +{ + struct font_num *tmp; + while(hfontnump!=NULL) { + tmp=hfontnump->next; + free(hfontnump); + hfontnump=tmp; + } +} + +void ClearFonts(void) +{ + struct font_entry *tmp; + + while(hfontptr!=NULL) { + tmp=hfontptr->next; + DoneFont(hfontptr); + free(hfontptr); + hfontptr=tmp; + } + if (dvi!=NULL) + FreeFontNumP(dvi->fontnump); +} + +/*-->SetFntNum*/ +/**********************************************************************/ +/**************************** SetFntNum *****************************/ +/**********************************************************************/ +void SetFntNum(int32_t k, void* parent /* dvi/vf */) +/* this routine is used to specify the font to be used in printing future + characters */ +{ + struct font_num *tfontnump=NULL; /* temporary font_num pointer */ + + switch (((struct font_entry*)parent)->type) { + case FONT_TYPE_VF: + tfontnump = ((struct font_entry*)parent)->vffontnump; + break; + case DVI_TYPE: + tfontnump = ((struct dvi_data*)parent)->fontnump; + } + while (tfontnump != NULL && tfontnump->k != k) + tfontnump = tfontnump->next; + if (tfontnump == NULL) + Fatal("font %d undefined", k); + + currentfont = tfontnump->fontp; + if (currentfont->name[0]=='\0') + FontFind(currentfont); +} + + diff --git a/Build/source/texk/dvipng/fontmap.c b/Build/source/texk/dvipng/fontmap.c new file mode 100644 index 00000000000..cecbd75dbfa --- /dev/null +++ b/Build/source/texk/dvipng/fontmap.c @@ -0,0 +1,250 @@ +/* fontmap.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" + +static char* psfont_name=NULL; +static struct filemmap psfont_mmap; +static struct psfontmap *psfontmap=NULL; + +char* newword(char** buffer, char* end) +{ + char *word,*pos=*buffer; + + while(pos<end && *pos!=' ' && *pos!='\t' && *pos!='"') pos++; + if ((word=malloc(pos-*buffer+1))==NULL) + Fatal("cannot malloc space for string"); + strncpy(word,*buffer,pos-*buffer); + word[pos-*buffer]='\0'; + if (*pos=='"') pos++; + *buffer=pos; + return(word); +} + +char* find_format(char* name) +{ + /* Cater for both new (first case) and old (second case) kpathsea */ + char* format = + kpse_find_file(name,kpse_fontmap_format,false); + + if (format==NULL) + format = kpse_find_file(name,kpse_dvips_config_format,false); + return(format); +} + +void InitPSFontMap(void) +{ + char *pos,*end; + struct psfontmap *entry; + + psfont_name=find_format("ps2pk.map"); + if (psfont_name==NULL) + psfont_name=find_format("psfonts.map"); + + if (psfont_name==NULL) { + Warning("cannot find ps2pk.map, nor psfonts.map"); + return; + } + DEBUG_PRINT(DEBUG_FT,("\n OPEN PSFONT MAP:\t'%s'", psfont_name)); + if (MmapFile(psfont_name,&psfont_mmap)) { + Warning("psfonts map %s could not be opened", psfont_name); + return; + } + pos = psfont_mmap.mmap; + end = psfont_mmap.mmap+psfont_mmap.size; + while(pos<end) { + while(pos < end && (*pos=='\n' || *pos==' ' || *pos=='\t' + || *pos=='%' || *pos=='*' || *pos==';' || *pos=='#')) { + while(pos < end && *pos!='\n') pos++; /* skip comments/empty rows */ + pos++; + } + if (pos < end) { + if ((entry=malloc(sizeof(struct psfontmap)))==NULL) + Fatal("cannot malloc psfontmap space"); + entry->line = pos; + /* skip <something and quoted entries */ + while(pos < end && (*pos=='<' || *pos=='"')) { + if (*pos=='<') + while(pos < end && *pos!=' ' && *pos!='\t') pos++; + else + while(pos < end && *pos!='"') pos++; + while(pos < end && (*pos==' ' || *pos=='\t')) pos++; + } + /* first word is font name */ + entry->tfmname = newword(&pos,end); + entry->psfile = NULL; + entry->encname = NULL; + entry->encoding = NULL; + while(pos < end && *pos!='\n') pos++; + entry->end = pos; + entry->next=psfontmap; + psfontmap=entry; + } + pos++; + } +} + +void ClearPSFontMap(void) +{ + struct psfontmap *entry; + + while(psfontmap!=NULL) { + entry=psfontmap; + psfontmap=psfontmap->next; + free(entry->tfmname); + if (entry->psfile!=NULL) + free(entry->psfile); + if (entry->encname!=NULL) + free(entry->encname); + free(entry); + } + UnMmapFile(&psfont_mmap); + if (psfont_name != NULL) + free(psfont_name); + psfont_name=NULL; +} + +struct psfontmap* FindPSFontMap(char* fontname) +{ + char *pos,*tfmname,*psname; + struct psfontmap *entry; + double cxx=0.0,cxy=0.0; + + entry=psfontmap; + while(entry!=NULL && strcmp(entry->tfmname,fontname)!=0) + entry=entry->next; + if (entry!=NULL && entry->psfile==NULL) { + int nameno = 0; + + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("\n PSFONTMAP: %s ",fontname)); + pos=entry->line; +#if HAVE_LIBT1 + entry->t1_transformp=NULL; +#endif +#if HAVE_FT2 + entry->ft_transformp=NULL; +#endif + while(pos < entry->end) { + if (*pos=='<') { /* filename follows */ + pos++; + if (pos<entry->end && *pos=='<') { /* <<download.font */ + pos++; + entry->psfile = newword((char**)&pos,entry->end); + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("<%s ",entry->psfile)); + } else if (pos<entry->end && *pos=='[') { /* <[encoding.file */ + pos++; + entry->encname = newword((char**)&pos,entry->end); + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("<[%s ",entry->encname)); + } else { /* <some.file */ + char* word =newword((char**)&pos,entry->end); + if (strncmp(word+strlen(word)-4,".enc",4)==0) {/* <some.enc */ + entry->encname=word; + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("<[%s ",entry->encname)); + } else { /* <font */ + entry->psfile=word; + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("<%s ",entry->psfile)); + } + } + } else if (*pos=='"') { /* PS code: reencoding/tranformation exists */ + double val=0.0; + pos++; + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("\"")); + while(pos < entry->end && *pos!='"') { + val=strtod(pos,(char**)&pos); + /* Small buffer overrun risk, but we're inside double quotes */ + while(pos < entry->end && (*pos==' ' || *pos=='\t')) pos++; + if (pos<entry->end-10 && strncmp(pos,"ExtendFont",10)==0) { + cxx=val; + DEBUG_PRINT((DEBUG_FT|DEBUG_T1), + ("%f ExtendFont ",cxx)); + } + if (pos<entry->end-9 && strncmp(pos,"SlantFont",9)==0) { + cxy=val; + DEBUG_PRINT((DEBUG_FT|DEBUG_T1), + ("%f SlantFont ",cxy)); + } + while(pos<entry->end && *pos!=' ' && *pos!='\t' && *pos!='"') + pos++; + } +#if HAVE_FT2 + entry->ft_transformp=&(entry->ft_transform); + if (cxx!=0.0) + entry->ft_transform.xx=(FT_Fixed)(cxx*0x10000); + else + entry->ft_transform.xx=0x10000; + entry->ft_transform.xy=(FT_Fixed)(cxy*0x10000); + entry->ft_transform.yx=0; + entry->ft_transform.yy=0x10000; +#endif +#if HAVE_LIBT1 + entry->t1_transformp=&(entry->t1_transform); + if (cxx!=0) + entry->t1_transform.cxx=cxx; + else + entry->t1_transform.cxx=1.0; + entry->t1_transform.cxy=cxy; + entry->t1_transform.cyx=0.0; + entry->t1_transform.cyy=1.0; +#endif + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("\" ")); + pos++; + } else { /* bare word */ + switch (++nameno) { + case 1: /* first word is tfmname and perhaps psname */ + while(pos<entry->end && *pos!=' ' && *pos!='\t') pos++; + psname=entry->tfmname; + break; + case 2: /* second word is psname */ + psname = newword((char**)&pos,entry->end); + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("(%s) ",psname)); + free(psname); + break; + case 3: /* third word is encoding */ + entry->encname = newword((char**)&pos,entry->end); + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("<[%s ",entry->encname)); + break; + default: + Warning("more than three bare words in font map entry"); + } + } + while(pos < entry->end && (*pos==' ' || *pos=='\t')) pos++; + } + if (entry->psfile==NULL) { + /* No psfile-name given, use (free-able copy of) tfmname */ + entry->psfile=newword(&tfmname,tfmname+strlen(tfmname)); + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),(" <%s ",entry->psfile)); + } + if (entry->encname!=NULL + && (entry->encoding=FindEncoding(entry->encname))==NULL) + Warning("unable to load font encoding '%s' for %s", + entry->encname,entry->tfmname); + } + if (entry != NULL && entry->encname!=NULL && entry->encoding==NULL) + /* Encoding given but it cannot be found. Unusable font */ + return(NULL); + + return(entry); +} + diff --git a/Build/source/texk/dvipng/ft.c b/Build/source/texk/dvipng/ft.c new file mode 100644 index 00000000000..d23017a93ba --- /dev/null +++ b/Build/source/texk/dvipng/ft.c @@ -0,0 +1,163 @@ +/* ft.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif + +void LoadFT(int32_t c, struct char_entry * ptr) +{ + FT_Bitmap bitmap; + FT_UInt glyph_i; + int i,j,k; + unsigned char* bit; + + DEBUG_PRINT(DEBUG_FT,("\n LOAD FT CHAR\t%d (%d)",c,ptr->tfmw)); + if (currentfont->psfontmap!=NULL + && currentfont->psfontmap->encoding != NULL) + glyph_i = FT_Get_Name_Index(currentfont->face, + currentfont->psfontmap->encoding->charname[c]); + else + glyph_i = FT_Get_Char_Index( currentfont->face, c ); + if (FT_Load_Glyph( currentfont->face, /* handle to face object */ + glyph_i, /* glyph index */ + FT_LOAD_RENDER | FT_LOAD_NO_HINTING )) + /* load flags */ + Fatal("cannot load FT char %d",c); + ptr->xOffset = -currentfont->face->glyph->bitmap_left*shrinkfactor; + ptr->yOffset = (currentfont->face->glyph->bitmap_top-1)*shrinkfactor; + bitmap=currentfont->face->glyph->bitmap; + DEBUG_PRINT(DEBUG_FT,(" (%dx%d)",bitmap.width,bitmap.rows)); + + if ((ptr->data = calloc(bitmap.width*bitmap.rows,sizeof(char))) == NULL) + Fatal("unable to allocate image space for char %c", (char)c); + ptr->w = bitmap.width; + ptr->h = bitmap.rows; + +#define GREYLEVELS 16 + DEBUG_PRINT(DEBUG_GLYPH,("\nDRAW GLYPH %d\n", (int)c)); + bit=ptr->data; + for(i=0;i<bitmap.rows;i++) { + for(j=0;j<bitmap.width;j++) { + k=bitmap.buffer[i*bitmap.pitch+j]/(256/GREYLEVELS)*17; + /* k=(bitmap.buffer[i*bitmap.pitch+j]+1)/16; */ + /* k= k>0 ? k*16-1 : 0; */ + DEBUG_PRINT(DEBUG_GLYPH,("%3u ",k)); + bit[i*bitmap.width+j]=k; + } + DEBUG_PRINT(DEBUG_GLYPH,("|\n")); + } +} + +bool InitFT(struct font_entry * tfontp) +{ + int error; + + if (libfreetype==NULL) { + if (FT_Init_FreeType( &libfreetype )) { + Warning("an error occured during freetype initialisation, disabling it"); + flags &= ~USE_FREETYPE; + return(false); + } +# ifdef DEBUG + else { + FT_Int amajor, aminor, apatch; + + FT_Library_Version( libfreetype, &amajor, &aminor, &apatch ); + DEBUG_PRINT(DEBUG_FT,("\n FREETYPE VERSION: FreeType %d.%d.%d", + amajor, aminor, apatch)); + } +# endif + } + + DEBUG_PRINT((DEBUG_DVI|DEBUG_FT),("\n OPEN FT FONT:\t'%s'", tfontp->name)); + error = FT_New_Face( libfreetype, tfontp->name, 0, &tfontp->face ); + if (error == FT_Err_Unknown_File_Format) { + Warning("font file %s has unknown format", tfontp->name); + return(false); + } else if (error) { + Warning("font file %s could not be opened", tfontp->name); + return(false); + } + Message(BE_VERBOSE,"<%s>", tfontp->name); + if (tfontp->psfontmap == NULL || tfontp->psfontmap->encoding == NULL) { +#ifndef FT_ENCODING_ADOBE_CUSTOM +# define FT_ENCODING_ADOBE_CUSTOM ft_encoding_adobe_custom +# define FT_ENCODING_ADOBE_STANDARD ft_encoding_adobe_standard +#endif + if (FT_Select_Charmap( tfontp->face, FT_ENCODING_ADOBE_CUSTOM )) { + Warning("unable to set font encoding FT_ENCODING_ADOBE_CUSTOM for %s", + tfontp->name); + if(FT_Select_Charmap( tfontp->face, FT_ENCODING_ADOBE_STANDARD )) { + Warning("unable to set font encoding for %s", tfontp->name); + return(false); + } + } + } + if (FT_Set_Char_Size( tfontp->face, /* handle to face object */ + 0, /* char_width in 1/64th of points */ + ((int64_t)tfontp->d*64*7200)/7227/65536, + /* char_height in 1/64th of _big_points, + not TeX points */ + tfontp->dpi/shrinkfactor, /* horizontal resolution */ + tfontp->dpi/shrinkfactor )) /* vertical resolution */ { + Warning("unable to set font size for %s", tfontp->name); + return(false); + } + if (tfontp->psfontmap!=NULL) + FT_Set_Transform(tfontp->face, tfontp->psfontmap->ft_transformp, NULL); + tfontp->type = FONT_TYPE_FT; + return(true); +} + + +void UnLoadFT(struct char_entry *ptr) +{ + if (ptr->data!=NULL) + free(ptr->data); + ptr->data=NULL; +} + + +void DoneFT(struct font_entry *tfontp) +{ + int c=0; + + int error = FT_Done_Face( tfontp->face ); + if (error) + Warning("font file %s could not be closed", tfontp->name); + while(c<NFNTCHARS-1) { + if (tfontp->chr[c]!=NULL) { + UnLoadFT((struct char_entry*)tfontp->chr[c]); + free(tfontp->chr[c]); + tfontp->chr[c]=NULL; + } + c++; + } + tfontp->name[0]='\0'; +} + + diff --git a/Build/source/texk/dvipng/install-sh b/Build/source/texk/dvipng/install-sh new file mode 100755 index 00000000000..e9de23842dc --- /dev/null +++ b/Build/source/texk/dvipng/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# 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. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# 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=: + chmodcmd="" + 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/dvipng/install.texi b/Build/source/texk/dvipng/install.texi new file mode 100644 index 00000000000..e43cbf19200 --- /dev/null +++ b/Build/source/texk/dvipng/install.texi @@ -0,0 +1,193 @@ +@c install.texi +@c +@c Part of the dvipng distribution + +@include macros.texi +@ifset rawfile +@chapter Installing dvipng + +@end ifset +@c ----------------------- +Installing dvipng should be simple: merely @code{./configure}, +@code{make}, and @code{make install}. + +@ifclear rawfile +@menu +* Prerequisites:: +* Configure:: +* Build/install:: +* Installation outside the texmf tree:: +* Advice for non-privileged users:: +@end menu +@end ifclear + +@node Prerequisites +@section Prerequisites + +@itemize @bullet +@item The GD Graphics Draw library, libgd + +The drawing library @samp{libgd} is necessary, and is downloadable at +@uref{http://www.boutell.com/gd}, and there are binary packages for +most operating systems from their respective distributors. In any +case, the latest version of the library installs using @samp{autoconf} +so it should not be difficult for you to install it from source, and +then proceed with installing dvipng. + +@item The path-searching library kpathsea + +Kpathsea is most likely included in your @LaTeX{} installation, but it +may happen that ./configure does not find it; see below. If you do not +have it, download it from @uref{http://www.ctan.org} and compile it. +I have no experience with this, so I cannot help much here. + +@item FreeType 2 and/or T1lib + +While not strictly necessary, you may want to have FreeType 2 or T1lib +available. Their presence will enable direct support for PostScript +fonts in dvipng, rather than using @samp{gsftopk} for rendering the +fonts. If you have PostScript versons of Computer Modern installed, +there will be no need to generate bitmapped variants on disk of +these. Then, you can render images at different (and unusual) +resolutions without cluttering the disk with lots of bitmapped fonts. +If both FreeType 2 and T1lib are present, FreeType will be internally +preferred by dvipng, but T1lib can be chosen at runtime. + +@item libpng and libz + +To be able to compress and write PNG files to disk, dvipng (or really +libgd) uses libpng which in turn uses libz. These should be available on +any modern system, if not, download them and install them. + +@item The @code{texinfo} package + +This is needed for building the documentation. +@ignore +If you don't have this, +you may download a separate tar file with the prebuilt documentation +from Sourceforge and install it over the main unpacked tar archive. +@end ignore +@end itemize + +@node Configure +@section Configure + +The first step is to configure the source code, telling it where +various files will be. To do so, run + +@example +./configure @var{options} +@end example + +(Note: if you have fetched dvipng from CVS rather than a regular +release, you will have to first generate @file{./configure} by running +@code{autoconf} 2.53 or later in the @file{preview} directory.) + +On many machines, you will not need to specify any options, but if +@code{configure} cannot determine something on its own, you'll need to +help it out. For a list of the options type + +@example +./configure --help +@end example + +On some machines, the libraries will be installed in directories that +are not in the linker's search path. This will generate an error when +running @file{./configure}, indicating that it cannot find libgd or +libkpathsea (most likely). You then need to specify the path to the +respective library's object files. They are typically called e.g., +@file{libgd.a} or @file{libgd.so}. If they are located in e.g., +@file{/sw/local/lib}, do + +@example +./configure LDFLAGS=-L/sw/local/lib +@end example + +If the library is available as a shared object file (@file{.so}), the +runtime linker may also need to be told where to find the library, +then use + +@example +./configure LDFLAGS='-L/sw/local/lib -R/sw/local/lib' +@end example + +When either of these is necessary, it is likely that the C header +files are also installed in directories that are not in the C +preprocessor's search path. This will also generate an error when +running @file{./configure}, indicating that it cannot find e.g., +@file{gd.h} or @file{kpathsea.h} (most likely). You then need to +specify the path to the respective library's C header files. If they +are located in e.g., @file{/sw/local/include}, do + +@example +./configure CPPFLAGS=-I/sw/local/include +@end example + +On my SUN Solaris workstation, I had to combine this into + +@example +./configure CPPFLAGS='-I/sw/local/include -I/sw/tex/teTeX/1.0/include'\ + LDFLAGS='-L/sw/local/lib -R/sw/local/lib -L/sw/tex/teTeX/1.0/lib/' +@end example + +@noindent +where the backslash denotes a continuation of the line. + +@node Build/install +@section Build/install + +Once @file{configure} has been run, simply enter + +@example +make +@end example +@noindent +at the prompt to compile the C code, and build the documentation files. +To install the files into the locations chosen earlier, type + +@example +make install +@end example + +@noindent +You may need special privileges to install, e.g., if you are installing +into system directories. + +@node Installation outside the texmf tree +@section Installation outside the texmf tree + +In some cases, a dvipng binary installed outside the texmf tree will +not be able to find virtual fonts, or the PostScript font maps +(normally used by dvips). This may be because @emph{only} +$SELFAUTOLOC, $SELFAUTODIR, and $SELFAUTOPARENT are used in the texmf +tree configuration file @samp{texmf.cnf}. If so, give the switch +@samp{--enable-selfauto-set} to @samp{./configure}. This will make +dvipng adjust these three internally so that kpathsea thinks that +dvipng @emph{is} installed in the texmf tree. + +@node Advice for non-privileged users +@section Installation for non-privileged users + +Often people without system administration privileges want to install +software for their private use. In that case you need to specify more +options to the @file{configure} script, usually this is done by using +the @samp{--prefix} option to the @file{configure} script, and let it +point to the personal home directory. In that way, resulting binaries +will be installed under the @file{bin} subdirectory of your home +directory, manual pages under @file{man} and so on. That way, it is +reasonably easy to maintain a bunch of additional packages, since the +prefix argument is supported by most @file{configure} scripts. + +You'll have to add something like @file{/home/myself/bin} to your +@code{PATH} shell variable, if it isn't there already, and similarly set +the @code{INFOPATH} variable to be able to access the documentation. + +@ifset rawfile +@section Copying + +This program is released under the GNU General Public License, see the +COPYING file in the dvipng distribution or +@url{http://www.gnu.org/licenses/gpl.html}. + +Copyright @copyright{} 2002-2005 Jan-@AA{}ke Larsson +@end ifset diff --git a/Build/source/texk/dvipng/macros.texi b/Build/source/texk/dvipng/macros.texi new file mode 100644 index 00000000000..4d5aafbbd0a --- /dev/null +++ b/Build/source/texk/dvipng/macros.texi @@ -0,0 +1,61 @@ +@ignore +macros.texi + +Part of the dvipng distribution + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Copyright @copyright{} 2002-2005 Jan-@AA{}ke Larsson +@end ignore + +@ifclear macros +@set macros +@macro AUCTeX {} +AUC@TeX{} +@end macro +@ifnottex +@macro LaTeX {} +La@TeX{} +@end macro +@macro previewlatex {} +preview-latex +@end macro +@ifset no-acronym +@clear no-acronym +@macro acronym {text} +@sc{\text\} +@end macro +@end ifset +@ifset no-env +@clear no-env +@macro env {text} +@code{\text\} +@end macro +@end ifset +@ifset no-option +@clear no-option +@macro option {text} +@samp{\text\} +@end macro +@end ifset +@end ifnottex +@tex +\gdef\LaTeX{L\kern-.36em\raise.3ex\hbox{\sc{a}}\kern-.15em\TeX} +\gdef\previewlatex{Preview-\LaTeX} +\ifx\acronym\undefined \gdef\acronym#1{{\smallcaps \lowercase{#1}}} \fi +\ifx\env\undefined \global\let\env=\code \fi +\ifx\option\undefined \global\let\option=\samp \fi +@end tex +@end ifclear diff --git a/Build/source/texk/dvipng/miktex.h b/Build/source/texk/dvipng/miktex.h new file mode 100644 index 00000000000..ed47faac283 --- /dev/null +++ b/Build/source/texk/dvipng/miktex.h @@ -0,0 +1,252 @@ +/* config.h. Edited for MiKTeX. */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define as 1 to get the debug (-d) option. */ +#define DEBUG 1 + +/* The environment setting for $SELFAUTODIR */ +#undef ENV_SELFAUTODIR + +/* The environment setting for $SELFAUTOLOC */ +#undef ENV_SELFAUTOLOC + +/* The environment setting for $SELFAUTOPARENT */ +#undef ENV_SELFAUTOPARENT + +/* Define as the path to GhostScript. */ +#undef GS_PATH + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +#undef HAVE_DOPRNT + +/* Define to 1 if you have the `dup2' function. */ +#undef HAVE_DUP2 + +/* Define to 1 if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have freetype2 */ +#undef HAVE_FT2 + +/* Define to 1 if you have the `ftime' function. */ +#undef HAVE_FTIME + +/* Define to 1 if you have the `gdImageCreateTrueColor' function. */ +#define HAVE_GDIMAGECREATETRUECOLOR 1 + +/* Define to 1 if you have the `gdImageGif' function. */ +#undef HAVE_GDIMAGEGIF + +/* Define to 1 if you have the `gdImagePngEx' function. */ +#define HAVE_GDIMAGEPNGEX 1 + +/* Define to 1 if you have the `gdImageTrueColorToPalette' function. */ +#define HAVE_GDIMAGETRUECOLORTOPALETTE 1 + +/* Define to 1 if you have the <gd.h> header file. */ +#define HAVE_GD_H 1 + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the <kpathsea/kpathsea.h> header file. */ +#define HAVE_KPATHSEA_KPATHSEA_H 1 + +/* Define to 1 if your kpathsea has kpse_enc_format */ +#define HAVE_KPSE_ENC_FORMATS 1 + +/* Define to 1 if you have the `gd' library (-lgd). */ +#define HAVE_LIBGD 1 + +/* Define to 1 if you have the `gen' library (-lgen). */ +#undef HAVE_LIBGEN + +/* Define to 1 if you have the `kpathsea' library (-lkpathsea). */ +#define HAVE_LIBKPATHSEA 1 + +/* Define to 1 if you have the `m' library (-lm). */ +#define HAVE_LIBM 1 + +/* Define to 1 if you have the `png' library (-lpng). */ +#define HAVE_LIBPNG 1 + +/* Define to 1 if you have the `t1' library (-lt1). */ +#undef HAVE_LIBT1 + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the `memchr' function. */ +#undef HAVE_MEMCHR + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the `munmap' function. */ +#undef HAVE_MUNMAP + +/* Define to 1 if you have the <png.h> header file. */ +#define HAVE_PNG_H 1 + +/* Define to 1 if you have the `putenv' function. */ +#undef HAVE_PUTENV + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strrchr' function. */ +#undef HAVE_STRRCHR + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the <t1lib.h> header file. */ +#undef HAVE_T1LIB_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the <vfork.h> header file. */ +#undef HAVE_VFORK_H + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL 1 + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "dvipng@nongnu.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "dvipng" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "dvipng 1.6" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "dvipng" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.6" + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ +#undef TIME_WITH_SYS_TIME + +/* Define as 1 to get execution time output. */ +#undef TIMING + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to `int' if <sys/types.h> does not define. */ +#undef pid_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork diff --git a/Build/source/texk/dvipng/miktex.mak b/Build/source/texk/dvipng/miktex.mak new file mode 100644 index 00000000000..5a0ea6795ef --- /dev/null +++ b/Build/source/texk/dvipng/miktex.mak @@ -0,0 +1,196 @@ +## miktex.mak: dvipng +## +## Copyright (C) 2004 Christian Schenk <cs@miktex.org> +## +## This file 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 file 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 file; if not, write to the Free Software +## Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +## USA. + +miktex_cc_no_warnings = 1 +miktex_cc_disable_optimization = 1 + +!include ..\miktex.inc + +objects = \ + $(outdir)\color.obj \ + $(outdir)\draw.obj \ + $(outdir)\dvi.obj \ + $(outdir)\dvipng.obj \ + $(outdir)\font.obj \ + $(outdir)\misc.obj \ + $(outdir)\papersiz.obj \ + $(outdir)\pk.obj \ + $(outdir)\ppagelist.obj \ + $(outdir)\set.obj \ + $(outdir)\special.obj \ + $(outdir)\vf.obj \ + $(wrapper_obj) \ + +sources = \ + color.c \ + draw.c \ + dvi.c \ + dvipng.c \ + font.c \ + misc.c \ + papersiz.c \ + pk.c \ + ppagelist.c \ + set.c \ + special.c \ + vf.c \ + +extra_cdefines = \ + -Dalloca=_alloca \ + -DUSE_MIKTEX_EXIT \ + +extra_cincludes = \ + -I$(gdlibdir) \ + -I$(kpslibdir) \ + +.c{$(outdir)\}.obj: + $(cc) $(cstandard) \ + $(extra_cdefines) \ + $(extra_cincludes) \ + $(ccopt_output_directory)$(outdir)\ $< + +binaries = $(outdir)\dvipng.exe + +all: common-all $(binaries) + +install: common-install install-binaries + +qrt: common-qrt + +# ----------------------------------------------------------------------------- +# dvipng +# ----------------------------------------------------------------------------- + +libs = \ + $(miktex_lib) \ + $(gd_lib) \ + $(kps_lib) \ + $(gnu_lib) \ + $(texmf_lib) \ + +$(outdir)\dvipng.exe: \ + $(outdir) \ + $(objects) \ + $(libs) \ + $(outdir)\dvipng.res \ + + $(link) $(lstandard) \ + -out:$@ \ + $(objects) \ + $(libs) \ + $(outdir)\dvipng.res \ + +$(outdir)\dvipng.res: \ + $(libdir)\miktex-version.h \ + $(outdir) \ + dvipng-version.h \ + dvipng.rc \ + + $(rc) $(rcstandard) $(rcopt_output_file)$@ dvipng.rc + +# ----------------------------------------------------------------------------- +# clean-up +# ----------------------------------------------------------------------------- + +mostlyclean: common-mostlyclean + +clean: common-clean mostlyclean + +distclean: common-distclean clean + +realclean: common-realclean distclean + +# ----------------------------------------------------------------------------- +# dependencies +# ----------------------------------------------------------------------------- + +!include ..\common-dependencies.inc + +depend: $(sources) + $(MAKEDEPEND1) $(extra_cincludes) $(extra_cdefines) $(sources) + +# DO NOT DELETE + +$(outdir)\color.obj: dvipng.h config.h .\inttypes.h $(gdlibdir)\gd.h +$(outdir)\color.obj: $(gdlibdir)\gd_io.h $(gdlibdir)\gdfx.h +$(outdir)\color.obj: $(kpslibdir)\kpathsea\kpathsea.h +$(outdir)\color.obj: $(kpslibdir)\web2c-miktex.h ..\lib\miktex.h +$(outdir)\color.obj: ..\lib\miktex-features.h commands.h +$(outdir)\draw.obj: dvipng.h config.h .\inttypes.h $(gdlibdir)\gd.h +$(outdir)\draw.obj: $(gdlibdir)\gd_io.h $(gdlibdir)\gdfx.h +$(outdir)\draw.obj: $(kpslibdir)\kpathsea\kpathsea.h +$(outdir)\draw.obj: $(kpslibdir)\web2c-miktex.h ..\lib\miktex.h +$(outdir)\draw.obj: ..\lib\miktex-features.h commands.h +$(outdir)\dvi.obj: dvipng.h config.h .\inttypes.h $(gdlibdir)\gd.h +$(outdir)\dvi.obj: $(gdlibdir)\gd_io.h $(gdlibdir)\gdfx.h +$(outdir)\dvi.obj: $(kpslibdir)\kpathsea\kpathsea.h +$(outdir)\dvi.obj: $(kpslibdir)\web2c-miktex.h ..\lib\miktex.h +$(outdir)\dvi.obj: ..\lib\miktex-features.h commands.h ..\libgnu\gnu-miktex.h +$(outdir)\dvipng.obj: dvipng.h config.h .\inttypes.h +$(outdir)\dvipng.obj: $(gdlibdir)\gd.h $(gdlibdir)\gd_io.h +$(outdir)\dvipng.obj: $(gdlibdir)\gdfx.h +$(outdir)\dvipng.obj: $(kpslibdir)\kpathsea\kpathsea.h +$(outdir)\dvipng.obj: $(kpslibdir)\web2c-miktex.h ..\lib\miktex.h +$(outdir)\dvipng.obj: ..\lib\miktex-features.h commands.h +$(outdir)\font.obj: dvipng.h config.h .\inttypes.h $(gdlibdir)\gd.h +$(outdir)\font.obj: $(gdlibdir)\gd_io.h $(gdlibdir)\gdfx.h +$(outdir)\font.obj: $(kpslibdir)\kpathsea\kpathsea.h +$(outdir)\font.obj: $(kpslibdir)\web2c-miktex.h ..\lib\miktex.h +$(outdir)\font.obj: ..\lib\miktex-features.h commands.h +$(outdir)\misc.obj: dvipng.h config.h .\inttypes.h $(gdlibdir)\gd.h +$(outdir)\misc.obj: $(gdlibdir)\gd_io.h $(gdlibdir)\gdfx.h +$(outdir)\misc.obj: $(kpslibdir)\kpathsea\kpathsea.h +$(outdir)\misc.obj: $(kpslibdir)\web2c-miktex.h ..\lib\miktex.h +$(outdir)\misc.obj: ..\lib\miktex-features.h commands.h +$(outdir)\misc.obj: ..\libgnu\gnu-miktex.h +$(outdir)\papersiz.obj: dvipng.h config.h .\inttypes.h +$(outdir)\papersiz.obj: $(gdlibdir)\gd.h +$(outdir)\papersiz.obj: $(gdlibdir)\gd_io.h +$(outdir)\papersiz.obj: $(gdlibdir)\gdfx.h +$(outdir)\papersiz.obj: $(kpslibdir)\kpathsea\kpathsea.h +$(outdir)\papersiz.obj: $(kpslibdir)\web2c-miktex.h ..\lib\miktex.h +$(outdir)\papersiz.obj: ..\lib\miktex-features.h commands.h +$(outdir)\pk.obj: dvipng.h config.h .\inttypes.h $(gdlibdir)\gd.h +$(outdir)\pk.obj: $(gdlibdir)\gd_io.h $(gdlibdir)\gdfx.h +$(outdir)\pk.obj: $(kpslibdir)\kpathsea\kpathsea.h +$(outdir)\pk.obj: $(kpslibdir)\web2c-miktex.h ..\lib\miktex.h +$(outdir)\pk.obj: ..\lib\miktex-features.h commands.h +$(outdir)\ppagelist.obj: dvipng.h config.h .\inttypes.h +$(outdir)\ppagelist.obj: $(gdlibdir)\gd.h +$(outdir)\ppagelist.obj: $(gdlibdir)\gd_io.h +$(outdir)\ppagelist.obj: $(gdlibdir)\gdfx.h +$(outdir)\ppagelist.obj: $(kpslibdir)\kpathsea\kpathsea.h +$(outdir)\ppagelist.obj: $(kpslibdir)\web2c-miktex.h ..\lib\miktex.h +$(outdir)\ppagelist.obj: ..\lib\miktex-features.h commands.h +$(outdir)\set.obj: dvipng.h config.h .\inttypes.h $(gdlibdir)\gd.h +$(outdir)\set.obj: $(gdlibdir)\gd_io.h $(gdlibdir)\gdfx.h +$(outdir)\set.obj: $(kpslibdir)\kpathsea\kpathsea.h +$(outdir)\set.obj: $(kpslibdir)\web2c-miktex.h ..\lib\miktex.h +$(outdir)\set.obj: ..\lib\miktex-features.h commands.h +$(outdir)\special.obj: dvipng.h config.h .\inttypes.h +$(outdir)\special.obj: $(gdlibdir)\gd.h $(gdlibdir)\gd_io.h +$(outdir)\special.obj: $(gdlibdir)\gdfx.h +$(outdir)\special.obj: $(kpslibdir)\kpathsea\kpathsea.h +$(outdir)\special.obj: $(kpslibdir)\web2c-miktex.h ..\lib\miktex.h +$(outdir)\special.obj: ..\lib\miktex-features.h commands.h +$(outdir)\vf.obj: dvipng.h config.h .\inttypes.h $(gdlibdir)\gd.h +$(outdir)\vf.obj: $(gdlibdir)\gd_io.h $(gdlibdir)\gdfx.h +$(outdir)\vf.obj: $(kpslibdir)\kpathsea\kpathsea.h +$(outdir)\vf.obj: $(kpslibdir)\web2c-miktex.h ..\lib\miktex.h +$(outdir)\vf.obj: ..\lib\miktex-features.h commands.h diff --git a/Build/source/texk/dvipng/misc.c b/Build/source/texk/dvipng/misc.c new file mode 100644 index 00000000000..69f3d04ac21 --- /dev/null +++ b/Build/source/texk/dvipng/misc.c @@ -0,0 +1,783 @@ +/* misc.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#ifdef HAVE_LIBGEN_H +# include <libgen.h> +#else +#define basename xbasename +#endif +#include <fcntl.h> /* open/close */ +#ifndef MIKTEX +#include <sys/mman.h> +#endif +#include <sys/stat.h> + +static char *programname; + +/*-->DecodeArgs*/ +/*********************************************************************/ +/***************************** DecodeArgs ****************************/ +/*********************************************************************/ +bool DecodeArgs(int argc, char ** argv) +{ + int i; /* argument index for options */ + bool ppused=false; /* Flag when -pp is used */ + char *dviname=NULL; /* Name of dvi file */ + char *outname=NULL; /* Name of output file */ + + if (argv[0]) { +#ifdef HAVE_GDIMAGEGIF + programname=strrchr(argv[0],'/'); + if (programname!=NULL) + programname++; + else + programname=argv[0]; + if (strncmp(programname,"dvigif",6)==0) + flags |= GIF_OUTPUT; +#endif + programname=argv[0]; + Message(BE_NONQUIET,"This is %s",programname); + if (strcmp(basename(programname),PACKAGE_NAME)!=0) + Message(BE_NONQUIET," (%s)", PACKAGE_NAME); + Message(BE_NONQUIET," %s Copyright 2002-2005 Jan-Ake Larsson\n", + PACKAGE_VERSION); + } + + for (i=1; i<argc; i++) { + if (*argv[i]=='-') { + char *p=argv[i]+2 ; + char c=argv[i][1] ; + if (c=='-') { + p++; + c=argv[i][2]; + } + switch (c) { + case 'd': /* selects Debug output */ + if (*p>'9' && *p!='-') { + if (strncmp(p,"vinum",5)==0) { + if (p[5] != '0') { + flags |= DVI_PAGENUM; + Message(PARSE_STDIN,"DVI page number output on\n",p); + } else { + flags &= ~DVI_PAGENUM; + Message(PARSE_STDIN,"DVI page number output off\n"); + } + break; + } else if (strncmp(p,"epth",4)==0) { /* Depth reporting */ + if (p[4] != '0') { + flags |= REPORT_DEPTH; + Message(PARSE_STDIN,"Depth reporting on\n",p); + } else { + flags &= ~REPORT_DEPTH; + Message(PARSE_STDIN,"Depth reporting off\n"); + } + break; + } + goto DEFAULT; + } else { +#ifdef DEBUG + if (*p == 0 && argv[i+1]) + p = argv[i+1]; + debug = atoi(p); + if (debug > 0) { + if (p == argv[i+1]) i++; + } else + debug = DEBUG_DEFAULT; + Message(PARSE_STDIN,"Debug output enabled\n"); +#ifdef HAVE_LIBKPATHSEA + kpathsea_debug = debug / LASTDEBUG / 2 ; +#endif +#else + Warning("This instance of %s was compiled without the debug (-d) option", + programname); +#endif + break; + } + case 'o': /* Output file is specified */ + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + outname=p; + /* remove .png extension */ + Message(PARSE_STDIN,"Output file: %s\n", + outname); + break; +#ifdef MAKETEXPK + case 'M': + /* -M, -M1 => don't make font; -M0 => do. */ + makeTexPK = (*p == '0'); +#ifdef HAVE_LIBKPATHSEA + kpse_set_program_enabled (kpse_pk_format, makeTexPK, kpse_src_cmdline); +#endif + if (makeTexPK) + Message(PARSE_STDIN,"MakeTeXPK enabled\n"); + else + Message(PARSE_STDIN,"MakeTeXPK disabled\n"); + break; + case 'm': + if (strcmp(p,"ode") == 0 ) { + if (argv[i+1]) + user_mfmode = argv[++i] ; + Message(PARSE_STDIN,"MetaFont mode: %s\n",user_mfmode); + break; + } + goto DEFAULT; + case 'h': + if (strcmp(p,"elp") == 0 ) { + break; + } else if (strncmp(p,"eight",5) == 0 ) { /* Height reporting */ + if (p[5] != '0') { + flags |= REPORT_HEIGHT; + Message(PARSE_STDIN,"Height reporting on\n",p); + } else { + flags &= ~REPORT_HEIGHT; + Message(PARSE_STDIN,"Height reporting off\n"); + } + break; + } + goto DEFAULT; +#endif /* MAKETEXPK */ + case 'O' : /* Offset */ + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + handlepapersize(p, &x_offset_def, &y_offset_def) ; + Message(PARSE_STDIN,"Offset: (%d,%d)\n",x_offset_def,y_offset_def); + break ; + case 'e': + if (strncmp(p,"xpand-bbox",10) == 0 ) { + if (p[10] != '0') { + flags |= EXPAND_BBOX; + Message(PARSE_STDIN,"BBox expansion on\n",p); + } else { + flags &= ~EXPAND_BBOX; + Message(PARSE_STDIN,"BBox expansion off\n"); + } + break; + } + goto DEFAULT; + case 'T' : + if (*p == 0 && argv[i+1]) + p = argv[++i]; + if (strcmp(p,"bbox")==0) { + x_width_def=0; + y_width_def=0; + Message(PARSE_STDIN,"Pagesize: (bbox)\n"); + } else if (strcmp(p,"tight")==0) { + x_width_def=-1; + y_width_def=-1; + Message(PARSE_STDIN,"Pagesize: (tight bbox)\n"); + } else { + handlepapersize(p, &x_width_def, &y_width_def) ; + Message(PARSE_STDIN,"Pagesize: (%d,%d)\n", + x_width_def,y_width_def); + } + break ; + case 't': /* specify paper format, only for cropmarks */ +#if HAVE_GDIMAGECREATETRUECOLOR + /* Truecolor */ + if (strncmp(p,"ruecolor",8)==0) { + if (p[8] != '0') { + flags |= RENDER_TRUECOLOR; + Message(PARSE_STDIN,"Truecolor mode on\n",p); + } else { + flags &= ~RENDER_TRUECOLOR; + Message(PARSE_STDIN,"Truecolor mode off\n"); + } + } else +#endif +#ifdef HAVE_LIBT1 + if ( strncmp(p,"1lib",4) == 0 ) { /* -t1lib activation */ + if (p[4] != '0') { + flags |= USE_LIBT1; + Message(PARSE_STDIN,"t1lib rendering on\n",p); + } else { + flags &= ~USE_LIBT1; + Message(PARSE_STDIN,"t1lib rendering off\n"); + } + } else +#endif + + { /* cropmarks not implemented yet */ + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + if (strcmp(p,"a4")==0) { + handlepapersize("210mm,297mm",&x_pwidth,&y_pwidth); + } else if (strcmp(p,"letter")==0) { + handlepapersize("8.5in,11in",&x_pwidth,&y_pwidth); + } else if (strcmp(p,"legal")==0) { + handlepapersize("8.5in,14in",&x_pwidth,&y_pwidth); + } else if (strcmp(p,"executive")==0) { + handlepapersize("7.25in,10.5in",&x_pwidth,&y_pwidth); + } else + Fatal("papersize %s is not implemented",p); + Message(PARSE_STDIN,"Papersize: %s\n",p); + } + break; + case 'c': + if (strncmp(p,"acheimages",10)==0) { + if (p[10] != '0') { + flags |= CACHE_IMAGES; + Message(PARSE_STDIN,"Caching images\n",p); + } else { + flags &= ~CACHE_IMAGES; + Message(PARSE_STDIN,"Not caching images\n"); + } + break; + } + goto DEFAULT; + case 'b': + if ( *p == 'g' ) { /* -bg background color */ + p++; + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + if (strncmp(p,"Transparent",11) == 0 ) + flags |= BG_TRANSPARENT_ALPHA; + else if (strncmp(p,"transparent",11) == 0 ) + flags |= BG_TRANSPARENT; + else + background(p); + if (flags & BG_TRANSPARENT) + Message(PARSE_STDIN,"Transp. background (fallback rgb %d,%d,%d)\n", + cstack[0].red,cstack[0].green,cstack[0].blue); + else + Message(PARSE_STDIN,"Background: rgb %d,%d,%d\n", + cstack[0].red,cstack[0].green,cstack[0].blue); + break; + } else if (strcmp(p, "dpi")==0) { + p+=3; + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + user_bdpi = atoi(p); + if (user_bdpi < 10 || user_bdpi > 10000) + Fatal("bad --bdpi parameter") ; + Message(PARSE_STDIN,"Bdpi: %d\n",user_bdpi); + break; + } else if ( *p == 'd' ) { /* -bd border width */ + int tmpi; + char* tmps; + p++; + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + tmpi = strtol(p, &tmps, 10); + if (p<tmps) { + borderwidth=tmpi; + Message(PARSE_STDIN,"Transp. border: %d dots\n",borderwidth); + } + if (*tmps) { + stringrgb(tmps, &bordercolor.red, &bordercolor.green, &bordercolor.blue); + userbordercolor=TRUE; + if (borderwidth==0) { + borderwidth=1; + Message(PARSE_STDIN,"Transp. border: %d dots\n",borderwidth); + } + Message(PARSE_STDIN,"Transp. border: rgb %d,%d,%d\n", + bordercolor.red, bordercolor.green, bordercolor.blue); + } + break; + } + goto DEFAULT; + case 'f': + if ( *p == 'g' ) { /* -fg foreground color */ + p++; + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + resetcolorstack(p); + Message(PARSE_STDIN,"Foreground: rgb %d,%d,%d\n", + cstack[1].red,cstack[1].green,cstack[1].blue); + break; +#ifdef HAVE_FT2 + } else if ( strncmp(p,"reetype",7) == 0 ) { /* -freetype activation */ + if (p[7] != '0') { + flags |= USE_FREETYPE; + Message(PARSE_STDIN,"FreeType rendering on\n",p); + } else { + flags &= ~USE_FREETYPE; + Message(PARSE_STDIN,"FreeType rendering off\n"); + } + break; +#endif + } else if (strcmp(p,"ollow") == 0 ) { + if (DVIFollowToggle()) + Message(PARSE_STDIN,"Follow mode on\n"); + else + Message(PARSE_STDIN,"Follow mode off\n"); + break; + } + goto DEFAULT; + case 'x' : case 'y' : + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + usermag = atoi(p); + if (usermag < 1 || usermag > 1000000) + Fatal("bad magnification parameter (-x or -y)") ; + Message(PARSE_STDIN,"Magstep: %d\n",usermag); + /*overridemag = (c == 'x' ? 1 : -1) ;*/ + break ; + case 'g' : + if (strncmp(p,"amma",4)==0) { /* --gamma correction */ + double gamma=0.0; + + p+=4; + if (*p == 0 && argv[i+1]) + p = argv[++i]; + if (p!=NULL) + gamma=atof(p); + if (gamma==0.0) { + Warning("Bad gamma value, default is %f",DEFAULT_GAMMA); + gamma=DEFAULT_GAMMA; + } + Gamma(gamma); + Message(PARSE_STDIN,"Gamma value is %s\n", gamma); + break; +#ifdef HAVE_GDIMAGEGIF + } else if (strncmp(p,"if",2)==0) { /* --gif output */ + flags |= GIF_OUTPUT; + Message(PARSE_STDIN,"GIF output\n"); + break; +#endif + } + goto DEFAULT; + case 'p' : + if (*p == 'p') { /* a -pp specifier for a page list */ + ppused=true; + p++ ; + if (*p == 0 && argv[i+1]) + p = argv[++i]; + Message(PARSE_STDIN,"Page list: %s\n",p); + if (ParsePages(p)) + Fatal("bad page list specifier (-pp)"); + } else if (strncmp(p,"ng",2)==0) { /* --png output */ + flags &= ~GIF_OUTPUT; + Message(PARSE_STDIN,"PNG output\n"); + } else if (strncmp(p,"icky",4)==0) { + if (p[4] != '0') { + flags |= MODE_PICKY; + Message(PARSE_STDIN,"No images output for pages with warnings\n",p); + } else { + flags &= ~MODE_PICKY; + Message(PARSE_STDIN,"Images output even for pages with warnings\n"); + } + } else { /* a -p specifier for first page */ + int32_t firstpage; + bool abspage=false; + + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + if (*p == '=') { + abspage=true; + p++ ; + } + firstpage = atoi(p); + FirstPage(firstpage,abspage); + Message(PARSE_STDIN,"First page: %d\n",firstpage); + } + break ; + case 's' : + if (strncmp(p,"trict",5)==0) { + if (p[5] != '0') { + flags |= MODE_STRICT; + Message(PARSE_STDIN,"Warnings are fatal\n",p); + } else { + flags &= ~MODE_STRICT; + Message(PARSE_STDIN,"Warnings are not fatal\n"); + } + } else + goto DEFAULT; + break ; + case 'n' : + if (strncmp(p,"oghostscript",12)==0) { + if (p[12] != '0') { + flags |= NO_GHOSTSCRIPT; + Message(PARSE_STDIN,"No GhostScript calls\n",p); + } else { + flags &= ~NO_GHOSTSCRIPT; + Message(PARSE_STDIN,"GhostScript calls made\n"); + } + } else if (strncmp(p,"ogssafer",8)==0) { + if (p[8] != '0') { + flags |= NO_GSSAFER; + Message(PARSE_STDIN,"GhostScript calls does not use -dSAFER\n",p); + } else { + flags &= ~NO_GSSAFER; + Message(PARSE_STDIN,"GhostScript calls use -dSAFER\n"); + } + } else + goto DEFAULT; + break ; + case 'l': + { + int32_t lastpage; + bool abspage=false; + + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + if (*p == '=') { + abspage=true; + p++ ; + } + lastpage = atoi(p); + LastPage(lastpage,abspage); + Message(PARSE_STDIN,"Last page: %d\n",lastpage); + } + break ; + case 'q': /* quiet operation */ + if (*p != '0') + flags &= (~BE_NONQUIET & ~BE_VERBOSE); + else + flags |= BE_NONQUIET; + break; + case 'r': /* process pages in reverse order */ + if (*p != '0') { + Message(PARSE_STDIN,"Reverse order\n"); + Reverse(true); + } else { + Message(PARSE_STDIN,"Normal order\n"); + Reverse(false); + } + break; + case 'v': /* verbatim mode */ + if (strcmp(p, "ersion")==0) { + if (strcmp(basename(programname),PACKAGE_NAME)!=0) + printf("%s (%s) %s\n",basename(programname), + PACKAGE_NAME,PACKAGE_VERSION); + else + puts(PACKAGE_STRING); +#ifdef HAVE_LIBKPATHSEA + puts (KPSEVERSION); +#endif + puts ("Copyright (C) 2002-2005 Jan-Ake Larsson.\n\ +There is NO warranty. You may redistribute this software\n\ +under the terms of the GNU General Public License.\n\ +For more information about these matters, see the files\n\ +named COPYING and dvipng.c."); + exit (EXIT_SUCCESS); + } + if (*p != '0') + flags |= BE_NONQUIET | BE_VERBOSE; + else + flags &= ~BE_VERBOSE; + break; + case 'D' : + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + dpi = atoi(p); + if (dpi < 10 || dpi > 10000) + Fatal("bad -D parameter") ; + Message(PARSE_STDIN,"Dpi: %d\n",dpi); + break; + case 'Q': /* quality (= shrinkfactor) */ + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + shrinkfactor = atoi(p); + Message(PARSE_STDIN,"Quality: %d\n",shrinkfactor); + break; +#ifdef HAVE_GDIMAGEPNGEX + case 'z': + if (*p == 0 && argv[i+1]) + p = argv[++i]; + compression = atoi(p); + break; +#endif + case '\0': + flags |= PARSE_STDIN; + break; + DEFAULT: default: + Warning("%s is not a valid option", argv[i]); + } + } else { + dviname=argv[i]; + } + } + if (dviname != NULL) { + if (dvi != NULL && dvi->filep != NULL) + DVIClose(dvi); + dvi=DVIOpen(dviname,outname); + } + + if (dvi==NULL) { + fprintf(stdout,"\nUsage: %s [OPTION]... FILENAME[.dvi]\n", programname); + fprintf(stdout,"Options are chosen to be similar to dvips' options where possible:\n"); +#ifdef DEBUG + fprintf(stdout," -d # Debug (# is the debug bitmap, 1 if not given)\n"); +#endif + fprintf(stdout," -D # Output resolution\n"); + fprintf(stdout," -l # Last page to be output\n"); + fprintf(stdout," --mode s MetaFont mode (default 'cx')\n"); + fprintf(stdout," -M* Don't make PK fonts\n"); + fprintf(stdout," -o f Output file, '%%d' is pagenumber\n"); + fprintf(stdout," -O c Image offset\n"); + fprintf(stdout," -p # First page to be output\n"); + fprintf(stdout," -pp #,#.. Page list to be output\n"); + fprintf(stdout," -q* Quiet operation\n"); + fprintf(stdout," -r* Reverse order of pages\n"); + /* fprintf(stdout," -t c Paper format (also accepts e.g., '-t a4')\n");*/ + fprintf(stdout," -T c Image size (also accepts '-T bbox' and '-T tight')\n"); + fprintf(stdout," -v* Verbose operation\n"); + fprintf(stdout," -x # Override dvi magnification\n"); + fprintf(stdout," - Interactive query of options\n"); + fprintf(stdout,"\nThese do not correspond to dvips options:\n"); + fprintf(stdout," -bd # Transparent border width in dots\n"); + fprintf(stdout," -bd s Transparent border fallback color (TeX-style color)\n"); + fprintf(stdout," --bdpi # Set the base (Metafont) resolution\n"); + fprintf(stdout," -bg s Background color (TeX-style color or 'Transparent')\n"); + fprintf(stdout," --depth* Output the image depth on stdout\n"); + fprintf(stdout," --dvinum* Use TeX page numbers in output filenames\n"); + fprintf(stdout," -fg s Foreground color (TeX-style color)\n"); + fprintf(stdout," --follow* Follow mode\n"); +#ifdef HAVE_FT2 + fprintf(stdout," --freetype* FreeType font rendering (default on)\n"); +#endif + fprintf(stdout," --gamma # Control color interpolation\n"); +#ifdef HAVE_GDIMAGEGIF + fprintf(stdout," --gif Output GIF images (dvigif default)\n"); +#endif + fprintf(stdout," --height* Output the image height on stdout\n"); + fprintf(stdout," --noghostscript* Don't use ghostscript for PostScript specials\n"); + fprintf(stdout," --nogssafer* Don't use -dSAFER in ghostscript calls\n"); + fprintf(stdout," --picky When a warning occurs, don't output image\n"); +#ifdef HAVE_GDIMAGEGIF + fprintf(stdout," --png Output PNG images (dvipng default)\n"); +#endif + fprintf(stdout," --strict When a warning occurs, exit\n"); +#ifdef HAVE_LIBT1 + fprintf(stdout," --t1lib* T1lib font rendering (default on)\n"); +#endif +#ifdef HAVE_GDIMAGECREATETRUECOLOR + fprintf(stdout," --truecolor* Truecolor output\n"); +#endif + fprintf(stdout," -Q # Quality (T1lib and PK subsampling)\n"); +#ifdef HAVE_GDIMAGEPNGEX + fprintf(stdout," -z # PNG compression level\n"); +#endif + + fprintf(stdout,"\n # = number f = file s = string * = suffix, '0' to turn off\n"); + fprintf(stdout," c = comma-separated dimension pair (e.g., 3.2in,-32.1cm)\n\n"); + /*#ifdef HAVE_LIBKPATHSEA + { + extern DllImport char *kpse_bug_address; + putc ('\n', stdout); + fputs (kpse_bug_address, stdout); + } + #endif*/ + if ((flags & PARSE_STDIN) == 0) { + exit(EXIT_SUCCESS); + } + } + if ((flags & PARSE_STDIN) == 0 && (!ppused)) + ParsePages("-"); + return((flags & PARSE_STDIN) != 0); +} + +void DecodeString(char *string) +{ +#define PARSEARGS 10 + char *strv[PARSEARGS]; + int strc=1; + strv[0]=NULL; /* No program name */ + + while (*string==' ' || *string=='\t' || *string=='\n') + string++; + while (*string!='\0') { + strv[strc++]=string; + if (*string!='\'') { + /* Normal split at whitespace */ + while (*string!=' ' && *string!='\t' && *string!='\n' && *string!='\0') + string++; + } else { + /* String delimiter found , so search for next */ + strv[strc-1]=++string; + while (*string!='\'' && *string!='\0') + string++; + } + if (*string!='\0') + *string++='\0'; + while (*string==' ' || *string=='\t' || *string=='\n') + string++; + } + if (strc>1) /* Nonempty */ + (void) DecodeArgs(strc,strv); +} + + + +uint32_t UNumRead(unsigned char* current, register int n) +{ + uint32_t x = (unsigned char) *(current)++; /* number being constructed */ + while(--n) + x = (x << 8) | *(current)++; + return(x); +} + +int32_t SNumRead(unsigned char* current, register int n) +{ + int32_t x = (signed char) *(current)++; /* number being constructed */ + while(--n) + x = (x << 8) | *(current)++; + return(x); +} + + +/**********************************************************************/ +/****************************** Fatal *******************************/ +/**********************************************************************/ +void Fatal (char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + fflush(stdout); + fprintf(stderr, "\n"); + fprintf(stderr, "%s: Fatal error, ", programname); + vfprintf(stderr, fmt, args); + + fprintf(stderr, "\n\n"); + va_end(args); + + ClearFonts(); +#ifdef HAVE_FT2 + if (libfreetype) + (void) FT_Done_FreeType(libfreetype); /* at this point, ignore error */ +#endif +#ifdef HAVE_LIBT1 + if (libt1) + (void) T1_CloseLib(); /* at this point, ignore error */ +#endif + exit(EXIT_FATAL); +} + +/*-->Warning*/ +/**********************************************************************/ +/***************************** Warning ******************************/ +/**********************************************************************/ +void Warning(char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + + if ( flags & BE_NONQUIET ) { + fflush(stdout); + fprintf(stderr, "%s warning: ", programname); + vfprintf(stderr, fmt, args); + fprintf(stderr, " "); + va_end(args); + } +} + +/*-->Message*/ +/**********************************************************************/ +/***************************** Message ******************************/ +/**********************************************************************/ +void Message(int activeflags, char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + if ( flags & activeflags ) { + vfprintf(stdout, fmt, args); + } + va_end(args); +} + + +bool MmapFile (char *filename,struct filemmap *fmmap) +{ +#ifndef MIKTEX + struct stat stat; +#endif + + DEBUG_PRINT(DEBUG_DVI,("\n OPEN FILE:\t'%s'", filename)); + fmmap->mmap=NULL; +#ifndef MIKTEX + if ((fmmap->fd = open(filename,O_RDONLY)) == -1) { + Warning("cannot open file <%s>", filename); + return(true); + } + fstat(fmmap->fd,&stat); + fmmap->size=stat.st_size; +# ifdef HAVE_MMAP + fmmap->mmap = mmap(NULL,fmmap->size, PROT_READ, MAP_SHARED,fmmap->fd,0); + if (fmmap->mmap == (char*)-1) { + Warning("cannot mmap file <%s>",filename); + fmmap->mmap=NULL; + close(fmmap->fd); + return(true); + } +# else /* HAVE_MMAP */ + fmmap->mmap = malloc(fmmap->size); + if (read(fmmap->fd,fmmap->mmap,fmmap->size)<fmmap->size) { + Warning("too little data in <%s>",filename); + free(fmmap->mmap); + fmmap->mmap=NULL; + close(fmmap->fd); + return(true); + } + close(fmmap->fd); +# endif /* HAVE_MMAP */ +#else /* MIKTEX */ + fmmap->hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, 0, + OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, 0); + if (fmmap->hFile == INVALID_HANDLE_VALUE) { + Warning("cannot open file <%s>", filename); + return(true); + } + fmmap->size = GetFileSize(fmmap->hFile, 0); + fmmap->hMap = CreateFileMapping(fmmap->hFile, 0, PAGE_READONLY, 0, 0, 0); + if (fmmap->hMap == 0) { + CloseHandle (fmmap->hFile); + Warning("cannot CreateFileMapping() file <%s>", filename); + return(true); + } + fmmap->mmap = MapViewOfFile(fmmap->hMap, FILE_MAP_READ, 0, 0, 0); + if (fmmap->mmap == NULL) { + Warning("cannot MapViewOfFile() file <%s>", filename); + CloseHandle (fmmap->hMap); + CloseHandle (fmmap->hFile); + return(true); + } +#endif /* MIKTEX */ + return(false); +} + +void UnMmapFile(struct filemmap* fmmap) +{ + if (fmmap->mmap!=NULL) { +#ifndef MIKTEX +# ifdef HAVE_MMAP + if (munmap(fmmap->mmap,fmmap->size)) + Warning("cannot munmap file at 0x%X",fmmap->mmap); + if (close(fmmap->fd)) + Warning("cannot close file descriptor %d",fmmap->fd); +# else /* HAVE_MMAP */ + free(fmmap->mmap); +# endif /* HAVE_MMAP */ +#else /* MIKTEX */ + UnmapViewOfFile (fmmap->mmap); + CloseHandle (fmmap->hMap); + CloseHandle (fmmap->hFile); +#endif /* MIKTEX */ + } + fmmap->mmap=NULL; +} diff --git a/Build/source/texk/dvipng/mkinstalldirs b/Build/source/texk/dvipng/mkinstalldirs new file mode 100755 index 00000000000..c51542b0f86 --- /dev/null +++ b/Build/source/texk/dvipng/mkinstalldirs @@ -0,0 +1,101 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.1 2003/10/19 20:33:26 jalar Exp $ + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case "${1}" in + -h | --help | --h* ) # -h for help + echo "${usage}" 1>&2; exit 0 ;; + -m ) # -m PERM arg + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + dirmode="${1}" + shift ;; + -- ) shift; break ;; # stop option processing + -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option + * ) break ;; # first non-opt arg + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in +0) exit 0 ;; +esac + +case $dirmode in +'') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi ;; +*) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 3 +# End: +# mkinstalldirs ends here diff --git a/Build/source/texk/dvipng/papersiz.c b/Build/source/texk/dvipng/papersiz.c new file mode 100644 index 00000000000..fa8117b600a --- /dev/null +++ b/Build/source/texk/dvipng/papersiz.c @@ -0,0 +1,73 @@ +/* papersiz.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" + +const char *lengthnames[]={ "sp", "pt", "bp", + "dd", "mm", "pc", + "cc", "cm", "in" }; +const int32_t lengthsp[]={ 1L, 65536L, 65782L, + 70124L, 186468L, 786432L, + 841489L, 1864680L, 4736286L }; + +/* + * Convert a double[unit], e.g., "3.2cm" or "1.0in" into length in pixels. + * Advance the passed pointer as well. + */ + +int32_t myatodim(char ** p) +{ + double tmp; /* double accuracy is enough, I think */ + int i=0; + + tmp = strtod(*p,p); + while (**p == ' ') + (*p)++; + while (i<8 && ((*p)[0]!=lengthnames[i][0] || (*p)[1]!=lengthnames[i][1])) + i++; + if (i==8 && ((*p)[0]!=lengthnames[i][0] || (*p)[1]!=lengthnames[i][1])) + Warning("unrecognized length unit \"%.2s\", assuming inches",*p); + while (**p != ',' && **p !='\0') + (*p)++; + tmp *= lengthsp[i]*dpi/4736286L; /* convert sp to pixels */ + return((int32_t) tmp); +} + + +/* + * The routine where we handle the paper size special. We need to pass in + * the string after the `papersize=' specification. + */ + +void handlepapersize(char * p, int32_t * x, int32_t * y) +{ + while (*p == ' ') + p++ ; + *x = myatodim(&p) ; + while (*p == ' ' || *p == ',') + p++ ; + *y = myatodim(&p) ; +} + diff --git a/Build/source/texk/dvipng/pk.c b/Build/source/texk/dvipng/pk.c new file mode 100644 index 00000000000..618679b8a97 --- /dev/null +++ b/Build/source/texk/dvipng/pk.c @@ -0,0 +1,408 @@ +/* pk.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif + +#define PK_POST 245 +#define PK_PRE 247 +#define PK_ID 89 + +unsigned char dyn_f; +int repeatcount; +int poshalf; + +unsigned char getnyb(unsigned char** pos) +{ + if (poshalf == 0) { + poshalf=1; + return(**pos / 16); + } else { + poshalf=0; + return(*(*pos)++ & 15); + } +} + +uint32_t pk_packed_num(unsigned char** pos) +{ + register int i; + uint32_t j; + + i = (int)getnyb(pos); + if (i == 0) { + do { + j = (uint32_t)getnyb(pos); + i++; + } while (j == 0); + while (i > 0) { + j = j * 16 + (uint32_t)getnyb(pos); + i--; + }; + return (j - 15 + (13 - dyn_f) * 16 + dyn_f); + } else if (i <= (int)dyn_f) { + return ((uint32_t)i); + } else if (i < 14) { + return ((i-(uint32_t)dyn_f - 1) * 16 + (uint32_t)getnyb(pos) + + dyn_f + 1); + } else { + if (i == 14) { + repeatcount = (int)pk_packed_num(pos); + } else { + repeatcount = 1; + } + return (pk_packed_num(pos)); /* tail end recursion !! */ + } +} + +unsigned char* skip_specials(unsigned char* pos) +{ + uint32_t i; + + while (*pos >= 240 && *pos != PK_POST) { + i=0; + switch (*pos++) { + case 243: + i = *pos++; + case 242: + i = 256 * i + *pos++; + case 241: + i = 256 * i + *pos++; + case 240: + i = 256 * i + *pos++; + DEBUG_PRINT(DEBUG_PK,("\n PK SPECIAL\t'%.*s' ",(int)i,pos)); + pos += i; + break; + case 244: +#ifdef DEBUG + { + uint32_t c; + c=UNumRead(pos,4); + DEBUG_PRINT(DEBUG_PK,("\n PK SPECIAL\t%d",c)); + } +#endif + pos += 4; + break; + case 245: + break; + case 246: + DEBUG_PRINT(DEBUG_PK,("\n PK\tNOP ")); + break; + case 247: case 248: case 249: case 250: + case 251: case 252: case 253: case 254: + case 255: + Fatal("unexpected PK flagbyte %d", (int)*pos); + } + } + return(pos); +} + + +void LoadPK(int32_t c, register struct char_entry * ptr) +{ + unsigned short shrunk_width,shrunk_height; + unsigned short width,height; + short xoffset,yoffset; + unsigned short i_offset,j_offset; + int i,j,k,n; + int count=0; + bool paint_switch; + unsigned char *pos,*buffer; + + DEBUG_PRINT(DEBUG_PK,("\n LOAD PK CHAR\t%d",c)); + pos=ptr->pkdata; + if ((ptr->flag_byte & 7) == 7) n=4; + else if ((ptr->flag_byte & 4) == 4) n=2; + else n=1; + dyn_f = ptr->flag_byte / 16; + paint_switch = ((ptr->flag_byte & 8) != 0); + /* + * Read character preamble + */ + if (n != 4) { + ptr->tfmw = UNumRead(pos, 3); + /* +n: vertical escapement not used */ + pos+=3+n; + } else { + ptr->tfmw = UNumRead(pos, 4); + /* +4: horizontal escapement not used */ + /* +n: vertical escapement not used */ + pos+=8+n; + } + DEBUG_PRINT(DEBUG_PK,(" %d",ptr->tfmw)); + ptr->tfmw = (dviunits) + ((int64_t) ptr->tfmw * currentfont->s / 0x100000 ); + DEBUG_PRINT(DEBUG_PK,(" (%d)",ptr->tfmw)); + + width = UNumRead(pos, n); + height = UNumRead(pos+=n, n); + DEBUG_PRINT(DEBUG_PK,(" %dx%d",width,height)); + + if (width > 0x7fff || height > 0x7fff) + Fatal("character %d too large in file %s", c, currentfont->name); + + /* + * Hotspot issues: Shrinking to the topleft corner rather than the + hotspot will displace glyphs a fraction of a pixel. We deal with + this in as follows: The glyph is shrunk to its hotspot by + offsetting the bitmap somewhat to put the hotspot in the lower + left corner of a "shrink square". Shrinking to the topleft corner + will then act as shrinking to the hotspot. This may enlarge the + bitmap somewhat, of course. (Also remember that the below + calculation of i/j_offset is in integer arithmetics.) + + There will still be a displacement from rounding the dvi + position, but vertically it will be equal for all glyphs on a + line, so we displace a whole line vertically by fractions of a + pixel. This is acceptible, IMHO. Sometime there will be support + for subpixel positioning, horizontally. Will do for now, I + suppose. + */ + xoffset = SNumRead(pos+=n, n); + i_offset = ( shrinkfactor - xoffset % shrinkfactor ) % shrinkfactor; + width += i_offset; + ptr->xOffset = xoffset+i_offset; + + yoffset = SNumRead(pos+=n, n); + j_offset = ( shrinkfactor - (yoffset-(shrinkfactor-1)) % shrinkfactor ) + % shrinkfactor; + height += j_offset; + ptr->yOffset = yoffset+j_offset; + + DEBUG_PRINT(DEBUG_PK,(" (%dx%d)",width,height)); + /* + Extra marginal so that we do not crop the image when shrinking. + */ + shrunk_width = (width + shrinkfactor - 1) / shrinkfactor; + shrunk_height = (height + shrinkfactor - 1) / shrinkfactor; + ptr->w = shrunk_width; + ptr->h = shrunk_height; + pos+=n; + buffer = alloca(shrunk_width*shrunk_height* + shrinkfactor*shrinkfactor*sizeof(char)); + (void)memset(buffer,0,shrunk_width*shrunk_height* + shrinkfactor*shrinkfactor*sizeof(char)); + DEBUG_PRINT(DEBUG_GLYPH,("\nDRAW GLYPH %d\n", (int)c)); + /* + Raster char + */ + if (dyn_f == 14) { /* get raster by bits */ + int bitweight = 0; + for (j = j_offset; j < (int) height; j++) { /* get all rows */ + for (i = i_offset; i < (int) width; i++) { /* get one row */ + bitweight /= 2; + if (bitweight == 0) { + count = *pos++; + bitweight = 128; + } + if (count & bitweight) { + buffer[i+j*width]=1; +#ifdef DEBUG + DEBUG_PRINT(DEBUG_GLYPH,("+")); + } else { + DEBUG_PRINT(DEBUG_GLYPH,(" ")); +#endif + } + } + DEBUG_PRINT(DEBUG_GLYPH,("|\n")); + } + } else { /* get packed raster */ + poshalf=0; + repeatcount = 0; + for(i=i_offset, j=j_offset; j<height; ) { + count = pk_packed_num(&pos); + while (count > 0) { + if (i+count < width) { + if (paint_switch) + for(k=0;k<count;k++) { + buffer[k+i+j*width]=1; + DEBUG_PRINT(DEBUG_GLYPH,("*")); + } +#ifdef DEBUG + else for(k=0;k<count;k++) + DEBUG_PRINT(DEBUG_GLYPH,(" ")); +#endif + i += count; + count = 0; + } else { + if (paint_switch) + for(k=i;k<width;k++) { + buffer[k+j*width]=1; + DEBUG_PRINT(DEBUG_GLYPH,("#")); + } +#ifdef DEBUG + else for(k=i;k<width;k++) + DEBUG_PRINT(DEBUG_GLYPH,(" ")); +#endif + DEBUG_PRINT(DEBUG_GLYPH,("|\n")); + j++; + count -= width-i; + /* Repeat row(s) */ + for (;repeatcount>0; repeatcount--,j++) { + for (i = i_offset; i<width; i++) { + buffer[i+j*width]=buffer[i+(j-1)*width]; +#ifdef DEBUG + if (buffer[i+j*width]>0) { + DEBUG_PRINT(DEBUG_GLYPH,("=")); + } else { + DEBUG_PRINT(DEBUG_GLYPH,(" ")); + } +#endif + } + DEBUG_PRINT(DEBUG_GLYPH,("|\n")); + } + i=i_offset; + } + } + paint_switch = 1 - paint_switch; + } + if (i>i_offset) + Fatal("wrong number of bits stored: char. %c, font %s", + (char)c, currentfont->name); + if (j>height) + Fatal("bad PK file %s, too many bits", currentfont->name); + } + /* + Shrink raster while doing antialiasing. (See above. The + single-glyph output seems better than what xdvi at 300 dpi, + shrinkfactor 3 produces.) + */ + if ((ptr->data = calloc(shrunk_width*shrunk_height,sizeof(char))) == NULL) + Fatal("unable to allocate image space for char %c", (char)c); + for (j = 0; j < (int) height; j++) { + for (i = 0; i < (int) width; i++) { + /* if (((i % shrinkfactor) == 0) && ((j % shrinkfactor) == 0)) + ptr->data[i/shrinkfactor+j/shrinkfactor*shrunk_width] = + buffer[i+j*width]; + else */ + ptr->data[i/shrinkfactor+j/shrinkfactor*shrunk_width] += + buffer[i+j*width]; + } + } + for (j = 0; j < shrunk_height; j++) { + for (i = 0; i < shrunk_width; i++) { + ptr->data[i+j*shrunk_width] = ptr->data[i+j*shrunk_width] + *255/shrinkfactor/shrinkfactor; + DEBUG_PRINT(DEBUG_GLYPH,("%3u ",ptr->data[i+j*shrunk_width])); + } + DEBUG_PRINT(DEBUG_GLYPH,("|\n")); + } +} + +void InitPK(struct font_entry * tfontp) +{ + unsigned char* position; + struct char_entry *tcharptr; /* temporary char_entry pointer */ + uint32_t hppp, vppp, packet_length; + uint32_t c; + + DEBUG_PRINT((DEBUG_DVI|DEBUG_PK),("\n OPEN FONT:\t'%s'", tfontp->name)); + Message(BE_VERBOSE,"<%s>", tfontp->name); + if (MmapFile(tfontp->name,&(tfontp->fmmap))) + Fatal("font file %s unusable", tfontp->name); + position=(unsigned char*)tfontp->fmmap.mmap; + if (tfontp->fmmap.size < 2 || tfontp->fmmap.size < 3+*(position+2)+16) + Fatal("PK file %s ends prematurely",tfontp->name); + if (*position++ != PK_PRE) + Fatal("unknown font format in file %s",tfontp->name); + if (*position++ != PK_ID) + Fatal( "wrong version %d of PK file %s (should be 89)", + (int)*(position-1),tfontp->name); + DEBUG_PRINT(DEBUG_PK,("\n PK_PRE:\t'%.*s'",(int)*position, position+1)); + position += *position + 1; + + tfontp->designsize = UNumRead(position, 4); + DEBUG_PRINT(DEBUG_PK,(" %d", tfontp->designsize)); + tfontp->type = FONT_TYPE_PK; + + c = UNumRead(position+4, 4); + DEBUG_PRINT(DEBUG_PK,(" %d", c)); + CheckChecksum (tfontp->c, c, tfontp->name); + + hppp = UNumRead(position+8, 4); + vppp = UNumRead(position+12, 4); + DEBUG_PRINT(DEBUG_PK,(" %d %d", hppp,vppp)); + if (hppp != vppp) + Warning("aspect ratio is %d:%d (should be 1:1)", hppp, vppp); + tfontp->magnification = (uint32_t)((uint64_t)hppp * 7227 * 5 / 65536l + 50)/100; + position+=16; + /* Read char definitions */ + position = skip_specials(position); + while (*position != PK_POST) { + DEBUG_PRINT(DEBUG_PK,("\n @%ld PK CHAR:\t%d", + (long)position - (long)tfontp->fmmap.mmap, *position)); + if ((tcharptr = malloc(sizeof(struct char_entry))) == NULL) + Fatal("cannot malloc space for char_entry"); + tcharptr->flag_byte = *position; + tcharptr->data = NULL; + tcharptr->tfmw = 0; + if ((*position & 7) == 7) { + packet_length = UNumRead(position+1,4); + c = UNumRead(position+5, 4); + position += 9; + } else if (*position & 4) { + packet_length = (*position & 3) * 65536l + + UNumRead(position+1, 2); + c = UNumRead(position+3, 1); + position += 4; + } else { + packet_length = (*position & 3) * 256 + + UNumRead(position+1, 1); + c = UNumRead(position+2, 1); + position += 3; + } + DEBUG_PRINT(DEBUG_PK,(" %d %d",packet_length,c)); + if (c > (LASTFNTCHAR)) + Fatal("PK font %s exceeds char numbering limit",tfontp->name); + tcharptr->length = packet_length; + tcharptr->pkdata = position; + tfontp->chr[c]=tcharptr; + position += packet_length; + position = skip_specials(position); + } +} + +void UnLoadPK(struct char_entry *ptr) +{ + if (ptr->data!=NULL) + free(ptr->data); + ptr->data=NULL; +} + +void DonePK(struct font_entry *tfontp) +{ + int c=FIRSTFNTCHAR; + + UnMmapFile(&(tfontp->fmmap)); + while(c<=LASTFNTCHAR) { + if (tfontp->chr[c]!=NULL) { + UnLoadPK((struct char_entry*)tfontp->chr[c]); + free(tfontp->chr[c]); + } + c++; + } + tfontp->name[0]='\0'; +} diff --git a/Build/source/texk/dvipng/ppagelist.c b/Build/source/texk/dvipng/ppagelist.c new file mode 100644 index 00000000000..ac93b7dba20 --- /dev/null +++ b/Build/source/texk/dvipng/ppagelist.c @@ -0,0 +1,185 @@ +/* ppagelist.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" + +/* Some code at the end of this file is adapted from dvips */ + +static int32_t first=PAGE_FIRSTPAGE, last=PAGE_LASTPAGE; +static bool abspage=false, reverse=false; +bool no_ppage=true; + +/* dvips' behaviour: + * -pp outputs _all_ pages with the correct numbers, + * -p, -l outputs from the first occurrence of firstpage to the first + * occurrence of lastpage. Using '=' means absolute pagenumbers + */ + +void FirstPage(int32_t page, bool data) +{ + first=page; + abspage |= data; +} +void LastPage(int32_t page,bool data) +{ + last=page; + abspage |= data; +} +void Reverse(bool new) +{ + reverse=new; +} +/*-->NextPPage*/ +/**********************************************************************/ +/**************************** NextPPage *****************************/ +/**********************************************************************/ +/* Return the page in turn on our queue */ +/* (Implicitly, PAGE_POST is never in the pagelist) */ +bool InPageList(int32_t i); + +struct page_list* NextPPage(void* dvi, struct page_list* page) +{ + if (! reverse) { /*********** normal order */ + if (page == NULL) { /* first call: find first page */ + if (no_ppage) + return(NULL); + page=FindPage(dvi,first,abspage); + } else /* later calls: count up, except "last" page */ + page=(last==page->count[abspage ? 0 : 10]) ? NULL : NextPage(dvi,page); + /* seek for pages in pagelist */ + while (page!=NULL && ! InPageList(page->count[0])) + page=(last==page->count[abspage ? 0 : 10]) ? NULL : NextPage(dvi,page); + } else { /******************** reverse order */ + if (page == NULL) { /* first call: find "last" page */ + if (no_ppage) + return(NULL); + page=FindPage(dvi,last,abspage); + } else /* later calls: count down, except "first" page */ + page=(first==page->count[abspage ? 0 : 10]) ? NULL : PrevPage(dvi,page); + /* seek for pages in pagelist */ + while (page!=NULL && ! InPageList(page->count[0])) + page=(first==page->count[abspage ? 0 : 10]) ? NULL : PrevPage(dvi,page); + } + return(page); +} + +struct pp_list { + struct pp_list *next; /* next in a series of alternates */ + int32_t ps_low, ps_high; /* allowed range */ +} *ppages = 0; /* the list of allowed pages */ + +/*-->InPageList*/ +/**********************************************************************/ +/****************************** InPageList **************************/ +/**********************************************************************/ +/* Return true iff i is one of the desired output pages */ + +bool InPageList(int32_t i) +{ + register struct pp_list *pl = ppages; + + while (pl) { + if ( i >= pl -> ps_low && i <= pl -> ps_high) + return(true); /* success */ + pl = pl -> next; + } + return(false); +} + +void ListPage(int32_t pslow, int32_t pshigh) +{ + register struct pp_list *pl; + + /* Some added code, we want to reuse the list */ + no_ppage=false; + pl = ppages; + while (pl != NULL && pl->ps_low <= pl->ps_high) + pl = pl->next; + if (pl == NULL) { + if ((pl = (struct pp_list *)malloc(sizeof(struct pp_list))) + ==NULL) + Fatal("cannot allocate memory for page queue"); + pl -> next = ppages; + ppages = pl; + } + pl -> ps_low = pslow; + pl -> ps_high = pshigh; +} + +/* Parse a string representing a list of pages. Return 0 iff ok. As a + side effect, the page selection(s) is (are) prepended to ppages. */ + +bool ParsePages(char *s) +{ + char *c; /* conversion start */ + long int ps_low = PAGE_MINPAGE, ps_high = PAGE_MAXPAGE; + + while (*s==' ' || *s=='\t') s++; + while (*s!='\0') { + if (*s=='-' || *s==':') { /* range with no starting value */ + ps_low = PAGE_MINPAGE; + c=s+1; + ps_high = strtol(c,&s,10); + if (c==s) ps_high=PAGE_MAXPAGE; /* no number */ + while (*s==' ' || *s=='\t') s++; + if (*s=='-' || *s==':') { /* Oh, range with negative starting value */ + ps_low = -ps_high; + c=s+1; + ps_high = strtol(c,&s,10); + if (c==s) ps_high=PAGE_MAXPAGE; /* no number */ + } + } else { /* range with starting value, or singleton */ + c=s; + ps_low = ps_high = strtol(c,&s,10); + if (c==s) + return(true); + if (*s=='-' || *s==':') { /* range */ + c=s+1; + ps_high = strtol(c,&s,10); + if (c==s) ps_high=PAGE_MAXPAGE; /* no number */ + } + } + ListPage(ps_low, ps_high); + while (*s==' ' || *s=='\t' || *s==',') s++; + } + return(false); +} + +/* Addition, we want to be able to clear the pplist */ +void ClearPpList(void) +{ + register struct pp_list *pl = ppages; + + while (pl) { + ppages=ppages->next; + free(pl); + pl = ppages; + } + first=PAGE_FIRSTPAGE; + last=PAGE_LASTPAGE; + abspage = false; + no_ppage=true; +} + diff --git a/Build/source/texk/dvipng/readme.texi b/Build/source/texk/dvipng/readme.texi new file mode 100644 index 00000000000..ccd94ca999b --- /dev/null +++ b/Build/source/texk/dvipng/readme.texi @@ -0,0 +1,149 @@ +@c readme.texi +@c +@c Part of the dvipng distribution + +@ifclear man +@include macros.texi +@ifset rawfile +@chapter dvipng + +@end ifset +@end ifclear +@c ----------------------- + +This program makes PNG and/or GIF graphics from DVI files as obtained +from @TeX{} and its relatives. + +If GIF support is enabled, GIF output is chosen by using the +@samp{dvigif} binary or with the @samp{--gif} option. + +@ifclear man + +It is intended to produce anti-aliased screen-resolution images as fast +as is possible. The target audience is people who need to generate and +regenerate many images again and again. The primary target is the +@previewlatex{} (X)Emacs package, a package to preview formulas from +within (X)Emacs. Yes, you get to see your formulas in the (X)Emacs +buffer, see @url{http://preview-latex.sf.net}. + +Another example is WeBWorK, an internet-based method for delivering +homework problems to students over the internet, giving students +instant feedback as to whether or not their answers are correct, see +@url{http://webwork.math.rochester.edu}. + +Other applications may also benefit, like web applications as latex2html +and WYSIWYG editors like LyX. + +@ifset rawfile +@section Benefits of dvipng +@end ifset +@end ifclear +@ifclear rawfile +@end ifclear + +The benefits of @samp{dvipng}/@samp{dvigif} include + +@itemize @bullet +@item +Speed. It is a very fast bitmap-rendering code for DVI files. On a +fairly low-end laptop, it takes less than a second to generate 150 +one-formula images. This makes dvipng suitable for generating large +amounts of images on-the-fly, as needed in @previewlatex{}, WeBWorK and +others. + +@item +It does not read the postamble, so it can be started before @TeX{} +finishes. There is a --follow switch that makes dvipng wait at EOF for +further output, unless it finds the POST marker that indicates the end +of the DVI. + +@item +Interactive query of options. dvipng can read options interactively +through stdin, and all options are usable. It is even possible to change +the input file through this interface. + +@item +Supports PK, VF, PostScript Type1, and TrueType fonts, color specials +and simple PostScript inclusion specials. + +@item +and more... + +@end itemize + +@ifset rawfile +@section Installation + +Read @file{INSTALL}, included in the distribution. + +@section Usage + +To use dvipng at its simplest, simply type + +@example +dvipng foo +@end example + +@noindent +where @file{foo.dvi} is the output of @TeX{} that you want to convert to +PNG format. If there are four pages in @file{foo.dvi}, those pages will +be output as @file{foo1.png}, @file{foo2.png}, @file{foo3.png}, and +@file{foo4.png}, respectively. + +Many options are available (see the info manual). For a brief summary +of available options, just type + +@example +dvipng --help +@end example + +@section Availability + +The dvipng package is available at Savannah, the GNU project site. Since +dvipng is not part of the GNU project, although released under the GNU +GPL, the web address is +@url{http://savannah.nongnu.org/projects/dvipng}. Instructions for +anonymous CVS access can be found at +@url{http://savannah.nongnu.org/cvs/?group=dvipng}. + +@section Contacts + +Bug reports should be sent to +@email{dvipng@@nongnu.org}. + +Questions, suggestions for new features, pleas for help, and/or praise +should go to @email{dvipng@@nongnu.org}. For more information on this +mailing list, send a message with just the word `help' as subject or +body to @email{dvipng-request@@nongnu.org} or look at +@url{http://lists.nongnu.org/mailman/listinfo/dvipng}. + +Offers to support further development will be appreciated. For developer +access, ask on @email{dvipng@@nongnu.org}. + +@section Copying + +This program is released under the GNU General Public License, see the +COPYING file in the dvipng distribution or +@url{http://www.gnu.org/licenses/gpl.html}. + +Copyright @copyright{} 2002-2005 Jan-@AA{}ke Larsson + +@section Todo + +@itemize @bullet +@item +Test the FreeType interface so that TrueType fonts work properly. + +@item +Further speed improvements. + +@item +Other output specials and source specials. + +@item +Remove kpathsea dependence, use dvips' environment variables (this is +maybe less of an issue now with working MiKTeX support). +@end itemize + + +@end ifset diff --git a/Build/source/texk/dvipng/set.c b/Build/source/texk/dvipng/set.c new file mode 100644 index 00000000000..1b73930a1fe --- /dev/null +++ b/Build/source/texk/dvipng/set.c @@ -0,0 +1,497 @@ +/* set.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif +#include <math.h> + +void CreateImage(pixels x_width,pixels y_width) +{ + int Background; + + if (page_imagep) + gdImageDestroy(page_imagep); + if (x_width <= 0) x_width=1; + if (y_width <= 0) y_width=1; +#ifdef HAVE_GDIMAGECREATETRUECOLOR + if (flags & RENDER_TRUECOLOR) + page_imagep=gdImageCreateTrueColor(x_width,y_width); + else +#endif + page_imagep=gdImageCreate(x_width,y_width); + /* Set bg color */ +#ifdef HAVE_GDIMAGECOLORRESOLVEALPHA + if (flags & BG_TRANSPARENT_ALPHA +#ifdef HAVE_GDIMAGEGIF + /* GIFs cannot handle an alpha channel, resort to transparent + color index */ + && ~flags & GIF_OUTPUT +#endif /* HAVE_GDIMAGEGIF */ + ) { + Background = gdImageColorAllocateAlpha(page_imagep, + cstack[0].red, + cstack[0].green, + cstack[0].blue,127); +#ifdef HAVE_GDIMAGEALPHABLENDING + /* Draw without blending to allow the background of the _viewer_ + to shine through. Color blending is calculated where needed. */ + gdImageAlphaBlending(page_imagep, 0); + gdImageSaveAlpha(page_imagep, 1); +#endif + } + else +#endif /* HAVE_GDIMAGECOLORRESOLVEALPHA */ + { + Background = gdImageColorAllocate(page_imagep, + cstack[0].red, + cstack[0].green, + cstack[0].blue); + /* maybe alpha is not available or perhaps we are producing + GIFs, so test for BG_TRANSPARENT_ALPHA too */ + if (flags & (BG_TRANSPARENT|BG_TRANSPARENT_ALPHA)) + gdImageColorTransparent(page_imagep,Background); + } +#ifdef HAVE_GDIMAGECREATETRUECOLOR + if (flags & RENDER_TRUECOLOR) + /* Truecolor: there is no background color index, fill image instead. */ + gdImageFilledRectangle(page_imagep, 0, 0, + x_width-1, y_width-1, Background); +#endif +} + + +void ChangeColor(gdImagePtr imagep,int x1,int y1,int x2,int y2,int color1,int color2) +/* In the given rectangle, change color1 to color2 */ +{ + int x,y; + for( y=y1; y<=y2; y++) { + for( x=x1; x<=x2; x++) { + if (gdImageGetPixel(imagep, x, y)==color1) + gdImageSetPixel(imagep, x, y, color2); + } + } +} + +void WriteImage(char *pngname, int pagenum) +{ + char* pos; + FILE* outfp=NULL; + + /* Transparent border */ + if (borderwidth>0) { + int Transparent,bgcolor; + pixels x_width,y_width; + + x_width=gdImageSX(page_imagep); + y_width=gdImageSY(page_imagep); + + bgcolor = gdImageColorResolve(page_imagep, + cstack[0].red,cstack[0].green,cstack[0].blue); + /* Set ANOTHER bg color, transparent this time */ + /* No semi-transparency here, given the motivation for this code + * (box cursor visibility in Emacs) */ + if (userbordercolor) + Transparent = gdImageColorAllocate(page_imagep, + bordercolor.red,bordercolor.green,bordercolor.blue); + else + Transparent = gdImageColorAllocate(page_imagep, + cstack[0].red,cstack[0].green,cstack[0].blue); + gdImageColorTransparent(page_imagep,Transparent); + ChangeColor(page_imagep,0,0,x_width-1,borderwidth-1,bgcolor,Transparent); + ChangeColor(page_imagep,0,0,borderwidth-1,y_width-1,bgcolor,Transparent); + ChangeColor(page_imagep,x_width-borderwidth,0,x_width-1,y_width-1,bgcolor,Transparent); + ChangeColor(page_imagep,0,y_width-borderwidth,x_width-1,y_width-1,bgcolor,Transparent); + } + + if ((pos=strchr(pngname,'%')) != NULL) { + if (strchr(++pos,'%')) + Fatal("too many %%s in output file name"); + if (*pos == 'd' + || (*pos=='0' && pos[1]>='1' && pos[1]<='9' && pos[2]=='d')) { + /* %d -> pagenumber, so add 9 string positions + since pagenumber max +-2^31 or +-2*10^9 */ + char* tempname = alloca(strlen(pngname)+9); + sprintf(tempname,pngname,pagenum); + pngname = tempname; + } else { + Fatal("unacceptible format spec in output file name"); + } + } +#ifdef HAVE_GDIMAGEGIF + if (flags & GIF_OUTPUT && (pos=strrchr(pngname,'.')) != NULL + && strcmp(pos,".png")==0) { + *(pos+1)='g'; + *(pos+2)='i'; + *(pos+3)='f'; + } +#endif + if ((outfp = fopen(pngname,"wb")) == NULL) + Fatal("cannot open output file %s",pngname); +#ifdef HAVE_GDIMAGEGIF + if (flags & GIF_OUTPUT) + gdImageGif(page_imagep,outfp); + else +#endif +#ifdef HAVE_GDIMAGEPNGEX + gdImagePngEx(page_imagep,outfp,compression); +#else + gdImagePng(page_imagep,outfp); +#endif + fclose(outfp); + DEBUG_PRINT(DEBUG_DVI,("\n WROTE: \t%s\n",pngname)); + DestroyImage(); +} + +void DestroyImage(void) +{ + gdImageDestroy(page_imagep); + page_imagep=NULL; +} + +static int gammatable[]= + {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19, + 20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39, + 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59, + 60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, + 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99, + 100,101,102,103,104,105,106,107,108,109, + 110,111,112,113,114,115,116,117,118,119, + 120,121,122,123,124,125,126,127,128,129, + 130,131,132,133,134,135,136,137,138,139, + 140,141,142,143,144,145,146,147,148,149, + 150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169, + 170,171,172,173,174,175,176,177,178,179, + 180,181,182,183,184,185,186,187,188,189, + 190,191,192,193,194,195,196,197,198,199, + 200,201,202,203,204,205,206,207,208,209, + 210,211,212,213,214,215,216,217,218,219, + 220,221,222,223,224,225,226,227,228,229, + 230,231,232,233,234,235,236,237,238,239, + 240,241,242,243,244,245,246,247,248,249, + 250,251,252,253,254,255}; + +void Gamma(double gamma) +{ + int i=0; + + while (i<=255) { + gammatable[i]=255-(int)(pow((double)(255-i)/255.0,gamma)*255); + DEBUG_PRINT(DEBUG_GLYPH,("\n GAMMA GREYSCALE: %d -> %d ",i,gammatable[i])); + i++; + } +} + + +#define GREYS 255 +dviunits SetGlyph(int32_t c, int32_t hh,int32_t vv) +{ + register struct char_entry *ptr = currentfont->chr[c]; + /* temporary char_entry pointer */ + int red,green,blue; + int *Color=alloca(sizeof(int)*(GREYS+1)); + int x,y; + int pos=0; + int bgColor,pixelgrey,pixelcolor; + hh -= ptr->xOffset/shrinkfactor; + vv -= ptr->yOffset/shrinkfactor; + + for( x=1; x<=GREYS ; x++) + Color[x] = -1; +#ifdef HAVE_GDIMAGECOLORRESOLVEALPHA + if (flags & BG_TRANSPARENT_ALPHA +#ifdef HAVE_GDIMAGEGIF + /* GIFs cannot handle an alpha channel, resort to transparent + color index */ + && ~flags & GIF_OUTPUT +#endif /* HAVE_GDIMAGEGIF */ + ) { + int alpha; + Color[0] = gdImageColorResolveAlpha(page_imagep, + cstack[0].red, + cstack[0].green, + cstack[0].blue,127); + for( y=0; y<ptr->h; y++) { + for( x=0; x<ptr->w; x++) { + if (ptr->data[pos]>0) { + pixelgrey=gammatable[(int)ptr->data[pos]]; + bgColor = gdImageGetPixel(page_imagep, hh + x, vv + y); + if (bgColor == Color[0]) { + if (Color[pixelgrey]==-1) { + DEBUG_PRINT(DEBUG_GLYPH,("\n GAMMA GREYSCALE: %d -> %d ",ptr->data[pos],pixelgrey)); + /* Standard background: use cached value if present */ + /* 127-alpha/2: 0=opaque,127=full_trans */ + Color[pixelgrey]=gdImageColorResolveAlpha(page_imagep, + cstack[csp].red, + cstack[csp].green, + cstack[csp].blue, + 127-pixelgrey/2); + } + pixelcolor=Color[pixelgrey]; + } else { + /* Overstrike: No cache */ + red =gdImageRed(page_imagep, bgColor); + green=gdImageGreen(page_imagep, bgColor); + blue =gdImageBlue(page_imagep, bgColor); + alpha=255-2*gdImageAlpha(page_imagep, bgColor); + red =red-(red-cstack[csp].red)*pixelgrey/GREYS; + green=green-(green-cstack[csp].green)*pixelgrey/GREYS; + blue =blue-(blue-cstack[csp].blue)*pixelgrey/GREYS; + /* 255=opaque */ + alpha=alpha-(alpha-255)*pixelgrey/GREYS; + /* 127-alpha/2: 0=opaque,127=full_trans */ + pixelcolor = gdImageColorResolveAlpha(page_imagep, + red,green,blue,127-alpha/2); + } + gdImageSetPixel(page_imagep, hh + x, vv + y, pixelcolor); + } + pos++; + } + } + } else +#endif /* HAVE_GDIMAGECOLORRESOLVEALPHA */ + { + Color[0] = gdImageColorResolve(page_imagep, + cstack[0].red, + cstack[0].green, + cstack[0].blue); + for( y=0; y<ptr->h; y++) { + for( x=0; x<ptr->w; x++) { + if (ptr->data[pos]>0) { + pixelgrey=gammatable[(int)ptr->data[pos]]; + bgColor = gdImageGetPixel(page_imagep, hh + x, vv + y); + if (bgColor == Color[0]) { + /* Standard background: use cached value if present */ + if (Color[pixelgrey]==-1) { + DEBUG_PRINT(DEBUG_GLYPH,("\n GAMMA GREYSCALE: %d -> %d ",ptr->data[pos],pixelgrey)); + red = cstack[0].red + - (cstack[0].red-cstack[csp].red)*pixelgrey/GREYS; + green = cstack[0].green + - (cstack[0].green-cstack[csp].green)*pixelgrey/GREYS; + blue = cstack[0].blue + - (cstack[0].blue-cstack[csp].blue)*pixelgrey/GREYS; + Color[pixelgrey] = + gdImageColorResolve(page_imagep,red,green,blue); + } + pixelcolor=Color[pixelgrey]; + } else { + /* Overstrike: No cache */ + red=gdImageRed(page_imagep, bgColor); + green=gdImageGreen(page_imagep, bgColor); + blue=gdImageBlue(page_imagep, bgColor); + red = red-(red-cstack[csp].red)*pixelgrey/GREYS; + green = green-(green-cstack[csp].green)*pixelgrey/GREYS; + blue = blue-(blue-cstack[csp].blue)*pixelgrey/GREYS; + pixelcolor = gdImageColorResolve(page_imagep, red, green, blue); + } + gdImageSetPixel(page_imagep, hh + x, vv + y, pixelcolor); + } + pos++; + } + } + } + /* This code saved _no_ execution time, strangely. + * Also, it cannot gamma correct; needs that in loaded glyphs + * + * #ifdef HAVE_GDIMAGECREATETRUECOLOR + * if (truecolor) + * for( i=1; i<=ptr->glyph.nchars ; i++) { + * Color = gdImageColorResolveAlpha(page_imagep,Red,Green,Blue, + * 128-128*i/ptr->glyph.nchars); + * gdImageChar(page_imagep, &(ptr->glyph), + * hh - ptr->xOffset/shrinkfactor, + * vv - ptr->yOffset/shrinkfactor, + * i,Color); + * } + * else { + * #endif */ + return(ptr->tfmw); +} + +dviunits SetRule(dviunits a, dviunits b, subpixels hh,subpixels vv) +{ + /* This routine will draw a \rule */ + int Color; + pixels width=0, height=0; + + if ( a > 0 && b > 0 ) { + /* Calculate width and height, round up */ + width = (b+dvi->conv*shrinkfactor-1)/dvi->conv/shrinkfactor; + height = (a+dvi->conv*shrinkfactor-1)/dvi->conv/shrinkfactor; + } + if (page_imagep != NULL) { + if ((height>0) && (width>0)) { + /* This code produces too dark rules. But what the hell. Grey + * rules look fuzzy. */ + Color = gdImageColorResolve(page_imagep, + cstack[csp].red, + cstack[csp].green, + cstack[csp].blue); + /* +1 and -1 are because the Rectangle coords include last pixels */ + gdImageFilledRectangle(page_imagep,hh,vv-height+1,hh+width-1,vv,Color); + DEBUG_PRINT(DEBUG_DVI,("\n RULE \t%dx%d at (%d,%d)", + width, height, hh, vv)); + } + } else { + /* The +1's are because things are cut _at_that_coordinate_. */ + min(x_min,hh); + min(y_min,vv-height+1); + max(x_max,hh+width); + max(y_max,vv+1); + } + return(b); +} + + +#if 0 + if (page_imagep != NULL) { + if ((a>0) && (b>0)) { + int width,height,left=-1,right=-1,bottom=-1,top=-1; + gdImagePtr rule; + + + width = (h+b+dvi->conv*shrinkfactor-1)/dvi->conv/shrinkfactor + - h/dvi->conv/shrinkfactor; + /* Calculate height, round up on the bottom and down on the top */ + height = (v+dvi->conv*shrinkfactor-1)/dvi->conv/shrinkfactor + - (v-a)/dvi->conv/shrinkfactor; + rule = gdImageCreate(width,height); + /* Set background */ + gdImageColorAllocate(rule,Red,Green,Blue); + + /* Calculate blackness of edges of wide rule */ + left = shrinkfactor - h/dvi->conv%shrinkfactor; + right = (h+b+dvi->conv-1)/dvi->conv%shrinkfactor; + if (right==0) right = shrinkfactor; + if (width==1) { + /* Adjust blackness of narrow rule */ + left = shrinkfactor; + /* The (correct) alternative produces "fuzzy" tables */ + /* left = ((h+b+dvi->conv-1)/dvi->conv - h/dvi->conv)%shrinkfactor; + */ + } + if (width==2 && right+left <= shrinkfactor +1) { + /* Adjust blackness of narrow rule when spread across two columns */ + /* Cheat to make it sharp (+1 above, and wedging it around below) */ + if (right>left) { right=shrinkfactor; left=0; } + if (right<left) { left=shrinkfactor; right=0; } + if (right==left) { left=right=(shrinkfactor+1)/2; } + } + + /* Calculate blackness of edges of tall rule */ + bottom = (v+dvi->conv-1)/dvi->conv%shrinkfactor; + if (bottom==0) bottom = shrinkfactor; + top = shrinkfactor-(v-a)/dvi->conv%shrinkfactor; + if (height == 1) { + /* Adjust blackness of short rule */ + bottom = shrinkfactor; + /* The (correct) alternative produces "fuzzy" tables */ + /* bottom = ((v+dvi->conv-1)/dvi->conv - (v-a)/dvi->conv)%shrinkfactor; + */ + } + if (height==2 && top+bottom <= shrinkfactor +1) { + /* Adjust blackness of short rule when spread across two columns */ + /* Cheat to make it sharp (+1 above, and wedging it around below) */ + if (top>bottom) { top=shrinkfactor; bottom=0; } + if (top<bottom) { bottom=shrinkfactor; top=0; } + if (right==left) { left=right=(shrinkfactor+1)/2; } + } + + Color = gdImageColorResolve(rule, + bRed-(bRed-Red)*left*bottom/shrinkfactor/shrinkfactor, + bGreen-(bGreen-Green)*left*bottom/shrinkfactor/shrinkfactor, + bBlue-(bBlue-Blue)*left*bottom/shrinkfactor/shrinkfactor); + gdImageSetPixel(rule,0,height-1,Color); + if (width>1) { + Color = gdImageColorResolve(rule, + bRed-(bRed-Red)*right*bottom/shrinkfactor/shrinkfactor, + bGreen-(bGreen-Green)*right*bottom/shrinkfactor/shrinkfactor, + bBlue-(bBlue-Blue)*right*bottom/shrinkfactor/shrinkfactor); + gdImageSetPixel(rule,width-1,height-1,Color); + } + if (height>1) { + Color = gdImageColorResolve(rule, + bRed-(bRed-Red)*left*top/shrinkfactor/shrinkfactor, + bGreen-(bGreen-Green)*left*top/shrinkfactor/shrinkfactor, + bBlue-(bBlue-Blue)*left*top/shrinkfactor/shrinkfactor); + gdImageSetPixel(rule,0,0,Color); + } + if (height>1 && width>1) { + Color = gdImageColorResolve(rule, + bRed-(bRed-Red)*right*top/shrinkfactor/shrinkfactor, + bGreen-(bGreen-Green)*right*top/shrinkfactor/shrinkfactor, + bBlue-(bBlue-Blue)*right*top/shrinkfactor/shrinkfactor); + gdImageSetPixel(rule,width-1,0,Color); + } + + if (width>2) { + Color = gdImageColorResolve(rule, + bRed-(bRed-Red)*bottom/shrinkfactor, + bGreen-(bGreen-Green)*bottom/shrinkfactor, + bBlue-(bBlue-Blue)*bottom/shrinkfactor); + gdImageFilledRectangle(rule,1,height-1,width-2,height-1,Color); + } + if (height>2) { + Color = gdImageColorResolve(rule, + bRed-(bRed-Red)*left/shrinkfactor, + bGreen-(bGreen-Green)*left/shrinkfactor, + bBlue-(bBlue-Blue)*left/shrinkfactor); + gdImageFilledRectangle(rule,0,1,0,height-2,Color); + } + if (height>1 && width>2) { + Color = gdImageColorResolve(rule, + bRed-(bRed-Red)*top/shrinkfactor, + bGreen-(bGreen-Green)*top/shrinkfactor, + bBlue-(bBlue-Blue)*top/shrinkfactor); + gdImageFilledRectangle(rule,1,0,width-2,0,Color); + } + if (height>2 && width>1) { + Color = gdImageColorResolve(rule, + bRed-(bRed-Red)*right/shrinkfactor, + bGreen-(bGreen-Green)*right/shrinkfactor, + bBlue-(bBlue-Blue)*right/shrinkfactor); + gdImageFilledRectangle(rule,width-1,1,width-1,height-2,Color); + } + gdImageCopy(page_imagep,rule, + h/dvi->conv/shrinkfactor, + (v-a)/dvi->conv/shrinkfactor, + 0,0,width,height); + DEBUG_PRINT(DEBUG_DVI,("\n RULE \t%dx%d at (%d,%d)", + width,height, + PIXROUND(h, dvi->conv*shrinkfactor), + PIXROUND(v, dvi->conv*shrinkfactor))); + DEBUG_PRINT(DEBUG_DVI,(" (lrtb %d %d %d %d)",left,right,top,bottom)); + } + } else { + min(x_min,hh); + min(y_min,vv-height+1); + max(x_max,hh+width); + max(y_max,vv+1); + } +#endif + + diff --git a/Build/source/texk/dvipng/special.c b/Build/source/texk/dvipng/special.c new file mode 100644 index 00000000000..be7d5e42a08 --- /dev/null +++ b/Build/source/texk/dvipng/special.c @@ -0,0 +1,482 @@ +/* special.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#include <fcntl.h> +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif + +#define SKIPSPACES(s) while(s && *s==' ' && *s!='\0') s++ + +gdImagePtr +ps2png(const char *psfile, int hresolution, int vresolution, + int urx, int ury, int llx, int lly) +{ +#ifndef MIKTEX + int downpipe[2], uppipe[2]; + pid_t pid; +#else + HANDLE hPngStream; + HANDLE hPsStream; + HANDLE hStdErr; + PROCESS_INFORMATION pi; + _TCHAR szCommandLine[2048]; + _TCHAR szGsPath[_MAX_PATH]; + int fd; +#endif + FILE *psstream=NULL, *pngstream=NULL; + char resolution[STRSIZE]; + /* char devicesize[STRSIZE]; */ + /* For some reason, png256 gives inferior result */ + char *device="-sDEVICE=png16m"; + gdImagePtr psimage=NULL; + static bool showpage; + + sprintf(resolution, "-r%dx%d",hresolution,vresolution); + /* Future extension for \rotatebox + status=sprintf(devicesize, "-g%dx%d", + //(int)((sin(atan(1.0))+1)* + (urx - llx)*hresolution/72,//), + //(int)((sin(atan(1.0))+1)* + (ury - lly)*vresolution/72);//); + */ + /* png16m being the default, this code is not needed + * #ifdef HAVE_GDIMAGECREATETRUECOLOR + * if (flags & RENDER_TRUECOLOR) + * device="-sDEVICE=png16m"; + * #endif + */ + +#ifndef MIKTEX + if (pipe(downpipe) || pipe(uppipe)) return(NULL); + /* Ready to fork */ + pid = fork (); + if (pid == 0) { /* Child process. Execute gs. */ + close(downpipe[1]); + dup2(downpipe[0], STDIN_FILENO); + close(downpipe[0]); +#ifdef DEBUG + if (flags & NO_GSSAFER) { + DEBUG_PRINT(DEBUG_GS, + ("\n GS CALL:\t%s %s %s %s %s %s %s %s %s %s ",/* %s", */ + GS_PATH, device, resolution, /* devicesize, */ + "-dBATCH", "-dNOPAUSE", "-q", + "-sOutputFile=-", + "-dTextAlphaBits=4", "-dGraphicsAlphaBits=4", + "-")); + } else { + DEBUG_PRINT(DEBUG_GS, + ("\n GS CALL:\t%s %s %s %s %s %s %s %s %s %s %s ",/* %s", */ + GS_PATH, device, resolution, /*devicesize,*/ + "-dBATCH", "-dNOPAUSE", "-dSAFER", "-q", + "-sOutputFile=-", + "-dTextAlphaBits=4", "-dGraphicsAlphaBits=4", + "-")); + } +#endif + close(uppipe[0]); + dup2(uppipe[1], STDOUT_FILENO); + close(uppipe[1]); + if (flags & NO_GSSAFER) + execl (GS_PATH, GS_PATH, device, resolution, /*devicesize,*/ + "-dBATCH", "-dNOPAUSE", "-q", + "-sOutputFile=-", + "-dTextAlphaBits=4", "-dGraphicsAlphaBits=4", + "-",NULL); + else + execl (GS_PATH, GS_PATH, device, resolution, /*devicesize,*/ + "-dBATCH", "-dNOPAUSE", "-dSAFER", "-q", + "-sOutputFile=-", + "-dTextAlphaBits=4", "-dGraphicsAlphaBits=4", + "-",NULL); + _exit (EXIT_FAILURE); + } + /* Parent process. */ + + close(downpipe[0]); + psstream=fdopen(downpipe[1],"wb"); + if (psstream == NULL) + close(downpipe[1]); + close(uppipe[1]); + pngstream=fdopen(uppipe[0],"rb"); + if (pngstream == NULL) + close(uppipe[0]); +#else /* MIKTEX */ + if (! miktex_find_miktex_executable("mgs.exe", szGsPath)) { + Warning("Ghostscript could not be found"); + return(NULL); + } + if (flags & NO_GSSAFER) { + DEBUG_PRINT(DEBUG_GS, + ("\n GS CALL:\t%s %s %s %s %s %s %s %s %s %s ",/* %s",*/ + szGsPath, device, resolution, /*devicesize,*/ + "-dBATCH", "-dNOPAUSE", "-q", + "-sOutputFile=-", + "-dTextAlphaBits=4", "-dGraphicsAlphaBits=4", + "-")); + sprintf(szCommandLine,"\"%s\" %s %s %s %s %s %s %s %s %s",/* %s",*/ + szGsPath, device, resolution, /*devicesize,*/ + "-dBATCH", "-dNOPAUSE", "-q", + "-sOutputFile=-", + "-dTextAlphaBits=4", "-dGraphicsAlphaBits=4", + "-"); + } else { + DEBUG_PRINT(DEBUG_GS, + ("\n GS CALL:\t%s %s %s %s %s %s %s %s %s %s %s ",/* %s",*/ + szGsPath, device, resolution, /*devicesize,*/ + "-dBATCH", "-dNOPAUSE", "-dSAFER", "-q", + "-sOutputFile=-", + "-dTextAlphaBits=4", "-dGraphicsAlphaBits=4", + "-")); + sprintf(szCommandLine,"\"%s\" %s %s %s %s %s %s %s %s %s %s",/* %s",*/ + szGsPath, device, resolution, /*devicesize,*/ + "-dBATCH", "-dNOPAUSE", "-dSAFER", "-q", + "-sOutputFile=-", + "-dTextAlphaBits=4", "-dGraphicsAlphaBits=4", + "-"); + } + if (! miktex_start_process_3(szCommandLine, &pi, INVALID_HANDLE_VALUE, + &hPsStream, &hPngStream, &hStdErr, 0)) { + Warning("Ghostscript could not be started"); + return(NULL); + } + CloseHandle (pi.hThread); + fd = _open_osfhandle((intptr_t)hPsStream, _O_WRONLY); + if (fd >= 0) { + psstream = _tfdopen(fd, "wb"); + if (psstream == NULL) + _close (fd); + } + fd = _open_osfhandle((intptr_t)hPngStream, _O_RDONLY); + if (fd >= 0) { + pngstream = _tfdopen(fd, "rb"); + if (pngstream == NULL) + _close (fd); + } +#endif + if (psstream) { + DEBUG_PRINT(DEBUG_GS,("\n PS CODE:\t<</PageSize[%d %d]/PageOffset[%d %d[1 1 dtransform exch]{0 ge{neg}if exch}forall]>>setpagedevice", + urx - llx, ury - lly,llx,lly)); + fprintf(psstream, "<</PageSize[%d %d]/PageOffset[%d %d[1 1 dtransform exch]{0 ge{neg}if exch}forall]>>setpagedevice\n", + urx - llx, ury - lly,llx,lly); + if ( cstack[0].red < 255 || cstack[0].green < 255 || cstack[0].blue < 255 ) { + DEBUG_PRINT(DEBUG_GS,("\n PS CODE:\tgsave %f %f %f setrgbcolor clippath fill grestore", + cstack[0].red/255.0, cstack[0].green/255.0, cstack[0].blue/255.0)); + fprintf(psstream, "gsave %f %f %f setrgbcolor clippath fill grestore", + cstack[0].red/255.0, cstack[0].green/255.0, cstack[0].blue/255.0); + } + DEBUG_PRINT(DEBUG_GS,("\n PS CODE:\t(%s) run", psfile)); + fprintf(psstream, "(%s) run\n", psfile); + if (showpage) { + DEBUG_PRINT(DEBUG_GS,("\n PS CODE:\tshowpage")); + fprintf(psstream, "showpage\n"); + } + DEBUG_PRINT(DEBUG_GS,("\n PS CODE:\tquit")); + fprintf(psstream, "quit\n"); + fclose(psstream); + } + if (pngstream) { + psimage = gdImageCreateFromPng(pngstream); + fclose(pngstream); + } +#ifdef MIKTEX + CloseHandle(pi.hProcess); +#endif +#ifdef HAVE_GDIMAGETRUECOLORTOPALETTE +#ifdef HAVE_GDIMAGECREATETRUECOLOR + if (!flags & RENDER_TRUECOLOR) +#endif + gdImageTrueColorToPalette(psimage,0,256); +#endif + if (psimage == NULL) { + DEBUG_PRINT(DEBUG_GS,("\n GS OUTPUT:\tNO IMAGE ")); + if (!showpage) { + showpage=true; + DEBUG_PRINT(DEBUG_GS,("(will try adding \"showpage\") ")); + psimage=ps2png(psfile, hresolution, vresolution, urx, ury, llx, lly); + showpage=false; + } +#ifdef DEBUG + } else { + DEBUG_PRINT(DEBUG_GS,("\n GS OUTPUT:\t%dx%d image ", + gdImageSX(psimage),gdImageSY(psimage))); +#endif + } + return psimage; +} + +/*-->SetSpecial*/ +/*********************************************************************/ +/**************************** SetSpecial ***************************/ +/*********************************************************************/ + +void SetSpecial(char * special, int32_t length, int32_t hh, int32_t vv) +/* interpret a \special command, made up of keyword=value pairs */ +/* Color specials only for now. Warn otherwise. */ +{ + char *buffer; + + DEBUG_PRINT(DEBUG_DVI,(" '%.*s'",length,special)); + + buffer = alloca(sizeof(char)*(length+1)); + if (buffer==NULL) + Fatal("cannot allocate space for special string"); + + strncpy(buffer,special,length); + buffer[length]='\0'; + + SKIPSPACES(buffer); + /********************** Color specials ***********************/ + if (strncmp(buffer,"background ",11)==0) { + background(buffer+11); + return; + } + if (strncmp(buffer,"color ",6)==0) { + buffer+=6; + SKIPSPACES(buffer); + if (strncmp(buffer,"push ",5)==0) { + pushcolor(buffer+5); + } else { + if (strcmp(buffer,"pop")==0) + popcolor(); + else + resetcolorstack(buffer); + } + return; + } + + /******************* Postscript inclusion ********************/ + if (strncmp(buffer,"PSfile=",7)==0) { /* PSfile */ + char* psname = buffer+7,*psfile; + int llx=0,lly=0,urx=0,ury=0,rwi=0,rhi=0; + int hresolution,vresolution; + + /* Remove quotation marks around filename */ + if (*psname=='"') { + char* tmp; + psname++; + tmp=strrchr(psname,'"'); + if (tmp!=NULL) { + *tmp='\0'; + buffer=tmp+1; + } else + buffer=NULL; + } + TEMPSTR(psfile,kpse_find_file(psname,kpse_pict_format,0)); + + /* Retrieve parameters */ + SKIPSPACES(buffer); + while(buffer && *buffer) { + if (strncmp(buffer,"llx=",4)==0) llx = strtol(buffer+4,&buffer,10); + else if (strncmp(buffer,"lly=",4)==0) lly = strtol(buffer+4,&buffer,10); + else if (strncmp(buffer,"urx=",4)==0) urx = strtol(buffer+4,&buffer,10); + else if (strncmp(buffer,"ury=",4)==0) ury = strtol(buffer+4,&buffer,10); + else if (strncmp(buffer,"rwi=",4)==0) rwi = strtol(buffer+4,&buffer,10); + else if (strncmp(buffer,"rhi=",4)==0) rhi = strtol(buffer+4,&buffer,10); + else while (*buffer && *buffer!=' ') buffer++; + SKIPSPACES(buffer); + } + + /* Calculate resolution, and use our base resolution as a fallback. */ + /* The factor 10 is magic, the dvips graphicx driver needs this. */ + hresolution = dpi*rwi/(urx - llx)/10; + vresolution = dpi*rhi/(ury - lly)/10; + if (vresolution==0) vresolution = hresolution; + if (hresolution==0) hresolution = vresolution; + if (hresolution==0) hresolution = vresolution = dpi; + + if (page_imagep != NULL) { /* Draw into image */ + char* psfile; + gdImagePtr psimage=NULL; + + /*---------- Cache ----------*/ + char* cachename = NULL; + gdImagePtr cacheimage=NULL; + + TEMPSTR(psfile,kpse_find_file(psname,kpse_pict_format,0)); + if (flags & CACHE_IMAGES) { /* Find cached image, if it exists */ + char *cachefile,*separator; + + cachename = alloca(sizeof(char)*(strlen(psname+5))); + if (cachename==NULL) + Fatal("cannot allocate space for cached image filename"); + strcpy(cachename,psname); + separator = strrchr(cachename,'.'); + if (separator!=NULL) + *separator='\0'; + strcat(cachename,".png"); + cachefile = kpse_find_file(cachename,kpse_pict_format,0); + if (cachefile!=NULL) { + FILE* cachefilep = fopen(cachefile,"rb"); + + if (cachefilep!=NULL) { + cacheimage = gdImageCreateFromPng(cachefilep); + fclose(cachefilep); + } + free(cachefile); + } + psimage = cacheimage; + } + /*---------- End Cache ----------*/ + Message(BE_NONQUIET,"<%s",psname); + if (psimage==NULL) { + /* No cached image, convert postscript */ + if (psfile == NULL) { + Warning("PS file %s not found, image will be left blank", psname ); + flags |= PAGE_GAVE_WARN; + } else if (flags & NO_GHOSTSCRIPT) { + Warning("GhostScript calls disallowed by --noghostscript", + psfile ); + flags |= PAGE_GAVE_WARN; + } else { + psimage = ps2png(psfile, hresolution, vresolution, + urx, ury, llx, lly); + if ( psimage == NULL ) { + Warning("Unable to convert %s to PNG, image will be left blank", + psfile ); + flags |= PAGE_GAVE_WARN; + } + } + } + /*---------- Store Cache ----------*/ + if (flags & CACHE_IMAGES && cachename !=NULL && + cacheimage==NULL && psimage != NULL) { + /* Cache image not found, save converted postscript */ + FILE* cachefilep = fopen(cachename,"wb"); + if (cachefilep!=NULL) { + gdImagePng(psimage,cachefilep); + fclose(cachefilep); + } else + Warning("Unable to cache %s as PNG", psfile ); + } + /*---------- End Store Cache ----------*/ + if (psimage!=NULL) { + DEBUG_PRINT(DEBUG_DVI, + ("\n PS-PNG INCLUDE \t%s (%d,%d) res %dx%d at (%d,%d)", + psfile, + gdImageSX(psimage),gdImageSY(psimage), + hresolution,vresolution, + hh, vv)); + gdImageCopy(page_imagep, psimage, + hh, vv-gdImageSY(psimage), + 0,0, + gdImageSX(psimage),gdImageSY(psimage)); + gdImageDestroy(psimage); + } + Message(BE_NONQUIET,">"); + } else { /* Don't draw */ + int pngheight,pngwidth; + + /* Convert from postscript 72 dpi resolution to our given resolution */ + pngheight = (vresolution*(ury - lly)+71)/72; /* +71: do 'ceil' */ + pngwidth = (hresolution*(urx - llx)+71)/72; + DEBUG_PRINT(DEBUG_DVI,("\n PS-PNG INCLUDE \t(%d,%d)", + pngwidth,pngheight)); + min(x_min,hh); + min(y_min,vv-pngheight); + max(x_max,hh+pngwidth); + max(y_max,vv); + } + return; + } + + /* preview-latex' tightpage option */ + if (strncmp(buffer,"!/preview@tightpage",19)==0) { + buffer+=19; + SKIPSPACES(buffer); + if (strncmp(buffer,"true",4)==0) { + if (page_imagep==NULL) + Message(BE_NONQUIET," (preview-latex tightpage option detected, will use its bounding box)"); + flags |= PREVIEW_LATEX_TIGHTPAGE; + return; + } + } + if (strncmp(buffer,"!userdict",9)==0 + && strstr(buffer+10,"7{currentfile token not{stop}if 65781.76 div")!=NULL) { + if (page_imagep==NULL && ~flags & PREVIEW_LATEX_TIGHTPAGE) + Message(BE_NONQUIET," (preview-latex <= 0.9.1 tightpage option detected, will use its bounding box)"); + flags |= PREVIEW_LATEX_TIGHTPAGE; + return; + } + + /* preview-latex' dvips bop-hook redefinition */ + if (strncmp(buffer,"!userdict",9)==0 + && strstr(buffer+10,"preview-bop-")!=NULL) { + if (page_imagep==NULL) + Message(BE_NONQUIET," (preview-latex beginning-of-page-hook detected)"); + return; + } + + if (strncmp(buffer,"ps::",4)==0) { + /* Hokay, decode bounding box */ + dviunits adj_llx,adj_lly,adj_urx,adj_ury,ht,dp,wd; + adj_llx = strtol(buffer+4,&buffer,10); + adj_lly = strtol(buffer,&buffer,10); + adj_urx = strtol(buffer,&buffer,10); + adj_ury = strtol(buffer,&buffer,10); + ht = strtol(buffer,&buffer,10); + dp = strtol(buffer,&buffer,10); + wd = strtol(buffer,&buffer,10); + if (wd>0) { + x_offset_tightpage = + (-adj_llx+dvi->conv*shrinkfactor-1)/dvi->conv/shrinkfactor; + x_width_tightpage = x_offset_tightpage + +(wd+adj_urx+dvi->conv*shrinkfactor-1)/dvi->conv/shrinkfactor; + } else { + x_offset_tightpage = + (-wd+adj_urx+dvi->conv*shrinkfactor-1)/dvi->conv/shrinkfactor; + x_width_tightpage = x_offset_tightpage + +(-adj_llx+dvi->conv*shrinkfactor-1)/dvi->conv/shrinkfactor; + } + /* y-offset = height - 1 */ + y_offset_tightpage = + (((ht>0)?ht:0)+adj_ury+dvi->conv*shrinkfactor-1)/dvi->conv/shrinkfactor-1; + y_width_tightpage = y_offset_tightpage+1 + +(((dp>0)?dp:0)-adj_lly+dvi->conv*shrinkfactor-1)/dvi->conv/shrinkfactor; + return; + } + + if (strncmp(buffer,"papersize=",10)==0) { /* papersize spec, ignored */ + return; + } + if (strncmp(buffer,"header=",7)==0 || buffer[0]=='!') { /* header, ignored */ + if ( page_imagep != NULL ) + Warning("at (%ld,%ld) ignored header \\special{%.*s}", + hh, vv, length,special); + return; + } + if (strncmp(buffer,"src:",4)==0) { /* source special */ + if ( page_imagep != NULL ) + Message(BE_NONQUIET," at (%ld,%ld) source \\special{%.*s}", + hh, vv, length,special); + return; + } + if ( page_imagep != NULL ) { + Warning("at (%ld,%ld) unimplemented \\special{%.*s}", + hh, vv, length,special); + flags |= PAGE_GAVE_WARN; + } +} diff --git a/Build/source/texk/dvipng/t1.c b/Build/source/texk/dvipng/t1.c new file mode 100644 index 00000000000..7985e9fb352 --- /dev/null +++ b/Build/source/texk/dvipng/t1.c @@ -0,0 +1,194 @@ +/* t1.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif + +void LoadT1(int32_t c, struct char_entry * ptr) +{ + GLYPH *glyph; + int original_width,original_height; + int i,j,k,width,height; + unsigned short shrunk_width,shrunk_height; + short xoffset,yoffset; + unsigned short i_offset,j_offset; + + DEBUG_PRINT(DEBUG_T1,("\n LOAD T1 CHAR\t%d",c)); + if ((glyph= + T1_SetChar(currentfont->T1id, c, + (float)currentfont->dpi*currentfont->d/65536/72.27, + currentfont->psfontmap==NULL ? NULL : currentfont->psfontmap->t1_transformp)) + ==NULL) + Fatal("cannot load T1 char %d",c); + + DEBUG_PRINT(DEBUG_T1,(" (%d)",ptr->tfmw)); + + original_width = glyph->metrics.rightSideBearing + - glyph->metrics.leftSideBearing; + original_height = glyph->metrics.ascent - glyph->metrics.descent; + DEBUG_PRINT(DEBUG_T1,(" %dx%d",original_width,original_height)); + + if (original_width > 0x7fff || original_height > 0x7fff) + Fatal("character %d too large in file %s", c, currentfont->name); + + /* + * Hotspot issues: Shrinking to the topleft corner rather than the + hotspot will displace glyphs a fraction of a pixel. We deal with + this in as follows: The glyph is shrunk to its hotspot by + offsetting the bitmap somewhat to put the hotspot in the lower + left corner of a "shrink square". Shrinking to the topleft corner + will then act as shrinking to the hotspot. This may enlarge the + bitmap somewhat, of course. (Also remember that the below + calculation of i/j_offset is in integer arithmetics.) + + There will still be a displacement from rounding the dvi + position, but vertically it will be equal for all glyphs on a + line, so we displace a whole line vertically by fractions of a + pixel. This is acceptible, IMHO. Sometime there will be support + for subpixel positioning, horizontally. Will do for now, I + suppose. + */ + xoffset = -glyph->metrics.leftSideBearing; + /* printf("xoffset: %d\n",xoffset); */ + i_offset = ( shrinkfactor - xoffset % shrinkfactor ) % shrinkfactor; + width = original_width+i_offset; + ptr->xOffset = xoffset+i_offset; + + yoffset = glyph->metrics.ascent-1; + /* printf("yoffset: %d\n",yoffset); */ + j_offset = ( shrinkfactor - (yoffset-(shrinkfactor-1)) % shrinkfactor ) + % shrinkfactor; + height = original_height+j_offset; + ptr->yOffset = yoffset+j_offset; + + DEBUG_PRINT(DEBUG_T1,(" (%dx%d)",width,height)); + /* + Extra marginal so that we do not crop the image when shrinking. + */ + shrunk_width = (width + shrinkfactor - 1) / shrinkfactor; + shrunk_height = (height + shrinkfactor - 1) / shrinkfactor; + ptr->w = shrunk_width; + ptr->h = shrunk_height; + + /* printf("(%d,%d) ",ptr->w,ptr->h); */ + DEBUG_PRINT(DEBUG_GLYPH,("\nDRAW GLYPH %d\n", (int)c)); + + /* + Shrink raster while doing antialiasing. + */ + if ((ptr->data = calloc(shrunk_width*shrunk_height,sizeof(char))) == NULL) + Fatal("unable to allocate image space for char %c", (char)c); + for (j = 0; j < original_height; j++) { + for (i = 0; i < (original_width+7)/8 ; i++) { + for (k = 0; k < 8 ; k++) { + DEBUG_PRINT(DEBUG_GLYPH, + ("%c", + (glyph->bits[i+j*((original_width+7)/8)] & (1<<k)) ? + 'x' : ' ')); + ptr->data[(i*8+k+i_offset)/shrinkfactor + +(j+j_offset)/shrinkfactor*shrunk_width] += + (glyph->bits[i+j*((original_width+7)/8)] & (1<<k) ? 1 : 0); + } + } + DEBUG_PRINT(DEBUG_GLYPH,("|\n")); + } + for (j = 0; j < shrunk_height; j++) { + for (i = 0; i < shrunk_width; i++) { + ptr->data[i+j*shrunk_width] = ptr->data[i+j*shrunk_width] + *255/shrinkfactor/shrinkfactor; + DEBUG_PRINT(DEBUG_GLYPH,("%3u ",ptr->data[i+j*shrunk_width])); + } + DEBUG_PRINT(DEBUG_GLYPH,("|\n")); + } +} + +bool InitT1(struct font_entry * tfontp) +{ + if (libt1==NULL) { + if ((libt1=T1_InitLib( NO_LOGFILE | IGNORE_CONFIGFILE + | IGNORE_FONTDATABASE | T1_NO_AFM)) == NULL) { + Warning("an error occured during t1lib initialisation, disabling it"); + flags &= ~USE_LIBT1; + return(false); + } +# ifdef DEBUG + else + DEBUG_PRINT(DEBUG_T1,("\n T1LIB VERSION: %s", T1_GetLibIdent())); +# endif + } + + DEBUG_PRINT((DEBUG_DVI|DEBUG_T1),("\n OPEN T1 FONT:\t'%s'", tfontp->name)); + tfontp->T1id = T1_AddFont( tfontp->name ); + if (tfontp->T1id < 0) { + Warning("t1lib could not open font file %s", tfontp->name); + return(false); + } + if (T1_LoadFont(tfontp->T1id)) { + Warning("t1lib could not load font file %s", tfontp->name); + return(false); + } + Message(BE_VERBOSE,"<%s>", tfontp->name); + if (tfontp->psfontmap!=NULL && tfontp->psfontmap->encoding != NULL) { + DEBUG_PRINT(DEBUG_T1,("\n USE ENCODING:\t'%s'", tfontp->psfontmap->encoding->name)); + if (T1_ReencodeFont(tfontp->T1id,tfontp->psfontmap->encoding->charname)) { + Warning("unable to use font encoding '%s' for %s", + tfontp->psfontmap->encoding->name,tfontp->name); + return(false); + } + } + tfontp->type = FONT_TYPE_T1; + return(true); +} + + +void UnLoadT1(struct char_entry *ptr) +{ + if (ptr->data!=NULL) + free(ptr->data); + ptr->data=NULL; +} + + +void DoneT1(struct font_entry *tfontp) +{ + int c=0; + + int error = T1_DeleteFont( tfontp->T1id ); + if (error) + Warning("font file %s could not be closed", tfontp->name); + while(c<NFNTCHARS-1) { + if (tfontp->chr[c]!=NULL) { + UnLoadT1((struct char_entry*)tfontp->chr[c]); + free(tfontp->chr[c]); + tfontp->chr[c]=NULL; + } + c++; + } + tfontp->name[0]='\0'; +} + + diff --git a/Build/source/texk/dvipng/test_dvipng.tex b/Build/source/texk/dvipng/test_dvipng.tex new file mode 100644 index 00000000000..86fcf388297 --- /dev/null +++ b/Build/source/texk/dvipng/test_dvipng.tex @@ -0,0 +1,53 @@ +% test_dvipng.tex +% +% Part of the dvipng distribution +% +% 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +% +% Copyright (C) 2002-2005 Jan-\AA{}ke Larsson + +\documentclass{article} +\usepackage{mathptmx} +%\usepackage[active,textmath]{preview} +\usepackage{color} +\pagestyle{empty} + +\begin{document} +\begin{equation} + \int dx +\end{equation} +\newpage +$\int dx$ +\newpage +$\sqrt2+1=\frac1{\sqrt2-1}$ +\newpage +$\frac23$ +\newpage +\ +\newpage +\( \begin{array}{|r|} \hline a \cr \hline \end{array} \) +\newpage +fig, pig, flask, efficiency, effluent +\newpage +\special{fail}a failing special +\newpage +\Huge A \LARGE A \Large A \large A \normalsize A \small A +\footnotesize A \scriptsize A \tiny A +\newpage +\color{yellow} + +\section*{Hello world} +\pagecolor{blue} +\end{document} diff --git a/Build/source/texk/dvipng/tfm.c b/Build/source/texk/dvipng/tfm.c new file mode 100644 index 00000000000..6c408895491 --- /dev/null +++ b/Build/source/texk/dvipng/tfm.c @@ -0,0 +1,80 @@ +/* tfm.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif + +bool ReadTFM(struct font_entry * tfontp, char* tfmname) +{ + struct filemmap fmmap; + struct char_entry *tcharptr; + unsigned char *position; + int lh,bc,ec,nw, c; + dviunits* width; + + DEBUG_PRINT((DEBUG_DVI|DEBUG_FT|DEBUG_TFM), + ("\n OPEN METRICS:\t'%s'", tfmname)); + if (MmapFile(tfmname,&fmmap)) return(false); + position=(unsigned char*)fmmap.mmap; + lh = UNumRead(position+2,2); + bc = UNumRead(position+4,2); + ec = UNumRead(position+6,2); + nw = UNumRead(position+8,2); + DEBUG_PRINT(DEBUG_TFM,(" %d %d %d %d",lh,bc,ec,nw)); + width=alloca(nw*sizeof(dviunits)); + c=0; + position=position+24+(lh+ec-bc+1)*4; + while( c < nw ) { + width[c] = SNumRead(position,4); + c++; + position += 4; + } + + /* Read char widths */ + c=bc; + position=(unsigned char*)fmmap.mmap+24+lh*4; + while(c <= ec) { + DEBUG_PRINT(DEBUG_TFM,("\n@%ld TFM METRICS:\t", + (long)position - (long)fmmap.mmap)); + tcharptr=xmalloc(sizeof(struct char_entry)); + tcharptr->data=NULL; + tcharptr->tfmw=width[*position]; + DEBUG_PRINT(DEBUG_TFM,("%d [%d] %d",c,*position,tcharptr->tfmw)); + tcharptr->tfmw = (dviunits) + ((int64_t) tcharptr->tfmw * tfontp->s / (1 << 20)); + DEBUG_PRINT(DEBUG_TFM,(" (%d)",tcharptr->tfmw)); + if (c > NFNTCHARS) /* Only positive for now */ + Fatal("tfm file %s exceeds char numbering limit",tfmname); + tfontp->chr[c] = tcharptr; + c++; + position += 4; + } + UnMmapFile(&fmmap); + return(true); +} + + diff --git a/Build/source/texk/dvipng/vf.c b/Build/source/texk/dvipng/vf.c new file mode 100644 index 00000000000..c61d05c6746 --- /dev/null +++ b/Build/source/texk/dvipng/vf.c @@ -0,0 +1,144 @@ +/* vf.c */ + +/************************************************************************ + + Part of the dvipng distribution + + 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Copyright (C) 2002-2005 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" + +#define VF_ID 202 +#define LONG_CHAR 242 + +int32_t SetVF(int32_t c) +{ + struct font_entry* currentvf; + unsigned char *command,*end; + struct char_entry* ptr=currentfont->chr[c]; + + currentvf=currentfont; + BeginVFMacro(currentvf); + command = ptr->data; + end = command + ptr->length; + while (command < end) { + DEBUG_PRINT(DEBUG_DVI,("\n VF MACRO:\t%s ", dvi_commands[*command])); + DrawCommand(command,currentvf); + command += CommandLength(command); + } + EndVFMacro(); + currentfont=currentvf; + return(ptr->tfmw); +} + + + +void InitVF(struct font_entry * tfontp) +{ + unsigned char* position; + int length; + struct char_entry *tcharptr; + uint32_t c=0; + struct font_num *tfontnump; /* temporary font_num pointer */ + + DEBUG_PRINT((DEBUG_DVI|DEBUG_VF),("\n OPEN FONT:\t'%s'", tfontp->name)); + Message(BE_VERBOSE,"<%s>", tfontp->name); + if (MmapFile(tfontp->name,&(tfontp->fmmap))) + Fatal("font file %s unusable", tfontp->name); + position=(unsigned char*)tfontp->fmmap.mmap; + if (*(position) != PRE) + Fatal("unknown font format in file %s",tfontp->name); + if (*(position+1) != VF_ID) + Fatal( "wrong version %d of vf file %s (should be 202)", + (int)*(position+1),tfontp->name); + DEBUG_PRINT(DEBUG_VF,("\n VF_PRE:\t'%.*s'", + (int)*(position+2), position+3)); + position = position+3 + *(position+2); + c=UNumRead(position, 4); + DEBUG_PRINT(DEBUG_VF,(" %d", c)); + CheckChecksum (tfontp->c, c, tfontp->name); + tfontp->designsize = UNumRead(position+4,4); + DEBUG_PRINT(DEBUG_VF,(" %d", tfontp->designsize)); + tfontp->type = FONT_TYPE_VF; + tfontp->vffontnump=NULL; + /* Read font definitions */ + position += 8; + while(*position >= FNT_DEF1 && *position <= FNT_DEF4) { + DEBUG_PRINT(DEBUG_VF,("\n @%ld VF:\t%s", + (long)position - (long)tfontp->fmmap.mmap, + dvi_commands[*position])); + FontDef(position,tfontp); + length = dvi_commandlength[*position]; + position += length + *(position + length-1) + *(position+length-2); + } + /* Default font is the first defined */ + tfontnump = tfontp->vffontnump; + while (tfontnump->next != NULL) { + tfontnump = tfontnump->next; + } + tfontp->defaultfont=tfontnump->k; + + /* Read char definitions */ + while(*position < FNT_DEF1) { + DEBUG_PRINT(DEBUG_VF,("\n@%ld VF CHAR:\t", + (long)position - (long)tfontp->fmmap.mmap)); + tcharptr=xmalloc(sizeof(struct char_entry)); + switch (*position) { + case LONG_CHAR: + tcharptr->length = UNumRead(position+1,4); + c = UNumRead(position+5,4); + tcharptr->tfmw = UNumRead(position+9,4); + position += 13; + break; + default: + tcharptr->length = UNumRead(position,1); + c = UNumRead(position+1,1); + tcharptr->tfmw = UNumRead(position+2,3); + position += 5; + } + DEBUG_PRINT(DEBUG_VF,("%d %d %d",tcharptr->length,c,tcharptr->tfmw)); + tcharptr->tfmw = (int32_t) + ((int64_t) tcharptr->tfmw * tfontp->s / (1 << 20)); + DEBUG_PRINT(DEBUG_VF,(" (%d)",tcharptr->tfmw)); + if (c > NFNTCHARS) /* Only positive for now */ + Fatal("VF font %s exceeds char numbering limit",tfontp->name); + tfontp->chr[c] = tcharptr; + tcharptr->data=position; + position += tcharptr->length; + } +} + + +void DoneVF(struct font_entry *tfontp) +{ + int c=FIRSTFNTCHAR; + + UnMmapFile(&(tfontp->fmmap)); + while(c<=LASTFNTCHAR) { + if (tfontp->chr[c]!=NULL) { + free(tfontp->chr[c]); + tfontp->chr[c]=NULL; + } + c++; + } + FreeFontNumP(tfontp->vffontnump); + tfontp->vffontnump=NULL; + tfontp->name[0]='\0'; +} |