| LH.example - 9base - revived minimalist port of Plan 9 userland to Unix | |
| git clone git://git.suckless.org/9base | |
| Log | |
| Files | |
| Refs | |
| README | |
| LICENSE | |
| --- | |
| LH.example (4433B) | |
| --- | |
| 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 adju… | |
| 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 tr… | |
| 19 % moves after printing the character (width field in file ../S1). The st… | |
| 20 % to follow are: | |
| 21 % | |
| 22 % 1: Create a simple troff test file for the new character. Somet… | |
| 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 … | |
| 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 l… | |
| 49 % in the PostScript build_LH procedure (below). What's there n… | |
| 50 % prints an example logo that you can use until you understand… | |
| 51 % remaining steps. | |
| 52 % | |
| 53 % 5: Print your troff test file using (assuming your making chang… | |
| 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… | |
| 59 % Xoffset and Yoffset (below). Both are in units of 72 per inc… | |
| 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 t… | |
| 68 % new LH character by changing the width (i.e. the number in t… | |
| 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 - comm… | |
| 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. T… | |
| 81 % new width should reflect what's currently in your S1 font fi… | |
| 82 % | |
| 83 % 12: Make a similiar set of changes in /usr/lib/font/devLatin1/cha… | |
| 84 % You can use the devpost version of LH to devLatin1/charlib/L… | |
| 85 % but changes to files devLatin1/S1 and devLatin1/shell.lib mu… | |
| 86 % entered by hand. | |
| 87 % | |
| 88 | |
| 89 /Logo_Dict 100 dict dup begin | |
| 90 /Xoffset 0 def % 72 dpi with positive to … | |
| 91 /Yoffset 0 def % 72 dpi with positive up … | |
| 92 /Scaling 1.0 def % adjust this number to change t… | |
| 93 /Unitsize 36 def % for point size scaling - leave… | |
| 94 /showpage {} def | |
| 95 end def | |
| 96 | |
| 97 /build_LH { % don't bind this procedure | |
| 98 Logo_Dict begin | |
| 99 gsave | |
| 100 /charwidth exch def | |
| 101 currentpoint translate | |
| 102 resolution 72 div dup scale | |
| 103 Xoffset Yoffset translate | |
| 104 Scaling Scaling scale | |
| 105 ptsize Unitsize div dup scale | |
| 106 | |
| 107 %% Replace everything between the <<StartLogo>> and <<En… | |
| 108 %% comment lines by the PostScript program that prints y… | |
| 109 %% logo. | |
| 110 | |
| 111 %% <<StartLogo>> | |
| 112 newpath | |
| 113 .5 .5 scale | |
| 114 0 0 moveto | |
| 115 100 0 lineto | |
| 116 100 100 lineto | |
| 117 closepath | |
| 118 .5 setgray | |
| 119 fill | |
| 120 0 setgray | |
| 121 10 10 translate | |
| 122 45 rotate | |
| 123 0 5 moveto | |
| 124 /Helvetica findfont 18 scalefont setfont | |
| 125 (Example Logo) show | |
| 126 %% <<EndLogo>> | |
| 127 | |
| 128 grestore | |
| 129 end | |
| 130 } def | |
| 131 |