diff options
| author | Gerd Moellmann | 2001-04-10 11:34:26 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-04-10 11:34:26 +0000 |
| commit | 7953b715e1d028245ac8ea5ec0ea75ed3cf4f13e (patch) | |
| tree | 0bfd6813928fa3290e7d208de0309f6c6972586f /etc | |
| parent | 319acba0f5507a95d5a85ca291723f9e243d4eee (diff) | |
| download | emacs-7953b715e1d028245ac8ea5ec0ea75ed3cf4f13e.tar.gz emacs-7953b715e1d028245ac8ea5ec0ea75ed3cf4f13e.zip | |
Footer implementation. Doc fix.
(doLineNumber): Code fix for line number color.
(BeginPage, BeginSheet, HeaderFramePath, HeaderFrame, HeaderText): Code
fix for footer implementation.
(TextStart, SetFooterLines, FooterFrameStart, doFramePath)
(FooterFramePath, doFrame, FooterFrame, FooterStart)
(HeaderOrFooterTextLines, HeaderOrFooterText, FooterText): New funs.
Diffstat (limited to 'etc')
| -rw-r--r-- | etc/ps-prin1.ps | 163 |
1 files changed, 114 insertions, 49 deletions
diff --git a/etc/ps-prin1.ps b/etc/ps-prin1.ps index d5e53e902c0..32e2529f577 100644 --- a/etc/ps-prin1.ps +++ b/etc/ps-prin1.ps | |||
| @@ -348,7 +348,7 @@ StandardEncoding 46 82 getinterval aload pop | |||
| 348 | LineNumber Lines ge or % or last line | 348 | LineNumber Lines ge or % or last line |
| 349 | {currentfont | 349 | {currentfont |
| 350 | gsave | 350 | gsave |
| 351 | 0.0 0.0 0.0 setrgbcolor | 351 | LineNumberColor SetColor |
| 352 | /L0 findfont setfont | 352 | /L0 findfont setfont |
| 353 | LineNumber Lines ge | 353 | LineNumber Lines ge |
| 354 | {(end )} | 354 | {(end )} |
| @@ -507,11 +507,14 @@ StandardEncoding 46 82 getinterval aload pop | |||
| 507 | printGlobalBackground | 507 | printGlobalBackground |
| 508 | printLocalBackground | 508 | printLocalBackground |
| 509 | }if | 509 | }if |
| 510 | PrintHeader{ | 510 | PrintOnlyOneHeader{ColumnIndex 1 eq}{true}ifelse |
| 511 | PrintOnlyOneHeader{ColumnIndex 1 eq}{true}ifelse{ | 511 | dup PrintHeader and{ |
| 512 | PrintHeaderFrame{HeaderFrame}if | 512 | PrintHeaderFrame{HeaderFrame}if |
| 513 | HeaderText | 513 | HeaderText |
| 514 | }if | 514 | }if |
| 515 | PrintFooter and{ | ||
| 516 | PrintFooterFrame{FooterFrame}if | ||
| 517 | FooterText | ||
| 515 | }if | 518 | }if |
| 516 | 0 PrintStartY moveto % move to where printing will start | 519 | 0 PrintStartY moveto % move to where printing will start |
| 517 | /LineNumber where | 520 | /LineNumber where |
| @@ -551,6 +554,15 @@ StandardEncoding 46 82 getinterval aload pop | |||
| 551 | }ifelse | 554 | }ifelse |
| 552 | }def | 555 | }def |
| 553 | 556 | ||
| 557 | /TextStart{ | ||
| 558 | LeftMargin BottomMargin | ||
| 559 | PrintFooter{ | ||
| 560 | FooterPad add | ||
| 561 | FooterLines FooterLineHeight mul add | ||
| 562 | FooterPad add | ||
| 563 | FooterOffset add}if | ||
| 564 | }def | ||
| 565 | |||
| 554 | % stack: number-of-pages-per-sheet |- -- | 566 | % stack: number-of-pages-per-sheet |- -- |
| 555 | /BeginSheet{ | 567 | /BeginSheet{ |
| 556 | /sheetState save def | 568 | /sheetState save def |
| @@ -605,14 +617,14 @@ StandardEncoding 46 82 getinterval aload pop | |||
| 605 | translate | 617 | translate |
| 606 | }if | 618 | }if |
| 607 | % ---- translate to lower left corner of TEXT | 619 | % ---- translate to lower left corner of TEXT |
| 608 | LeftMargin BottomMargin translate | 620 | TextStart translate |
| 609 | 621 | ||
| 610 | % ---- N-up printing | 622 | % ---- N-up printing |
| 611 | N-Up 1 gt N-Up-Border and pages-per-sheet 0 gt and{ | 623 | N-Up 1 gt N-Up-Border and pages-per-sheet 0 gt and{ |
| 612 | % ---- page border | 624 | % ---- page border |
| 613 | gsave | 625 | gsave |
| 614 | 0 setgray | 626 | 0 setgray |
| 615 | LeftMargin neg BottomMargin neg moveto | 627 | TextStart exch neg exch neg moveto |
| 616 | N-Up-Repeat | 628 | N-Up-Repeat |
| 617 | {N-Up-End | 629 | {N-Up-End |
| 618 | {gsave | 630 | {gsave |
| @@ -647,6 +659,15 @@ StandardEncoding 46 82 getinterval aload pop | |||
| 647 | /HeaderHeight exch def | 659 | /HeaderHeight exch def |
| 648 | }def | 660 | }def |
| 649 | 661 | ||
| 662 | /SetFooterLines{ % nb-lines -- | ||
| 663 | /FooterLines exch def | ||
| 664 | % ---- bottom up | ||
| 665 | FooterPad | ||
| 666 | FooterLines FooterLineHeight mul add | ||
| 667 | FooterPad add | ||
| 668 | /FooterHeight exch def | ||
| 669 | }def | ||
| 670 | |||
| 650 | % |---------| | 671 | % |---------| |
| 651 | % | tm | | 672 | % | tm | |
| 652 | % |---------| | 673 | % |---------| |
| @@ -655,36 +676,52 @@ StandardEncoding 46 82 getinterval aload pop | |||
| 655 | % | ho | | 676 | % | ho | |
| 656 | % |---------| | 677 | % |---------| |
| 657 | % | text | | 678 | % | text | |
| 679 | % |---------| | ||
| 680 | % | fo | | ||
| 681 | % |---------| | ||
| 682 | % | footer | | ||
| 658 | % |-+-------| <-- (0 0) | 683 | % |-+-------| <-- (0 0) |
| 659 | % | bm | | 684 | % | bm | |
| 660 | % |---------| | 685 | % |---------| |
| 661 | 686 | ||
| 662 | % -- |- x y | 687 | % -- |- x y |
| 663 | /HeaderFrameStart{0 PrintHeight HeaderOffset add}def | 688 | /HeaderFrameStart{0 PrintHeight HeaderOffset add}def |
| 664 | 689 | /FooterFrameStart{0 FooterHeight FooterOffset add neg}def | |
| 665 | /HeaderFramePath{ | 690 | |
| 666 | PrintHeaderWidth 0 rlineto | 691 | /doFramePath{ |
| 667 | 0 HeaderHeight rlineto | 692 | /h exch def |
| 668 | PrintHeaderWidth neg 0 rlineto | 693 | PrintHeaderWidth 0 rlineto |
| 669 | 0 HeaderHeight neg rlineto | 694 | 0 h rlineto |
| 695 | PrintHeaderWidth neg 0 rlineto | ||
| 696 | 0 h neg rlineto | ||
| 670 | }def | 697 | }def |
| 671 | 698 | ||
| 672 | /HeaderFrame{ | 699 | /HeaderFramePath{HeaderHeight doFramePath}def |
| 700 | /FooterFramePath{FooterHeight doFramePath}def | ||
| 701 | |||
| 702 | % /path-fun /start-fun vector-property doFrame | ||
| 703 | /doFrame{ | ||
| 704 | /vecFrame exch def | ||
| 705 | /startFrame exch load def | ||
| 706 | /pathFrame exch load def | ||
| 673 | gsave | 707 | gsave |
| 674 | 0.4 setlinewidth | 708 | vecFrame 2 get setlinewidth % frame border width |
| 675 | % ---- fill a black rectangle (the shadow of the next one) | 709 | % ---- do the shadow of the next rectangle |
| 676 | HeaderFrameStart moveto | 710 | startFrame moveto |
| 677 | 1 -1 rmoveto | 711 | 1 -1 rmoveto |
| 678 | HeaderFramePath | 712 | pathFrame |
| 679 | 0 setgray fill | 713 | vecFrame 4 get SetColor fill % frame shadow color |
| 680 | % ---- do the next rectangle ... | 714 | % ---- do the next rectangle ... |
| 681 | HeaderFrameStart moveto | 715 | startFrame moveto |
| 682 | HeaderFramePath | 716 | pathFrame |
| 683 | gsave 0.9 setgray fill grestore % filled with grey | 717 | gsave vecFrame 1 get SetColor fill grestore % frame background |
| 684 | gsave 0 setgray stroke grestore % drawn with black | 718 | gsave vecFrame 3 get SetColor stroke grestore % frame border color |
| 685 | grestore | 719 | grestore |
| 686 | }def | 720 | }def |
| 687 | 721 | ||
| 722 | /HeaderFrame{/HeaderFramePath /HeaderFrameStart HeaderFrameProperties doFrame}def | ||
| 723 | /FooterFrame{/FooterFramePath /FooterFrameStart FooterFrameProperties doFrame}def | ||
| 724 | |||
| 688 | /HeaderStart{ | 725 | /HeaderStart{ |
| 689 | HeaderFrameStart | 726 | HeaderFrameStart |
| 690 | exch HeaderPad add exch % horizontal pad | 727 | exch HeaderPad add exch % horizontal pad |
| @@ -694,6 +731,15 @@ StandardEncoding 46 82 getinterval aload pop | |||
| 694 | HeaderLineHeight HeaderLines 1 sub mul add | 731 | HeaderLineHeight HeaderLines 1 sub mul add |
| 695 | }def | 732 | }def |
| 696 | 733 | ||
| 734 | /FooterStart{ | ||
| 735 | FooterFrameStart | ||
| 736 | exch FooterPad add exch % horizontal pad | ||
| 737 | % ---- bottom up | ||
| 738 | FooterPad add % vertical pad | ||
| 739 | FooterDescent sub | ||
| 740 | FooterLineHeight FooterLines 1 sub mul add | ||
| 741 | }def | ||
| 742 | |||
| 697 | /strcat{ | 743 | /strcat{ |
| 698 | dup length 3 -1 roll dup length dup 4 -1 roll add string dup | 744 | dup length 3 -1 roll dup length dup 4 -1 roll add string dup |
| 699 | 0 5 -1 roll putinterval | 745 | 0 5 -1 roll putinterval |
| @@ -705,39 +751,58 @@ StandardEncoding 46 82 getinterval aload pop | |||
| 705 | ShowNofN{(/)strcat PageCount 32 string cvs strcat}if | 751 | ShowNofN{(/)strcat PageCount 32 string cvs strcat}if |
| 706 | }def | 752 | }def |
| 707 | 753 | ||
| 708 | /HeaderText{ | 754 | % lines is-right HeaderOrFooterTextLines |
| 709 | HeaderStart moveto | 755 | /HeaderOrFooterTextLines{ |
| 756 | /is_right exch def | ||
| 757 | HFStart moveto | ||
| 758 | { % ---- process the lines | ||
| 759 | aload pop | ||
| 760 | exch F | ||
| 761 | gsave | ||
| 762 | dup xcheck{exec}if | ||
| 763 | is_right{ | ||
| 764 | dup stringwidth pop | ||
| 765 | PrintHeaderWidth exch sub HFPad HFPad add sub 0 rmoveto | ||
| 766 | }if | ||
| 767 | HFColor SetColor | ||
| 768 | show | ||
| 769 | grestore | ||
| 770 | 0 HFLineHeight neg rmoveto | ||
| 771 | }forall | ||
| 772 | }def | ||
| 710 | 773 | ||
| 711 | HeaderLinesRight HeaderLinesLeft % -- rightLines leftLines | 774 | % right-lines left-lines /start lineheight pad fore-color HeaderOrFooterText |
| 775 | /HeaderOrFooterText{ | ||
| 776 | /HFColor exch def | ||
| 777 | /HFPad exch def | ||
| 778 | /HFLineHeight exch def | ||
| 779 | /HFStart exch load def | ||
| 712 | 780 | ||
| 713 | % ---- hack: `PN 1 and' == `PN 2 modulo' | 781 | % -- rightLines leftLines -- at stack |
| 714 | 782 | ||
| 783 | % ---- hack: `PN 1 and' == `PN 2 modulo' | ||
| 715 | % ---- if even page number and duplex, then exchange left and right | 784 | % ---- if even page number and duplex, then exchange left and right |
| 716 | PageNumber 1 and 0 eq SwitchHeader and{exch}if | 785 | PageNumber 1 and 0 eq SwitchHeader and{exch}if |
| 717 | 786 | ||
| 718 | { % ---- process the left lines | 787 | % ---- process the left lines |
| 719 | aload pop | 788 | false HeaderOrFooterTextLines |
| 720 | exch F | ||
| 721 | gsave | ||
| 722 | dup xcheck{exec}if | ||
| 723 | show | ||
| 724 | grestore | ||
| 725 | 0 HeaderLineHeight neg rmoveto | ||
| 726 | }forall | ||
| 727 | 789 | ||
| 728 | HeaderStart moveto | 790 | % ---- process the right lines |
| 791 | true HeaderOrFooterTextLines | ||
| 792 | }def | ||
| 729 | 793 | ||
| 730 | { % ---- process the right lines | 794 | /HeaderText{ |
| 731 | aload pop | 795 | HeaderLinesRight HeaderLinesLeft |
| 732 | exch F | 796 | /HeaderStart HeaderLineHeight HeaderPad |
| 733 | gsave | 797 | HeaderFrameProperties 0 get |
| 734 | dup xcheck{exec}if | 798 | HeaderOrFooterText |
| 735 | dup stringwidth pop | 799 | }def |
| 736 | PrintHeaderWidth exch sub HeaderPad 2 mul sub 0 rmoveto | 800 | |
| 737 | show | 801 | /FooterText{ |
| 738 | grestore | 802 | FooterLinesRight FooterLinesLeft |
| 739 | 0 HeaderLineHeight neg rmoveto | 803 | /FooterStart FooterLineHeight FooterPad |
| 740 | }forall | 804 | FooterFrameProperties 0 get |
| 805 | HeaderOrFooterText | ||
| 741 | }def | 806 | }def |
| 742 | 807 | ||
| 743 | /ReportFontInfo{ | 808 | /ReportFontInfo{ |