Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing colors

Status
Not open for further replies.

bigwood177

Programmer
Nov 20, 2002
5
US
I'm having a difficult time changing the color of one word in a line of text from black to some color, can someone help me understand what's happening in the following examples?
I'm using a HP Business InkJet 1200

Thanks,
Wood

I've add my own comments after the ";"

----- test 1 -----
this is black<esc>*r-3U<esc>*vSCyan<esc>*r1U
<esc>*r-3U<esc>*v6SRed <esc>*r1U<esc>*v1SBlack
<esc>*r-3U<esc>*v3SBlue <esc>*r1U<esc>*v1SBlack

Result: my comments
this is black Cyan ;in correct colors
Red Black ;in correct colors
Blue Black ;in correct colors

-------end of test 1 ---------

----- test 2 -------
this is black<esc>*r-3U<esc>V1SCyan<esc>*r1U
<esc>*r-3U<esc>*v6SRed <esc>*r1U
<esc>*r-3U<esc>*v3SBlue <esc>*r1U<esc>*v1SBlack

Result:
this is black Cyan ;in correct colors
;blank line
Blue Black ;in correct colors

---- end of test 2 ----

----- test 3 -----
this is black<esc>*r-3U<esc>V1SCyan<esc>*r1U
<esc>*r-3U<esc>*v6SRed <esc>*r1U<esc>*v1S
<esc>*r-3U<esc>*v3SBlue <esc>*r1U<esc>*v1SBlack

Result:
this is black Cyan ;in correct colors
;blank line
Blue Black ;in correct colors

-------end of test 3 ---------


----- test 4 -----
this is black<esc>*r-3U<esc>V1SCyan<esc>*r1U
<esc>*r-3U<esc>*v6SRed <esc>*r1U<esc>*v1S.
<esc>*r-3U<esc>*v3SBlue <esc>*r1U<esc>*v1SBlack

Result:
this is black Cyan ;in correct colors
unreadable line ;line the height of the "."
Blue Black ;in correct colors

-------end of test 4 ---------

 
You appear to be saying that:

Test1: prints as you expect.
Test2: prints as you expect.
Test3: second line is blank rather than "Red"
Test4: second line is unreadable because height is very small

Am I interpreting you correctly?

General point: you appear to be relying upon LineFeed (0x0a) characters (perhaps in conjunction with CarriageReturn (0x0d) characters) to move from line to line.

These lines SHOULD be spaced according to the current Vertical Motion Index (VMI) value.
This can be changed explicitly by several commands, but not any of the sequences you have mentioned.

So I can't explain your symptoms, given the evidence you have presented so far; have you 'missed out' any sequences in your examples, for clarity?

I prefer to position the cursor explicitly, rather than using <CR><LF> with VMI; there are sequences available to allow positioning by row (at current VMI setting), decipoint or PCL unit (at current PCL units per inch setting).

Another general point: I assume that you are switching between the CMY palette, and the monochrome palette, because the BLACK in the CMY palette is a composite (multi-colour) whereas the BLACK in the monochrome palette perhaps uses only the black cartridge? [I don't know, as I have no direct experience of Inkjet devices.]
 
DansDadUK: Thanks for your analysis.
test1: prints as I expect.
test2: I don't understand why I'm getting a blank line
instead of "Red"

I had expected the escape sequence:
<esc>*r-3U
to select the CMY palette, and

<esc>*v6SRed
to change the current color to red, and then print
the word "Red" in red ink, and

<esc>*r1U<esc>*v1S
to change back to the monochrome palette and select
black.

Why is the 2nd line blank instead of printing the
word "Red"??

As far as the <cr><lf> cursor positioning, this is an old program that was set up to print factory work orders on a line printer, ie: print a line of text, do a <cr><lf> and print another line of text, and eventually a <page eject> at the bottom of the page, etc. Several years ago, I "bolded" some of the text by surrounding it with PCL escape sequences (eg: <esc><bold>TEXT<esc><normal>). Now I've been asked to change the color of the text as well. I had hoped I would be able to use the same technique of adding an escape sequence to change the color before the selected text and then a following escape sequence to change the color back to black; eg:
<esc><ChangeColorToRed>TEXT<esc><BackToBlack>

and end up with a work order that looks like the current one, except all the part numbers are now red.
 
Sorry; I should have said:

Test1: prints as you expect.
Test2: second line is blank rather than "Red"
Test3: second line is blank rather than "Red"
Test4: second line is unreadable because height is very small

but my eye was deceived by the very similar constructs for tests 2 and 3.

Another point which I didn't mention before was that the first line of each test as shown contained either <esc>*vSCyan or <esc>V1SCyan, which I assumed were both 'typos' (and should have been <esc>*v1SCyan), otherwise you would not have got Cyan on the first line.

I still can't explain your symptoms, given the information that you've provided so far.

[I assume that Inkjet1200 devices (with which I've no experience) do properly understand PCL5c colour sequences, as would be understood by a LaserJet device.]

If you can 'print to file' a sample of your output "text + embedded PCL", send it to "DansDad at btinternet dot com" and I'll see if that gives any more clues; bear in mind that mailbox gets a lot of (filtered) spam, so I might not get it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top