home *** CD-ROM | disk | FTP | other *** search
/ swCHIP 1991 January / swCHIP_95-1.bin / utility / gs333ini / gs3.33 / markhint.ps < prev    next >
Text File  |  1995-12-09  |  3KB  |  114 lines

  1. %    Copyright (C) 1994 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % markhint.ps
  16. % Draw the hints for a Type 1 font.
  17.  
  18. (type1ops.ps) run
  19.  
  20. /mhsetup        % <matrix> <print> mhsetup -
  21.  { /mhprint exch def
  22.    /mhmx exch def
  23.    /mhdash 0 9 gsave initmatrix dtransform grestore idtransform add abs def
  24.    gsave
  25.    clippath pathbbox
  26.    2 index sub /bbh exch def
  27.    2 index sub /bbw exch def
  28.    /bby exch def
  29.    /bbx exch def
  30.    grestore
  31.  } def
  32.  
  33. /markfonthints        % <matrix> <print> markfonthints -
  34.  { mhsetup
  35.  } def
  36.  
  37. /hmark            % <y> hmark -
  38.  { bbx exch moveto bbw 0 rlineto stroke
  39.  } def
  40. /vmark            % <x> vmark -
  41.  { bby moveto 0 bbh rlineto stroke
  42.  } def
  43. /pmark            % <x> <y> pmark -
  44.  { newpath 0 4.5 gsave initmatrix dtransform grestore idtransform add abs
  45.    0 360 arc stroke
  46.  } def
  47. /mchdict mark
  48.   /hsbw { pop 0 mhmx transform translate 0 0 pmark }
  49.   /sbw { pop pop mhmx transform translate 0 0 pmark }
  50.   /hstem
  51.    { mhprint { (hstem ) print 2 copy 2 packedarray == } if
  52.      1 index add exch gsave
  53.      [mhdash] 0 setdash 0 exch mhmx transform exch pop hmark
  54.      [mhdash 2 div dup 2 mul] 0 setdash 0 exch mhmx transform exch pop hmark
  55.      grestore
  56.    }
  57.   /vstem
  58.    { mhprint { (vstem ) print 2 copy 2 packedarray == } if
  59.      1 index add exch gsave
  60.      [mhdash] 0 setdash 0 mhmx transform pop vmark
  61.      [mhdash 2 div dup 2 mul] 0 setdash 0 mhmx transform pop vmark
  62.      grestore
  63.    }
  64.   /callothersubr
  65.    { 3 eq
  66.       { pop
  67. pstack flush
  68.         % We're replacing hints; lighten the color.
  69.     currentrgbcolor 3 { 2 mul 3 div 3 1 roll } repeat setrgbcolor
  70.       }
  71.       { { pop } repeat
  72.       } ifelse
  73.    }
  74.   /callsubr
  75.    { Private /Subrs get exch get mchinterp
  76.    }
  77.   /pop
  78.    {
  79.    }
  80.   /return
  81.    {
  82.    }
  83. .dicttomark def
  84.  
  85. /mchinterp        % <charstring> mchinterp -
  86.  { 4330 exch dup length string .type1decrypt exch pop
  87.    dup length lenIV sub lenIV exch getinterval
  88.    0 () /SubFileDecode filter
  89.    mark exch charstack_read ]
  90.     { dup type /nametype eq
  91.        { mchdict exch .knownget { exec } { cleartomark mark } ifelse
  92.        }
  93.       if
  94.     }
  95.    forall
  96.  } def
  97.  
  98. /markcharhints        % <charname> <matrix> <print> markcharhints -
  99.  { mhsetup
  100.    gsave mark
  101.    /Private currentfont /Private get def
  102.    Private rcheck    % make sure we won't get an access error
  103.     { /lenIV Private /lenIV .knownget not { 4 } if def
  104.       currentfont /CharStrings get 3 -1 roll get mchinterp
  105.     }
  106.     { (Sorry, this font is protected; I can't show the hints.\n) print flush
  107.     }
  108.    ifelse
  109.    cleartomark grestore
  110.  } def
  111.