home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / APPS / gs403osk.tgz / gs403osk.tar / markhint.ps < prev    next >
Text File  |  1996-09-22  |  4KB  |  132 lines

  1. %    Copyright (C) 1994, 1995, 1996 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) runlibfile
  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. /hsmark         % <y0> <dy> hsmark -
  41.  { 1 index add exch gsave
  42.    [mhdash] 0 setdash 0 exch mhmx transform exch pop hmark
  43.    [mhdash 2 div dup 2 mul] 0 setdash 0 exch mhmx transform exch pop hmark
  44.    grestore
  45.  } def
  46. /vmark          % <x> vmark -
  47.  { bby moveto 0 bbh rlineto stroke
  48.  } def
  49. /vsmark         % <x0> <dx> vsmark -
  50.  { 1 index add exch gsave
  51.    [mhdash] mhdash setdash 0 mhmx transform pop vmark
  52.    [mhdash 2 div dup 2 mul] 0 setdash 0 mhmx transform pop vmark
  53.    grestore
  54.  } def
  55. /pmark          % <x> <y> pmark -
  56.  { newpath 0 4.5 gsave initmatrix dtransform grestore idtransform add abs
  57.    0 360 arc stroke
  58.  } def
  59. /mchdict mark
  60.   /hsbw { pop 0 mhmx transform translate 0 0 pmark }
  61.   /sbw { pop pop mhmx transform translate 0 0 pmark }
  62.   /hstem
  63.    { mhprint { (hstem ) print 2 copy 2 packedarray == } if
  64.      hsmark
  65.    }
  66.   /vstem
  67.    { mhprint { (vstem ) print 2 copy 2 packedarray == } if
  68.      vsmark
  69.    }
  70.   /hstem3
  71.    { mhprint { (hstem3 ) print 6 copy 6 packedarray == } if
  72.      3 { hsmark } repeat
  73.    }
  74.   /vstem3
  75.    { mhprint { (vstem3 ) print 6 copy 6 packedarray == } if
  76.      3 { vsmark } repeat
  77.    }
  78.   /div
  79.    { div
  80.    }
  81.   /callothersubr
  82.    { 3 eq
  83.       { pop
  84.     mhprint { (replace) = } if
  85.         % We're replacing hints; lighten the color.
  86.     currentrgbcolor 3 { 2 mul 3 div 3 1 roll } repeat setrgbcolor
  87.       }
  88.       { { pop } repeat
  89.       } ifelse
  90.    }
  91.   /callsubr
  92.    { Private /Subrs get exch get mchinterp
  93.    }
  94.   /pop
  95.    {
  96.    }
  97.   /return
  98.    {
  99.    }
  100. .dicttomark def
  101.  
  102. /mchinterp      % <charstring> mchinterp -
  103.  { 4330 exch dup length string .type1decrypt exch pop
  104.    dup length lenIV sub lenIV exch getinterval
  105.    0 () /SubFileDecode filter
  106.    mark exch charstack_read ]
  107.     { dup type /nametype eq
  108.        { mchdict exch .knownget { exec } { cleartomark mark } ifelse
  109.        }
  110.       if
  111.     }
  112.    forall
  113.  } def
  114.  
  115. /markcharhints      % <charname> <matrix> <print> markcharhints -
  116.  { mhsetup
  117.    gsave mark
  118.    /Private currentfont /Private get def
  119.    Private rcheck   % make sure we won't get an access error
  120.     { /lenIV Private /lenIV .knownget not { 4 } if def
  121.       currentfont /CharStrings get 3 -1 roll get mchinterp
  122.     }
  123.     { (Sorry, this font is protected; I can't show the hints.\n) print flush
  124.       exch
  125.     }
  126.    ifelse
  127.    cleartomark grestore
  128.  } def
  129.