[net.micro.amiga] Printer Driver for Toshiba P1340

mark@ece-csc.UUCP (Mark Lanzo) (10/28/86)

Questions, questions, and more questions...

I have written a printer driver for a Toshiba P1340 printer.
It doesn't support all printer functions yet; mostly because I don't
know what some of the sequences are supposed to do.
For instance, what is the difference between "RESET" and "INITIALIZE" ?
("aRIN" and "aRIS" I believe are the correct names for these). -- My
driver treats these as the same for now.  What is the "set normalization on"
sequence for? (I first thought that this pertained to justification,
but there are separate codes for that.)  Etc. etc.  Unfortunately I don't
have the manuals with me here else I would list all the sequences I don't
understand.

My biggest question pertains to graphics dumps.  When I print pictures,
the shading comes out very poorly.  White prints as white, but other
colors generally print in various _very_ dark shades of gray, even if the
color is very bright on the screen (such as yellow).  The dithering
algorithm seems not to work very well; printed images have next to no contrast,
if you ignore white.  I've seen this also with images dumped on some 
other printers, and know that there are others out there who also would
like to have an answer about this.  So how about it?  Do the dithering
routines in the Amiga just work terribly poorly, or am I doing something
wrong?   ... before someone suggests it, YES I DO HAVE "grey-scale" set
in preferences.

Another problem:
My DoSpecial seems to get called for a lot of functions where it shouldn't
be.  There are entries in the command-table which do NOT contain any \377
characters, but for which DoSpecial is still being called.  I thought 
DoSpecial was only supposed to be called for functions which couldn't be
handled through simple text substitution via the command-table.  Yet
some entries in the command table work fine.

My last question is not about the driver per se, but is simply a request for
opinions on how to handle certain sequences:

The P1340 unfortunately is not very smart in regards to different character
sets et al.  It's a 24 pin printer which prints very nicely, particularly
when put into NLQ mode.  However, it does not have italics or boldface, 
although it does have underlining.  The question is: how should I treat
requests for italics and other special fonts?  My current solution is to
treat any request for italics/boldface/shadow-print/etc as a single 
"standout" mode.  If I am in draft-mode (non NLQ), I turn on NLQ mode,
which causes the text in "standout" mode to print as darker and more
distinct than the surrounding text.  When all "standout" attributes are turned
off, I switch back to draft mode.  If I'm already in NLQ mode,
there's nothing much I can do, so I just ignore the requests.  I can't say
that I really like this arrangement, but I don't have any better ideas.
Suggestions?

Well, enough noise for now... thanks in advance for any help you'd care to
send.

       --- Mark ---

daveb@cbmvax.cbm.UUCP (Dave Berezowski) (10/29/86)

In article <3117@ece-csc.UUCP> mark@ece-csc.UUCP (Mark Lanzo) writes:
>Questions, questions, and more questions...
>
>I have written a printer driver for a Toshiba P1340 printer.
>
>My biggest question pertains to graphics dumps.  When I print pictures,
>the shading comes out very poorly.  White prints as white, but other
>colors generally print in various _very_ dark shades of gray, even if the
>color is very bright on the screen (such as yellow).  The dithering
>algorithm seems not to work very well; printed images have next to no contrast,
>if you ignore white.  I've seen this also with images dumped on some 
>other printers, and know that there are others out there who also would
>like to have an answer about this.  So how about it?  Do the dithering
>routines in the Amiga just work terribly poorly, or am I doing something
>wrong?   ... before someone suggests it, YES I DO HAVE "grey-scale" set
>in preferences.
>

	Mark, as the author of the graphic's side of the printer drivers,
let me assure you that the dithering algorithms have been tested thoroughly
on a wide range of printers by numerous individuals at CBM-Amiga.

	A couple of thoughts come to mind concerning your problem:

1. If memory serves, the Toshiba P1340 has a 180 and 360 dpi graphics mode.
	Make sure that the dpi that you have implemented is the same as
	the what you are telling the system. ie. you may have implemented
	180 dpi but told the system that the Toshiba does 200 dpi.

2. Printers that implement a higher density by OVERLAPING dots TEND to
	produce darker prints as the area of overlap produces a darker
	dot. Have you implemented an overlaping dot gfx dump? If so, try
	a non-overlapping one.

3. Strange as it may sound, double (and triple) check your algorithm
	in your gfx dump code. Here is an easy way to verify that it
	is correct. Create a screen or window with the 16 shades of black
	(thats 000, 111, 222, etc up to fff in rgb values). Dump this
	to the printer as a large dump (ie 80 columns). Starting at the
	lightest color, you should see a gradual increase in the number
	of dots/fixed_area on the printer. The dither algorithm uses a
	4 x 4 dither matrix, thus:
	000 corresponds to 0 dots per 4 x 4
	111      "         1
	222      "         2
		etc
	eee      "         14
	fff      "         16 (uses all 16 here so that full colors are solid)


	Hope I've been helpful.

	Regards, David Berezowski

Disclaimer: I no longer work for CBM-Amiga, (although I sometimes do work
for them) and my views are my own.

andy@amiga.UUCP (Andy Finkel) (10/29/86)

