星火微课系统客户端
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

gs_dps1.ps 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. % Copyright (C) 1997, 1999 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: gs_dps1.ps 8954 2008-08-08 04:22:38Z ray $
  16. % Initialization file for most of the Display PostScript functions
  17. % that are also included in Level 2.
  18. level2dict begin
  19. % ------ Virtual memory ------ %
  20. /currentshared /.currentglobal load def
  21. /scheck /.gcheck load def
  22. %****** FOLLOWING IS WRONG ******
  23. /shareddict currentdict /globaldict .knownget not { 20 dict } if def
  24. % Global and LocalFontDirectory must remain in systemdict
  25. % even if we temporarily exit Level 2 mode.
  26. end % level2dict
  27. systemdict begin
  28. /SharedFontDirectory .FontDirectory .gcheck
  29. { .currentglobal false .setglobal
  30. /LocalFontDirectory .FontDirectory dup maxlength dict copy
  31. .forcedef % LocalFontDirectory is local, systemdict is global
  32. .setglobal .FontDirectory
  33. }
  34. { /LocalFontDirectory .FontDirectory
  35. .forcedef % LocalFontDirectory is local, systemdict is global
  36. 50 dict
  37. }
  38. ifelse def
  39. end % systemdict
  40. level2dict begin
  41. % setshared must rebind FontDirectory to the appropriate one of
  42. % Local or SharedFontDirectory.
  43. /.setglobal % <bool> .setglobal -
  44. { dup .setglobal
  45. //systemdict /FontDirectory .currentglobal
  46. { //SharedFontDirectory }
  47. { /LocalFontDirectory .systemvar } % can't embed ref to local VM
  48. ifelse .forceput pop % LocalFontDirectory is local, systemdict is global
  49. } .bind odef % must bind .forceput and .setglobal
  50. % even if NOBIND in effect
  51. % Don't just copy (load) the definition of .setglobal:
  52. % it gets redefined for LL3.
  53. /setshared { /.setglobal .systemvar exec } odef
  54. .currentglobal setshared
  55. % See below for changes in save and restore.
  56. % ------ Fonts ------ %
  57. /selectfont % <fontname> <size> selectfont -
  58. {
  59. { 1 .argindex findfont
  60. 1 index dup type /arraytype eq { makefont } { scalefont } ifelse
  61. setfont pop pop
  62. } stopped { /selectfont .systemvar $error /errorname get signalerror } if
  63. } odef
  64. % undefinefont has to take local/global VM into account.
  65. /undefinefont % <fontname> undefinefont -
  66. { .FontDirectory 1 .argindex .forceundef % FontDirectory is readonly
  67. .currentglobal
  68. { % Current mode is global; delete from local directory too.
  69. //systemdict /LocalFontDirectory .knownget
  70. { 1 index .forceundef } % LocalFontDirectory is readonly
  71. if
  72. }
  73. { % Current mode is local; if there was a shadowed global
  74. % definition, copy it into the local directory.
  75. //systemdict /SharedFontDirectory .knownget
  76. { 1 index .knownget
  77. { .FontDirectory 2 index 3 -1 roll { put } //superexec } % readonly
  78. if
  79. }
  80. if
  81. }
  82. ifelse pop
  83. } odef
  84. % If we load a font into global VM within an inner save, the restore
  85. % will delete it from FontDirectory but not from SharedFontDirectory.
  86. % We have to handle this by making restore copy missing entries from
  87. % SharedFontDirectory to FontDirectory. Since this could slow down restore
  88. % considerably, we define a new operator .forcecopynew for this purpose.
  89. % Furthermore, if FAKEFONTS is in effect, we want global real fonts to
  90. % override fake local ones. We handle this by brute force.
  91. /restore % <save> restore -
  92. { dup //restore % bind even if NOBIND
  93. /LocalFontDirectory .systemvar
  94. FAKEFONTS
  95. { mark
  96. % We want to delete a fake font from the local directory
  97. % iff the global directory now has no definition for it,
  98. % or a non-fake definition.
  99. 1 index dup
  100. { % Stack: lfd mark lfd key ... lfd key value
  101. length 1 gt
  102. { % This is a real local definition; don't do anything.
  103. pop
  104. }
  105. { % This is a fake local definition, check for global.
  106. //SharedFontDirectory 1 index .knownget
  107. { % A global definition exists, check for fake.
  108. length 1 eq { pop } { 1 index } ifelse
  109. }
  110. { % No global definition, delete the local one.
  111. 1 index
  112. }
  113. ifelse
  114. }
  115. ifelse
  116. } forall
  117. pop counttomark 2 idiv { .forceundef } repeat pop % readonly
  118. }
  119. if
  120. //SharedFontDirectory exch .forcecopynew pop
  121. .currentglobal .setglobal % Rebind FontDirectory according to current VM.
  122. pop
  123. } .bind odef
  124. end % level2dict