changeset 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 71c05fbebaba
children 4321a26f6594
files lisp/ps-mule.el
diffstat 1 files changed, 49 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ps-mule.el	Wed May 12 08:41:32 1999 +0000
+++ b/lisp/ps-mule.el	Thu May 13 06:40:05 1999 +0000
@@ -574,16 +574,38 @@
 %% Working dictionary for general use.
 /MuleDict 10 dict def
 
+%% Adjust /RelativeCompose properly by checking /BaselineOffset.
+/AdjustRelativeCompose {	% fontdict  |-  fontdict
+  dup length 2 add dict begin
+    { 1 index /FID ne { def } { pop pop } ifelse } forall
+    currentdict /BaselineOffset known {
+	BaselineOffset false eq { /BaselinfOffset 0 def } if
+    } {
+      /BaselineOffset 0 def
+    } ifelse
+    currentdict /RelativeCompose known not {
+      /RelativeCompose [ 0 0 ] def
+    } {
+      RelativeCompose false ne {
+        [ BaselineOffset RelativeCompose BaselineOffset add
+          [ FontMatrix { FontSize div } forall ] transform ]
+        /RelativeCompose exch def
+      } if
+    } ifelse
+    currentdict
+  end
+} def
+
 %% Define already scaled font for non-ASCII character sets.
 /DefFontMule {			% fontname size basefont  |-  --
-  findfont exch scalefont definefont pop
+  findfont exch scalefont AdjustRelativeCompose definefont pop
 } bind def
 
 %% Define already scaled font for ASCII character sets.
 /DefAsciiFontMule {		% fontname size basefont  |-
   MuleDict begin
   findfont dup /Encoding get /ISOLatin1Encoding exch def
-  exch scalefont reencodeFontISO
+  exch scalefont AdjustRelativeCompose reencodeFontISO
   end
 } def
 
@@ -727,10 +749,10 @@
     currentfont /FontType get 3 eq { %ifelse
 	stringwidth pop pop
     } {
-	currentpoint /y exch def pop
+	currentpoint /y exch def /x exch def
 	false charpath flattenpath pathbbox
-	y sub /URY exch def pop
-	y sub /LLY exch def pop
+	y sub /URY exch def x sub /URX exch def
+	y sub /LLY exch def x sub /LLX exch def
     } ifelse
     grestore
 } bind def
@@ -752,7 +774,10 @@
     grestore
     /Effect Effectsave 8 32 add and def	% enable only shadow and outline
     false BG
-    gsave SpaceWidth mul 0 rmoveto dup GetPathBox S grestore
+    gsave
+	SpaceWidth mul 0 rmoveto dup GetPathBox S
+	/RIGHT currentpoint pop def
+    grestore
     /y currentpoint exch pop def
     /HIGH URY y add def /LOW LLY y add def
 } bind def
@@ -762,7 +787,11 @@
     /bg bgsave def /bgcolor bgcolorsave def
     /Effect Effectsave def
     /Cmpchar false def
-    CmpcharWidth SpaceWidth mul 0 rmoveto
+    CmpcharRelativeCompose false eq {
+	CmpcharWidth SpaceWidth mul 0 rmoveto
+    } {
+	RIGHT currentpoint exch pop moveto
+    } ifelse
 } bind def
 
 %% Rule base composition
@@ -781,20 +810,26 @@
     currentpoint pop btm LLY sub moveto
     S
     grestore
+    /CmpcharRelativeCompose false def
 } bind def
 
 %% Relative composition
 /RLC {				% str  |-  --
     gsave
     dup GetPathBox
-    CmpcharRelativeCompose type /integertype eq {
-	LLY CmpcharRelativeCompose gt {	% compose on top
+    LLX 0 lt { RIGHT currentpoint exch pop moveto } if
+    CmpcharRelativeCompose type /arraytype eq {
+	LLY CmpcharRelativeCompose 1 get gt {	% compose on top
 	    currentpoint pop HIGH LLY sub CmpcharRelativeSkip add moveto
 	    /HIGH HIGH URY LLY sub add CmpcharRelativeSkip add def
-	} { URY 0 le {			% compose under bottom
-	    currentpoint pop LOW LLY add CmpcharRelativeSkip sub moveto
+	} { URY CmpcharRelativeCompose 0 get le { % compose under bottom
+	    currentpoint pop LOW URY sub CmpcharRelativeSkip sub moveto
 	    /LOW LOW URY LLY sub sub CmpcharRelativeSkip sub def
-    } if } ifelse } if
+	} {
+	    /y currentpoint exch pop def
+	    y URY add dup HIGH gt { /HIGH exch def } { pop } ifelse
+	    y LLY add dup LOW lt { /LOW exch def } { pop } ifelse
+	} ifelse } ifelse } if
     S
     grestore
 } bind def
@@ -958,9 +993,9 @@
 	Cmpchar { %ifelse
 	    /FontMatrix get [ exch { size div } forall ] /mtrx exch def
 	    bmp 3 get bmp 4 get mtrx transform
-	    /LLY exch def pop
+	    /LLY exch def /LLX exch def
 	    bmp 1 get bmp 3 get add bmp 2 get bmp 4 get add mtrx transform
-	    /URY exch def pop
+	    /URY exch def /URX exch def
 	} {
 	    pop
 	} ifelse