home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 10 / AU_CD10.iso / Updates / GhostScript / !GhostScr / 6_01 / lib / markhint.ps < prev    next >
Text File  |  2000-03-09  |  4KB  |  133 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. % $Id: markhint.ps,v 1.1 2000/03/09 08:40:40 lpd Exp $
  16. % markhint.ps
  17. % Draw the hints for a Type 1 font.
  18.  
  19. (type1ops.ps) runlibfile
  20.  
  21. /mhsetup        % <matrix> <print> mhsetup -
  22.  { /mhprint exch def
  23.    /mhmx exch def
  24.    /mhdash 0 9 gsave initmatrix dtransform grestore idtransform add abs def
  25.    gsave
  26.    clippath pathbbox
  27.    2 index sub /bbh exch def
  28.    2 index sub /bbw exch def
  29.    /bby exch def
  30.    /bbx exch def
  31.    grestore
  32.  } def
  33.  
  34. /markfonthints        % <matrix> <print> markfonthints -
  35.  { mhsetup
  36.  } def
  37.  
  38. /hmark            % <y> hmark -
  39.  { bbx exch moveto bbw 0 rlineto stroke
  40.  } def
  41. /hsmark            % <y0> <dy> hsmark -
  42.  { 1 index add exch gsave
  43.    [mhdash] 0 setdash 0 exch mhmx transform exch pop hmark
  44.    [mhdash 2 div dup 2 mul] 0 setdash 0 exch mhmx transform exch pop hmark
  45.    grestore
  46.  } def
  47. /vmark            % <x> vmark -
  48.  { bby moveto 0 bbh rlineto stroke
  49.  } def
  50. /vsmark            % <x0> <dx> vsmark -
  51.  { 1 index add exch gsave
  52.    [mhdash] mhdash setdash 0 mhmx transform pop vmark
  53.    [mhdash 2 div dup 2 mul] 0 setdash 0 mhmx transform pop vmark
  54.    grestore
  55.  } def
  56. /pmark            % <x> <y> pmark -
  57.  { newpath 0 4.5 gsave initmatrix dtransform grestore idtransform add abs
  58.    0 360 arc stroke
  59.  } def
  60. /mchdict mark
  61.   /hsbw { pop 0 mhmx transform translate 0 0 pmark }
  62.   /sbw { pop pop mhmx transform translate 0 0 pmark }
  63.   /hstem
  64.    { mhprint { (hstem ) print 2 copy 2 packedarray == } if
  65.      hsmark
  66.    }
  67.   /vstem
  68.    { mhprint { (vstem ) print 2 copy 2 packedarray == } if
  69.      vsmark
  70.    }
  71.   /hstem3
  72.    { mhprint { (hstem3 ) print 6 copy 6 packedarray == } if
  73.      3 { hsmark } repeat
  74.    }
  75.   /vstem3
  76.    { mhprint { (vstem3 ) print 6 copy 6 packedarray == } if
  77.      3 { vsmark } repeat
  78.    }
  79.   /div
  80.    { div
  81.    }
  82.   /callothersubr
  83.    { 3 eq
  84.       { pop
  85.     mhprint { (replace) = } if
  86.         % We're replacing hints; lighten the color.
  87.     currentrgbcolor 3 { 2 mul 3 div 3 1 roll } repeat setrgbcolor
  88.       }
  89.       { { pop } repeat
  90.       } ifelse
  91.    }
  92.   /callsubr
  93.    { Private /Subrs get exch get mchinterp
  94.    }
  95.   /pop
  96.    {
  97.    }
  98.   /return
  99.    {
  100.    }
  101. .dicttomark def
  102.  
  103. /mchinterp        % <charstring> mchinterp -
  104.  { 4330 exch dup length string .type1decrypt exch pop
  105.    dup length lenIV sub lenIV exch getinterval
  106.    0 () /SubFileDecode filter
  107.    mark exch charstack_read ]
  108.     { dup type /nametype eq
  109.        { mchdict exch .knownget { exec } { cleartomark mark } ifelse
  110.        }
  111.       if
  112.     }
  113.    forall
  114.  } def
  115.  
  116. /markcharhints        % <charname> <matrix> <print> markcharhints -
  117.  { mhsetup
  118.    gsave mark
  119.    /Private currentfont /Private get def
  120.    Private rcheck    % make sure we won't get an access error
  121.     { /lenIV Private /lenIV .knownget not { 4 } if def
  122.       currentfont /CharStrings get 3 -1 roll get mchinterp
  123.     }
  124.     { (Sorry, this font is protected; I can't show the hints.\n) print flush
  125.       exch
  126.     }
  127.    ifelse
  128.    cleartomark grestore
  129.  } def
  130.