home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume27 / psf3 / part05 / language.PSF < prev    next >
Encoding:
Text File  |  1992-01-20  |  7.3 KB  |  209 lines

  1. %%PsfStart
  2.  
  3. $Id: language.PSF,v 3.2 1992/01/19 05:50:33 ajf Exp ajf $
  4.  
  5.     WARNING: This file must be edited to cause valid selection
  6.     =======     of postscript characters for non-English languages.
  7.          The sample "Scandinavian" translation table is
  8.          used for testing purposes only and will not generate
  9.          correct character selections.  Read the comments in
  10.          the "%%translate" section below to manually create
  11.          a valid translation table and language character
  12.          vector for the target language.
  13.  
  14.     This is an example language startup file that illustrates
  15.     encoding of a font vector to use Scandinavian characters. This
  16.     file must be appended to the end of "psfprint.def" with
  17.     
  18.         cat psfprint.old.def language.PSF > psfprint.def
  19.     
  20.     The comments may remain in the final file, or may be removed as
  21.     desired - they are ignored by psf and friends.
  22.  
  23.     To set this code up for a different language, edit the lines
  24.     prefixed with "%%font" and "%%translate". Then modify the
  25.     section of postscript code following "ENCODE".
  26.  
  27.     The first section of the code must start with "%%PsfStart" and
  28.     terminate with %%PsfEnd. The information within this section
  29.     contains new font defintion and character translation tables.
  30.     This section may be empty, however the "%%PsfStart" and
  31.     "%%PsfEnd" lines must exist.
  32.  
  33.     This section is setup information processed by psf and psfbanner.
  34.  
  35.     Any postscript code following the "%%PsfEnd" marker is copied to
  36.     the printer as part of the postscript prologue.
  37.  
  38.     The key words %%PsfStart, %%fontX %%translate %%copy %%PsfEnd
  39.     must start in the first column of this file.
  40.  
  41.     ((( It might be possible to adapt this file to re-encode an
  42.     entire font for a different character set such as EBCDIC. Refer
  43.     to Adobe's Blue Book program #17 for hints on how this might be
  44.     accomplished. Entries for %%fontX would be needed, %%translate
  45.     would not be needed, and the postscript code after %%PsfEnd
  46.     would have to be replaced. )))
  47.     --------------------------------------------------------------
  48.  
  49.     Set up new language font names. Fonts in psf are numbered
  50.     as 0..9, a..z. The "%%fontX" numbers (where 'X' represents the
  51.     font number used by psf) reflect the font to be updated or
  52.     added. If a font is not updated in the list below, the original
  53.     font remains.
  54.  
  55.     The following are the standard fonts known to psf:
  56.  
  57.          # name                  # name
  58.          - -------------------   - -------------------------
  59.          0 Courier         1 Helvetica
  60.          2 Times-Roman         3 AvantGarde-Book
  61.          4 Bookman-Light     5 NewCenturySchlbk-Roman
  62.          6 Palatino-Roman     7 Helvetical-Narrow
  63.          8 Garamond-Light     9 Korinna-Regular
  64.          a Helvetica-Condensed     b ZapfChancery-MediumItalic
  65.  
  66.     This example REPLACES standard Courier (%%font0) to become a
  67.     Scandinavian equivalent for the default Courier font and add a
  68.     NEW font (%%fontc) to be the Scandinavian encoded version of
  69.     Times-Roman. New fonts should be numbered starting from "c". DO
  70.     NOT leave gaps when adding new font numbers, add c, d, e, ... in
  71.     sequence.  
  72.     
  73.     New font definitions will appear with "psf -".
  74.  
  75.     The format of the %%fontX lines must always follow the pattern
  76.     below - the new names created must be for the base, italic,
  77.     bold and bold-italic, in order. The new font names are
  78.     arbitrary, however must match the names later in the ENCODE
  79.     section.
  80.  
  81.     font new base font    new italic font      new bold font    new bold-italic
  82.       #   --------------   -------------------  ---------------- ---------------------
  83. %%font0  Courier-S        Courier-Oblique-S    Courier-Bold-S   Courier-BoldOblique-S
  84. %%fontc  Times-S          Times-I-S            Times-B-S        Times-BI-S
  85.     ------------------------------------------------------------------
  86.  
  87.     The following translates the letters from 'a' .. 't' to a series
  88.     of characters that could be used in a Scandinavian language.
  89.     Printing a file containing:
  90.  
  91.         abcdefghijklmnopqrst
  92.     
  93.     causes each 'English' letter to be replaced by an arbitrary
  94.     special 'Scandanavian' letter.
  95.  
  96.     The translation table format is:
  97.  
  98.                    <ascii text value> / <postscript value>
  99.     e.g.:
  100.            141/300  translates "a" to "/Oacute"
  101.  
  102.                    where 141 = "a",    300 = "/Oacute"
  103.  
  104.     The <ascii text value> is the octal value of a text character
  105.     that actually appears in the text file. The <postscript value>
  106.     is the octal value to which it is to be translated. This new
  107.     value is set up in the "languagevec" array below.
  108.  
  109.     On SysV unix, the <ascii text value>s are (may be?) determined
  110.     from the ttymap(1) table for the target language.
  111.  
  112.     Of course, this table is not "real", it is an example only -
  113.     used for testing! Replace this with real translation
  114.     information.
  115.  
  116. %%translate 141/300 142/311 143/321 144/322 145/323 146/324 147/325 150/330 
  117. %%translate 151/331 152/332 153/333 154/334 155/340 156/342 157/344 160/347
  118. %%translate 161/360 162/362 163/364 164/367
  119.     ----------------------------------------------------------------
  120.  
  121.     An external file may be copied to the printer with "%%copy file"
  122.     This file is inserted into the "prologue" code. It must be
  123.     postscript.
  124.  
  125.          %%copy /etc/some.file
  126.  
  127. %%PsfEnd
  128.  
  129.  
  130. %  Psf and psbanner add the following code to the Prologue
  131. %
  132. %  The following postscript code is from:
  133. %       Adobe Postscript Language Tutorial and Cookbook
  134. %       Blue book program 18, page 211.
  135. %       Making small changes to encoding vectors
  136. %
  137.  
  138. /reencsmalldict 12 dict def
  139. /ReEncodeSmall
  140.    {reencsmalldict begin
  141.       /newcodesandnames exch def
  142.       /newfontname exch def
  143.       /basefontname exch def
  144.       /basefontdict basefontname findfont def
  145.       /newfont basefontdict maxlength dict def
  146.       basefontdict
  147.       { exch dup /FID ne
  148.          {dup /Encoding eq
  149.             {   exch dup length array copy
  150.                 newfont 3 1 roll put }
  151.             {   exch newfont 3 1 roll put }
  152.             ifelse
  153.          }
  154.          {   pop pop   }
  155.          ifelse
  156.       } forall
  157.       
  158.       newfont /FontName newfontname put
  159.       newcodesandnames aload pop
  160.       
  161.       newcodesandnames length 2 idiv
  162.       {   newfont /Encoding get 3 1 roll put }
  163.       repeat
  164.          
  165.       newfontname newfont definefont pop
  166.       end
  167.    } def
  168.  
  169. % Select the additional characters needed for the desired language.
  170. % "languagevec" below is set up as a Scandinavian character set
  171. % assignment. Other languages will need a different selection.
  172.  
  173. /languagevec [
  174.    8#300 /Oacute
  175.    8#311 /Adieresis
  176.    8#321 /oacute
  177.    8#322 /Ograve
  178.    8#323 /Scaron
  179.    8#324 /ograve
  180.    8#325 /scaron
  181.    8#330 /Edieresis
  182.    8#331 /adieresis
  183.    8#332 /edieresis
  184.    8#333 /Odieresis
  185.    8#334 /odieresis
  186.    8#340 /Aacute
  187.    8#342 /Aring
  188.    8#344 /Zcaron
  189.    8#347 /Eacute
  190.    8#360 /aacute
  191.    8#362 /aring
  192.    8#364 /zcaron
  193.    8#367 /eacute
  194.    ] def
  195.  
  196. % ENCODE the new fonts for Scandinavian.  Then new font name must
  197. % have been defined in the "%%fontX" lines above.
  198. %
  199. % base font          new font name          reencode the new font
  200. % -----------------  ---------------------  -------------------------
  201. /Courier             /Courier-S             languagevec ReEncodeSmall
  202. /Courier-Oblique     /Courier-Oblique-S     languagevec ReEncodeSmall
  203. /Courier-Bold        /Courier-Bold-S        languagevec ReEncodeSmall
  204. /Courier-BoldOblique /Courier-BoldOblique-S languagevec ReEncodeSmall
  205. /Times-Roman         /Times-S               languagevec ReEncodeSmall
  206. /Times-Italic        /Times-I-S             languagevec ReEncodeSmall
  207. /Times-Bold          /Times-B-S             languagevec ReEncodeSmall
  208. /Times-BoldItalic    /Times-BI-S            languagevec ReEncodeSmall
  209.