summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/xetexdir/xetex.ch
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2012-04-30 06:09:18 +0000
committerKhaled Hosny <khaledhosny@eglug.org>2012-04-30 06:09:18 +0000
commit6bd71f27b23982f4b367d58f9ea9f07ef3a59afa (patch)
treed8645cba9f47fd28a54373e058b9f0b44a9f25cc /Build/source/texk/web2c/xetexdir/xetex.ch
parent8c5d600ac54cee93435e3456b48bbb8c522882e6 (diff)
Merge changes from XeTeX repository
git-svn-id: svn://tug.org/texlive/trunk@26159 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/xetexdir/xetex.ch')
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex.ch72
1 files changed, 50 insertions, 22 deletions
diff --git a/Build/source/texk/web2c/xetexdir/xetex.ch b/Build/source/texk/web2c/xetexdir/xetex.ch
index ddf6b5a5a6d..d90c3fd5a5b 100644
--- a/Build/source/texk/web2c/xetexdir/xetex.ch
+++ b/Build/source/texk/web2c/xetexdir/xetex.ch
@@ -4140,7 +4140,7 @@ end;
@d accent_noad=over_noad+1 {|type| of a noad for accented subformulas}
@d fixed_acc=1 {|subtype| for non growing math accents}
@d bottom_acc=2 {|subtype| for bottom math accents}
-@d is_bottom_acc(#)==(subtype(#)=bottom_acc) or (subtype(#)=bottom_acc+fixed_acc)
+@d is_bottom_acc(#)==((subtype(#)=bottom_acc) or (subtype(#)=bottom_acc+fixed_acc))
@z
@x
@@ -4715,7 +4715,42 @@ if char_exists(cur_i) then
x:=clean_box(nucleus(q),cramped_style(cur_style)); w:=width(x); h:=height(x);
@<Switch to a larger accent if available and appropriate@>;
if h<x_height(f) then delta:=h@+else delta:=x_height(f);
+ if (math_type(supscr(q))<>empty)or(math_type(subscr(q))<>empty) then
+ if math_type(nucleus(q))=math_char then
+ @<Swap the subscript and superscript into box |x|@>;
+ y:=char_box(f,c);
+ shift_amount(y):=s+half(w-width(y));
+ width(y):=0; p:=new_kern(-delta); link(p):=x; link(y):=p;
+ y:=vpack(y,natural); width(y):=width(x);
+ if height(y)<h then @<Make the height of box |y| equal to |h|@>;
+ info(nucleus(q)):=y;
+ math_type(nucleus(q)):=sub_box;
+ end;
+end;
@y
+function compute_ot_math_accent_pos(@!p:pointer):scaled;
+var
+ @!q,@!r:pointer;
+ @!s,@!g:scaled;
+begin
+ if (math_type(nucleus(p))=math_char) then begin
+ fetch(nucleus(p));
+ q:=new_native_character(cur_f, qo(cur_c));
+ g:=get_native_glyph(q, 0);
+ s:=get_ot_math_accent_pos(cur_f, g);
+ end else begin
+ if (math_type(nucleus(p))=sub_mlist) then begin
+ r:=info(nucleus(p));
+ if (r<>null) and (type(r)=accent_noad) then
+ s:=compute_ot_math_accent_pos(r)
+ else
+ s:=@"7FFFFFFF;
+ end else
+ s:=@"7FFFFFFF;
+ end;
+ compute_ot_math_accent_pos:=s;
+end;
+
procedure make_math_accent(@!q:pointer);
label done,done1;
var p,@!x,@!y:pointer; {temporary registers for box construction}
@@ -4723,16 +4758,16 @@ var p,@!x,@!y:pointer; {temporary registers for box construction}
@!c,@!g:integer; {accent character}
@!f:internal_font_number; {its font}
@!i:four_quarters; {its |char_info|}
-@!s:scaled; {amount to skew the accent to the right}
+@!s,@!sa:scaled; {amount to skew the accent to the right}
@!h:scaled; {height of character being accented}
@!delta:scaled; {space to remove between accent and accentee}
-@!w,@!wa,@!w2:scaled; {width of the accentee, not including sub/superscripts}
+@!w,@!w2:scaled; {width of the accentee, not including sub/superscripts}
@!ot_assembly_ptr:void_pointer;
begin fetch(accent_chr(q));
x:=null;
if is_native_font(cur_f) then
begin c:=cur_c; f:=cur_f;
- s:=0; {@@<Compute the amount of skew@@>;}
+ if not is_bottom_acc(q) then s:=compute_ot_math_accent_pos(q);
x:=clean_box(nucleus(q),cramped_style(cur_style)); w:=width(x); h:=height(x);
end
else if char_exists(cur_i) then
@@ -4747,15 +4782,9 @@ if x<>null then begin
else if h<get_ot_math_constant(f, accentBaseHeight) then delta:=h@+else delta:=get_ot_math_constant(f, accentBaseHeight)
else
if h<x_height(f) then delta:=h@+else delta:=x_height(f);
-@z
-
-@x
- y:=char_box(f,c);
- shift_amount(y):=s+half(w-width(y));
- width(y):=0; p:=new_kern(-delta); link(p):=x; link(y):=p;
- y:=vpack(y,natural); width(y):=width(x);
- if height(y)<h then @<Make the height of box |y| equal to |h|@>;
-@y
+ if (math_type(supscr(q))<>empty)or(math_type(subscr(q))<>empty) then
+ if math_type(nucleus(q))=math_char then
+ @<Swap the subscript and superscript into box |x|@>;
y:=char_box(f,c);
if is_native_font(f) then begin
{turn the |native_word| node into a |native_glyph| one}
@@ -4769,15 +4798,10 @@ if x<>null then begin
@<Switch to a larger native-font accent if available and appropriate@>;
{determine horiz positioning}
- wa:=get_ot_math_accent_pos(f,native_glyph(p));
- if wa=@"7FFFFFFF then wa:=half(width(y));
- p:=list_ptr(x);
- if (p<>null) and is_glyph_node(p) and (math_type(nucleus(q))=math_char) then begin
- w2:=get_ot_math_accent_pos(native_font(p), native_glyph(p));
- if w2=@"7FFFFFFF then w:=half(w) else w:=w2;
- end else
- w:=half(w);
- shift_amount(y):=s+w-wa;
+ sa:=get_ot_math_accent_pos(f,native_glyph(p));
+ if sa=@"7FFFFFFF then sa:=half(width(y));
+ if is_bottom_acc(q) or (s=@"7FFFFFFF) then s:=half(w);
+ shift_amount(y):=s-sa;
end else
shift_amount(y):=s+half(w-width(y));
width(y):=0;
@@ -4788,6 +4812,10 @@ if x<>null then begin
if height(y)<h then @<Make the height of box |y| equal to |h|@>;
end;
width(y):=width(x);
+ info(nucleus(q)):=y;
+ math_type(nucleus(q)):=sub_box;
+ end;
+end;
@z
@x