You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.0 KiB

1 month ago
  1. % Copyright (C) 2001-2023 Artifex Software, Inc.
  2. % All Rights Reserved.
  3. %
  4. % This software is provided AS-IS with no warranty, either express or
  5. % implied.
  6. %
  7. % This software is distributed under license and may not be copied,
  8. % modified or distributed except as expressly authorized under the terms
  9. % of the license contained in the file LICENSE in this distribution.
  10. %
  11. % Refer to licensing information at http://www.artifex.com or contact
  12. % Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
  13. % CA 94129, USA, for further information.
  14. %
  15. % Type 42 font support code.
  16. % Here are the BuildChar and BuildGlyph implementation for Type 42 fonts.
  17. % The names %Type42BuildChar and %Type42BuildGlyph are known to the
  18. % interpreter. The real work is done in an operator:
  19. % <font> <code|name> <name> <glyphindex> .type42execchar -
  20. /.type42build % <font> <code|name> <name> .type42build -
  21. { 2 index begin
  22. dup CharStrings exch .knownget not
  23. { 2 copy eq { exch pop /.notdef exch } if
  24. QUIET not
  25. { (Substituting .notdef for ) print
  26. =string cvs print ( in the font ) print
  27. 1 index /FontName get = flush
  28. }
  29. { pop }
  30. ifelse
  31. /.notdef CharStrings /.notdef get
  32. } if
  33. end .type42execchar
  34. } bind def
  35. (%Type42BuildChar) cvn % <font> <code> %Type42BuildChar -
  36. { 1 index /Encoding get 1 index get //.type42build exec
  37. } bind executeonly def
  38. (%Type42BuildGlyph) cvn % <font> <name> %Type42BuildGlyph -
  39. { dup //.type42build exec
  40. } .internalbind def
  41. currentdict /.type42build .undef
  42. % Register the font type for definefont.
  43. buildfontdict 42
  44. { % check for bogus sfnts -- this happens in Genoa FTS 421-01.ps
  45. dup /sfnts get 0 get length 14 lt { % smallest valid sfnts is 14 bytes
  46. % HACK: Add a BuildGlyph and make this a Type 3 font instead
  47. dup /FontType 3 put
  48. dup /BuildGlyph {
  49. 1 index /CharStrings get exch 2 copy known not { pop /.notdef } if get exec
  50. } bind put
  51. //.buildfont3 exec
  52. } {
  53. systemdict /.buildfont42 get exec
  54. } ifelse
  55. } .internalbind
  56. put