$OpenBSD: patch-ps_c,v 1.2 2005/05/15 18:09:41 db Exp $ --- ps.c.orig Thu Feb 19 00:35:03 2004 +++ ps.c Thu May 12 12:46:35 2005 @@ -116,352 +116,350 @@ static char* cp850 [] = { -#define PS_END "\ -%% --------- \n\n\ - didShowPage not { \n\ - showpage \n\ - } if\n\n\ -%%%%EOF\n" +#define PS_END \ +"%% --------- \n\n"\ +" didShowPage not { \n"\ +" showpage \n"\ +" } if\n\n"\ +"%%%%EOF\n" -#define PS_START "\ -%%%%!PS\n\ -%%--------------------------------------------------------------------------\n\ -%% GNU UnRTF, a command-line program to convert RTF documents to other formats.\n\ -%% Copyright (C) 2000,2001 Zachary Thayer Smith\n\ -%%\n\ -%% This program is free software; you can redistribute it and/or modify\n\ -%% it under the terms of the GNU General Public License as published by\n\ -%% the Free Software Foundation; either version 2 of the License, or\n\ -%% (at your option) any later version.\n\ -%%\n\ -%% This program is distributed in the hope that it will be useful,\n\ -%% but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ -%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ -%% GNU General Public License for more details.\n\ -%%\n\ -%% You should have received a copy of the GNU General Public License\n\ -%% along with this program; if not, write to the Free Software\n\ -%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\ -%%\n\ -%% The author is reachable by electronic mail at tuorfa@yahoo.com.\n\ -%%--------------------------------------------------------------------------\n\ -%%%%EndComments \n\ -%%\n\ -%% --------- Note, this PS code is unfinished -------- \n\ -%% --------- Note, this PS code is unfinished -------- \n\ -%% --------- Note, this PS code is unfinished -------- \n\ -%% --------- Note, this PS code is unfinished -------- \n\ -%% --------- Note, this PS code is unfinished -------- \n\ -%%\n\ -%% ----------- Variables ------------\n\ -/fontFamily /Times def\n\ -/fontAscent 0 def %% ascent for current font\n\ -/fontDescent 0 def %% descent for current font\n\ -/lineAscent 0 def \n\ -/lineDescent 0 def \n\ -/pageWidthInches 8.5 def \n\ -/pageHeightInches 11 def \n\ -/leftMargin 20 def \n\ -/rightMargin 20 def \n\ -/topMargin 20 def \n\ -/bottomMargin 20 def \n\ -/DPI 72 def \n\ -/pageWidth pageWidthInches DPI mul def \n\ -/rightLimit pageWidth rightMargin sub def \n\ -/pageHeight pageHeightInches DPI mul def \n\ -/x 0 def \n\ -/y 0 def \n\ -/bold false def \n\ -/italic false def \n\ -/underline false def \n\ -/overline false def \n\ -/intercharSpace 0 def \n\ -/strike false def \n\ -/outline false def \n\ -/shadow false def \n\ -/fontSize 12 def \n\ -/didBR false def \n\ -/didParSkip false def \n\ -/didShowPage false def \n\ -%%------------------------------------------------------\n\ -%% Set up the ISO fonts \n\ -\n\ -%% Times \n\ -%% ----- \n\ -/Times-Roman findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/TRomanISO exch definefont pop \n\n\ -/Times-Bold findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/TBoldISO exch definefont pop \n\n\ -/Times-BoldItalic findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/TBoldItalicISO exch definefont pop \n\n\ -/Times-Italic findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/TItalicISO exch definefont pop \n\n\ -%% Courier \n\ -%% ----- \n\ -/Courier-Roman findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/CRomanISO exch definefont pop \n\n\ -/Courier-Bold findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/CBoldISO exch definefont pop \n\n\ -/Courier-BoldItalic findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/CBoldItalicISO exch definefont pop \n\n\ -/Courier-Italic findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/CItalicISO exch definefont pop \n\n\ -%% Symbol \n\ -%% ----- \n\ -/Symbol-Roman findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/SRomanISO exch definefont pop \n\n\ -/Symbol-Bold findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/SBoldISO exch definefont pop \n\n\ -/Symbol-BoldItalic findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/SBoldItalicISO exch definefont pop \n\n\ -/Symbol-Italic findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/SItalicISO exch definefont pop \n\n\ -%% Helvetica \n\ -%% --------- \n\ -/Helvetica-Roman findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/HRomanISO exch definefont pop \n\n\ -/Helvetica-Bold findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/HBoldISO exch definefont pop \n\n\ -/Helvetica-BoldOblique findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/HBoldItalicISO exch definefont pop \n\n\ -/Helvetica-Oblique findfont dup length dict begin { \n\ - 1 index /FID ne { def } { pop pop } ifelse \n\ -} forall \n\ -/Encoding ISOLatin1Encoding def \n\ -currentdict end \n\ -/HItalicISO exch definefont pop \n\n\ -%% \n\ -%% Ideally, before we can draw a line of text, we need to collect all the\n\ -%% words that will be on it, just as I do in my Beest HTML viewer, as well\n\ -%% as character attributes for each word. But for now, this implementation \n\ -%% does not bother. It determines the maximize ascent and descent after\n\ -%% drawing the text, not before. XX\n\ -%% \n\ -%% ----------- Functions ------------\n\ -/updateFont { \n\ - /f0 null def \n\ - (Times) fontFamily eq (Times New Roman) fontFamily eq or { \n\ - bold { \n\ - italic { /TBoldItalicISO } { /TBoldISO } ifelse \n\ - } { \n\ - italic { /TItalicISO } { /TRomanISO } ifelse \n\ - } \n\ - ifelse \n\ - } if \n\ - (Helvetica) fontFamily eq (Arial) fontFamily eq or { \n\ - bold { \n\ - italic { /HBoldItalicISO } { /HBoldISO } ifelse \n\ - } { \n\ - italic { /HItalicISO } { /HRomanISO } ifelse \n\ - } \n\ - ifelse \n\ - } if \n\ - (Courier) fontFamily eq (Courier New) fontFamily eq or { \n\ - bold { \n\ - italic { /CBoldItalicISO } { /CBoldISO } ifelse \n\ - } { \n\ - italic { /CItalicISO } { /CRomanISO } ifelse \n\ - } \n\ - ifelse \n\ - } if \n\ - (Symbol) fontFamily eq { \n\ - bold { \n\ - italic { /SBoldItalicISO } { /SBoldISO } ifelse \n\ - } { \n\ - italic { /SItalicISO } { /SRomanISO } ifelse \n\ - } \n\ - ifelse \n\ - } if \n\n\ - findfont /f0 exch def \n\ - /bboxBottom f0 /FontBBox get 1 get 1000 div fontSize mul -1 mul def \n\ - /bboxTop f0 /FontBBox get 3 get 1000 div fontSize mul def \n\ - f0 fontSize scalefont setfont \n\ - lineAscent bboxTop lt { /lineAscent bboxTop def } if \n\ - lineDescent bboxBottom lt { /lineDescent bboxBottom def } if \n\ - /fontAscent bboxTop def \n\ - /fontDescent bboxBottom def \n\ -} def\n\ -/FS { \n\ - /fontSize exch def updateFont \n\ -} def \n\ -/F { \n\ - /fontFamily exch def updateFont \n\ -} def \n\ -/resetX { \n\ - /x leftMargin def\n\ -} def \n\ -/resetY { \n\ - /y pageHeight topMargin sub def \n\ -} def \n\ -/BR { \n\ - /oldx x def \n\ - /y y lineAscent lineDescent add sub def \n\ - resetX \n\ - y bottomMargin lt { \n\ - showpage \n\ - /didShowPage true \n\ - resetY \n\ - } if \n\ - oldx 0 eq didBR and { /didParSkip true def } if \n\ - /didBR true def \n\ - % /lineAscent 0 def \n\ - % /lineDescent 0 def \n\ -} def \n\ -/P { \n\ - didParSkip not { BR } if \n\ - didParSkip not { BR } if \n\ -} \n\ -def \n\ -/acharpath { \n\ - /acstr exch def pop /acsp exch def \n\ - newpath \n\ - str { \n\ - /ch exch def \n\ - 1 string 0 ch put false charpath \n\ - acsp 0 rmoveto \n\ - } forall \n\ -} def \n\ -/A { \n\ - /str exch def \n\ - /w str stringwidth pop \n\ - str length intercharSpace mul add \n\ - def \n\ - x w add rightLimit ge { BR } if \n\ - x y moveto \n\ - outline { \n\ - shadow { \n\ - 1 -0.1 0 { \n\ - /offset exch def \n\ - offset setgray \n\ - x offset 3 mul add y offset 3 mul sub moveto \n\ - intercharSpace 0 str acharpath \n\ - %% str false charpath \n\ - fontSize 30 div setlinewidth stroke \n\ - } for \n\ - 0 setgray \n\ - } { \n\ - intercharSpace 0 str acharpath \n\ - %% str false charpath \n\ - fontSize 30 div setlinewidth stroke \n\ - } ifelse \n\ - } { \n\ - shadow { \n\ - 1 -0.1 0 { \n\ - /offset exch def \n\ - offset setgray \n\ - x offset 3 mul add y offset 3 mul sub moveto \n\ - intercharSpace 0 str ashow \n\ - %% str show \n\ - } for \n\ - 0 setgray \n\ - } { \n\ - intercharSpace 0 str ashow \n\ - %% str show \n\ - } ifelse \n\ - } ifelse \n\ - strike { \n\ - newpath fontSize 20 div setlinewidth \n\ - x y fontAscent 0.32 mul add dup /y2 exch def moveto \n\ - x w add y2 lineto stroke \n\ - } if \n\ - underline { \n\ - newpath fontSize 20 div setlinewidth \n\ - x y fontAscent 0.2 mul sub dup /y2 exch def moveto \n\ - x w add y2 lineto stroke \n\ - } if \n\ - overline { \n\ - %% I don't think RTF supports this, but it can be used later. \n\ - newpath fontSize 20 div setlinewidth \n\ - x y fontAscent 1.2 mul add dup /y2 exch def moveto \n\ - x w add y2 lineto stroke \n\ - } if \n\ - /x x w add def \n\ - /didBR false def \n\ - /didShowPage false def \n\ -} def \n\ -\n\ -%% These are only binary for now \n\ -/X1 { /intercharSpace exch def } def\n\ -/X0 { /intercharSpace 0 def } def\n\ -/O1 { /outline false def } def\n\ -/O0 { /outline false def } def\n\ -/H1 { /shadow true def } def\n\ -/H0 { /shadow false def } def\n\ -/S1 { /strike true def } def\n\ -/S0 { /strike false def } def\n\ -/B1 { /bold true def updateFont } def\n\ -/B0 { /bold false def updateFont } def\n\ -/I1 { /italic true def updateFont } def\n\ -/I0 { /italic false def updateFont } def\n\ -/U1 { /underline true def } def\n\ -/U0 { /underline false def } def\n\ -updateFont \n\ -resetX resetY \n\ -\n\ -" +#define PS_START \ +"%%%%!PS\n"\ +"%%--------------------------------------------------------------------------\n"\ +"%% GNU UnRTF, a command-line program to convert RTF documents to other formats.\n"\ +"%% Copyright (C) 2000,2001 Zachary Thayer Smith\n"\ +"%%\n"\ +"%% This program is free software; you can redistribute it and/or modify\n"\ +"%% it under the terms of the GNU General Public License as published by\n"\ +"%% the Free Software Foundation; either version 2 of the License, or\n"\ +"%% (at your option) any later version.\n"\ +"%%\n"\ +"%% This program is distributed in the hope that it will be useful,\n"\ +"%% but WITHOUT ANY WARRANTY; without even the implied warranty of\n"\ +"%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"\ +"%% GNU General Public License for more details.\n"\ +"%%\n"\ +"%% You should have received a copy of the GNU General Public License\n"\ +"%% along with this program; if not, write to the Free Software\n"\ +"%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"\ +"%%\n"\ +"%% The author is reachable by electronic mail at tuorfa@yahoo.com.\n"\ +"%%--------------------------------------------------------------------------\n"\ +"%%%%EndComments \n"\ +"%%\n"\ +"%% --------- Note, this PS code is unfinished -------- \n"\ +"%% --------- Note, this PS code is unfinished -------- \n"\ +"%% --------- Note, this PS code is unfinished -------- \n"\ +"%% --------- Note, this PS code is unfinished -------- \n"\ +"%%\n"\ +"%% ----------- Variables ------------\n"\ +"/fontFamily /Times def\n"\ +"/fontAscent 0 def %% ascent for current font\n"\ +"/fontDescent 0 def %% descent for current font\n"\ +"/lineAscent 0 def \n"\ +"/lineDescent 0 def \n"\ +"/pageWidthInches 8.5 def \n"\ +"/pageHeightInches 11 def \n"\ +"/leftMargin 20 def \n"\ +"/rightMargin 20 def \n"\ +"/topMargin 20 def \n"\ +"/bottomMargin 20 def \n"\ +"/DPI 72 def \n"\ +"/pageWidth pageWidthInches DPI mul def \n"\ +"/rightLimit pageWidth rightMargin sub def \n"\ +"/pageHeight pageHeightInches DPI mul def \n"\ +"/x 0 def \n"\ +"/y 0 def \n"\ +"/bold false def \n"\ +"/italic false def \n"\ +"/underline false def \n"\ +"/overline false def \n"\ +"/intercharSpace 0 def \n"\ +"/strike false def \n"\ +"/outline false def \n"\ +"/shadow false def \n"\ +"/fontSize 12 def \n"\ +"/didBR false def \n"\ +"/didParSkip false def \n"\ +"/didShowPage false def \n"\ +"%%------------------------------------------------------\n"\ +"%% Set up the ISO fonts \n"\ +"\n"\ +"%% Times \n"\ +"%% ----- \n"\ +"/Times-Roman findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/TRomanISO exch definefont pop \n\n"\ +"/Times-Bold findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/TBoldISO exch definefont pop \n\n"\ +"/Times-BoldItalic findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/TBoldItalicISO exch definefont pop \n\n"\ +"/Times-Italic findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/TItalicISO exch definefont pop \n\n"\ +"%% Courier \n"\ +"%% ----- \n"\ +"/Courier-Roman findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/CRomanISO exch definefont pop \n\n"\ +"/Courier-Bold findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/CBoldISO exch definefont pop \n\n"\ +"/Courier-BoldItalic findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/CBoldItalicISO exch definefont pop \n\n"\ +"/Courier-Italic findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/CItalicISO exch definefont pop \n\n"\ +"%% Symbol \n"\ +"%% ----- \n"\ +"/Symbol-Roman findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/SRomanISO exch definefont pop \n\n"\ +"/Symbol-Bold findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/SBoldISO exch definefont pop \n\n"\ +"/Symbol-BoldItalic findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/SBoldItalicISO exch definefont pop \n\n"\ +"/Symbol-Italic findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/SItalicISO exch definefont pop \n\n"\ +"%% Helvetica \n"\ +"%% --------- \n"\ +"/Helvetica-Roman findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/HRomanISO exch definefont pop \n\n"\ +"/Helvetica-Bold findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/HBoldISO exch definefont pop \n\n"\ +"/Helvetica-BoldOblique findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/HBoldItalicISO exch definefont pop \n\n"\ +"/Helvetica-Oblique findfont dup length dict begin { \n"\ +" 1 index /FID ne { def } { pop pop } ifelse \n"\ +"} forall \n"\ +"/Encoding ISOLatin1Encoding def \n"\ +"currentdict end \n"\ +"/HItalicISO exch definefont pop \n\n"\ +"%% \n"\ +"%% Ideally, before we can draw a line of text, we need to collect all the\n"\ +"%% words that will be on it, just as I do in my Beest HTML viewer, as well\n"\ +"%% as character attributes for each word. But for now, this implementation \n"\ +"%% does not bother. It determines the maximize ascent and descent after\n"\ +"%% drawing the text, not before. XX\n"\ +"%% \n"\ +"%% ----------- Functions ------------\n"\ +"/updateFont { \n"\ +" /f0 null def \n"\ +" (Times) fontFamily eq (Times New Roman) fontFamily eq or { \n"\ +" bold { \n"\ +" italic { /TBoldItalicISO } { /TBoldISO } ifelse \n"\ +" } { \n"\ +" italic { /TItalicISO } { /TRomanISO } ifelse \n"\ +" } \n"\ +" ifelse \n"\ +" } if \n"\ +" (Helvetica) fontFamily eq (Arial) fontFamily eq or { \n"\ +" bold { \n"\ +" italic { /HBoldItalicISO } { /HBoldISO } ifelse \n"\ +" } { \n"\ +" italic { /HItalicISO } { /HRomanISO } ifelse \n"\ +" } \n"\ +" ifelse \n"\ +" } if \n"\ +" (Courier) fontFamily eq (Courier New) fontFamily eq or { \n"\ +" bold { \n"\ +" italic { /CBoldItalicISO } { /CBoldISO } ifelse \n"\ +" } { \n"\ +" italic { /CItalicISO } { /CRomanISO } ifelse \n"\ +" } \n"\ +" ifelse \n"\ +" } if \n"\ +" (Symbol) fontFamily eq { \n"\ +" bold { \n"\ +" italic { /SBoldItalicISO } { /SBoldISO } ifelse \n"\ +" } { \n"\ +" italic { /SItalicISO } { /SRomanISO } ifelse \n"\ +" } \n"\ +" ifelse \n"\ +" } if \n\n"\ +" findfont /f0 exch def \n"\ +" /bboxBottom f0 /FontBBox get 1 get 1000 div fontSize mul -1 mul def \n"\ +" /bboxTop f0 /FontBBox get 3 get 1000 div fontSize mul def \n"\ +" f0 fontSize scalefont setfont \n"\ +" lineAscent bboxTop lt { /lineAscent bboxTop def } if \n"\ +" lineDescent bboxBottom lt { /lineDescent bboxBottom def } if \n"\ +" /fontAscent bboxTop def \n"\ +" /fontDescent bboxBottom def \n"\ +"} def\n"\ +"/FS { \n"\ +" /fontSize exch def updateFont \n"\ +"} def \n"\ +"/F { \n"\ +" /fontFamily exch def updateFont \n"\ +"} def \n"\ +"/resetX { \n"\ +" /x leftMargin def\n"\ +"} def \n"\ +"/resetY { \n"\ +" /y pageHeight topMargin sub def \n"\ +"} def \n"\ +"/BR { \n"\ +" /oldx x def \n"\ +" /y y lineAscent lineDescent add sub def \n"\ +" resetX \n"\ +" y bottomMargin lt { \n"\ +" showpage \n"\ +" /didShowPage true \n"\ +" resetY \n"\ +" } if \n"\ +" oldx 0 eq didBR and { /didParSkip true def } if \n"\ +" /didBR true def \n"\ +" % /lineAscent 0 def \n"\ +" % /lineDescent 0 def \n"\ +"} def \n"\ +"/P { \n"\ +" didParSkip not { BR } if \n"\ +" didParSkip not { BR } if \n"\ +"} \n"\ +"def \n"\ +"/acharpath { \n"\ +" /acstr exch def pop /acsp exch def \n"\ +" newpath \n"\ +" str { \n"\ +" /ch exch def \n"\ +" 1 string 0 ch put false charpath \n"\ +" acsp 0 rmoveto \n"\ +" } forall \n"\ +"} def \n"\ +"/A { \n"\ +" /str exch def \n"\ +" /w str stringwidth pop \n"\ +" str length intercharSpace mul add \n"\ +" def \n"\ +" x w add rightLimit ge { BR } if \n"\ +" x y moveto \n"\ +" outline { \n"\ +" shadow { \n"\ +" 1 -0.1 0 { \n"\ +" /offset exch def \n"\ +" offset setgray \n"\ +" x offset 3 mul add y offset 3 mul sub moveto \n"\ +" intercharSpace 0 str acharpath \n"\ +" %% str false charpath \n"\ +" fontSize 30 div setlinewidth stroke \n"\ +" } for \n"\ +" 0 setgray \n"\ +" } { \n"\ +" intercharSpace 0 str acharpath \n"\ +" %% str false charpath \n"\ +" fontSize 30 div setlinewidth stroke \n"\ +" } ifelse \n"\ +" } { \n"\ +" shadow { \n"\ +" 1 -0.1 0 { \n"\ +" /offset exch def \n"\ +" offset setgray \n"\ +" x offset 3 mul add y offset 3 mul sub moveto \n"\ +" intercharSpace 0 str ashow \n"\ +" %% str show \n"\ +" } for \n"\ +" 0 setgray \n"\ +" } { \n"\ +" intercharSpace 0 str ashow \n"\ +" %% str show \n"\ +" } ifelse \n"\ +" } ifelse \n"\ +" strike { \n"\ +" newpath fontSize 20 div setlinewidth \n"\ +" x y fontAscent 0.32 mul add dup /y2 exch def moveto \n"\ +" x w add y2 lineto stroke \n"\ +" } if \n"\ +" underline { \n"\ +" newpath fontSize 20 div setlinewidth \n"\ +" x y fontAscent 0.2 mul sub dup /y2 exch def moveto \n"\ +" x w add y2 lineto stroke \n"\ +" } if \n"\ +" overline { \n"\ +" %% I don't think RTF supports this, but it can be used later. \n"\ +" newpath fontSize 20 div setlinewidth \n"\ +" x y fontAscent 1.2 mul add dup /y2 exch def moveto \n"\ +" x w add y2 lineto stroke \n"\ +" } if \n"\ +" /x x w add def \n"\ +" /didBR false def \n"\ +" /didShowPage false def \n"\ +"} def \n"\ +"\n"\ +"%% These are only binary for now \n"\ +"/X1 { /intercharSpace exch def } def\n"\ +"/X0 { /intercharSpace 0 def } def\n"\ +"/O1 { /outline false def } def\n"\ +"/O0 { /outline false def } def\n"\ +"/H1 { /shadow true def } def\n"\ +"/H0 { /shadow false def } def\n"\ +"/S1 { /strike true def } def\n"\ +"/S0 { /strike false def } def\n"\ +"/B1 { /bold true def updateFont } def\n"\ +"/B0 { /bold false def updateFont } def\n"\ +"/I1 { /italic true def updateFont } def\n"\ +"/I0 { /italic false def updateFont } def\n"\ +"/U1 { /underline true def } def\n"\ +"/U0 { /underline false def } def\n"\ +"updateFont \n"\ +"resetX resetY \n"\ +"\n"