In article <3117@ece-csc.UUCP> mark@ece-csc.UUCP (Mark Lanzo) writes:
>Questions, questions, and more questions...
>
>I have written a printer driver for a Toshiba P1340 printer.
>It doesn't support all printer functions yet; mostly because I don't
>know what some of the sequences are supposed to do.
>For instance, what is the difference between "RESET" and "INITIALIZE" ?
>("aRIN" and "aRIS" I believe are the correct names for these). -- My
>driver treats these as the same for now.  

aRIS (reset) is the escape sequence to RESET the printer, using the
manufacturer's reset code

aRIN is the escape sequence to do a read from preferences printer
selections.  This sequence makes the printer state match preferences.
This sequence also does a CR/LF.  (Because most printers require this
as part of the set margins commands.)  Under V1.1, this command is
issued automatically every time the printer is Opened.  Under V1.2
this command is issued only the first time this printer is Opened.
(If you change printers using preferences, or change one of the preference
items that the printer is listening to, this command will be issued
on the next Open, again)


What is the "set normalization on"
>sequence for? (I first thought that this pertained to justification,
>but there are separate codes for that.)  Etc. etc.  Unfortunately I don't
>have the manuals with me here else I would list all the sequences I don't
>understand.
>

The Normalize escape sequence is cancel superscript/subscript modes,
and if you've been using PLU or PLD commands, return the printer
to the starting line.

>My biggest question pertains to graphics dumps.  When I print pictures,

Dave (one of my co-conspirators on the printer.device) has given some hints
already on this.

>Another problem:
>My DoSpecial seems to get called for a lot of functions where it shouldn't
>be.  There are entries in the command-table which do NOT contain any \377
>characters, but for which DoSpecial is still being called.  I thought 
>DoSpecial was only supposed to be called for functions which couldn't be
>handled through simple text substitution via the command-table.  Yet
>some entries in the command table work fine.
>

No, actually, dospecial is given a chance to override any of the commands,
whether there is a \377 there, or not.  The \377 is a place holder, which
doesn't come up when dealing with printers. (At least, any of the ones
we've hit so far.  If one does come up, that sequence could be handled in
dospecial, anyway.)


>My last question is not about the driver per se, but is simply a request for
>opinions on how to handle certain sequences:
>
>The P1340 unfortunately is not very smart in regards to different character
>sets et al.  It's a 24 pin printer which prints very nicely, particularly
>when put into NLQ mode.  However, it does not have italics or boldface, 
>although it does have underlining.  The question is: how should I treat
>requests for italics and other special fonts?  My current solution is to
>treat any request for italics/boldface/shadow-print/etc as a single 
>"standout" mode.  If I am in draft-mode (non NLQ), I turn on NLQ mode,
>which causes the text in "standout" mode to print as darker and more
>distinct than the surrounding text.  When all "standout" attributes are turned
>off, I switch back to draft mode.  If I'm already in NLQ mode,
>there's nothing much I can do, so I just ignore the requests.  I can't say
>that I really like this arrangement, but I don't have any better ideas.
>Suggestions?

On the Amiga printer drivers, I decided to give what the printer was
capable of...ie if a printer couldn't so italics I left that unimplemented.

I also didn't mix NLQ modes in with the SGR commands...NLQ is really slow
on some printers, and didn't help on those without italics (generally
daisy wheel printers) anyway.

>
>Well, enough noise for now... thanks in advance for any help you'd care to
>send.
>
>       --- Mark ---



			andy finkel
-- 

			andy finkel
			Commodore(Amiga)
			{ihnp4|seismo|allegra}!cbmvax!andy
		or	 pyramid!amiga!andy

Any expressed opinions are mine; but feel free to share.

I disclaim all responsibilities, all shapes, all sizes, all colors.

"Remember, no matter where you grow, there you are." - Buckaroo Bonsai.

dillon@CORY.BERKELEY.EDU (Matt Dillon) (10/31/86)

In article <3117@ece-csc.UUCP> mark@ece-csc.UUCP (Mark Lanzo) writes:

>My last question is not about the driver per se, but is simply a request for
>opinions on how to handle certain sequences:
>
>The P1340 unfortunately is not very smart in regards to different character
>sets et al.  It's a 24 pin printer which prints very nicely, particularly
>when put into NLQ mode.  However, it does not have italics or boldface, 
>although it does have underlining.  The question is: how should I treat
>requests for italics and other special fonts?  My current solution is to
>treat any request for italics/boldface/shadow-print/etc as a single 
>"standout" mode.  If I am in draft-mode (non NLQ), I turn on NLQ mode,
>which causes the text in "standout" mode to print as darker and more
>distinct than the surrounding text.  When all "standout" attributes are turned
>off, I switch back to draft mode.  If I'm already in NLQ mode,
>there's nothing much I can do, so I just ignore the requests.  I can't say
>that I really like this arrangement, but I don't have any better ideas.
>Suggestions?

	Yes, you can simply overwrite the line... a double pass on the chars
you want in boldface will make them darker whether your in LQ or not.  In
terms of italics.. the standard convention for printers that do not have 
italics is to underline them instead... however, make sure you treat it as
a separate mode, so if the user does 'italics on, underline on, underline off',
following text will still be italics (underlined). until an 'italics off'.

						-Matt