From 4951780633cb4bd2174478f80a0f1c6e355f1fdf Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Sat, 28 Mar 2015 11:15:04 +0100 Subject: 2015-03-28 10:33:00 --- .../documents/general/manuals/xtables-mkiv.pdf | Bin 137070 -> 136973 bytes tex/context/base/buff-ini.lua | 25 +++- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4326 -> 4331 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/font-ctx.lua | 32 +++++- tex/context/base/font-lib.mkvi | 13 +-- tex/context/base/page-flt.lua | 128 +++++++++++++++++---- tex/context/base/page-flt.mkiv | 30 ++--- tex/context/base/status-files.pdf | Bin 24674 -> 24635 bytes tex/context/base/status-lua.pdf | Bin 400705 -> 401475 bytes tex/context/base/strc-flt.mkvi | 4 +- tex/context/base/tabl-xtb.lua | 89 +++++++++----- tex/context/base/tabl-xtb.mkvi | 101 +++++++++------- tex/context/base/typo-mar.lua | 36 +++++- tex/context/base/typo-mar.mkiv | 70 +++++------ tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 17 files changed, 367 insertions(+), 167 deletions(-) diff --git a/doc/context/documents/general/manuals/xtables-mkiv.pdf b/doc/context/documents/general/manuals/xtables-mkiv.pdf index 4559ce314..ee213f4d7 100644 Binary files a/doc/context/documents/general/manuals/xtables-mkiv.pdf and b/doc/context/documents/general/manuals/xtables-mkiv.pdf differ diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua index a825ad719..77d278489 100644 --- a/tex/context/base/buff-ini.lua +++ b/tex/context/base/buff-ini.lua @@ -50,6 +50,8 @@ local registertempfile = luatex.registertempfile local v_yes = variables.yes +local p_whitespace = patterns.whitespace + local catcodenumbers = catcodes.numbers local ctxcatcodes = catcodenumbers.ctxcatcodes @@ -388,8 +390,27 @@ function tokens.pickup(start,stop) end end end - list = concat(list,"",1,size-stoplength-1) - return list + local start = 1 + local stop = size-stoplength-1 + for i=start,stop do + if lpegmatch(p_whitespace,list[i]) then + start = i + 1 + else + break + end + end + for i=stop,start,-1 do + if lpegmatch(p_whitespace,list[i]) then + stop = i - 1 + else + break + end + end + if start <= stop then + return concat(list,"",start,stop) + else + return "" + end end -- function buffers.pickup(name,start,stop,finish,catcodes,doundent) diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 43843f0d6..b3594bf1f 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{2015.03.28 00:06} +\newcontextversion{2015.03.28 10:30} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index b48b327a5..3d6722c68 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 8782f1062..dad14f536 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2015.03.28 00:06} +\edef\contextversion{2015.03.28 10:30} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index a00cc228e..2d0e99653 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -2270,12 +2270,34 @@ implement { arguments = "string" } -function commands.cleanfontname (name) context(names.cleanname(name)) end +implement { + name = "cleanfontname", + actions = { names.cleanname, context }, + arguments = "string" +} + +implement { + name = "fontlookupinitialize", + actions = names.lookup, + arguments = "string", +} + +implement { + name = "fontlookupnoffound", + actions = { names.noflookups, context }, +} + +implement { + name = "fontlookupgetkeyofindex", + actions = { names.getlookupkey, context }, + arguments = { "string", "integer"} +} -function commands.fontlookupinitialize (name) names.lookup(name) end -function commands.fontlookupnoffound () context(names.noflookups()) end -function commands.fontlookupgetkeyofindex(key,index) context(names.getlookupkey(key,index)) end -function commands.fontlookupgetkey (key) context(names.getlookupkey(key)) end +implement { + name = "fontlookupgetkey", + actions = { names.getlookupkey, context }, + arguments = "string" +} -- this might move to a runtime module: diff --git a/tex/context/base/font-lib.mkvi b/tex/context/base/font-lib.mkvi index 4b819f43a..59074b07d 100644 --- a/tex/context/base/font-lib.mkvi +++ b/tex/context/base/font-lib.mkvi @@ -91,14 +91,13 @@ %D \stoptyping % we can also move the lookups to the fonts.namespace (of commands) +% one can also directly use the clf calls when speed is needed -% these will be renamed but it needs synchronization with WS - -\def\dolookupfontbyspec #1{\ctxcommand{fontlookupinitialize("#1")}} -\def\dolookupnoffound {\ctxcommand{fontlookupnoffound()}} -\def\dolookupgetkeyofindex#1#2{\ctxcommand{fontlookupgetkeyofindex("#1",#2)}} -\def\dolookupgetkey #1{\ctxcommand{fontlookupgetkey("#1")}} -\def\cleanfontname #1{\ctxcommand{cleanfontname("#1")}} +\def\dolookupfontbyspec #1{\clf_fontlookupinitialize{#1}} +\def\dolookupnoffound {\clf_fontlookupnoffound} +\def\dolookupgetkeyofindex#1#2{\clf_fontlookupgetkeyofindex{#1}\numexpr#2\relax} +\def\dolookupgetkey #1{\clf_fontlookupgetkey{#1}} +\def\cleanfontname #1{\clf_cleanfontname{#1}} % new: diff --git a/tex/context/base/page-flt.lua b/tex/context/base/page-flt.lua index 7b1afc55c..e91285d0a 100644 --- a/tex/context/base/page-flt.lua +++ b/tex/context/base/page-flt.lua @@ -242,10 +242,14 @@ function floats.checkedpagefloat(packed) end end -function floats.nofstacked() +function floats.nofstacked(which) return #stacks[which or default] or 0 end +function floats.hasstacked(which) + return (#stacks[which or default] or 0) > 0 +end + -- todo: check for digits ! local method = C((1-S(", :"))^1) @@ -273,27 +277,101 @@ end -- interface -local context = context -local context_setvalue = context.setvalue - -commands.flushfloat = floats.flush -commands.savefloat = floats.save -commands.resavefloat = floats.resave -commands.pushfloat = floats.push -commands.popfloat = floats.pop -commands.consultfloat = floats.consult -commands.collectfloat = floats.collect - -function commands.getfloatvariable (...) local v = floats.getvariable(...) if v then context(v) end end -function commands.checkedpagefloat (...) local v = floats.checkedpagefloat(...) if v then context(v) end end - -function commands.nofstackedfloats (...) context(floats.nofstacked(...)) end -function commands.doifelsesavedfloat(...) commands.doifelse(floats.nofstacked(...)>0) end - -function commands.analysefloatmethod(str) -- currently only one method - local method, label, row, column = floats.analysemethod(str) - context_setvalue("floatmethod",method or "") - context_setvalue("floatlabel", label or "") - context_setvalue("floatrow", row or "") - context_setvalue("floatcolumn",column or "") -end +local context = context +local commands = commands +local implement = interfaces.implement +local setmacro = interfaces.setmacro + +implement { + name = "flushfloat", + actions = floats.flush, + arguments = { "string", "integer" }, +} + +implement { + name = "flushlabeledfloat", + actions = floats.flush, + arguments = { "string", "string", true }, +} + +implement { + name = "savefloat", + actions = floats.save, + arguments = "string" +} + +implement { + name = "savespecificfloat", + actions = floats.save, + arguments = { + "string", + { + { "specification" }, + { "label" }, + } + } +} + +implement { + name = "resavefloat", + actions = floats.resave, + arguments = "string" +} + +implement { + name = "pushfloat", + actions = floats.push +} + +implement { + name = "popfloat", + actions = floats.pop +} + +implement { + name = "consultfloat", + actions = floats.consult, + arguments = "string", +} + +implement { + name = "collectfloat", + actions = floats.collect, + arguments = { "string", "dimen", "dimen" } +} + +implement { + name = "getfloatvariable", + actions = { floats.getvariable, context }, + arguments = "string" +} + +implement { + name = "checkedpagefloat", + actions = { floats.checkedpagefloat, context }, + arguments = "string" +} + +implement { + name = "nofstackedfloats", + actions = { floats.nofstacked, context }, + arguments = "string" +} + +implement { + name = "doifelsestackedfloats", + actions = { floats.hasstacked, commands.doifelse }, + arguments = "string" +} + +implement { + name = "analysefloatmethod", + actions = function(str) + local method, label, row, column = floats.analysemethod(str) + setmacro("floatmethod",method or "") + setmacro("floatlabel", label or "") + setmacro("floatrow", row or "") + setmacro("floatcolumn",column or "") + end, + arguments = "string" +} diff --git a/tex/context/base/page-flt.mkiv b/tex/context/base/page-flt.mkiv index d641e1c7d..16c427139 100644 --- a/tex/context/base/page-flt.mkiv +++ b/tex/context/base/page-flt.mkiv @@ -83,49 +83,49 @@ \to \everyfloatscheck \unexpanded\def\page_floats_flush#1#2% - {\ctxcommand{flushfloat("#1",\number#2)}% + {\clf_flushfloat{#1}#2\relax \the\everyfloatscheck} \unexpanded\def\page_floats_flush_by_label#1#2% - {\ctxcommand{flushfloat("#1","#2",true)}% + {\clf_flushlabeledfloat{#1}{#2}\relax \the\everyfloatscheck} \unexpanded\def\page_floats_save#1% - {\ctxcommand{savefloat("#1")}% + {\clf_savefloat{#1}\relax \the\everyfloatscheck} \unexpanded\def\page_floats_resave#1% - {\ctxcommand{resavefloat("#1")}% + {\clf_resavefloat{#1}\relax \the\everyfloatscheck} \unexpanded\def\page_floats_push_saved - {\ctxcommand{pushfloat()}% + {\clf_pushfloat \the\everyfloatscheck} \unexpanded\def\page_floats_pop_saved - {\ctxcommand{popfloat()}% + {\clf_popfloat \the\everyfloatscheck} \unexpanded\def\page_floats_get_info#1% - {\ctxcommand{consultfloat("#1")}} + {\clf_consultfloat{#1}} \unexpanded\def\page_floats_if_else#1% - {\ctxcommand{doifelsesavedfloat("#1")}} + {\clf_doifelsestackedfloats{#1}} \unexpanded\def\page_floats_collect#1#2#3% - {\ctxcommand{collectfloat("#1",\number\dimexpr#2,\number\dimexpr#3)}} + {\clf_collectfloat{#1}\dimexpr#2\relax\dimexpr#3\relax} -\unexpanded\def\nofstackedfloatincategory#1% - {\ctxcommand{nofstackedfloats("#1")}} +\def\nofstackedfloatincategory#1% + {\clf_nofstackedfloats{#1}} \let\page_floats_column_push_saved\page_floats_push_saved % overloaded in page-mul \let\page_floats_column_pop_saved \page_floats_pop_saved % overloaded in page-mul \unexpanded\def\page_floats_save_page_float#1#2% - {\ctxcommand{savefloat("#1", { specification = "#2" })}} + {\clf_savespecificfloat{#1}{specification{#2}}\relax} \unexpanded\def\page_floats_save_somewhere_float#1#2% #1=method - {\ctxcommand{savefloat("#1", { specification = "#2", label = "\floatlabel" })}} + {\clf_savespecificfloat{#1}{specification{#2}label{\floatlabel}}\relax} %D This is an experimental new feature (for Alan Braslau), a prelude to more: %D @@ -256,7 +256,7 @@ \def\page_floats_flush_page_floats_indeed#1% future releases can do more clever things {\page_floats_flush{#1}\plusone - \edef\floatspecification{\ctxcommand{getfloatvariable("specification")}}% Is this okay? + \edef\floatspecification{\clf_getfloatvariable{specification}}% Is this okay? \the\everybeforeflushedpagefloat \vbox to \textheight {\doifnotinset\v!high\floatspecification\vfill @@ -265,7 +265,7 @@ \page_otr_fill_and_eject_page} \unexpanded\def\page_floats_flush_page_floats % used in postpone - {\edef\m_page_otf_checked_page_float{\ctxcommand{checkedpagefloat()}}% (true) for packed + {\edef\m_page_otf_checked_page_float{\clf_checkedpagefloat}% \ifx\m_page_otf_checked_page_float\empty % nothing \else\ifx\m_page_otf_checked_page_float\v!empty diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index a4ee09313..59fe33bbe 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index f6bf197a4..a805ed2f4 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi index 14bfafa9f..af3aa8183 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -2082,7 +2082,7 @@ \definefloat [\v!graphic] [\v!graphics] - + % float strategy, replaces some of the above macros \installcorenamespace{floatmethods} @@ -2094,7 +2094,7 @@ \let\forcedfloatmethod\empty % set by lua \def\setfloatmethodvariables#1% \floatmethod \floatlabel \floatrow \floatcolumn - {\ctxcommand{analysefloatmethod("#1")}} + {\clf_analysefloatmethod{#1}} \def\somesomewherefloat[#1]% {\page_floats_save_somewhere_float\s!somewhere{#1}} diff --git a/tex/context/base/tabl-xtb.lua b/tex/context/base/tabl-xtb.lua index d8c5f78c9..c3076ca68 100644 --- a/tex/context/base/tabl-xtb.lua +++ b/tex/context/base/tabl-xtb.lua @@ -32,6 +32,8 @@ local commands = commands local context = context local tex = tex +local implement = interfaces.implement + local texgetcount = tex.getcount local texsetcount = tex.setcount local texgetdimen = tex.getdimen @@ -983,23 +985,23 @@ local function spanheight(body,i) end function xtables.flush(directives) -- todo split by size / no inbetween then .. glue list kern blank - local vsize = directives.vsize - local method = directives.method or v_normal - local settings = data.settings - local results = data.results - local rowdistance = settings.rowdistance - local head = results[head_mode] - local foot = results[foot_mode] - local more = results[more_mode] - local body = results[body_mode] + local height = directives.height + local method = directives.method or v_normal + local settings = data.settings + local results = data.results + local rowdistance = settings.rowdistance + local head = results[head_mode] + local foot = results[foot_mode] + local more = results[more_mode] + local body = results[body_mode] local repeatheader = settings.header == v_repeat local repeatfooter = settings.footer == v_repeat - if vsize and vsize > 0 then + if height and height > 0 then context_beginvbox() local bodystart = data.bodystart or 1 local bodystop = data.bodystop or #body if bodystart > 0 and bodystart <= bodystop then - local bodysize = vsize + local bodysize = height local footsize = total(foot,rowdistance) local headsize = total(head,rowdistance) local moresize = total(more,rowdistance) @@ -1086,7 +1088,7 @@ function xtables.flush(directives) -- todo split by size / no inbetween then .. texsetcount("global","c_tabl_x_state",2) end else - if firstsize > vsize then + if firstsize > height then -- get rid of the too large cell for s=1,firstspans do inject(body[bodystart]) @@ -1194,20 +1196,51 @@ end -- eventually we might only have commands -commands.x_table_create = xtables.create -commands.x_table_reflow_width = xtables.reflow_width -commands.x_table_reflow_height = xtables.reflow_height -commands.x_table_construct = xtables.construct -commands.x_table_flush = xtables.flush -commands.x_table_cleanup = xtables.cleanup -commands.x_table_next_row = xtables.next_row -commands.x_table_finish_row = xtables.finish_row -commands.x_table_init_reflow_width = xtables.initialize_reflow_width -commands.x_table_init_reflow_height = xtables.initialize_reflow_height -commands.x_table_init_construct = xtables.initialize_construct -commands.x_table_set_reflow_width = xtables.set_reflow_width -commands.x_table_set_reflow_height = xtables.set_reflow_height -commands.x_table_set_construct = xtables.set_construct +implement { + name = "x_table_create", + actions = xtables.create, + arguments = { + { + { "option" }, + { "textwidth", "dimen" }, + { "textheight", "dimen" }, + { "maxwidth", "dimen" }, + { "lineheight", "dimen" }, + { "columndistance", "dimen" }, + { "leftmargindistance", "dimen" }, + { "rightmargindistance", "dimen" }, + { "rowdistance", "dimen" }, + { "header" }, + { "footer" }, + } + } +} + +implement { + name = "x_table_flush", + actions = xtables.flush, + arguments = { + { + { "method" }, + { "height", "dimen" } + } + } +} -commands.x_table_r = function() context(data.currentrow or 0) end -commands.x_table_c = function() context(data.currentcolumn or 0) end +implement { name = "x_table_reflow_width", actions = xtables.reflow_width } +implement { name = "x_table_reflow_height", actions = xtables.reflow_height } +implement { name = "x_table_construct", actions = xtables.construct } +implement { name = "x_table_cleanup", actions = xtables.cleanup } +implement { name = "x_table_next_row", actions = xtables.next_row } +implement { name = "x_table_next_row_option", actions = xtables.next_row, arguments = "string" } +implement { name = "x_table_finish_row", actions = xtables.finish_row } +implement { name = "x_table_init_reflow_width", actions = xtables.initialize_reflow_width } +implement { name = "x_table_init_reflow_height", actions = xtables.initialize_reflow_height } +implement { name = "x_table_init_reflow_width_option", actions = xtables.initialize_reflow_width, arguments = "string" } +implement { name = "x_table_init_reflow_height_option", actions = xtables.initialize_reflow_height, arguments = "string" } +implement { name = "x_table_init_construct", actions = xtables.initialize_construct } +implement { name = "x_table_set_reflow_width", actions = xtables.set_reflow_width } +implement { name = "x_table_set_reflow_height", actions = xtables.set_reflow_height } +implement { name = "x_table_set_construct", actions = xtables.set_construct } +implement { name = "x_table_r", actions = function() context(data.currentrow or 0) end } +implement { name = "x_table_c", actions = function() context(data.currentcolumn or 0) end } diff --git a/tex/context/base/tabl-xtb.mkvi b/tex/context/base/tabl-xtb.mkvi index d0997c045..343b00620 100644 --- a/tex/context/base/tabl-xtb.mkvi +++ b/tex/context/base/tabl-xtb.mkvi @@ -98,8 +98,8 @@ \newcount\c_tabl_x_skip_mode % 1 = skip \newdimen\d_tabl_x_textwidth -\def\currentxtablerow {\ctxcommand{x_table_r()}} -\def\currentxtablecolumn{\ctxcommand{x_table_c()}} +\let\currentxtablerow \clf_x_table_r +\let\currentxtablecolumn\clf_x_table_c % \setupxtable[one][parent][a=b,c=d] % \setupxtable[one] [a=b,c=d] @@ -196,7 +196,7 @@ \unexpanded\def\tabl_x_embedded_start[#settings]#content\stopembeddedxtable {\tabl_x_prepare{#settings}% - \ctxcommand{assignbuffer("embedded_x_table",\!!bs\detokenize{#content}\!!es)}% + \clf_assignbuffer{embedded_x_table}{\detokenize{#content}}\catcodetable\relax \bgroup \let\tabl_x_start_table\tabl_x_process_buffer \edef\tabl_x_current_buffer{embedded_x_table}% @@ -250,7 +250,7 @@ }% else whitespace mess \def\tabl_x_get_buffer - {\ctxcommand{gettexbuffer("\tabl_x_current_buffer")}} + {\clf_gettexbuffer{\tabl_x_current_buffer}} \let\tabl_x_start_row_yes \relax \let\tabl_x_start_row_nop \relax @@ -267,19 +267,19 @@ {\setupbodyfont[\xtableparameter\c!bodyfont]}% \setbox\scratchbox\vbox {\doifsomething{\xtableparameter\c!spaceinbetween}{\blank[\xtableparameter\c!spaceinbetween]}}% - \ctxcommand{x_table_create { - option = "\xtableparameter\c!option", - textwidth = \number\d_tabl_x_textwidth, - textheight = \number\dimexpr\xtableparameter\c!textheight, - maxwidth = \number\dimexpr\xtableparameter\c!maxwidth, - lineheight = \number\openlineheight, - columndistance = \number\dimexpr\xtableparameter\c!columndistance, - leftmargindistance = \number\dimexpr\xtableparameter\c!leftmargindistance, - rightmargindistance = \number\dimexpr\xtableparameter\c!rightmargindistance, - rowdistance = \number\ht\scratchbox, - header = "\xtableparameter\c!header", - footer = "\xtableparameter\c!footer", - } }% + \clf_x_table_create + option {\xtableparameter\c!option}% + textwidth \d_tabl_x_textwidth + textheight \dimexpr\xtableparameter\c!textheight\relax + maxwidth \dimexpr\xtableparameter\c!maxwidth\relax + lineheight \openlineheight + columndistance \dimexpr\xtableparameter\c!columndistance\relax + leftmargindistance \dimexpr\xtableparameter\c!leftmargindistance\relax + rightmargindistance \dimexpr\xtableparameter\c!rightmargindistance\relax + rowdistance \ht\scratchbox + header {\xtableparameter\c!header}% + footer {\xtableparameter\c!footer}% + \relax % \letxtableparameter\c!option\empty % not so nice but needed as we use this in the setup @@ -294,7 +294,7 @@ \let\tabl_x_stop_cell \tabl_x_stop_cell_reflow_width \settrialtypesetting \tabl_x_get_buffer - \ctxcommand{x_table_reflow_width()}\relax + \clf_x_table_reflow_width \endgroup \begingroup \let\tabl_x_start_row_yes \tabl_x_start_row_reflow_height_yes @@ -305,7 +305,7 @@ \let\tabl_x_stop_cell \tabl_x_stop_cell_reflow_height \settrialtypesetting \tabl_x_get_buffer - \ctxcommand{x_table_reflow_height()}\relax + \clf_x_table_reflow_height \endgroup \begingroup \let\tabl_x_start_row_yes \tabl_x_start_row_construct_yes @@ -315,7 +315,7 @@ \let\tabl_x_start_cell_nop\tabl_x_start_cell_construct_nop \let\tabl_x_stop_cell \tabl_x_stop_cell_construct \tabl_x_get_buffer - \ctxcommand{x_table_construct()}\relax + \clf_x_table_construct \endgroup \endgroup % * \ifinsidesplitfloat @@ -325,7 +325,7 @@ \else \tabl_x_flush_text_checked \fi\fi - \ctxcommand{x_table_cleanup()}% + \clf_x_table_cleanup \dostoptagged \resetbuffer[\tabl_x_current_buffer]% \egroup} @@ -340,20 +340,27 @@ % in text flow: headers and footers only once \setvalue{\??xtableflushsplit\v!yes}% - {\ctxcommand{x_table_flush{ method = "\v!split" }}} + {\clf_x_table_flush + method {\v!split}% + \relax} % in text flow: headers and footers only once \setvalue{\??xtableflushsplit\v!no}% {\noindent % \dontleavehmode % else no leftskip etc - \ctxcommand{x_table_flush{ method = "\v!normal" }}% + \clf_x_table_flush + method {\v!normal}% + \relax \removeunwantedspaces} % in text flow: headers and footers get repeated \setvalue{\??xtableflushsplit\v!repeat}% {\doloop - {\ctxcommand{x_table_flush{ method = "\v!split", vsize = \number\ifdim\pagegoal=\maxdimen\textheight\else\pagegoal\fi }}% + {\clf_x_table_flush + method {\v!split}% + height \ifdim\pagegoal=\maxdimen\textheight\else\pagegoal\fi + \relax \ifcase\c_tabl_x_state \exitloop \else @@ -375,7 +382,10 @@ % \stopsetups % % \unexpanded\def\xtablesplitflush -% {\ctxcommand{x_table_flush{ method = "\v!split", vsize = \number\dimexpr\xtablesplitvsize\relax}}\relax} +% {\clf_x_table_flush +% method {\v!split}% +% height \dimexpr\xtablesplitvsize\relax +% \relax} % % \def\xtablesplitvsize % {\ifdim\pagegoal=\maxdimen\textheight\else\pagegoal\fi} @@ -385,7 +395,9 @@ \let\extratxtablesplitheight\zeropoint % might disappear so don't depend on it \unexpanded\def\tabl_x_flush_float_normal - {\ctxcommand{x_table_flush{ method = "\v!normal" }}} + {\clf_x_table_flush + method {\v!normal}% + \relax} \unexpanded\def\tabl_x_flush_float_split {\resetdirecttsplit @@ -396,9 +408,12 @@ \let\tsplitdirectwidth \d_tabl_x_final_width \handledirecttsplit} -\unexpanded\def\tabl_x_split_splitter#vsize% +\unexpanded\def\tabl_x_split_splitter#height% {\setbox\tsplitresult\vbox - {\ctxcommand{x_table_flush{ method = "\v!split", vsize = \number\dimexpr#vsize }}}% + {\clf_x_table_flush + method {\v!split}% + height \dimexpr#height\relax + \relax}% \ifcase\c_tabl_x_state \global\setfalse\somenextsplitofffloat \else @@ -411,10 +426,10 @@ \unexpanded\def\tabl_x_start_row_reflow_width_yes[#settings]% {\setupcurrentxtable[#settings]% - \ctxcommand{x_table_next_row()}} + \clf_x_table_next_row} \unexpanded\def\tabl_x_start_row_reflow_width_nop - {\ctxcommand{x_table_next_row()}} + {\clf_x_table_next_row} \unexpanded\def\tabl_x_stop_row_reflow_width {} @@ -426,16 +441,14 @@ \unexpanded\def\tabl_x_start_row_construct_yes[#settings]% {\setupcurrentxtable[#settings]% \dostarttagged\t!tablerow\empty - \ctxcommand{x_table_next_row{ - samepage = "\xtableparameter\c!samepage", - }}} + \clf_x_table_next_row_option{\xtableparameter\c!samepage}} \unexpanded\def\tabl_x_start_row_construct_nop {\dostarttagged\t!tablerow\empty - \ctxcommand{x_table_next_row()}} + \clf_x_table_next_row} \unexpanded\def\tabl_x_stop_row_construct - {\ctxcommand{x_table_finish_row()}% + {\clf_x_table_finish_row \dostoptagged} \unexpanded\def\stopxrow @@ -510,7 +523,7 @@ \fi % \d_tabl_x_distance\xtableparameter\c!distance\relax - \ctxcommand{x_table_init_reflow_width("\xtableparameter\c!option")}% + \clf_x_table_init_reflow_width_option{\xtableparameter\c!option}% \inheritedxtableframed\bgroup \tabl_x_begin_of_cell \tabl_x_set_hsize} @@ -524,7 +537,7 @@ \c_tabl_x_nx\plusone \c_tabl_x_ny\plusone \d_tabl_x_distance\xtableparameter\c!distance\relax - \ctxcommand{x_table_init_reflow_width()}% + \clf_x_table_init_reflow_width \inheritedxtableframed\bgroup \tabl_x_begin_of_cell \tabl_x_set_hsize} @@ -533,11 +546,11 @@ {\tabl_x_end_of_cell \egroup \egroup - \ctxcommand{x_table_set_reflow_width()}} + \clf_x_table_set_reflow_width} \unexpanded\def\tabl_x_start_cell_reflow_height_yes[#settings]% {\setbox\b_tabl_x\hbox\bgroup - \ctxcommand{x_table_init_reflow_height()}% + \clf_x_table_init_reflow_height \ifcase\c_tabl_x_skip_mode % can be sped up \ifnum\c_tabl_x_nesting>\plusone \letxtableparameter\c!height\v!fit % overloads given height @@ -551,7 +564,7 @@ \unexpanded\def\tabl_x_start_cell_reflow_height_nop {\setbox\b_tabl_x\hbox\bgroup - \ctxcommand{x_table_init_reflow_height()}% + \clf_x_table_init_reflow_height \ifcase\c_tabl_x_skip_mode % can be sped up \ifnum\c_tabl_x_nesting>\plusone \letxtableparameter\c!height\v!fit % overloads given height @@ -568,7 +581,7 @@ \egroup \fi \egroup - \ctxcommand{x_table_set_reflow_height()}} + \clf_x_table_set_reflow_height} \unexpanded\def\tabl_x_start_cell_construct_yes[#settings]% {\dostarttagged\t!tablecell\empty % can't we just tag the box @@ -576,7 +589,7 @@ \setupcurrentxtable[#settings]% \letxtableparameter\c!width \d_tabl_x_width % overloads given width \letxtableparameter\c!height\d_tabl_x_height % overloads given height - \ctxcommand{x_table_init_construct()}% + \clf_x_table_init_construct \inheritedxtableframed\bgroup \tabl_x_begin_of_cell \dotagxtablecell} @@ -586,7 +599,7 @@ \setbox\b_tabl_x\hbox\bgroup \letxtableparameter\c!width \d_tabl_x_width % overloads given width \letxtableparameter\c!height\d_tabl_x_height % overloads given height (commenting it ... nice option) - \ctxcommand{x_table_init_construct()}% + \clf_x_table_init_construct \inheritedxtableframed\bgroup \tabl_x_begin_of_cell \dotagxtablecell} @@ -596,7 +609,7 @@ \egroup \dotagxtablesignal % harmless spot \egroup - \ctxcommand{x_table_set_construct()}% + \clf_x_table_set_construct \dostoptagged} \unexpanded\def\startxcellgroup diff --git a/tex/context/base/typo-mar.lua b/tex/context/base/typo-mar.lua index bba8501d0..a13b3b56b 100644 --- a/tex/context/base/typo-mar.lua +++ b/tex/context/base/typo-mar.lua @@ -77,6 +77,7 @@ local format, validstring = string.format, string.valid local insert, remove = table.insert, table.remove local setmetatable, next = setmetatable, next local formatters = string.formatters +local toboolean = toboolean local attributes, nodes, node, variables = attributes, nodes, node, variables @@ -577,6 +578,11 @@ local function inject(parent,head,candidate) nofdelayed = nofdelayed + 1 status[nofstatus] = candidate -- yet untested + baseline = tonumber(baseline) + if not baseline then + baseline = toboolean(baseline) + end + -- if baseline == true then baseline = false -- hbox vtop @@ -947,4 +953,32 @@ statistics.register("margin data", function() end end) -commands.savemargindata = margins.save +interfaces.implement { + name = "savemargindata", + actions = margins.save, + arguments = { + { + { "location" }, + { "method" }, + { "category" }, + { "name" }, + { "scope" }, + { "number", "integer" }, + { "margin" }, + { "distance", "dimen" }, + { "hoffset", "dimen" }, + { "voffset", "dimen" }, + { "dy", "dimen" }, + { "bottomspace", "dimen" }, + { "baseline"}, -- dimen or string or + { "threshold", "dimen" }, + { "inline", "boolean" }, + { "anchor" }, + -- { "leftskip", "dimen" }, + -- { "rightskip", "dimen" }, + { "align" }, + { "line", "integer" }, + { "stack" }, + } + } +} diff --git a/tex/context/base/typo-mar.mkiv b/tex/context/base/typo-mar.mkiv index be24d0a90..a59a498d2 100644 --- a/tex/context/base/typo-mar.mkiv +++ b/tex/context/base/typo-mar.mkiv @@ -115,7 +115,7 @@ \c!color=, % maybe \maintextcolor % \c!name=, % \c!category=, - \c!threshold=.25ex, + \c!threshold=.25\exheight, \c!margin=\v!normal, \c!scope=\v!global, \c!width=, @@ -207,7 +207,7 @@ \the\everymargindatacontent \usemargindatastyleandcolor\c!style\c!color \setupcurrentmarginframed[\c!location=\v!normal,#textparameters]% -\typo_margins_data_synchronize + \typo_margins_data_synchronize \inheritedmarginframedframed\bgroup \ifx\currentmargindatastrut\empty \else \synchronizestrut\currentmargindatastrut @@ -223,7 +223,7 @@ \edef\currentmargindatawidth{\margindataparameter\c!width}% \ifx\currentmargindatawidth\empty \setbox\nextbox\hbox \currentmarginreference \bgroup -\typo_margins_data_synchronize + \typo_margins_data_synchronize \the\everymargindatacontent \usemargindatastyleandcolor\c!style\c!color \ifx\currentmargindatastrut\empty \else @@ -237,7 +237,7 @@ \let\currentmarginfirstheight\empty \else \setbox\nextbox\hbox \currentmarginreference \bgroup -\typo_margins_data_synchronize + \typo_margins_data_synchronize \dosetraggedcommand{\margindataparameter\c!align}% \vtop \bgroup \the\everymargindatacontent @@ -260,49 +260,49 @@ \fi \ifdone \anch_positions_initialize % we use positions at the lua end - \ctxcommand{savemargindata{ - location = "\margindataparameter\c!location", - method = "\margindataparameter\c!method", - category = "\margindataparameter\c!category", - name = "\margindataparameter\c!name", - scope = "\margindataparameter\c!scope", - number = \number\nextbox, - margin = "\margindataparameter\c!margin", % local normal margin edge - distance = \number\dimexpr\margindataparameter\c!distance, - hoffset = \number\dimexpr\margindataparameter\c!hoffset, - voffset = \number\dimexpr\margindataparameter\c!voffset, - dy = \number\dimexpr\margindataparameter\c!dy, - bottomspace = \number\dimexpr\margindataparameter\c!bottomspace, + \clf_savemargindata + location {\margindataparameter\c!location}% + method {\margindataparameter\c!method}% + category {\margindataparameter\c!category}% + name {\margindataparameter\c!name}% + scope {\margindataparameter\c!scope}% + number \nextbox + margin {\margindataparameter\c!margin}% local normal margin edge + distance \dimexpr\margindataparameter\c!distance\relax + hoffset \dimexpr\margindataparameter\c!hoffset\relax + voffset \dimexpr\margindataparameter\c!voffset\relax + dy \dimexpr\margindataparameter\c!dy\relax + bottomspace \dimexpr\margindataparameter\c!bottomspace\relax \ifx\currentmarginfirstheight\empty \else - baseline = \currentmarginfirstheight, + baseline {\currentmarginfirstheight}% \fi - threshold = \number\dimexpr\margindataparameter\c!threshold, % overlap related, will change + threshold \dimexpr\margindataparameter\c!threshold\relax % overlap related, will change \ifhmode - inline = true, + inline true % \fi - anchor = "\margindataparameter\c!anchor", + anchor {\margindataparameter\c!anchor}% % % we're not in forgetall % % \ifzeropt\leftskip \else - % leftskip = \number\leftskip, + % leftskip \dimexpr\leftskip\relax % \fi % \ifzeropt\leftskip \else - % rightskip = \number\rightskip, + % rightskip \dimexpr\rightskip\relax % \fi - align = "\margindataparameter\c!align", - line = \number\margindataparameter\c!line, - stack = "\margindataparameter\c!stack", - }}% + align {\margindataparameter\c!align}% + line \numexpr\margindataparameter\c!line\relax + stack {\margindataparameter\c!stack}% + \relax \else - \ctxcommand{savemargindata{ - location = "\margindataparameter\c!location", - method = "\margindataparameter\c!method", - category = "\margindataparameter\c!category", - name = "\margindataparameter\c!name", - scope = "\margindataparameter\c!scope", - number = \number\nextbox, - }}% + \clf_savemargindata + location {\margindataparameter\c!location}% + method {\margindataparameter\c!method}% + category {\margindataparameter\c!category}% + name {\margindataparameter\c!name}% + scope {\margindataparameter\c!scope}% + number \nextbox + \relax \fi \endgroup} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 97f3c207c..c03d650a5 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 : 03/28/15 00:06:08 +-- merge date : 03/28/15 10:30:56 do -- begin closure to overcome local limits and interference -- cgit v1.2.3