From faadaac35c4c8723dcd38bd67cfabefadd912073 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 25 Mar 2012 17:03:56 +0000 Subject: Merge changes from XeTeX repository git-svn-id: svn://tug.org/texlive/trunk@25739 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/xetexdir/XeTeX_ext.h | 9 ++ Build/source/texk/web2c/xetexdir/xetex.ch | 184 ++++++++++++++++++++------- 2 files changed, 150 insertions(+), 43 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h index 7818aa4b3ca..10b60139990 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h @@ -313,6 +313,15 @@ typedef void* ATSUStyle; /* dummy declaration just so the stubs can compile */ void atsugetfontmetrics(ATSUStyle style, integer* ascent, integer* descent, integer* xheight, integer* capheight, integer* slant); #ifdef XETEX_MAC + +#if defined(MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7) + #include + /* These functions have been removed on 10.7; as a workaround, just do + * a cast as the ATSFontRef and ATSUFontID should have the same value... */ + #define FMGetFontFromATSFontRef(x) ((ATSUFontID) x) + #define FMGetATSFontRefFromFont(x) ((ATSFontRef) x) +#endif + /* functions in XeTeX_mac.c */ void* loadAATfont(ATSFontRef fontRef, integer scaled_size, const char* cp1); void DoAtsuiLayout(void* node, int justify); diff --git a/Build/source/texk/web2c/xetexdir/xetex.ch b/Build/source/texk/web2c/xetexdir/xetex.ch index 551edaa9043..a23ae00dad8 100644 --- a/Build/source/texk/web2c/xetexdir/xetex.ch +++ b/Build/source/texk/web2c/xetexdir/xetex.ch @@ -4260,7 +4260,7 @@ macro capabilities. This seems a bit ugly, but it works. begin f := fam_fnt(2 + size_code); if is_ot_font(f) then - rval := get_native_mathsy_param(f, #) + rval := get_native_mathsy_param(cur_f, #) else rval := mathsy(#); define_mathsy_end @@ -4309,7 +4309,7 @@ define_mathsy_accessor(axis_height)(22)(axis_height); begin f := fam_fnt(3 + cur_size); if is_ot_font(f) then - rval := get_native_mathex_param(f, #) + rval := get_native_mathex_param(cur_f, #) else rval := mathex(#); define_mathex_end @@ -4341,8 +4341,19 @@ begin type(p):=whatsit_node; subtype(p):=glyph_node; native_font(p):=f; native_glyph(p):=g; set_native_glyph_metrics(p, 1); - link(p):=list_ptr(b); list_ptr(b):=p; - height(b):=height(p); width(b):=width(p); + if type(b)=hlist_node then begin + q:=list_ptr(b); + if q=null then list_ptr(b):=p else begin + while link(q)<>null do q:=link(q); + link(q):=p; + if (height(b) < height(p)) then height(b):=height(p); + if (depth(b) < depth(p)) then depth(b):=depth(p); + end; + end else begin + link(p):=list_ptr(b); list_ptr(b):=p; + height(b):=height(p); + if (width(b) < width(p)) then width(b):=width(p); + end; end; procedure stack_glue_into_box(@!b:pointer;@!min,max:scaled); @@ -4352,24 +4363,35 @@ begin width(q):=min; stretch(q):=max-min; p:=new_glue(q); - link(p):=list_ptr(b); list_ptr(b):=p; - height(b):=height(p); width(b):=width(p); + if type(b)=hlist_node then begin + q:=list_ptr(b); + if q=null then list_ptr(b):=p else begin + while link(q)<>null do q:=link(q); + link(q):=p; + end; + end else begin + link(p):=list_ptr(b); list_ptr(b):=p; + height(b):=height(p); width(b):=width(p); + end; end; -function build_opentype_assembly(@!f:internal_font_number;@!a:void_pointer;@!h:scaled):pointer; - {return a box with height at least |h|, using font |f|, with glyph assembly info from |a|} +function build_opentype_assembly(@!f:internal_font_number;@!a:void_pointer;@!s:scaled;@!horiz:boolean):pointer; + {return a box with height/width at least |s|, using font |f|, with glyph assembly info from |a|} var b:pointer; {the box we're constructing} n:integer; {the number of repetitions of each extender} i,j:integer; {indexes} g:integer; {glyph code} p:pointer; {temp pointer} - h_max,o,oo,prev_o,min_o:scaled; + s_max,o,oo,prev_o,min_o:scaled; no_extenders: boolean; - nat,str:scaled; {natural height, stretch} + nat,str:scaled; {natural size, stretch} begin b:=new_null_box; - type(b):=vlist_node; + if horiz then + type(b):=hlist_node + else + type(b):=vlist_node; {figure out how many repeats of each extender to use} n:=-1; @@ -4377,8 +4399,8 @@ begin min_o:=ot_min_connector_overlap(f); repeat n:=n+1; - {calc max possible height with this number of extenders} - h_max:=0; + {calc max possible size with this number of extenders} + s_max:=0; prev_o:=0; for i:=0 to ot_part_count(a)-1 do begin if ot_part_is_extender(a, i) then begin @@ -4387,18 +4409,18 @@ begin o:=ot_part_start_connector(f, a, i); if min_o=h) or no_extenders; + until (s_max>=s) or no_extenders; {assemble box using |n| copies of each extender, with appropriate glue wherever an overlap occurs} @@ -4427,11 +4449,15 @@ begin end; end; - {find natural height and total stretch of the box} + {find natural size and total stretch of the box} p:=list_ptr(b); nat:=0; str:=0; while p<>null do begin - if type(p)=whatsit_node then nat:=nat+height(p)+depth(p) - else if type(p)=glue_node then begin + if type(p)=whatsit_node then begin + if horiz then + nat:=nat+width(p) + else + nat:=nat+height(p)+depth(p); + end else if type(p)=glue_node then begin nat:=nat+width(glue_ptr(p)); str:=str+stretch(glue_ptr(p)); end; @@ -4439,12 +4465,23 @@ begin end; {set glue so as to stretch the connections if needed} + o:=0; depth(b):=0; - if (h>nat) and (str>0) then begin + if (s>nat) and (str>0) then begin + o:=(s-nat); + {don't stretch more than |str|} + if (o>str) then o:=str; glue_order(b):=normal; glue_sign(b):=stretching; - glue_set(b):=unfloat((h-nat)/str); - height(b):=nat+round(str*float(glue_set(b))); - end else height(b):=nat; + glue_set(b):=unfloat(o/str); + if horiz then + width(b):= nat+round(str*float(glue_set(b))) + else + height(b):=nat+round(str*float(glue_set(b))); + end else + if horiz then + width(b):=nat + else + height(b):=nat; build_opentype_assembly:=b; end; @@ -4487,7 +4524,7 @@ found: if f<>null_font then begin else begin {for OT fonts, c is the glyph ID to use} if ot_assembly_ptr<>nil then - b:=build_opentype_assembly(f, ot_assembly_ptr, v) + b:=build_opentype_assembly(f, ot_assembly_ptr, v, 0) else begin b:=new_null_box; type(b):=vlist_node; list_ptr(b):=get_node(glyph_node_size); type(list_ptr(b)):=whatsit_node; subtype(list_ptr(b)):=glyph_node; @@ -4666,6 +4703,7 @@ if char_exists(cur_i) then @; x:=clean_box(nucleus(q),cramped_style(cur_style)); w:=width(x); h:=height(x); @; + if h; end; if x<>null then begin + if is_ot_font(f) then + if hnull then begin @ @= @y @ @= - wa:=width(x); c:=native_glyph(p); a:=0; repeat g:=get_ot_math_variant(f, c, a, addressof(w2), 1); - if (w2>0) and (w2<=wa) then begin + if (w2>0) and (w2<=w) then begin native_glyph(p):=g; set_native_glyph_metrics(p, 1); incr(a); end; - until (w2<0) or (w2>=wa); -{ - |if (w2<0) then begin + until (w2<0) or (w2>=w); + if (w2<0) then begin ot_assembly_ptr:=get_ot_assembly_ptr(f, c, 1); if ot_assembly_ptr<>nil then begin free_node(p,glyph_node_size); - p:=build_opentype_assembly(cur_f, ot_assembly_ptr, w1); + p:=build_opentype_assembly(cur_f, ot_assembly_ptr, w, 1); list_ptr(y):=p; goto found; end; - end else| -} + end else set_native_glyph_metrics(p, 1); -{found:} +found: width(y):=width(p); height(y):=height(p); depth(y):=depth(p); if depth(y)<0 then depth(y):=0; @@ -4764,9 +4804,9 @@ begin if cur_style= -begin if is_ot_font(fam_fnt(3+cur_size)) then begin - if cur_style= -begin if is_ot_font(fam_fnt(3+cur_size)) then begin +begin if is_ot_font(cur_f) then begin delta:=half(thickness(q)); - if cur_style0 then native_glyph(p):=g; + if h2>0 then begin + native_glyph(p):=g; + set_native_glyph_metrics(p, 1); + end; incr(n); until (h2<0) or (h2>=h1); if (h2<0) then begin @@ -4872,7 +4915,7 @@ if math_type(nucleus(q))=math_char then ot_assembly_ptr:=get_ot_assembly_ptr(cur_f, c, 0); if ot_assembly_ptr<>nil then begin free_node(p,glyph_node_size); - p:=build_opentype_assembly(cur_f, ot_assembly_ptr, h1); + p:=build_opentype_assembly(cur_f, ot_assembly_ptr, h1, 0); list_ptr(x):=p; delta:=0; goto found; @@ -4962,6 +5005,61 @@ begin p:=new_hlist(q); if is_char_node(p) or (p<>null and is_native_word_node(p)) then @z +@x +clr:=height(x)-(abs(math_x_height(cur_size)*4) div 5); +@y +if is_ot_font(cur_f) then + clr:=height(x)-get_ot_math_constant(cur_f, subscriptTopMax) +else + clr:=height(x)-(abs(math_x_height(cur_size)*4) div 5); +@z + +@x +clr:=depth(x)+(abs(math_x_height(cur_size)) div 4); +@y +if is_ot_font(cur_f) then + clr:=depth(x)+get_ot_math_constant(cur_f, superscriptBottomMin) +else + clr:=depth(x)+(abs(math_x_height(cur_size)) div 4); +@z + +@x +@= +begin y:=clean_box(subscr(q),sub_style(cur_style)); +width(y):=width(y)+script_space; +if shift_down0 then + begin shift_down:=shift_down+clr; + clr:=(abs(math_x_height(cur_size)*4) div 5)-(shift_up-depth(x)); + if clr>0 then + begin shift_up:=shift_up+clr; + shift_down:=shift_down-clr; + end; + end; +@y +@= +begin y:=clean_box(subscr(q),sub_style(cur_style)); +width(y):=width(y)+script_space; +if shift_down0 then + begin shift_down:=shift_down+clr; + if is_ot_font(cur_f) then + clr:=get_ot_math_constant(cur_f, superscriptBottomMaxWithSubscript)-(shift_up-depth(x)) + else + clr:=(abs(math_x_height(cur_size)*4) div 5)-(shift_up-depth(x)); + if clr>0 then + begin shift_up:=shift_up+clr; + shift_down:=shift_down-clr; + end; + end; +@z + @x magic_offset:=str_start[math_spacing]-9*ord_noad @y -- cgit v1.2.3