gs_ccfnt.ps 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. % Copyright (C) 1994, 2000 Aladdin Enterprises. All rights reserved.
  2. %
  3. % This file is part of AFPL Ghostscript.
  4. %
  5. % AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author or
  6. % distributor accepts any responsibility for the consequences of using it, or
  7. % for whether it serves any particular purpose or works at all, unless he or
  8. % she says so in writing. Refer to the Aladdin Free Public License (the
  9. % "License") for full details.
  10. %
  11. % Every copy of AFPL Ghostscript must include a copy of the License, normally
  12. % in a plain ASCII text file named PUBLIC. The License grants you the right
  13. % to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14. % conditions described in the License. Among other things, the License
  15. % requires that the copyright notice and this notice be preserved on all
  16. % copies.
  17. % $Id: gs_ccfnt.ps,v 1.5 2001/10/01 05:25:55 lpd Exp $
  18. % Find and register all the precompiled font operators in systemdict.
  19. /registerfont % <fontname> <fontdict> registerfont <font>
  20. { DEBUG { (Registering ) print 1 index = } if
  21. dup begin
  22. Encoding type /nametype eq
  23. { Encoding .findencoding /Encoding exch def
  24. }
  25. if
  26. dup /PrefEnc known
  27. { PrefEnc type /nametype eq
  28. { PrefEnc .findencoding /PrefEnc exch def
  29. }
  30. if
  31. }
  32. if
  33. dup /FDepVector known
  34. { /FDepVector [ FDepVector
  35. { .FontDirectory 1 index .knownget
  36. { exch pop }
  37. { ccfonts 1 index .knownget
  38. { registerfont
  39. }
  40. { Fontmap 1 index known
  41. { findfont }
  42. { pop NullFont }
  43. ifelse
  44. }
  45. ifelse
  46. }
  47. ifelse
  48. }
  49. forall ] readonly def
  50. }
  51. if
  52. end
  53. % Use the value of definefont appropriate at run-time, not bind-time
  54. /definefont load exec
  55. } bind odef
  56. % Bind recursive call (bind descends into oparrays: feature!)
  57. /registerfont dup load bind def
  58. /.loadinitialfonts {
  59. //.loadinitialfonts exec
  60. NOCCFONTS not {
  61. /ccfonts mark
  62. 0 1 null .getccfont 1 sub { .getccfont dup /FontName get exch } for
  63. .dicttomark def
  64. % Make sure these fonts are registered as "resources".
  65. currentfile {
  66. pop ccfonts {
  67. .FontDirectory 2 index known { pop pop } { registerfont pop } ifelse
  68. } forall
  69. } .execasresource
  70. currentdict /ccfonts .undef
  71. } if
  72. } bind def
  73. currentdict /registerfont .undef