summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2014-01-25 01:44:00 +0100
committerHans Hagen <pragma@wxs.nl>2014-01-25 01:44:00 +0100
commitcd81e1891f199413dd92f125e0362dec526bf22c (patch)
tree750234ab80bb2821ae71ff857de8b7744f1c6403
parent725c6683f9b5a9a3c86ac8e2f51d283d65a12430 (diff)
downloadcontext-cd81e1891f199413dd92f125e0362dec526bf22c.tar.gz
beta 2014.01.25 01:44
-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--scripts/context/stubs/win64/mtxrun.lua6
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4120 -> 4113 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/l-lpeg.lua13
-rw-r--r--tex/context/base/node-bck.lua2
-rw-r--r--tex/context/base/node-mig.lua6
-rw-r--r--tex/context/base/node-nut.lua33
-rw-r--r--tex/context/base/node-tra.lua14
-rw-r--r--tex/context/base/spac-ali.lua3
-rw-r--r--tex/context/base/status-files.pdfbin24837 -> 24865 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin233976 -> 233976 bytes
-rw-r--r--tex/context/base/typo-bld.lua2
-rw-r--r--tex/context/base/typo-drp.lua308
-rw-r--r--tex/context/base/typo-drp.mkiv39
-rw-r--r--tex/context/base/typo-mar.lua2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
20 files changed, 364 insertions, 88 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 24f5e7744..02693a8a0 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: 29434, stripped down to: 16076
+-- original size: 29680, stripped down to: 16076
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -16705,8 +16705,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 : 687882
--- stripped bytes : 244794
+-- original bytes : 688128
+-- stripped bytes : 245040
-- end library merge
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 24f5e7744..02693a8a0 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: 29434, stripped down to: 16076
+-- original size: 29680, stripped down to: 16076
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -16705,8 +16705,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 : 687882
--- stripped bytes : 244794
+-- original bytes : 688128
+-- stripped bytes : 245040
-- end library merge
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 24f5e7744..02693a8a0 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: 29434, stripped down to: 16076
+-- original size: 29680, stripped down to: 16076
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -16705,8 +16705,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 : 687882
--- stripped bytes : 244794
+-- original bytes : 688128
+-- stripped bytes : 245040
-- end library merge
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index 24f5e7744..02693a8a0 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/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: 29434, stripped down to: 16076
+-- original size: 29680, stripped down to: 16076
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -16705,8 +16705,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 : 687882
--- stripped bytes : 244794
+-- original bytes : 688128
+-- stripped bytes : 245040
-- end library merge
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 0b15f297a..7cd5791f9 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{2014.01.24 14:17}
+\newcontextversion{2014.01.25 01:44}
%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 7e39d8c19..6fe52c591 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 59304e67e..3177cd70f 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{2014.01.24 14:17}
+\edef\contextversion{2014.01.25 01:44}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua
index 982d8f98d..6d3acd753 100644
--- a/tex/context/base/l-lpeg.lua
+++ b/tex/context/base/l-lpeg.lua
@@ -6,6 +6,10 @@ if not modules then modules = { } end modules ['l-lpeg'] = {
license = "see context related readme files"
}
+-- lpeg 12 vs lpeg 10: slower compilation, similar parsing speed (i need to check
+-- if i can use new features like capture / 2 and .B (at first sight the xml
+-- parser is some 5% slower)
+
-- a new lpeg fails on a #(1-P(":")) test and really needs a + P(-1)
-- move utf -> l-unicode
@@ -15,14 +19,15 @@ lpeg = require("lpeg")
-- The latest lpeg doesn't have print any more, and even the new ones are not
-- available by default (only when debug mode is enabled), which is a pitty as
--- as it helps bailign down bottlenecks. Performance seems comparable, although
+-- as it helps nailign down bottlenecks. Performance seems comparable: some 10%
+-- slower pattern compilation, same parsing speed, although,
--
-- local p = lpeg.C(lpeg.P(1)^0 * lpeg.P(-1))
--- local a = string.rep("123",10)
+-- local a = string.rep("123",100)
-- lpeg.match(p,a)
--
--- is nearly 20% slower and also still suboptimal (i.e. a match that runs from
--- begin to end, one of the cases where string matchers win).
+-- seems slower and is also still suboptimal (i.e. a match that runs from begin
+-- to end, one of the cases where string matchers win).
if not lpeg.print then function lpeg.print(...) print(lpeg.pcode(...)) end end
diff --git a/tex/context/base/node-bck.lua b/tex/context/base/node-bck.lua
index d756d43d6..4b7b4a064 100644
--- a/tex/context/base/node-bck.lua
+++ b/tex/context/base/node-bck.lua
@@ -176,5 +176,7 @@ end
nodes.handlers.backgrounds = function(head) local head, done = add_backgrounds (tonut(head)) return tonode(head), done end
nodes.handlers.alignbackgrounds = function(head) local head, done = add_alignbackgrounds(tonut(head)) return tonode(head), done end
+-- elsewhere: needs checking
+
tasks.appendaction("shipouts","normalizers","nodes.handlers.backgrounds")
tasks.appendaction("shipouts","normalizers","nodes.handlers.alignbackgrounds")
diff --git a/tex/context/base/node-mig.lua b/tex/context/base/node-mig.lua
index 2b35335c3..41f95be45 100644
--- a/tex/context/base/node-mig.lua
+++ b/tex/context/base/node-mig.lua
@@ -29,7 +29,7 @@ local getattr = nuts.getattr
local setfield = nuts.setfield
local setattr = nuts.setattr
-local remove_nodes = nuts.remove
+local remove_node = nuts.remove
local nodecodes = nodes.nodecodes
local hlist_code = nodecodes.hlist
@@ -56,7 +56,7 @@ local function locate(head,first,last,ni,nm)
current = getnext(current)
elseif migrate_inserts and id == insert_code then
local insert
- head, current, insert = remove_nodes(head,current)
+ head, current, insert = remove_node(head,current)
setfield(insert,"next",nil)
if first then
setfield(insert,"prev",last)
@@ -69,7 +69,7 @@ local function locate(head,first,last,ni,nm)
ni = ni + 1
elseif migrate_marks and id == mark_code then
local mark
- head, current, mark = remove_nodes(head,current)
+ head, current, mark = remove_node(head,current)
setfield(mark,"next",nil)
if first then
setfield(mark,"prev",last)
diff --git a/tex/context/base/node-nut.lua b/tex/context/base/node-nut.lua
index b933ff096..33116d1b1 100644
--- a/tex/context/base/node-nut.lua
+++ b/tex/context/base/node-nut.lua
@@ -243,12 +243,41 @@ local function remove(head,current,free_too)
d_free_node(t)
t = nil
else
- d_setfield(t,"next",nil)
- d_setfield(t,"prev",nil)
+ d_setfield(t,"next",nil) -- not that much needed (slows down unless we check the source on this)
+ d_setfield(t,"prev",nil) -- not that much needed (slows down unless we check the source on this)
end
return head, current, t
end
+-- bad: we can have prev's being glue_spec
+
+-- local function remove(head,current,free_too) -- d_remove_node does a slide which can fail
+-- local prev = d_getprev(current) -- weird
+-- local next = d_getnext(current)
+-- if next then
+-- -- print("!!!!!!!! prev is gluespec",
+-- -- nodes.nodecodes[d_getid(current)],
+-- -- nodes.nodecodes[d_getid(next)],
+-- -- nodes.nodecodes[d_getid(prev)])
+-- d_setfield(prev,"next",next)
+-- d_setfield(next,"prev",prev)
+-- else
+-- d_setfield(prev,"next",nil)
+-- end
+-- if free_too then
+-- d_free_node(current)
+-- current = nil
+-- else
+-- d_setfield(current,"next",nil) -- use this fact !
+-- d_setfield(current,"prev",nil) -- use this fact !
+-- end
+-- if head == current then
+-- return next, next, current
+-- else
+-- return head, next, current
+-- end
+-- end
+
nuts.remove = remove
function nuts.delete(head,current)
diff --git a/tex/context/base/node-tra.lua b/tex/context/base/node-tra.lua
index 89c3e52f9..081107277 100644
--- a/tex/context/base/node-tra.lua
+++ b/tex/context/base/node-tra.lua
@@ -653,3 +653,17 @@ end
tracers.rule = nodestracerpool.rule -- for a while
+-- local function show(head,n,message)
+-- print("START",message or "")
+-- local i = 0
+-- for current in traverse(head) do
+-- local prev = getprev(current)
+-- local next = getnext(current)
+-- i = i + 1
+-- print(i, prev and nodecodes[getid(prev)],nodecodes[getid(current)],next and nodecodes[getid(next)])
+-- if i == n then
+-- break
+-- end
+-- end
+-- print("STOP", message or "")
+-- end
diff --git a/tex/context/base/spac-ali.lua b/tex/context/base/spac-ali.lua
index cf7d45172..eb93458e0 100644
--- a/tex/context/base/spac-ali.lua
+++ b/tex/context/base/spac-ali.lua
@@ -10,9 +10,6 @@ local div = math.div
local format = string.format
local tasks = nodes.tasks
-local appendaction = tasks.appendaction
-local prependaction = tasks.prependaction
-local disableaction = tasks.disableaction
local enableaction = tasks.enableaction
local nuts = nodes.nuts
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 0cc6af901..61b38c046 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.pdf b/tex/context/base/status-lua.pdf
index 69b99c513..fa11c6428 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/typo-bld.lua b/tex/context/base/typo-bld.lua
index 8d9ad616a..04bf226c1 100644
--- a/tex/context/base/typo-bld.lua
+++ b/tex/context/base/typo-bld.lua
@@ -241,7 +241,7 @@ function builders.buildpage_filter(groupcode)
stoptiming(builders)
-- -- doesn't work here (not passed on?)
-- tex.pagegoal = tex.vsize - tex.dimen.d_page_floats_inserted_top - tex.dimen.d_page_floats_inserted_bottom
- texlists.contrib_head = head
+ texlists.contrib_head = head or nil -- needs checking
return done and head or true
else
if trace_page_builder then
diff --git a/tex/context/base/typo-drp.lua b/tex/context/base/typo-drp.lua
index b3f840ae1..57818d62f 100644
--- a/tex/context/base/typo-drp.lua
+++ b/tex/context/base/typo-drp.lua
@@ -11,9 +11,7 @@ if not modules then modules = { } end modules ['typo-drp'] = {
local tonumber, type, next = tonumber, type, next
local ceil = math.ceil
-
-local utfbyte = utf.byte
-local utfchar = utf.char
+local settings_to_hash = utilities.parsers.settings_to_hash
local trace_initials = false trackers.register("typesetters.initials", function(v) trace_initials = v end)
local report_initials = logs.reporter("nodes","initials")
@@ -49,10 +47,17 @@ local new_kern = nodepool.kern
local insert_before = nuts.insert_before
local insert_after = nuts.insert_after
+local remove_node = nuts.remove
+local traverse_id = nuts.traverse_id
+local traverse = nuts.traverse
+local free_node = nuts.free
local variables = interfaces.variables
local v_default = variables.default
local v_margin = variables.margin
+local v_auto = variables.auto
+local v_first = variables.first
+local v_last = variables.last
local texget = tex.get
local texsetattribute = tex.setattribute
@@ -60,7 +65,8 @@ local unsetvalue = attributes.unsetvalue
local glyph_code = nodecodes.glyph
local hlist_code = nodecodes.hlist
-local kern_node = nodecodes.kern
+local glue_code = nodecodes.glue
+local kern_code = nodecodes.kern
local whatsit_code = nodecodes.whatsit
local localpar_code = whatsitcodes.localpar
@@ -72,6 +78,8 @@ local a_color = attributes.private('color')
local a_transparency = attributes.private('transparency')
local a_colorspace = attributes.private('colormodel')
+local category = characters.category
+
local settings = nil
function initials.set(specification)
@@ -100,6 +108,99 @@ commands.setinitial = initials.set
-- todo: prevent linebreak .. but normally a initial ends up at the top of
-- a page so this has a low priority
+-- actions[v_default] = function(head,setting)
+-- local done = false
+-- if getid(head) == whatsit_code and getsubtype(head) == localpar_code then
+-- -- begin of par
+-- local first = getnext(head)
+-- -- parbox .. needs to be set at 0
+-- if first and getid(first) == hlist_code then
+-- first = getnext(first)
+-- end
+-- -- we need to skip over kerns and glues (signals)
+-- while first and getid(first) ~= glyph_code do
+-- first = getnext(first)
+-- end
+-- if first and getid(first) == glyph_code then
+-- local char = getchar(first)
+-- local prev = getprev(first)
+-- local next = getnext(first)
+-- -- if getid(prev) == hlist_code then
+-- -- -- set the width to 0
+-- -- end
+-- if next and getid(next) == kern_code then
+-- setfield(next,"kern",0)
+-- end
+-- if setting.font then
+-- setfield(first,"font",setting.font)
+-- end
+-- if setting.dynamic > 0 then
+-- setattr(first,0,setting.dynamic)
+-- end
+-- -- can be a helper
+-- local ma = setting.ma or 0
+-- local ca = setting.ca
+-- local ta = setting.ta
+-- if ca and ca > 0 then
+-- setattr(first,a_colorspace,ma == 0 and 1 or ma)
+-- setattr(first,a_color,ca)
+-- end
+-- if ta and ta > 0 then
+-- setattr(first,a_transparency,ta)
+-- end
+-- --
+-- local width = getfield(first,"width")
+-- local height = getfield(first,"height")
+-- local depth = getfield(first,"depth")
+-- local distance = setting.distance or 0
+-- local voffset = setting.voffset or 0
+-- local hoffset = setting.hoffset or 0
+-- local parindent = tex.parindent
+-- local baseline = texget("baselineskip").width
+-- local lines = tonumber(setting.n) or 0
+-- --
+-- setfield(first,"xoffset",- width - hoffset - distance - parindent)
+-- setfield(first,"yoffset",- voffset) -- no longer - height here
+-- -- We pack so that successive handling cannot touch the dropped cap. Packaging
+-- -- in a hlist is also needed because we cannot locally adapt e.g. parindent (not
+-- -- yet stored in with localpar).
+-- setfield(first,"prev",nil)
+-- setfield(first,"next",nil)
+-- local h = hpack_nodes(first)
+-- setfield(h,"width",0)
+-- setfield(h,"height",0)
+-- setfield(h,"depth",0)
+-- setfield(prev,"next",h)
+-- setfield(next,"prev",h)
+-- setfield(h,"next",next)
+-- setfield(h,"prev",prev)
+-- first = h
+-- -- end of packaging
+-- if setting.location == v_margin then
+-- -- okay
+-- else
+-- if lines == 0 then -- safeguard, not too precise
+-- lines = ceil((height+voffset) / baseline)
+-- end
+-- -- We cannot set parshape yet ... when we can I'll add a slope
+-- -- option (positive and negative, in emwidth).
+-- local hangafter = - lines
+-- local hangindent = width + distance + parindent
+-- if trace_initials then
+-- report_initials("setting hangafter to %i and hangindent to %p",hangafter,hangindent)
+-- end
+-- tex.hangafter = hangafter
+-- tex.hangindent = hangindent
+-- if parindent ~= 0 then
+-- insert_after(first,first,new_kern(-parindent))
+-- end
+-- end
+-- done = true
+-- end
+-- end
+-- return head, done
+-- end
+
actions[v_default] = function(head,setting)
local done = false
if getid(head) == whatsit_code and getsubtype(head) == localpar_code then
@@ -114,60 +215,173 @@ actions[v_default] = function(head,setting)
first = getnext(first)
end
if first and getid(first) == glyph_code then
- local char = getchar(first)
- local prev = getprev(first)
- local next = getnext(first)
- -- if getid(prev) == hlist_code then
- -- -- set the width to 0
- -- end
- if next and getid(next) == kern_node then
- setfield(next,"kern",0)
- end
- if setting.font then
- setfield(first,"font",setting.font)
- end
- if setting.dynamic > 0 then
- setattr(first,0,setting.dynamic)
- end
- -- can be a helper
- local ma = setting.ma or 0
- local ca = setting.ca
- local ta = setting.ta
- if ca and ca > 0 then
- setattr(first,a_colorspace,ma == 0 and 1 or ma)
- setattr(first,a_color,ca)
- end
- if ta and ta > 0 then
- setattr(first,a_transparency,ta)
- end
- --
- local width = getfield(first,"width")
- local height = getfield(first,"height")
- local depth = getfield(first,"depth")
+
+-- show(head,8,"one")
+
+ local ma = setting.ma or 0
+ local ca = setting.ca
+ local ta = setting.ta
+ local last = first
local distance = setting.distance or 0
local voffset = setting.voffset or 0
local hoffset = setting.hoffset or 0
local parindent = tex.parindent
local baseline = texget("baselineskip").width
local lines = tonumber(setting.n) or 0
+ local dynamic = setting.dynamic
+ local font = setting.font
+ local method = settings_to_hash(setting.method)
+ local length = tonumber(setting.m) or 1
+ --
+ -- 1 char | n chars | skip first quote | ignore punct | keep punct
--
- setfield(first,"xoffset",- width - hoffset - distance - parindent)
- setfield(first,"yoffset",- voffset) -- no longer - height here
+ if method[v_auto] then
+ local char = getchar(first)
+ local kind = category(char)
+ if kind == "po" or kind == "pi" then
+ if method[v_first] then
+ -- remove quote etc before initial
+ local next = getnext(first)
+ if not next then
+ -- don't start with a quote or so
+ return head, false
+ end
+ last = nil
+ for current in traverse_id(glyph_code,next) do
+ head, first = remove_node(head,first,true)
+ first = current
+ last = first
+ break
+ end
+ if not last then
+ -- no following glyph or so
+ return head, false
+ end
+ else
+ -- keep quote etc with initial
+ local next = getnext(first)
+ if not next then
+ -- don't start with a quote or so
+ return head, false
+ end
+ for current in traverse_id(glyph_code,next) do
+ last = current
+ break
+ end
+ if last == first then
+ return head, false
+ end
+ end
+ elseif kind == "pf" then
+ -- error: final quote
+ else
+ -- okay
+ end
+ local next = getnext(first)
+ if next then
+ for current in traverse_id(glyph_code,next) do
+ local char = getchar(current)
+ local kind = category(char)
+ if kind == "po" then
+ if method[v_last] then
+ -- remove period etc after initial
+ remove_node(head,current,true)
+ else
+ -- keep period etc with initial
+ last = current
+ end
+ end
+ break
+ end
+ end
+ else
+ for current in traverse_id(glyph_code,first) do
+ last = current
+ if length <= 1 then
+ break
+ else
+ length = length - 1
+ end
+ end
+ end
+ local current = first
+ while true do
+ local id = getid(current)
+ if id == kern_code then
+ setfield(current,"kern",0)
+ elseif id == glyph_code then
+ local next = getnext(current)
+ if font then
+ setfield(current,"font",font)
+ end
+ if dynamic > 0 then
+ setattr(current,0,dynamic)
+ end
+ -- can be a helper
+ if ca and ca > 0 then
+ setattr(current,a_colorspace,ma == 0 and 1 or ma)
+ setattr(current,a_color,ca)
+ end
+ if ta and ta > 0 then
+ setattr(current,a_transparency,ta)
+ end
+ --
+ end
+ if current == last then
+ break
+ else
+ current = getnext(current)
+ end
+ end
-- We pack so that successive handling cannot touch the dropped cap. Packaging
-- in a hlist is also needed because we cannot locally adapt e.g. parindent (not
-- yet stored in with localpar).
+ local prev = getprev(first)
+ local next = getnext(last)
+ --
setfield(first,"prev",nil)
- setfield(first,"next",nil)
- local h = hpack_nodes(first)
- setfield(h,"width",0)
- setfield(h,"height",0)
- setfield(h,"depth",0)
- setfield(prev,"next",h)
- setfield(next,"prev",h)
- setfield(h,"next",next)
- setfield(h,"prev",prev)
- first = h
- -- end of packaging
+ setfield(last,"next",nil)
+ local dropper = hpack_nodes(first)
+ local width = getfield(dropper,"width")
+ local height = getfield(dropper,"height")
+ local depth = getfield(dropper,"depth")
+ setfield(dropper,"width",0)
+ setfield(dropper,"height",0)
+ setfield(dropper,"depth",0)
+ --
+ setfield(prev,"next",dropper)
+ if next then
+ setfield(next,"prev",dropper)
+ end
+ setfield(dropper,"next",next)
+ setfield(dropper,"prev",prev)
+ --
+ if next then
+ local current = next
+ while current do
+ local id = getid(current)
+ if id == glue_code or id == kern_code then
+ local next = getnext(current)
+ -- remove_node(current,current,true) -- created an invalid next link and dangling remains
+ remove_node(head,current,true)
+ current = next
+ else
+ break
+ end
+ end
+ end
+ --
+ local hoffset = width + hoffset + distance + parindent
+ for current in traverse_id(glyph_code,first) do
+ setfield(current,"xoffset",- hoffset )
+ setfield(current,"yoffset",- voffset) -- no longer - height here
+ if current == last then
+ break
+ end
+ end
+ --
+ first = dropper
+ --
if setting.location == v_margin then
-- okay
else
diff --git a/tex/context/base/typo-drp.mkiv b/tex/context/base/typo-drp.mkiv
index 78f6df0a2..a266bfdbe 100644
--- a/tex/context/base/typo-drp.mkiv
+++ b/tex/context/base/typo-drp.mkiv
@@ -57,6 +57,8 @@
\setupinitial
[\c!location=\v!text,
\c!n=3,
+ \c!m=1,
+ \c!method=\v!none,
% \s!font=Bold sa 4,
% \s!font=Bold ht \measure{initial:n},
\s!font=Bold cp \measure{initial:n},
@@ -67,7 +69,7 @@
\c!color=,
\c!before=\blank]
-\unexpanded\def\placeinitial
+\unexpanded\def\placeinitial % we cannot group so no settings
{\dosingleempty\typo_initials_place}
\def\typo_initials_place[#1]% old command
@@ -96,17 +98,19 @@
{\useinitialstyleparameter\c!style}%
\useinitialcolorparameter\c!color
\ctxcommand{setinitial{
- location = "\initialparameter\c!location",
- enabled = true,
- n = \number\scratchcounter,
- distance = \number\scratchdistance,
- hoffset = \number\scratchhoffset,
- voffset = \number\scratchvoffset,
- ma = \the\attribute\colormodelattribute ,
- ca = \the\attribute\colorattribute ,
- ta = \the\attribute\transparencyattribute,
- font = \fontid\font,
- dynamic = \number\attribute\zerocount, % it's a bit over the top to support this here
+ location = "\initialparameter\c!location",
+ enabled = true,
+ n = \number\scratchcounter,
+ m = \number\initialparameter\c!m,
+ method = "\initialparameter\c!method",
+ distance = \number\scratchdistance,
+ hoffset = \number\scratchhoffset,
+ voffset = \number\scratchvoffset,
+ ma = \the\attribute\colormodelattribute,
+ ca = \the\attribute\colorattribute,
+ ta = \the\attribute\transparencyattribute,
+ font = \fontid\font,
+ dynamic = \number\attribute\zerocount, % it's a bit over the top to support this here
}}%
\stopluacode
\kern\zeropoint % we need a node
@@ -115,4 +119,15 @@
\let\typo_initial_handle\relax
+% \startbuffer
+% \placeinitial[two] D. E. Knuth \ignorespaces\input knuth \par
+% \placeinitial[two] Knuth \ignorespaces\input knuth \par
+% \placeinitial[two] \quotation{D. E. Knuth} \ignorespaces\input knuth \par
+% \placeinitial[two] \quotation {Knuth} \ignorespaces\input knuth \par
+% \stopbuffer
+
+% \type{m=2} \defineinitial[two][m=2] \getbuffer \page
+% \type{m=1,method=auto} \defineinitial[two][m=1,method=auto] \getbuffer \page
+% \type{m=1,method={auto,first,last}} \defineinitial[two][m=1,method={first,auto,last}] \getbuffer \page
+
\protect \endinput
diff --git a/tex/context/base/typo-mar.lua b/tex/context/base/typo-mar.lua
index a8f08dd79..7c03bf0a9 100644
--- a/tex/context/base/typo-mar.lua
+++ b/tex/context/base/typo-mar.lua
@@ -344,7 +344,7 @@ function margins.save(t)
--
-- t.realpageno = texgetcount("realpageno")
if inline then
- context(tonode(new_usernumber(inline_mark,nofsaved))) -- or use a normal node
+ context(tonode(new_usernumber(inline_mark,nofsaved))) -- or use a normal node
store[nofsaved] = t -- no insert
nofinlined = nofinlined + 1
else
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index c9c0304e5..e90447c18 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 : 01/24/14 14:17:19
+-- merge date : 01/25/14 01:44:16
do -- begin closure to overcome local limits and interference