LH.example 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. %
  2. % An example logo character. Building the PostScript program that prints
  3. % your company logo is not addressed here; we assume you already have
  4. % such a program, that it's relatively simple, and that it prints the
  5. % logo by itself on a page. What you'll find here are instructions for
  6. % converting that logo program into a character that can be accessed by
  7. % troff and dpost.
  8. %
  9. % Building a new charlib character involves some PostScript programming.
  10. % We've tried to isolate parameters that you'll need to change (Xoffset,
  11. % Yoffset, and Scaling), but we can't guarantee things will work properly
  12. % with every logo program. PostScript is a complex language and subtle
  13. % interactions between your logo program and what we've done here can
  14. % cause problems.
  15. %
  16. % Tuning the new character is an iterative process. You may want to adjust
  17. % the size of the logo (via Scaling), it's position relative to adjacent
  18. % characters and the baseline (Xoffset and Yoffset), and the distance troff
  19. % moves after printing the character (width field in file ../S1). The steps
  20. % to follow are:
  21. %
  22. % 1: Create a simple troff test file for the new character. Something
  23. % like,
  24. %
  25. % .sp 1i
  26. % .ps 10
  27. % size 10: \(LH
  28. % .sp 1i
  29. % .ps 18
  30. % size 18: \(LH
  31. % .sp 1i
  32. % .ps 36
  33. % size 36: \(LH
  34. % .sp 1i
  35. % .ps 10
  36. % four logo characters: \(LH\(LH\(LH\(LH
  37. %
  38. % is sufficient. The test file can go anywhere.
  39. %
  40. % 2: Change into directory /usr/lib/font/devpost/charlib. All file
  41. % pathnames will be relative to that directory.
  42. %
  43. % 3: Save a copy of the working LH logo file. Then replace LH with
  44. % this file (i.e. LH.example). Changes described below should be
  45. % be made in the new LH file (not in LH.example).
  46. %
  47. % 4: Your PostScript logo program will eventually replace whatever
  48. % you find between the <<StartLogo>> and <<EndLogo>> comment lines
  49. % in the PostScript build_LH procedure (below). What's there now
  50. % prints an example logo that you can use until you understand the
  51. % remaining steps.
  52. %
  53. % 5: Print your troff test file using (assuming your making changes
  54. % in the devpost charlib directory),
  55. %
  56. % troff -Tpost testfile | dpost | lp ...
  57. %
  58. % 6: Adjust the logo positioning by changing the numbers assigned to
  59. % Xoffset and Yoffset (below). Both are in units of 72 per inch.
  60. % Positive offsets should move the logo to the right and up the
  61. % page.
  62. %
  63. % 7: Adjust the logo size by changing the the number assigned to
  64. % Scaling. Unitsize also controls scaling, but there's no good
  65. % reason to change both Scaling and Unitsize.
  66. %
  67. % 8: Control the horizontal distance troff moves after printing the
  68. % new LH character by changing the width (i.e. the number in the
  69. % second column) assigned to LH in file ../S1. Character width
  70. % adjustments should probably wait until you're satisfied with
  71. % the Scaling set in step 7.
  72. %
  73. % 9: Back to step 5 until your satisfied with the output.
  74. %
  75. % The remaining steps are suggested but not required:
  76. %
  77. % 10: Delete PostScript comments in your new LH charlib file - comments
  78. % start with % and go to the end of the line.
  79. %
  80. % 11: Update the width field assigned to LH in file ../shell.lib. The
  81. % new width should reflect what's currently in your S1 font file.
  82. %
  83. % 12: Make a similiar set of changes in /usr/lib/font/devLatin1/charlib.
  84. % You can use the devpost version of LH to devLatin1/charlib/LH,
  85. % but changes to files devLatin1/S1 and devLatin1/shell.lib must be
  86. % entered by hand.
  87. %
  88. /Logo_Dict 100 dict dup begin
  89. /Xoffset 0 def % 72 dpi with positive to the right
  90. /Yoffset 0 def % 72 dpi with positive up the page
  91. /Scaling 1.0 def % adjust this number to change the size
  92. /Unitsize 36 def % for point size scaling - leave it be
  93. /showpage {} def
  94. end def
  95. /build_LH { % don't bind this procedure
  96. Logo_Dict begin
  97. gsave
  98. /charwidth exch def
  99. currentpoint translate
  100. resolution 72 div dup scale
  101. Xoffset Yoffset translate
  102. Scaling Scaling scale
  103. ptsize Unitsize div dup scale
  104. %% Replace everything between the <<StartLogo>> and <<EndLogo>>
  105. %% comment lines by the PostScript program that prints your
  106. %% logo.
  107. %% <<StartLogo>>
  108. newpath
  109. .5 .5 scale
  110. 0 0 moveto
  111. 100 0 lineto
  112. 100 100 lineto
  113. closepath
  114. .5 setgray
  115. fill
  116. 0 setgray
  117. 10 10 translate
  118. 45 rotate
  119. 0 5 moveto
  120. /Helvetica findfont 18 scalefont setfont
  121. (Example Logo) show
  122. %% <<EndLogo>>
  123. grestore
  124. end
  125. } def