1
0

markhint.ps 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. % Copyright (C) 1994, 1995, 1996 Aladdin Enterprises. All rights reserved.
  2. %
  3. % This software is provided AS-IS with no warranty, either express or
  4. % implied.
  5. %
  6. % This software is distributed under license and may not be copied,
  7. % modified or distributed except as expressly authorized under the terms
  8. % of the license contained in the file LICENSE in this distribution.
  9. %
  10. % For more information about licensing, please refer to
  11. % http://www.ghostscript.com/licensing/. For information on
  12. % commercial licensing, go to http://www.artifex.com/licensing/ or
  13. % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  14. % San Rafael, CA 94903, U.S.A., +1(415)492-9861.
  15. % $Id: markhint.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
  16. % markhint.ps
  17. % Draw the hints for a Type 1 font.
  18. (type1ops.ps) runlibfile
  19. /mhsetup % <matrix> <print> mhsetup -
  20. { /mhprint exch def
  21. /mhmx exch def
  22. /mhdash 0 9 gsave initmatrix dtransform grestore idtransform add abs def
  23. gsave
  24. clippath pathbbox
  25. 2 index sub /bbh exch def
  26. 2 index sub /bbw exch def
  27. /bby exch def
  28. /bbx exch def
  29. grestore
  30. } def
  31. /markfonthints % <matrix> <print> markfonthints -
  32. { mhsetup
  33. } def
  34. /hmark % <y> hmark -
  35. { bbx exch moveto bbw 0 rlineto stroke
  36. } def
  37. /hsmark % <y0> <dy> hsmark -
  38. { 1 index add exch gsave
  39. [mhdash] 0 setdash 0 exch mhmx transform exch pop hmark
  40. [mhdash 2 div dup 2 mul] 0 setdash 0 exch mhmx transform exch pop hmark
  41. grestore
  42. } def
  43. /vmark % <x> vmark -
  44. { bby moveto 0 bbh rlineto stroke
  45. } def
  46. /vsmark % <x0> <dx> vsmark -
  47. { 1 index add exch gsave
  48. [mhdash] mhdash setdash 0 mhmx transform pop vmark
  49. [mhdash 2 div dup 2 mul] 0 setdash 0 mhmx transform pop vmark
  50. grestore
  51. } def
  52. /pmark % <x> <y> pmark -
  53. { newpath 0 4.5 gsave initmatrix dtransform grestore idtransform add abs
  54. 0 360 arc stroke
  55. } def
  56. /mchdict mark
  57. /hsbw { pop 0 mhmx transform translate 0 0 pmark }
  58. /sbw { pop pop mhmx transform translate 0 0 pmark }
  59. /hstem
  60. { mhprint { (hstem ) print 2 copy 2 packedarray == } if
  61. hsmark
  62. }
  63. /vstem
  64. { mhprint { (vstem ) print 2 copy 2 packedarray == } if
  65. vsmark
  66. }
  67. /hstem3
  68. { mhprint { (hstem3 ) print 6 copy 6 packedarray == } if
  69. 3 { hsmark } repeat
  70. }
  71. /vstem3
  72. { mhprint { (vstem3 ) print 6 copy 6 packedarray == } if
  73. 3 { vsmark } repeat
  74. }
  75. /div
  76. { div
  77. }
  78. /callothersubr
  79. { 3 eq
  80. { pop
  81. mhprint { (replace) = } if
  82. % We're replacing hints; lighten the color.
  83. currentrgbcolor 3 { 2 mul 3 div 3 1 roll } repeat setrgbcolor
  84. }
  85. { { pop } repeat
  86. } ifelse
  87. }
  88. /callsubr
  89. { Private /Subrs get exch get mchinterp
  90. }
  91. /pop
  92. {
  93. }
  94. /return
  95. {
  96. }
  97. .dicttomark def
  98. /mchinterp % <charstring> mchinterp -
  99. { 4330 exch dup length string .type1decrypt exch pop
  100. dup length lenIV sub lenIV exch getinterval
  101. 0 () /SubFileDecode filter
  102. mark exch charstack_read ]
  103. { dup type /nametype eq
  104. { mchdict exch .knownget { exec } { cleartomark mark } ifelse
  105. }
  106. if
  107. }
  108. forall
  109. } def
  110. /markcharhints % <charname> <matrix> <print> markcharhints -
  111. { mhsetup
  112. gsave mark
  113. /Private currentfont /Private get def
  114. Private rcheck % make sure we won't get an access error
  115. { /lenIV Private /lenIV .knownget not { 4 } if def
  116. currentfont /CharStrings get 3 -1 roll get mchinterp
  117. }
  118. { (Sorry, this font is protected; I can't show the hints.\n) print flush
  119. exch
  120. }
  121. ifelse
  122. cleartomark grestore
  123. } def