summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2013-09-30 19:49:00 +0200
committerHans Hagen <pragma@wxs.nl>2013-09-30 19:49:00 +0200
commit3bd0c3e25a26069d71a5c905cd8af54b38172655 (patch)
tree72f5badf7411fed8ea08420940eaa4ecdca53384
parentfff0f2637579a3259e5da3e8c36436f0ab89aa23 (diff)
downloadcontext-3bd0c3e25a26069d71a5c905cd8af54b38172655.tar.gz
beta 2013.09.30 19:49
-rw-r--r--context/data/scite/lexers/data/scite-context-data-metapost.lua2
-rw-r--r--context/data/scite/scite-context-data-metapost.properties2
-rw-r--r--doc/context/scripts/mkiv/mtx-flac.html1
-rw-r--r--doc/context/scripts/mkiv/mtx-flac.man3
-rw-r--r--doc/context/scripts/mkiv/mtx-flac.xml1
-rw-r--r--metapost/context/base/mp-grap.mpiv216
-rw-r--r--metapost/context/base/mp-mlib.mpiv54
-rw-r--r--metapost/context/base/mp-tool.mpiv5
-rw-r--r--metapost/context/fonts/bidi-symbols.mp73
-rw-r--r--metapost/context/fonts/punkfont-bold.mp4
-rw-r--r--metapost/context/fonts/punkfont-boldslanted.mp5
-rw-r--r--metapost/context/fonts/punkfont-characters.mp726
-rw-r--r--metapost/context/fonts/punkfont-definitions.mp115
-rw-r--r--metapost/context/fonts/punkfont-slanted.mp4
-rw-r--r--metapost/context/fonts/punkfont.mp2
-rw-r--r--scripts/context/lua/mtx-context.lua2
-rw-r--r--scripts/context/lua/mtx-flac.lua37
-rw-r--r--scripts/context/lua/mtxrun.lua6
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua6
-rwxr-xr-xscripts/context/stubs/unix/mtxrun6
-rw-r--r--tex/context/base/anch-pgr.mkiv2
-rw-r--r--tex/context/base/attr-lay.lua2
-rw-r--r--tex/context/base/back-pdf.mkiv2
-rw-r--r--tex/context/base/buff-imp-mp.lua2
-rw-r--r--tex/context/base/buff-imp-tex.lua2
-rw-r--r--tex/context/base/buff-ini.mkiv6
-rw-r--r--tex/context/base/buff-ver.mkiv3
-rw-r--r--tex/context/base/char-def.lua6
-rw-r--r--tex/context/base/colo-ini.mkiv3
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4108 -> 4119 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-con.mkiv5
-rw-r--r--tex/context/base/core-uti.lua21
-rw-r--r--tex/context/base/font-emp.mkvi2
-rw-r--r--tex/context/base/font-ini.mkvi33
-rw-r--r--tex/context/base/font-mat.mkvi46
-rw-r--r--tex/context/base/font-sel.lua629
-rw-r--r--tex/context/base/font-sel.mkvi320
-rw-r--r--tex/context/base/font-sty.mkvi5
-rw-r--r--tex/context/base/l-lpeg.lua3
-rw-r--r--tex/context/base/math-rad.mkvi4
-rw-r--r--tex/context/base/meta-fnt.lua1
-rw-r--r--tex/context/base/mlib-pdf.lua10
-rw-r--r--tex/context/base/mult-mps.lua2
-rw-r--r--tex/context/base/node-fnt.lua7
-rw-r--r--tex/context/base/page-mul.mkiv28
-rw-r--r--tex/context/base/s-present-tiles.mkiv2
-rw-r--r--tex/context/base/status-files.pdfbin24761 -> 24835 bytes
-rw-r--r--tex/context/base/status-lua.log2
-rw-r--r--tex/context/base/strc-doc.lua152
-rw-r--r--tex/context/base/strc-lst.mkvi2
-rw-r--r--tex/context/base/strc-reg.lua77
-rw-r--r--tex/context/base/strc-reg.mkiv22
-rw-r--r--tex/context/base/strc-sec.mkiv5
-rw-r--r--tex/context/base/tabl-nte.mkiv8
-rw-r--r--tex/context/base/tabl-tbl.mkiv4
-rw-r--r--tex/context/base/tabl-xtb.mkvi1
-rw-r--r--tex/context/base/task-ini.lua4
-rw-r--r--tex/context/base/type-ini.mkvi2
-rw-r--r--tex/context/base/typo-del.mkiv2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
62 files changed, 2477 insertions, 226 deletions
diff --git a/context/data/scite/lexers/data/scite-context-data-metapost.lua b/context/data/scite/lexers/data/scite-context-data-metapost.lua
index def27c33d..25b049802 100644
--- a/context/data/scite/lexers/data/scite-context-data-metapost.lua
+++ b/context/data/scite/lexers/data/scite-context-data-metapost.lua
@@ -1,5 +1,5 @@
return {
- ["commands"]={ "beginfig", "endfig", "beginglyph", "endglyph", "charscale", "rotatedaround", "reflectedabout", "arrowhead", "currentpen", "currentpicture", "cuttings", "defaultfont", "extra_beginfig", "extra_endfig", "ditto", "EOF", "down", "evenly", "fullcircle", "halfcircle", "identity", "in", "left", "origin", "pensquare", "quartercircle", "right", "unitsquare", "up", "withdots", "abs", "bbox", "ceiling", "center", "cutafter", "cutbefore", "dir", "directionpoint", "div", "dotprod", "intersectionpoint", "inverse", "mod", "round", "unitvector", "whatever", "cutdraw", "draw", "drawarrow", "drawdblarrow", "fill", "filldraw", "drawdot", "loggingall", "interact", "tracingall", "tracingnone", "pickup", "undraw", "unfill", "unfilldraw", "buildcycle", "dashpattern", "decr", "dotlabel", "dotlabels", "drawoptions", "incr", "label", "labels", "max", "min", "thelabel", "z", "beginchar", "blacker", "capsule_end", "change_width", "define_blacker_pixels", "define_corrected_pixels", "define_good_x_pixels", "define_good_y_pixels", "define_horizontal_corrected_pixels", "define_pixels", "define_whole_blacker_pixels", "define_whole_pixels", "define_whole_vertical_blacker_pixels", "define_whole_vertical_pixels", "endchar", "extra_beginchar", "extra_endchar", "extra_setup", "font_coding_scheme", "clearxy", "clearit", "clearpen", "shipit", "font_extra_space", "exitunless", "relax", "hide", "gobble", "gobbled", "stop", "blankpicture", "counterclockwise", "tensepath", "takepower", "direction", "softjoin", "makelabel", "rotatedabout", "flex", "superellipse", "erase", "image", "nullpen", "savepen", "clearpen", "penpos", "penlabels", "range", "numtok", "thru", "z", "laboff", "bye", "red", "green", "blue", "cyan", "magenta", "yellow", "black", "white", "background", "graypart", "graycolor", "mm", "pt", "dd", "bp", "cm", "pc", "cc", "in" },
+ ["commands"]={ "beginfig", "endfig", "beginglyph", "endglyph", "charscale", "rotatedaround", "reflectedabout", "arrowhead", "currentpen", "currentpicture", "cuttings", "defaultfont", "extra_beginfig", "extra_endfig", "ditto", "EOF", "down", "evenly", "fullcircle", "halfcircle", "identity", "in", "left", "origin", "pensquare", "quartercircle", "right", "unitsquare", "up", "withdots", "abs", "bbox", "ceiling", "center", "cutafter", "cutbefore", "dir", "directionpoint", "div", "dotprod", "intersectionpoint", "inverse", "mod", "round", "unitvector", "whatever", "cutdraw", "draw", "drawarrow", "drawdblarrow", "fill", "filldraw", "drawdot", "loggingall", "interact", "tracingall", "tracingnone", "pickup", "undraw", "unfill", "unfilldraw", "buildcycle", "dashpattern", "decr", "dotlabel", "dotlabels", "drawoptions", "incr", "label", "labels", "max", "min", "thelabel", "z", "beginchar", "blacker", "capsule_end", "change_width", "define_blacker_pixels", "define_corrected_pixels", "define_good_x_pixels", "define_good_y_pixels", "define_horizontal_corrected_pixels", "define_pixels", "define_whole_blacker_pixels", "define_whole_pixels", "define_whole_vertical_blacker_pixels", "define_whole_vertical_pixels", "endchar", "extra_beginchar", "extra_endchar", "extra_setup", "font_coding_scheme", "clearxy", "clearit", "clearpen", "shipit", "font_extra_space", "exitunless", "relax", "hide", "gobble", "gobbled", "stop", "blankpicture", "counterclockwise", "tensepath", "takepower", "direction", "softjoin", "makelabel", "rotatedabout", "flex", "superellipse", "erase", "image", "nullpen", "savepen", "clearpen", "penpos", "penlabels", "range", "numtok", "thru", "z", "laboff", "bye", "red", "green", "blue", "cyan", "magenta", "yellow", "black", "white", "background", "graypart", "graycolor", "mm", "pt", "dd", "bp", "cm", "pc", "cc", "in", "triplet", "quadruplet" },
["internals"]={ "mitered", "rounded", "beveled", "butt", "squared", "eps", "epsilon", "infinity", "bboxmargin", "ahlength", "ahangle", "labeloffset", "dotlabeldiam", "defaultpen", "defaultscale", "join_radius", "pen_lft", "pen_rt", "pen_top", "pen_bot" },
["primitives"]={ "charcode", "day", "linecap", "linejoin", "miterlimit", "month", "pausing", "prologues", "showstopping", "time", "tracingcapsules", "tracingchoices", "mpprocset", "tracingcommands", "tracingequations", "tracinglostchars", "tracingmacros", "tracingonline", "tracingoutput", "tracingrestores", "tracingspecs", "tracingstats", "tracingtitles", "truecorners", "warningcheck", "year", "false", "nullpicture", "pencircle", "true", "and", "angle", "arclength", "arctime", "ASCII", "boolean", "bot", "char", "color", "cosd", "cycle", "decimal", "directiontime", "floor", "fontsize", "hex", "infont", "intersectiontimes", "known", "length", "llcorner", "lrcorner", "makepath", "makepen", "mexp", "mlog", "normaldeviate", "not", "numeric", "oct", "odd", "or", "path", "pair", "pen", "penoffset", "picture", "point", "postcontrol", "precontrol", "reverse", "rotated", "scaled", "shifted", "sind", "slanted", "sqrt", "str", "string", "subpath", "substring", "transform", "transformed", "ulcorner", "uniformdeviate", "unknown", "urcorner", "xpart", "xscaled", "xxpart", "xypart", "ypart", "yscaled", "yxpart", "yypart", "zscaled", "addto", "clip", "input", "interim", "let", "newinternal", "save", "setbounds", "shipout", "show", "showdependencies", "showtoken", "showvariable", "special", "begingroup", "endgroup", "of", "curl", "tension", "and", "controls", "interpath", "on", "off", "def", "vardef", "enddef", "expr", "suffix", "text", "primary", "secondary", "tertiary", "primarydef", "secondarydef", "tertiarydef", "randomseed", "also", "contour", "doublepath", "withcolor", "withpen", "dashed", "if", "else", "elseif", "fi", "for", "endfor", "forever", "exitif", "within", "forsuffixes", "downto", "upto", "step", "until", "charlist", "extensible", "fontdimen", "headerbyte", "kern", "ligtable", "boundarychar", "chardp", "charext", "charht", "charic", "charwd", "designsize", "fontmaking", "charexists", "cullit", "currenttransform", "gfcorners", "grayfont", "hround", "imagerules", "lowres_fix", "nodisplays", "notransforms", "openit", "displaying", "currentwindow", "screen_rows", "screen_cols", "pixels_per_inch", "cull", "display", "openwindow", "numspecial", "totalweight", "autorounding", "fillin", "proofing", "tracingpens", "xoffset", "chardx", "granularity", "smoothing", "turningcheck", "yoffset", "chardy", "hppp", "tracingedges", "vppp", "extra_beginfig", "extra_endfig", "mpxbreak", "endinput", "message", "delimiters", "turningnumber", "errmessage", "readstring", "scantokens", "end", "outer", "inner", "write", "to", "readfrom", "withprescript", "withpostscript", "top", "bot", "lft", "rt", "ulft", "urt", "llft", "lrt", "redpart", "greenpart", "bluepart", "cyanpart", "magentapart", "yellowpart", "blackpart", "greypart", "prescriptpart", "postscriptpart", "rgbcolor", "cmykcolor", "greycolor", "graycolor", "colormodel", "graypart", "dashpart", "penpart", "stroked", "filled", "textual", "clipped", "bounded", "pathpart", "expandafter" },
["shortcuts"]={ "..", "...", "--", "---", "&" },
diff --git a/context/data/scite/scite-context-data-metapost.properties b/context/data/scite/scite-context-data-metapost.properties
index 5ff791448..9d9a81edc 100644
--- a/context/data/scite/scite-context-data-metapost.properties
+++ b/context/data/scite/scite-context-data-metapost.properties
@@ -28,7 +28,7 @@ z laboff bye red green \
blue cyan magenta yellow black \
white background graypart graycolor mm \
pt dd bp cm pc \
-cc in
+cc in triplet quadruplet
keywordclass.metapost.internals=\
mitered rounded beveled butt \
diff --git a/doc/context/scripts/mkiv/mtx-flac.html b/doc/context/scripts/mkiv/mtx-flac.html
index 78259b60b..cbb3167c0 100644
--- a/doc/context/scripts/mkiv/mtx-flac.html
+++ b/doc/context/scripts/mkiv/mtx-flac.html
@@ -40,6 +40,7 @@
<tr><th style="width: 10em">flag</th><th style="width: 8em">value</th><th>description</th></tr>
<tr><th/><td/><td/></tr>
<tr><th>--collect</th><td></td><td>collect albums in xml file</td></tr>
+ <tr><th>--pattern</th><td></td><td>use pattern for locating files</td></tr>
</table>
<br/>
<h1>Example</h1>
diff --git a/doc/context/scripts/mkiv/mtx-flac.man b/doc/context/scripts/mkiv/mtx-flac.man
index ef914f2ac..9e41e90e2 100644
--- a/doc/context/scripts/mkiv/mtx-flac.man
+++ b/doc/context/scripts/mkiv/mtx-flac.man
@@ -13,6 +13,9 @@
.TP
.B --collect
collect albums in xml file
+.TP
+.B --pattern
+use pattern for locating files
.SH AUTHOR
More information about ConTeXt and the tools that come with it can be found at:
diff --git a/doc/context/scripts/mkiv/mtx-flac.xml b/doc/context/scripts/mkiv/mtx-flac.xml
index bd5fc9bc9..00af3d807 100644
--- a/doc/context/scripts/mkiv/mtx-flac.xml
+++ b/doc/context/scripts/mkiv/mtx-flac.xml
@@ -9,6 +9,7 @@
<category name="basic">
<subcategory>
<flag name="collect"><short>collect albums in xml file</short></flag>
+ <flag name="pattern"><short>use pattern for locating files</short></flag>
</subcategory>
</category>
</flags>
diff --git a/metapost/context/base/mp-grap.mpiv b/metapost/context/base/mp-grap.mpiv
index a7115fc7a..64e63b90c 100644
--- a/metapost/context/base/mp-grap.mpiv
+++ b/metapost/context/base/mp-grap.mpiv
@@ -11,8 +11,6 @@
%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
%C details.
-% laboff -> mfun_laboff or use plain_label instead
-
if known context_grap : endinput ; fi ;
boolean context_grap ; context_grap := true ;
@@ -43,6 +41,7 @@ fi
% OUT loc value for labels relative to whole graph
% gdata(file,s,text) read coords from file ; evaluate t w/ tokens s[]
% auto.<x or y> default x or y tick locations (for interation)
+% tick.<bot|top|..>(fmt,u) draw centered tick from given side at u w/ format
% itick.<bot|top|..>(fmt,u) draw inward tick from given side at u w/ format
% otick.<bot|top|..>(fmt,u) draw outward tick at coord u ; label format fmt
% grid.<bot|top|..>(fmt,u) draw grid line at u with given side labeled
@@ -135,7 +134,7 @@ enddef ;
vardef graph_error(expr x,s) =
interim showstopping :=0 ;
- show x ; errmessage s;
+ show x ; errmessage s ;
enddef ;
%%%%%%%%%%%%%%%%%%%%%%%% Data structures, begingraph %%%%%%%%%%%%%%%%%%%%%%%%
@@ -170,8 +169,12 @@ def begingraph(expr w, h) =
save graph_last_drawn ;
picture graph_last_drawn ; % result of last gdraw or gfill
graph_last_drawn = nullpicture ;
+ save graph_last_path ;
+ path graph_last_path ; % last gdraw or gfill path in data coordinates.
save graph_plot_picture ;
picture graph_plot_picture ; % a picture from the `plot' option known when plot allowed
+ save graph_foreground ;
+ color graph_foreground ; % drawing color, if set.
save graph_label ;
picture graph_label[] ; % labels to place around the whole graph when it is done
save graph_autogrid_needed ;
@@ -356,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 ;
@@ -366,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
@@ -500,7 +503,7 @@ enddef ;
vardef augment@#(text t) =
interim warningcheck := 0 ;
if not path begingroup @# endgroup :
- Gerr(begingroup @# endgroup, "Cannot augment--not a path") ;
+ graph_error(begingroup @# endgroup, "Cannot augment--not a path") ;
else :
def graph_comma= hide(def graph_comma=,enddef) enddef ;
if known @# : @# :=@#-- else : @#= fi
@@ -517,6 +520,7 @@ enddef ;
% Unknown pair components are set to 0 because glabel and gdotlabel understand
% unknown coordinates as `0 in absolute units'.
vardef graph_unknown_pair_bbox(expr p) =
+ interim warningcheck:=0 ;
if known p : addto graph_current_bb doublepath p ;
else :
save x,y ;
@@ -528,19 +532,24 @@ vardef graph_unknown_pair_bbox(expr p) =
graph_current_bb := image(fill llcorner graph_current_bb..urcorner graph_current_bb--cycle) ;
enddef ;
-
% Initiate a gdraw or gfill command. This must be done before scanning the
% argument, because that could invoke the `if known graph_plot_picture' test in a following
% plot option .
def graph_addto =
+ def graph_errorbar_text = enddef ;
+ color graph_foreground ;
+ path graph_last_path ;
graph_last_drawn := graph_plot_picture := nullpicture ; addto graph_last_drawn
enddef;
% Handle the part of a Gdraw command that uses path or data file p.
def graph_draw expr p =
- if string p : graph_convert_user_path_to_internal graph_readpath(p)
- elseif path p or pair p : graph_convert_user_path_to_internal p
+ if string p : hide(graph_last_path := graph_readpath(p) ;)
+ graph_convert_user_path_to_internal graph_last_path
+ elseif path p or pair p :
+ hide(graph_last_path := p ;)
+ graph_convert_user_path_to_internal p
else : graph_error(p,"gdraw argument should be a data file or a path")
origin
fi
@@ -550,8 +559,10 @@ enddef ;
% Handle the part of a Gdraw command that uses path or data file p.
def graph_fill expr p =
- if string p : graph_convert_user_path_to_internal graph_readpath(p) --cycle
- elseif cycle p : graph_convert_user_path_to_internal p
+ if string p : hide(graph_last_path := graph_readpath(p) --cycle ;)
+ graph_convert_user_path_to_internal graph_last_path
+ elseif cycle p : hide(graph_last_path := p ;)
+ graph_convert_user_path_to_internal p
else : graph_error(p,"gfill argument should be a data file or a cyclic path")
origin..cycle
fi graph_withlist _op_
@@ -564,6 +575,74 @@ def gfill = graph_addto contour graph_fill enddef ;
% This is used in graph_draw and graph_fill to allow postprocessing graph_last_drawn
def graph_withlist text t_ = t_ ; graph_post_draw; enddef;
+def witherrorbars(text t) text options =
+ hide(
+ def graph_errorbar_text = t enddef ;
+ save pic ; picture pic ; pic := image(draw origin _op_ options ;) ;
+ if color colorpart pic : graph_foreground := colorpart pic ; fi
+ )
+ options
+enddef ;
+
+picture graph_errorbar_picture ; graph_errorbar_picture := image(draw (left--right) scaled .5 ;) ;
+%picture graph_xbar_picture ; graph_xbar_picture := image(draw (down--up) scaled .5 ;) ;
+%picture graph_ybar_picture ; graph_ybar_picture := image(draw (left--right) scaled .5 ;) ;
+
+vardef graph_errorbars(text t) =
+ if known graph_last_path :
+ save n, p, q ; path p ; pair q ;
+ save pic ; picture pic[] ; pic0 := nullpicture ;
+ pic1 := if known graph_xbar_picture : graph_xbar_picture
+ elseif known graph_errorbar_picture : graph_errorbar_picture rotated 90
+ else : nullpicture fi ;
+ pic2 := if known graph_ybar_picture : graph_ybar_picture
+ elseif known graph_errorbar_picture : graph_errorbar_picture
+ else : nullpicture fi ;
+ if length pic1>0 :
+ pic1 := pic1 scaled graph_shapesize ;
+ setbounds pic1 to origin..cycle ;
+ fi
+ if length pic2>0 :
+ pic2 := pic2 scaled graph_shapesize ;
+ setbounds pic2 to origin..cycle ;
+ fi
+ for i=0 upto length graph_last_path :
+ clearxy ; z = point i of graph_last_path ;
+ n := 1 ;
+ for $=t :
+ if known $ :
+ q := if path $ : if length $>i : point i of $ else : origin fi
+ elseif pair $ : $ elseif numeric $ : ($,$) else : origin fi ;
+ if q<>origin :
+ p := graph_convert_user_path_to_internal ((
+ if n=1 :
+ (-xpart q,0)--(ypart q,0)
+ else :
+ (0,-xpart q)--(0,ypart q)
+ fi ) shifted z) ;
+ addto pic0 doublepath p ;
+ if length pic[n]>0 :
+ if ypart q<>0 :
+ addto pic0 also pic[n] shifted point 1 of p ;
+ fi
+ if xpart q<>0 :
+ addto pic0 also pic[n] rotated 180 shifted point 0 of p ;
+ fi
+ fi
+ fi
+ fi
+ exitif incr n>3 ;
+ endfor
+ endfor
+ if length pic0>0 :
+ save bg, fg ; color bg, fg ;
+ bg := if known graph_background : graph_background else : background fi ;
+ fg := if known graph_foreground : graph_foreground else : black fi ;
+ addto graph_current_graph also pic0 withpen currentpen scaled 2 _op_ withcolor bg ;
+ addto graph_current_graph also pic0 withpen currentpen scaled .5 _op_ withcolor fg ;
+ fi
+ fi
+enddef ;
% Set graph_plot_picture so the postprocessing step will plot picture p at each path knot.
% Also select nullpen to suppress stroking.
@@ -596,6 +675,7 @@ vardef graph_post_draw =
if filled graph_last_drawn or not graph_is_null(penpart graph_last_drawn) :
addto graph_current_graph also graph_last_drawn ;
fi
+ graph_errorbars(graph_errorbar_text) ;
if length graph_plot_picture>0 :
for i=0 upto length p if cycle p : -1 fi :
addto graph_current_graph also graph_plot_picture shifted point i of p ;
@@ -644,7 +724,7 @@ enddef ;
% Stash the result drawing command c in the graph_label table using with list w and
-% an index based on angle laboff$.
+% an index based on angle mfun_laboff$.
vardef graph_stash_label(suffix $)(text c) text w =
graph_label[1.5+angle mfun_laboff$ /90] = image(c(origin) w) ;
enddef ;
@@ -679,10 +759,13 @@ def OUT = enddef ; % location text for outside labels
% Grid lines and tick marks are transformed versions of the templates below.
% In the template paths, (0,0) is on the edge of the frame and inward is to
% the right.
-path Gtemplate.itick, Gtemplate.otick, Gtemplate.grid ;
+path Gtemplate.tick, Gtemplate.itick, Gtemplate.otick, Gtemplate.grid ;
+Gtemplate.tick = (-3.5bp,0)--(3.5bp,0) ;
Gtemplate.itick = origin--(7bp,0) ;
Gtemplate.otick = (-7bp,0)--origin ;
-Gtemplate.grid = origin--(1,0) ;
+Gtemplate.grid = origin--(1,0) ;
+
+vardef tick@#(expr f,u) text w = graph_tick_label(@#,@,false,f,u,w) ; enddef;
vardef itick@#(expr f,u) text w = graph_tick_label(@#,@,false,f,u,w) ; enddef;
@@ -1020,7 +1103,7 @@ vardef format(expr f, x) = textext(strfmt(f, x)) enddef ;
% unfilled outline, interior filled with different shades of the background.
% This allows overlapping points on a plot to be more distinguishable.
-vardef graph_shapesize = .33BodyFontSize enddef ;
+vardef graph_shapesize = (.33BodyFontSize) enddef ;
path graph_shape[] ; % (internal) symbol path
@@ -1101,9 +1184,11 @@ def plotsymbol(expr n, f) text t =
save bg, fg ; color bg, fg ;
bg := if known graph_background : graph_background else : background fi ;
save pic ; picture pic ; pic := image(draw origin _op_ t ;) ;
- fg := if color colorpart pic : colorpart pic else : black fi ;
+ if color colorpart pic : graph_foreground := colorpart pic ; fi
+ fg := if known graph_foreground : graph_foreground else : black fi ;
save p ; path p ; p = graph_shape[n] scaled graph_shapesize ;
draw p withcolor bg withpen currentpen scaled 2 ; % halo
+ currentpen := currentpen scaled .5 ;
if cycle p :
fill p withcolor
if known f :
@@ -1120,7 +1205,7 @@ def plotsymbol(expr n, f) text t =
bg
fi ;
fi
- draw p withpen currentpen _op_ t ;
+ draw p _op_ t ;
)
else :
nullpicture
@@ -1193,7 +1278,7 @@ enddef ;
def makefunctionpath (expr f, t, n) (text func) =
(for x=f step ((t-f)/(abs n)) until t :
- if x<>f : .. fi
+ if x<>f : -- fi
(x, func)
endfor )
enddef ;
@@ -1298,9 +1383,9 @@ numeric fit_chi_squared ;
vardef polynomial_fit (suffix p, $) (expr n) (text t) =
if not path p :
- Gerr(p, "Cannot fit--not a path") ;
+ graph_error(p, "Cannot fit--not a path") ;
elseif length p < n :
- Gerr(p, "Cannot fit--not enough points") ;
+ graph_error(p, "Cannot fit--not enough points") ;
else :
fit_chi_squared := 0 ;
% calculate sums of the data
@@ -1314,7 +1399,24 @@ vardef polynomial_fit (suffix p, $) (expr n) (text t) =
endfor
for i=0 upto length p :
clearxy ; z = point i of p ;
- w := if length(t) > 0 : t else : 1 fi ; % weight
+ w := 1 ; % weight
+ if known t :
+ if numeric t :
+ w := 1 if t<>0 : /(abs t) fi ;
+ elseif pair t :
+ if t<>origin :
+ w := 1/(abs t) ;
+ fi
+ elseif path t :
+ if length t>= i:
+ if point i of t<>origin :
+ w := 1/(abs point i of t) ;
+ fi
+ else :
+ w := 0 ;
+ fi ;
+ fi
+ fi
x1 := w ;
for j=0 upto 2n :
sumx[j] := sumx[j] + x1 ;
@@ -1385,13 +1487,29 @@ vardef exponential_function (suffix $) (expr x) = $1*exp($0*x) enddef ;
vardef exponential_fit (suffix p, $) (text t) =
save a ; numeric a[] ;
- save q ; path q ; % fit to the log of the ordinate
+ save q ; path q[] ; % fit to the log of the ordinate
for i=0 upto length p :
- if ypart(point i of p)>0 :
- augment.q(xpart(point i of p),ln(ypart(point i of p))) ;
+ clearxy ; z = point i of p ;
+ if y>0 :
+ augment.q0(x,ln(y)) ;
+ augment.q1(
+ if known t :
+ if numeric t : (0,ln(t))
+ elseif pair t : (xpart t,ln(ypart t))
+ elseif path t :
+ if length t>=i :
+ hide(z1 = point i of t;)
+ (x1,ln(y1))
+ else :
+ origin
+ fi
+ fi
+ else :
+ (0,1)
+ fi ) ;
fi
endfor
- linear_fit(q,a,t) ;
+ linear_fit(q0,a,q1) ;
save e ; e := exp(sqrt(fit_chi_squared)) ;
fit_chi_squared := e * e ;
$0 := a1 ;
@@ -1406,13 +1524,29 @@ vardef power_law_function (suffix $) (expr x) = $1*(x**$0) enddef ;
vardef power_law_fit (suffix p, $) (text t) =
save a ; numeric a[] ;
- save q ; path q ; % fit to the logs of the abscissae and ordinates
+ save q ; path q[] ; % fit to the logs of the abscissae and ordinates
for i=0 upto length p :
- if (xpart(point i of p)>0) and (ypart(point i of p)>0) :
- augment.q(ln(xpart(point i of p)),ln(ypart(point i of p))) ;
+ clearxy ; z = point i of p ;
+ if (x>0) and (y>0) :
+ augment.q0(ln(x),ln(y)) ;
+ augment.q1(
+ if known t :
+ if numeric t : (0,ln(t))
+ elseif pair t : (ln(xpart t),ln(ypart t))
+ elseif path t :
+ if length t>=i :
+ hide(z1 = point i of t)
+ (ln(x1),ln(y1))
+ else :
+ origin
+ fi
+ fi
+ else :
+ (0,1)
+ fi ) ;
fi
endfor
- linear_fit(q,a,t) ;
+ linear_fit(q0,a,q1) ;
save e ; e := exp(sqrt(fit_chi_squared)) ;
fit_chi_squared := e * e ;
$0 := a1 ;
@@ -1440,13 +1574,29 @@ enddef ;
vardef gaussian_fit (suffix p, $) (text t) =
save a ; numeric a[] ;
- save q ; path q ; % fit to the log of the ordinate
+ save q ; path q[] ; % fit to the log of the ordinate
for i=0 upto length p :
- if ypart(point i of p)>0 :
- augment.q(xpart(point i of p), ln(ypart(point i of p))) ;
+ clearxy ; z = point i of p ;
+ if y>0 :
+ augment.q0(x,ln(y)) ;
+ augment.q1(
+ if known t :
+ if numeric t : (0,ln(t))
+ elseif pair t : (xpart t,ln(ypart t))
+ elseif path t :
+ if length t>=i :
+ hide(z1 = point i of t)
+ (x1,ln(y1))
+ else :
+ origin
+ fi
+ fi
+ else :
+ (0,1)
+ fi ) ;
fi
endfor
- polynomial_fit(q,a,2,if t > 0 : ln(t) else : 0 fi) ;
+ polynomial_fit(q0,a,2,q1) ;
save e ; e := exp(sqrt(fit_chi_squared)) ;
fit_chi_squared := e * e ;
$1 := sqrt(-lntwo/a2) ;
diff --git a/metapost/context/base/mp-mlib.mpiv b/metapost/context/base/mp-mlib.mpiv
index 1f1146def..088c856a7 100644
--- a/metapost/context/base/mp-mlib.mpiv
+++ b/metapost/context/base/mp-mlib.mpiv
@@ -781,7 +781,7 @@ enddef ;
% passvariable("boolean",false) ;
% passvariable("path",fullcircle scaled 1cm) ;
-vardef mfun_p_to_s(expr p,i) =
+vardef mfun_point_to_string(expr p,i) =
decimal xpart (point i of p) & " " &
decimal ypart (point i of p) & " " &
decimal xpart (precontrol i of p) & " " &
@@ -790,14 +790,54 @@ vardef mfun_p_to_s(expr p,i) =
decimal ypart (postcontrol i of p)
enddef ;
+vardef mfun_transform_to_string(expr t) =
+ decimal xxpart t & " " & % rx
+ decimal xypart t & " " & % sx
+ decimal yxpart t & " " & % sy
+ decimal yypart t & " " & % ry
+ decimal xpart t & " " & % tx
+ decimal ypart t % ty
+enddef ;
+
+vardef mfun_numeric_to_string(expr n) =
+ decimal n
+enddef ;
+
+vardef mfun_pair_to_string(expr p) =
+ decimal xpart p & " " &
+ decimal ypart p
+enddef ;
+
+vardef mfun_rbgcolor_to_string(expr c) =
+ decimal redpart c & " " &
+ decimal greenpart c & " " &
+ decimal bluepart c
+enddef ;
+
+vardef mfun_cmykcolor_to_string(expr c) =
+ decimal cyanpart c & " " &
+ decimal magentapart c & " " &
+ decimal yellowpart c & " " &
+ decimal blackpart c
+enddef ;
+
+vardef mfun_path_to_string(expr p) =
+ mfun_point_to_string(value,1) for i=2 upto length(value) : & " " & mfun_point_to_string(value,i) endfor
+enddef ;
+
+vardef mfun_boolean_to_string(expr b) =
+ if value : "true" else : "false" fi
+enddef ;
+
def passvariable(expr key, value) =
special
- if numeric value : "1:" & key & "=" & decimal value
- elseif pair value : "4:" & key & "=" & ddecimal value
- elseif rgbcolor value : "5:" & key & "=" & dddecimal value
- elseif cmykcolor value : "6:" & key & "=" & ddddecimal value
- elseif boolean value : "3:" & key & "=" & if value : "true" else : "false" fi
- elseif path value : "7:" & key & "=" & mfun_p_to_s(value,1) for i=2 upto length(value) : & " " & mfun_p_to_s(value,i) endfor
+ if numeric value : "1:" & key & "=" & mfun_numeric_to_string(value)
+ elseif pair value : "4:" & key & "=" & mfun_pair_to_string(value)
+ elseif rgbcolor value : "5:" & key & "=" & mfun_rgbcolor_to_string(value)
+ elseif cmykcolor value : "6:" & key & "=" & mfun_cmykcolor_to_string(value)
+ elseif boolean value : "3:" & key & "=" & mfun_boolean_to_string(value)
+ elseif path value : "7:" & key & "=" & mfun_path_to_string(value)
+ elseif transform value : "8:" & key & "=" & mfun_transform_to_string(value)
else : "2:" & key & "=" & value
fi ;
enddef ;
diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mp-tool.mpiv
index 1600edd9a..a39219c67 100644
--- a/metapost/context/base/mp-tool.mpiv
+++ b/metapost/context/base/mp-tool.mpiv
@@ -77,6 +77,11 @@ def stopplaincompatibility =
endgroup ;
enddef ;
+%D More neutral:
+
+let triplet = rgbcolor ;
+let quadruplet = cmykcolor ;
+
%D Colors:
newinternal nocolormodel ; nocolormodel := 1 ;
diff --git a/metapost/context/fonts/bidi-symbols.mp b/metapost/context/fonts/bidi-symbols.mp
new file mode 100644
index 000000000..640b2b944
--- /dev/null
+++ b/metapost/context/fonts/bidi-symbols.mp
@@ -0,0 +1,73 @@
+%D \module
+%D [ file=bidi-symbols.mp,
+%D version=2013.09.06,
+%D title=\CONTEXT\ \METAPOST\ graphics,
+%D subtitle=demo font,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+passvariable("fontname","bidi-symbols") ;
+passvariable("fontversion","1.007") ;
+
+numeric font_bidi_dp ; font_bidi_dp := -6 ;
+numeric font_bidi_wd ; font_bidi_wd := -12 ;
+
+% beginfig(1) ; % lre
+% charcode := 8234 ; charwd := 0 ; charht := 0 ; chardp := 0 ;
+% drawarrow (0,0) -- (0,font_bidi_dp) -- (font_bidi_wd,font_bidi_dp) withcolor red ;
+% currentpicture := currentpicture scaled charscale ;
+% setbounds currentpicture to boundingbox nullpicture ;
+% endfig ;
+%
+% beginfig(2) ; % rle
+% charcode := 8235 ; charwd := 0 ; charht := 0 ; chardp := 0 ;
+% drawarrow (0,0) -- (0,font_bidi_dp) -- (-font_bidi_wd,font_bidi_dp) withcolor green ;
+% currentpicture := currentpicture scaled charscale ;
+% setbounds currentpicture to boundingbox nullpicture ;
+% endfig ;
+%
+% beginfig(3) ; % pdf
+% charcode := 8236 ; charwd := 0 ; charht := 0 ; chardp := 0 ;
+% draw (0,0) -- (0,font_bidi_dp) -- (-font_bidi_wd/2,font_bidi_dp) -- (font_bidi_wd/2,font_bidi_dp) withcolor blue ;
+% currentpicture := currentpicture scaled charscale ;
+% setbounds currentpicture to boundingbox nullpicture ;
+% endfig ;
+%
+% beginfig(4) ; % lro
+% charcode := 8237 ; charwd := 0 ; charht := 0 ; chardp := 0 ;
+% drawarrow reverse ((0,0) -- (0,font_bidi_dp) -- (font_bidi_wd,font_bidi_dp)) withcolor red ;
+% currentpicture := currentpicture scaled charscale ;
+% setbounds currentpicture to boundingbox nullpicture ;
+% endfig ;
+%
+% beginfig(5) ; % rlo
+% charcode := 8238 ; charwd := 0 ; charht := 0 ; chardp := 0 ;
+% drawarrow reverse ((0,0) -- (0,font_bidi_dp) -- (-font_bidi_wd,font_bidi_dp)) withcolor green ;
+% currentpicture := currentpicture scaled charscale ;
+% setbounds currentpicture to boundingbox nullpicture ;
+% endfig ;
+
+beginglyph(8234,0,0,0) ; % lre
+ drawarrow (0,0) -- (0,font_bidi_dp) -- (font_bidi_wd,font_bidi_dp) withcolor red ;
+endglyph ;
+
+beginglyph(8235,0,0,0) ; % rle
+ drawarrow (0,0) -- (0,font_bidi_dp) -- (-font_bidi_wd,font_bidi_dp) withcolor green ;
+endglyph ;
+
+beginglyph(8236,0,0,0) ; % pdf
+ draw (0,0) -- (0,font_bidi_dp) -- (-font_bidi_wd/2,font_bidi_dp) -- (font_bidi_wd/2,font_bidi_dp) withcolor blue ;
+endglyph ;
+
+beginglyph(8237,0,0,0) ; % lro
+ drawarrow reverse ((0,0) -- (0,font_bidi_dp) -- (font_bidi_wd,font_bidi_dp)) withcolor red ;
+endglyph ;
+
+beginglyph(8238,0,0,0) ; % rlo
+ drawarrow reverse ((0,0) -- (0,font_bidi_dp) -- (-font_bidi_wd,font_bidi_dp)) withcolor green ;
+endglyph ;
diff --git a/metapost/context/fonts/punkfont-bold.mp b/metapost/context/fonts/punkfont-bold.mp
new file mode 100644
index 000000000..1c62963f9
--- /dev/null
+++ b/metapost/context/fonts/punkfont-bold.mp
@@ -0,0 +1,4 @@
+boolean bold_punk ; bold_punk := true ;
+
+input "punkfont-definitions.mp" ;
+input "punkfont-characters.mp" ;
diff --git a/metapost/context/fonts/punkfont-boldslanted.mp b/metapost/context/fonts/punkfont-boldslanted.mp
new file mode 100644
index 000000000..3e5fa1561
--- /dev/null
+++ b/metapost/context/fonts/punkfont-boldslanted.mp
@@ -0,0 +1,5 @@
+boolean bold_punk ; bold_punk := true ;
+boolean slanted_punk ; slanted_punk := true ;
+
+input "punkfont-definitions.mp" ;
+input "punkfont-characters.mp" ;
diff --git a/metapost/context/fonts/punkfont-characters.mp b/metapost/context/fonts/punkfont-characters.mp
new file mode 100644
index 000000000..da0015b02
--- /dev/null
+++ b/metapost/context/fonts/punkfont-characters.mp
@@ -0,0 +1,726 @@
+initialize_punk_upper ;
+
+beginpunkchar("A",13,1,2);
+z1=pp(1.5u,0); z2=(.5w,1.1h); z3=pp(w-1.5u,0);
+pd z1; pd z3; draw z1--z2--z3; % left and right diagonals
+z4=pp .3[z1,z2]; z5=pp .3[z3,z2]; pd z4; pd z5; draw z4--z5; % crossbar
+endchar;
+
+beginpunkchar("B",12,1,1);
+z1=pp(2u,0); z2=pp(2u,.6h); z3=pp(2u,h); pd z1; pd z3; draw z1--z3; % stem
+z1.5=pp(w-u,.5y2); z2.5=pp(w-u,.5[y2,y3]); draw z2--z2.5--z3; % upper lobe
+draw flex(z2,z1.5,z1); % lower lobe
+endchar;
+
+beginpunkchar("C",13,1,2);
+z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=(.6w,0); z5=(w-2u,.2h);
+pd z1; pd z5; draw z1..z2..z3..z4..z5; % arc
+endchar;
+
+beginpunkchar("D",14,1,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6h);
+pd z1; pd z2; draw flex(z1,z3,z2); % lobe
+draw z1--z2; % stem
+endchar;
+
+beginpunkchar("E",12,.5,1);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2.5u,h); z4=pp(w-2u,0);
+pd z3; pd z4; draw z4--z1--z2--z3; % stem and arms
+z5=pp(2u,.6h); z6=pp(w-3u,.6h); pd z5; pd z6; draw z5--z6; % crossbar
+endchar;
+
+beginpunkchar("F",12,.5,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,h);
+pd z1; pd z3; draw z1--z2--z3; % stem and arm
+z5=pp(2u,.6h); z6=pp(w-3u,.6h); z4=pp .5[z5,z6]-(0,.1h);
+pd z5; pd z6; draw flex (z5,z4,z6); % crossbar
+endchar;
+
+beginpunkchar("G",13,.5,.5);
+z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=pp(.6w,0); z5=(w-2u,0);
+pd z1; draw z1..z2..z3..z4---z5; % arc
+z6=pp(.5[u,x5],.4h); pd z6; pd z5; draw z6--(pp(x5,y6))--z5; % spur
+endchar;
+
+beginpunkchar("H",14,1,.5);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h);
+z5=pp(2u,.6h); z6=pp(w-2u,.6h);
+pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw flex(z3,z6,z4); % stems
+pd z5; draw z5--z6; % crossbar
+endchar;
+
+beginpunkchar("I",5,1,2);
+z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h);
+pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem
+endchar;
+
+beginpunkchar("J",9,1,2);
+z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0);
+pd z1; pd z3; draw z1--z2--z3; % arc
+endchar;
+
+beginpunkchar("K",14,1,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(2u,1/3h); z4=pp(w-1.5u,h);
+pd z1; pd z2; draw z1--z2; % stem
+pd z3; pd z4; draw z3--z4; % upper diagonal
+z6=pp(w-u,0); z5=1/3[z3,z4];
+pd z6; draw flex(z5,.8[z1,2/3[z5,z6] ],z6);% lower diagonal
+endchar;
+
+beginpunkchar("L",11,1,2);
+z1=pp(2u,h); z2=pp(2u,0); z3=pp(w-1.5u,0);
+pd z1; pd z3; draw z1--z2--z3; % stem and arm
+endchar;
+
+beginpunkchar("M",17,.5,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(.5w,0); z4=pp(w-2u,h); z5=pp(w-2u,0);
+pd z1; pd z5; draw z1--z2--z3--z4--z5; % stems and diagonals
+endchar;
+
+beginpunkchar("N",13,.75,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h);
+pd z1; pd z4; draw z1--z2--z3--z4; % stems and diagonals
+endchar;
+
+beginpunkchar("O",12,.5,2);
+z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h);
+pd z1; draw z1{left}..z2..z3..z4..z1; % bowl
+endchar;
+
+beginpunkchar("P",13,1,2);
+z1=pp(2u,0); z2=pp(2u,1.1h); z3=pp(2u,.5h); z4=pp(w,.6[y3,y2]);
+pd z1; pd z3; draw z1--z2--z4--z3; % stem and bowl
+endchar;
+
+beginpunkchar("Q",14,.5,2);
+z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h);
+pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl
+z5=pp(.4w,.2h); z6=pp(w-u,-.1h); z7=pp(.5[x5,x6],-.2h);
+pd z5; pd z6; draw z5--z7--z6; % tail
+endchar;
+
+beginpunkchar("R",16,1,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6[y2,y4]); z4=pp(2u,.5h); z5=pp(w-1.5u,0);
+pd z1; pd z2; pd z5; draw z1--flex(z2,z3,z4)--z5; % stem, bowl, and diagonal
+endchar;
+
+beginpunkchar("S",11,.3,1);
+z1=pp(w-2u,.9h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.6[z6,z2];
+z5=pp(w-u,.35h); z6=pp(.5w,u); z7=pp(u,.2h);
+pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % stroke
+endchar;
+
+beginpunkchar("T",13,.75,2);
+z1=pp(u,h); z2=pp(w-u,h); z3=pp(.5w,0);
+pd z1; pd z2; pd z3; draw z1--z2; % arms
+draw .5[z1,z2]--z3; % stem
+endchar;
+
+beginpunkchar("U",13,.3,2);
+z1=pp(2u,h); z2=pp(2u,.2h); z3=pp(.5w,0); z4=pp(w-2u,.2h); z5=pp(w-2u,h);
+pd z1; pd z5; draw z1---z2...z3{z4-z2}...z4---z5; % stroke
+endchar;
+
+beginpunkchar("V",13,1,2);
+z1=pp(1.5u,h); z2=pp(.5w,0); z3=pp(w-1.5u,h);
+pd z1; pd z3; draw z1--z2--z3; % diagonals
+endchar;
+
+beginpunkchar("W",18,1,2);
+z1=pp(1.5u,h); z2=pp(.5[x1,x3],0); z3=pp(.5w,.8h); z4=pp(.5[x3,x5],0);
+z5=pp(w-1.5u,h);
+pd z1; pd z5; draw z1--z2--z3--z4--z5; % diagonals
+endchar;
+
+beginpunkchar("X",13,1,1);
+z1=pp(1.5u,h); z2=pp(w-1.5u,0); z3=pp(1.5u,0); z4=pp(w-2.5u,h);
+pd z1; pd z2; draw z1--z2; % main diagonal
+pd z3; pd z4; draw z3--z4; % cross diagonal
+endchar;
+
+beginpunkchar("Y",13,1,2);
+z1=pp(1.5u,h); z2=pp(w-1.5u,h); z3=pp(.5w,.5h); z4=pp(.5w,0);
+pd z1; pd z2; pd z4; draw z1--z3--z4; % stem and left diagonal
+draw z2--z3; % right diagonal
+endchar;
+
+beginpunkchar("Z",11,1,2);
+z1=pp(1.5u,h); z2=pp(w-2.5u,h); z3=pp(1.5u,0); z4=pp(w-1.5u,0);
+pd z1; pd z4; draw z1--z2--z3--z4; % diagonals
+endchar;
+
+beginpunkchar(198,16,1,2); % \AE
+z1=pp(1.5u,0); z2=pp(.6w,h); z3=pp(w-1.5u,h);
+pd z1; pd z3; draw z1--z2--z3; % left diagonal and upper arm
+z4=pp .3[z1,z2]; z5=pp(.6w,0); z6=pp(w-2u,.3h);
+pd z4; pd z6; draw z4--z6; % crossbar
+z7=pp(w-u,0); pd z2; pd z7; draw z2--z5--z7; % stem and lower arm
+endchar;
+
+beginpunkchar(338,18,1,2); % \OE
+z1=pp(.5w,h); z2=pp(u,.4h); z3=pp(.5w,0);
+pd z1; draw z1..z2..{right}z3; % bowl
+z4=pp(w-1.5u,h); z5=pp(w-2u,.4h); z6=pp(w-u,0);
+pd z4; pd z6; draw z4--z1--z3--z6; % arms and stem
+pd z5; draw z5--.4[z3,z1]; % crossbar
+endchar;
+
+beginpunkchar(216,14,1,1); % \O
+z1=pp(.5w,h); z2=pp(u,.5h); z3=pp(.5w,0); z4=pp(w-u,.5h);
+z5=pp(w-2u,1.1h); z6=pp(2u,-.1h);
+pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % bowl and diagonal
+endchar;
+
+beginpunkchar(915,11,1,2); % $\Gamma$
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-1.5u,h);
+pd z1; pd z3; draw z1--z2--z3; % stem and arm
+endchar;
+
+beginpunkchar(916,15,1,2); % $\Delta$
+z1=pp(u,0); z2=pp(.5w,h); z3=pp(w-u,0);
+pd z1; draw z1--z2..tension 5..z3..tension 5..z1; % triangle
+endchar;
+
+beginpunkchar(920,15,.5,2); % $\Theta$
+z1=pp(.5w,h); z2=pp(u,.6h); z3=pp(.5w,0); z4=pp(w-u,.6h);
+pd z1; draw z1..tension.8..z2..z3..z4..tension.8..z1; % bowl
+z5=pp(x2+2u,.4h); z6=pp(x4-2u,.4h); pd z5; pd z6; draw z5--z6; % bar
+endchar;
+
+beginpunkchar(923,12,1,2); % $\Lambda$
+z1=pp(u,0); z2=pp(.5w,h); z3=pp(w-u,0);
+pd z1; pd z3; draw z1--z2--z3; % diagonals
+endchar;
+
+beginpunkchar(926,12,1,1); % $\Xi$
+z1=pp(u,h); z2=pp(w-u,h); pd z1; pd z2; draw z1--z2; % upper arm
+z3=pp(2u,.55h); z4=pp(w-2u,.55h); pd z3; pd z4; draw z3--z4; % bar
+z5=pp(u,0); z6=pp(w-u,0); pd z5; pd z6; draw z5--z6; % lower arm
+endchar;
+
+beginpunkchar(928,13,1,.5); % $\Pi$
+z1=pp(1.5u,0); z2=pp(1.5u,h); z3=pp(w-1.5u,h); z4=pp(w-1.5u,0);
+pd z1; pd z4; draw z1--z2--z3--z4; % stems and bar
+endchar;
+
+beginpunkchar(931,13,1,1); % $\Sigma$
+z1=pp(w-u,h); z2=pp(u,h); z3=pp(.5w-u,.5h); z4=pp(u,0); z5=pp(w-u,0);
+pd z1; pd z5; draw z1--z2{.5[z4,z5]-z2}..z3--z4--z5; % arms and diagonals
+endchar;
+
+beginpunkchar(933,15,1,.5); % $\Upsilon$
+z1=pp(u,.8h); z2=pp(.3w,h); z3=pp(.5w,.5h); z4=pp(.5w,0);
+pd z1; pd z4; draw z1..z2..tension2..z3---z4; % left arc and stem
+z5=pp(w-u,.8h); z6=pp(.7w,h);
+pd z5; draw z5..z6..tension2..{z4-z3}z3; % right arc
+endchar;
+
+beginpunkchar(934,13,1,2); % $\Phi$
+z1=pp(.5w,h); z2=pp(.5w,0); pd z1; pd z2; draw z1--z2; % stem
+z3=pp(.5w,2/3h); z4=pp(u,.5h); z5=pp(.5w,1/4h); z6=pp(w-u,.5h);
+pd z3; draw z3..z4..z5..z6..z3; % bowl
+endchar;
+
+beginpunkchar(936,14,1,1); % $\Psi$
+z1=pp(.5w,h); z2=pp(.5w,0); pd z1; pd z2; draw z1--z2; % stem
+z3=pp(u,.8h); z4=pp(.5w,.2h); z5=pp(w-u,.8h);
+pd z3; pd z5; draw z3{.4[z1,z2]-z3}..z4{right}..{z5-.4[z1,z2]}z5; % stroke
+endchar;
+
+beginpunkchar(937,13,1,2); % $\Omega$
+z1=pp(u,0); z2=pp(1/3w,0); z3=pp(u,2/3h); z4=pp(.5w,h);
+z5=pp(w-u,2/3h); z6=pp(2/3w,0); z7=pp(w-u,0);
+pd z1; pd z7; draw z1--z2{up}..z3..z4..z5..{down}z6--z7; % bowl and arms
+endchar;
+
+beginpunkchar(".",5,1,2);
+pd pp(.5w,0); % dot
+endchar;
+
+beginpunkchar(",",5,.5,.5);
+z1=pp(.5w,0); z2=pp(w-u,-.1h); z3=pp(.5w,-.3h);
+pd z1; pd z3; draw z1--z2--z3; % stroke
+endchar;
+
+beginpunkchar(":",5,1,.5);
+pd pp(.5w,0); pd pp(.5w,.4h); % dots
+endchar;
+
+beginpunkchar(";",5,.5,.5);
+z1=pp(.5w,0); z2=pp(w-u,-.1h); z3=pp(.5w,-.3h);
+pd z1; pd z3; draw z1--z2--z3; % stroke
+pd pp(.5w,.4h); % dot
+endchar;
+
+beginpunkchar("!",5,.5,.5);
+pd pp(.5w,0); % dot
+z1=pp(.5w,1.05h); z2=pp(.5w,.3h); pd z1; pd z2; draw z1--z2; % stem
+endchar;
+
+beginpunkchar(161,5,.5,.5); % spanish inverted !
+pd pp(.5w,.9h); % dot
+z1=pp(.5w,-.1h); z2=pp(.5w,.6h); pd z1; pd z2; draw z1--z2; % stem
+endchar;
+
+beginpunkchar("?",9,1,.5);
+z1=pp(1.5u,.8h); z2=pp(.5w,h); z3=pp(w-u,.8h); z4=pp(.5w,.3h);
+pd z1; pd z4; draw z1..z2..z3..{down}z4; % arc and stem
+pd pp(.5w,0); % dot
+endchar;
+
+beginpunkchar(191,9,1,.5); % spanish inverted ?
+z1=pp(1.5u,.1h); z2=pp(.5w,-.1h); z3=pp(w-u,.1h); z4=pp(.5w,.6h);
+pd z1; pd z4; draw z1..z2..z3..{up}z4; % arc and stem
+pd pp(.5w,.9h); % dot
+endchar;
+
+beginpunkchar("&",14,.5,.5);
+z1=pp(w-2u,h); z2=pp(u,h); z3=pp(3u,0); z5=pp(w-u,.6h); z6=pp(w-2u,0);
+pd z1; pd z5; draw z1--z2--z3--z5; % arms and stem
+draw z1--.5[z2,z3]; pd z6; draw z6--.6[z3,z5]; % diagonals
+endchar;
+
+beginpunkchar("$",12,.5,.5);
+z1=pp(w-1.5u,.7h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.5[z3,z5];
+z5=pp(w-u,.3h); z6=pp(.5w,0); z7=pp(u,.3h);
+pd z1; pd z7; draw z1..z2..z3..z4..z5..z6..z7; % stroke
+z8=z2+(0,.1h); pd z8; draw z8--z6; % stem
+endchar;
+
+beginpunkchar("%",18,.5,.5);
+z1=pp(3.5u,1.1h); z2=pp(u,.8h); z3=pp(3.5u,.5h); z4=pp(6u,.8h);
+z5=pp(w-3.5u,.5h); z6=pp(w-6u,.2h); z7=pp(w-3.5u,-.1h); z8=pp(w-u,.2h);
+pd z1; draw z1..z2..z3..z4..z1; % upper bowl
+pd z5; draw z5..z6..z7..z8..z5; % lower bowl
+z9=pp(w-3u,1.1h); z0=pp(3u,-.1h); pd z0; draw z9--z0; % diagonal
+draw z1{z5-z1}..z9; % link
+endchar;
+
+beginpunkchar("@",18,1,.5);
+z1=pp(2u,0); z2=pp(1/3w,.7h); z3=pp(w-6u,0);
+z4=pp(w,.3h); z5=pp(1/3w,h); z6=pp(u,.5h); z7=.7[z2,z3];
+pd z1; pd z7; draw z1--z2--z3{right}..z4..z5..z6..z7; % diagonals and stroke
+endchar;
+
+beginpunkchar("-",7,.5,.5);
+z1=pp(u,.4h); z2=pp(w-u,.5h); pd z1; pd z2; draw z1--z2; % bar
+endchar;
+
+beginpunkchar(8211,9,.5,.5); % --
+z1=pp(0,.5h); z2=pp(w,.4h); pd z1; pd z2; draw z1--z2; % bar
+endchar;
+
+beginpunkchar(8212,18,.5,.5); % ---
+z1=pp(0,.5h); z2=pp(w,.4h); pd z1; pd z2; draw z1--z2; % bar
+endchar;
+
+beginpunkchar("+",9,.5,1);
+z1=pp(0,.5h); z2=pp(w,.5h); pd z1; pd z2; draw z1--z2; % bar
+z3=pp(.5w,.1h); z4=pp(.5w,.9h); pd z3; pd z4; draw z3--z4; % stem
+endchar;
+
+beginpunkchar("*",13,.5,1);
+z0=pp(.5w,1.1h); z1=pp(u,.9h); z2=pp(2u,.3h); z3=pp(w-u,.3h); z4=pp(w-u,.9h);
+pd z0; draw z0--z2..1/3[.5[z2,z4],z0]..z4--z1--z3--z0; % star
+endchar;
+
+beginpunkchar(39,5,.5,1.5); % ' apostrofe HH/TH (to be checked)
+z1=pp(w/2,h); z2=pp(w/2+u,.85h); z3=pp(w/2,2/3h);
+pd z1; pd z3; draw z1..z2..z3; % stroke
+endchar;
+
+beginpunkchar(34,9,1,1.5); % " HH/TH (to be checked)
+z1=pp(1.5u,h); z2=pp(1.5u,.6h); z3=pp(w-1.5u,h); z4=pp(w-1.5u,.6h);
+pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw z3--z4;
+endchar;
+
+beginpunkchar(8216,5,.3,.5); % `
+z1=pp(w-1.5u,h); z2=pp(u,.85h); z3=pp(w-u,2/3h);
+pd z1; pd z3; draw z1--z2--z3; % stroke
+endchar;
+
+beginpunkchar(8217,5,.3,.5); % '
+z1=pp(1.5u,h); z2=pp(w-u,.85h); z3=pp(u,2/3h);
+pd z1; pd z3; draw z1--z2--z3; % stroke
+endchar;
+
+beginpunkchar(8220,9,.3,.5); % `` quotedblleft
+z1=pp(.5w+.5u,h); z2=pp(w-u,.6h); z3=pp(u,.95h);
+pd z1; pd z3; draw z1--z2--z3; % stroke
+endchar;
+
+beginpunkchar(8221,9,.3,.5); % '' quotedblright
+z1=pp(.5w-.5u,h); z2=pp(u,.6h); z3=pp(w-u,.95h);
+pd z1; pd z3; draw z1--z2--z3; % stroke
+endchar;
+
+beginpunkchar("(",7,.5,.5);
+z1=pp(w-u,h); z2=pp(u,.5h); z3=pp(w-u,0);
+pd z1; pd z3; draw z1..z2..z3; % stroke
+endchar;
+
+beginpunkchar(")",7,.5,.5);
+z1=pp(u,h); z2=pp(w-u,.5h); z3=pp(u,0); pd z1; pd z3; draw z1..z2..z3; % stroke
+endchar;
+
+beginpunkchar("[",8,.5,.5);
+z1=pp(w-u,h); z2=pp(.5w,h); z3=pp(.5w,0); z4=pp(w-u,0);
+pd z1; pd z4; draw z1--z2--z3--z4; % bars and stem
+endchar;
+
+beginpunkchar("]",8,.5,.5);
+z1=pp(u,h); z2=pp(.5w,h); z3=pp(.5w,0); z4=pp(u,0);
+pd z1; pd z4; draw z1--z2--z3--z4; % bars and stem
+endchar;
+
+beginpunkchar("<",9,.5,.5);
+z1=pp(w-u,.9h); z2=pp(u,.5h); z3=pp(w-u,.1h);
+pd z1; pd z3; draw z1--z2--z3; % diagonals
+endchar;
+
+beginpunkchar(">",9,.5,.5);
+z1=pp(u,.9h); z2=pp(w-u,.5h); z3=pp(u,.1h);
+pd z1; pd z3; draw z1--z2--z3; % diagonals
+endchar;
+
+beginpunkchar("{",10,.5,.5); % HH/TH
+z1=pp(w-2u,h); z3=pp(2u,.5h); z5=pp(w-2u,0);
+z2=pp(w-4u,.6h); z4=(w-4u,.4h);
+pd z1; pd z3; pd z5; draw z1{left}..z2--z3 & z3--z4..{right}z5;
+endchar;
+
+beginpunkchar("}",10,.5,.5); % HH/TH
+z1=pp(2u,h); z3=pp(w-2u,.5h); z5=pp(2u,0);
+z2=pp(4u,.6h); z4=(4u,.4h);
+pd z1; pd z3; pd z5; draw z1{right}..z2--z3 & z3--z4..{left}z5;
+endchar;
+
+beginpunkchar("=",9,.5,.5);
+z5=pp(u,2/3h); z6=pp(w-u,2/3h); pd z5; pd z6; draw z5--z6; % upper bar
+z7=pp(u,1/3h); z8=pp(w-u,1/3h); pd z7; pd z8; draw z7--z8; % lower bar
+endchar;
+
+beginpunkchar("#",15,.5,.5);
+z1=pp(.5w,h); z2=pp(3u,0); z3=pp(w-3u,h); z4=pp(.5w,0);
+pd z2; pd z3; draw z3--z1--z2; draw z3--z4--z2; % diagonals (linked)
+z5=pp(u,2/3h); z6=pp(w-u,2/3h); pd z5; pd z6; draw z5--z6; % upper bar
+z7=pp(u,1/3h); z8=pp(w-u,1/3h); pd z7; pd z8; draw z7--z8; % lower bar
+endchar;
+
+beginpunkchar("/",9,1,1);
+z1=pp(1.5u,-.05h); z2=pp(w-1.5u,1.05h); pd z1; pd z2; draw z1--z2; % diagonal
+endchar;
+
+beginpunkchar("\",9,1,1); % HH/TH
+z1=pp(1.5u,1.05h); z2=pp(w-1.5u,-.05h); pd z1; pd z2; draw z1--z2; % reverse diagonal
+endchar;
+
+
+beginpunkchar("0",9,.5,1);
+z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h);
+pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl
+endchar;
+
+beginpunkchar("1",9,.3,1);
+z1=pp(2u,.7h); z2=pp(.6w,h); z3=pp(.6w,0);
+pd z1; pd z3; draw z1--z2--z3; % serif and stem
+endchar;
+
+beginpunkchar("2",9,1,1);
+z1=pp(2u,.7h); z2=pp(.5w,h); z3=pp(w-u,.6h); z4=pp(u,0); z5=pp(w-2u,0);
+pd z1; pd z5; draw z1..z2..z3..z4--z5; % stroke
+endchar;
+
+beginpunkchar("3",9,.5,.5);
+z1=pp(2u,.7h); z2=pp(.5w,h); z3=pp(w-u,.5[y2,y4]);
+z4=pp(.5w-u,.55h); z5=pp(w-u,.5[y4,y6]); z6=pp(.5w,0); z7=pp(1.5u,.2h);
+pd z1; pd z7; draw z1..z2..z3..z4&z4..z5..z6..z7; % arcs
+endchar;
+
+beginpunkchar("4",9,1,1);
+z1=pp(w-u,.3h); z2=pp(u,.3h); z3=pp(2/3w,h); z4=pp(2/3w,0);
+pd z1; pd z4; draw z1--z2--z3--z4; % stem and diagonals
+endchar;
+
+beginpunkchar("5",9,.5,.5);
+z1=pp(w-2u,h); z2=pp(2u,h); z3=pp(u,.7h); z4=pp(w-u,.5[y3,y5]);
+z5=pp(.5w,0); z6=pp(u,.2h);
+pd z1; pd z6; draw z1--z2--z3..z4..z5..z6; % stroke
+endchar;
+
+beginpunkchar("6",9,1,1);
+z1=pp(2/3w,h); z2=pp(u,.3h); z3=pp(.5w,0); z4=pp(w-u,.3h); z5=pp(.6w,.6h);
+z6=pp z2; pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % stroke
+endchar;
+
+beginpunkchar("7",9,.5,1);
+z1=pp(2u,h); z2=pp(w-.5u,h); z3=pp(.4w,0);
+pd z1; pd z3; draw z1--z2&z2..z3{down}; % stroke
+endchar;
+
+beginpunkchar("8",9,.5,.5);
+z1=pp(.5w,h); z2=pp(u,.5[y1,y3]); z3=pp(.5w,.6h); z4=pp(w-u,.5[y3,y5]);
+z5=pp(.5w,0); z6=pp(u,.5[y5,y3]); z7=pp(w-u,.5[y1,y3]);
+pd z1; draw z1{curl 8}..z2..z3..z4..z5..z6..z3..z7..z1; % stroke
+endchar;
+
+beginpunkchar("9",9,1,1);
+z1=pp(1/3w,0); z2=pp(w-u,.7h); z3=pp(.5w,h); z4=pp(u,.7h); z5=pp(.5w,.4h);
+pd z1; pd z5; draw z1..z2..z3..z4..z5; % stroke
+endchar;
+
+beginpunkchar(96,9,1,1); % \`{} grave
+z1=pp(2.5u,h); z2=pp(.6w,.8h); pd z1; pd z2; draw z1--z2; % diagonal
+endchar;
+
+beginpunkchar(180,9,1,1); % \'{} acute
+z1=pp(w-2.5u,h); z2=pp(.4w,.8h); pd z1; pd z2; draw z1--z2; % diagonal
+endchar;
+
+beginpunkchar(710,13,1,1); % \^{} circumflex
+z1=pp(2.5u,.8h); z2=pp(.5w,h); z3=(w-2.5u,.8h);
+pd z1; pd z3; draw z1--z2--z3; % diagonals
+endchar;
+
+beginpunkchar(711,13,1,1); % \v{} caron
+z1=pp(2.5u,.9h); z2=pp(.5w,.7h); z3=pp(w-2.5u,.9h);
+pd z1; pd z3; draw z1--z2--z3; % diagonals
+endchar;
+
+beginpunkchar(728,11,1,1); % \u{} breve
+z1=pp(2u,h); z2=pp(.5w,.75h); z3=pp(w-2u,h);
+pd z1; pd z3; draw flex(z1,z2,z3); % stroke
+endchar;
+
+beginpunkchar(175,12,1,1); % \={} macron
+z1=pp(u,.8h); z2=pp(w-u,.8h); pd z1; pd z2; draw z1--z2; % bar
+endchar;
+
+beginpunkchar(729,5,1,1); % \.{}
+pd pp(.5w,.9h); % dot
+endchar;
+
+beginpunkchar(168,13,1,1); % \"{} diaeresis
+pd pp(1/5w,.9h); pd pp(4/5w,.9h); % dots
+endchar;
+
+beginpunkchar(732,13,1,1); % \~{} tilde
+z1=pp(u,.75h); z2=pp(w-u,.9h); pd z1; pd z2; draw z1{up}..{up}z2; % stroke
+endchar;
+
+beginpunkchar(733,13,1,1); % \H{} hungarumlaut
+z1=pp(4u,h); z2=pp(2.5u,.7h); z3=pp(w-2u,h); z4=pp(w-3.5u,.7h);
+pd z1; pd z3; draw z1--z2--z4--z3; % diagonals (linked)
+endchar;
+
+beginpunkchar(730,13,0,0); % Scandinavian loop, for \AA\ and \aa (ring)
+z0=(.5w,.66h); % point $z^2$ of lowercase A
+z1=(.5w,.9h); draw z0{z0-(1.5u,0)}..z1..{(w-1.5u,0)-z0}z0; % loop
+endchar;
+
+beginpunkchar(184,13,.5,.5); % Cedilla, for \c c
+z1=(.6w,0); z2=pp(.6w,-.1h); z3=pp(2.5u,-.1h);
+pd z3; draw z1--z2--z3; % stroke
+endchar;
+
+initialize_punk_lower ;
+
+beginpunkchar(305,5,1,2); % dotless I
+z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h);
+pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem
+endchar;
+
+beginpunkchar(567,9,1,2); % dotless J
+z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0);
+pd z1; pd z3; draw z1--z2--z3; % arc
+endchar;
+
+beginpunkchar(223,18,.3,1); % German SS
+z1=pp(.5w-u,.9h); z2=pp(1/3w,h); z3=pp(u,.7h); z4=.6[z6,z2];
+z5=pp(.5w,.35h); z6=pp(1/3w,u); z7=pp(u,.2h);
+pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % left stroke
+for i=1 upto 7: z[i+10]=pp(z[i] shifted (.5w-u,0)); endfor
+pd z11; pd z17; draw z11--z12...z13..z14..z15...z16--z17; % right stroke
+endchar;
+
+beginpunkchar("a",13,1,2);
+z1=pp(1.5u,0); z2=(.5w,1.1h); z3=pp(w-1.5u,0);
+pd z1; pd z3; draw z1--z2--z3; % left and right diagonals
+z4=pp .3[z1,z2]; z5=pp .3[z3,z2]; pd z4; pd z5; draw z4--z5; % crossbar
+endchar;
+
+beginpunkchar("b",12,1,1);
+z1=pp(2u,0); z2=pp(2u,.6h); z3=pp(2u,h); pd z1; pd z3; draw z1--z3; % stem
+z1.5=pp(w-u,.5y2); z2.5=pp(w-u,.5[y2,y3]); draw z2--z2.5--z3; % upper lobe
+draw flex(z2,z1.5,z1); % lower lobe
+endchar;
+
+beginpunkchar("c",13,1,2);
+z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=(.6w,0); z5=(w-2u,.2h);
+pd z1; pd z5; draw z1..z2..z3..z4..z5; % arc
+endchar;
+
+beginpunkchar("d",14,1,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6h);
+pd z1; pd z2; draw flex(z1,z3,z2); % lobe
+draw z1--z2; % stem
+endchar;
+
+beginpunkchar("e",12,.5,1);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2.5u,h); z4=pp(w-2u,0);
+pd z3; pd z4; draw z4--z1--z2--z3; % stem and arms
+z5=pp(2u,.6h); z6=pp(w-3u,.6h); pd z5; pd z6; draw z5--z6; % crossbar
+endchar;
+
+beginpunkchar("f",12,.5,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,h);
+pd z1; pd z3; draw z1--z2--z3; % stem and arm
+z5=pp(2u,.6h); z6=pp(w-3u,.6h); z4=pp .5[z5,z6]-(0,.1h);
+pd z5; pd z6; draw flex (z5,z4,z6); % crossbar
+endchar;
+
+beginpunkchar("g",13,.5,.5);
+z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=pp(.6w,0); z5=(w-2u,0);
+pd z1; draw z1..z2..z3..z4---z5; % arc
+z6=pp(.5[u,x5],.4h); pd z6; pd z5; draw z6--(pp(x5,y6))--z5; % spur
+endchar;
+
+beginpunkchar("h",14,1,.5);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h);
+z5=pp(2u,.6h); z6=pp(w-2u,.6h);
+pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw flex(z3,z6,z4); % stems
+pd z5; draw z5--z6; % crossbar
+endchar;
+
+beginpunkchar("i",5,1,2);
+z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h);
+pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem
+endchar;
+
+beginpunkchar("j",9,1,2);
+z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0);
+pd z1; pd z3; draw z1--z2--z3; % arc
+endchar;
+
+beginpunkchar("k",14,1,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(2u,1/3h); z4=pp(w-1.5u,h);
+pd z1; pd z2; draw z1--z2; % stem
+pd z3; pd z4; draw z3--z4; % upper diagonal
+z6=pp(w-u,0); z5=1/3[z3,z4];
+pd z6; draw flex(z5,.8[z1,2/3[z5,z6] ],z6);% lower diagonal
+endchar;
+
+beginpunkchar("l",11,1,2);
+z1=pp(2u,h); z2=pp(2u,0); z3=pp(w-1.5u,0);
+pd z1; pd z3; draw z1--z2--z3; % stem and arm
+endchar;
+
+beginpunkchar("m",17,.5,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(.5w,0); z4=pp(w-2u,h); z5=pp(w-2u,0);
+pd z1; pd z5; draw z1--z2--z3--z4--z5; % stems and diagonals
+endchar;
+
+beginpunkchar("n",13,.75,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h);
+pd z1; pd z4; draw z1--z2--z3--z4; % stems and diagonals
+endchar;
+
+beginpunkchar("o",12,.5,2);
+z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h);
+pd z1; draw z1{left}..z2..z3..z4..z1; % bowl
+endchar;
+
+beginpunkchar("p",13,1,2);
+z1=pp(2u,0); z2=pp(2u,1.1h); z3=pp(2u,.5h); z4=pp(w,.6[y3,y2]);
+pd z1; pd z3; draw z1--z2--z4--z3; % stem and bowl
+endchar;
+
+beginpunkchar("q",14,.5,2);
+z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h);
+pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl
+z5=pp(.4w,.2h); z6=pp(w-u,-.1h); z7=pp(.5[x5,x6],-.2h);
+pd z5; pd z6; draw z5--z7--z6; % tail
+endchar;
+
+beginpunkchar("r",16,1,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6[y2,y4]); z4=pp(2u,.5h); z5=pp(w-1.5u,0);
+pd z1; pd z2; pd z5; draw z1--flex(z2,z3,z4)--z5; % stem, bowl, and diagonal
+endchar;
+
+beginpunkchar("s",11,.3,1);
+z1=pp(w-2u,.9h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.6[z6,z2];
+z5=pp(w-u,.35h); z6=pp(.5w,u); z7=pp(u,.2h);
+pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % stroke
+endchar;
+
+beginpunkchar("t",13,.75,2);
+z1=pp(u,h); z2=pp(w-u,h); z3=pp(.5w,0);
+pd z1; pd z2; pd z3; draw z1--z2; % arms
+draw .5[z1,z2]--z3; % stem
+endchar;
+
+beginpunkchar("u",13,.3,2);
+z1=pp(2u,h); z2=pp(2u,.2h); z3=pp(.5w,0); z4=pp(w-2u,.2h); z5=pp(w-2u,h);
+pd z1; pd z5; draw z1---z2...z3{z4-z2}...z4---z5; % stroke
+endchar;
+
+beginpunkchar("v",13,1,2);
+z1=pp(1.5u,h); z2=pp(.5w,0); z3=pp(w-1.5u,h);
+pd z1; pd z3; draw z1--z2--z3; % diagonals
+endchar;
+
+beginpunkchar("w",18,1,2);
+z1=pp(1.5u,h); z2=pp(.5[x1,x3],0); z3=pp(.5w,.8h); z4=pp(.5[x3,x5],0);
+z5=pp(w-1.5u,h);
+pd z1; pd z5; draw z1--z2--z3--z4--z5; % diagonals
+endchar;
+
+beginpunkchar("x",13,1,1);
+z1=pp(1.5u,h); z2=pp(w-1.5u,0); z3=pp(1.5u,0); z4=pp(w-2.5u,h);
+pd z1; pd z2; draw z1--z2; % main diagonal
+pd z3; pd z4; draw z3--z4; % cross diagonal
+endchar;
+
+beginpunkchar("y",13,1,2);
+z1=pp(1.5u,h); z2=pp(w-1.5u,h); z3=pp(.5w,.5h); z4=pp(.5w,0);
+pd z1; pd z2; pd z4; draw z1--z3--z4; % stem and left diagonal
+draw z2--z3; % right diagonal
+endchar;
+
+beginpunkchar("z",11,1,2);
+z1=pp(1.5u,h); z2=pp(w-2.5u,h); z3=pp(1.5u,0); z4=pp(w-1.5u,0);
+pd z1; pd z4; draw z1--z2--z3--z4; % diagonals
+endchar;
+
+beginpunkchar(230,16,1,2); % \ae
+z1=pp(1.5u,0); z2=pp(.6w,h); z3=pp(w-1.5u,h);
+pd z1; pd z3; draw z1--z2--z3; % left diagonal and upper arm
+z4=pp .3[z1,z2]; z5=pp(.6w,0); z6=pp(w-2u,.3h);
+pd z4; pd z6; draw z4--z6; % crossbar
+z7=pp(w-u,0); pd z2; pd z7; draw z2--z5--z7; % stem and lower arm
+endchar;
+
+beginpunkchar(339,18,1,2); % \oe
+z1=pp(.5w,h); z2=pp(u,.4h); z3=pp(.5w,0);
+pd z1; draw z1..z2..{right}z3; % bowl
+z4=pp(w-1.5u,h); z5=pp(w-2u,.4h); z6=pp(w-u,0);
+pd z4; pd z6; draw z4--z1--z3--z6; % arms and stem
+pd z5; draw z5--.4[z3,z1]; % crossbar
+endchar;
+
+beginpunkchar(248,14,1,1); % \o
+z1=pp(.5w,h); z2=pp(u,.5h); z3=pp(.5w,0); z4=pp(w-u,.5h);
+z5=pp(w-2u,1.1h); z6=pp(2u,-.1h);
+pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % bowl and diagonal
+endchar;
+
+revert_punk_lower;
+
+beginpunkchar("_",12,.5,.5); % _
+z1=pp(0,-.2h); z2=pp(w,-.2h); pd z1; pd z2; draw z1--z2; % bar
+endchar;
+
+beginpunkchar("^",12,1,.5); %
+z1=pp(.5w,h); z2=pp(1.5u,.6h); z3=pp(w-1.5u,.6h);
+pd z2; pd z3; draw z2--z1--z3;
+endchar;
diff --git a/metapost/context/fonts/punkfont-definitions.mp b/metapost/context/fonts/punkfont-definitions.mp
new file mode 100644
index 000000000..2901a9d03
--- /dev/null
+++ b/metapost/context/fonts/punkfont-definitions.mp
@@ -0,0 +1,115 @@
+% Remark:
+%
+% This file is a merge of the original punk files by Donald Knuth, who
+% added this comment:
+%
+% Font inspired by Gerard and Marjan Unger's lectures, Feb 1985
+%
+% The regular punk files are part of TeXLive and in metafont format. All
+% errors introduced are ours. We also changed the encoding to unicode. In
+% due time we might add a few more more characters. We still need to
+% improve some of the metrics which involves a bit of trial and error. The
+% font just covers basic latin shapes but in ConTeXt MkIV we add virtual
+% composed shapes. There is a module m-punk.tex that implements this. This
+% derivate is also used in mk.tex (mk.pdf) which is one of our tests for
+% LuaTeX. We published an article on it in the MAPS (NTG magazine).
+%
+% 2008, Taco Hoekwater & Hans Hagen
+
+if unknown punk_font_loaded :
+
+ if unknown scale_factor :
+ scale_factor := 1 ;
+ fi ;
+
+ boolean punk_font_loaded ;
+
+ punk_font_loaded := true ;
+ warningcheck := 0 ;
+ proofing := 0 ;
+ designsize := 10pt#;
+ font_identifier := "Punk Nova" ; % dedicated to Don Knuth and Hermann Zapf
+
+ ht# := 7pt# ; % height of characters
+ u# := 1/4pt# ; % unit width
+ dev# := .3pt# ; % standard deviation of punk points
+
+ if known bold_punk :
+ s# := 1.2pt# ; % extra sidebar
+ px# := 1pt# ; % horizontal thickness of pen
+ py# := .8pt# ; % vertical thickness of pen
+ dot# := 1.7pt# ; % diameter of dots
+ else :
+ s# := 0 ; % extra sidebar, ok
+ px# := .6pt# ; % horizontal thickness of pen
+ py# := .5pt# ; % vertical thickness of pen
+ dot# := 1.3pt# ; % diameter of dots
+ fi ;
+
+ pt := .1pt ;
+ mag := scale_factor * 10 ;
+ bp_per_pixel := bpppix_ * mag ;
+
+ define_pixels(u,dev) ;
+ define_blacker_pixels(px,py,dot) ;
+ define_whole_pixels(s) ;
+ xoffset := s ;
+
+ pickup pencircle xscaled px yscaled py ;
+ punk_pen := savepen ;
+ pickup pencircle scaled dot ;
+ path dot_pen_path ;
+ dot_pen_path := tensepath makepath currentpen ;
+
+ defaultcolormodel := 1 ;
+
+ if known slanted_punk :
+ dot_pen_path := dot_pen_path slanted -0.25 ;
+ extra_endchar := extra_endchar & "currentpicture := currentpicture slanted 0.25 ;" ;
+ fi ;
+
+
+ def beginpunkchar(expr c,n,h,v) = % code $c$; width is $n$ units
+ hdev := h * dev ; % modify horizontal amounts of deviation
+ vdev := v * dev ; % modify vertical amounts of deviation
+ beginchar(c,n*u#,ht#,0) ;
+ italcorr 0 ;
+ % italcorr ht#*slant;
+ pickup punk_pen
+ enddef ;
+
+ def ^ =
+ transformed currenttransform
+ enddef ;
+
+ def makebox(text rule) =
+ for y=0, h : % horizontals
+ rule((-s,y)^,(w-s,y)^) ;
+ endfor
+ for x=-s, 0, w-2s, w-s : % verticals
+ rule((x,0)^,(x,h)^) ;
+ endfor
+ enddef ;
+
+ rulepen := pensquare ;
+
+ vardef pp expr z =
+ z + (hdev * normaldeviate, vdev * normaldeviate)
+ enddef;
+
+ def pd expr z = % {\bf drawdot}
+ addto currentpicture contour dot_pen_path shifted z.t_ % withpen penspeck
+ enddef;
+
+ def initialize_punk_upper =
+ ht# := 7pt# ; dev# := .3pt# ;
+ enddef ;
+ def initialize_punk_lower =
+ sht# := ht#; sdev := dev;
+ ht# := .6ht# ; dev := .7dev ;
+ enddef ;
+ def revert_punk_lower =
+ ht# := sht#; dev := sdev;
+ enddef ;
+
+fi ;
diff --git a/metapost/context/fonts/punkfont-slanted.mp b/metapost/context/fonts/punkfont-slanted.mp
new file mode 100644
index 000000000..5c1ff46b2
--- /dev/null
+++ b/metapost/context/fonts/punkfont-slanted.mp
@@ -0,0 +1,4 @@
+boolean slanted_punk ; slanted_punk := true ;
+
+input "punkfont-definitions.mp" ;
+input "punkfont-characters.mp" ;
diff --git a/metapost/context/fonts/punkfont.mp b/metapost/context/fonts/punkfont.mp
new file mode 100644
index 000000000..2a03aae81
--- /dev/null
+++ b/metapost/context/fonts/punkfont.mp
@@ -0,0 +1,2 @@
+input "punkfont-definitions.mp" ;
+input "punkfont-characters.mp" ;
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index 2ca3253d0..4c6672051 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -854,7 +854,7 @@ local function make_mkiv_format(name,engine)
end
local function make_mkii_format(name,engine)
- local command = format("mtxrun texexec.rb --make --%s %s",name,engine)
+ local command = format("mtxrun texexec.rb --make %s --%s",name,engine)
report("running command: %s",command)
os.spawn(command)
end
diff --git a/scripts/context/lua/mtx-flac.lua b/scripts/context/lua/mtx-flac.lua
index 2155b24be..4e01abc99 100644
--- a/scripts/context/lua/mtx-flac.lua
+++ b/scripts/context/lua/mtx-flac.lua
@@ -56,11 +56,20 @@ readers.default = function(f,size,target)
f:seek("cur",size)
end
+local valid = {
+ ["fLaC"] = true,
+ ["ID3♥"] = false,
+}
+
function flac.getmetadata(filename)
local f = io.open(filename, "rb")
if f then
- local banner = readstring(f,4)
- if banner == "fLaC" then
+ local banner = readstring(f,4)
+ local whatsit = valid[banner]
+ if whatsit ~= nil then
+ if whatsit == false then
+ flac.report("suspicious flac file: %s (%s)",filename,banner)
+ end
local data = {
banner = banner,
filename = filename,
@@ -96,13 +105,14 @@ function flac.savecollection(pattern,filename)
local files = dir.glob(pattern)
flac.report("%s files found, analyzing files",#files)
local music = { }
+ table.sort(files)
for i=1,#files do
local data = flac.getmetadata(files[i])
if data then
- local tags = data.tags
- local info = data.info
- local artist = tags.artist
- local album = tags.album
+ local tags = data.tags
+ local info = data.info
+ local artist = tags.artist or "no-artist"
+ local album = tags.album or "no-album"
local albums = music[artist]
if not albums then
albums = { }
@@ -134,8 +144,18 @@ function flac.savecollection(pattern,filename)
f:write("\t<artist>\n")
f:write("\t\t<name>",lpegmatch(p_escaped,artist),"</name>\n")
f:write("\t\t<albums>\n")
- for album, data in sortedpairs(albums) do
- nofalbums = nofalbums + 1
+ local list = table.keys(albums)
+ table.sort(list,function(a,b)
+ local ya, yb = albums[a].year or 0, albums[b].year or 0
+ if ya == yb then
+ return a < b
+ else
+ return ya < yb
+ end
+ end)
+ for nofalbums=1,#list do
+ local album = list[nofalbums]
+ local data = albums[album]
f:write("\t\t\t<album year='",data.year or 0,"'>\n")
f:write("\t\t\t\t<name>",lpegmatch(p_escaped,album),"</name>\n")
f:write("\t\t\t\t<tracks>\n")
@@ -179,6 +199,7 @@ local helpinfo = [[
<category name="basic">
<subcategory>
<flag name="collect"><short>collect albums in xml file</short></flag>
+ <flag name="pattern"><short>use pattern for locating files</short></flag>
</subcategory>
</category>
</flags>
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 682425a23..0ddb7f65c 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -434,7 +434,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 29071, stripped down to: 15964
+-- original size: 29245, stripped down to: 15964
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -16546,8 +16546,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 679359
--- stripped bytes : 240332
+-- original bytes : 679533
+-- stripped bytes : 240506
-- end library merge
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 682425a23..0ddb7f65c 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -434,7 +434,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 29071, stripped down to: 15964
+-- original size: 29245, stripped down to: 15964
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -16546,8 +16546,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 679359
--- stripped bytes : 240332
+-- original bytes : 679533
+-- stripped bytes : 240506
-- end library merge
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 682425a23..0ddb7f65c 100755
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -434,7 +434,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 29071, stripped down to: 15964
+-- original size: 29245, stripped down to: 15964
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -16546,8 +16546,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 679359
--- stripped bytes : 240332
+-- original bytes : 679533
+-- stripped bytes : 240506
-- end library merge
diff --git a/tex/context/base/anch-pgr.mkiv b/tex/context/base/anch-pgr.mkiv
index 8ed9913ae..c18a1b669 100644
--- a/tex/context/base/anch-pgr.mkiv
+++ b/tex/context/base/anch-pgr.mkiv
@@ -444,6 +444,8 @@
\def\currentposition{#1}\MPpositiongraphic{#2}{#3}%
\fi}
+\let\anch_positions_meta_graphic_handle_indeed\relax
+
\appendtoks
\let\anch_positions_meta_graphic_handle_indeed\anch_positions_meta_graphic_insert
\to \everyinsertpositionaction
diff --git a/tex/context/base/attr-lay.lua b/tex/context/base/attr-lay.lua
index 4bcc70b0c..176af1a2c 100644
--- a/tex/context/base/attr-lay.lua
+++ b/tex/context/base/attr-lay.lua
@@ -133,8 +133,8 @@ attributes.viewerlayers.handler = nodes.installattributehandler {
namespace = viewerlayers,
initializer = initializer,
finalizer = states.finalize,
- -- processor = states.stacked,
processor = states.stacker,
+ -- processor = states.stacked,
}
local stack, enabled, global = { }, false, false
diff --git a/tex/context/base/back-pdf.mkiv b/tex/context/base/back-pdf.mkiv
index 4ea76e1b5..948a14138 100644
--- a/tex/context/base/back-pdf.mkiv
+++ b/tex/context/base/back-pdf.mkiv
@@ -262,6 +262,8 @@
{\back_object_stop
\egroup}
+\let\back_object_stop\relax
+
% attr {/Group << /S /Transparency /I false /K true >>}
\def\back_object_register#1#2%
diff --git a/tex/context/base/buff-imp-mp.lua b/tex/context/base/buff-imp-mp.lua
index 34e3459c6..bcd18dd47 100644
--- a/tex/context/base/buff-imp-mp.lua
+++ b/tex/context/base/buff-imp-mp.lua
@@ -36,6 +36,8 @@ local MetapostSnippetConstructor = verbatim.MetapostSnippetConstructor
local MetapostSnippetBoundary = verbatim.MetapostSnippetBoundary
local MetapostSnippetSpecial = verbatim.MetapostSnippetSpecial
local MetapostSnippetComment = verbatim.MetapostSnippetComment
+local MetapostSnippetQuote = verbatim.MetapostSnippetQuote
+local MetapostSnippetString = verbatim.MetapostSnippetString
local MetapostSnippetNamePrimitive = verbatim.MetapostSnippetNamePrimitive
local MetapostSnippetNamePlain = verbatim.MetapostSnippetNamePlain
local MetapostSnippetNameMetafun = verbatim.MetapostSnippetNameMetafun
diff --git a/tex/context/base/buff-imp-tex.lua b/tex/context/base/buff-imp-tex.lua
index 9e61de016..097dff212 100644
--- a/tex/context/base/buff-imp-tex.lua
+++ b/tex/context/base/buff-imp-tex.lua
@@ -41,7 +41,7 @@ local handler = visualizers.newhandler {
-- todo: unicode letters in control sequences (slow as we need to test the nature)
local comment = S("%")
-local name = P("\\") * (patterns.letter + S("@!?"))^1
+local name = P("\\") * (patterns.letter + S("@!?_"))^1
local escape = P("\\") * (patterns.anything - patterns.newline)^-1 -- else we get \n
local group = S("${}")
local boundary = S('[]()<>#="')
diff --git a/tex/context/base/buff-ini.mkiv b/tex/context/base/buff-ini.mkiv
index 3b754b532..4ea3042b6 100644
--- a/tex/context/base/buff-ini.mkiv
+++ b/tex/context/base/buff-ini.mkiv
@@ -61,6 +61,9 @@
\def\buff_grab_direct_indeed_a[#1][#2][#3][#4]{\buff_start_indeed {#1}{#2}{#3}{#4}}
\def\buff_grab_direct_indeed_b[#1][#2][#3][#4]{\buff_start_indeed\empty{#1}{#2}{#3}}
+\let\buff_finish\relax
+\let\buff_gobble\relax
+
\unexpanded\def\buff_pickup#1#2#3#4#5% name, startsequence, stopsequence, before, after
{\begingroup % (1)
#4%
@@ -140,6 +143,9 @@
\unexpanded\def\buff_get_stored_indeed#1%
{\ctxcommand{getbuffer("#1")}}
+\unexpanded\def\getdefinedbuffer[#1]%
+ {\buff_get_stored{#1}{\thedefinedbuffer{#1}}}%
+
\unexpanded\def\inlinebuffer
{\dosingleempty\buff_get_inline}
diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv
index 7ebadea41..8d5fc3220 100644
--- a/tex/context/base/buff-ver.mkiv
+++ b/tex/context/base/buff-ver.mkiv
@@ -689,6 +689,9 @@
\unexpanded\def\buff_verbatim_type_defined_buffer
{\dotripleempty\buff_verbatim_type_defined_buffer_indeed}
+\unexpanded\def\typedefinedbuffer[#1]%
+ {\buff_verbatim_type_defined_buffer[\v!buffer][\thedefinedbuffer{#1}]}%
+
\appendtoks
\setuevalue{\e!type\currentbuffer}{\buff_verbatim_type_defined_buffer[\v!buffer][\currentdefinedbuffer]}%
\to \everydefinebuffer
diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua
index 827c6a5ff..1261bd45a 100644
--- a/tex/context/base/char-def.lua
+++ b/tex/context/base/char-def.lua
@@ -64250,8 +64250,10 @@ characters.data={
description="DIAMETER SIGN",
direction="on",
linebreak="al",
- mathclass="ordinary",
- mathname="varnothing",
+ mathspec={
+ { class="ord", name="varnothing" },
+ { class="ord", name="diameter" },
+ },
unicodeslot=0x2300,
},
[0x2301]={
diff --git a/tex/context/base/colo-ini.mkiv b/tex/context/base/colo-ini.mkiv
index 3fae31cbe..6aa51b218 100644
--- a/tex/context/base/colo-ini.mkiv
+++ b/tex/context/base/colo-ini.mkiv
@@ -121,6 +121,9 @@
% \testfeatureonce{100000}{\color[red]{}} % 1.046 => 0.541
+\let\g_color\empty
+\let\g_style\empty
+
\unexpanded\def\switchtocolor[#1]{\csname#1\endcsname}
\unexpanded\def\color [#1]{\bgroup
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 5cfb7b5de..4541bcf0f 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.09.21 13:53}
+\newcontextversion{2013.09.30 19:49}
%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
index dcef079b9..15bffc01e 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 9209790b5..2dba3c5e8 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.09.21 13:53}
+\edef\contextversion{2013.09.30 19:49}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/core-con.mkiv b/tex/context/base/core-con.mkiv
index 7febdcf39..375d77072 100644
--- a/tex/context/base/core-con.mkiv
+++ b/tex/context/base/core-con.mkiv
@@ -15,6 +15,8 @@
\registerctxluafile{core-con}{1.001}
+% todo: iso date ranges (from/to)
+
\unprotect
\ifdefined\currentlanguage \else \let\currentlanguage\empty \fi
@@ -97,6 +99,9 @@
\def\koreannumeralsp #1{\ctxcommand{alphabetic(\number#1,"korean-parent")}}
\def\koreannumeralsc #1{\ctxcommand{alphabetic(\number#1,"korean-circle")}}
+\let\koreanparentnumerals\koreannumeralsp
+\let\koreancirclenumerals\koreannumeralsc
+
\def\chinesenumerals #1{\ctxcommand{chinesenumerals (\number#1)}}
\def\chinesecapnumerals#1{\ctxcommand{chinesecapnumerals(\number#1,"cap")}}
\def\chineseallnumerals#1{\ctxcommand{chineseallnumerals(\number#1,"all")}}
diff --git a/tex/context/base/core-uti.lua b/tex/context/base/core-uti.lua
index a11fba309..cbbdeff23 100644
--- a/tex/context/base/core-uti.lua
+++ b/tex/context/base/core-uti.lua
@@ -279,11 +279,11 @@ statistics.register("randomizer", function()
end
end)
--- local kg_per_watt_per_second = 1 / 15000000
--- local watts_per_core = 50
--- local speedup_by_other_engine = 1.2
--- local used_wood_factor = watts_per_core * kg_per_watt_per_second / speedup_by_other_engine
--- local used_wood_factor = (50 / 15000000) / 1.2
+local kg_per_watt_per_second = 1 / 15000000
+local watts_per_core = 50
+local speedup_by_other_engine = 1.2
+local used_wood_factor = watts_per_core * kg_per_watt_per_second / speedup_by_other_engine
+local used_wood_factor = (50 / 15000000) / 1.2
function statistics.formatruntime(runtime)
if not environment.initex then -- else error when testing as not counters yet
@@ -295,13 +295,14 @@ function statistics.formatruntime(runtime)
if shipped > 0 or pages > 0 then
local persecond = shipped / runtime
if pages == 0 then pages = shipped end
--- if jit then
--- local saved = watts_per_core * runtime * kg_per_watt_per_second / speedup_by_other_engine
--- local saved = used_wood_factor * runtime
+if jit then
+local saved = watts_per_core * runtime * kg_per_watt_per_second / speedup_by_other_engine
+local saved = used_wood_factor * runtime
-- return format("%s seconds, %i processed pages, %i shipped pages, %.3f pages/second, %f kg tree saved by using luajittex",runtime,pages,shipped,persecond,saved)
--- else
+ return format("%s seconds, %i processed pages, %i shipped pages, %.3f pages/second, %f g tree saved by using luajittex",runtime,pages,shipped,persecond,saved*1000)
+else
return format("%s seconds, %i processed pages, %i shipped pages, %.3f pages/second",runtime,pages,shipped,persecond)
--- end
+end
else
return format("%s seconds",runtime)
end
diff --git a/tex/context/base/font-emp.mkvi b/tex/context/base/font-emp.mkvi
index 1713eda70..34a1ea9cc 100644
--- a/tex/context/base/font-emp.mkvi
+++ b/tex/context/base/font-emp.mkvi
@@ -117,6 +117,8 @@
%D The next feature was not present in previous versions. It
%D takes care of \type {\em \bf ...} situations.
+\let\font_emphasis_saved_emphasis_boldface\relax
+
\def\font_emphasis_set_emphasis_boldface
{\let\font_emphasis_saved_emphasis_boldface\bf
\let\font_emphasis_set_emphasis_boldface\relax
diff --git a/tex/context/base/font-ini.mkvi b/tex/context/base/font-ini.mkvi
index a627310e0..521901e05 100644
--- a/tex/context/base/font-ini.mkvi
+++ b/tex/context/base/font-ini.mkvi
@@ -1679,7 +1679,7 @@
\unexpanded\def\font_helpers_set_font_set_font_option_body#method#body#message%
{\normalizebodyfontsize\normalizedsetfont{#body}% redundant for some calls
\ifcsname\??fontbodyknown\normalizedsetfont\endcsname \else
- \font_helpers_define_unknown_font{#body}%
+ \font_helpers_define_unknown_font\normalizedsetfont
\fi
\ifcsname\??fontbodyknown\normalizedsetfont\endcsname
\localbodyfontsize\normalizedsetfont
@@ -2136,6 +2136,37 @@
%D $\cases{& \ccaron}$ $x=\hbox{\ccaron $x=\hbox{\ccaron}$}$
%D \stoptyping
+%D \macros
+%D {usebodyfont}
+%D
+%D This looks nicer then a switch in the preamble
+%D
+%D \starttyping
+%D \usebodyfont[pagella,10pt]
+%D \usebodyfont[termes,10pt]
+%D \usebodyfont[dejavu,10pt]
+%D
+%D \setupbodyfont[dejavu]
+%D
+%D \starttext
+%D test
+%D \stoptext
+%D \stoptyping
+
+% \unexpanded\def\usebodyfont[#1]%
+% {\pushmacro\fontclass
+% \switchtobodyfont[#1]%
+% \popmacro\fontclass
+% \ifx\fontclass\empty\else\setupbodyfont\relax\fi}
+
+\unexpanded\def\usebodyfont[#1]%
+ {\pushmacro\fontclass
+ \font_helpers_set_font\zerocount{#1}%
+ \popmacro\fontclass
+ \ifx\fontclass\empty \else
+ \font_basics_setupbodyfont_nop
+ \fi}
+
%D Handy for manuals:
\unexpanded\def\fontchar#character%
diff --git a/tex/context/base/font-mat.mkvi b/tex/context/base/font-mat.mkvi
index 4fe44a2da..c8ee2630b 100644
--- a/tex/context/base/font-mat.mkvi
+++ b/tex/context/base/font-mat.mkvi
@@ -66,8 +66,8 @@
\definesystemattribute[mathfamily][public]
-\newconditional\c_font_bidirectional_math_strategy % can be default, not that much overhead: \settrue\c_font_bidirectional_math_strategy
-\newconditional\c_font_complete_bold_math_strategy \settrue\c_font_complete_bold_math_strategy
+\newconditional\c_font_bidirectional_mathstrategy % can be default, not that much overhead: \settrue\c_font_bidirectional_mathstrategy
+\newconditional\c_font_complete_bold_mathstrategy \settrue\c_font_complete_bold_mathstrategy
\def\mathtextsuffix {-text}
\def\mathscriptsuffix {-script}
@@ -224,9 +224,9 @@
\edef\m_font_class_direction{\ifcsname\??fontclass\fontclass\s!mm\s!direction\endcsname\csname\??fontclass\fontclass\s!mm\s!direction\endcsname\fi}%
% ...
\ifx\m_font_class_direction\v!both
- \settrue\c_font_bidirectional_math_strategy
+ \settrue\c_font_bidirectional_mathstrategy
\else
- \setfalse\c_font_bidirectional_math_strategy
+ \setfalse\c_font_bidirectional_mathstrategy
\fi
\to \t_font_math_strategies
@@ -257,32 +257,32 @@
\scriptscriptfont\c_font_fam_mr_lr\scriptscriptfont\c_font_fam_mr}
\appendtoks
- \ifconditional\c_font_bidirectional_math_strategy
+ \ifconditional\c_font_bidirectional_mathstrategy
\font_helpers_bidirectional_mathstrategy_yes
\else
\font_helpers_bidirectional_mathstrategy_nop
\fi
\to \t_font_math_strategies
-\def\font_helpers_complete_bold_math_strategy_yes_bidi
+\def\font_helpers_complete_bold_mathstrategy_yes_bidi
{\font_helpers_set_math_family_bold\c_font_fam_mb_lr\s!mblr\c_font_fam_mr_lr
\font_helpers_set_math_family_bold\c_font_fam_mb_rl\s!mbrl\c_font_fam_mr_rl
\ifnum\fontid\textfont\c_font_fam_mb=\fontid\textfont\c_font_fam_mb_lr\else
- \font_helpers_complete_bold_math_strategy_yes_bidi_changed
+ \font_helpers_complete_bold_mathstrategy_yes_bidi_changed
\fi}
-\def\font_helpers_complete_bold_math_strategy_yes_bidi_changed
+\def\font_helpers_complete_bold_mathstrategy_yes_bidi_changed
{\textfont \c_font_fam_mb\textfont \c_font_fam_mb_lr
\scriptfont \c_font_fam_mb\scriptfont \c_font_fam_mb_lr
\scriptscriptfont\c_font_fam_mb\scriptscriptfont\c_font_fam_mb_lr}
-\def\font_helpers_complete_bold_math_strategy_yes
+\def\font_helpers_complete_bold_mathstrategy_yes
{\font_helpers_set_math_family_bold\c_font_fam_mb\s!mb\c_font_fam_mr\relax
\ifnum\fontid\textfont\c_font_fam_mb_rl=\fontid\textfont\c_font_fam_mb\else
- \font_helpers_complete_bold_math_strategy_yes_changed
+ \font_helpers_complete_bold_mathstrategy_yes_changed
\fi}
-\def\font_helpers_complete_bold_math_strategy_yes_changed
+\def\font_helpers_complete_bold_mathstrategy_yes_changed
{\textfont \c_font_fam_mb_rl\textfont \c_font_fam_mb
\scriptfont \c_font_fam_mb_rl\scriptfont \c_font_fam_mb
\scriptscriptfont\c_font_fam_mb_rl\scriptscriptfont\c_font_fam_mb
@@ -290,12 +290,12 @@
\scriptfont \c_font_fam_mb_lr\scriptfont \c_font_fam_mb
\scriptscriptfont\c_font_fam_mb_lr\scriptscriptfont\c_font_fam_mb}
-\def\font_helpers_complete_bold_math_strategy_nop
+\def\font_helpers_complete_bold_mathstrategy_nop
{\ifnum\fontid\textfont\c_font_fam_mb=\fontid\textfont\c_font_fam_mr\else
- \font_helpers_complete_bold_math_strategy_nop_changed
+ \font_helpers_complete_bold_mathstrategy_nop_changed
\fi}
-\def\font_helpers_complete_bold_math_strategy_nop_changed
+\def\font_helpers_complete_bold_mathstrategy_nop_changed
{\textfont \c_font_fam_mb \textfont \c_font_fam_mr
\scriptfont \c_font_fam_mb \scriptfont \c_font_fam_mr
\scriptscriptfont\c_font_fam_mb \scriptscriptfont\c_font_fam_mr
@@ -306,19 +306,19 @@
\scriptfont \c_font_fam_mb_lr\scriptfont \c_font_fam_mr_lr
\scriptscriptfont\c_font_fam_mb_lr\scriptscriptfont\c_font_fam_mr_lr}
-\def\font_helpers_apply_complete_bold_math_strategy
- {\ifconditional\c_font_complete_bold_math_strategy
- \ifconditional\c_font_bidirectional_math_strategy
- \font_helpers_complete_bold_math_strategy_yes_bidi
+\def\font_helpers_apply_complete_bold_mathstrategy
+ {\ifconditional\c_font_complete_bold_mathstrategy
+ \ifconditional\c_font_bidirectional_mathstrategy
+ \font_helpers_complete_bold_mathstrategy_yes_bidi
\else
- \font_helpers_complete_bold_math_strategy_yes
+ \font_helpers_complete_bold_mathstrategy_yes
\fi
\else
- \font_helpers_complete_bold_math_strategynop
+ \font_helpers_complete_bold_mathstrategy_nop
\fi}
\appendtoks
- \font_helpers_apply_complete_bold_math_strategy
+ \font_helpers_apply_complete_bold_mathstrategy
\to \t_font_math_strategies
\ifdefined\defaultmathfamily \else
@@ -330,7 +330,7 @@
\to \everymathematics
\unexpanded\def\font_helpers_synchronize_math_family_mr
- {\attribute\mathfamilyattribute\ifconditional\c_font_bidirectional_math_strategy
+ {\attribute\mathfamilyattribute\ifconditional\c_font_bidirectional_mathstrategy
\ifconditional\c_math_right_to_left
\plustwo
\else
@@ -341,7 +341,7 @@
\fi}
\unexpanded\def\font_helpers_synchronize_math_family_mb
- {\attribute\mathfamilyattribute\ifconditional\c_font_bidirectional_math_strategy
+ {\attribute\mathfamilyattribute\ifconditional\c_font_bidirectional_mathstrategy
\ifconditional\c_math_right_to_left
\ifconditional\c_font_pseudo_bold_math_state\pluseight\else\plusfive\fi
\else
diff --git a/tex/context/base/font-sel.lua b/tex/context/base/font-sel.lua
new file mode 100644
index 000000000..7d535caa8
--- /dev/null
+++ b/tex/context/base/font-sel.lua
@@ -0,0 +1,629 @@
+if not modules then modules = { } end modules ['font-sel'] = {
+ version = 1.000,
+ comment = "companion to font-sel.mkvi",
+ author = "Wolfgang Schuster",
+ copyright = "Wolfgang Schuster",
+ license = "GNU General Public License"
+}
+
+local context = context
+local cleanname = fonts.names.cleanname
+local gsub, splitup, find = string.gsub, string.splitup, string.find
+local formatters = string.formatters
+
+local v_yes = interfaces.variables.yes
+local v_simplefonts = interfaces.variables.simplefonts
+local v_selectfont = interfaces.variables.selectfont
+local v_default = interfaces.variables.default
+
+local selectfont = fonts.select or { }
+fonts.select = selectfont
+
+local data = selectfont.data or { }
+selectfont.data = data
+
+local fallbacks = selectfont.fallbacks or { }
+selectfont.fallbacks = fallbacks
+
+local methods = selectfont.methods or { }
+selectfont.methods = methods
+
+local getlookups = fonts.names.getlookups
+local registerdesignsizes = fonts.goodies.designsizes.register
+
+local alternatives = {
+ ["tf"] = "regular",
+ ["it"] = "italic",
+ ["sl"] = "slanted",
+ ["bf"] = "bold",
+ ["bi"] = "bolditalic",
+ ["bs"] = "boldslanted",
+ ["sc"] = "smallcaps",
+}
+
+local styles = {
+ ["rm"] = "serif",
+ ["ss"] = "sans",
+ ["tt"] = "mono",
+ ["hw"] = "handwriting",
+ ["cg"] = "calligraphy",
+ ["mm"] = "math",
+}
+
+local sizes = {
+ ["default"] = {
+ { 40, "4pt" },
+ { 50, "5pt" },
+ { 60, "6pt" },
+ { 70, "7pt" },
+ { 80, "8pt" },
+ { 90, "9pt" },
+ { 100, "10pt" },
+ { 110, "11pt" },
+ { 120, "12pt" },
+ { 144, "14.4pt" },
+ { 173, "17.3pt" },
+ },
+ ["dtp"] = {
+ { 50, "5pt" },
+ { 60, "6pt" },
+ { 70, "7pt" },
+ { 80, "8pt" },
+ { 90, "9pt" },
+ { 100, "10pt" },
+ { 110, "11pt" },
+ { 120, "12pt" },
+ { 130, "13pt" },
+ { 140, "14pt" },
+ { 160, "16pt" },
+ { 180, "18pt" },
+ { 220, "22pt" },
+ { 280, "28pt" },
+ }
+}
+
+local synonyms = {
+ ["rm"] = {
+ ["tf"] = "Serif",
+ ["it"] = "SerifItalic",
+ ["sl"] = "SerifSlanted",
+ ["bf"] = "SerifBold",
+ ["bi"] = "SerifBoldItalic",
+ ["bs"] = "SerifBoldSlanted",
+ ["sc"] = "SerifCaps",
+ },
+ ["ss"] = {
+ ["tf"] = "Sans",
+ ["it"] = "SansItalic",
+ ["sl"] = "SansSlanted",
+ ["bf"] = "SansBold",
+ ["bi"] = "SansBoldItalic",
+ ["bs"] = "SansBoldSlanted",
+ ["sc"] = "SansCaps",
+ },
+ ["tt"] = {
+ ["tf"] = "Mono",
+ ["it"] = "MonoItalic",
+ ["sl"] = "MonoSlanted",
+ ["bf"] = "MonoBold",
+ ["bi"] = "MonoBoldItalic",
+ ["bs"] = "MonoBoldSlanted",
+ ["sc"] = "MonoCaps",
+ },
+ ["hw"] = {
+ ["tf"] = "Handwriting",
+ },
+ ["cg"] = {
+ ["tf"] = "Calligraphy",
+ },
+ ["mm"] = {
+ ["tf"] = "MathRoman",
+ ["bf"] = "MathBold",
+ }
+}
+
+local replacement = {
+ ["style"] = {
+ ["it"] = "tf",
+ ["sl"] = "it",
+ ["bf"] = "tf",
+ ["bi"] = "bf",
+ ["bs"] = "bi",
+ ["sc"] = "tf",
+ },
+ ["weight"] = {
+ ["it"] = "tf",
+ ["sl"] = "tf",
+ ["bf"] = "tf",
+ ["bi"] = "bf",
+ ["bs"] = "bf",
+ ["sc"] = "tf",
+ },
+}
+
+local names = {
+ ["selectfont"] = { -- weight, style, width, variant, italic
+ ["regular"] = { weight = "normal", style = "normal", width = "normal", variant = "normal", italic = false },
+ ["italic"] = { weight = "normal", style = "italic", width = "normal", variant = "normal", italic = true },
+ ["slanted"] = { weight = "normal", style = "slanted", width = "normal", variant = "normal", italic = true },
+ ["medium"] = { weight = "medium", style = "normal", width = "normal", variant = "normal", italic = false },
+ ["mediumitalic"] = { weight = "medium", style = "italic", width = "normal", variant = "normal", italic = true },
+ ["mediumcaps"] = { weight = "medium", style = "normal", width = "normal", variant = "smallcaps", italic = true },
+ ["bold"] = { weight = "bold", style = "normal", width = "normal", variant = "normal", italic = false },
+ ["bolditalic"] = { weight = "bold", style = "italic", width = "normal", variant = "normal", italic = true },
+ ["boldslanted"] = { weight = "bold", style = "slanted", width = "normal", variant = "normal", italic = true },
+ ["smallcaps"] = { weight = "normal", style = "normal", width = "normal", variant = "smallcaps", italic = false },
+ },
+ ["simplefonts"] = {
+ ["light"] = { "lightregular", "light" },
+ ["lightitalic"] = { "lightitalic", "lightit", "lightoblique" },
+ ["lightcaps"] = { "smallcapslight" },
+ ["regular"] = { "roman", "regular", "book", "" },
+ ["italic"] = { "italic", "it", "oblique", "kursiv", "bookitalic", "bookit" },
+ ["medium"] = { "mediumregular", "medregular", "medium" },
+ ["mediumitalic"] = { "mediumitalic", "meditalic" },
+ ["mediumcaps"] = { "mediumcaps" },
+ ["bold"] = { "bold", "bd", "kraeftig", "mediumregular", "semibold", "demi" },
+ ["bolditalic"] = { "bolditalic", "boldit", "bdit", "boldoblique", "mediumitalic", "semibolditalic", "demiitalic" },
+ ["smallcaps"] = { "smallcaps", "capitals", "sc" },
+ ["heavy"] = { "heavyregular", "heavy" },
+ ["heavyitalic"] = { "heavyitalic" },
+ },
+ ["default"] = { -- weight, width, italic
+ ["thin"] = { weight = { 100, 200, 300, 400, 500 }, width = 5, italic = false },
+ ["extralight"] = { weight = { 200, 100, 300, 400, 500 }, width = 5, italic = false },
+ ["light"] = { weight = { 300, 200, 100, 400, 500 }, width = 5, italic = false },
+ ["regular"] = { weight = { 400, 500, 300, 200, 100 }, width = 5, italic = false },
+ ["italic"] = { weight = { 400, 500, 300, 200, 100 }, width = 5, italic = true },
+ ["medium"] = { weight = { 500, 400, 300, 200, 100 }, width = 5, italic = false },
+ ["demibold"] = { weight = { 600, 700, 800, 900 }, width = 5, italic = false },
+ ["bold"] = { weight = { 700, 600, 800, 900 }, width = 5, italic = false },
+ ["bolditalic"] = { weight = { 700, 600, 800, 900 }, width = 5, italic = true },
+ ["smallcaps"] = { weight = { 400, 500, 300, 200, 100 }, width = 5, italic = false },
+ ["heavy"] = { weight = { 800, 900, 700, 600 }, width = 5, italic = false },
+ ["black"] = { weight = { 900, 800, 700, 600 }, width = 5, italic = false },
+ }
+}
+
+names.simplefonts.slanted = names.simplefonts.italic
+names.simplefonts.boldslanted = names.simplefonts.bolditalic
+
+names.default.normal = names.default.regular
+names.default.slanted = names.default.italic
+names.default.semibold = names.default.demibold
+names.default.boldslanted = names.default.bolditalic
+
+local mathsettings = {
+ ["asanamath"] = {
+ extras = "asana-math",
+ goodies = {
+ ["tf"] = "anana-math",
+ },
+ features = {
+ ["tf"] = "math\\mathsizesuffix",
+ },
+ },
+ ["cambriamath"] = {
+ extras = "cambria-math",
+ goodies = {
+ ["tf"] = "cambria-math",
+ },
+ features = {
+ ["tf"] = "math\\mathsizesuffix",
+ },
+ },
+ ["neoeuler"] = {
+ extras = "euler-math",
+ features = {
+ ["tf"] = "math\\mathsizesuffix",
+ },
+ },
+ ["latinmodernmath"] = {
+ extras = "lm,lm-math",
+ goodies = {
+ ["tf"] = "lm",
+ },
+ features = {
+ ["tf"] = "math\\mathsizesuffix,lm-math",
+ },
+ },
+ ["lucidabrightmathot"] = {
+ extras = "lucida-opentype-math",
+ goodies = {
+ ["tf"] = "lucida-opentype-math",
+ },
+ features = {
+ ["tf"] = "math\\mathsizesuffix",
+ },
+ },
+ ["texgyrepagellamath"] = {
+ extras = "texgyre",
+ features = {
+ ["tf"] = "math\\mathsizesuffix",
+ },
+ },
+ ["texgyrebonummath"] = {
+ extras = "texgyre",
+ features = {
+ ["tf"] = "math\\mathsizesuffix",
+ },
+ },
+ ["texgyretermesmath"] = {
+ extras = "texgyre",
+ features = {
+ ["tf"] = "math\\mathsizesuffix",
+ },
+ },
+ ["xitsmath"] = {
+ extras = "xits-math",
+ goodies = {
+ ["tf"] = "xits-math",
+ },
+ features = {
+ ["tf"] = "math\\mathsizesuffix",
+ },
+ },
+}
+
+function commands.defineselectfont(settings)
+ local index = #data + 1
+ data[index] = settings
+ selectfont.searchfiles(index)
+ context(index)
+end
+
+local function savefont(data,alternative,entries)
+ local f = data.fonts
+ if not f then
+ f = { }
+ data.fonts = f
+ end
+ f[alternative] = entries
+end
+
+methods[v_simplefonts] = function(data,alternative,style)
+ local family = data.metadata.family
+ local names = names["simplefonts"][style] or names["simplefonts"]["regular"]
+ for _, name in next, names do
+ local filename = cleanname(formatters["%s%s"](family,name))
+ local fullname = getlookups{ fullname = filename }
+ local fontname = getlookups{ fontname = filename }
+ local cleanfilename = getlookups{ cleanfilename = filename }
+ if #fullname > 0 then
+ savefont(data,alternative,fullname)
+ break
+ elseif #fontname > 0 then
+ savefont(data,alternative,fontname)
+ break
+ elseif #cleanfilename > 0 then
+ savefont(data,alternative,cleanfilename)
+ break
+ end
+ end
+end
+
+methods[v_default] = function(data,alternative,style)
+ local family = data.metadata.family
+ local spec = names["default"][style] or names["default"]["regular"]
+ local weights = spec["weight"]
+ for _, weight in next, weights do
+ local pattern = getlookups{
+ familyname = cleanname(family),
+ pfmweight = weight,
+ pfmwidth = spec["width"],
+ }
+ if #pattern > 0 then
+ local fontfiles = { }
+ for _, fontfile in next, pattern do
+ if (fontfile["angle"] and spec["italic"] == true) or (not fontfile["angle"] and spec["italic"] == false) then
+ fontfiles[#fontfiles + 1] = fontfile
+ end
+ end
+ savefont(data,alternative,fontfiles)
+ break
+ end
+ end
+end
+
+methods[v_selectfont] = function(data,alternative,style)
+ local family = data.metadata.family
+ local spec = names["selectfont"][style] or names["selectfont"]["regular"]
+ local pattern = getlookups{
+ familyname = cleanname(family),
+ weight = spec["weight"],
+ style = spec["style"],
+ width = spec["width"],
+ variant = spec["variant"]
+ }
+ if #pattern > 0 then
+ local fontfiles = { }
+ for _, fontfile in next, pattern do
+ if (fontfile["angle"] and spec["italic"] == true) or (not fontfile["angle"] and spec["italic"] == false) then
+ fontfiles[#fontfiles + 1] = fontfile
+ end
+ end
+ savefont(data,alternative,fontfiles)
+ end
+end
+
+methods["name"] = function(data,alternative,filename)
+ local data = data
+ local family = data.metadata.family
+ local filename = cleanname(gsub(filename,"*",family))
+ local fullname = getlookups{ fullname = filename }
+ local fontname = getlookups{ fontname = filename }
+ if #fullname > 0 then
+ savefont(data,alternative,fullname)
+ elseif #fontname > 0 then
+ savefont(data,alternative,fontname)
+ end
+end
+
+methods["file"] = function(data,alternative,filename)
+ local data = data
+ local family = data.metadata.family
+ local filename = gsub(file.removesuffix(filename),"*",family)
+ local filename = getlookups{ cleanfilename = cleanname(filename) }
+ if #filename > 0 then
+ savefont(data,alternative,filename)
+ end
+end
+
+methods["spec"] = function(data,alternative,filename)
+ local family = data.metadata.family
+ local weight, style, width, variant = splitup(filename,"-")
+ local pattern = getlookups{
+ familyname = cleanname(family),
+ weight = weight or "normal",
+ style = style or "normal",
+ width = width or "normal",
+ variant = variant or "normal",
+ }
+ if #pattern > 0 then
+ savefont(data,alternative,pattern)
+ end
+end
+
+methods["style"] = function(data,alternative,style)
+ local method = data.options.alternative or nil
+ (methods[method] or methods[v_default])(data,alternative,style)
+end
+
+function selectfont.searchfiles(index)
+ local data = data[index]
+ for alternative, _ in next, alternatives do
+ local filename = data.files[alternative]
+ local method = data.options.alternative
+ local family = data.metadata.family
+ local style = alternatives[alternative]
+ if filename == "" then
+ local pattern = getlookups{ familyname = cleanname(family) }
+ if #pattern == 1 then -- needs to be improved
+ savefont(data,"tf",pattern)
+ break
+ else
+ (methods[method] or methods[v_default])(data,alternative,style)
+ end
+ else
+ method, filename = splitup(filename,":")
+ if not filename then
+ filename = method
+ method = "name"
+ end
+ (methods[method] or methods["name"])(data,alternative,filename)
+ end
+ end
+end
+
+local function definefontsynonym(data,alternative,index,fallback)
+ local fontdata = data.fonts and data.fonts[alternative]
+ local style = data.metadata.style
+ local typeface = data.metadata.typeface
+ local mathsettings = mathsettings[cleanname(data.metadata.family)]
+ local features = mathsettings and mathsettings["features"] and (mathsettings["features"][alternative] or mathsettings["features"]["tf"]) or data.features[alternative]
+ local goodies = mathsettings and mathsettings["goodies"] and (mathsettings["goodies"] [alternative] or mathsettings["goodies"] ["tf"]) or ""
+ local parent = replacement["style"][alternative] or ""
+ local fontname, fontfile, fontparent
+ if fallback then
+ fontname = formatters["%s-%s-%s-fallback-%s"](typeface, style, alternative, index)
+ fontfile = formatters["%s-%s-%s-%s"] (typeface, style, alternative, index)
+ fontparent = formatters["%s-%s-%s-%s"] (typeface, style, parent, index)
+ else
+ fontname = synonyms[style][alternative]
+ fontfile = formatters["%s-%s-%s"](typeface, style, alternative)
+ fontparent = formatters["%s-%s-%s"](typeface, style, parent)
+ end
+ if fontdata then
+ for _, size in next, sizes["default"] do
+ for _, entry in next, fontdata do
+ if entry["minsize"] and entry["maxsize"] then
+ if size[1] > entry["minsize"] and size[1] <= entry["maxsize"] then
+ registerdesignsizes( fontfile, size[2], entry["filename"] )
+ end
+ end
+ end
+ end
+ for _, entry in next, fontdata do
+ local filename = entry["filename"]
+ local designsize = entry["designsize"] or 100
+ if designsize == 100 or designsize == 120 or designsize == 0 then
+ registerdesignsizes( fontfile, "default", filename )
+ break
+ end
+ end
+ if fallback then
+ context.definefontsynonym( { fontname }, { fontfile }, { features = features } )
+ else
+ context.definefontsynonym( { fontname }, { fontfile }, { features = features, fallbacks = fontfile, goodies = goodies } )
+ end
+ else
+ if fallback then
+ context.definefontsynonym( { fontname }, { fontparent }, { features = features } )
+ else
+ context.definefontsynonym( { fontname }, { fontparent }, { features = features, fallbacks = fontfile, goodies = goodies } )
+ end
+ end
+end
+
+local function definetypescript(index)
+ local data = data[index]
+ local entry = data.fonts
+ local mathsettings = mathsettings[cleanname(data.metadata.family)]
+ local goodies = mathsettings and mathsettings.extras or data.options.goodies
+ local typeface = data.metadata.typeface
+ local style = data.metadata.style
+ if entry and entry["tf"] then
+ context.startfontclass( { typeface } )
+ if goodies ~= "" then
+ goodies = utilities.parsers.settings_to_array(goodies)
+ for _, goodie in next, goodies do
+ context.loadfontgoodies( { goodie } )
+ end
+ end
+ for alternative, _ in next, alternatives do
+ if synonyms[style][alternative] then -- prevent unnecessary synonyms for handwriting, calligraphy and math
+ definefontsynonym(data,alternative)
+ end
+ end
+ context.stopfontclass()
+ else
+ -- regular style not available, loading aborted
+ end
+end
+
+function selectfont.registerfallback(typeface,style,index)
+ local t = fallbacks[typeface]
+ if not t then
+ fallbacks[typeface] = { [style] = { index } }
+ else
+ local s = t[style]
+ if not s then
+ fallbacks[typeface][style] = { index }
+ else
+ fallbacks[typeface][style][#s+1] = index
+ end
+ end
+end
+
+local function definetextfontfallback(data,alternative,index)
+ local typeface = data.metadata.typeface
+ local style = data.metadata.style
+ local features = data.features[alternative]
+ local range = data.options.range
+ local rscale = data.options.scale ~= "" and data.options.scale or 1
+ local check = data.options.check ~= "" and data.options.check or "yes"
+ local force = data.options.force ~= "" and data.options.force or "yes"
+ local synonym = formatters["%s-%s-%s-fallback-%s"](typeface, style, alternative, index)
+ local fallback = formatters["%s-%s-%s"] (typeface, style, alternative)
+ if index == 1 then
+ context.resetfontfallback( { fallback } )
+ end
+ context.definefontfallback( { fallback }, { synonym }, { range }, { rscale = rscale, check = check, force = force } )
+end
+
+local function definetextfallback(entry,index)
+ local data = data[index]
+ local typeface = data.metadata.typeface
+ context.startfontclass( { typeface } )
+ for alternative, _ in next, alternatives do
+ definefontsynonym (data,alternative,entry,true)
+ definetextfontfallback(data,alternative,entry)
+ end
+ context.stopfontclass()
+end
+
+local function definemathfontfallback(data,alternative,index)
+ local typeface = data.metadata.typeface
+ local style = data.metadata.style
+ local range = data.options.range
+ local rscale = data.options.scale ~= "" and data.options.scale or 1
+ local check = data.options.check ~= "" and data.options.check or "yes"
+ local force = data.options.force ~= "" and data.options.force or "yes"
+ local offset = data.options.offset
+ local features = data.features[alternative]
+ local fontdata = data.fonts and data.fonts[alternative]
+ local fallback = formatters["%s-%s-%s"](typeface, style, alternative)
+ if index == 1 then
+ context.resetfontfallback( { fallback } )
+ end
+ for _, entry in next, fontdata do
+ local filename = entry["filename"]
+ local designsize = entry["designsize"] or 100
+ if designsize == 100 or designsize == 120 or designsize == 0 then
+ context.definefontfallback( { fallback }, { formatters["%s*%s"](filename,features) }, { range }, { rscale = rscale, check = check, force = force, offset = offset } )
+ break
+ end
+ end
+end
+
+local function definemathfallback(entry,index)
+ local data = data[index]
+ local typeface = data.metadata.typeface
+ local style = data.metadata.style
+ context.startfontclass( { typeface } )
+ for alternative, _ in next, alternatives do
+ if synonyms[style][alternative] then
+ definemathfontfallback(data,alternative,entry)
+ end
+ end
+ context.stopfontclass()
+end
+
+local function definefallbackfont(index)
+ local data = data[index]
+ local f = fallbacks[data.metadata.typeface]
+ if f then
+ local s = f[data.metadata.style]
+ if s then
+ for entry, fallback in next, s do
+ if data.metadata.style == "mm" then
+ definemathfallback(entry,fallback)
+ else
+ definetextfallback(entry,fallback)
+ end
+ end
+ end
+ end
+end
+
+local function definetextfont(index)
+ local data = data[index]
+ local fontclass = data.metadata.typeface
+ local shortstyle = data.metadata.style
+ local style = styles[data.metadata.style]
+ local designsize = data.options.opticals == v_yes and "auto" or "default"
+ local scale = data.options.scale ~= "" and data.options.scale or 1
+ context.definetypeface( { fontclass }, { shortstyle }, { style }, { "" }, { "default" }, { designsize = designsize, rscale = scale } )
+end
+
+local function definemathfont(index)
+ local data = data[index]
+ local fontclass = data.metadata.typeface
+ local shortstyle = data.metadata.style
+ local style = styles[data.metadata.style]
+ local scale = data.options.scale ~= "" and data.options.scale or 1
+ local typescript = cleanname(data.metadata.family)
+ local entries = data.fonts
+ if entries then
+ context.definetypeface( { fontclass }, { shortstyle }, { style }, { "" }, { "default" }, { rscale = scale } )
+ else
+ context.definetypeface( { fontclass }, { shortstyle }, { style }, { typescript }, { "default" }, { rscale = scale } )
+ end
+end
+
+function selectfont.definetypeface(index)
+ local data = data[index]
+ if data.metadata.style == "mm" then
+ definefallbackfont(index)
+ definetypescript (index)
+ definemathfont (index)
+ else
+ definefallbackfont(index)
+ definetypescript (index)
+ definetextfont (index)
+ end
+ -- inspect(data)
+end
+
+commands.definefontfamily = selectfont.definetypeface
+commands.definefallbackfamily = selectfont.registerfallback
diff --git a/tex/context/base/font-sel.mkvi b/tex/context/base/font-sel.mkvi
new file mode 100644
index 000000000..f91baa5d8
--- /dev/null
+++ b/tex/context/base/font-sel.mkvi
@@ -0,0 +1,320 @@
+%D \module
+%D [ file=font-sel,
+%D version=2013.09.28,
+%D title=\CONTEXT\ User Module,
+%D subtitle=Selectfont,
+%D author=Wolfgang Schuster,
+%D date=\currentdate,
+%D copyright=Wolfgang Schuster,
+%D license=GNU General Public License]
+
+\writestatus{loading}{ConTeXt User Module / Selectfont}
+
+\registerctxluafile{font-sel}{1.000}
+
+\unprotect
+
+\installcorenamespace {selectfont}
+\installsimplecommandhandler \??selectfont {selectfont}
+
+\unexpanded\def\selectfont_setparameters[#settings]%
+ {\begingroup
+ \setupcurrentselectfont[#settings]%
+ \edef\p_selectfont_preset{\selectfontparameter\c!preset}%
+ \ifx\p_selectfont_preset\empty \else
+ \processcommacommand[\p_selectfont_preset]\selectfont_preset_process
+ \setupcurrentselectfont[#settings]%
+ \fi
+ \setexpandedselectfontparameter\c!style {\expandnamespaceparameter\??selectfontstyle \selectfontparameter\c!style \s!rm }%
+ \setexpandedselectfontparameter\c!alternative{\expandnamespaceparameter\??selectfontalternative\selectfontparameter\c!alternative\v!default}%
+ \xdef\selectfont_index{\ctxcommand{
+ defineselectfont {
+ metadata = {
+ typeface = "\selectfontparameter\c!name",
+ style = "\selectfontparameter\c!style",
+ family = "\selectfontparameter\c!family",
+ },
+ options = {
+ opticals = "\selectfontparameter\c!opticalsize",
+ scale = "\selectfontparameter\c!scale",
+ goodies = "\selectfontparameter\c!goodies",
+ alternative = "\selectfontparameter\c!alternative",
+ range = "\selectfontparameter\c!range", % fallback only
+ offset = "\selectfontparameter\c!offset", % fallback only
+ check = "\selectfontparameter\c!check", % fallback only
+ force = "\selectfontparameter\c!force", % fallback only
+ },
+ files = {
+ ["tf"] = "\selectfontparameter\c!regularfont",
+ ["bf"] = "\selectfontparameter\c!boldfont",
+ ["it"] = "\selectfontparameter\c!italicfont",
+ ["sl"] = "\selectfontparameter\c!slantedfont",
+ ["bi"] = "\selectfontparameter\c!bolditalicfont",
+ ["bs"] = "\selectfontparameter\c!boldslantedfont",
+ ["sc"] = "\selectfontparameter\c!smallcapsfont",
+ },
+ features = {
+ ["tf"] = "\selectfontparameter\c!regularfeatures",
+ ["bf"] = "\selectfontparameter\c!boldfeatures",
+ ["it"] = "\selectfontparameter\c!italicfeatures",
+ ["sl"] = "\selectfontparameter\c!slantedfeatures",
+ ["bi"] = "\selectfontparameter\c!bolditalicfeatures",
+ ["bs"] = "\selectfontparameter\c!boldslantedfeatures",
+ ["sc"] = "\selectfontparameter\c!smallcapsfeatures",
+ }
+ }}}%
+ \endgroup}
+
+%D \macros
+%D {defineselectfontstyle}
+
+\installcorenamespace {selectfontstyle}
+
+\unexpanded\def\defineselectfontstyle
+ {\dodoubleargument\selectfont_style_define}
+
+\def\selectfont_style_define[#styles][#shortstyle]%
+ {\processcommalist[#styles]{\selectfont_style_define_indeed{#shortstyle}}}
+
+\def\selectfont_style_define_indeed#shortstyle#style%
+ {\setvalue{\??selectfontstyle#style}{#shortstyle}}
+
+\defineselectfontstyle [\s!rm,\s!serif] [\s!rm]
+\defineselectfontstyle [\s!ss,\s!sans] [\s!ss]
+\defineselectfontstyle [\s!tt,\s!mono] [\s!tt]
+\defineselectfontstyle [\s!hw,\s!handwriting] [\s!hw]
+\defineselectfontstyle [\s!cg,\s!calligraphy] [\s!cg]
+\defineselectfontstyle [\s!mm,\s!math] [\s!mm]
+
+%D \macros
+%D {definefontfamilypreset}
+
+\installcorenamespace {selectfontpreset}
+
+\unexpanded\def\defineselectfontpreset
+ {\dodoubleargument\selectfont_preset_define}
+
+\def\selectfont_preset_define[#name][#settings]%
+ {\doifassignmentelse{#settings}
+ {\setvalue{\??selectfontpreset#name}{\setupcurrentselectfont[#settings]}}
+ {\setvalue{\??selectfontpreset#name}{\csname\??selectfontpreset#settings\endcsname}}}
+
+\def\selectfont_preset_process#name%
+ {\ifcsname\??selectfontpreset#name\endcsname
+ \csname\??selectfontpreset#name\endcsname
+ \else
+ % unknown preset
+ \fi}
+
+\let\definefontfamilypreset\defineselectfontpreset
+
+\definefontfamilypreset [\s!chinese ] [\c!range={0x00400-0x2FA1F}]
+\definefontfamilypreset [\s!japanese] [\c!range={0x00400-0x2FA1F}]
+\definefontfamilypreset [\s!korean ] [\c!range={0x00400-0x2FA1F}]
+
+%D \macros
+%D {defineselectfontalternative}
+%D
+%D The results between the old {\em simplefonts} and the new {\em selectfont}
+%D can be different because simplefonts the name entries in the database to find
+%D the styles for a font while selectfont the newer spec-method to the find the
+%D files for each style.
+%D
+%D The used method depends on the command one uses to load a font but it is
+%D also possible to switch between them with the {\em alternative} key, possible
+%D values are:
+%D
+%D \startitemize[packed]
+%D \startitem selectfont and \stopitem
+%D \startitem simplefonts. \stopitem
+%D \stopitemize
+
+\installcorenamespace {selectfontalternative}
+
+\unexpanded\def\defineselectfontalternative
+ {\dodoubleargument\selectfont_alternative_define}
+
+\def\selectfont_alternative_define[#name][#alternative]%
+ {\setvalue{\??selectfontalternative#name}{#alternative}}
+
+\defineselectfontalternative [\v!selectfont ] [\v!selectfont ]
+\defineselectfontalternative [\v!simplefonts] [\v!simplefonts]
+\defineselectfontalternative [\v!default ] [\v!default ]
+
+%D \macros
+%D {definefontfamily,definefallbackfamily}
+%D
+%D The \tex{definefontfamily} creates like \tex{definetypeface} a collection of font
+%D with different styles which can be later called with the \tex{setupbodyfont} command.
+%D
+%D The command takes three mendatory commands which are (a) the name of the fontclass,
+%D (b) the styles of the font and (c) the name of the font.
+%D
+%D \starttyping
+%D \definefontfamily [dejavu] [serif] [DejaVu Serif]
+%D \definefontfamily [dejavu] [sans] [DejaVu Sans]
+%D \definefontfamily [dejavu] [mono] [DejaVu Sans Mono]
+%D \definefontfamily [dejavu] [math] [XITS Math] [scale=1.1]
+%D
+%D \definefontfamily [office] [serif] [Times New Roman]
+%D \definefontfamily [office] [sans] [Arial] [scale=0.9]
+%D \definefontfamily [office] [mono] [Courier]
+%D \definefontfamily [office] [math] [TeX Gyre Termes Math]
+%D
+%D \definefontfamily [linux] [serif] [Linux Libertine O]
+%D \definefontfamily [linux] [sans] [Linux Biolinum O]
+%D \definefontfamily [linux] [mono] [Latin Modern Mono]
+%D \definefontfamily [linux] [math] [TeX Gyre Pagella Math] [scale=0.9]
+%D
+%D \setupbodyfont[dejavu]
+%D
+%D \starttext
+%D
+%D \rm Serif \ss Sans \tt Mono \m{1+2=3}
+%D
+%D \switchtobodyfont[office]
+%D
+%D \rm Serif 123 \ss Sans \tt Mono \m{1+2=3}
+%D
+%D \switchtobodyfont[linux]
+%D
+%D \rm Serif 123 \ss Sans \tt Mono \m{1+2=3}
+%D
+%D \stoptext
+%D \stoptyping
+%D
+%D When a document contains different languages and the global font lacks some characters
+%D for one language, one could set a different font where these charcters are taken from.
+%D This fallback font (there can be more than one for a certain style) could be set with
+%D the \tex{definefallbackfamily} command which takes the same argument as
+%D the \tex{definefontfamily} command.
+%D
+%D \starttyping
+%D \definefallbackfamily [mainface] [serif] [DejaVu Serif] [range=cyrillic,force=yes]
+%D \definefontfamily [mainface] [serif] [TeX Gyre Pagella]
+%D
+%D \setupbodyfont[mainface]
+%D
+%D \setuplanguage[en][patterns={us,ru}]
+%D
+%D \starttext
+%D
+%D \input knuth
+%D
+%D Традиционная систематика лишайников оказывается во многом условна и
+%D
+%D \stoptext
+%D \stoptyping
+%D
+%D Another feature of the module is the \type{opticalsize} key which allows one to enable
+%D optical sizes when they are a feature of the requested font.
+%D
+%D \starttyping
+%D \definefontfamily[mainface][serif][Latin Modern Roman][opticalsize=yes]
+%D
+%D \setupbodyfont[mainface]
+%D
+%D \starttext
+%D \scale[width=\textwidth]{\switchtobodyfont [6pt]\tf Regular, \it Italic \bf Bold and \bi BoldItalic}
+%D \scale[width=\textwidth]{\switchtobodyfont [8pt]\tf Regular, \it Italic \bf Bold and \bi BoldItalic}
+%D \scale[width=\textwidth]{\switchtobodyfont [10pt]\tf Regular, \it Italic \bf Bold and \bi BoldItalic}
+%D \scale[width=\textwidth]{\switchtobodyfont [12pt]\tf Regular, \it Italic \bf Bold and \bi BoldItalic}
+%D \scale[width=\textwidth]{\switchtobodyfont[17.3pt]\tf Regular, \it Italic \bf Bold and \bi BoldItalic}
+%D \stoptext
+%D \stoptyping
+
+% regularfont = … | * … | name:… | name:* … | file:… | file:* … | spec:…-…-… | style:medium
+
+\unexpanded\def\definefontfamily
+ {\doquadrupleempty\selectfont_family_define}
+
+\def\selectfont_family_define[#typeface][#style][#family][#settings]%
+ {\selectfont_setparameters[\c!name={#typeface},\c!style={#style},\c!family={#family},#settings]%
+ \ctxcommand{definefontfamily(\selectfont_index)}}
+
+\unexpanded\def\definefallbackfamily
+ {\doquadrupleempty\selectfont_fallback_define}
+
+\def\selectfont_fallback_define[#typeface][#style][#family][#settings]%
+ {\doifassignmentelse{#settings}
+ {\selectfont_setparameters[\c!name={#typeface},\c!style={#style},\c!family={#family},#settings]}
+ {\selectfont_setparameters[\c!name={#typeface},\c!style={#style},\c!family={#family},\c!preset={#settings}]}%
+ \edef\p_selectfont_style{\expandnamespacevalue\??selectfontstyle{#style}\s!rm}%
+ \ctxcommand{definefallbackfamily("#typeface","\p_selectfont_style",\selectfont_index)}}
+
+%D \macros
+%D {setupfontfamily,setupfallbackfamily}
+%D
+%D For simple documents which don’t need complex font settings one could use
+%D the \tex{setupfontfamily} command where the requested font is enabled immediately
+%D without the need to load it with \tex{setupbodyfont}. The downside of this method
+%D is that processing of the document takes longer with each additional font which
+%D is set with \tex{setupfontfamily}.
+%D
+%D \starttyping
+%D \setupfontfamily [serif] [DejaVu Serif]
+%D \setupfontfamily [sans] [DejaVu Sans]
+%D \setupfontfamily [mono] [DejaVu Sans Mono]
+%D \setupfontfamily [math] [XITS Math] [scale=1.1]
+%D
+%D \starttext
+%D
+%D \rm Serif 123 \ss Sans \tt Mono \m{1+2=3}
+%D
+%D \stoptext
+%D \stoptyping
+
+\newcount\c_selectfont_family
+\newtoks \t_selectfont_fallback
+\newtoks \t_selectfont_styles
+
+\unexpanded\def\setupfontfamily
+ {\dotripleempty\selectfont_family_setup}
+
+\def\selectfont_family_setup[#style][#family][#settings]%
+ {\normalexpanded{\t_selectfont_styles{\selectfont_set_font_family[#style][#family][#settings]\the\t_selectfont_styles}}%
+ \selectfont_set_font_indeed}
+
+\unexpanded\def\selectfont_set_default
+ {\selectfont_set_font_family[\v!serif][Latin Modern Roman][\c!opticalsize=\v!yes]%
+ \selectfont_set_font_family[\v!sans] [Latin Modern Sans] [\c!opticalsize=\v!yes]%
+ \selectfont_set_font_family[\v!mono] [Latin Modern Mono] [\c!opticalsize=\v!yes,\c!features=\s!none]}
+
+\unexpanded\def\setupfallbackfamily
+ {\dotripleempty\selectfont_fallback_setup}
+
+\def\selectfont_fallback_setup[#style][#family][#settings]%
+ {\normalexpanded{\t_selectfont_fallback{\the\t_selectfont_fallback\selectfont_set_font_fallback[#style][#family][#settings]}}}
+
+\def\selectfont_set_font_indeed
+ {\global\advance\c_selectfont_family\plusone
+ \edef\m_selectfont_typeface{\v!selectfont-\number\c_selectfont_family}%
+ \the\t_selectfont_fallback
+ \the\t_selectfont_styles
+ \selectfont_set_default
+ \setupbodyfont[\m_selectfont_typeface,\rootselectfontparameter\c!style]}
+
+\unexpanded\def\selectfont_set_font_family[#style]#dummy[#family]#dummy[#settings]%
+ {\ifcsname\m_selectfont_typeface#style\endcsname \else
+ \expandafter\let\csname\m_selectfont_typeface#style\endcsname\relax
+ \selectfont_family_define[\m_selectfont_typeface][#style][#family][#settings]%
+ \fi}
+
+\unexpanded\def\selectfont_set_font_fallback[#style]#dummy[#family]#dummy[#settings]%
+ {\selectfont_fallback_define[\m_selectfont_typeface][#style][#family][#settings]}
+
+%D You can apply a different feature set to each style of a font but if nothing
+%D is set the global features are used.
+
+\setupselectfont
+ [ \c!features=\s!default,
+ \c!regularfeatures=\selectfontparameter\c!features,
+ \c!boldfeatures=\selectfontparameter\c!features,
+ \c!italicfeatures=\selectfontparameter\c!features,
+ \c!slantedfeatures=\selectfontparameter\c!features,
+ \c!bolditalicfeatures=\selectfontparameter\c!features,
+ \c!boldslantedfeatures=\selectfontparameter\c!features,
+ \c!smallcapsfeatures=\s!smallcaps,
+ \c!style=\s!rm]
+
+\protect \ No newline at end of file
diff --git a/tex/context/base/font-sty.mkvi b/tex/context/base/font-sty.mkvi
index d9781f407..03fa598c2 100644
--- a/tex/context/base/font-sty.mkvi
+++ b/tex/context/base/font-sty.mkvi
@@ -172,6 +172,8 @@
%D The new one:
+\setfalse\fontattributeisset
+
\unexpanded\def\dousestyleparameter#value%
{\edef\currentstyleparameter{#value}%
\ifx\currentstyleparameter\empty\else
@@ -342,6 +344,9 @@
\font_styles_define_style_collection_a\s!default
\fi}
+\let\font_styles_define_style_collection_a\relax
+\let\font_styles_define_style_collection_b\relax
+
\unexpanded\def\definestyleinstance
{\doquadrupleargument\font_styles_define_style_instance}
diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua
index 58c552419..399b3ad65 100644
--- a/tex/context/base/l-lpeg.lua
+++ b/tex/context/base/l-lpeg.lua
@@ -466,6 +466,9 @@ function lpeg.replacer(one,two,makefunction,isutf) -- in principle we should sor
end
end
+-- local pattern1 = P(1-P(pattern))^0 * P(pattern) : test for not nil
+-- local pattern2 = (P(pattern) * Cc(true) + P(1))^0 : test for true (could be faster, but not much)
+
function lpeg.finder(lst,makefunction) -- beware: slower than find with 'patternless finds'
local pattern
if type(lst) == "table" then
diff --git a/tex/context/base/math-rad.mkvi b/tex/context/base/math-rad.mkvi
index b3a6a24c9..541a7038e 100644
--- a/tex/context/base/math-rad.mkvi
+++ b/tex/context/base/math-rad.mkvi
@@ -77,10 +77,10 @@
\setvalue{\??mathradicalalternative\v!normal}#body%
{\edef\p_color{\mathradicalparameter\c!color}%
\ifx\p_color\empty
- \rootradical\currentmathradicaldegree{#body}%
+ \rootradical{\currentmathradicaldegree}{#body}% {} really needed as \rootradical expands first
\else\ifx\currentmathradicaldegree\empty
\pushcolor[\p_color]%
- \rootradical\currentmathradicaldegree
+ \rootradical{\currentmathradicaldegree}%
{\popcolor#body}%
\else
\pushcolor[\p_color]%
diff --git a/tex/context/base/meta-fnt.lua b/tex/context/base/meta-fnt.lua
index 75d8f2699..3d8263d3a 100644
--- a/tex/context/base/meta-fnt.lua
+++ b/tex/context/base/meta-fnt.lua
@@ -127,6 +127,7 @@ local function process(mpxformat,name,instances,scalefactor)
}
}
end
+-- inspect(lists)
lists.version = metapost.variables.fontversion or "1.000"
metapost.reset(mpxformat) -- saves memory
lists = containers.write(mpfonts.cache, hash, lists)
diff --git a/tex/context/base/mlib-pdf.lua b/tex/context/base/mlib-pdf.lua
index 4fa97a7c7..6cb094e3e 100644
--- a/tex/context/base/mlib-pdf.lua
+++ b/tex/context/base/mlib-pdf.lua
@@ -277,11 +277,11 @@ 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("456") * P(":") * key * Ct(number^1)
- + lpeg.P("7:") * key * Ct(Ct(number * number^-5)^1)
+ 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)
local pattern = Cf ( Carg(1) * (Cg(variable * newline^0)^0), rawset)
diff --git a/tex/context/base/mult-mps.lua b/tex/context/base/mult-mps.lua
index c1e05f265..5a320487a 100644
--- a/tex/context/base/mult-mps.lua
+++ b/tex/context/base/mult-mps.lua
@@ -105,6 +105,8 @@ return {
"graypart", "graycolor",
--
"mm", "pt", "dd", "bp", "cm", "pc", "cc", "in",
+ --
+ "triplet", "quadruplet",
},
internals = { -- we need to remove duplicates above
--
diff --git a/tex/context/base/node-fnt.lua b/tex/context/base/node-fnt.lua
index 6d5ed6ca0..f74f27e7c 100644
--- a/tex/context/base/node-fnt.lua
+++ b/tex/context/base/node-fnt.lua
@@ -126,8 +126,11 @@ function handlers.characters(head)
attrfonts[font] = used
end
if not used[attr] then
- used[attr] = setfontdynamics[font][attr]
- a = a + 1
+ local fd = setfontdynamics[font]
+ if fd then
+ used[attr] = fd[attr]
+ a = a + 1
+ end
end
else
local used = usedfonts[font]
diff --git a/tex/context/base/page-mul.mkiv b/tex/context/base/page-mul.mkiv
index 9e0861af9..24286106a 100644
--- a/tex/context/base/page-mul.mkiv
+++ b/tex/context/base/page-mul.mkiv
@@ -1158,26 +1158,28 @@
\def\setlocalcolumnfloats
{\settrue\onlylocalcolumnfloats
\everypar\everylocalcolumnfloatspar
- \let\page_mul_flush_float\doflushcolumnfloat
+ \let\page_mul_flush_float \doflushcolumnfloat
\let\page_mul_flush_floats\doflushcolumnfloats}
\def\setglobalcolumnfloats
{\setfalse\onlylocalcolumnfloats
\reseteverypar
- \let\page_mul_flush_float\relax
+ \let\page_mul_flush_float \relax
\let\page_mul_flush_floats\noflushcolumnfloats}
- \def\noflushcolumnfloats
- {\bgroup
- \xdef\localsavednoffloats{\the\savednoffloats}%
- \global\savednoffloats\globalsavednoffloats
- \page_otr_command_flush_top_insertions
- \xdef\globalsavenoffloats{\the\savednoffloats}%
- \ifnum\globalsavednoffloats=\zerocount
- \setlocalcolumnfloats
- \fi
- \global\savednoffloats\localsavednoffloats
- \egroup}
+ % \def\noflushcolumnfloats
+ % {\bgroup
+ % \xdef\localsavednoffloats{\the\savednoffloats}%
+ % \global\savednoffloats\globalsavednoffloats
+ % \page_otr_command_flush_top_insertions
+ % \xdef\globalsavenoffloats{\the\savednoffloats}%
+ % \ifnum\globalsavednoffloats=\zerocount
+ % \setlocalcolumnfloats
+ % \fi
+ % \global\savednoffloats\localsavednoffloats
+ % \egroup}
+ %
+ \def\noflushcolumnfloats{\doflushcolumnfloats} % not yet redone
%D We need to calculate the amount of free space in a columns. When there is not
%D enough room, we migrate the float to the next column. These macro's are
diff --git a/tex/context/base/s-present-tiles.mkiv b/tex/context/base/s-present-tiles.mkiv
index 80ea5249f..1a0c95f0d 100644
--- a/tex/context/base/s-present-tiles.mkiv
+++ b/tex/context/base/s-present-tiles.mkiv
@@ -13,7 +13,7 @@
%D The Bacho\TeX\ 2013 style.
-\setupbodyfont[palatino,14.4pt]
+\setupbodyfont[pagella,14.4pt]
\setuppapersize[S6][S6]
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 7324eec33..a44ff4b48 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.log b/tex/context/base/status-lua.log
index 125142be3..75b246b6f 100644
--- a/tex/context/base/status-lua.log
+++ b/tex/context/base/status-lua.log
@@ -1,6 +1,6 @@
(cont-yes.mkiv
-ConTeXt ver: 2013.09.21 13:53 MKIV beta fmt: 2013.9.21 int: english/english
+ConTeXt ver: 2013.09.30 19:49 MKIV beta fmt: 2013.9.30 int: english/english
system > 'cont-new.mkiv' loaded
(cont-new.mkiv)
diff --git a/tex/context/base/strc-doc.lua b/tex/context/base/strc-doc.lua
index a3aeb31e7..5be5727f5 100644
--- a/tex/context/base/strc-doc.lua
+++ b/tex/context/base/strc-doc.lua
@@ -737,13 +737,13 @@ function sections.typesetnumber(entry,kind,...) -- kind='section','number','pref
applyprocessor(connector)
end
else
-if groupsuffix and kind ~= "prefix" then
- if result then
- result[#result+1] = strippedprocessor(groupsuffix)
- else
- applyprocessor(groupsuffix)
- end
-end
+ if groupsuffix and kind ~= "prefix" then
+ if result then
+ result[#result+1] = strippedprocessor(groupsuffix)
+ else
+ applyprocessor(groupsuffix)
+ end
+ end
if stopper then
if result then
result[#result+1] = strippedprocessor(stopper)
@@ -769,94 +769,104 @@ end
function sections.findnumber(depth,what) -- needs checking (looks wrong and slow too)
local data = data.status[depth or data.depth]
- if data then
- local index = data.references.section
- local collected = sections.collected
- local sectiondata = collected[index]
- if sectiondata and sectiondata.hidenumber ~= true then -- can be nil
- local quit = what == v_previous or what == v_next
- if what == v_first or what == v_previous then
- for i=index,1,-1 do
- local s = collected[i]
- if s then
- local n = s.numbers
- if #n == depth and n[depth] and n[depth] ~= 0 then
- sectiondata = s
- if quit then
- break
- end
- elseif #n < depth then
+ if not data then
+ return
+ end
+ local references = data.references
+ if not references then
+ return
+ end
+ local index = references.section
+ local collected = sections.collected
+ local sectiondata = collected[index]
+ if sectiondata and sectiondata.hidenumber ~= true then -- can be nil
+ local quit = what == v_previous or what == v_next
+ if what == v_first or what == v_previous then
+ for i=index,1,-1 do
+ local s = collected[i]
+ if s then
+ local n = s.numbers
+ if #n == depth and n[depth] and n[depth] ~= 0 then
+ sectiondata = s
+ if quit then
break
end
+ elseif #n < depth then
+ break
end
end
- elseif what == v_last or what == v_next then
- for i=index,#collected do
- local s = collected[i]
- if s then
- local n = s.numbers
- if #n == depth and n[depth] and n[depth] ~= 0 then
- sectiondata = s
- if quit then
- break
- end
- elseif #n < depth then
+ end
+ elseif what == v_last or what == v_next then
+ for i=index,#collected do
+ local s = collected[i]
+ if s then
+ local n = s.numbers
+ if #n == depth and n[depth] and n[depth] ~= 0 then
+ sectiondata = s
+ if quit then
break
end
+ elseif #n < depth then
+ break
end
end
end
- return sectiondata
end
+ return sectiondata
end
end
function sections.finddata(depth,what)
local data = data.status[depth or data.depth]
- if data then
- -- if sectiondata and sectiondata.hidenumber ~= true then -- can be nil
- local index = data.references.listindex
- if index then
- local collected = structures.lists.collected
- local quit = what == v_previous or what == v_next
- if what == v_first or what == v_previous then
- for i=index-1,1,-1 do
- local s = collected[i]
- if not s then
+ if not data then
+ return
+ end
+ local references = data.references
+ if not references then
+ return
+ end
+ local index = references.listindex
+ if not index then
+ return
+ end
+ local collected = structures.lists.collected
+ local quit = what == v_previous or what == v_next
+ if what == v_first or what == v_previous then
+ for i=index-1,1,-1 do
+ local s = collected[i]
+ if not s then
+ break
+ elseif s.metadata.kind == "section" then -- maybe check on name
+ local n = s.numberdata.numbers
+ if #n == depth and n[depth] and n[depth] ~= 0 then
+ data = s
+ if quit then
break
- elseif s.metadata.kind == "section" then -- maybe check on name
- local n = s.numberdata.numbers
- if #n == depth and n[depth] and n[depth] ~= 0 then
- data = s
- if quit then
- break
- end
- elseif #n < depth then
- break
- end
end
+ elseif #n < depth then
+ break
end
- elseif what == v_last or what == v_next then
- for i=index+1,#collected do
- local s = collected[i]
- if not s then
+ end
+ end
+ elseif what == v_last or what == v_next then
+ for i=index+1,#collected do
+ local s = collected[i]
+ if not s then
+ break
+ elseif s.metadata.kind == "section" then -- maybe check on name
+ local n = s.numberdata.numbers
+ if #n == depth and n[depth] and n[depth] ~= 0 then
+ data = s
+ if quit then
break
- elseif s.metadata.kind == "section" then -- maybe check on name
- local n = s.numberdata.numbers
- if #n == depth and n[depth] and n[depth] ~= 0 then
- data = s
- if quit then
- break
- end
- elseif #n < depth then
- break
- end
end
+ elseif #n < depth then
+ break
end
end
end
- return data
end
+ return data
end
function sections.internalreference(sectionname,what) -- to be used in pagebuilder (no marks used)
diff --git a/tex/context/base/strc-lst.mkvi b/tex/context/base/strc-lst.mkvi
index 15a499c8b..7cef924b7 100644
--- a/tex/context/base/strc-lst.mkvi
+++ b/tex/context/base/strc-lst.mkvi
@@ -1262,6 +1262,8 @@
% \resetinteractionparameter\c!contrastcolor
\fi}
+\let\strc_lists_set_style_color\strc_lists_set_style_color_normal
+
%D A helper:
\def\strc_lists_limitated_text#text%
diff --git a/tex/context/base/strc-reg.lua b/tex/context/base/strc-reg.lua
index 2356acb9b..7e7736e2b 100644
--- a/tex/context/base/strc-reg.lua
+++ b/tex/context/base/strc-reg.lua
@@ -13,32 +13,35 @@ local utfchar = utf.char
local lpegmatch = lpeg.match
local allocate = utilities.storage.allocate
-local trace_registers = false trackers.register("structures.registers", function(v) trace_registers = v end)
+local trace_registers = false trackers.register("structures.registers", function(v) trace_registers = v end)
-local report_registers = logs.reporter("structure","registers")
+local report_registers = logs.reporter("structure","registers")
-local structures = structures
-local registers = structures.registers
-local helpers = structures.helpers
-local sections = structures.sections
-local documents = structures.documents
-local pages = structures.pages
-local references = structures.references
+local structures = structures
+local registers = structures.registers
+local helpers = structures.helpers
+local sections = structures.sections
+local documents = structures.documents
+local pages = structures.pages
+local references = structures.references
-local mappings = sorters.mappings
-local entries = sorters.entries
-local replacements = sorters.replacements
+local mappings = sorters.mappings
+local entries = sorters.entries
+local replacements = sorters.replacements
-local processors = typesetters.processors
-local splitprocessor = processors.split
+local processors = typesetters.processors
+local splitprocessor = processors.split
-local texgetcount = tex.getcount
+local texgetcount = tex.getcount
-local variables = interfaces.variables
-local context = context
-local commands = commands
+local variables = interfaces.variables
+local context = context
+local commands = commands
-local matchingtilldepth, numberatdepth = sections.matchingtilldepth, sections.numberatdepth
+local matchingtilldepth = sections.matchingtilldepth
+local numberatdepth = sections.numberatdepth
+
+local absmaxlevel = 5 -- \c_strc_registers_maxlevel
-- some day we will share registers and lists (although there are some conceptual
-- differences in the application of keywords)
@@ -661,18 +664,39 @@ local function collapsepages(pages)
return #pages
end
+-- todo: determine max
+
function registers.flush(data,options,prefixspec,pagespec)
local collapse_singles = options.compress == variables.yes
local collapse_ranges = options.compress == variables.all
local result = data.result
+ local done = { } -- reused
+ local maxlevel = 0
+ --
+ for i=1,#result do
+ local data = result[i].data
+ for d=1,#data do
+ local m = #data[d].list
+ if m > maxlevel then
+ maxlevel = m
+ end
+ end
+ end
+ if maxlevel > absmaxlevel then
+ maxlevel = absmaxlevel
+ report_registers("limiting level to %a",maxlevel)
+ end
+ --
context.startregisteroutput()
for i=1,#result do
-- ranges need checking !
local sublist = result[i]
- local done = { false, false, false, false }
local data = sublist.data
local d, n = 0, 0
context.startregistersection(sublist.tag)
+ for i=1,maxlevel do
+ done[i] = false
+ end
for d=1,#data do
local entry = data[d]
if entry.metadata.kind == "see" then
@@ -685,20 +709,26 @@ function registers.flush(data,options,prefixspec,pagespec)
end
end
end
+ local e = { } -- reused
while d < #data do
d = d + 1
local entry = data[d]
- local e = { false, false, false, false }
local metadata = entry.metadata
local kind = metadata.kind
local list = entry.list
- for i=1,4 do -- max 4
+ for i=1,maxlevel do
+ e[i] = false
+ end
+ for i=1,maxlevel do
if list[i] then
e[i] = list[i][1]
end
if e[i] ~= done[i] then
if e[i] and e[i] ~= "" then
done[i] = e[i]
+ for j=i+1,maxlevel do
+ done[j] = false
+ end
if n == i then
context.stopregisterentries()
context.startregisterentries(n)
@@ -722,6 +752,9 @@ function registers.flush(data,options,prefixspec,pagespec)
end
else
done[i] = false
+ for j=i,maxlevel do
+ done[j] = false
+ end
end
end
end
diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv
index 8c9f040f0..febb4c0b0 100644
--- a/tex/context/base/strc-reg.mkiv
+++ b/tex/context/base/strc-reg.mkiv
@@ -116,6 +116,7 @@
%D \stoptyping
\newconditional\c_strc_registers_defining
+\setnewconstant\c_strc_registers_maxlevel \plusfive
\ifdefined\Word \else \unexpanded\def\Word#1{#1} \fi
@@ -131,7 +132,7 @@
\setuevalue{\e!place\currentregister}{\placeregister[\currentregister]}%
\setuevalue{\e!complete\currentregister}{\completeregister[\currentregister]}%
\setuevalue{\e!setup\currentregister\e!endsetup}{\setupregister[\currentregister]}%
- \dorecurse\plusthree {% weird, expanded should not be needed
+ \dorecurse\c_strc_registers_maxlevel{% weird, expanded should not be needed
\normalexpanded{\defineregister[\currentregister:\recurselevel][\currentregister]}%
%\defineregister[\currentregister:\recurselevel][\currentregister]%
\letregisterparameter{\c!entries:\recurselevel}\empty % needed as we use detokenize (ok, we can
@@ -672,14 +673,29 @@
\dostoptagged
\endgroup}
+% \unexpanded\def\startregisterentries#1% depth
+% {\endgraf
+% \begingroup
+% \dostarttagged\t!registerentries\empty
+% \let\savedcurrentregister\currentregister
+% \edef\currentregister{\currentregister:#1}%
+% \useregisterstyleandcolor\c!textstyle\c!textcolor
+% \advance\leftskip\numexpr#1-\plusone\relax\dimexpr\d_strc_registers_distance\relax
+% \hangindent\registerparameter\c!distance\relax
+% \hangafter\plusone
+% \let\currentregister\savedcurrentregister}
+
\unexpanded\def\startregisterentries#1% depth
{\endgraf
\begingroup
+ \scratchcounter\ifnum#1>\c_strc_registers_maxlevel\c_strc_registers_maxlevel\else#1\fi\relax
\dostarttagged\t!registerentries\empty
\let\savedcurrentregister\currentregister
- \edef\currentregister{\currentregister:#1}%
+ \edef\currentregister{\currentregister:\number\scratchcounter}%
\useregisterstyleandcolor\c!textstyle\c!textcolor
- \advance\leftskip\numexpr#1-\plusone\relax\dimexpr\d_strc_registers_distance\relax
+ \ifnum\scratchcounter>\plusone
+ \advance\leftskip\d_strc_registers_distance\relax
+ \fi
\hangindent\registerparameter\c!distance\relax
\hangafter\plusone
\let\currentregister\savedcurrentregister}
diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv
index aadda56db..2836b018b 100644
--- a/tex/context/base/strc-sec.mkiv
+++ b/tex/context/base/strc-sec.mkiv
@@ -432,6 +432,9 @@
\unexpanded\def\startnamedsection
{\dotripleempty\strc_sectioning_start_named_section}
+% todo: add grouping but where: before/after trickery .. probably inside because one can always add
+% grouping to the before/after settings
+
\unexpanded\def\strc_sectioning_start_named_section[#1]% [#2][#3]
{\pushmacro\currentnamedsection
\edef\currentnamedsection{#1}%
@@ -588,11 +591,13 @@
\headparameter\c!beforesection % beware, no users vars set yet
\the\everybeforehead
\strc_sectioning_handle{#1}{#2}{#3}% name -- -- -- userdata (we might move the tagged to here)
+ % potential: \bgroup (can be optional: grouped = yes)
\headparameter\c!insidesection}
\unexpanded\def\strc_sectioning_stop[#1]% !!! also used at lua end
{\dostoptagged
\dostoptagged
+ % potential: \egroup
%\globalpopmacro\currenthead % so we do a hard recover
\xdef\currenthead{#1}% recover
\headparameter\c!aftersection
diff --git a/tex/context/base/tabl-nte.mkiv b/tex/context/base/tabl-nte.mkiv
index 4a9774cb0..af74a2abe 100644
--- a/tex/context/base/tabl-nte.mkiv
+++ b/tex/context/base/tabl-nte.mkiv
@@ -102,9 +102,9 @@
\unexpanded\def\startTABLEbody{\dosingleempty\tabl_nte_start_body} \let\stopTABLEbody\relax
\unexpanded\def\startTABLEfoot{\dosingleempty\tabl_nte_start_foot} \let\stopTABLEfoot\relax
-\def\tabl_nte_start_head[#1]#2\stopTABLEhead{\appendtoks\doTABLEsection[#1]{#2}\to\TBLhead}
-\def\tabl_nte_start_next[#1]#2\stopTABLEnext{\appendtoks\doTABLEsection[#1]{#2}\to\TBLnext}
-\def\tabl_nte_start_body[#1]#2\stopTABLEbody{\appendtoks\doTABLEsection[#1]{#2}\to\TBLbody}
-\def\tabl_nte_start_foot[#1]#2\stopTABLEfoot{\appendtoks\doTABLEsection[#1]{#2}\to\TBLfoot}
+\def\tabl_nte_start_head[#1]#2\stopTABLEhead{\appendtoks\tabl_ntb_section[#1]{#2}\to\t_tabl_ntb_head}
+\def\tabl_nte_start_next[#1]#2\stopTABLEnext{\appendtoks\tabl_ntb_section[#1]{#2}\to\t_tabl_ntb_next}
+\def\tabl_nte_start_body[#1]#2\stopTABLEbody{\appendtoks\tabl_ntb_section[#1]{#2}\to\t_tabl_ntb_body}
+\def\tabl_nte_start_foot[#1]#2\stopTABLEfoot{\appendtoks\tabl_ntb_section[#1]{#2}\to\t_tabl_ntb_foot}
\protect \endinput
diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv
index 57b5dd9c8..f04c45e18 100644
--- a/tex/context/base/tabl-tbl.mkiv
+++ b/tex/context/base/tabl-tbl.mkiv
@@ -1923,7 +1923,7 @@
\tabl_tabulate_nobreak_inject
\stoptabulatenoalign}
-\let\tabl_tabulate_BL_second\tabl_tabulate_TL_second
+\let\tabl_tabulate_BL_second_indeed\tabl_tabulate_TL_second_indeed
\def\tabl_tabulate_HL_second
{\csname
@@ -2016,6 +2016,8 @@
\let\tabl_tabulate_flush_collected \empty
\let\tabl_tabulate_flush_collected_indeed\empty
+\let\v_tabl_tabulate_align\!!zerocount
+
\def\tabl_tabulate_set_local_hsize
{\setlocalhsize
\hsize\localhsize}
diff --git a/tex/context/base/tabl-xtb.mkvi b/tex/context/base/tabl-xtb.mkvi
index f63f83080..556bec5ce 100644
--- a/tex/context/base/tabl-xtb.mkvi
+++ b/tex/context/base/tabl-xtb.mkvi
@@ -153,6 +153,7 @@
\let\stopxtable\relax
\def\tabl_x_default_buffer{x_table_\number\c_tabl_x_nesting}
+\let\tabl_x_current_buffer\empty
\unexpanded\def\tabl_x_start_table[#settings]% maybe two arguments: [tag][settings] | [tag] | [settings]
{\bgroup
diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua
index 1022483a0..9c7e7ce63 100644
--- a/tex/context/base/task-ini.lua
+++ b/tex/context/base/task-ini.lua
@@ -12,6 +12,10 @@ if not modules then modules = { } end modules ['task-ini'] = {
-- we can disable more handlers and enable then when really used (*)
--
-- todo: two finalizers: real shipout (can be imposed page) and page shipout (individual page)
+--
+-- todo: consider moving the kernel kerning/ligaturing functions in the main font loop because
+-- there we know if they are needed; doesn't save time but; if we overload unh* commands to
+-- not apply the font handler, we can remove all checks for subtypes 255
local tasks = nodes.tasks
local appendaction = tasks.appendaction
diff --git a/tex/context/base/type-ini.mkvi b/tex/context/base/type-ini.mkvi
index 0ce14ef9f..a4d576d80 100644
--- a/tex/context/base/type-ini.mkvi
+++ b/tex/context/base/type-ini.mkvi
@@ -601,6 +601,8 @@
\def\font_typescripts_inherit_check_step#style{\setevalue{\??typescriptinheritances#name:#style}{#parentclass}}%
\processcommalist[#styles]\font_typescripts_inherit_check_step}}}
+\let\font_typescripts_inherit_check_step\relax
+
%D This hooks into the font mechanism with:
\def\font_typescripts_inherit_check_indeed#name% called often
diff --git a/tex/context/base/typo-del.mkiv b/tex/context/base/typo-del.mkiv
index 82cc7472d..603471f75 100644
--- a/tex/context/base/typo-del.mkiv
+++ b/tex/context/base/typo-del.mkiv
@@ -334,6 +334,8 @@
\def\typo_delimited_start_par
{\dosingleempty\typo_delimited_start_par_indeed}
+\let\typo_delimited_stop_par_indeed\endgraf
+
\def\typo_delimited_start_par_indeed[#1]%
{\let\typo_delimited_stop\typo_delimited_stop_par
\doifsomething{\delimitedtextparameter\c!spacebefore}
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 810538a7f..4a1087fbb 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 : 09/21/13 13:53:05
+-- merge date : 09/30/13 19:49:15
do -- begin closure to overcome local limits and interference