diff options
23 files changed, 859 insertions, 590 deletions
diff --git a/context/data/scite/lexers/data/scite-context-data-metafun.lua b/context/data/scite/lexers/data/scite-context-data-metafun.lua index eac24016c..076cf2839 100644 --- a/context/data/scite/lexers/data/scite-context-data-metafun.lua +++ b/context/data/scite/lexers/data/scite-context-data-metafun.lua @@ -1,4 +1,4 @@ return { - ["commands"]={ "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "acosh", "asinh", "sinh", "cosh", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "smoothed", "cornered", "superellipsed", "randomized", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withlinearshading", "withcircularshading", "withfromshadecolor", "withtoshadecolor", "withshading", "shadedinto", "withcircularshade", "withlinearshade", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "withmask", "figure", "register", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "textext", "thetextext", "rawtextext", "textextoffset", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "asgroup", "infont", "set_linear_vector", "linear_shade", "define_linear_shade", "define_circular_linear_shade", "define_sampled_linear_shade", "set_circular_vector", "circular_shade", "define_circular_shade", "define_circular_linear_shade", "define_sampled_circular_shade", "space", "CRLF", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedpath", "constructedpairs", "punkedfunction", "curvedfunction", "tightfunction", "punkedpath", "curvedpath", "tightpath", "punkedpairs", "curvedpairs", "tightpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "normalfill", "normaldraw", "visualizepaths", "naturalizepaths", "drawboundary", "drawwholepath", "visualizeddraw", "visualizedfill", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions" }, + ["commands"]={ "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "acosh", "asinh", "sinh", "cosh", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "smoothed", "cornered", "superellipsed", "randomized", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withlinearshading", "withcircularshading", "withfromshadecolor", "withtoshadecolor", "withshading", "shadedinto", "withcircularshade", "withlinearshade", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "withmask", "figure", "register", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "textext", "thetextext", "rawtextext", "textextoffset", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "asgroup", "infont", "set_linear_vector", "linear_shade", "define_linear_shade", "define_circular_linear_shade", "define_sampled_linear_shade", "set_circular_vector", "circular_shade", "define_circular_shade", "define_circular_linear_shade", "define_sampled_circular_shade", "space", "CRLF", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedpath", "constructedpairs", "punkedfunction", "curvedfunction", "tightfunction", "punkedpath", "curvedpath", "tightpath", "punkedpairs", "curvedpairs", "tightpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "normalfill", "normaldraw", "visualizepaths", "naturalizepaths", "drawboundary", "drawwholepath", "visualizeddraw", "visualizedfill", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "decorated", "redecorated", "undecorated" }, ["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "textextoffset", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent" }, }
\ No newline at end of file diff --git a/context/data/scite/scite-context-data-metafun.properties b/context/data/scite/scite-context-data-metafun.properties index f53048363..a33928d9e 100644 --- a/context/data/scite/scite-context-data-metafun.properties +++ b/context/data/scite/scite-context-data-metafun.properties @@ -42,7 +42,8 @@ normalfill normaldraw visualizepaths naturalizepaths drawboundary \ drawwholepath visualizeddraw visualizedfill draworigin drawboundingbox \ drawpath drawpoint drawpoints drawcontrolpoints drawcontrollines \ drawpointlabels drawlineoptions drawpointoptions drawcontroloptions drawlabeloptions \ -draworiginoptions drawboundoptions drawpathoptions resetdrawoptions +draworiginoptions drawboundoptions drawpathoptions resetdrawoptions decorated \ +redecorated undecorated keywordclass.metafun.internals=\ nocolormodel greycolormodel graycolormodel rgbcolormodel \ diff --git a/metapost/context/base/mp-chem.mpiv b/metapost/context/base/mp-chem.mpiv index e2412d2f7..00bf9eed1 100644 --- a/metapost/context/base/mp-chem.mpiv +++ b/metapost/context/base/mp-chem.mpiv @@ -20,6 +20,7 @@ if known context_chem : endinput ; fi ; boolean context_chem ; context_chem := true ; numeric + n[], % scratch chem_text_min, chem_text_max, chem_rotation, chem_adjacent, chem_stack_n, chem_substituent, chem_substituent.lft, chem_substituent.rt, @@ -40,10 +41,20 @@ color chem_axis_color ; path + p[], % scratch chem_setting_bbox ; pair - chem_origin, chem_mirror, chem_sb_pair, chem_sb_pair.m, chem_sb_pair.p ; + chem_pair[], % scratch + chem_origin, chem_mirror, + chem_sb_pair, chem_sb_pair.m, chem_sb_pair.p ; + +picture + chem_pic, % scratch + chem_sb_dash, chem_sb_dash.m, chem_sb_dash.p ; + +transform + chem_t ; % scratch chem_setting_axis := false ; chem_axis_color := (173/255,216/255,230/255) ; % lightblue @@ -58,9 +69,10 @@ chem_bb_angle := angle(1,2chem_dbl_offset) ; chem_text_min := 0.75 ; chem_text_max := 1.25 ; chem_dot_factor := 4 ; % *linewidth -chem_sb_pair := (0.25,0.75) ; -chem_sb_pair.m := (0.25,1.00) ; -chem_sb_pair.p := (0.00,0.75) ; +chem_sb_pair := (0.25,0.75) ; chem_sb_dash := dashpattern(off 0.25 on 0.5 off 0.25) ; +chem_sb_pair.m := (0.25,1.00) ; chem_sb_dash.m := dashpattern(off 0.25 on 0.75) ; +chem_sb_pair.p := (0.00,0.75) ; chem_sb_dash.p := dashpattern(on 0.75 off 0.25) ; + chem_text_trace := false ; % debugging chem_bd_wedge := false ; % true is incorrect, but quite common... @@ -134,60 +146,61 @@ path vardef chem_init_some (suffix $) (expr e) = if not known chem_front.$ : - chem_front.$ := false ; + chem_front.$ := false ; fi if not known chem_star.$ : - chem_star.$ := false ; + chem_star.$ := false ; fi if not known chem_stacked.$: chem_stacked.$ := false ; fi - save n ; numeric n ; if path(e) : chem_b_path.$ := e if not cycle(e) : -- cycle fi ; - n := length(chem_b_path.$) - 1 ; + n0 := length(chem_b_path.$) - 1 ; else : % polygon - n := e ; - save a ; numeric a ; a := 360/n ; + n0 := e ; + n1 := 360/n0 ; chem_b_path.$ := ( - for i=0 upto n-1 : - dir(if chem_star.$ : -i else : (.5-i) fi *a) -- + for i=0 upto n0-1 : + dir(if chem_star.$ : -i else : (.5-i) fi *n1) -- endfor cycle ) if chem_front.$ : - rotated (a-90) + rotated (n1-90) fi if not chem_star.$ : - scaled (.5/(sind .5a)) + scaled (.5/(sind .5n1)) fi ; fi ; - save m ; numeric m ; m := 0 ; + n2 := 0 ; chem_c_path.$ := reverse(fullcircle) rotated angle(point 0 of chem_b_path.$) if not chem_star.$ : - hide (for i=0 upto n: - if abs(point i+.5 of chem_b_path.$)<abs(point m+.5 of chem_b_path.$): - m := i ; + hide (for i=0 upto n0: + if abs(point i+.5 of chem_b_path.$)<abs(point n2+.5 of chem_b_path.$): + n2 := i ; fi endfor) - scaled (2*(abs(point m+.5 of chem_b_path.$) - chem_dbl_offset)) + scaled (2*(abs(point n2+.5 of chem_b_path.$) - chem_dbl_offset)) fi ; if not chem_front.$ : chem_r_path.$ := if chem_star.$ : chem_b_path.$ else : - for i=0 upto n-1 : - (unitvector point i of chem_b_path.$) - shifted point i of chem_b_path.$ -- - endfor - cycle - fi ; + ( + for i=0 upto n0-1 : + (unitvector point i of chem_b_path.$) + shifted point i of chem_b_path.$ -- + endfor + cycle + ) ; + fi fi if not chem_star.$ : - chem_r_path.lft.$ := - for i=0 upto n-1 : + chem_r_path.lft.$ := + for i=0 upto n0-1 : if chem_front.$ : up scaled .5 @@ -198,8 +211,8 @@ vardef chem_init_some (suffix $) (expr e) = fi -- endfor cycle ; - chem_r_path.rt.$ := - for i=0 upto n-1 : + chem_r_path.rt.$ := ( + for i=0 upto n0-1 : if chem_front.$ : down scaled .5 @@ -209,14 +222,14 @@ vardef chem_init_some (suffix $) (expr e) = rotatedabout(point i of chem_b_path.$,180) fi -- endfor - cycle ; + cycle + ) ; fi enddef ; % The following is used only once: - def chem_init_all = - begingroup +begingroup save a, b, c, d, e ; numeric a, b, c, d, e ; save lft, rt ; path lft, rt ; @@ -282,7 +295,7 @@ def chem_init_all = for i=0 upto 5 : point i of $ shifted point i of chem_b_path.boat -- endfor cycle ; endfor - endgroup +endgroup enddef ; chem_init_all ; % WHY does this not work unless defined and then called? @@ -292,11 +305,13 @@ chem_init_all ; % WHY does this not work unless defined and then called? % unless of course the error be too harmful... % \startchemical -vardef chem_start_structure(expr i, l, r, t, b, scale, fitwidth, fitheight, emwidth, offset, axis, rulethickness, axiscolor) = +vardef chem_start_structure(expr i, l, r, t, b, scale, fitwidth, fitheight, + emwidth, offset, axis, rulethickness, axiscolor) = + chem_emwidth := emwidth ; % EmWidth or \the\emwidth does not work... chem_b_length := if scale<>0: scale* fi 3chem_emwidth ; chem_setting_fitwidth := if boolean fitwidth : fitwidth else : (fitwidth<>0) fi ; - chem_setting_fitheight := if boolean fitheight : fitheight else : (fithheight<>0) fi ; + chem_setting_fitheight := if boolean fitheight : fitheight else : (fithheight<>0) fi ;; chem_setting_l := l * chem_b_length ; chem_setting_r := r * chem_b_length ; chem_setting_t := t * chem_b_length ; @@ -326,23 +341,23 @@ vardef chem_stop_structure = (-chem_setting_l,-chem_setting_b) -- ( chem_setting_r,-chem_setting_b) -- ( chem_setting_r, chem_setting_t) -- (-chem_setting_l, chem_setting_t) -- cycle ; if chem_setting_axis : % put it behind the picture - picture chem_picture ; chem_picture := currentpicture ; currentpicture := nullpicture ; - save stp ; stp := .5chem_b_length ; - save siz ; siz := .2stp ; + chem_pic := currentpicture ; currentpicture := nullpicture ; + n0 := .5chem_b_length ; + n1 := .2n0 ; draw (-chem_setting_l,0) -- (chem_setting_r,0) withpen pencircle scaled chem_axis_rulethickness withcolor chem_axis_color ; draw (0,-chem_setting_b) -- (0,chem_setting_t) withpen pencircle scaled chem_axis_rulethickness withcolor chem_axis_color ; - for i = 0 step stp until chem_setting_r : draw (i,-siz) -- (i,siz) + for i = 0 step n0 until chem_setting_r : draw (i,-n1) -- (i,n1) withpen pencircle scaled chem_axis_rulethickness withcolor chem_axis_color ; endfor - for i = 0 step -stp until -chem_setting_l : draw (i,-siz) -- (i,siz) + for i = 0 step -n0 until -chem_setting_l : draw (i,-n1) -- (i,n1) withpen pencircle scaled chem_axis_rulethickness withcolor chem_axis_color ; endfor - for i = 0 step stp until chem_setting_t : draw (-siz,i) -- (siz,i) + for i = 0 step n0 until chem_setting_t : draw (-n1,i) -- (n1,i) withpen pencircle scaled chem_axis_rulethickness withcolor chem_axis_color ; endfor - for i = 0 step -stp until -chem_setting_b : draw (-siz,i) -- (siz,i) + for i = 0 step -n0 until -chem_setting_b : draw (-n1,i) -- (n1,i) withpen pencircle scaled chem_axis_rulethickness withcolor chem_axis_color ; endfor % frame=on : draw chem_setting_bbox withcolor chem_axis_color ; - addto currentpicture also chem_picture ; +addto currentpicture also chem_pic ; fi ; setbounds currentpicture to chem_setting_bbox ; enddef ; @@ -375,13 +390,13 @@ vardef chem_pe = % PE chem_doing_pb := false ; enddef ; -vardef chem_do (expr p) = +vardef chem_do (expr pos) = if (unknown chem_doing_pb) or (not chem_doing_pb) : - p + pos else : chem_doing_pb := false ; - currentpicture := currentpicture shifted - p ; - chem_origin := chem_origin - p ; + currentpicture := currentpicture shifted - pos ; + chem_origin := chem_origin - pos ; origin % nullpicture fi enddef ; @@ -456,28 +471,25 @@ def chem_transformed (suffix $) = % not vardef! fi enddef ; -vardef chem_draw (suffix $) (expr p, r, c) (text t) = - draw p - chem_transformed($) +vardef chem_draw (expr what, r, c) (text extra) = + draw what withpen pencircle scaled r withcolor c - t ; + extra ; enddef ; -vardef chem_fill (suffix $) (expr p, r, c) (text t) = - fill p - chem_transformed($) +vardef chem_fill (expr what, r, c) (text extra) = + fill what withpen pencircle scaled r withcolor c - t ; + extra ; enddef ; -vardef chem_drawarrow (suffix $) (expr p, r, c) (text t) = - drawarrow p - chem_transformed($) +vardef chem_drawarrow (expr what, r, c) (text extra) = + drawarrow what withpen pencircle scaled r withcolor c - t ; + extra ; enddef ; vardef chem_set (suffix $) = @@ -497,8 +509,7 @@ vardef chem_set (suffix $) = chem_substituent.lft := 0 ; chem_substituent.rt := 0 ; % move to the bond midpoint of the first structure - save p ; pair p[] ; - p0 := center ( + chem_pair0 := center ( if chem_star.P : origin -- point (chem_adjacent-1) else : @@ -507,12 +518,11 @@ vardef chem_set (suffix $) = of chem_b_path.P ) chem_transformed(P) ; % find the closest opposite bond of the second structure - p1 := p0 rotated if chem_star.P : 90 else : 180 fi ; - save r ; r := abs(p1) ; - save j ; + chem_pair1 := chem_pair0 rotated if chem_star.P : 90 else : 180 fi ; + n0 := abs(chem_pair1) ; % only consider even indices (cardinal points) for ONE for i=0 step if chem_star.$ : 2 else : 1 fi until (length chem_b_path.$) : - p2 := ( + chem_pair2 := ( ( unitvector center ( @@ -523,31 +533,32 @@ vardef chem_set (suffix $) = fi of chem_b_path.$) ) - scaled r + scaled n0 ) chem_transformed($) ; if i=0 : - p3 := p2 ; - j := 0 ; - elseif (abs(p1 shifted -p2)) < (abs(p1 shifted -p3)) : - p3 := p2 ; - j := i ; + chem_pair3 := chem_pair2 ; + n1 := 0 ; + elseif (abs(chem_pair1 shifted -chem_pair2)) < (abs(chem_pair1 shifted -chem_pair3)) : + chem_pair3 := chem_pair2 ; + n1 := i ; fi endfor if chem_star.$ : - p4 := p0 shifted -((point (chem_adjacent-1) of chem_b_path.P) chem_transformed(P)) ; + chem_pair4 := chem_pair0 shifted + -((point (chem_adjacent-1) of chem_b_path.P) chem_transformed(P)) ; fi % adjust the bond angles - chem_rotation := (chem_rotation + angle(p1)-angle(p3)) mod 360 ; + chem_rotation := (chem_rotation + angle(chem_pair1)-angle(chem_pair3)) mod 360 ; if not chem_star.$ : - p4 := - if chem_star.P : (point j else : center(subpath (j,j+1) fi of chem_b_path.$) + chem_pair4 := + if chem_star.P : (point n1 else : center(subpath (n1,n1+1) fi of chem_b_path.$) chem_transformed($) ; fi if not chem_star.P : - p4 := p4 shifted -p0 ; + chem_pair4 := chem_pair4 shifted -chem_pair0 ; fi - currentpicture := currentpicture shifted p4 ; - chem_origin := chem_origin + p4 ; + currentpicture := currentpicture shifted chem_pair4 ; + chem_origin := chem_origin + chem_pair4 ; chem_adjacent := 0 ; fi ; @@ -560,49 +571,51 @@ vardef chem_set (suffix $) = chem_substituent.rt := 0 ; fi if (chem_substituent <> 0) or (chem_substituent.lft <> 0) or (chem_substituent.rt <> 0) : - save p ; pair p[] ; % move origin to radical endpoint of the first structure if chem_substituent.lft > 0 : - p0 := point chem_substituent.lft-1 of chem_r_path.lft.P ; + chem_pair0 := point chem_substituent.lft-1 of chem_r_path.lft.P ; chem_substituent := chem_substituent.lft ; chem_substituent.lft := 0 ; elseif chem_substituent.rt>0 : - p0 := point chem_substituent.rt-1 of chem_r_path.rt.P ; + chem_pair0 := point chem_substituent.rt-1 of chem_r_path.rt.P ; chem_substituent := chem_substituent.rt ; chem_substituent.rt := 0 ; elseif not chem_front.P : - p0 := point chem_substituent-1 of chem_r_path.P ; + chem_pair0 := point chem_substituent-1 of chem_r_path.P ; else : - p0 := point chem_substituent-1 of chem_r_path.lft.P ; + chem_pair0 := point chem_substituent-1 of chem_r_path.lft.P ; fi - p1 := p0 if not chem_star.P : shifted -(point chem_substituent-1 of chem_b_path.P) fi ; - p0 := p0 chem_transformed(P) ; - p1 := p1 chem_transformed(P) ; - currentpicture := currentpicture shifted -p0 ; - chem_origin := chem_origin - p0 ; + chem_pair1 := chem_pair0 if not chem_star.P : + shifted -(point chem_substituent-1 of chem_b_path.P) fi ; + chem_t := identity chem_transformed(P) ; + chem_pair0 := chem_pair0 transformed chem_t ; + chem_pair1 := chem_pair1 transformed chem_t ; + currentpicture := currentpicture shifted -chem_pair0 ; + chem_origin := chem_origin - chem_pair0 ; if not (chem_star.P and chem_star.$) : % find the closest node - p1 := p1 rotated 180 ; - save r ; r := abs(p1) ; - save j ; + chem_pair1 := chem_pair1 rotated 180 ; + n0 := abs(chem_pair1) ; + n1 := length chem_b_path.$ ; + chem_t := identity chem_transformed($) ; % only consider even indices (cardinal points) for ONE - for i=0 step if chem_star.$ : 2 else : 1 fi until (length chem_b_path.$) : - p2 := (unitvector(point i of chem_b_path.$) scaled r) chem_transformed($) ; + for i=0 step if chem_star.$ : 2 else : 1 fi until n1 : + chem_pair2 := (unitvector(point i of chem_b_path.$) scaled n0) transformed chem_t ; if i=0 : - p3 := p2 ; - j := 0 ; - elseif (abs(p1 shifted -p2)) < (abs(p1 shifted -p3)) : - p3 := p2 ; - j := i ; + chem_pair3 := chem_pair2 ; + n2 := 0 ; + elseif (abs(chem_pair1 shifted -chem_pair2)) < (abs(chem_pair1 shifted -chem_pair3)) : + chem_pair3 := chem_pair2 ; + n2 := i ; fi endfor if not chem_front.$ : - chem_rotation := (chem_rotation + angle(p1)-angle(p3)) mod 360 ; + chem_rotation := (chem_rotation + angle(chem_pair1)-angle(chem_pair3)) mod 360 ; fi ; - p4 := (point j of chem_b_path.$) chem_transformed($) ; + chem_pair4 := (point n2 of chem_b_path.$) transformed chem_t ; if not chem_star.$ : - currentpicture := currentpicture shifted p4 ; - chem_origin := chem_origin + p4 ; + currentpicture := currentpicture shifted chem_pair4 ; + chem_origin := chem_origin + chem_pair4 ; fi fi chem_substituent := 0 ; @@ -617,8 +630,8 @@ vardef chem_b (suffix $) (expr f, t, r, c) = % B if chem_star.$ : chem_r($,f,t,r,c) ; else : - chem_draw($, - subpath (f-1,t) of chem_b_path.$, + chem_draw( + (subpath (f-1,t) of chem_b_path.$) chem_transformed($), r,c,) ; fi enddef ; @@ -627,11 +640,16 @@ vardef chem_sb@# (suffix $) (expr f, t, r, c) = % SB if chem_star.$ : chem_sr@#($,f,t,r,c) ; else : - for i=f upto t : - chem_draw($, - subpath (chem_sb_pair@# shifted (i-1,i-1)) of chem_b_path.$, - r,c,) ; - endfor + chem_draw( + (subpath (f-1,t) of chem_b_path.$) chem_transformed($), + r,c,dashed chem_sb_dash@# scaled chem_b_length) ; + %chem_t := identity chem_transformed($) ; + %for i=f upto t : + % chem_draw( + % (subpath (chem_sb_pair@# shifted (i-1,i-1)) of chem_b_path.$) + % transformed chem_t, + % r,c,) ; + %endfor fi enddef ; @@ -640,51 +658,52 @@ enddef ; % or continue to calculate them on the fly? vardef chem_r_fragment@# (suffix $) (expr i) = - if chem_front.$ and (length(str @#)=0) : % note that length=3, not 2... - (point i-1 of chem_r_path.rt.$ -- - point i-1 of chem_b_path.$ -- - point i-1 of chem_r_path.lft.$) - else : - (if chem_star.$ : - origin - else : - point i-1 of chem_b_path.$ - fi -- - point i-1 of chem_r_path@#.$) - fi + if chem_front.$ and (length(str @#)=0) : % note that length=3, not 2... + (point i-1 of chem_r_path.rt.$ -- + point i-1 of chem_b_path.$ -- + point i-1 of chem_r_path.lft.$) + else : + (if chem_star.$ : + origin + else : + point i-1 of chem_b_path.$ + fi -- + point i-1 of chem_r_path@#.$) + fi % no ; enddef ; vardef chem_r (suffix $) (expr f, t, r, c) = % R - save l, h ; numeric l, h ; l := length chem_b_path.$ ; - h := if chem_stacked.$ : floor(.5l) else : l fi ; + n0 := length chem_b_path.$ ; + n1 := if chem_stacked.$ : floor(.5n0) else : n0 fi ; + chem_t := identity chem_transformed($) ; for i=f upto t : - chem_draw($, - if i>h : subpath (.5,1) of fi - chem_r_fragment($,i), + chem_draw( + (if i>n1 : subpath (.5,1) of fi chem_r_fragment($,i)) transformed chem_t, r,c,) ; endfor enddef ; vardef chem_er (suffix $) (expr f, t, r, c) = % ER if not chem_front.$ : - for i=f upto t : - save p ; path p ; - p := chem_r_fragment($,i) ; - chem_draw($, - p paralleled chem_dbl_offset, - r,c,) ; - chem_draw($, - p paralleled -chem_dbl_offset, - r,c,) ; - endfor + chem_t := identity chem_transformed($) ; + for i=f upto t : + p0 := chem_r_fragment($,i) ; + chem_draw( + (p0 paralleled chem_dbl_offset) transformed chem_t, + r,c,) ; + chem_draw( + (p0 paralleled -chem_dbl_offset) transformed chem_t, + r,c,) ; + endfor fi enddef ; vardef chem_lr (suffix $) (expr f, t, r, c) = % LR if not chem_star.$ : + chem_t := identity chem_transformed($) ; for i=f upto t : - chem_draw($, - chem_r_fragment.lft($,i), + chem_draw( + chem_r_fragment.lft($,i) transformed chem_t, r,c,) ; endfor fi @@ -692,9 +711,10 @@ enddef ; vardef chem_rr (suffix $) (expr f, t, r, c) = % RR if not chem_star.$ : + chem_t := identity chem_transformed($) ; for i=f upto t : - chem_draw($, - chem_r_fragment.rt($,i), + chem_draw( + chem_r_fragment.rt($,i) transformed chem_t, r,c,) ; endfor fi @@ -702,21 +722,26 @@ enddef ; vardef chem_eb (suffix $) (expr f, t, r, c) = % EB if not chem_star.$ : - for i=f upto t : - chem_draw($, - (subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path.$) - paralleled -2chem_dbl_offset, - r,c,) ; - endfor + chem_draw( + ((subpath (f-1,t) of chem_b_path.$) paralleled -2chem_dbl_offset) chem_transformed($), + r,c,dashed chem_sb_dash scaled chem_b_length) ; + %for i=f upto t : + % chem_t := identity chem_transformed($) ; + % chem_draw( + % ((subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path.$) + % paralleled -2chem_dbl_offset) transformed chem_t, + % r,c,) ; + %endfor fi enddef ; vardef chem_ad (suffix $) (expr f, t, r, c) = % AD if not chem_star.$ : + chem_t := identity chem_transformed($) ; for i=f upto t : - chem_drawarrow($, - (subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path.$) - paralleled 2chem_dbl_offset, + chem_drawarrow( + ((subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path.$) + paralleled 2chem_dbl_offset) transformed chem_t, r,c,) ; endfor fi @@ -724,11 +749,12 @@ enddef ; vardef chem_au (suffix $) (expr f, t, r, c) = % AU if not chem_star.$ : + chem_t := identity chem_transformed($) ; for i=f upto t : - chem_drawarrow($, + chem_drawarrow( reverse( (subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path.$) - paralleled 2chem_dbl_offset), + paralleled 2chem_dbl_offset) transformed chem_t, r,c,) ; endfor fi @@ -736,29 +762,30 @@ enddef ; vardef chem_es (suffix $) (expr f, t, r, c) = % ES if chem_star.$ : + chem_t := identity chem_transformed($) ; for i=f upto t : - chem_draw($, - (point i-1 of chem_r_path.$) scaled (xpart chem_sb_pair), + chem_draw( + ((point i-1 of chem_r_path.$) scaled (xpart chem_sb_pair)) transformed chem_t, chem_dot_factor*r,c,) ; endfor fi enddef ; vardef chem_ed (suffix $) (expr f, t, r, c) = % ED + chem_t := identity chem_transformed($) ; for i=f upto t : - save p ; path p ; if chem_star.$ : - p := subpath chem_sb_pair of chem_r_fragment($,i) ; - chem_draw($, - point 0 of (p paralleled -chem_dbl_offset), + p0 := subpath chem_sb_pair of chem_r_fragment($,i) ; + chem_draw( + (point 0 of (p0 paralleled -chem_dbl_offset)) transformed chem_t, chem_dot_factor*r,c,) ; - chem_draw($, - point 0 of (p paralleled chem_dbl_offset), + chem_draw( + (point 0 of (p0 paralleled chem_dbl_offset)) transformed chem_t, chem_dot_factor*r,c,) ; else : - chem_draw($, - (subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path.$) - paralleled -2chem_dbl_offset, + chem_draw( + ((subpath (chem_sb_pair shifted (i-1,i-1)) of chem_b_path.$) + paralleled -2chem_dbl_offset) transformed chem_t, r,c,dashed evenly) ; fi endfor @@ -766,12 +793,12 @@ enddef ; vardef chem_ep (suffix $) (expr f, t, r, c) = % EP if chem_star.$ : - save p ; path p ; + chem_t := identity chem_transformed($) ; for i=f upto t : - p := subpath chem_sb_pair of chem_r_fragment($,i) ; - chem_draw($, - point 0 of (p paralleled -chem_dbl_offset) -- - point 0 of (p paralleled chem_dbl_offset), + p0 := subpath chem_sb_pair of chem_r_fragment($,i) ; + chem_draw( + (point 0 of (p0 paralleled -chem_dbl_offset) -- + point 0 of (p0 paralleled chem_dbl_offset)) transformed chem_t, r,c,) ; endfor fi @@ -779,17 +806,17 @@ enddef ; vardef chem_et (suffix $) (expr f, t, r, c) = % ET if chem_star.$ : - save p ; path p ; + chem_t := identity chem_transformed($) ; for i=f upto t : - p := subpath chem_sb_pair of chem_r_fragment($,i) ; - chem_draw($, - point 0 of (p paralleled -2chem_dbl_offset), + p0 := subpath chem_sb_pair of chem_r_fragment($,i) ; + chem_draw( + (point 0 of (p0 paralleled -2chem_dbl_offset)) transformed chem_t, chem_dot_factor*r,c,) ; - chem_draw($, - point 0 of p, + chem_draw( + (point 0 of p0) transformed chem_t, chem_dot_factor*r,c,) ; - chem_draw($, - point 0 of (p paralleled 2chem_dbl_offset), + chem_draw( + (point 0 of (p0 paralleled 2chem_dbl_offset)) transformed chem_t, chem_dot_factor*r,c,) ; endfor fi @@ -798,106 +825,124 @@ enddef ; vardef chem_db@# (suffix $) (expr f, t, r, c) = % DB if chem_star.$ : chem_dr@#($,f,t,r,c) ; - else : - if not chem_front.$ : - save p ; path p ; - for i=f upto t : - p := subpath (chem_sb_pair@# shifted (i-1,i-1)) of chem_b_path.$ ; - chem_draw($, - p paralleled -chem_dbl_offset, - r,c,) ; - chem_draw($, - p paralleled chem_dbl_offset, - r,c,) ; - % todo : this should be cut-off where it overlaps a neighboring standard bond. - endfor - fi + elseif not chem_front.$ : + chem_t := identity chem_transformed($) ; + chem_draw( + ((subpath (f-1,t) of chem_b_path.$) paralleled -chem_dbl_offset) transformed chem_t, + r,c,dashed chem_sb_dash@# scaled chem_b_length) ; + chem_draw( + ((subpath (f-1,t) of chem_b_path.$) paralleled chem_dbl_offset) transformed chem_t, + r,c,dashed chem_sb_dash@# scaled chem_b_length) ; + %for i=f upto t : + % p0 := subpath (chem_sb_pair@# shifted (i-1,i-1)) of chem_b_path.$ ; + % chem_draw( + % (p0 paralleled -chem_dbl_offset) transformed chem_t, + % r,c,) ; + % chem_draw( + % (p0 paralleled chem_dbl_offset) transformed chem_t, + % r,c,) ; + % % todo : this should be cut-off where it overlaps a neighboring standard bond. + %endfor fi enddef ; vardef chem_tb@# (suffix $) (expr f, t, r, c) = % TB if chem_star.$ : - save p ; path p ; + chem_t := identity chem_transformed($) ; for i=f upto t : - p := subpath chem_sb_pair@# of chem_r_fragment($,i) ; - chem_draw($, - p paralleled -2chem_dbl_offset, + p0 := subpath chem_sb_pair@# of chem_r_fragment($,i) ; + chem_draw( + (p0 paralleled -2chem_dbl_offset) transformed chem_t, r,c,) ; - chem_draw($, - p, + chem_draw( + p0 transformed chem_t, r,c,) ; - chem_draw($, - p paralleled 2chem_dbl_offset, + chem_draw( + (p0 paralleled 2chem_dbl_offset) transformed chem_t, r,c,) ; endfor fi enddef ; vardef chem_sr@# (suffix $) (expr f, t, r, c) = % SR + chem_t := identity chem_transformed($) ; if chem_stacked.$ : - save l, h ; numeric l, h ; l := length chem_b_path.$ ; h := floor(.5l) ; + n0 := length chem_b_path.$ ; n1 := floor(.5n0) ; for i=f upto t : - chem_draw($, - subpath (if i>h: .5,ypart fi chem_sb_pair@#) of chem_r_fragment($,i), + chem_draw( + (subpath (if i>n1: .5,ypart fi chem_sb_pair@#) of chem_r_fragment($,i)) + transformed chem_t, r,c,) ; endfor else: - for i=f upto t : - if chem_front.$ : % length=3... - chem_draw($, - subpath chem_sb_pair@# of (subpath (1,0) of chem_r_fragment($,i)), - r,c,) ; - chem_draw($, - subpath chem_sb_pair@# of (subpath (1,2) of chem_r_fragment($,i)), - r,c,) ; - else : - chem_draw($, - subpath chem_sb_pair@# of chem_r_fragment($,i), - r,c,) ; - fi - endfor + for i=f upto t : + if chem_front.$ : % length=3... + chem_draw( + (subpath chem_sb_pair@# of (subpath (1,0) of chem_r_fragment($,i))) + transformed chem_t, + r,c,) ; + chem_draw( + (subpath chem_sb_pair@# of (subpath (1,2) of chem_r_fragment($,i))) + transformed chem_t, + r,c,) ; + else : + chem_draw( + (subpath chem_sb_pair@# of chem_r_fragment($,i)) + transformed chem_t, + r,c,) ; + fi + endfor fi enddef ; vardef chem_sd@# (suffix $) (expr f, t, r, c) = % SD if chem_star.$ : + chem_t := identity chem_transformed($) ; for i=f upto t : - chem_draw($, - subpath chem_sb_pair@# of chem_r_fragment($,i), + chem_draw( + (subpath chem_sb_pair@# of chem_r_fragment($,i)) transformed chem_t, r,c,dashed evenly) ; endfor fi enddef ; vardef chem_rd@# (suffix $) (expr f, t, r, c) = % RD + chem_t := identity chem_transformed($) ; for i=f upto t : if chem_front.$ : - chem_draw($, - subpath chem_sb_pair@# of (subpath (1,0) of chem_r_fragment($,i)), + chem_draw( + (subpath chem_sb_pair@# of (subpath (1,0) of chem_r_fragment($,i))) + transformed chem_t, r,c,dashed evenly) ; - chem_draw($, - subpath chem_sb_pair@# of (subpath (1,2) of chem_r_fragment($,i)), + chem_draw( + (subpath chem_sb_pair@# of (subpath (1,2) of chem_r_fragment($,i))) + transformed chem_t, r,c,dashed evenly) ; else : - chem_draw($, - subpath chem_sb_pair@# of chem_r_fragment($,i), + chem_draw( + (subpath chem_sb_pair@# of chem_r_fragment($,i)) + transformed chem_t, r,c,dashed evenly) ; fi : endfor enddef ; vardef chem_rh@# (suffix $) (expr f, t, r, c) = % RH + chem_t := identity chem_transformed($) ; for i=f upto t : if chem_front.$ : - chem_draw($, - subpath chem_sb_pair@# of (subpath (1,0) of chem_r_fragment($,i)), + chem_draw( + (subpath chem_sb_pair@# of (subpath (1,0) of chem_r_fragment($,i))) + transformed chem_t, r,c,dashed withdots scaled ((.5chem_b_length/3)/5bp)) ; - chem_draw($, - subpath chem_sb_pair@# of (subpath (1,2) of chem_r_fragment($,i)), + chem_draw( + (subpath chem_sb_pair@# of (subpath (1,2) of chem_r_fragment($,i))) + transformed chem_t, r,c,dashed withdots scaled ((.5chem_b_length/3)/5bp)) ; else : - chem_draw($, - subpath chem_sb_pair@# of chem_r_fragment($,i), + chem_draw( + (subpath chem_sb_pair@# of chem_r_fragment($,i)) + transformed chem_t, chem_dot_factor*r,c,dashed withdots scaled ((.5chem_b_length/3)/5bp)) ; fi endfor @@ -907,14 +952,14 @@ vardef chem_hb@# (suffix $) (expr f, t, r, c) = if chem_star.$ : chem_rh@#($,f,t vardef chem_dr@# (suffix $) (expr f, t, r, c) = % DR if not chem_front.$ : - save p ; path p ; + chem_t := identity chem_transformed($) ; for i=f upto t : - p := (subpath chem_sb_pair@# of chem_r_fragment($,i)) ; - chem_draw($, - p paralleled chem_dbl_offset, + p0 := (subpath chem_sb_pair@# of chem_r_fragment($,i)) ; + chem_draw( + (p0 paralleled chem_dbl_offset) transformed chem_t, r,c,) ; - chem_draw($, - p paralleled -chem_dbl_offset, + chem_draw( + (p0 paralleled -chem_dbl_offset) transformed chem_t, r,c,) ; endfor fi @@ -924,45 +969,43 @@ vardef chem_bb (suffix $) (expr f, t, r, c) = % BB if chem_star.$ : chem_rb($,f,t,r,c) ; elseif chem_front.$ : - chem_draw($, - subpath (f-1,t) of chem_b_path.$, + chem_t := identity chem_transformed($) ; + chem_draw( + (subpath (f-1,t) of chem_b_path.$) transformed chem_t, r,c,) ; - save l, fm, tm, nb ; numeric l, fm, tm, nb ; - l := length chem_b_path.$ ; - nb := floor(.5l) + 1 ; - fm := if f<0 :((f+1) mod l) + l else : ((f-1) mod l) + 1 fi ; - tm := if t<0 :((t+1) mod l) + l else : ((t-1) mod l) + 1 fi ; - if tm<fm : - save tmp ; numeric tmp ; - tmp := tm ; - tm := fm ; - fm := tmp ; + n0 := length chem_b_path.$ ; + n1 := floor(.5n0) + 1 ; + n2 := if f<0 :((f+1) mod n0) + n0 else : ((f-1) mod n0) + 1 fi ; + n3 := if t<0 :((t+1) mod n0) + n0 else : ((t-1) mod n0) + 1 fi ; + if n3<n2 : + n4 := n3 ; + n3 := n2 ; + n2 := n4 ; fi - if fm<nb : - if fm=1 : - chem_fill($, - point fm-1 of chem_b_path.$ -- - point fm of chem_b_path.$ shifted (0,-.5chem_dbl_offset) -- - point fm of chem_b_path.$ shifted (0, .5chem_dbl_offset) -- - cycle, + if n2<n1 : + if n2=1 : + chem_fill( + (point n2-1 of chem_b_path.$ -- + point n2 of chem_b_path.$ shifted (0,-.5chem_dbl_offset) -- + point n2 of chem_b_path.$ shifted (0, .5chem_dbl_offset) -- + cycle) transformed chem_t, r,c,) ; fi - if (fm<=nb-1) and (tm>1) : - save p ; path p; - p := subpath (if fm>2 : fm-1 else : 1 fi,if tm<nb : tm else : nb-1 fi) + if (n2<=n1-1) and (n3>1) : + p0 := subpath (if n2>2 : n2-1 else : 1 fi,if n3<n1 : n3 else : n1-1 fi) of chem_b_path.$ ; - chem_fill($, - p paralleled -.5chem_dbl_offset -- - reverse(p) paralleled -.5chem_dbl_offset -- - cycle, + chem_fill( + (p0 paralleled -.5chem_dbl_offset -- + reverse(p0) paralleled -.5chem_dbl_offset -- + cycle) transformed chem_t, r,c,) ; fi - if tm>=nb : - chem_fill($, - point nb of chem_b_path.$ -- - point nb-1 of chem_b_path.$ shifted (0,-.5chem_dbl_offset) -- - point nb-1 of chem_b_path.$ shifted (0, .5chem_dbl_offset) -- - cycle, + if n3>=n1 : + chem_fill( + (point n1 of chem_b_path.$ -- + point n1-1 of chem_b_path.$ shifted (0,-.5chem_dbl_offset) -- + point n1-1 of chem_b_path.$ shifted (0, .5chem_dbl_offset) -- + cycle) transformed chem_t, r,c,) ; fi fi @@ -979,14 +1022,14 @@ enddef ; vardef chem_rb@# (suffix $) (expr f, t, r, c) = % RB if not chem_front.$ : - save p ; path p ; + chem_t := identity chem_transformed($) ; for i=f upto t : - p := subpath chem_sb_pair of chem_r_fragment@#($,i) ; - chem_fill($, - point 0 of p -- - point 1 of p rotatedaround(point 0 of p, -chem_bb_angle) -- - point 1 of p rotatedaround(point 0 of p, chem_bb_angle) -- - cycle, + p0 := subpath chem_sb_pair of chem_r_fragment@#($,i) ; + chem_fill( + (point 0 of p0 -- + point 1 of p0 rotatedaround(point 0 of p0, -chem_bb_angle) -- + point 1 of p0 rotatedaround(point 0 of p0, chem_bb_angle) -- + cycle) transformed chem_t, r,c,) ; endfor fi @@ -994,9 +1037,10 @@ enddef ; vardef chem_lsr@# (suffix $) (expr f, t, r, c) = % LSR if not chem_star.$ : + chem_t := identity chem_transformed($) ; for i=f upto t : - chem_draw($, - subpath chem_sb_pair@# of chem_r_fragment.lft($,i), + chem_draw( + (subpath chem_sb_pair@# of chem_r_fragment.lft($,i)) transformed chem_t, r,c,) ; endfor fi @@ -1004,9 +1048,10 @@ enddef ; vardef chem_rsr@# (suffix $) (expr f, t, r, c) = % RSR if not chem_star.$ : + chem_t := identity chem_transformed($) ; for i=f upto t : - chem_draw($, - subpath chem_sb_pair@# of chem_r_fragment.rt($,i), + chem_draw( + (subpath chem_sb_pair@# of chem_r_fragment.rt($,i)) transformed chem_t, r,c,) ; endfor fi @@ -1014,9 +1059,10 @@ enddef ; vardef chem_lrd@# (suffix $) (expr f, t, r, c) = % LRD if not chem_star.$ : + chem_t := identity chem_transformed($) ; for i=f upto t : - chem_draw($, - subpath chem_sb_pair@# of chem_r_fragment.lft($,i), + chem_draw( + (subpath chem_sb_pair@# of chem_r_fragment.lft($,i)) transformed chem_t, r,c,dashed evenly) ; endfor fi @@ -1024,9 +1070,10 @@ enddef ; vardef chem_rrd@# (suffix $) (expr f, t, r, c) = % RRD if not chem_star.$ : + chem_t := identity chem_transformed($) ; for i=f upto t : - chem_draw($, - subpath chem_sb_pair@# of chem_r_fragment.rt($,i), + chem_draw( + (subpath chem_sb_pair@# of chem_r_fragment.rt($,i)) transformed chem_t, r,c,dashed evenly) ; endfor fi @@ -1034,25 +1081,27 @@ enddef ; vardef chem_s (suffix $) (expr f, t, r, c) = % S if not (chem_star.$ or chem_front.$) : - chem_draw($, - point f-2 of chem_b_path.$ -- point t of chem_b_path.$, + chem_draw( + (point f-2 of chem_b_path.$ -- point t of chem_b_path.$) chem_transformed($), r,c,) ; fi enddef ; vardef chem_ss@# (suffix $) (expr f, t, r, c) = % SS if not (chem_star.$ or chem_front.$) : - chem_draw($, - subpath chem_sb_pair@# of (point f-2 of chem_b_path.$ -- point t of chem_b_path.$), + chem_draw( + subpath chem_sb_pair@# of (point f-2 of chem_b_path.$ -- point t of chem_b_path.$) + chem_transformed($), r,c,) ; fi enddef ; vardef chem_mid (suffix $) (expr f, t, r, c) = % MID if not (chem_star.$ or chem_front.$) : + chem_t := identity chem_transformed($) ; for i=f upto t : - chem_draw($, - origin -- point i-1 of chem_b_path.$, + chem_draw( + (origin -- point i-1 of chem_b_path.$) transformed chem_t, r,c,) ; endfor fi @@ -1060,64 +1109,63 @@ enddef ; vardef chem_mids@# (suffix $) (expr f, t, r, c) = % MIDS if not (chem_star.$ or chem_front.$) : + chem_t := identity chem_transformed($) ; for i=f upto t : - chem_draw($, - subpath chem_sb_pair@# of (origin -- point i-1 of chem_b_path.$), + chem_draw( + (subpath chem_sb_pair@# of (origin -- point i-1 of chem_b_path.$)) transformed chem_t, r,c,) ; endfor fi enddef ; vardef chem_cd (suffix $) (expr r, c) = % CD - chem_draw($, - chem_c_path.$, + chem_draw( + chem_c_path.$ chem_transformed($), r,c,dashed evenly) ; enddef ; vardef chem_c (suffix $) (expr r, c) = % C - chem_draw($, - chem_c_path.$, + chem_draw( + chem_c_path.$ chem_transformed($), r,c,) ; enddef ; vardef chem_ccd (suffix $) (expr f, t, r, c) = % CCD - save l; numeric l[] ; - l0 = ypart((origin--center(subpath (f-2,f-1) of chem_b_path.$)) + n0 := ypart((origin--center(subpath (f-2,f-1) of chem_b_path.$)) intersectiontimes chem_c_path.$) ; - l1 = ypart((origin--center(subpath (t-1,t) of chem_b_path.$)) + n1 := ypart((origin--center(subpath (t-1,t) of chem_b_path.$)) intersectiontimes chem_c_path.$) ; - if l1>l0 : - l0 := l0 + length chem_c_path.$ ; + if n1>n0 : + n0 := n0 + length chem_c_path.$ ; fi - chem_draw($, - subpath (l1,l0) of chem_c_path.$, + chem_draw( + subpath (n1,n0) of chem_c_path.$ chem_transformed($), r,c,dashed evenly) ; enddef ; vardef chem_cc (suffix $) (expr f, t, r, c) = % CC - save l; numeric l[] ; - l0 = ypart((origin--center(subpath (f-2,f-1) of chem_b_path.$)) + n0 := ypart((origin--center(subpath (f-2,f-1) of chem_b_path.$)) intersectiontimes chem_c_path.$) ; - l1 = ypart((origin--center(subpath (t-1,t) of chem_b_path.$)) + n1 := ypart((origin--center(subpath (t-1,t) of chem_b_path.$)) intersectiontimes chem_c_path.$) ; - if l1>l0 : - l0 := l0 + length chem_c_path.$ ; + if n1>n0 : + n0 := n0 + length chem_c_path.$ ; fi - chem_draw($, - subpath (l1,l0) of chem_c_path.$, + chem_draw( + subpath (n1,n0) of chem_c_path.$ chem_transformed($), r,c,) ; enddef ; vardef chem_ld@# (suffix $) (expr f, t, r, c) = % LD if chem_star.$ : - save p ; path p ; + chem_t := identity chem_transformed($) ; for i=f upto t : - p := subpath chem_sb_pair@# of chem_r_fragment($,i) ; - chem_draw($, - p, + p0 := subpath chem_sb_pair@# of chem_r_fragment($,i) ; + chem_draw( + p0 transformed chem_t, r,c,) ; - chem_draw($, - p paralleled 2chem_dbl_offset, + chem_draw( + (p0 paralleled 2chem_dbl_offset) transformed chem_t, r,c,) ; endfor fi @@ -1125,14 +1173,14 @@ enddef ; vardef chem_rd@# (suffix $) (expr f, t, r, c) = % RD if chem_star.$ : - save p ; path p ; + chem_t := identity chem_transformed($) ; for i=f upto t : - p := subpath chem_sb_pair@# of chem_r_fragment($,i) ; - chem_draw($, - p, + p0 := subpath chem_sb_pair@# of chem_r_fragment($,i) ; + chem_draw( + p0 transformed chem_t, r,c,) ; - chem_draw($, - p paralleled -2chem_dbl_offset, + chem_draw( + (p0 paralleled -2chem_dbl_offset) transformed chem_t, r,c,) ; endfor fi @@ -1140,14 +1188,14 @@ enddef ; vardef chem_ldd@# (suffix $) (expr f, t, r, c) = % LDD if chem_star.$ : - save p ; path p ; + chem_t := identity chem_transformed($) ; for i=f upto t : - p := subpath chem_sb_pair@# of chem_r_fragment($,i) ; - chem_draw($, - p, + p0 := subpath chem_sb_pair@# of chem_r_fragment($,i) ; + chem_draw( + p0 transformed chem_t, r,c,) ; - chem_draw($, - p paralleled 2chem_dbl_offset, + chem_draw( + (p0 paralleled 2chem_dbl_offset) transformed chem_t, r,c,dashed evenly) ; endfor fi @@ -1155,14 +1203,14 @@ enddef ; vardef chem_rdd@# (suffix $) (expr f, t, r, c) = % RDD if chem_star.$ : - save p ; path p ; + chem_t := identity chem_transformed($) ; for i=f upto t : - p := subpath chem_sb_pair@# of chem_r_fragment($,i) ; - chem_draw($, - p, + p0 := subpath chem_sb_pair@# of chem_r_fragment($,i) ; + chem_draw( + p0 transformed chem_t, r,c,) ; - chem_draw($, - p paralleled -2chem_dbl_offset, + chem_draw( + (p0 paralleled -2chem_dbl_offset) transformed chem_t, r,c,dashed evenly) ; endfor fi @@ -1170,13 +1218,13 @@ enddef ; vardef chem_oe (suffix $) (expr f, t, r, c) = % OE if chem_star.$ : - save p ; path p[] ; + chem_t := identity chem_transformed($) ; for i=f upto t : p0 := subpath chem_sb_pair of chem_r_fragment($,i) ; p1 := p0 paralleled -.5chem_dbl_offset ; p2 := p0 paralleled .5chem_dbl_offset ; - chem_draw($, - point 0 of p0 -- + chem_draw( + ( point 0 of p0 -- .2[point 0 of p0, point infinity of p0].. .3[point 0 of p1, point infinity of p1].. .4[point 0 of p0, point infinity of p0].. @@ -1184,7 +1232,7 @@ vardef chem_oe (suffix $) (expr f, t, r, c) = % OE .6[point 0 of p0, point infinity of p0].. .7[point 0 of p1, point infinity of p1].. .8[point 0 of p0, point infinity of p0]-- - point infinity of p0, + point infinity of p0) transformed chem_t, r,c,) ; endfor fi @@ -1192,13 +1240,13 @@ enddef ; vardef chem_bw (suffix $) (expr f, t, r, c) = % BW if chem_star.$ : - save p ; path p[] ; + chem_t := identity chem_transformed($) ; for i=f upto t : p0 := subpath chem_sb_pair of chem_r_fragment($,i) ; p1 := p0 paralleled -.5chem_dbl_offset ; p2 := p0 paralleled .5chem_dbl_offset ; - chem_draw($, - point 0 of p0.. + chem_draw( + ( point 0 of p0.. .1[point 0 of p1, point infinity of p1].. .2[point 0 of p0, point infinity of p0].. .3[point 0 of p2, point infinity of p2].. @@ -1208,7 +1256,7 @@ vardef chem_bw (suffix $) (expr f, t, r, c) = % BW .7[point 0 of p2, point infinity of p2].. .8[point 0 of p0, point infinity of p0].. .9[point 0 of p1, point infinity of p1].. - point infinity of p0, + point infinity of p0) transformed chem_t, r,c,) ; endfor fi @@ -1216,7 +1264,7 @@ enddef ; vardef chem_bd (suffix $) (expr f, t, r, c) = % BD if chem_star.$ : - save p ; path p[] ; + chem_t := identity chem_transformed($) ; for i=f upto t : p0 := subpath chem_sb_pair of chem_r_fragment($,i) ; if chem_bd_wedge : @@ -1227,8 +1275,8 @@ vardef chem_bd (suffix $) (expr f, t, r, c) = % BD p2 := p0 paralleled .5chem_dbl_offset ; fi for j=0 upto 3 : - chem_draw($, - point (j/3) of p1 -- point (j/3) of p2, + chem_draw( + (point (j/3) of p1 -- point (j/3) of p2) transformed chem_t, 2r,c,) ; endfor endfor @@ -1366,18 +1414,17 @@ enddef ; vardef chem_symbol(expr t) = draw textext(t) ; enddef ; vardef chem_text@#(expr txt, z) = % adapted copy of thelabel@ - save p ; picture p ; - p := textext(txt) ; - p := p + chem_pic := textext(txt) ; + chem_pic := chem_pic if (mfun_labtype@# >= 10) : - shifted (0,ypart center p) + shifted (0,ypart center chem_pic) fi - shifted (z + chem_text_offset*mfun_laboff@# - (mfun_labxf@#*lrcorner p + mfun_labyf@#*ulcorner p + (1-mfun_labxf@#-mfun_labyf@#)*llcorner p)) ; + shifted (z + chem_text_offset*mfun_laboff@# - (mfun_labxf@#*lrcorner chem_pic + mfun_labyf@#*ulcorner chem_pic + (1-mfun_labxf@#-mfun_labyf@#)*llcorner chem_pic)) ; if chem_text_trace : draw z withpen pencircle scaled 2pt withcolor red ; - draw boundingbox p withpen pencircle scaled 1pt withcolor red ; + draw boundingbox chem_pic withpen pencircle scaled 1pt withcolor red ; fi ; - p + chem_pic enddef ; % transform @@ -1389,9 +1436,9 @@ vardef chem_rot (suffix $) (expr d, s) = % ROT if d=0 : chem_rotation := 0 else : - save a, off ; numeric a, off ; off := if chem_stacked.$ : 3 else : 0 fi ; - a := .5(angle(point d+off of chem_b_path.$) - angle(point d+off-1 of chem_b_path.$)) ; - chem_rotation := (chem_rotation + s*a) mod 360 ; + n0 := if chem_stacked.$ : 3 else : 0 fi ; + n1 := .5(angle(point d+n0 of chem_b_path.$) - angle(point d+n0-1 of chem_b_path.$)) ; + chem_rotation := (chem_rotation + s*n1) mod 360 ; fi fi enddef ; @@ -1405,19 +1452,17 @@ vardef chem_mir (suffix $) (expr d, s) = % MIR chem_mirror := chem_mirror rotated 90 ; fi else : - save p ; pair p ; - p := (point d-1 of chem_b_path.$) scaled s ; % not chem_transformed + chem_pair0 := (point d-1 of chem_b_path.$) scaled s ; % not chem_transformed if chem_mirror=origin : - chem_mirror := p ; + chem_mirror := chem_pair0 ; else : - save a ; numeric a ; - a := angle(p)-angle(chem_mirror) ; - if (a>0) and (a> 180) : - a := 360 - a ; - elseif (a<0) and (a<-180) : - a := -360 - a ; + n0 := angle(chem_pair0)-angle(chem_mirror) ; + if (n0>0) and (n0> 180) : + n0 := 360 - n0 ; + elseif (n0<0) and (n0<-180) : + n0 := -360 - n0 ; fi - chem_rotation := (chem_rotation + 2a) mod 360 ; + chem_rotation := (chem_rotation + 2n0) mod 360 ; chem_mirror := origin ; fi fi @@ -1432,11 +1477,11 @@ vardef chem_dir (suffix $) (expr d, s) = % DIR (same as MOV(d-1)MOV(d+1)) currentpicture := currentpicture shifted - chem_origin ; chem_origin := origin ; else : - save p ; pair p ; - p := (((point d-2 of chem_b_path.$) shifted (point d of chem_b_path.$)) scaled s) + chem_pair0 := + (((point d-2 of chem_b_path.$) shifted (point d of chem_b_path.$)) scaled s) chem_transformed($) ; - currentpicture := currentpicture shifted -p ; - chem_origin := chem_origin - p ; + currentpicture := currentpicture shifted -chem_pair0 ; + chem_origin := chem_origin - chem_pair0 ; fi fi enddef ; @@ -1446,10 +1491,9 @@ vardef chem_mov (suffix $) (expr d, s) = % MOV currentpicture := currentpicture shifted - chem_origin ; chem_origin := origin ; else : - save p ; pair p ; - p := ((point d-1 of chem_b_path.$) scaled s) chem_transformed($) ; - currentpicture := currentpicture shifted -p ; - chem_origin := chem_origin - p ; + chem_pair0 := ((point d-1 of chem_b_path.$) scaled s) chem_transformed($) ; + currentpicture := currentpicture shifted -chem_pair0 ; + chem_origin := chem_origin - chem_pair0 ; fi ; enddef ; @@ -1494,10 +1538,9 @@ enddef ; vardef chem_rm (suffix $) (expr d, s) = % RM if (not chem_front.$) and (d<>0) : - save p ; pair p ; - p := ((point d-1 of chem_r_path.$) scaled s) chem_transformed($) ; - currentpicture := currentpicture shifted -p ; - chem_origin := chem_origin - p ; + chem_pair0 := ((point d-1 of chem_r_path.$) scaled s) chem_transformed($) ; + currentpicture := currentpicture shifted -chem_pair0 ; + chem_origin := chem_origin - chem_pair0 ; fi ; enddef ; @@ -1506,10 +1549,9 @@ vardef chem_off (suffix $) (expr d, s) = % OFF currentpicture := currentpicture shifted - chem_origin ; chem_origin := origin ; else : - save p ; pair p ; - p := (unitvector(point d-1 of chem_b_path.one)) scaled chem_setting_offset*s ; + chem_pair0 := (unitvector(point d-1 of chem_b_path.one)) scaled chem_setting_offset*s ; % not chem_transformed - currentpicture := currentpicture shifted -p ; - chem_origin := chem_origin - p ; + currentpicture := currentpicture shifted -chem_pair0 ; + chem_origin := chem_origin - chem_pair0 ; fi ; enddef ; diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mp-tool.mpiv index cdf0e02a9..9dd00bfb4 100644 --- a/metapost/context/base/mp-tool.mpiv +++ b/metapost/context/base/mp-tool.mpiv @@ -2183,3 +2183,100 @@ vardef mcomponent expr p = if cmykcolor p : magentapart p elseif rgbcolor p : 1 vardef ycomponent expr p = if cmykcolor p : yellowpart p elseif rgbcolor p : 1 - bluepart p else : p fi enddef ; vardef bcomponent expr p = if cmykcolor p : blackpart p elseif rgbcolor p : 0 else : p fi enddef ; +% draw image (...) ... ; % prescripts prepended to first, postscripts appended to last +% draw decorated (...) ... ; % prescripts prepended to each, postscripts appended to each +% draw redecorated (...) ... ; % prescripts assigned to each, postscripts assigned to each +% draw undecorated (...) ... ; % following properties are ignored, existing properties are kept +% +% draw decorated ( +% draw fullcircle scaled 20cm withpen pencircle scaled 20mm withcolor red withtransparency (1,.40) ; +% draw fullcircle scaled 15cm withpen pencircle scaled 15mm withcolor green withtransparency (1,.30) ; +% draw fullcircle scaled 10cm withpen pencircle scaled 10mm withcolor blue withtransparency (1,.20) ; +% ) +% withcolor blue +% withtransparency (1,.125) % selectively applied +% withpen pencircle scaled 10mm +% ; + +% vardef image (text imagedata) = % already defined +% save currentpicture ; +% picture currentpicture ; +% currentpicture := nullpicture ; +% imagedata ; +% currentpicture +% enddef ; + +vardef undecorated (text imagedata) text decoration = + save currentpicture ; + picture currentpicture ; + currentpicture := nullpicture ; + imagedata ; + currentpicture +enddef ; + +vardef decorated (text imagedata) text decoration = + save mfun_decorated_path, currentpicture ; + picture mfun_decorated_path, currentpicture ; + currentpicture := nullpicture ; + imagedata ; + mfun_decorated_path := currentpicture ; + currentpicture := nullpicture ; + for i within mfun_decorated_path : + addto currentpicture + if stroked i : + doublepath pathpart i + dashed dashpart i + withpen penpart i + withcolor colorpart i + % withprescript prescriptpart i + % withpostscript postscriptpart i + decoration + elseif filled i : + contour pathpart i + withpen penpart i + withcolor colorpart i + % withprescript prescriptpart i + % withpostscript postscriptpart i + decoration + elseif textual i : + also i + withcolor colorpart i + % withprescript prescriptpart i + % withpostscript postscriptpart i + decoration + else : + also i + fi + ; + endfor ; + currentpicture +enddef ; + +vardef redecorated (text imagedata) text decoration = + save mfun_decorated_path, currentpicture ; + picture mfun_decorated_path, currentpicture ; + currentpicture := nullpicture ; + imagedata ; + mfun_decorated_path := currentpicture ; + currentpicture := nullpicture ; + for i within mfun_decorated_path : + addto currentpicture + if stroked i : + doublepath pathpart i + dashed dashpart i + withpen penpart i + decoration + elseif filled i : + contour pathpart i + withpen penpart i + decoration + elseif textual i : + also i + decoration + else : + also i + fi + ; + endfor ; + currentpicture +enddef ; diff --git a/tex/context/base/char-ini.lua b/tex/context/base/char-ini.lua index 70e893b2c..e0480df65 100644 --- a/tex/context/base/char-ini.lua +++ b/tex/context/base/char-ini.lua @@ -134,185 +134,204 @@ setmetatableindex(data, function(t,k) end) local blocks = allocate { - ["aegeannumbers"] = { first = 0x10100, last = 0x1013F, description = "Aegean Numbers" }, - ["alphabeticpresentationforms"] = { first = 0x0FB00, last = 0x0FB4F, description = "Alphabetic Presentation Forms" }, - ["ancientgreekmusicalnotation"] = { first = 0x1D200, last = 0x1D24F, description = "Ancient Greek Musical Notation" }, - ["ancientgreeknumbers"] = { first = 0x10140, last = 0x1018F, description = "Ancient Greek Numbers" }, - ["ancientsymbols"] = { first = 0x10190, last = 0x101CF, description = "Ancient Symbols" }, - ["arabic"] = { first = 0x00600, last = 0x006FF, description = "Arabic" }, - ["arabicpresentationformsa"] = { first = 0x0FB50, last = 0x0FDFF, description = "Arabic Presentation Forms-A" }, - ["arabicpresentationformsb"] = { first = 0x0FE70, last = 0x0FEFF, description = "Arabic Presentation Forms-B" }, - ["arabicsupplement"] = { first = 0x00750, last = 0x0077F, description = "Arabic Supplement" }, - ["armenian"] = { first = 0x00530, last = 0x0058F, description = "Armenian" }, - ["arrows"] = { first = 0x02190, last = 0x021FF, description = "Arrows" }, - ["balinese"] = { first = 0x01B00, last = 0x01B7F, description = "Balinese" }, - ["basiclatin"] = { first = 0x00000, last = 0x0007F, description = "Basic Latin" }, - ["bengali"] = { first = 0x00980, last = 0x009FF, description = "Bengali" }, - ["blockelements"] = { first = 0x02580, last = 0x0259F, description = "Block Elements" }, - ["bopomofo"] = { first = 0x03100, last = 0x0312F, description = "Bopomofo" }, - ["bopomofoextended"] = { first = 0x031A0, last = 0x031BF, description = "Bopomofo Extended" }, - ["boxdrawing"] = { first = 0x02500, last = 0x0257F, description = "Box Drawing" }, - ["braillepatterns"] = { first = 0x02800, last = 0x028FF, description = "Braille Patterns" }, - ["buginese"] = { first = 0x01A00, last = 0x01A1F, description = "Buginese" }, - ["buhid"] = { first = 0x01740, last = 0x0175F, description = "Buhid" }, - ["byzantinemusicalsymbols"] = { first = 0x1D000, last = 0x1D0FF, description = "Byzantine Musical Symbols" }, - ["carian"] = { first = 0x102A0, last = 0x102DF, description = "Carian" }, - ["cham"] = { first = 0x0AA00, last = 0x0AA5F, description = "Cham" }, - ["cherokee"] = { first = 0x013A0, last = 0x013FF, description = "Cherokee" }, - ["cjkcompatibility"] = { first = 0x03300, last = 0x033FF, description = "CJK Compatibility" }, - ["cjkcompatibilityforms"] = { first = 0x0FE30, last = 0x0FE4F, description = "CJK Compatibility Forms" }, - ["cjkcompatibilityideographs"] = { first = 0x0F900, last = 0x0FAFF, description = "CJK Compatibility Ideographs" }, - ["cjkcompatibilityideographssupplement"] = { first = 0x2F800, last = 0x2FA1F, description = "CJK Compatibility Ideographs Supplement" }, - ["cjkradicalssupplement"] = { first = 0x02E80, last = 0x02EFF, description = "CJK Radicals Supplement" }, - ["cjkstrokes"] = { first = 0x031C0, last = 0x031EF, description = "CJK Strokes" }, - ["cjksymbolsandpunctuation"] = { first = 0x03000, last = 0x0303F, description = "CJK Symbols and Punctuation" }, - ["cjkunifiedideographs"] = { first = 0x04E00, last = 0x09FFF, description = "CJK Unified Ideographs" }, - ["cjkunifiedideographsextensiona"] = { first = 0x03400, last = 0x04DBF, description = "CJK Unified Ideographs Extension A" }, - ["cjkunifiedideographsextensionb"] = { first = 0x20000, last = 0x2A6DF, description = "CJK Unified Ideographs Extension B" }, - ["combiningdiacriticalmarks"] = { first = 0x00300, last = 0x0036F, description = "Combining Diacritical Marks" }, - ["combiningdiacriticalmarksforsymbols"] = { first = 0x020D0, last = 0x020FF, description = "Combining Diacritical Marks for Symbols" }, - ["combiningdiacriticalmarkssupplement"] = { first = 0x01DC0, last = 0x01DFF, description = "Combining Diacritical Marks Supplement" }, - ["combininghalfmarks"] = { first = 0x0FE20, last = 0x0FE2F, description = "Combining Half Marks" }, - ["controlpictures"] = { first = 0x02400, last = 0x0243F, description = "Control Pictures" }, - ["coptic"] = { first = 0x02C80, last = 0x02CFF, description = "Coptic" }, - ["countingrodnumerals"] = { first = 0x1D360, last = 0x1D37F, description = "Counting Rod Numerals" }, - ["cuneiform"] = { first = 0x12000, last = 0x123FF, description = "Cuneiform" }, - ["cuneiformnumbersandpunctuation"] = { first = 0x12400, last = 0x1247F, description = "Cuneiform Numbers and Punctuation" }, - ["currencysymbols"] = { first = 0x020A0, last = 0x020CF, description = "Currency Symbols" }, - ["cypriotsyllabary"] = { first = 0x10800, last = 0x1083F, description = "Cypriot Syllabary" }, - ["cyrillic"] = { first = 0x00400, last = 0x004FF, description = "Cyrillic" }, - ["cyrillicextendeda"] = { first = 0x02DE0, last = 0x02DFF, description = "Cyrillic Extended-A" }, - ["cyrillicextendedb"] = { first = 0x0A640, last = 0x0A69F, description = "Cyrillic Extended-B" }, - ["cyrillicsupplement"] = { first = 0x00500, last = 0x0052F, description = "Cyrillic Supplement" }, - ["deseret"] = { first = 0x10400, last = 0x1044F, description = "Deseret" }, - ["devanagari"] = { first = 0x00900, last = 0x0097F, description = "Devanagari" }, - ["dingbats"] = { first = 0x02700, last = 0x027BF, description = "Dingbats" }, - ["dominotiles"] = { first = 0x1F030, last = 0x1F09F, description = "Domino Tiles" }, - ["enclosedalphanumerics"] = { first = 0x02460, last = 0x024FF, description = "Enclosed Alphanumerics" }, - ["enclosedcjklettersandmonths"] = { first = 0x03200, last = 0x032FF, description = "Enclosed CJK Letters and Months" }, - ["ethiopic"] = { first = 0x01200, last = 0x0137F, description = "Ethiopic" }, - ["ethiopicextended"] = { first = 0x02D80, last = 0x02DDF, description = "Ethiopic Extended" }, - ["ethiopicsupplement"] = { first = 0x01380, last = 0x0139F, description = "Ethiopic Supplement" }, - ["generalpunctuation"] = { first = 0x02000, last = 0x0206F, description = "General Punctuation" }, - ["geometricshapes"] = { first = 0x025A0, last = 0x025FF, description = "Geometric Shapes" }, - ["georgian"] = { first = 0x010A0, last = 0x010FF, description = "Georgian" }, - ["georgiansupplement"] = { first = 0x02D00, last = 0x02D2F, description = "Georgian Supplement" }, - ["glagolitic"] = { first = 0x02C00, last = 0x02C5F, description = "Glagolitic" }, - ["gothic"] = { first = 0x10330, last = 0x1034F, description = "Gothic" }, - ["greekandcoptic"] = { first = 0x00370, last = 0x003FF, description = "Greek and Coptic" }, - ["greekextended"] = { first = 0x01F00, last = 0x01FFF, description = "Greek Extended" }, - ["gujarati"] = { first = 0x00A80, last = 0x00AFF, description = "Gujarati" }, - ["gurmukhi"] = { first = 0x00A00, last = 0x00A7F, description = "Gurmukhi" }, - ["halfwidthandfullwidthforms"] = { first = 0x0FF00, last = 0x0FFEF, description = "Halfwidth and Fullwidth Forms" }, - ["hangulcompatibilityjamo"] = { first = 0x03130, last = 0x0318F, description = "Hangul Compatibility Jamo" }, - ["hanguljamo"] = { first = 0x01100, last = 0x011FF, description = "Hangul Jamo" }, - ["hangulsyllables"] = { first = 0x0AC00, last = 0x0D7AF, description = "Hangul Syllables" }, - ["hanunoo"] = { first = 0x01720, last = 0x0173F, description = "Hanunoo" }, - ["hebrew"] = { first = 0x00590, last = 0x005FF, description = "Hebrew" }, - ["highprivateusesurrogates"] = { first = 0x0DB80, last = 0x0DBFF, description = "High Private Use Surrogates" }, - ["highsurrogates"] = { first = 0x0D800, last = 0x0DB7F, description = "High Surrogates" }, - ["hiragana"] = { first = 0x03040, last = 0x0309F, description = "Hiragana" }, - ["ideographicdescriptioncharacters"] = { first = 0x02FF0, last = 0x02FFF, description = "Ideographic Description Characters" }, - ["ipaextensions"] = { first = 0x00250, last = 0x002AF, description = "IPA Extensions" }, - ["kanbun"] = { first = 0x03190, last = 0x0319F, description = "Kanbun" }, - ["kangxiradicals"] = { first = 0x02F00, last = 0x02FDF, description = "Kangxi Radicals" }, - ["kannada"] = { first = 0x00C80, last = 0x00CFF, description = "Kannada" }, - ["katakana"] = { first = 0x030A0, last = 0x030FF, description = "Katakana" }, - ["katakanaphoneticextensions"] = { first = 0x031F0, last = 0x031FF, description = "Katakana Phonetic Extensions" }, - ["kayahli"] = { first = 0x0A900, last = 0x0A92F, description = "Kayah Li" }, - ["kharoshthi"] = { first = 0x10A00, last = 0x10A5F, description = "Kharoshthi" }, - ["khmer"] = { first = 0x01780, last = 0x017FF, description = "Khmer" }, - ["khmersymbols"] = { first = 0x019E0, last = 0x019FF, description = "Khmer Symbols" }, - ["lao"] = { first = 0x00E80, last = 0x00EFF, description = "Lao" }, - ["latinextendeda"] = { first = 0x00100, last = 0x0017F, description = "Latin Extended-A" }, - ["latinextendedadditional"] = { first = 0x01E00, last = 0x01EFF, description = "Latin Extended Additional" }, - ["latinextendedb"] = { first = 0x00180, last = 0x0024F, description = "Latin Extended-B" }, - ["latinextendedc"] = { first = 0x02C60, last = 0x02C7F, description = "Latin Extended-C" }, - ["latinextendedd"] = { first = 0x0A720, last = 0x0A7FF, description = "Latin Extended-D" }, - ["latinsupplement"] = { first = 0x00080, last = 0x000FF, description = "Latin-1 Supplement" }, - ["lepcha"] = { first = 0x01C00, last = 0x01C4F, description = "Lepcha" }, - ["letterlikesymbols"] = { first = 0x02100, last = 0x0214F, description = "Letterlike Symbols" }, - ["limbu"] = { first = 0x01900, last = 0x0194F, description = "Limbu" }, - ["linearbideograms"] = { first = 0x10080, last = 0x100FF, description = "Linear B Ideograms" }, - ["linearbsyllabary"] = { first = 0x10000, last = 0x1007F, description = "Linear B Syllabary" }, - ["lowsurrogates"] = { first = 0x0DC00, last = 0x0DFFF, description = "Low Surrogates" }, - ["lycian"] = { first = 0x10280, last = 0x1029F, description = "Lycian" }, - ["lydian"] = { first = 0x10920, last = 0x1093F, description = "Lydian" }, - ["mahjongtiles"] = { first = 0x1F000, last = 0x1F02F, description = "Mahjong Tiles" }, - ["malayalam"] = { first = 0x00D00, last = 0x00D7F, description = "Malayalam" }, - ["mathematicalalphanumericsymbols"] = { first = 0x1D400, last = 0x1D7FF, description = "Mathematical Alphanumeric Symbols" }, - ["mathematicaloperators"] = { first = 0x02200, last = 0x022FF, description = "Mathematical Operators" }, - ["miscellaneousmathematicalsymbolsa"] = { first = 0x027C0, last = 0x027EF, description = "Miscellaneous Mathematical Symbols-A" }, - ["miscellaneousmathematicalsymbolsb"] = { first = 0x02980, last = 0x029FF, description = "Miscellaneous Mathematical Symbols-B" }, - ["miscellaneoussymbols"] = { first = 0x02600, last = 0x026FF, description = "Miscellaneous Symbols" }, - ["miscellaneoussymbolsandarrows"] = { first = 0x02B00, last = 0x02BFF, description = "Miscellaneous Symbols and Arrows" }, - ["miscellaneoustechnical"] = { first = 0x02300, last = 0x023FF, description = "Miscellaneous Technical" }, - ["modifiertoneletters"] = { first = 0x0A700, last = 0x0A71F, description = "Modifier Tone Letters" }, - ["mongolian"] = { first = 0x01800, last = 0x018AF, description = "Mongolian" }, - ["musicalsymbols"] = { first = 0x1D100, last = 0x1D1FF, description = "Musical Symbols" }, - ["myanmar"] = { first = 0x01000, last = 0x0109F, description = "Myanmar" }, - ["newtailue"] = { first = 0x01980, last = 0x019DF, description = "New Tai Lue" }, - ["nko"] = { first = 0x007C0, last = 0x007FF, description = "NKo" }, - ["numberforms"] = { first = 0x02150, last = 0x0218F, description = "Number Forms" }, - ["ogham"] = { first = 0x01680, last = 0x0169F, description = "Ogham" }, - ["olchiki"] = { first = 0x01C50, last = 0x01C7F, description = "Ol Chiki" }, - ["olditalic"] = { first = 0x10300, last = 0x1032F, description = "Old Italic" }, - ["oldpersian"] = { first = 0x103A0, last = 0x103DF, description = "Old Persian" }, - ["opticalcharacterrecognition"] = { first = 0x02440, last = 0x0245F, description = "Optical Character Recognition" }, - ["oriya"] = { first = 0x00B00, last = 0x00B7F, description = "Oriya" }, - ["osmanya"] = { first = 0x10480, last = 0x104AF, description = "Osmanya" }, - ["phagspa"] = { first = 0x0A840, last = 0x0A87F, description = "Phags-pa" }, - ["phaistosdisc"] = { first = 0x101D0, last = 0x101FF, description = "Phaistos Disc" }, - ["phoenician"] = { first = 0x10900, last = 0x1091F, description = "Phoenician" }, - ["phoneticextensions"] = { first = 0x01D00, last = 0x01D7F, description = "Phonetic Extensions" }, - ["phoneticextensionssupplement"] = { first = 0x01D80, last = 0x01DBF, description = "Phonetic Extensions Supplement" }, - ["privateusearea"] = { first = 0x0E000, last = 0x0F8FF, description = "Private Use Area" }, - ["rejang"] = { first = 0x0A930, last = 0x0A95F, description = "Rejang" }, - ["runic"] = { first = 0x016A0, last = 0x016FF, description = "Runic" }, - ["saurashtra"] = { first = 0x0A880, last = 0x0A8DF, description = "Saurashtra" }, - ["shavian"] = { first = 0x10450, last = 0x1047F, description = "Shavian" }, - ["sinhala"] = { first = 0x00D80, last = 0x00DFF, description = "Sinhala" }, - ["smallformvariants"] = { first = 0x0FE50, last = 0x0FE6F, description = "Small Form Variants" }, - ["spacingmodifierletters"] = { first = 0x002B0, last = 0x002FF, description = "Spacing Modifier Letters" }, - ["specials"] = { first = 0x0FFF0, last = 0x0FFFF, description = "Specials" }, - ["sundanese"] = { first = 0x01B80, last = 0x01BBF, description = "Sundanese" }, - ["superscriptsandsubscripts"] = { first = 0x02070, last = 0x0209F, description = "Superscripts and Subscripts" }, - ["supplementalarrowsa"] = { first = 0x027F0, last = 0x027FF, description = "Supplemental Arrows-A" }, - ["supplementalarrowsb"] = { first = 0x02900, last = 0x0297F, description = "Supplemental Arrows-B" }, - ["supplementalmathematicaloperators"] = { first = 0x02A00, last = 0x02AFF, description = "Supplemental Mathematical Operators" }, - ["supplementalpunctuation"] = { first = 0x02E00, last = 0x02E7F, description = "Supplemental Punctuation" }, - ["supplementaryprivateuseareaa"] = { first = 0xF0000, last = 0xFFFFF, description = "Supplementary Private Use Area-A" }, - ["supplementaryprivateuseareab"] = { first = 0x100000,last = 0x10FFFF,description = "Supplementary Private Use Area-B" }, - ["sylotinagri"] = { first = 0x0A800, last = 0x0A82F, description = "Syloti Nagri" }, - ["syriac"] = { first = 0x00700, last = 0x0074F, description = "Syriac" }, - ["tagalog"] = { first = 0x01700, last = 0x0171F, description = "Tagalog" }, - ["tagbanwa"] = { first = 0x01760, last = 0x0177F, description = "Tagbanwa" }, - ["tags"] = { first = 0xE0000, last = 0xE007F, description = "Tags" }, - ["taile"] = { first = 0x01950, last = 0x0197F, description = "Tai Le" }, - ["taixuanjingsymbols"] = { first = 0x1D300, last = 0x1D35F, description = "Tai Xuan Jing Symbols" }, - ["tamil"] = { first = 0x00B80, last = 0x00BFF, description = "Tamil" }, - ["telugu"] = { first = 0x00C00, last = 0x00C7F, description = "Telugu" }, - ["thaana"] = { first = 0x00780, last = 0x007BF, description = "Thaana" }, - ["thai"] = { first = 0x00E00, last = 0x00E7F, description = "Thai" }, - ["tibetan"] = { first = 0x00F00, last = 0x00FFF, description = "Tibetan" }, - ["tifinagh"] = { first = 0x02D30, last = 0x02D7F, description = "Tifinagh" }, - ["ugaritic"] = { first = 0x10380, last = 0x1039F, description = "Ugaritic" }, - ["unifiedcanadianaboriginalsyllabics"] = { first = 0x01400, last = 0x0167F, description = "Unified Canadian Aboriginal Syllabics" }, - ["vai"] = { first = 0x0A500, last = 0x0A63F, description = "Vai" }, - ["variationselectors"] = { first = 0x0FE00, last = 0x0FE0F, description = "Variation Selectors" }, - ["variationselectorssupplement"] = { first = 0xE0100, last = 0xE01EF, description = "Variation Selectors Supplement" }, - ["verticalforms"] = { first = 0x0FE10, last = 0x0FE1F, description = "Vertical Forms" }, - ["yijinghexagramsymbols"] = { first = 0x04DC0, last = 0x04DFF, description = "Yijing Hexagram Symbols" }, - ["yiradicals"] = { first = 0x0A490, last = 0x0A4CF, description = "Yi Radicals" }, - ["yisyllables"] = { first = 0x0A000, last = 0x0A48F, description = "Yi Syllables" }, + ["aegeannumbers"] = { first = 0x10100, last = 0x1013F, description = "Aegean Numbers" }, + ["alphabeticpresentationforms"] = { first = 0x0FB00, last = 0x0FB4F, otf="latn", description = "Alphabetic Presentation Forms" }, + ["ancientgreekmusicalnotation"] = { first = 0x1D200, last = 0x1D24F, otf="grek", description = "Ancient Greek Musical Notation" }, + ["ancientgreeknumbers"] = { first = 0x10140, last = 0x1018F, otf="grek", description = "Ancient Greek Numbers" }, + ["ancientsymbols"] = { first = 0x10190, last = 0x101CF, otf="grek", description = "Ancient Symbols" }, + ["arabic"] = { first = 0x00600, last = 0x006FF, otf="arab", description = "Arabic" }, + ["arabicpresentationformsa"] = { first = 0x0FB50, last = 0x0FDFF, otf="arab", description = "Arabic Presentation Forms-A" }, + ["arabicpresentationformsb"] = { first = 0x0FE70, last = 0x0FEFF, otf="arab", description = "Arabic Presentation Forms-B" }, + ["arabicsupplement"] = { first = 0x00750, last = 0x0077F, otf="arab", description = "Arabic Supplement" }, + ["armenian"] = { first = 0x00530, last = 0x0058F, otf="armn", description = "Armenian" }, + ["arrows"] = { first = 0x02190, last = 0x021FF, description = "Arrows" }, + ["balinese"] = { first = 0x01B00, last = 0x01B7F, otf="bali", description = "Balinese" }, + ["basiclatin"] = { first = 0x00000, last = 0x0007F, otf="latn", description = "Basic Latin" }, + ["bengali"] = { first = 0x00980, last = 0x009FF, otf="beng", description = "Bengali" }, + ["blockelements"] = { first = 0x02580, last = 0x0259F, otf="bopo", description = "Block Elements" }, + ["bopomofo"] = { first = 0x03100, last = 0x0312F, otf="bopo", description = "Bopomofo" }, + ["bopomofoextended"] = { first = 0x031A0, last = 0x031BF, otf="bopo", description = "Bopomofo Extended" }, + ["boxdrawing"] = { first = 0x02500, last = 0x0257F, description = "Box Drawing" }, + ["braillepatterns"] = { first = 0x02800, last = 0x028FF, otf="brai", description = "Braille Patterns" }, + ["buginese"] = { first = 0x01A00, last = 0x01A1F, otf="bugi", description = "Buginese" }, + ["buhid"] = { first = 0x01740, last = 0x0175F, otf="buhd", description = "Buhid" }, + ["byzantinemusicalsymbols"] = { first = 0x1D000, last = 0x1D0FF, otf="byzm", description = "Byzantine Musical Symbols" }, + ["carian"] = { first = 0x102A0, last = 0x102DF, description = "Carian" }, + ["cham"] = { first = 0x0AA00, last = 0x0AA5F, description = "Cham" }, + ["cherokee"] = { first = 0x013A0, last = 0x013FF, otf="cher", description = "Cherokee" }, + ["cjkcompatibility"] = { first = 0x03300, last = 0x033FF, otf="hang", description = "CJK Compatibility" }, + ["cjkcompatibilityforms"] = { first = 0x0FE30, last = 0x0FE4F, otf="hang", description = "CJK Compatibility Forms" }, + ["cjkcompatibilityideographs"] = { first = 0x0F900, last = 0x0FAFF, otf="hang", description = "CJK Compatibility Ideographs" }, + ["cjkcompatibilityideographssupplement"] = { first = 0x2F800, last = 0x2FA1F, otf="hang", description = "CJK Compatibility Ideographs Supplement" }, + ["cjkradicalssupplement"] = { first = 0x02E80, last = 0x02EFF, otf="hang", description = "CJK Radicals Supplement" }, + ["cjkstrokes"] = { first = 0x031C0, last = 0x031EF, otf="hang", description = "CJK Strokes" }, + ["cjksymbolsandpunctuation"] = { first = 0x03000, last = 0x0303F, otf="hang", description = "CJK Symbols and Punctuation" }, + ["cjkunifiedideographs"] = { first = 0x04E00, last = 0x09FFF, otf="hang", description = "CJK Unified Ideographs" }, + ["cjkunifiedideographsextensiona"] = { first = 0x03400, last = 0x04DBF, otf="hang", description = "CJK Unified Ideographs Extension A" }, + ["cjkunifiedideographsextensionb"] = { first = 0x20000, last = 0x2A6DF, otf="hang", description = "CJK Unified Ideographs Extension B" }, + ["combiningdiacriticalmarks"] = { first = 0x00300, last = 0x0036F, description = "Combining Diacritical Marks" }, + ["combiningdiacriticalmarksforsymbols"] = { first = 0x020D0, last = 0x020FF, description = "Combining Diacritical Marks for Symbols" }, + ["combiningdiacriticalmarkssupplement"] = { first = 0x01DC0, last = 0x01DFF, description = "Combining Diacritical Marks Supplement" }, + ["combininghalfmarks"] = { first = 0x0FE20, last = 0x0FE2F, description = "Combining Half Marks" }, + ["controlpictures"] = { first = 0x02400, last = 0x0243F, description = "Control Pictures" }, + ["coptic"] = { first = 0x02C80, last = 0x02CFF, otf="copt", description = "Coptic" }, + ["countingrodnumerals"] = { first = 0x1D360, last = 0x1D37F, description = "Counting Rod Numerals" }, + ["cuneiform"] = { first = 0x12000, last = 0x123FF, otf="xsux", description = "Cuneiform" }, + ["cuneiformnumbersandpunctuation"] = { first = 0x12400, last = 0x1247F, otf="xsux", description = "Cuneiform Numbers and Punctuation" }, + ["currencysymbols"] = { first = 0x020A0, last = 0x020CF, description = "Currency Symbols" }, + ["cypriotsyllabary"] = { first = 0x10800, last = 0x1083F, otf="cprt", description = "Cypriot Syllabary" }, + ["cyrillic"] = { first = 0x00400, last = 0x004FF, otf="cyrl", description = "Cyrillic" }, + ["cyrillicextendeda"] = { first = 0x02DE0, last = 0x02DFF, otf="cyrl", description = "Cyrillic Extended-A" }, + ["cyrillicextendedb"] = { first = 0x0A640, last = 0x0A69F, otf="cyrl", description = "Cyrillic Extended-B" }, + ["cyrillicsupplement"] = { first = 0x00500, last = 0x0052F, otf="cyrl", description = "Cyrillic Supplement" }, + ["deseret"] = { first = 0x10400, last = 0x1044F, otf="dsrt", description = "Deseret" }, + ["devanagari"] = { first = 0x00900, last = 0x0097F, otf="deva", description = "Devanagari" }, + ["dingbats"] = { first = 0x02700, last = 0x027BF, description = "Dingbats" }, + ["dominotiles"] = { first = 0x1F030, last = 0x1F09F, description = "Domino Tiles" }, + ["enclosedalphanumerics"] = { first = 0x02460, last = 0x024FF, description = "Enclosed Alphanumerics" }, + ["enclosedcjklettersandmonths"] = { first = 0x03200, last = 0x032FF, description = "Enclosed CJK Letters and Months" }, + ["ethiopic"] = { first = 0x01200, last = 0x0137F, otf="ethi", description = "Ethiopic" }, + ["ethiopicextended"] = { first = 0x02D80, last = 0x02DDF, otf="ethi", description = "Ethiopic Extended" }, + ["ethiopicsupplement"] = { first = 0x01380, last = 0x0139F, otf="ethi", description = "Ethiopic Supplement" }, + ["generalpunctuation"] = { first = 0x02000, last = 0x0206F, description = "General Punctuation" }, + ["geometricshapes"] = { first = 0x025A0, last = 0x025FF, description = "Geometric Shapes" }, + ["georgian"] = { first = 0x010A0, last = 0x010FF, otf="geor", description = "Georgian" }, + ["georgiansupplement"] = { first = 0x02D00, last = 0x02D2F, otf="geor", description = "Georgian Supplement" }, + ["glagolitic"] = { first = 0x02C00, last = 0x02C5F, otf="glag", description = "Glagolitic" }, + ["gothic"] = { first = 0x10330, last = 0x1034F, otf="goth", description = "Gothic" }, + ["greekandcoptic"] = { first = 0x00370, last = 0x003FF, otf="grek", description = "Greek and Coptic" }, + ["greekextended"] = { first = 0x01F00, last = 0x01FFF, otf="grek", description = "Greek Extended" }, + ["gujarati"] = { first = 0x00A80, last = 0x00AFF, otf="gujr", description = "Gujarati" }, + ["gurmukhi"] = { first = 0x00A00, last = 0x00A7F, otf="guru", description = "Gurmukhi" }, + ["halfwidthandfullwidthforms"] = { first = 0x0FF00, last = 0x0FFEF, description = "Halfwidth and Fullwidth Forms" }, + ["hangulcompatibilityjamo"] = { first = 0x03130, last = 0x0318F, otf="jamo", description = "Hangul Compatibility Jamo" }, + ["hanguljamo"] = { first = 0x01100, last = 0x011FF, otf="jamo", description = "Hangul Jamo" }, + ["hangulsyllables"] = { first = 0x0AC00, last = 0x0D7AF, otf="hang", description = "Hangul Syllables" }, + ["hanunoo"] = { first = 0x01720, last = 0x0173F, otf="hano", description = "Hanunoo" }, + ["hebrew"] = { first = 0x00590, last = 0x005FF, otf="hebr", description = "Hebrew" }, + ["highprivateusesurrogates"] = { first = 0x0DB80, last = 0x0DBFF, description = "High Private Use Surrogates" }, + ["highsurrogates"] = { first = 0x0D800, last = 0x0DB7F, description = "High Surrogates" }, + ["hiragana"] = { first = 0x03040, last = 0x0309F, otf="kana", description = "Hiragana" }, + ["ideographicdescriptioncharacters"] = { first = 0x02FF0, last = 0x02FFF, description = "Ideographic Description Characters" }, + ["ipaextensions"] = { first = 0x00250, last = 0x002AF, description = "IPA Extensions" }, + ["kanbun"] = { first = 0x03190, last = 0x0319F, description = "Kanbun" }, + ["kangxiradicals"] = { first = 0x02F00, last = 0x02FDF, description = "Kangxi Radicals" }, + ["kannada"] = { first = 0x00C80, last = 0x00CFF, otf="knda", description = "Kannada" }, + ["katakana"] = { first = 0x030A0, last = 0x030FF, otf="kana", description = "Katakana" }, + ["katakanaphoneticextensions"] = { first = 0x031F0, last = 0x031FF, otf="kana", description = "Katakana Phonetic Extensions" }, + ["kayahli"] = { first = 0x0A900, last = 0x0A92F, description = "Kayah Li" }, + ["kharoshthi"] = { first = 0x10A00, last = 0x10A5F, otf="khar", description = "Kharoshthi" }, + ["khmer"] = { first = 0x01780, last = 0x017FF, otf="khmr", description = "Khmer" }, + ["khmersymbols"] = { first = 0x019E0, last = 0x019FF, otf="khmr", description = "Khmer Symbols" }, + ["lao"] = { first = 0x00E80, last = 0x00EFF, otf="lao", description = "Lao" }, + ["latinextendeda"] = { first = 0x00100, last = 0x0017F, otf="latn", description = "Latin Extended-A" }, + ["latinextendedadditional"] = { first = 0x01E00, last = 0x01EFF, otf="latn", description = "Latin Extended Additional" }, + ["latinextendedb"] = { first = 0x00180, last = 0x0024F, otf="latn", description = "Latin Extended-B" }, + ["latinextendedc"] = { first = 0x02C60, last = 0x02C7F, otf="latn", description = "Latin Extended-C" }, + ["latinextendedd"] = { first = 0x0A720, last = 0x0A7FF, otf="latn", description = "Latin Extended-D" }, + ["latinsupplement"] = { first = 0x00080, last = 0x000FF, otf="latn", description = "Latin-1 Supplement" }, + ["lepcha"] = { first = 0x01C00, last = 0x01C4F, description = "Lepcha" }, + ["letterlikesymbols"] = { first = 0x02100, last = 0x0214F, description = "Letterlike Symbols" }, + ["limbu"] = { first = 0x01900, last = 0x0194F, otf="limb", description = "Limbu" }, + ["linearbideograms"] = { first = 0x10080, last = 0x100FF, otf="linb", description = "Linear B Ideograms" }, + ["linearbsyllabary"] = { first = 0x10000, last = 0x1007F, otf="linb", description = "Linear B Syllabary" }, + ["lowsurrogates"] = { first = 0x0DC00, last = 0x0DFFF, description = "Low Surrogates" }, + ["lycian"] = { first = 0x10280, last = 0x1029F, description = "Lycian" }, + ["lydian"] = { first = 0x10920, last = 0x1093F, description = "Lydian" }, + ["mahjongtiles"] = { first = 0x1F000, last = 0x1F02F, description = "Mahjong Tiles" }, + ["malayalam"] = { first = 0x00D00, last = 0x00D7F, otf="mlym", description = "Malayalam" }, + ["mathematicalalphanumericsymbols"] = { first = 0x1D400, last = 0x1D7FF, description = "Mathematical Alphanumeric Symbols" }, + ["mathematicaloperators"] = { first = 0x02200, last = 0x022FF, description = "Mathematical Operators" }, + ["miscellaneousmathematicalsymbolsa"] = { first = 0x027C0, last = 0x027EF, description = "Miscellaneous Mathematical Symbols-A" }, + ["miscellaneousmathematicalsymbolsb"] = { first = 0x02980, last = 0x029FF, description = "Miscellaneous Mathematical Symbols-B" }, + ["miscellaneoussymbols"] = { first = 0x02600, last = 0x026FF, description = "Miscellaneous Symbols" }, + ["miscellaneoussymbolsandarrows"] = { first = 0x02B00, last = 0x02BFF, description = "Miscellaneous Symbols and Arrows" }, + ["miscellaneoustechnical"] = { first = 0x02300, last = 0x023FF, description = "Miscellaneous Technical" }, + ["modifiertoneletters"] = { first = 0x0A700, last = 0x0A71F, description = "Modifier Tone Letters" }, + ["mongolian"] = { first = 0x01800, last = 0x018AF, otf="mong", description = "Mongolian" }, + ["musicalsymbols"] = { first = 0x1D100, last = 0x1D1FF, otf="musc", description = "Musical Symbols" }, + ["myanmar"] = { first = 0x01000, last = 0x0109F, otf="mymr", description = "Myanmar" }, + ["newtailue"] = { first = 0x01980, last = 0x019DF, description = "New Tai Lue" }, + ["nko"] = { first = 0x007C0, last = 0x007FF, otf="nko", description = "NKo" }, + ["numberforms"] = { first = 0x02150, last = 0x0218F, description = "Number Forms" }, + ["ogham"] = { first = 0x01680, last = 0x0169F, otf="ogam", description = "Ogham" }, + ["olchiki"] = { first = 0x01C50, last = 0x01C7F, description = "Ol Chiki" }, + ["olditalic"] = { first = 0x10300, last = 0x1032F, otf="ital", description = "Old Italic" }, + ["oldpersian"] = { first = 0x103A0, last = 0x103DF, otf="xpeo", description = "Old Persian" }, + ["opticalcharacterrecognition"] = { first = 0x02440, last = 0x0245F, description = "Optical Character Recognition" }, + ["oriya"] = { first = 0x00B00, last = 0x00B7F, otf="orya", description = "Oriya" }, + ["osmanya"] = { first = 0x10480, last = 0x104AF, otf="osma", description = "Osmanya" }, + ["phagspa"] = { first = 0x0A840, last = 0x0A87F, otf="phag", description = "Phags-pa" }, + ["phaistosdisc"] = { first = 0x101D0, last = 0x101FF, description = "Phaistos Disc" }, + ["phoenician"] = { first = 0x10900, last = 0x1091F, otf="phnx", description = "Phoenician" }, + ["phoneticextensions"] = { first = 0x01D00, last = 0x01D7F, description = "Phonetic Extensions" }, + ["phoneticextensionssupplement"] = { first = 0x01D80, last = 0x01DBF, description = "Phonetic Extensions Supplement" }, + ["privateusearea"] = { first = 0x0E000, last = 0x0F8FF, description = "Private Use Area" }, + ["rejang"] = { first = 0x0A930, last = 0x0A95F, description = "Rejang" }, + ["runic"] = { first = 0x016A0, last = 0x016FF, otf="runr", description = "Runic" }, + ["saurashtra"] = { first = 0x0A880, last = 0x0A8DF, description = "Saurashtra" }, + ["shavian"] = { first = 0x10450, last = 0x1047F, otf="shaw", description = "Shavian" }, + ["sinhala"] = { first = 0x00D80, last = 0x00DFF, otf="sinh", description = "Sinhala" }, + ["smallformvariants"] = { first = 0x0FE50, last = 0x0FE6F, description = "Small Form Variants" }, + ["spacingmodifierletters"] = { first = 0x002B0, last = 0x002FF, description = "Spacing Modifier Letters" }, + ["specials"] = { first = 0x0FFF0, last = 0x0FFFF, description = "Specials" }, + ["sundanese"] = { first = 0x01B80, last = 0x01BBF, description = "Sundanese" }, + ["superscriptsandsubscripts"] = { first = 0x02070, last = 0x0209F, description = "Superscripts and Subscripts" }, + ["supplementalarrowsa"] = { first = 0x027F0, last = 0x027FF, description = "Supplemental Arrows-A" }, + ["supplementalarrowsb"] = { first = 0x02900, last = 0x0297F, description = "Supplemental Arrows-B" }, + ["supplementalmathematicaloperators"] = { first = 0x02A00, last = 0x02AFF, description = "Supplemental Mathematical Operators" }, + ["supplementalpunctuation"] = { first = 0x02E00, last = 0x02E7F, description = "Supplemental Punctuation" }, + ["supplementaryprivateuseareaa"] = { first = 0xF0000, last = 0xFFFFF, description = "Supplementary Private Use Area-A" }, + ["supplementaryprivateuseareab"] = { first = 0x100000,last = 0x10FFFF, description = "Supplementary Private Use Area-B" }, + ["sylotinagri"] = { first = 0x0A800, last = 0x0A82F, otf="sylo", description = "Syloti Nagri" }, + ["syriac"] = { first = 0x00700, last = 0x0074F, otf="syrc", description = "Syriac" }, + ["tagalog"] = { first = 0x01700, last = 0x0171F, otf="tglg", description = "Tagalog" }, + ["tagbanwa"] = { first = 0x01760, last = 0x0177F, otf="tagb", description = "Tagbanwa" }, + ["tags"] = { first = 0xE0000, last = 0xE007F, description = "Tags" }, + ["taile"] = { first = 0x01950, last = 0x0197F, otf="tale", description = "Tai Le" }, + ["taixuanjingsymbols"] = { first = 0x1D300, last = 0x1D35F, description = "Tai Xuan Jing Symbols" }, + ["tamil"] = { first = 0x00B80, last = 0x00BFF, otf="taml", description = "Tamil" }, + ["telugu"] = { first = 0x00C00, last = 0x00C7F, otf="telu", description = "Telugu" }, + ["thaana"] = { first = 0x00780, last = 0x007BF, otf="thaa", description = "Thaana" }, + ["thai"] = { first = 0x00E00, last = 0x00E7F, otf="thai", description = "Thai" }, + ["tibetan"] = { first = 0x00F00, last = 0x00FFF, otf="tibt", description = "Tibetan" }, + ["tifinagh"] = { first = 0x02D30, last = 0x02D7F, otf="tfng", description = "Tifinagh" }, + ["ugaritic"] = { first = 0x10380, last = 0x1039F, otf="ugar", description = "Ugaritic" }, + ["unifiedcanadianaboriginalsyllabics"] = { first = 0x01400, last = 0x0167F, otf="cans", description = "Unified Canadian Aboriginal Syllabics" }, + ["vai"] = { first = 0x0A500, last = 0x0A63F, description = "Vai" }, + ["variationselectors"] = { first = 0x0FE00, last = 0x0FE0F, description = "Variation Selectors" }, + ["variationselectorssupplement"] = { first = 0xE0100, last = 0xE01EF, description = "Variation Selectors Supplement" }, + ["verticalforms"] = { first = 0x0FE10, last = 0x0FE1F, description = "Vertical Forms" }, + ["yijinghexagramsymbols"] = { first = 0x04DC0, last = 0x04DFF, otf="yi", description = "Yijing Hexagram Symbols" }, + ["yiradicals"] = { first = 0x0A490, last = 0x0A4CF, otf="yi", description = "Yi Radicals" }, + ["yisyllables"] = { first = 0x0A000, last = 0x0A48F, otf="yi", description = "Yi Syllables" }, } characters.blocks = blocks -setmetatableindex(blocks, function(t,k) +setmetatableindex(blocks, function(t,k) -- we could use an intermediate table if called often return k and rawget(t,lower(gsub(k,"[^a-zA-Z]",""))) end) +local otfscripts = utilities.storage.allocate() +characters.otfscripts = otfscripts + +table.setmetatableindex(otfscripts,function(t,unicode) + for k, v in next, blocks do + local first, last = v.first, v.last + if unicode >= first and unicode <= last then + local script = v.otf or "dflt" + for u=first,last do + t[u] = script + end + return script + end + end + -- pretty slow when we're here + t[unicode] = "dflt" + return "dflt" +end) + function characters.getrange(name) -- used in font fallback definitions (name or range) local range = blocks[name] if range then diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 50a2e3a21..916fb902a 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.11.29 18:40} +\newcontextversion{2012.11.30 22:53} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index a9c3335b6..2dbe71608 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.11.29 18:40} +\newcontextversion{2012.11.30 22:53} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex c02b2e77f..d645699d0 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 5a2da6911..fe72b4e98 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index f1cad9278..98f34d94b 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2012.11.29 18:40} +\edef\contextversion{2012.11.30 22:53} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 1e72f7bfb..3f965044a 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.11.29 18:40} +\edef\contextversion{2012.11.30 22:53} %D For those who want to use this: diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index d4baec7bd..1e10e2e68 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -674,8 +674,8 @@ local function withset(name,what) texattribute[0] = done end -local function withfnt(name,what) - local font = currentfont() +local function withfnt(name,what,font) + local font = font or currentfont() local hash = font .. "*" .. name .. "*" .. what local done = cache[hash] if not done then diff --git a/tex/context/base/font-otb.lua b/tex/context/base/font-otb.lua index 04e289ba9..c37058d34 100644 --- a/tex/context/base/font-otb.lua +++ b/tex/context/base/font-otb.lua @@ -45,8 +45,8 @@ local function gref(descriptions,n) local num, nam = { }, { } for i=2,#n do -- first is likely a key local ni = n[i] - num[i] = format("U+%05X",ni) - nam[i] = descriptions[ni].name or "?" + num[i-1] = format("U+%05X",ni) + nam[i-1] = descriptions[ni].name or "?" end return format("%s (%s)",concat(num," "), concat(nam," ")) else diff --git a/tex/context/base/font-otd.lua b/tex/context/base/font-otd.lua index 0bc8225de..89f84804c 100644 --- a/tex/context/base/font-otd.lua +++ b/tex/context/base/font-otd.lua @@ -54,7 +54,7 @@ function otf.setdynamics(font,attribute) local script = features.script or 'dflt' local language = features.language or 'dflt' if script == "auto" then - -- checkedscript and resources are defined later so we cannot shortcut them + -- checkedscript and resources are defined later so we cannot shortcut them -- todo: make installer script = definers.checkedscript(fontdata[font],hashes.resources[font],features) end local ds = dynamics[script] -- can be metatable magic (less testing) diff --git a/tex/context/base/mult-fun.lua b/tex/context/base/mult-fun.lua index aa4ef64df..260497f52 100644 --- a/tex/context/base/mult-fun.lua +++ b/tex/context/base/mult-fun.lua @@ -92,5 +92,7 @@ return { "drawboundary", "drawwholepath", "visualizeddraw", "visualizedfill", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", + -- + "decorated", "redecorated", "undecorated", }, } diff --git a/tex/context/base/node-pro.lua b/tex/context/base/node-pro.lua index 73d22697e..d30ad49a9 100644 --- a/tex/context/base/node-pro.lua +++ b/tex/context/base/node-pro.lua @@ -72,7 +72,7 @@ function processors.pre_linebreak_filter(head,groupcode,size,packtype,direction) if found then if trace_callbacks then local before = nodes.count(head,true) - local head, done = actions(head,groupcode,size,packtype,direction) + local head, done = actions(head,groupcode,size,packtype,direction) -- todo : pass first local after = nodes.count(head,true) if done then tracer("pre_linebreak","changed",head,groupcode,before,after,true) @@ -81,7 +81,7 @@ function processors.pre_linebreak_filter(head,groupcode,size,packtype,direction) end return (done and head) or true else - local head, done = actions(head,groupcode,size,packtype,direction) + local head, done = actions(head,groupcode,size,packtype,direction) -- todo : pass first return (done and head) or true end elseif trace_callbacks then diff --git a/tex/context/base/page-mix.mkiv b/tex/context/base/page-mix.mkiv index 6c1c26667..97774681c 100644 --- a/tex/context/base/page-mix.mkiv +++ b/tex/context/base/page-mix.mkiv @@ -313,6 +313,8 @@ %D \stopmixedcolumns %D \stoptyping +\let\currentmixedcolumnsmethod\empty + \unexpanded\def\startmixedcolumns {\dodoubleempty\page_mix_start_columns} diff --git a/tex/context/base/scrp-ini.lua b/tex/context/base/scrp-ini.lua index 9b0e9fc21..0b8c49370 100644 --- a/tex/context/base/scrp-ini.lua +++ b/tex/context/base/scrp-ini.lua @@ -16,36 +16,37 @@ local trace_injections = false trackers.register("scripts.injections", function local report_preprocessing = logs.reporter("scripts","preprocessing") -local allocate = utilities.storage.allocate +local utfchar = utf.char -local set_attribute = node.set_attribute -local has_attribute = node.has_attribute -local first_glyph = node.first_glyph or node.first_character -local traverse_id = node.traverse_id +local set_attribute = node.set_attribute +local has_attribute = node.has_attribute +local first_glyph = node.first_glyph or node.first_character +local traverse_id = node.traverse_id -local texsetattribute = tex.setattribute +local texsetattribute = tex.setattribute -local nodecodes = nodes.nodecodes -local unsetvalue = attributes.unsetvalue +local nodecodes = nodes.nodecodes +local unsetvalue = attributes.unsetvalue -local glyph_code = nodecodes.glyph -local glue_code = nodecodes.glue +local glyph_code = nodecodes.glyph +local glue_code = nodecodes.glue -local a_preproc = attributes.private('preproc') -local a_prestat = attributes.private('prestat') +local a_preproc = attributes.private('preproc') +local a_prestat = attributes.private('prestat') -local fontdata = fonts.hashes.identifiers +local fontdata = fonts.hashes.identifiers +local allocate = utilities.storage.allocate +local setnodecolor = nodes.tracers.colors.set +local setmetatableindex = table.setmetatableindex -local setnodecolor = nodes.tracers.colors.set +scripts = scripts or { } +local scripts = scripts -scripts = scripts or { } -local scripts = scripts +scripts.hash = scripts.hash or { } +local hash = scripts.hash -scripts.hash = scripts.hash or { } -local hash = scripts.hash - -local handlers = allocate() -scripts.handlers = handlers +local handlers = allocate() +scripts.handlers = handlers local hash = { -- we could put these presets in char-def.lua -- @@ -189,7 +190,7 @@ local function provide(t,k) return v end -table.setmetatableindex(hash,provide) +setmetatableindex(hash,provide) scripts.hash = hash @@ -222,7 +223,7 @@ function scripts.installmethod(handler) datasets.default = { } -- slower but an error anyway end for k, v in next, datasets do - table.setmetatableindex(v,defaults) + setmetatableindex(v,defaults) end setmetatable(attributes, { __index = function(t,k) @@ -377,7 +378,7 @@ end -- we can have a fonts.hashes.originals -function scripts.preprocess(head) +function scripts.preprocess(head) -- we could probably pass the first glyph (as it's already known) local start = first_glyph(head) if not start then return head, false @@ -502,3 +503,90 @@ function scripts.preprocess(head) return head, done end end + +-- new plugin: + +local registercontext = fonts.specifiers.registercontext +local mergecontext = fonts.specifiers.mergecontext + +local otfscripts = characters.otfscripts + +local report_scripts = logs.reporter("scripts","auto feature") +local trace_scripts = false trackers.register("scripts.autofeature",function(v) trace_scripts = v end) + +local autofontfeature = scripts.autofontfeature or { } +scripts.autofontfeature = autofontfeature + +local cache_yes = { } +local cache_nop = { } + +setmetatableindex(cache_yes,function(t,k) local v = { } t[k] = v return v end) +setmetatableindex(cache_nop,function(t,k) local v = { } t[k] = v return v end) + +-- beware: we need to tag a done (otherwise too many extra instances ... but how +-- often unpack? wait till we have a bitmap +-- +-- we can consider merging this in handlers.characters(head) at some point as there +-- already check for the dynamic attribute so it saves a pass, however, then we also +-- need to check for a_preproc there which nils the benefit +-- +-- we can consider cheating: set all glyphs in a word as the first one but it's not +-- playing nice + +function autofontfeature.handler(head) + for n in traverse_id(glyph_code,head) do + -- if has_attribute(n,a_preproc) then + -- -- already tagged by script feature, maybe some day adapt + -- else + local char = n.char + local script = otfscripts[char] + if script then + local dynamic = has_attribute(n,0) or 0 + local font = n.font + if dynamic > 0 then + local slot = cache_yes[font] + local attr = slot[script] + if not attr then + attr = mergecontext(dynamic,name,what) + slot[script] = attr + if trace_scripts then + report_scripts("script: %s, trigger 0x%05X (%s), dynamic: %s (extended)",script,char,utfchar(char),attr) + end + end + if attr ~= 0 then + set_attribute(n,0,attr) + -- maybe set preproc when associated + end + else + local slot = cache_nop[font] + local attr = slot[script] + if not attr then + attr = registercontext(font,script,2) + slot[script] = attr + if trace_scripts then + report_scripts("script: %s, trigger 0x%05X (%s), dynamic: %s",script,char,utfchar(char),attr) + end + end + if attr ~= 0 then + set_attribute(n,0,attr) + -- maybe set preproc when associated + end + end + end + -- end + end + return head +end + +function autofontfeature.enable() + report_scripts("globally enabled") + nodes.tasks.enableaction("processors","scripts.autofontfeature.handler") +end + +function autofontfeature.disable() + report_scripts("globally disabled") + nodes.tasks.disableaction("processors","scripts.autofontfeature.handler") +end + +commands.enableautofontscript = autofontfeature.enable +commands.disableautofontscript = autofontfeature.disable diff --git a/tex/context/base/scrp-ini.mkiv b/tex/context/base/scrp-ini.mkiv index 8182368d7..bf8b580c7 100644 --- a/tex/context/base/scrp-ini.mkiv +++ b/tex/context/base/scrp-ini.mkiv @@ -30,6 +30,8 @@ \installcommandhandler \??script {script} \??script +\let\setupscripts\setupscript % be nice + % presets are global and are currently defined in lua \appendtoks @@ -64,4 +66,18 @@ \definescript[latin] [\c!method=] % resets the attribute (also currentscript) +% a new trick (at some point we will predefine more scripts and consider a link with the above) + +\appendtoks + \ifx\currentscript\empty + \doifelse{\scriptparameter\s!features}\v!auto\enableautofontscript\disableautofontscript + \fi +\to \everysetupscript + +\unexpanded\def\enableautofontscript {\ctxcommand{enableautofontscript ()}} +\unexpanded\def\disableautofontscript{\ctxcommand{disableautofontscript()}} + +\definefontfeature[latn][script=latn] +\definefontfeature[grek][script=grek] + \protect \endinput diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 29cf0f0eb..7ff0b264d 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 66438fc0d..0eba8309b 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua index 8bbcea599..3cc5ae9fa 100644 --- a/tex/context/base/task-ini.lua +++ b/tex/context/base/task-ini.lua @@ -23,6 +23,7 @@ appendaction("processors", "normalizers", "typesetters.characters.handler") appendaction("processors", "normalizers", "fonts.collections.process") -- disabled appendaction("processors", "normalizers", "fonts.checkers.missing") -- disabled +appendaction("processors", "characters", "scripts.autofontfeature.handler") appendaction("processors", "characters", "typesetters.cleaners.handler") -- disabled appendaction("processors", "characters", "typesetters.directions.handler") -- disabled appendaction("processors", "characters", "typesetters.cases.handler") -- disabled @@ -106,6 +107,7 @@ appendaction("vboxbuilders","normalizers","typesetters.checkers.handler") -- speedup: only kick in when used +disableaction("processors", "scripts.autofontfeature.handler") disableaction("processors", "fonts.collections.process") disableaction("processors", "fonts.checkers.missing") disableaction("processors", "chars.handle_breakpoints") diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index f5965112b..6ee50cb6f 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 11/29/12 18:40:35 +-- merge date : 11/30/12 22:53:44 do -- begin closure to overcome local limits and interference @@ -7801,8 +7801,8 @@ local function gref(descriptions,n) local num, nam = { }, { } for i=2,#n do -- first is likely a key local ni = n[i] - num[i] = format("U+%05X",ni) - nam[i] = descriptions[ni].name or "?" + num[i-1] = format("U+%05X",ni) + nam[i-1] = descriptions[ni].name or "?" end return format("%s (%s)",concat(num," "), concat(nam," ")) else |