home *** CD-ROM | disk | FTP | other *** search
/ jppd.dyndns.org / jppd.dyndns.org.tar / jppd.dyndns.org / QUERYPRO / Impressora_PDF / converter.exe / GPLGS / pcharstr.ps < prev    next >
Text File  |  2002-02-22  |  4KB  |  127 lines

  1. %    Copyright (C) 1990, 1992, 1997, 1999 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: pcharstr.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
  14. % pcharstr.ps
  15. % Print the CharStrings and Subrs (if present) from a Type 1 font,
  16. % in either a PostScript-like or a C-compatible form,
  17. % depending on whether CSFormat is defined as /PS or /C.
  18.  
  19. % Load the Type 1 utilities.
  20. (type1ops.ps) runlibfile
  21.  
  22. % Define the printing procedures for PostScript-like output.
  23. /pcs_ps_dict mark
  24.   /, {( ) print}
  25.   /charname {==only}
  26.   /csbegin {}
  27.   /beginchars {(%---------------- CharStrings\n) print}
  28.   /charbegin {==only}
  29.   /char1 {( ) print ==only}
  30.   /endchars {}
  31.   /beginsubrs {(%---------------- Subrs\n) print}
  32.   /subrbegin {=only}
  33.   /endsubrs {}
  34.   /beginboxes {(%---------------- Encoding & metrics\n) print}
  35.   /notdefbox {}
  36.   /boxbegin {=only ( ) print}
  37.   /boxend {(\n) print}
  38.   /endboxes {(%----------------\n) print}
  39. .dicttomark readonly def
  40.  
  41. % Define the printing procedures for C-like output.
  42. /pcs_c_dict mark
  43.   /, {(, ) print}
  44.   /charname {(") print =only (") print}
  45.   /csbegin {counttomark =only ,}
  46.   /beginchars {(\nconstdata int CSCharData[] = {\n) print}
  47.   /charbegin {pop}
  48.   /char1 {=only ,}
  49.   /endchars {
  50.     (-1\n};\nconstdata char *CSCharNames[] = {\n) print
  51.     CharStrings {pop charname ,} forall (0\n};\n) print
  52.   }
  53.   /beginsubrs {(\nconstdata int CSSubrs[] = {\n) print}
  54.   /subrbegin {pop}
  55.   /endsubrs {(-1\n};\n) print}
  56.   /beginboxes {(\nconstdata type1_box CSboxes[] = {\n) print}
  57.   /notdefbox {(  {""},\n) print}
  58.   /boxbegin {pop (  {) print}
  59.   /boxend {(},) =}
  60.   /endboxes {(  {0}\n};\n) print}
  61. .dicttomark readonly def
  62.  
  63. /printcs
  64.  { dup type /stringtype eq
  65.     { printcs1 (\n) print }
  66.     { ( ) print == }
  67.    ifelse
  68.  } bind def
  69. /printcs1
  70.  { save exch
  71.    lenIV 0 ge {
  72.      4330 exch dup length string .type1decrypt exch pop
  73.      dup length lenIV sub lenIV exch getinterval
  74.    } if
  75.    0 () /SubFileDecode filter
  76.    mark exch charstack_read csbegin
  77.    counttomark 1 sub -1 0 { index char1 } for
  78.    cleartomark restore
  79.  } bind def
  80.  
  81. /printfont
  82.  { pcs_ps_dict
  83.    /CSFormat where { pop CSFormat /C eq { pop pcs_c_dict } if } if
  84.    begin
  85.    currentfont begin Private begin 10 dict begin
  86.  
  87.     % Print the CharStrings and Subrs
  88.  
  89.    beginchars
  90.    CharStrings { exch charbegin printcs } forall
  91.    endchars
  92.    /Subrs where
  93.     { pop    % the dictionary
  94.       beginsubrs
  95.       0 1 Subrs length 1 sub
  96.        { dup subrbegin
  97.          Subrs exch get printcs
  98.        } for
  99.       endsubrs
  100.     } if
  101.  
  102.     % Print the bounding boxes
  103.  
  104.    gsave nulldevice FontMatrix matrix invertmatrix concat
  105.    beginboxes
  106.    0 1 Encoding length 1 sub
  107.     { dup Encoding exch get dup /.notdef eq
  108.        { pop pop notdefbox
  109.        }
  110.        { 1 index boxbegin charname ,
  111.          ( ) dup 0 4 -1 roll put
  112.          newpath 0 0 moveto false charpath
  113.      pathbbox ({) print 4 -1 roll =only ,
  114.      3 -1 roll =only , exch =only , =only (}) print
  115.          boxend
  116.        }
  117.       ifelse
  118.     } for
  119.    endboxes
  120.    grestore
  121.  
  122.    end end end end
  123.  } bind def
  124.