home *** CD-ROM | disk | FTP | other *** search
/ jppd.dyndns.org / jppd.dyndns.org.tar / jppd.dyndns.org / QUERYPRO / Impressora_PDF / converter.exe / GPLGS / gs_pfile.ps < prev    next >
Text File  |  2003-12-13  |  4KB  |  128 lines

  1. %    Copyright (C) 1994, 1995 Aladdin Enterprises.  All rights reserved.
  2. % This software is provided AS-IS with no warranty, either express or
  3. % implied.
  4. % This software is distributed under license and may not be copied,
  5. % modified or distributed except as expressly authorized under the terms
  6. % of the license contained in the file LICENSE in this distribution.
  7. % For more information about licensing, please refer to
  8. % http://www.ghostscript.com/licensing/. For information on
  9. % commercial licensing, go to http://www.artifex.com/licensing/ or
  10. % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  11. % San Rafael, CA  94903, U.S.A., +1(415)492-9861.
  12.  
  13. % $Id: gs_pfile.ps,v 1.4.2.1 2003/12/12 22:07:58 giles Exp $
  14. % Runtime support for minimum-space fonts and packed files.
  15.  
  16. % ****** NOTE: This file must be kept consistent with
  17. % ****** packfile.ps and wrfont.ps.
  18.  
  19. % ---------------- Packed file support ---------------- %
  20.  
  21. % A packed file is the concatenation of several file groups, each of which
  22. % is the result of compressing several files concatenated together.
  23. % The packed file begins with a procedure that creates an appropriate
  24. % decoding filter for each file group, as follows:
  25. %    <group-subfile-filter> -proc- <group-decode-filter>
  26. % Thus, accessing an individual file requires 4 parameters:
  27. % the starting address and length of the outer compressed file,
  28. % and the starting address and length of the inner file.
  29. /.packedfilefilter    % <file> <ostart> <olength> <istart> <ilength>
  30.             %   .packedfilefilter <filter>
  31.  { 4 index systemdict begin token pop end 6 1 roll
  32.     % Stack: fproc file ostart olength istart ilength
  33.    4 index 5 -1 roll setfileposition
  34.     % Stack: fproc file olength istart ilength
  35.    4 -2 roll () /SubFileDecode filter
  36.     % Stack: fproc istart ilength ofilter
  37.    4 -1 roll exec
  38.     % Filters don't support setfileposition, so we must skip data
  39.     % by reading it into a buffer.  We rely on the fact that
  40.     % save/restore don't affect file positions.
  41.     % Stack: istart ilength dfilter
  42.    save exch 64000 string
  43.     % Stack: istart ilength save dfilter scratch
  44.    4 index 1 index length idiv { 2 copy readstring pop pop } repeat
  45.    2 copy 0 8 -1 roll 2 index length mod getinterval readstring pop pop pop
  46.     % Stack: ilength save dfilter
  47.    exch restore exch () /SubFileDecode filter
  48.  } bind def
  49.  
  50. % Run a packed library file.
  51. /.runpackedlibfile    % <filename> <ostart> <olength> <istart> <ilength>
  52.             %   .runpackedlibfile
  53.  { 5 -1 roll findlibfile
  54.     { exch pop dup 6 2 roll .packedfilefilter
  55.       currentobjectformat exch 1 setobjectformat run
  56.       setobjectformat closefile
  57.     }
  58.     { 5 1 roll /findlibfile load /undefinedfilename signalerror
  59.     }
  60.    ifelse
  61.  } bind def
  62.  
  63. % ---------------- Compacted font support ---------------- %
  64.  
  65. % Compacted fonts written by wrfont.ps depend on the existence and
  66. % specifications of the procedures and data in this section.
  67.  
  68. /.compactfontdefault mark
  69.     /PaintType 0
  70.     /FontMatrix [0.001 0 0 0.001 0 0] readonly
  71.     /FontType 1
  72.     /Encoding StandardEncoding
  73. .dicttomark readonly def
  74.  
  75. /.checkexistingfont    % <fontname> <uid> <privatesize> <fontsize>
  76.             %   .checkexistingfont
  77.             %   {} (<font> on d-stack)
  78.             % <fontname> <uid> <privatesize> <fontsize>
  79.             %   .checkexistingfont
  80.             %   -save- --restore-- (<font> on d-stack)
  81.  { FontDirectory 4 index .knownget
  82.     { dup /UniqueID .knownget
  83.        { 4 index eq exch /FontType get 1 eq and }
  84.        { pop false }
  85.       ifelse
  86.     }
  87.     { false
  88.     }
  89.    ifelse
  90.     { save /restore load 6 2 roll }
  91.     { {} 5 1 roll }
  92.    ifelse
  93.    dict //.compactfontdefault exch .copydict begin
  94.    dict /Private exch def
  95.    Private begin
  96.      /MinFeature {16 16} def
  97.      /Password 5839 def
  98.      /UniqueID 1 index def
  99.    end
  100.    /UniqueID exch def
  101.    /FontName exch def
  102.  } bind def
  103.  
  104. /.knownEncodings [
  105.    ISOLatin1Encoding
  106.    StandardEncoding
  107.    SymbolEncoding
  108. ] readonly def
  109.  
  110. /.readCharStrings    % <count> <encrypt> .readCharStrings <dict>
  111.  { exch dup dict dup 3 -1 roll
  112.     { currentfile token pop dup type /integertype eq
  113.        { dup -8 bitshift //.knownEncodings exch get exch 255 and get } if
  114.       currentfile token pop dup type /nametype eq
  115.        { 2 index exch get
  116.        }
  117.        {    % Stack: encrypt dict dict key value
  118.      4 index { 4330 exch dup .type1encrypt exch pop } if
  119.      readonly
  120.        }
  121.       ifelse put dup
  122.     }
  123.    repeat pop exch pop
  124.  } bind def
  125.