Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. /*=============================================================================
  3.    GNU UnRTF, a command-line program to convert RTF documents to other formats.
  4.    Copyright (C) 2000,2001 Zachary Thayer Smith
  5.  
  6.    This program is free software; you can redistribute it and/or modify
  7.    it under the terms of the GNU General Public License as published by
  8.    the Free Software Foundation; either version 2 of the License, or
  9.    (at your option) any later version.
  10.  
  11.    This program is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.    GNU General Public License for more details.
  15.  
  16.    You should have received a copy of the GNU General Public License
  17.    along with this program; if not, write to the Free Software
  18.    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19.  
  20.    The author is reachable by electronic mail at tuorfa@yahoo.com.
  21. =============================================================================*/
  22.  
  23.  
  24. /*----------------------------------------------------------------------
  25.  * Module name:    ps
  26.  * Author name:    Zach Smith
  27.  * Create date:    18 Sep 01
  28.  * Purpose:        PostScript(TM)-specific output module
  29.  *----------------------------------------------------------------------
  30.  * Changes:
  31.  * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
  32.  * 23 Sep 01, tuorfa@yahoo.com: added shadow, outline, strikethru, underline
  33.  * 23 Sep 01, tuorfa@yahoo.com: revised PS program to use ISOLatin1Encoding
  34.  * 28 Sep 01, tuorfa@yahoo.com: added support for Helvetica,Courier,Symbol
  35.  *--------------------------------------------------------------------*/
  36.  
  37.  
  38.  
  39.  
  40. #include <stdio.h>
  41. #include <string.h>
  42. #include "malloc.h"
  43. #include "defs.h"
  44. #include "error.h"
  45. #include "main.h"
  46. #include "output.h"
  47.  
  48.  
  49.  
  50. static char*
  51. ascii [96] = {
  52.         /* 0x20 */ " ", "!", "\"", "#", "$", "\%", "&", "'",
  53.         /* 0x28 */ "\\(", "\\)", "*", "+", ",", "-", ".", "/",
  54.         /* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7",
  55.         /* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?",
  56.         /* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G",
  57.         /* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O",
  58.         /* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W",
  59.         /* 0x58 */ "X", "Y", "Z", "\\[", "\\\\", "\\]", "^", "_",
  60.         /* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g",
  61.         /* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o",
  62.         /* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w",
  63.         /* 0x78 */ "x", "y", "z", "{", "|", "}", "~", "",
  64. };
  65.  
  66.  
  67. static char* ansi [] = {
  68. /* 0x80 */ "\\200","\\201","\\202","\\203",
  69. /* 0x84 */ "\\204","\\205","\\206","\\207",
  70. /* 0x88 */ "\\210","\\211","\\212","\\213",
  71. /* 0x8c */ "\\214","\\215","\\216","\\217",
  72. /* 0x90 */ "\\220","\\221","\\222","\\223",
  73. /* 0x94 */ "\\224","\\225","\\226","\\227",
  74. /* 0x98 */ "\\230","\\231","\\232","\\233",
  75. /* 0x9c */ "\\234","\\235","\\236","\\237",
  76. /* 0xa0 */ "\\240","\\241","\\242","\\243",
  77. /* 0xa4 */ "\\244","\\245","\\246","\\247",
  78. /* 0xa8 */ "\\250","\\251","\\252","\\253",
  79. /* 0xac */ "\\254","\\255","\\256","\\257",
  80. /* 0xb0 */ "\\260","\\261","\\262","\\263",
  81. /* 0xb4 */ "\\264","\\265","\\266","\\267",
  82. /* 0xb8 */ "\\270","\\271","\\272","\\273",
  83. /* 0xbc */ "\\274","\\275","\\276","\\277",
  84. /* 0xc0 */ "\\300","\\301","\\302","\\303",
  85. /* 0xc4 */ "\\304","\\305","\\306","\\307",
  86. /* 0xc8 */ "\\310","\\311","\\312","\\313",
  87. /* 0xcc */ "\\314","\\315","\\316","\\317",
  88. /* 0xd0 */ "\\320","\\321","\\322","\\323",
  89. /* 0xd4 */ "\\324","\\325","\\326","\\327",
  90. /* 0xd8 */ "\\330","\\331","\\332","\\333",
  91. /* 0xdc */ "\\334","\\335","\\336","\\337",
  92. /* 0xe0 */ "\\340","\\341","\\342","\\343",
  93. /* 0xe4 */ "\\344","\\345","\\346","\\347",
  94. /* 0xe8 */ "\\350","\\351","\\352","\\353",
  95. /* 0xec */ "\\354","\\355","\\356","\\357",
  96. /* 0xf0 */ "\\360","\\361","\\362","\\363",
  97. /* 0xf4 */ "\\364","\\365","\\366","\\367",
  98. /* 0xf8 */ "\\370","\\371","\\372","\\373",
  99. /* 0xfc */ "\\374","\\375","\\376","\\377",
  100. };
  101.  
  102.  
  103. static char* mac [] = {
  104.         "?",
  105. };
  106.  
  107. static char* cp437 [] = {
  108.         "?",
  109. };
  110.  
  111. static char* cp850 [] = {
  112.         "?",
  113. };
  114.  
  115.  
  116.  
  117.  
  118. #define PS_END "\
  119. %% --------- \n\n\
  120.   didShowPage not { \n\
  121.     showpage \n\
  122.   } if\n\n\
  123. %%%%EOF\n"
  124.  
  125.  
  126.  
  127.  
  128. #define PS_START "\
  129. %%%%!PS\n\
  130. %%--------------------------------------------------------------------------\n\
  131. %% GNU UnRTF, a command-line program to convert RTF documents to other formats.\n\
  132. %% Copyright (C) 2000,2001 Zachary Thayer Smith\n\
  133. %%\n\
  134. %% This program is free software; you can redistribute it and/or modify\n\
  135. %% it under the terms of the GNU General Public License as published by\n\
  136. %% the Free Software Foundation; either version 2 of the License, or\n\
  137. %% (at your option) any later version.\n\
  138. %%\n\
  139. %% This program is distributed in the hope that it will be useful,\n\
  140. %% but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
  141. %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n\
  142. %% GNU General Public License for more details.\n\
  143. %%\n\
  144. %% You should have received a copy of the GNU General Public License\n\
  145. %% along with this program; if not, write to the Free Software\n\
  146. %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\
  147. %%\n\
  148. %% The author is reachable by electronic mail at tuorfa@yahoo.com.\n\
  149. %%--------------------------------------------------------------------------\n\
  150. %%%%EndComments \n\
  151. %%\n\
  152. %%         --------- Note, this PS code is unfinished -------- \n\
  153. %%         --------- Note, this PS code is unfinished -------- \n\
  154. %%         --------- Note, this PS code is unfinished -------- \n\
  155. %%         --------- Note, this PS code is unfinished -------- \n\
  156. %%         --------- Note, this PS code is unfinished -------- \n\
  157. %%\n\
  158. %% ----------- Variables ------------\n\
  159. /fontFamily /Times def\n\
  160. /fontAscent 0 def %% ascent for current font\n\
  161. /fontDescent 0 def %% descent for current font\n\
  162. /lineAscent 0 def \n\
  163. /lineDescent 0 def \n\
  164. /pageWidthInches 8.5 def \n\
  165. /pageHeightInches 11 def \n\
  166. /leftMargin 20 def \n\
  167. /rightMargin 20 def \n\
  168. /topMargin 20 def \n\
  169. /bottomMargin 20 def \n\
  170. /DPI 72 def \n\
  171. /pageWidth pageWidthInches DPI mul def \n\
  172. /rightLimit pageWidth rightMargin sub def \n\
  173. /pageHeight pageHeightInches DPI mul def \n\
  174. /x 0 def \n\
  175. /y 0 def \n\
  176. /bold false def \n\
  177. /italic false def \n\
  178. /underline false def \n\
  179. /overline false def \n\
  180. /intercharSpace 0 def \n\
  181. /strike false def \n\
  182. /outline false def \n\
  183. /shadow false def \n\
  184. /fontSize 12 def \n\
  185. /didBR false def \n\
  186. /didParSkip false def \n\
  187. /didShowPage false def \n\
  188. %%------------------------------------------------------\n\
  189. %% Set up the ISO fonts \n\
  190. %% Times \n\
  191. %% ----- \n\
  192. /Times-Roman findfont dup length dict begin {           \n\
  193.         1 index /FID ne { def } { pop pop } ifelse      \n\
  194. } forall                                                \n\
  195. /Encoding ISOLatin1Encoding def                         \n\
  196. currentdict end                                         \n\
  197. /TRomanISO exch definefont pop                  \n\
  198. /Times-Bold findfont dup length dict begin {            \n\
  199.         1 index /FID ne { def } { pop pop } ifelse      \n\
  200. } forall                                                \n\
  201. /Encoding ISOLatin1Encoding def                         \n\
  202. currentdict end                                         \n\
  203. /TBoldISO exch definefont pop                   \n\
  204. /Times-BoldItalic findfont dup length dict begin {      \n\
  205.         1 index /FID ne { def } { pop pop } ifelse      \n\
  206. } forall                                                \n\
  207. /Encoding ISOLatin1Encoding def                         \n\
  208. currentdict end                                         \n\
  209. /TBoldItalicISO exch definefont pop                     \n\
  210. /Times-Italic findfont dup length dict begin {          \n\
  211.         1 index /FID ne { def } { pop pop } ifelse      \n\
  212. } forall                                                \n\
  213. /Encoding ISOLatin1Encoding def                         \n\
  214. currentdict end                                         \n\
  215. /TItalicISO exch definefont pop                 \n\
  216. %% Courier \n\
  217. %% ----- \n\
  218. /Courier-Roman findfont dup length dict begin {         \n\
  219.         1 index /FID ne { def } { pop pop } ifelse      \n\
  220. } forall                                                \n\
  221. /Encoding ISOLatin1Encoding def                         \n\
  222. currentdict end                                         \n\
  223. /CRomanISO exch definefont pop                  \n\
  224. /Courier-Bold findfont dup length dict begin {          \n\
  225.         1 index /FID ne { def } { pop pop } ifelse      \n\
  226. } forall                                                \n\
  227. /Encoding ISOLatin1Encoding def                         \n\
  228. currentdict end                                         \n\
  229. /CBoldISO exch definefont pop                   \n\
  230. /Courier-BoldItalic findfont dup length dict begin {    \n\
  231.         1 index /FID ne { def } { pop pop } ifelse      \n\
  232. } forall                                                \n\
  233. /Encoding ISOLatin1Encoding def                         \n\
  234. currentdict end                                         \n\
  235. /CBoldItalicISO exch definefont pop                     \n\
  236. /Courier-Italic findfont dup length dict begin {                \n\
  237.         1 index /FID ne { def } { pop pop } ifelse      \n\
  238. } forall                                                \n\
  239. /Encoding ISOLatin1Encoding def                         \n\
  240. currentdict end                                         \n\
  241. /CItalicISO exch definefont pop                 \n\
  242. %% Symbol \n\
  243. %% ----- \n\
  244. /Symbol-Roman findfont dup length dict begin {          \n\
  245.         1 index /FID ne { def } { pop pop } ifelse      \n\
  246. } forall                                                \n\
  247. /Encoding ISOLatin1Encoding def                         \n\
  248. currentdict end                                         \n\
  249. /SRomanISO exch definefont pop                  \n\
  250. /Symbol-Bold findfont dup length dict begin {           \n\
  251.         1 index /FID ne { def } { pop pop } ifelse      \n\
  252. } forall                                                \n\
  253. /Encoding ISOLatin1Encoding def                         \n\
  254. currentdict end                                         \n\
  255. /SBoldISO exch definefont pop                   \n\
  256. /Symbol-BoldItalic findfont dup length dict begin {     \n\
  257.         1 index /FID ne { def } { pop pop } ifelse      \n\
  258. } forall                                                \n\
  259. /Encoding ISOLatin1Encoding def                         \n\
  260. currentdict end                                         \n\
  261. /SBoldItalicISO exch definefont pop                     \n\
  262. /Symbol-Italic findfont dup length dict begin {         \n\
  263.         1 index /FID ne { def } { pop pop } ifelse      \n\
  264. } forall                                                \n\
  265. /Encoding ISOLatin1Encoding def                         \n\
  266. currentdict end                                         \n\
  267. /SItalicISO exch definefont pop                 \n\
  268. %% Helvetica \n\
  269. %% --------- \n\
  270. /Helvetica-Roman findfont dup length dict begin {               \n\
  271.         1 index /FID ne { def } { pop pop } ifelse      \n\
  272. } forall                                                \n\
  273. /Encoding ISOLatin1Encoding def                         \n\
  274. currentdict end                                         \n\
  275. /HRomanISO exch definefont pop                  \n\
  276. /Helvetica-Bold findfont dup length dict begin {                \n\
  277.         1 index /FID ne { def } { pop pop } ifelse      \n\
  278. } forall                                                \n\
  279. /Encoding ISOLatin1Encoding def                         \n\
  280. currentdict end                                         \n\
  281. /HBoldISO exch definefont pop                   \n\
  282. /Helvetica-BoldOblique findfont dup length dict begin { \n\
  283.         1 index /FID ne { def } { pop pop } ifelse      \n\
  284. } forall                                                \n\
  285. /Encoding ISOLatin1Encoding def                         \n\
  286. currentdict end                                         \n\
  287. /HBoldItalicISO exch definefont pop                     \n\
  288. /Helvetica-Oblique findfont dup length dict begin {             \n\
  289.         1 index /FID ne { def } { pop pop } ifelse      \n\
  290. } forall                                                \n\
  291. /Encoding ISOLatin1Encoding def                         \n\
  292. currentdict end                                         \n\
  293. /HItalicISO exch definefont pop                 \n\
  294. %% \n\
  295. %% Ideally, before we can draw a line of text, we need to collect all the\n\
  296. %% words that will be on it, just as I do in my Beest HTML viewer, as well\n\
  297. %% as character attributes for each word. But for now, this implementation \n\
  298. %% does not bother. It determines the maximize ascent and descent after\n\
  299. %% drawing the text, not before. XX\n\
  300. %% \n\
  301. %% ----------- Functions ------------\n\
  302. /updateFont { \n\
  303.         /f0 null def \n\
  304.         (Times) fontFamily eq (Times New Roman) fontFamily eq or {              bold { \n\
  305.                         italic { /TBoldItalicISO } { /TBoldISO } ifelse \n\
  306.                 } { \n\
  307.                         italic { /TItalicISO } { /TRomanISO } ifelse \n\
  308.                 } \n\
  309.                 ifelse \n\
  310.         } if    (Helvetica) fontFamily eq (Arial) fontFamily eq or {            bold { \n\
  311.                         italic { /HBoldItalicISO } { /HBoldISO } ifelse \n\
  312.                 } { \n\
  313.                         italic { /HItalicISO } { /HRomanISO } ifelse \n\
  314.                 } \n\
  315.                 ifelse \n\
  316.         } if    (Courier) fontFamily eq (Courier New) fontFamily eq or {                bold { \n\
  317.                         italic { /CBoldItalicISO } { /CBoldISO } ifelse \n\
  318.                 } { \n\
  319.                         italic { /CItalicISO } { /CRomanISO } ifelse \n\
  320.                 } \n\
  321.                 ifelse \n\
  322.         } if    (Symbol) fontFamily eq {                bold { \n\
  323.                         italic { /SBoldItalicISO } { /SBoldISO } ifelse \n\
  324.                 } { \n\
  325.                         italic { /SItalicISO } { /SRomanISO } ifelse \n\
  326.                 } \n\
  327.                 ifelse \n\
  328.         } if    findfont /f0 exch def  \n\
  329.         /bboxBottom f0 /FontBBox get 1 get 1000 div fontSize mul -1 mul def \n\
  330.         /bboxTop    f0 /FontBBox get 3 get 1000 div fontSize mul def \n\
  331.         f0 fontSize scalefont setfont \n\
  332.         lineAscent bboxTop lt { /lineAscent bboxTop def } if  \n\
  333.         lineDescent bboxBottom lt { /lineDescent bboxBottom def } if  \n\
  334.         /fontAscent bboxTop def \n\
  335.         /fontDescent bboxBottom def \n\
  336. } def\n\
  337. /FS { \n\
  338.         /fontSize exch def updateFont \n\
  339. } def \n\
  340. /F { \n\
  341.         /fontFamily exch def updateFont \n\
  342. } def \n\
  343. /resetX { \n\
  344.         /x leftMargin def\n\
  345. } def \n\
  346. /resetY { \n\
  347.         /y pageHeight topMargin sub def \n\
  348. } def \n\
  349. /BR {  \n\
  350.         /oldx x def \n\
  351.         /y y lineAscent lineDescent add sub def  \n\
  352.         resetX \n\
  353.         y bottomMargin lt { \n\
  354.                 showpage \n\
  355.                 /didShowPage true \n\
  356.                 resetY \n\
  357.         } if \n\
  358.         oldx 0 eq didBR and { /didParSkip true def } if \n\
  359.         /didBR true def \n\
  360.         % /lineAscent 0 def \n\
  361.         % /lineDescent 0 def \n\
  362. } def \n\
  363. /P { \n\
  364.         didParSkip not { BR } if \n\
  365.         didParSkip not { BR } if \n\
  366. } \n\
  367. def \n\
  368. /acharpath { \n\
  369.         /acstr exch def pop /acsp exch def      newpath         str {           /ch exch def            1 string 0 ch put false charpath                acsp 0 rmoveto  } forall} def \n\
  370. /A { \n\
  371.         /str exch def \n\
  372.         /w str stringwidth pop \n\
  373.                 str length intercharSpace mul add \n\
  374.                 def \n\
  375.                 x w add rightLimit ge { BR } if \n\
  376.         x y moveto \n\
  377.         outline {                                           \n\
  378.                 shadow {                                    \n\
  379.                         1 -0.1 0 {                        \n\
  380.                                 /offset exch def \n\
  381.                                 offset setgray                 \n\
  382.                                 x offset 3 mul add y offset 3 mul sub moveto                            intercharSpace 0 str acharpath \n\
  383.                                 %% str false charpath \n\
  384.                                 fontSize 30 div setlinewidth stroke \n\
  385.                         } for                               \n\
  386.                         0 setgray \n\
  387.                 } {                                         \n\
  388.                         intercharSpace 0 str acharpath      \n\
  389.                         %% str false charpath \n\
  390.                         fontSize 30 div setlinewidth stroke \n\
  391.                 } ifelse                                    \n\
  392.         } {                                                 \n\
  393.                 shadow {                                    \n\
  394.                         1 -0.1 0 {                        \n\
  395.                                 /offset exch def \n\
  396.                                 offset setgray                 \n\
  397.                                 x offset 3 mul add y offset 3 mul sub moveto                            intercharSpace 0 str ashow  \n\
  398.                                 %% str show \n\
  399.                         } for                               \n\
  400.                         0 setgray               } {                                         \n\
  401.                         intercharSpace 0 str ashow          \n\
  402.                         %% str show \n\
  403.                 } ifelse                                    \n\
  404.         } ifelse                                            \n\
  405.         strike {                                                        \n\
  406.                 newpath fontSize 20 div setlinewidth                    \n\
  407.                 x y fontAscent 0.32 mul add dup /y2 exch def moveto     \n\
  408.                 x w add y2 lineto stroke                                \n\
  409.         } if                                                            \n\
  410.         underline {                                                     \n\
  411.                 newpath fontSize 20 div setlinewidth                    \n\
  412.                 x y fontAscent 0.2 mul sub dup /y2 exch def moveto      \n\
  413.                 x w add y2 lineto stroke                                \n\
  414.         } if                                                            \n\
  415.         overline {                                                      \n\
  416.                 %% I don't think RTF supports this, but it can be used later. \n\
  417.                 newpath fontSize 20 div setlinewidth                    \n\
  418.                 x y fontAscent 1.2 mul add dup /y2 exch def moveto      \n\
  419.                 x w add y2 lineto stroke                                \n\
  420.         } if                                    \n\
  421.         /x x w add def                          \n\
  422.         /didBR false def                        \n\
  423.         /didShowPage false def                  \n\
  424. } def \n\
  425. \n\
  426. %% These are only binary for now \n\
  427. /X1 { /intercharSpace exch def } def\n\
  428. /X0 { /intercharSpace 0 def } def\n\
  429. /O1 { /outline false def } def\n\
  430. /O0 { /outline false def } def\n\
  431. /H1 { /shadow true def } def\n\
  432. /H0 { /shadow false def } def\n\
  433. /S1 { /strike true def } def\n\
  434. /S0 { /strike false def } def\n\
  435. /B1 { /bold true def updateFont } def\n\
  436. /B0 { /bold false def updateFont } def\n\
  437. /I1 { /italic true def updateFont } def\n\
  438. /I0 { /italic false def updateFont } def\n\
  439. /U1 { /underline true def } def\n\
  440. /U0 { /underline false def } def\n\
  441. updateFont \n\
  442. resetX resetY \n\
  443. \n\
  444. "
  445.  
  446.  
  447.  
  448.  
  449. /*========================================================================
  450.  * Name:        ps_init
  451.  * Purpose:     Generates an OutputPersonality object for the PostScript(TM)
  452.  *              format.
  453.  * Args:        None.
  454.  * Returns:     OutputPersonality.
  455.  *=======================================================================*/
  456.  
  457. OutputPersonality *
  458. ps_init (void)
  459. {
  460.         OutputPersonality* op;
  461.  
  462.         op = op_create();
  463.  
  464.         op->comment_begin = "%% ";
  465.         op->comment_end = "\n";
  466.  
  467.         op->word_begin = "(";
  468.         op->word_end = ")A ";
  469.  
  470.         op->document_begin = PS_START;
  471.         op->document_end = PS_END;
  472.  
  473.         op->header_begin = "%% header begin\n";
  474.         op->header_end = "%% header end\n";
  475.  
  476.         op->document_title_begin = "%%%%Title: ";
  477.         op->document_title_end = "\n";
  478.  
  479.         op->document_author_begin = "%%%%Creator: ";
  480.         op->document_author_end = "\n";
  481.  
  482.         op->document_changedate_begin = "%% CHANGED: ";
  483.         op->document_changedate_end = "\n";
  484.  
  485.         op->body_begin = "\n\n%% ---------- Document Body ------------\n";
  486.         op->body_end = "\n";
  487.  
  488.         op->paragraph_begin = "P ";
  489.         op->paragraph_end = "\n";
  490.  
  491.         op->center_begin = "";
  492.         op->center_end = "";
  493.  
  494.         op->justify_begin = "";
  495.         op->justify_end = "";
  496.  
  497.         op->align_left_begin = "";
  498.         op->align_left_end = "";
  499.  
  500.         op->align_right_begin = "";
  501.         op->align_right_end = "";
  502.  
  503.         op->forced_space = " ";
  504.         op->line_break = "BR\n";
  505.         op->page_break = "\n";
  506.  
  507.         op->hyperlink_begin = "U1(";
  508.         op->hyperlink_end = ")A U0 ";
  509.  
  510.         op->imagelink_begin = "";
  511.         op->imagelink_end = "";
  512.  
  513.         op->table_begin = "\n% TABLE BEGINS (not implemented)\nP\n(TABLE)A BR\n";
  514.         op->table_end = "\n% TABLE ENDS (not implemented)\nP\n";
  515.  
  516.         op->table_row_begin = "(  )A ";
  517.         op->table_row_end = "( |)A BR\n";
  518.  
  519.         op->table_cell_begin = "( | )A ";
  520.         op->table_cell_end = "";
  521.  
  522.         /* Character attributes */
  523.         op->font_begin = "(%s) F ";
  524.         op->font_end = "";
  525.  
  526.         op->fontsize_begin = "%s FS ";
  527.         op->fontsize_end = "";
  528.  
  529.         op->smaller_begin = "";
  530.         op->smaller_end = "";
  531.  
  532.         op->bigger_begin = "";
  533.         op->bigger_end = "";
  534.  
  535.         op->foreground_begin = "";
  536.         op->foreground_end = "";
  537.  
  538.         op->background_begin = "";
  539.         op->background_end = "";
  540.  
  541.         op->bold_begin = "B1 ";
  542.         op->bold_end = "B0 ";
  543.  
  544.         op->italic_begin = "I1 ";
  545.         op->italic_end = "I0 ";
  546.  
  547.         op->underline_begin = "U1 ";
  548.         op->underline_end = "U0 ";
  549.  
  550.         op->dbl_underline_begin = "U1 ";
  551.         op->dbl_underline_end = "U0 ";
  552.  
  553.         op->superscript_begin = "";
  554.         op->superscript_end = "";
  555.  
  556.         op->subscript_begin = "";
  557.         op->subscript_end = "";
  558.  
  559.         op->strikethru_begin = "S1 ";
  560.         op->strikethru_end = "S0 ";
  561.  
  562.         op->dbl_strikethru_begin = "S1 ";
  563.         op->dbl_strikethru_end = "S0 ";
  564.  
  565.         op->emboss_begin="";
  566.         op->emboss_end = "";
  567.  
  568.         op->engrave_begin = "";
  569.         op->engrave_end = "";
  570.  
  571.         op->shadow_begin= "H1 ";
  572.         op->shadow_end= "H0 ";
  573.  
  574.         op->outline_begin= "O1 ";
  575.         op->outline_end= "O0 ";
  576.  
  577.         op->expand_begin = "%s X1 ";
  578.         op->expand_end = "X0 ";
  579.  
  580.         op->simulate_small_caps = TRUE;
  581.         op->simulate_all_caps = TRUE;
  582.         op->simulate_word_underline = TRUE;
  583.  
  584.         op->ascii_translation_table = ascii;
  585.  
  586.         op->ansi_translation_table = ansi;
  587.         op->ansi_first_char = 0x80;
  588.         op->ansi_last_char = 0xff;
  589.  
  590.         op->cp437_translation_table = cp437;
  591.         op->cp437_first_char = 0x80;
  592.         op->cp437_last_char = 0x80;
  593.  
  594.         op->cp850_translation_table = cp850;
  595.         op->cp850_first_char = 0x80;
  596.         op->cp850_last_char = 0x80;
  597.  
  598.         op->mac_translation_table = mac;
  599.         op->mac_first_char = 0x80;
  600.         op->mac_last_char = 0x80;
  601.  
  602.         op->chars.right_quote = "'";
  603.         op->chars.left_quote = "`";
  604.         op->chars.right_dbl_quote = "''";
  605.         op->chars.left_dbl_quote = "``";
  606.  
  607.         return op;
  608. }
  609.  
  610.  
  611.