Printing
[1/3] from: hijim::pronet::net at: 28-Apr-2003 19:40
Printing
Hi Steven,
I use these functions for line printing on my HP-895Cse. It has built-in fonts. I'm not
sure if most printers still do.
lprint: func [x] [write %//prn join x newline] ; print line and cr
lprin: func [x] [write %//prn x] ; print line
cr: does [write %//prn newline] ; carriage return
ff: does [write %//prn #"^l"] ; formfeed
I also use a free download called txtprint.exe to print in columns and in dirrerent fonts
and sizes. It prints through the HP Windows print driver.
I also have a print function for printing from a text-area.
btn green / 1.8 "Print" [
if my-area/text <> none [
write %//prn format copy my-area/text
]
]
The format function:
format: func [prn-txt /local count] [
insert prn-txt " " ; margin of 5
replace/all prn-txt "^/" "^/ "
count: 0
forall prn-txt [
if (first prn-txt) = newline [count: 0]
if all [
count >= 76 ; wraps at 70 characters
find/reverse prn-txt " "
] [
prn-txt: find/reverse prn-txt " "
change prn-txt newline
prn-txt: insert next prn-txt " " ; margin of 5
count: 5
]
count: count + 1
]
trim/tail prn-txt
append prn-txt "^/^L"
head prn-txt
]
I hope this helps,
Jim
[2/3] from: Al:Bri:xtra at: 29-Apr-2003 23:12
Jim wrote:
> cr: does [write %//prn newline] ; carriage return
Be careful here. You're overwriting the value of a word in Rebol:
>> cr
== #"^M"
Andrew Martin
ICQ: 26227169 http://Valley.WebPictureBook.com/
[3/3] from: hijim:pronet at: 29-Apr-2003 6:55
Thanks Andrew, I'll change that to:
cret: does [write %//prn newline] ; carriage return