Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!nuug!sigyn.idt.unit.no!he From: he@idt.unit.no (Haavard Eidnes) Newsgroups: comp.soft-sys.andrew Subject: Re: Why isn't ATK more widely used? Message-ID: <1990Jul28.182517.12115@idt.unit.no> Date: 28 Jul 90 18:25:17 GMT References: <104319@convex.convex.com> Organization: Div. of CS & T, Norwegian Institute of Technology Lines: 267 In article cmf@UNIX.CIS.PITT.EDU ("Carl M. Fongheiser") writes: >> Wouldn't another *roff clone work as well? How's Transcript required? > >I haven't tried it, but groff ought to work. It has all the >functionality needed, though not necessarily compatibly. Maybe I'll try >that this afternoon... Ok, several other seem to think the way I do... I've tried to make groff work with ATK documents. Below follows the changes I've done so far. Apply at own risk. I've yet to be able to print a combined graphics and text document, but I am able to print pure text documents and pure raster images. I do not have the time to continue working on this, so I would appreciate it if someone else picked this up and continued. Regards, Havard Eidnes ------------------------------ Cut here: #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # README # patches # atk_print # This archive created: Sat Jul 28 19:21:47 1990 export PATH; PATH=/bin:/usr/bin:$PATH if test -f 'README' then echo shar: "will not over-write existing file 'README'" else cat << \SHAR_EOF > 'README' Preliminary try at supporting printing ATK documents with groff. Explanation of changes: atk/text/tmac.atk: .po change apparently needed because .po occurs outside of a .de .. section. groff complains otherwise. Add knowledge of "ps" printertype. Non-space mode has to be turned off for spacing to work. Since we use the \X'ps:import' primitive, and the postscript image is imported with its lower left corner at the current troff output position, we have to space forward appropriately. I don't understand what this testing for number register .j is all about. My doc (Sun's) says it's something to do with adjust mode, but why would a picture be positioned elsewhere due to different adjustment modes? Also my doc doesn't mention what the different values of .j are supposed to mean. Since the perl program makes some guesses (that troffadjust will be defined to { pop 0 }), the conditional code should perhaps be changed to unconditional? Anyway, it's difficult to convey to the perl program what adjustment mode will be used... I just comment out the PB and PE macro calls, since we won't be using Transcript. atk/text/txttroff.c: Changes are straight-forward -- just change of font names. atk_print: Perl program which splits out imbedded postscript in ditroff style and constructs the (hopefully) appropriate \X'ps:import' statement. After running groff deletes the constructed input files. Yes, my inexperience with using perl probably shows here... I'd be glad if someone else turned this into something that worked for combined documents! he@idt.unit.no, 28 Jul 1990 SHAR_EOF fi if test -f 'patches' then echo shar: "will not over-write existing file 'patches'" else cat << \SHAR_EOF > 'patches' *** /tmp/,RCSt1a18173 Sat Jul 28 20:07:47 1990 --- atk/text/tmac.atk Thu Jul 26 22:31:31 1990 *************** *** 91,95 **** .. . \" default footer string definitions ! .po +\\n(INu . \" BT -- Bottom trap handling .de BT --- 91,95 ---- .. . \" default footer string definitions ! .po +\n(INu . \" BT -- Bottom trap handling .de BT *************** *** 353,358 **** --- 353,361 ---- .if "\*(.T"postscript" 'nr zT 1 .if "\*(.T"psc" 'nr zT 1 + .if "\*(.T"ps" 'nr zT 1 .de PB 'ne \\$2p + 'rs + 'sp \\$2p 'nr zw \\n(.l-\\n(.k-1m-\\$1p 'nr zH \\n(.k *************** *** 369,383 **** .sp |\\n(zVu 'if ((\\n(zx<=0)&(\\$2p>0.75v)) \\x'\\$2p-0.75v'\\c ! \\!% ! \\!%! ! \\! PB 'if \\n(.j=3 \\{\\ ! \\! /troffadjust { neg 2 idiv } def 'ss\\} 'if \\n(.j=5 \\{\\ ! \\! /troffadjust { neg } def 'ss\\} 'if \\n(.j<3 \\{\\ ! \\! /troffadjust { pop 0 } def 'ss\\}\\} .. --- 372,386 ---- .sp |\\n(zVu 'if ((\\n(zx<=0)&(\\$2p>0.75v)) \\x'\\$2p-0.75v'\\c ! .\" \\!% ! .\" \\!%! ! .\" \\! PB 'if \\n(.j=3 \\{\\ ! \X'ps:exec userdict beginn /troffadjust { neg 2 idiv } def end' 'ss\\} 'if \\n(.j=5 \\{\\ ! \X'ps:exec userdict begin /troffadjust { neg } def end' 'ss\\} 'if \\n(.j<3 \\{\\ ! \X'ps:exec userdict begin /troffadjust { pop 0 } def end' 'ss\\}\\} .. *************** *** 384,389 **** .de PE 'if \\n(zT \\{\\ ! \\! PE ! \\!. 'ie \\n(zx \\{\\ 'if (\\$2p>0.75v) \\x'\\$2p-0.75v'\\c --- 387,392 ---- .de PE 'if \\n(zT \\{\\ ! .\" \\! PE ! .\" \\!. 'ie \\n(zx \\{\\ 'if (\\$2p>0.75v) \\x'\\$2p-0.75v'\\c *** /tmp/,RCSt1a18179 Sat Jul 28 20:08:43 1990 --- atk/text/txttroff.c Tue Jul 24 12:52:35 1990 *************** *** 133,143 **** /* All shadowface is bold for now */ } fonttable[] = { ! {"timesroman", {"R", "I", "B", "BI", "C", "CO", "CB", "CD", "B"}}, ! {"helvetica", {"H", "HO", "HB", "HD", "C", "CO", "CB", "CD", "B"}}, ! {"andy", {"R", "I", "B", "BI", "C", "CO", "CB", "CD", "B"}}, ! {"andysans", {"H", "HO", "HB", "HD", "C", "CO", "CB", "CD", "B"}}, ! {"andytype", {"C", "CO", "CB", "CD", "C", "CO", "CB", "CD", "C"}}, ! {"gacha", {"C", "CO", "CB", "CD", "C", "CO", "CB", "CD", "C"}}, ! {0, {"R", "I", "B", "BI", "C", "CO", "CB", "CD", "B"}} /* default for unknown family */ }; --- 133,143 ---- /* All shadowface is bold for now */ } fonttable[] = { ! {"timesroman", {"R", "I", "B", "BI", "CR", "CI", "CB", "CBI", "B"}}, ! {"helvetica", {"HR", "HI", "HB", "HBI", "CR", "CI", "CB", "CBI", "B"}}, ! {"andy", {"R", "I", "B", "BI", "CR", "CI", "CB", "CBI", "B"}}, ! {"andysans", {"HR", "HI", "HB", "HBI", "CR", "CI", "CB", "CBI", "B"}}, ! {"andytype", {"CR", "CI", "CB", "CBI", "CR", "CI", "CB", "CBI", "CR"}}, ! {"gacha", {"C", "CO", "CB", "CD", "CR", "CI", "CB", "CBI", "CR"}}, ! {0, {"R", "I", "B", "BI", "CR", "CI", "CB", "CBI", "B"}} /* default for unknown family */ }; SHAR_EOF fi if test -f 'atk_print' then echo shar: "will not over-write existing file 'atk_print'" else cat << \SHAR_EOF > 'atk_print' #!/local/bin/perl $mainfile = "/tmp/atk_main.$$"; $outfile = "/tmp/atk_ps.$$"; $template = "/tmp/atk_ps_part$$"; open(main,">" . $mainfile) || die "Can't open $mainfile for write!"; $tmp_no = 0; $pb_seen = 0; while(<>) { if($pb_seen) { if(/^\'if/) { printf main $_; $tempfile = $template . "_" . $tmp_no++; open( temp, ">" . $tempfile ) || die "Can't open $tempfile!"; printf main "\\X'ps:import $tempfile %d %d %d %d %d %d'\n", 0, -$height, $width, 0, $width * 1000, $height * 1000; } else { if(/^\'PE/) { $bp_seen = 0; close(temp); printf main "\\}\n" ; printf main $_; } else { if(/^\\}/) { next; } s/\\!//; printf temp $_; } } } else { if(/^\'PB/) { $pb_seen = 1; $line = $_; split; $width = $_[1]; $height = $_[2]; printf main $line; } else { printf main $_; } } } close main; system "groff -C -e -Tps $mainfile"; for( $n = 0; $n < $tmp_no; $n++ ) { unlink($template . "_" . $n); } unlink($mainfile); SHAR_EOF chmod +x 'atk_print' fi exit 0 # End of shell archive