home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2002 February / INTERNET88.ISO / pc / software / windows / bits / pdf995 / data1.cab / Program_Executable_Files / res / markhint.ps < prev    next >
Encoding:
Text File  |  2001-12-08  |  3.8 KB  |  134 lines

  1. %    Copyright (C) 1994, 1995, 1996 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of GNU Ghostscript.
  3. % GNU Ghostscript is distributed in the hope that it will be useful, but
  4. % WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  5. % to anyone for the consequences of using it or for whether it serves any
  6. % particular purpose or works at all, unless he says so in writing.  Refer
  7. % to the GNU General Public License for full details.
  8. % Everyone is granted permission to copy, modify and redistribute GNU
  9. % Ghostscript, but only under the conditions described in the GNU General
  10. % Public License.  A copy of this license is supposed to have been given
  11. % to you along with GNU Ghostscript so you can know your rights and
  12. % responsibilities.  It should be in a file named COPYING.  Among other
  13. % things, the copyright notice and this notice must be preserved on all
  14. % copies.
  15.  
  16. % $RCSfile: markhint.ps,v $ $Revision: 1.2.2.1 $
  17. % markhint.ps
  18. % Draw the hints for a Type 1 font.
  19.  
  20. (type1ops.ps) runlibfile
  21.  
  22. /mhsetup        % <matrix> <print> mhsetup -
  23.  { /mhprint exch def
  24.    /mhmx exch def
  25.    /mhdash 0 9 gsave initmatrix dtransform grestore idtransform add abs def
  26.    gsave
  27.    clippath pathbbox
  28.    2 index sub /bbh exch def
  29.    2 index sub /bbw exch def
  30.    /bby exch def
  31.    /bbx exch def
  32.    grestore
  33.  } def
  34.  
  35. /markfonthints        % <matrix> <print> markfonthints -
  36.  { mhsetup
  37.  } def
  38.  
  39. /hmark            % <y> hmark -
  40.  { bbx exch moveto bbw 0 rlineto stroke
  41.  } def
  42. /hsmark            % <y0> <dy> hsmark -
  43.  { 1 index add exch gsave
  44.    [mhdash] 0 setdash 0 exch mhmx transform exch pop hmark
  45.    [mhdash 2 div dup 2 mul] 0 setdash 0 exch mhmx transform exch pop hmark
  46.    grestore
  47.  } def
  48. /vmark            % <x> vmark -
  49.  { bby moveto 0 bbh rlineto stroke
  50.  } def
  51. /vsmark            % <x0> <dx> vsmark -
  52.  { 1 index add exch gsave
  53.    [mhdash] mhdash setdash 0 mhmx transform pop vmark
  54.    [mhdash 2 div dup 2 mul] 0 setdash 0 mhmx transform pop vmark
  55.    grestore
  56.  } def
  57. /pmark            % <x> <y> pmark -
  58.  { newpath 0 4.5 gsave initmatrix dtransform grestore idtransform add abs
  59.    0 360 arc stroke
  60.  } def
  61. /mchdict mark
  62.   /hsbw { pop 0 mhmx transform translate 0 0 pmark }
  63.   /sbw { pop pop mhmx transform translate 0 0 pmark }
  64.   /hstem
  65.    { mhprint { (hstem ) print 2 copy 2 packedarray == } if
  66.      hsmark
  67.    }
  68.   /vstem
  69.    { mhprint { (vstem ) print 2 copy 2 packedarray == } if
  70.      vsmark
  71.    }
  72.   /hstem3
  73.    { mhprint { (hstem3 ) print 6 copy 6 packedarray == } if
  74.      3 { hsmark } repeat
  75.    }
  76.   /vstem3
  77.    { mhprint { (vstem3 ) print 6 copy 6 packedarray == } if
  78.      3 { vsmark } repeat
  79.    }
  80.   /div
  81.    { div
  82.    }
  83.   /callothersubr
  84.    { 3 eq
  85.       { pop
  86.     mhprint { (replace) = } if
  87.         % We're replacing hints; lighten the color.
  88.     currentrgbcolor 3 { 2 mul 3 div 3 1 roll } repeat setrgbcolor
  89.       }
  90.       { { pop } repeat
  91.       } ifelse
  92.    }
  93.   /callsubr
  94.    { Private /Subrs get exch get mchinterp
  95.    }
  96.   /pop
  97.    {
  98.    }
  99.   /return
  100.    {
  101.    }
  102. .dicttomark def
  103.  
  104. /mchinterp        % <charstring> mchinterp -
  105.  { 4330 exch dup length string .type1decrypt exch pop
  106.    dup length lenIV sub lenIV exch getinterval
  107.    0 () /SubFileDecode filter
  108.    mark exch charstack_read ]
  109.     { dup type /nametype eq
  110.        { mchdict exch .knownget { exec } { cleartomark mark } ifelse
  111.        }
  112.       if
  113.     }
  114.    forall
  115.  } def
  116.  
  117. /markcharhints        % <charname> <matrix> <print> markcharhints -
  118.  { mhsetup
  119.    gsave mark
  120.    /Private currentfont /Private get def
  121.    Private rcheck    % make sure we won't get an access error
  122.     { /lenIV Private /lenIV .knownget not { 4 } if def
  123.       currentfont /CharStrings get 3 -1 roll get mchinterp
  124.     }
  125.     { (Sorry, this font is protected; I can't show the hints.\n) print flush
  126.       exch
  127.     }
  128.    ifelse
  129.    cleartomark grestore
  130.  } def
  131.