home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / os2 / remind / src / rem2ps.h < prev    next >
Encoding:
Text File  |  1993-10-12  |  7.6 KB  |  211 lines

  1. /***************************************************************/
  2. /*                                                             */
  3. /*  REM2PS.H                                                   */
  4. /*                                                             */
  5. /*  Define the PostScript prologue                             */
  6. /*                                                             */
  7. /*  This file is part of REMIND.                               */
  8. /*  Copyright (C) 1992, 1993 by David F. Skoll.                */
  9. /*                                                             */
  10. /***************************************************************/
  11.  
  12. char *PSProlog1[] =
  13. {
  14.    "% This file was produced by Remind and Rem2PS, written by",
  15.    "% David F. Skoll.",
  16.    "/ISOLatin1Encoding where { pop save true }{ false } ifelse",
  17.    "  /ISOLatin1Encoding [ StandardEncoding 0 45 getinterval aload pop /minus",
  18.    "    StandardEncoding 46 98 getinterval aload pop /dotlessi /grave /acute",
  19.    "    /circumflex /tilde /macron /breve /dotaccent /dieresis /.notdef /ring",
  20.    "    /cedilla /.notdef /hungarumlaut /ogonek /caron /space /exclamdown /cent",
  21.    "    /sterling /currency /yen /brokenbar /section /dieresis /copyright",
  22.    "    /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron",
  23.    "    /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph",
  24.    "    /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright",
  25.    "    /onequarter /onehalf /threequarters /questiondown /Agrave /Aacute",
  26.    "    /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute",
  27.    "    /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth",
  28.    "    /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply",
  29.    "    /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn",
  30.    "    /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring /ae",
  31.    "    /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute",
  32.    "    /icircumflex /idieresis /eth /ntilde /ograve /oacute /ocircumflex",
  33.    "    /otilde /odieresis /divide /oslash /ugrave /uacute /ucircumflex",
  34.    "    /udieresis /yacute /thorn /ydieresis ] def",
  35.    "{ restore } if",
  36.    "",
  37.    "/reencodeISO { %def",
  38.    "    findfont dup length dict begin",
  39.    "    { 1 index /FID ne { def }{ pop pop } ifelse } forall",
  40.    "    /Encoding ISOLatin1Encoding def",
  41.    "    currentdict end definefont pop",
  42.    "} bind def",
  43.    "/copyFont { %def",
  44.    "    findfont dup length dict begin",
  45.    "    { 1 index /FID ne { def } { pop pop } ifelse } forall",
  46.    "    currentdict end definefont pop",
  47.    "} bind def",
  48.    "",
  49.    "% L - Draw a line",
  50.    "/L {",
  51.    "   newpath moveto lineto stroke",
  52.    "} bind def",
  53.    "% string1 string2 strcat string",
  54.    "% Function: Concatenates two strings together.",
  55.    "/strcat {",
  56.    "         2 copy length exch length add",
  57.    "         string dup",
  58.    "         4 2 roll",
  59.    "         2 index 0 3 index",
  60.    "         putinterval",
  61.    "         exch length exch putinterval",
  62.    "} bind def",
  63.    "% string doheading",
  64.    "/doheading",
  65.    "{",
  66.    "   /monthyr exch def",
  67.    "",
  68.    "   /TitleFont findfont",
  69.    "   TitleSize scalefont setfont",
  70.    "   monthyr stringwidth",
  71.    "   /hgt exch def",
  72.    "   2 div MaxX MinX add 2 div exch sub /x exch def",
  73.    "   MaxY Border sub TitleSize sub /y exch def",
  74.    "   newpath x y moveto monthyr show",
  75.    "   newpath x y moveto monthyr false charpath flattenpath pathbbox",
  76.    "   pop pop Border sub /y exch def pop",
  77.    "   MinX y MaxX y L",
  78.    "   /topy y def",
  79.    "   /HeadFont findfont HeadSize scalefont setfont",
  80.    "% Do the days of the week",
  81.    "   MaxX MinX sub 7 div /xincr exch def",
  82.    "   /x MinX def",
  83.    NULL
  84. };
  85. char *PSProlog2[] =
  86. {
  87.    "  {",
  88.    "     HeadSize x y HeadSize 2 mul sub x xincr add y CenterText",
  89.    "     x xincr add /x exch def",
  90.    "  } forall",
  91.    "  y HeadSize 2 mul sub /y exch def",
  92.    "  MinX y MaxX y L",
  93.    "  /ytop y def /ymin y def",
  94.    "}",
  95.    "def",
  96.    "/CenterText",
  97.    "{",
  98.    "   /maxy exch def",
  99.    "   /maxx exch def",
  100.    "   /miny exch def",
  101.    "   /minx exch def",
  102.    "   /sz exch def",
  103.    "   /str exch def",
  104.    "   str stringwidth pop",
  105.    "   2 div maxx minx add 2 div exch sub",
  106.    "   sz 2 div maxy miny add 2 div exch sub",
  107.    "   moveto str show",
  108.    "} def",
  109.    "% Variables:",
  110.    "% curline - a string holding the current line",
  111.    "% y - current y pos",
  112.    "% yincr - increment to next line",
  113.    "% xleft - left margin",
  114.    "% width - max width.",
  115.    "% EnterOneWord - given a word, enter it into the box.",
  116.    "% string EnterOneWord",
  117.    "/EnterOneWord {",
  118.    "   { EnterOneWordAux",
  119.    "     {exit} if }",
  120.    "   loop",
  121.    "} bind def",
  122.    "% EnterOneWordAux - if the word fits, enter it into box and return true.",
  123.    "% If it doesn't fit, put as much as will fit and return the string and false.",
  124.    "/EnterOneWordAux {",
  125.    "   /word exch def",
  126.    "   /tmpline curline word strcat def",
  127.    "   tmpline stringwidth pop width gt",
  128.    "   {MoveToNewLine}",
  129.    "   {/curline tmpline ( ) strcat def /word () def}",
  130.    "   ifelse",
  131.    "   word () eq",
  132.    "   {true}",
  133.    "   {word false}",
  134.    "   ifelse",
  135.    "} bind def",
  136.    "% MoveToNewLine - move to a new line, resetting word as appropriate",
  137.    "/MoveToNewLine {",
  138.    "   curline () ne",
  139.    "   {newpath xleft y moveto curline show /curline () def /y y yincr add def}   ",
  140.    "   {ChopWord}",
  141.    "   ifelse",
  142.    "} bind def",
  143.    "% ChopWord - word won't fit.  Chop it and find biggest piece that will fit",
  144.    "/ChopWord {",
  145.    "   /curline () def",
  146.    "   /len word length def",
  147.    "   /Fcount len 1 sub def",
  148.    "",
  149.    "   {",
  150.    "     word 0 Fcount getinterval stringwidth pop width le",
  151.    "     {exit} if",
  152.    "     /Fcount Fcount 1 sub def",
  153.    "   } loop",
  154.    "% Got the count.  Display it and reset word",
  155.    "   newpath xleft y moveto word 0 Fcount getinterval show",
  156.    "   /y y yincr add def",
  157.    "   /word word Fcount len Fcount sub getinterval def",
  158.    "} bind def",
  159.    "/FinishFormatting {",
  160.    "   word () ne",
  161.    "   {newpath xleft y moveto word show /word () def",
  162.    "    /curline () def /y y yincr add def}",
  163.    "   {curline () ne",
  164.    "     {newpath xleft y moveto curline show /word () def",
  165.    "      /curline () def /y y yincr add def} if}",
  166.    "   ifelse",
  167.    "} bind def",
  168.    "% FillBoxWithText - fill a box with text",
  169.    "% text-array xleft width yincr y FillBoxWithText new-y",
  170.    "% Returns the new Y-coordinate.",
  171.    "/FillBoxWithText {",
  172.    "   /y exch def",
  173.    "   /yincr exch def",
  174.    "   /width exch def",
  175.    "   /xleft exch def",
  176.    "   /curline () def",
  177.    "   {EnterOneWord} forall",
  178.    "   FinishFormatting",
  179.    "   y",
  180.    "} bind def",
  181.    "% Variables for calendar boxes:",
  182.    "% ytop - current top position",
  183.    "% ymin - minimum y reached for current row",
  184.    "% border ytop xleft width textarray daynum DoCalBox ybot",
  185.    "% Do the entries for one calendar box.  Returns lowest Y-coordinate reached",
  186.    "/DoCalBox {",
  187.    "   /daynum exch def",
  188.    "   /textarr exch def",
  189.    "   /wid exch def",
  190.    "   /xl exch def",
  191.    "   /yt exch def",
  192.    "   /border exch def",
  193.    "% Do the day number",
  194.    "   /DayFont findfont DaySize scalefont setfont",
  195.    "   xl wid add border sub daynum stringwidth pop sub",
  196.    "   yt border sub DaySize sub moveto daynum show",
  197.    "% Do the text entries.  Precharge the stack with current y pos.",
  198.    "   /ycur yt border sub DaySize sub DaySize sub 2 add def",
  199.    "   /EntryFont findfont EntrySize scalefont setfont",
  200.    "   ycur",
  201.    "   textarr",
  202.    "   { exch 2 sub /ycur exch def xl border add wid border sub border sub EntrySize 2 add neg",
  203.    "     ycur FillBoxWithText }",
  204.    "    forall",
  205.    "} bind def",
  206.    "2 setlinecap",
  207.    "% Define a default PreCal procedure",
  208.    "/PreCal { pop pop } bind def",
  209.    NULL
  210. };
  211.