comparison lisp/ps-mule.el @ 24721:25eb63742593

(ps-mule-prologue): Fix the definition of DefFontMule to correctly reflect the value of BaseLineOffset in RelativeCompose. Now the value of RelativeCompose is an array of low and high positions. (ps-mule-cmpchar-prologue): Adjust the definition of BC, EC, and RLC for the above change.
author Kenichi Handa <handa@m17n.org>
date Thu, 13 May 1999 06:40:05 +0000
parents fded44022dc6
children 4321a26f6594
comparison
equal deleted inserted replaced
24720:71c05fbebaba 24721:25eb63742593
572 "%%%% Start of Mule Section 572 "%%%% Start of Mule Section
573 573
574 %% Working dictionary for general use. 574 %% Working dictionary for general use.
575 /MuleDict 10 dict def 575 /MuleDict 10 dict def
576 576
577 %% Adjust /RelativeCompose properly by checking /BaselineOffset.
578 /AdjustRelativeCompose { % fontdict |- fontdict
579 dup length 2 add dict begin
580 { 1 index /FID ne { def } { pop pop } ifelse } forall
581 currentdict /BaselineOffset known {
582 BaselineOffset false eq { /BaselinfOffset 0 def } if
583 } {
584 /BaselineOffset 0 def
585 } ifelse
586 currentdict /RelativeCompose known not {
587 /RelativeCompose [ 0 0 ] def
588 } {
589 RelativeCompose false ne {
590 [ BaselineOffset RelativeCompose BaselineOffset add
591 [ FontMatrix { FontSize div } forall ] transform ]
592 /RelativeCompose exch def
593 } if
594 } ifelse
595 currentdict
596 end
597 } def
598
577 %% Define already scaled font for non-ASCII character sets. 599 %% Define already scaled font for non-ASCII character sets.
578 /DefFontMule { % fontname size basefont |- -- 600 /DefFontMule { % fontname size basefont |- --
579 findfont exch scalefont definefont pop 601 findfont exch scalefont AdjustRelativeCompose definefont pop
580 } bind def 602 } bind def
581 603
582 %% Define already scaled font for ASCII character sets. 604 %% Define already scaled font for ASCII character sets.
583 /DefAsciiFontMule { % fontname size basefont |- 605 /DefAsciiFontMule { % fontname size basefont |-
584 MuleDict begin 606 MuleDict begin
585 findfont dup /Encoding get /ISOLatin1Encoding exch def 607 findfont dup /Encoding get /ISOLatin1Encoding exch def
586 exch scalefont reencodeFontISO 608 exch scalefont AdjustRelativeCompose reencodeFontISO
587 end 609 end
588 } def 610 } def
589 611
590 %% Set the specified non-ASCII font to use. It doesn't install 612 %% Set the specified non-ASCII font to use. It doesn't install
591 %% Ascent, etc. 613 %% Ascent, etc.
725 /GetPathBox { % str |- -- 747 /GetPathBox { % str |- --
726 gsave 748 gsave
727 currentfont /FontType get 3 eq { %ifelse 749 currentfont /FontType get 3 eq { %ifelse
728 stringwidth pop pop 750 stringwidth pop pop
729 } { 751 } {
730 currentpoint /y exch def pop 752 currentpoint /y exch def /x exch def
731 false charpath flattenpath pathbbox 753 false charpath flattenpath pathbbox
732 y sub /URY exch def pop 754 y sub /URY exch def x sub /URX exch def
733 y sub /LLY exch def pop 755 y sub /LLY exch def x sub /LLX exch def
734 } ifelse 756 } ifelse
735 grestore 757 grestore
736 } bind def 758 } bind def
737 759
738 %% Beginning of composite char. 760 %% Beginning of composite char.
750 /Effect Effect 1 2 add 4 add 16 add and def 772 /Effect Effect 1 2 add 4 add 16 add and def
751 /f0 findfont setfont ( ) 0 CmpcharWidth getinterval S 773 /f0 findfont setfont ( ) 0 CmpcharWidth getinterval S
752 grestore 774 grestore
753 /Effect Effectsave 8 32 add and def % enable only shadow and outline 775 /Effect Effectsave 8 32 add and def % enable only shadow and outline
754 false BG 776 false BG
755 gsave SpaceWidth mul 0 rmoveto dup GetPathBox S grestore 777 gsave
778 SpaceWidth mul 0 rmoveto dup GetPathBox S
779 /RIGHT currentpoint pop def
780 grestore
756 /y currentpoint exch pop def 781 /y currentpoint exch pop def
757 /HIGH URY y add def /LOW LLY y add def 782 /HIGH URY y add def /LOW LLY y add def
758 } bind def 783 } bind def
759 784
760 %% End of composite char. 785 %% End of composite char.
761 /EC { % -- |- -- 786 /EC { % -- |- --
762 /bg bgsave def /bgcolor bgcolorsave def 787 /bg bgsave def /bgcolor bgcolorsave def
763 /Effect Effectsave def 788 /Effect Effectsave def
764 /Cmpchar false def 789 /Cmpchar false def
765 CmpcharWidth SpaceWidth mul 0 rmoveto 790 CmpcharRelativeCompose false eq {
791 CmpcharWidth SpaceWidth mul 0 rmoveto
792 } {
793 RIGHT currentpoint exch pop moveto
794 } ifelse
766 } bind def 795 } bind def
767 796
768 %% Rule base composition 797 %% Rule base composition
769 /RBC { % str xoff gref nref |- -- 798 /RBC { % str xoff gref nref |- --
770 /nref exch def /gref exch def 799 /nref exch def /gref exch def
779 top HIGH gt { /HIGH top def } if 808 top HIGH gt { /HIGH top def } if
780 btm LOW lt { /LOW btm def } if 809 btm LOW lt { /LOW btm def } if
781 currentpoint pop btm LLY sub moveto 810 currentpoint pop btm LLY sub moveto
782 S 811 S
783 grestore 812 grestore
813 /CmpcharRelativeCompose false def
784 } bind def 814 } bind def
785 815
786 %% Relative composition 816 %% Relative composition
787 /RLC { % str |- -- 817 /RLC { % str |- --
788 gsave 818 gsave
789 dup GetPathBox 819 dup GetPathBox
790 CmpcharRelativeCompose type /integertype eq { 820 LLX 0 lt { RIGHT currentpoint exch pop moveto } if
791 LLY CmpcharRelativeCompose gt { % compose on top 821 CmpcharRelativeCompose type /arraytype eq {
822 LLY CmpcharRelativeCompose 1 get gt { % compose on top
792 currentpoint pop HIGH LLY sub CmpcharRelativeSkip add moveto 823 currentpoint pop HIGH LLY sub CmpcharRelativeSkip add moveto
793 /HIGH HIGH URY LLY sub add CmpcharRelativeSkip add def 824 /HIGH HIGH URY LLY sub add CmpcharRelativeSkip add def
794 } { URY 0 le { % compose under bottom 825 } { URY CmpcharRelativeCompose 0 get le { % compose under bottom
795 currentpoint pop LOW LLY add CmpcharRelativeSkip sub moveto 826 currentpoint pop LOW URY sub CmpcharRelativeSkip sub moveto
796 /LOW LOW URY LLY sub sub CmpcharRelativeSkip sub def 827 /LOW LOW URY LLY sub sub CmpcharRelativeSkip sub def
797 } if } ifelse } if 828 } {
829 /y currentpoint exch pop def
830 y URY add dup HIGH gt { /HIGH exch def } { pop } ifelse
831 y LLY add dup LOW lt { /LOW exch def } { pop } ifelse
832 } ifelse } ifelse } if
798 S 833 S
799 grestore 834 grestore
800 } bind def 835 } bind def
801 %%%% End of composite character handler 836 %%%% End of composite character handler
802 837
956 GlobalCharName GetBitmap /bmp exch def 991 GlobalCharName GetBitmap /bmp exch def
957 %% bmp == [ DWIDTH BBX-WIDTH BBX-HEIGHT BBX-XOFF BBX-YOFF BITMAP ] 992 %% bmp == [ DWIDTH BBX-WIDTH BBX-HEIGHT BBX-XOFF BBX-YOFF BITMAP ]
958 Cmpchar { %ifelse 993 Cmpchar { %ifelse
959 /FontMatrix get [ exch { size div } forall ] /mtrx exch def 994 /FontMatrix get [ exch { size div } forall ] /mtrx exch def
960 bmp 3 get bmp 4 get mtrx transform 995 bmp 3 get bmp 4 get mtrx transform
961 /LLY exch def pop 996 /LLY exch def /LLX exch def
962 bmp 1 get bmp 3 get add bmp 2 get bmp 4 get add mtrx transform 997 bmp 1 get bmp 3 get add bmp 2 get bmp 4 get add mtrx transform
963 /URY exch def pop 998 /URY exch def /URX exch def
964 } { 999 } {
965 pop 1000 pop
966 } ifelse 1001 } ifelse
967 /FirstCode -1 store 1002 /FirstCode -1 store
968 1003