diff options
28 files changed, 270 insertions, 87 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 dfe88ec02..2e38f31a5 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", "property", "properties", "withproperties", "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", "undashed", "decorated", "redecorated", "undecorated", "passvariable" }, + ["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", "property", "properties", "withproperties", "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", "undashed", "decorated", "redecorated", "undecorated", "passvariable", "tostring" }, ["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "textextoffset", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent", "metapostversion", "maxdimensions" }, }
\ 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 b9d53ae51..255867dd6 100644 --- a/context/data/scite/scite-context-data-metafun.properties +++ b/context/data/scite/scite-context-data-metafun.properties @@ -44,7 +44,7 @@ visualizedfill draworigin drawboundingbox drawpath drawpoint \ drawpoints drawcontrolpoints drawcontrollines drawpointlabels drawlineoptions \ drawpointoptions drawcontroloptions drawlabeloptions draworiginoptions drawboundoptions \ drawpathoptions resetdrawoptions undashed decorated redecorated \ -undecorated passvariable +undecorated passvariable tostring keywordclass.metafun.internals=\ nocolormodel greycolormodel graycolormodel rgbcolormodel \ diff --git a/metapost/context/base/mp-grap.mpiv b/metapost/context/base/mp-grap.mpiv index 64e63b90c..81a410db2 100644 --- a/metapost/context/base/mp-grap.mpiv +++ b/metapost/context/base/mp-grap.mpiv @@ -359,7 +359,7 @@ vardef graph_set_bounds@#(expr l, h) = graph_clear_bounds@# ; if @#graph_coordinate_type>0 : @#low = if unknown l : - whatever + whatever else : if abs @#graph_coordinate_type=log : graph_mlog fi if string l : scantokens fi l fi ; @@ -369,7 +369,7 @@ vardef graph_set_bounds@#(expr l, h) = if abs @#graph_coordinate_type=log : graph_mlog fi if string h : scantokens fi h fi ; else : - -@#high = if unknown l : + -@#high = if unknown l : whatever else : if abs @#graph_coordinate_type=log : graph_mlog fi if string l : scantokens fi l @@ -1075,6 +1075,8 @@ enddef ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% we could pass via variables and save escaping + Ten_to0 = 1 ; Ten_to1 = 10 ; Ten_to2 = 100 ; @@ -1082,7 +1084,7 @@ Ten_to3 = 1000 ; Ten_to4 = 10000 ; vardef escaped_format(expr s) = - "" for n=1 upto length(s) : & + "" for n=0 upto length(s) : & if ASCII substring (n,n+1) of s = 37 : "@" else : @@ -1092,7 +1094,7 @@ vardef escaped_format(expr s) = enddef ; vardef strfmt(expr f, x) = - "\MPgraphformat{" & escaped_format(f) & "}{" & (if string x : x else : decimal x fi) & "}" + "\MPgraphformat{" & escaped_format(f) & "}{" & mfun_tagged_string(x) & "}" enddef ; vardef format(expr f, x) = textext(strfmt(f, x)) enddef ; diff --git a/metapost/context/base/mp-mlib.mpiv b/metapost/context/base/mp-mlib.mpiv index e667e4064..6139a63c2 100644 --- a/metapost/context/base/mp-mlib.mpiv +++ b/metapost/context/base/mp-mlib.mpiv @@ -841,3 +841,27 @@ def passvariable(expr key, value) = else : "2:" & key & "=" & value fi ; enddef ; + +vardef tostring(expr value) = + if numeric value : mfun_numeric_to_string(value) + elseif pair value : mfun_pair_to_string(value) + elseif rgbcolor value : mfun_rgbcolor_to_string(value) + elseif cmykcolor value : mfun_cmykcolor_to_string(value) + elseif boolean value : mfun_boolean_to_string(value) + elseif path value : mfun_path_to_string(value) + elseif transform value : mfun_transform_to_string(value) + else : value + fi +enddef ; + +vardef mfun_tagged_string(expr value) = + if numeric value : "1:" & mfun_numeric_to_string(value) + elseif pair value : "4:" & mfun_pair_to_string(value) + elseif rgbcolor value : "5:" & mfun_rgbcolor_to_string(value) + elseif cmykcolor value : "6:" & mfun_cmykcolor_to_string(value) + elseif boolean value : "3:" & mfun_boolean_to_string(value) + elseif path value : "7:" & mfun_path_to_string(value) + elseif transform value : "8:" & mfun_transform_to_string(value) + else : "2:" & value + fi +enddef ; diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua index 1261bd45a..9642d1736 100644 --- a/tex/context/base/char-def.lua +++ b/tex/context/base/char-def.lua @@ -452,7 +452,6 @@ characters.data={ adobename="slash", category="po", cjkwd="na", - comment="mathsymbol=0x2044", contextname="textslash", description="SOLIDUS", direction="cs", @@ -460,11 +459,13 @@ characters.data={ mathspec={ { class="middle", - unicode=0x2044, + -- unicode=0x2044, + -- unicode=0x2215, }, { class="ordinary", - unicode=0x2044, + -- unicode=0x2044, + -- unicode=0x2215, }, }, unicodeslot=0x002F, @@ -58822,6 +58823,8 @@ characters.data={ category="mn", description="COMBINING ANNUITY SYMBOL", direction="nsm", + mathclass="topaccent", + mathname="actuarial", linebreak="cm", unicodeslot=0x20E7, }, diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index b625a0ff3..fe2418d7e 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{2013.10.20 07:09} +\newcontextversion{2013.10.30 13:30} %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 0909c6799..204b0d1d6 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 5f3866345..eaff168ec 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{2013.10.20 07:09} +\edef\contextversion{2013.10.30 13:30} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-fea.mkvi b/tex/context/base/font-fea.mkvi index 777c6e3ca..8d985b411 100644 --- a/tex/context/base/font-fea.mkvi +++ b/tex/context/base/font-fea.mkvi @@ -286,7 +286,7 @@ \unexpanded\def\featureattribute#feature% {\ctxcommand{featureattribute("#feature")}} -\unexpanded\def\setfontfeature #feature% +\unexpanded\def\setfontfeature#feature% {\edef\currentfeature{#feature}% \let\m_font_feature_list\currentfeature \ctxcommand{setfontfeature("\currentfeature")}} diff --git a/tex/context/base/font-gds.lua b/tex/context/base/font-gds.lua index 7f8bb91d1..7131ecad5 100644 --- a/tex/context/base/font-gds.lua +++ b/tex/context/base/font-gds.lua @@ -372,7 +372,7 @@ setmetatableindex(cache,function(t,a) setmetatableindex(v,function(t,c) local v = "colorscheme:" .. a .. ":" .. c t[c] = v - return c + return v end) t[a]= v return v diff --git a/tex/context/base/font-mis.lua b/tex/context/base/font-mis.lua index 0796356c4..6b6789481 100644 --- a/tex/context/base/font-mis.lua +++ b/tex/context/base/font-mis.lua @@ -22,7 +22,7 @@ local handlers = fonts.handlers handlers.otf = handlers.otf or { } local otf = handlers.otf -otf.version = otf.version or 2.745 +otf.version = otf.version or 2.747 otf.cache = otf.cache or containers.define("fonts", "otf", otf.version, true) function otf.loadcached(filename,format,sub) diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index 7598a9c35..6ebcb9cf9 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -48,7 +48,7 @@ local otf = fonts.handlers.otf otf.glists = { "gsub", "gpos" } -otf.version = 2.745 -- beware: also sync font-mis.lua +otf.version = 2.747 -- beware: also sync font-mis.lua otf.cache = containers.define("fonts", "otf", otf.version, true) local fontdata = fonts.hashes.identifiers @@ -1056,20 +1056,21 @@ local g_directions = { gsub_reversecontextchain = -1, gpos_reversecontextchain = -1, } - --- Research by Khaled Hosny has demonstrated that the font loader merges --- regular and AAT features and that these can interfere (especially because --- we dropped checking for valid features elsewhere. So, we just check for --- the special flag and drop the feature if such a tag is found. - -local function supported(features) - for i=1,#features do - if features[i].ismac then - return false - end - end - return true -end +-- The following is no longer needed as AAT is ignored per end October 2013. +-- +-- -- Research by Khaled Hosny has demonstrated that the font loader merges +-- -- regular and AAT features and that these can interfere (especially because +-- -- we dropped checking for valid features elsewhere. So, we just check for +-- -- the special flag and drop the feature if such a tag is found. +-- +-- local function supported(features) +-- for i=1,#features do +-- if features[i].ismac then +-- return false +-- end +-- end +-- return true +-- end actions["reorganize subtables"] = function(data,filename,raw) local resources = data.resources @@ -1084,8 +1085,7 @@ actions["reorganize subtables"] = function(data,filename,raw) for k=1,#dw do local gk = dw[k] local features = gk.features --- if features and supported(features) then - if not features or supported(features) then -- not always features ! + -- if not features or supported(features) then -- not always features ! local typ = gk.type local chain = g_directions[typ] or 0 local subtables = gk.subtables @@ -1152,7 +1152,7 @@ actions["reorganize subtables"] = function(data,filename,raw) markclass = markclass, } end - end + -- end end end end diff --git a/tex/context/base/font-pre.mkiv b/tex/context/base/font-pre.mkiv index 75f42f8f5..7d892ad37 100644 --- a/tex/context/base/font-pre.mkiv +++ b/tex/context/base/font-pre.mkiv @@ -52,6 +52,16 @@ tlig=yes, trep=yes] % texligatures=yes,texquotes=yes +\definefontfeature + [inlinenumbers] + [lnum=yes, + tnum=no] + +\definefontfeature + [tabularnumbers] + [tnum=yes, + lnum=no] + % \definefontfeature % [newstyle] % [onum=no] diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua index 18da4f2e1..8af31f222 100644 --- a/tex/context/base/font-syn.lua +++ b/tex/context/base/font-syn.lua @@ -41,37 +41,39 @@ local trace_names = false trackers.register("fonts.names", fu local trace_warnings = false trackers.register("fonts.warnings", function(v) trace_warnings = v end) local trace_specifications = false trackers.register("fonts.specifications", function(v) trace_specifications = v end) -local report_names = logs.reporter("fonts","names") +local report_names = logs.reporter("fonts","names") --[[ldx-- <p>This module implements a name to filename resolver. Names are resolved using a table that has keys filtered from the font related files.</p> --ldx]]-- -fonts = fonts or { } -- also used elsewhere +fonts = fonts or { } -- also used elsewhere -local names = font.names or allocate { } -fonts.names = names +local names = font.names or allocate { } +fonts.names = names -local filters = names.filters or { } -names.filters = filters +local filters = names.filters or { } +names.filters = filters -local treatments = names.treatments or { } -names.treatments = treatments +local treatments = fonts.treatments or { } +fonts.treatments = treatments -names.data = names.data or allocate { } +names.data = names.data or allocate { } -names.version = 1.123 -names.basename = "names" -names.saved = false -names.loaded = false -names.be_clever = true -names.enabled = true -names.cache = containers.define("fonts","data",names.version,true) +names.version = 1.123 +names.basename = "names" +names.saved = false +names.loaded = false +names.be_clever = true +names.enabled = true +names.cache = containers.define("fonts","data",names.version,true) -local autoreload = true +local usesystemfonts = true +local autoreload = true -directives.register("fonts.autoreload", function(v) autoreload = toboolean(v) end) +directives.register("fonts.autoreload", function(v) autoreload = toboolean(v) end) +directives.register("fonts.usesystemfonts", function(v) usesystemfonts = toboolean(v) end) --[[ldx-- <p>A few helpers.</p> @@ -979,7 +981,9 @@ local function analyzefiles(olddata) walk_tree(names.getpaths(trace),suffix,identify) end traverse("tree",withtree) -- TEXTREE only - if texconfig.kpse_init then + if not usesystemfonts then + report_names("ignoring system fonts") + elseif texconfig.kpse_init then traverse("lsr", withlsr) else traverse("system", withsystem) diff --git a/tex/context/base/m-graph.mkiv b/tex/context/base/m-graph.mkiv index e99921c43..f8114561c 100644 --- a/tex/context/base/m-graph.mkiv +++ b/tex/context/base/m-graph.mkiv @@ -22,6 +22,37 @@ local simplify = true + -- local function strip(n,e) + -- -- get rid of e(0) + -- -- get rid of e(+*) + -- e = gsub(e,"^+","") + -- -- remove leading zeros + -- e = gsub(e,"^([+-]*)0+(%d)","%1%2") + -- if not simplify then + -- -- take it as it is + -- elseif n == "1" then + -- return format("10^{%s}",e) + -- end + -- return format("%s\\times10^{%s}",n,e) + -- end + -- + -- function metapost.format_n(fmt,...) + -- fmt = gsub(fmt,"@","%%") + -- local initial, hasformat, final = match(fmt,"^(.-)(%%.-[%a])(.-)$") + -- if hasformat then + -- str = format(fmt,...) + -- str = gsub(str,"(.-)e(.-)$",strip) + -- str = format("%s\\mathematics{%s}%s",initial,str,final) + -- elseif not find(fmt,"%%") then + -- str = format("%"..fmt,...) + -- str = gsub(str,"(.-)e(.-)$",strip) + -- str = format("\\mathematics{%s}",str) + -- end + -- context(str) + -- end + + -- todo: proper lpeg + local function strip(n,e) -- get rid of e(0) -- get rid of e(+*) @@ -31,28 +62,28 @@ if not simplify then -- take it as it is elseif n == "1" then - return format("10^{%s}",e) + return format("\\mathematics{10^{%s}}",e) end - return format("%s\\times10^{%s}",n,e) + return format("\\mathematics{%s\\times10^{%s}}",n,e) end - function metapost.format_n(fmt,str) + function metapost.format_n(fmt,...) fmt = gsub(fmt,"@","%%") - local initial, hasformat, final = match(fmt,"^(.-)(%%.-[%a])(.-)$") - if hasformat then - str = format(fmt,str) - str = gsub(str,"(.-)e(.-)$",strip) - str = format("%s\\mathematics{%s}%s",initial,str,final) - elseif not find(fmt,"%%") then - str = format("%"..fmt,str) - str = gsub(str,"(.-)e(.-)$",strip) - str = format("\\mathematics{%s}",str) + if find(fmt,"%%") then + str = format(fmt,...) + else -- yes or no + str = format("%"..fmt,...) end + str = gsub(str,"([%-%+]-[%.%d]+)e([%-%+]-[%.%d]+)",strip) context(str) end + + function metapost.format_v(fmt,str) + metapost.format_n(fmt,metapost.untagvariable(str,false)) + end \stopluacode -\unexpanded\def\MPgraphformat#1#2{\ctxlua{metapost.format_n("#1","#2")}} +\unexpanded\def\MPgraphformat#1#2{\ctxlua{metapost.format_v("#1","#2")}} % We could also delegate parsing using lower level plugins. @@ -86,6 +117,8 @@ label(format("@g","1"), (2cm,-2.0cm)) ; label(format("@g","1e-102"),(0, -2.5cm)) ; label(format("@g","1e+102"),(2cm,-2.5cm)) ; + label(format("@f,@f",(1.23,4.56)),(0cm,-3.0cm)) ; + label(format("@i,@f",(1.23,4.56)),(0cm,-3.5cm)) ; \stopMPpage % \startMPpage[instance=graph] diff --git a/tex/context/base/math-fbk.lua b/tex/context/base/math-fbk.lua index b364d1208..fe4cd1929 100644 --- a/tex/context/base/math-fbk.lua +++ b/tex/context/base/math-fbk.lua @@ -503,3 +503,29 @@ virtualcharacters[0xFE935] = function(data) return smashed(data,0x02035,true) en virtualcharacters[0xFE936] = function(data) return smashed(data,0x02036,true) end virtualcharacters[0xFE937] = function(data) return smashed(data,0x02037,true) end +-- actuarian + +virtualcharacters[0x020E7] = function(data) + local characters = data.target.characters + -- if characters[0x020E7] then + -- -- we cannot assume that the character is useable + -- else + local parameters = data.target.parameters + local basechar = characters[0x0078] -- x (0x0058 X) + local linewidth = parameters.xheight / 10 + local basewidth = basechar.width + local baseheight = basechar.height + return { + -- compromise: lm has large hooks e.g. \actuarial{a} + commands = { + { "right", 2 * linewidth }, + { "down", - baseheight - 3 * linewidth }, + { "rule", linewidth, basewidth + 4 * linewidth }, + { "right", -linewidth }, + { "down", baseheight + 4 * linewidth }, + { "rule", baseheight + 5 * linewidth, linewidth }, + }, + width = basewidth + 4 * linewidth, + } + -- end +end diff --git a/tex/context/base/mlib-pdf.lua b/tex/context/base/mlib-pdf.lua index d5f22cd7e..1f37223a7 100644 --- a/tex/context/base/mlib-pdf.lua +++ b/tex/context/base/mlib-pdf.lua @@ -276,13 +276,31 @@ local key = C((1-equal)^1) * equal local newline = S("\n\r")^1 local number = (((1-space-newline)^1) / tonumber) * (space^0) local variable = - lpeg.P("1:") * key * number - + lpeg.P("2:") * key * C((1-newline)^0) - + lpeg.P("3:") * key * (P("false") * Cc(false) + P("true") * Cc(true)) - + lpeg.S("4568") * P(":") * key * Ct(number^1) - + lpeg.P("7:") * key * Ct(Ct(number * number^-5)^1) + P("1:") * key * number + + P("2:") * key * C((1-newline)^0) + + P("3:") * key * (P("false") * Cc(false) + P("true") * Cc(true)) + + S("4568") * P(":") * key * Ct(number^1) + + P("7:") * key * Ct(Ct(number * number^-5)^1) -local pattern = Cf ( Carg(1) * (Cg(variable * newline^0)^0), rawset) +local pattern_key = Cf ( Carg(1) * (Cg(variable * newline^0)^0), rawset) + +local variable = + P("1:") * number + + P("2:") * C((1-newline)^0) + + P("3:") * (P("false") * Cc(false) + P("true") * Cc(true)) + + S("4568") * P(":") * Ct(number^1) + + P("7:") * Ct(Ct(number * number^-5)^1) + +local pattern_tab = Cf ( Carg(1) * (Cg(variable * newline^0)^0), rawset) + +local variable = + P("1:") * number + + P("2:") * C((1-newline)^0) + + P("3:") * (P("false") * Cc(false) + P("true") * Cc(true)) + + S("4568") * P(":") * number^1 + + P("7:") * (number * number^-5)^1 + +local pattern_lst = (variable * newline^0)^0 metapost.variables = { } -- to be stacked metapost.llx = 0 -- to be stacked @@ -290,7 +308,7 @@ metapost.lly = 0 -- to be stacked metapost.urx = 0 -- to be stacked metapost.ury = 0 -- to be stacked -function commands.mprunvar(key,n) +function commands.mprunvar(key,n) -- should be defined in another lib local value = metapost.variables[key] if value ~= nil then local tvalue = type(value) @@ -311,6 +329,14 @@ function commands.mprunvar(key,n) end end +function metapost.untagvariable(str,variables) + if variables == false then + return lpegmatch(pattern_lst,str) + else + return lpegmatch(pattern_tab,str,1,variables or { }) + end +end + function metapost.flush(result,flusher,askedfig) if result then local figures = result.fig @@ -366,7 +392,7 @@ function metapost.flush(result,flusher,askedfig) if objecttype == "start_bounds" or objecttype == "stop_bounds" then -- skip elseif objecttype == "special" then - lpegmatch(pattern,object.prescript,1,variables) + lpegmatch(pattern_key,object.prescript,1,variables) elseif objecttype == "start_clip" then t[#t+1] = "q" flushnormalpath(object.path,t,false) diff --git a/tex/context/base/mult-fun.lua b/tex/context/base/mult-fun.lua index 3867489bf..3167fe7bf 100644 --- a/tex/context/base/mult-fun.lua +++ b/tex/context/base/mult-fun.lua @@ -100,6 +100,6 @@ return { -- "decorated", "redecorated", "undecorated", -- - "passvariable", + "passvariable", "tostring" }, } diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex e2c3f3255..86c2ca88a 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 82a45e683..931f19bde 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-bkm.lua b/tex/context/base/strc-bkm.lua index d9c268ce4..13508e820 100644 --- a/tex/context/base/strc-bkm.lua +++ b/tex/context/base/strc-bkm.lua @@ -85,7 +85,7 @@ end local function stripped(str) -- kind of generic str = gsub(str,"\\([A-Z]+)","%1") -- \LOGO str = gsub(str,"\\ "," ") -- \ - str = gsub(str,"\\([A-Za-z]+) *{(.-)}","%1") -- \bla{...} + str = gsub(str,"\\([A-Za-z]+) *{(.-)}","%2") -- \bla{...} str = gsub(str," +"," ") -- spaces return str end diff --git a/tex/context/base/tabl-ntb.mkiv b/tex/context/base/tabl-ntb.mkiv index 242c3d6fe..2db908f8e 100644 --- a/tex/context/base/tabl-ntb.mkiv +++ b/tex/context/base/tabl-ntb.mkiv @@ -1539,6 +1539,7 @@ {\ifcase\c_tabl_tbl_pass \or \setcharacteralign{#2}{\naturaltablelocalparameter\c!alignmentcharacter}% \fi + \typo_charalign_adapt_font \signalcharacteralign{#2}{#1}} \unexpanded\def\tabl_ntb_cell_process_a#1#2[#3]#4% grouping added ! ! ! diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv index fa2417712..7a58182aa 100644 --- a/tex/context/base/tabl-tbl.mkiv +++ b/tex/context/base/tabl-tbl.mkiv @@ -625,6 +625,7 @@ \def\tabl_tabulate_hook_g % partly expanded {\ifconditional\c_tabl_auto_align_mode \signalcharacteralign\c_tabl_tabulate_column{\c_tabl_tabulate_noflines+\plusone}% + \typo_charalign_adapt_font \fi} \def\tabl_tabulate_set_align#1% diff --git a/tex/context/base/typo-tal.mkiv b/tex/context/base/typo-tal.mkiv index a34cb8bb6..fb3955aec 100644 --- a/tex/context/base/typo-tal.mkiv +++ b/tex/context/base/typo-tal.mkiv @@ -109,4 +109,27 @@ \def\setfirstpasscharacteralign {\let\checkcharacteralign\gobbleoneargument} \def\setsecondpasscharacteralign{\let\checkcharacteralign\firstofoneargument} +%D We need fonts to provide tabular digits that is, the digits need to have the same +%D width. + +\definefontfeature + [system:tabnum] + [tnum=yes, + lnum=no] + +\newconditional\c_tabl_ntb_char_align_auto_font \settrue\c_tabl_ntb_char_align_auto_font + +\installtexdirective % yes or no ? + {typesetters.characteralign.autofont} + {\settrue \c_tabl_ntb_char_align_auto_font} + {\setfalse\c_tabl_ntb_char_align_auto_font} + +\def\m_font_feature_auto_tabnum{system:tabnum} + +\def\typo_charalign_adapt_font % slow but seldom used + {\ifconditional\c_tabl_ntb_char_align_auto_font + \let\m_font_feature_asked\m_font_feature_auto_tabnum + \font_feature_reset_add_indeed + \fi} + \protect \endinput diff --git a/tex/context/fonts/hanbatanglvt.lfg b/tex/context/fonts/hanbatanglvt.lfg new file mode 100644 index 000000000..0e3eaf5ed --- /dev/null +++ b/tex/context/fonts/hanbatanglvt.lfg @@ -0,0 +1,30 @@ +-- Maybe some day I will do this more efficient but for the moment it's okay. (We need +-- access to the names table then.) + +local f_uni_base = string.formatters["uni%04X"] +local f_uni_plus = string.formatters["uni%04X.y%s"] + +local function range(first,last) + local t = { } + for i=first,last do + t[#t+1] = f_uni_base(i) + for j=0,19 do + t[#t+1] = f_uni_plus(i,j) + end + end + return t +end + +return { + name = "hanbatanglvt", + version = "1.00", + comment = "Goodies that complement the hanbatanglvt fonts.", + author = "Hans Hagen", + colorschemes = { + default = { + range(0x01100,0x0115F), -- jamo_initial + range(0x01160,0x011A7), -- jamo_medial + range(0x011A8,0x011FF), -- jamo_final + } + } +} diff --git a/tex/context/fonts/treatments.lfg b/tex/context/fonts/treatments.lfg index b973906c3..44d24da22 100644 --- a/tex/context/fonts/treatments.lfg +++ b/tex/context/fonts/treatments.lfg @@ -64,6 +64,10 @@ return { comment = "a text file with suffix ttf", -- used in test file ignored = true, }, + ["lingoes.ttf"] = { + comment = "bugged file", + ignored = true, + }, -- harmless example -- ["copperplatethirtythreebc.ttf"] = { -- comment = "hangs and has no hyphen", diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 17c5b6b22..05ddf222d 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 : 10/20/13 07:09:03 +-- merge date : 10/30/13 13:30:14 do -- begin closure to overcome local limits and interference @@ -6334,7 +6334,7 @@ local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf otf.glists={ "gsub","gpos" } -otf.version=2.745 +otf.version=2.747 otf.cache=containers.define("fonts","otf",otf.version,true) local fontdata=fonts.hashes.identifiers local chardata=characters and characters.data @@ -7204,14 +7204,6 @@ local g_directions={ gsub_reversecontextchain=-1, gpos_reversecontextchain=-1, } -local function supported(features) - for i=1,#features do - if features[i].ismac then - return false - end - end - return true -end actions["reorganize subtables"]=function(data,filename,raw) local resources=data.resources local sequences={} @@ -7225,7 +7217,6 @@ actions["reorganize subtables"]=function(data,filename,raw) for k=1,#dw do local gk=dw[k] local features=gk.features - if not features or supported(features) then local typ=gk.type local chain=g_directions[typ] or 0 local subtables=gk.subtables @@ -7288,7 +7279,6 @@ actions["reorganize subtables"]=function(data,filename,raw) markclass=markclass, } end - end end end end @@ -10901,6 +10891,10 @@ local function show_skip(kind,chainname,char,ck,class) logwarning("%s: skipping char %s, class %a, rule %a, lookuptype %a",cref(kind,chainname),gref(char),class,ck[1],ck[2]) end end +local quit_on_no_replacement=true +directives.register("otf.chain.quitonnoreplacement",function(value) + quit_on_no_replacement=value +end) local function normal_handle_contextchain(head,start,kind,chainname,contexts,sequence,lookuphash) local flags=sequence.flags local done=false @@ -11171,7 +11165,7 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq if replacements then head,start,done=chainprocs.reversesub(head,start,last,kind,chainname,ck,lookuphash,replacements) else - done=true + done=quit_on_no_replacement if trace_contexts then logprocess("%s: skipping match",cref(kind,chainname)) end diff --git a/web2c/contextcnf.lua b/web2c/contextcnf.lua index c0ff5e4c9..366df01ac 100644 --- a/web2c/contextcnf.lua +++ b/web2c/contextcnf.lua @@ -209,6 +209,8 @@ return { -- ["pdfview.method"] = "sumatra", + -- ["fonts.usesystemfonts"] = false, + }, experiments = { |