summaryrefslogtreecommitdiff
path: root/tex/context
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-07-26 21:34:14 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2018-07-26 21:34:14 +0200
commit1add40ac787d36d3bd40e196aea752dff2cfb769 (patch)
treec109f4b7a8a69de8071b6f937954ab06a4de26de /tex/context
parent669436bb34437aee17f1823836cbbb16c570a505 (diff)
downloadcontext-1add40ac787d36d3bd40e196aea752dff2cfb769.tar.gz
2018-07-26 20:48:00
Diffstat (limited to 'tex/context')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-mis.lua2
-rw-r--r--tex/context/base/mkiv/font-otl.lua2
-rw-r--r--tex/context/base/mkiv/font-oup.lua3
-rw-r--r--tex/context/base/mkiv/node-par.lua2
-rw-r--r--tex/context/base/mkiv/page-lay.mkiv1
-rw-r--r--tex/context/base/mkiv/page-one.mkiv1
-rw-r--r--tex/context/base/mkiv/page-txt.mkvi6
-rw-r--r--tex/context/base/mkiv/scrp-eth.lua84
-rw-r--r--tex/context/base/mkiv/scrp-ini.lua194
-rw-r--r--tex/context/base/mkiv/scrp-tib.lua93
-rw-r--r--tex/context/base/mkiv/spac-ver.lua111
-rw-r--r--tex/context/base/mkiv/spac-ver.mkiv20
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26171 -> 26178 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin265128 -> 264394 bytes
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin846988 -> 846843 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin61213 -> 61209 bytes
-rw-r--r--tex/context/modules/mkiv/m-maybe.mkiv57
-rw-r--r--tex/context/modules/mkiv/m-scite.mkiv15
22 files changed, 312 insertions, 287 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 2370467b3..7cb24385a 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2018.07.25 19:41}
+\newcontextversion{2018.07.26 20:40}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index 0fe486458..7e37a446c 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.07.25 19:41}
+\edef\contextversion{2018.07.26 20:40}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 1acfee799..3de47eb86 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2018.07.25 19:41}
+\newcontextversion{2018.07.26 20:40}
%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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 086eceada..63ac7b100 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -42,7 +42,7 @@
%D has to match \type {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.07.25 19:41}
+\edef\contextversion{2018.07.26 20:40}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-mis.lua b/tex/context/base/mkiv/font-mis.lua
index e1f158c83..ac697295d 100644
--- a/tex/context/base/mkiv/font-mis.lua
+++ b/tex/context/base/mkiv/font-mis.lua
@@ -21,7 +21,7 @@ local readers = otf.readers
if readers then
- otf.version = otf.version or 3.103
+ otf.version = otf.version or 3.104
otf.cache = otf.cache or containers.define("fonts", "otl", otf.version, true)
function fonts.helpers.getfeatures(name,save)
diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua
index 4ddbcf8b4..abb0ebd14 100644
--- a/tex/context/base/mkiv/font-otl.lua
+++ b/tex/context/base/mkiv/font-otl.lua
@@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading")
local fonts = fonts
local otf = fonts.handlers.otf
-otf.version = 3.103 -- beware: also sync font-mis.lua and in mtx-fonts
+otf.version = 3.104 -- beware: also sync font-mis.lua and in mtx-fonts
otf.cache = containers.define("fonts", "otl", otf.version, true)
otf.svgcache = containers.define("fonts", "svg", otf.version, true)
otf.sbixcache = containers.define("fonts", "sbix", otf.version, true)
diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua
index 79ac76abe..7ba8af8b1 100644
--- a/tex/context/base/mkiv/font-oup.lua
+++ b/tex/context/base/mkiv/font-oup.lua
@@ -674,7 +674,8 @@ local function unifyglyphs(fontdata,usenames)
for index=1,#glyphs do
local glyph = glyphs[index]
local unicode = glyph.unicode -- this is the primary one
- if not unicode then
+ -- if not unicode then -- some fonts use the private space
+ if not unicode or unicode >= private or (unicode >= 0xE000 and unicode <= 0xF8FF) or unicode == 0xFFFE or unicode == 0xFFFF then
-- report("assigning private unicode %U to glyph indexed %05X (%s)",private,index,"unset")
unicode = private
-- glyph.unicode = -1
diff --git a/tex/context/base/mkiv/node-par.lua b/tex/context/base/mkiv/node-par.lua
index 4afaef220..bcb4621c9 100644
--- a/tex/context/base/mkiv/node-par.lua
+++ b/tex/context/base/mkiv/node-par.lua
@@ -22,6 +22,6 @@ end
if LUATEXFUNCTIONALITY > 6857 then
- callback.register("insert_local_par",everypar,"paragraph start")
+ callbacks.register("insert_local_par",everypar,"paragraph start")
end
diff --git a/tex/context/base/mkiv/page-lay.mkiv b/tex/context/base/mkiv/page-lay.mkiv
index d285c3a58..071a270e1 100644
--- a/tex/context/base/mkiv/page-lay.mkiv
+++ b/tex/context/base/mkiv/page-lay.mkiv
@@ -996,6 +996,7 @@
\newdimen\d_page_adepts_pushed_text_height
\newdimen\d_page_adepts_pushed_footer_height
\newdimen\d_page_adepts_height
+\newdimen\d_page_adapts_delta
\unexpanded\def\adaptlayout
{\dodoubleempty\page_adapts_layout}
diff --git a/tex/context/base/mkiv/page-one.mkiv b/tex/context/base/mkiv/page-one.mkiv
index 348c301fc..27b5ae022 100644
--- a/tex/context/base/mkiv/page-one.mkiv
+++ b/tex/context/base/mkiv/page-one.mkiv
@@ -73,6 +73,7 @@
\else
\global\vsize\textheight
\fi
+ \global\advance\vsize\d_page_adapts_delta
% alternatively we could set it in builders.buildpage_filter
% \ifdim\pagegoal<\maxdimen .. \fi
\global\pagegoal\dimexpr\vsize-\d_page_floats_inserted_top-\d_page_floats_inserted_bottom\relax}
diff --git a/tex/context/base/mkiv/page-txt.mkvi b/tex/context/base/mkiv/page-txt.mkvi
index 2640633ec..00e329c01 100644
--- a/tex/context/base/mkiv/page-txt.mkvi
+++ b/tex/context/base/mkiv/page-txt.mkvi
@@ -854,6 +854,10 @@
% \let\page_prepare_backgrounds\gobbleoneargument
% \fi
+% only for very special controlled cases or experiments:
+
+\let\page_scale_text_box\gobbleoneargument
+
\def\page_insert_body#1#2%
{\setbox\b_page_layouts_element\vpack
{\offinterlineskip
@@ -863,7 +867,6 @@
\vskip\dimexpr\headerheight+\headerdistance+\textdistance\relax
\dontleavehmode
%\page_prepare_backgrounds{#2}%
-% \hbox to \makeupwidth
\hpack to \makeupwidth
{\begingroup
\swapmargins
@@ -881,6 +884,7 @@
\settextpagecontent\b_page_layouts_element{#1}{#2}%
\page_backgrounds_add_to_text\b_page_layouts_element
\page_grids_add_to_box\b_page_layouts_element
+ \page_scale_text_box\b_page_layouts_element
\box\b_page_layouts_element
\begingroup
\ifdim\rightmarginwidth>\zeropoint
diff --git a/tex/context/base/mkiv/scrp-eth.lua b/tex/context/base/mkiv/scrp-eth.lua
index 2be77a2ce..cd2280c31 100644
--- a/tex/context/base/mkiv/scrp-eth.lua
+++ b/tex/context/base/mkiv/scrp-eth.lua
@@ -12,71 +12,16 @@ if not modules then modules = { } end modules ['scrp-eth'] = {
local nuts = nodes.nuts
local getnext = nuts.getnext
-local getfont = nuts.getfont
-local getid = nuts.getid
+local getchar = nuts.getchar
local getattr = nuts.getattr
-local insert_node_before = nuts.insert_before
-
-local nodepool = nuts.pool
-
-local new_glue = nodepool.glue
-local new_penalty = nodepool.penalty
-
local nodecodes = nodes.nodecodes
local glyph_code = nodecodes.glyph
local a_scriptstatus = attributes.private('scriptstatus')
-local a_scriptinjection = attributes.private('scriptinjection')
-local categorytonumber = scripts.categorytonumber
local numbertocategory = scripts.numbertocategory
-local hash = scripts.hash
-local numbertodataset = scripts.numbertodataset
-
-local fonthashes = fonts.hashes
-local parameters = fonthashes.parameters
-
-local space, stretch, shrink, lastfont
-
-local inter_character_space_factor = 1
-local inter_character_stretch_factor = 1
-local inter_character_shrink_factor = 1
-
-local function space_glue(current)
- local data = numbertodataset[getattr(current,a_scriptinjection)]
- if data then
- inter_character_space_factor = data.inter_character_space_factor or 1
- inter_character_stretch_factor = data.inter_character_stretch_factor or 1
- inter_character_shrink_factor = data.inter_character_shrink_factor or 1
- end
- local font = getfont(current)
- if lastfont ~= font then
- local pf = parameters[font]
- space = pf.space
- stretch = pf.space_stretch
- shrink = pf.space_shrink
- lastfont = font
- end
- return new_glue(
- inter_character_space_factor * space,
- inter_character_stretch_factor * stretch,
- inter_character_shrink_factor * shrink
- )
-end
-
-local function insert_space_before(head,current)
- return insert_node_before(head,current,space_glue(current))
-end
-
-local function insert_zerowidthspace_before(head,current)
- return insert_node_before(head,current,new_glue(0))
-end
-
-local function insert_nobreakspace_before(head,current)
- head, current = insert_node_before(head,current,new_penalty(10000))
- return insert_node_before(head,current,space_glue(current))
-end
+local inserters = scripts.inserters
-- syllable [zerowidthspace] syllable
-- syllable [zerowidthspace] word
@@ -88,21 +33,22 @@ end
-- sentence [space] word
-- sentence [space] sentence
+
local injectors = { -- [previous] [current]
ethiopic_syllable = {
- ethiopic_syllable = insert_zerowidthspace_before,
- ethiopic_word = insert_nobreakspace_before,
- ethiopic_sentence = insert_nobreakspace_before,
+ ethiopic_syllable = inserters.zerowidthspace_before,
+ ethiopic_word = inserters.nobreakspace_before,
+ ethiopic_sentence = inserters.nobreakspace_before,
},
ethiopic_word = {
- ethiopic_syllable = insert_space_before,
- ethiopic_word = insert_space_before,
- ethiopic_sentence = insert_space_before,
+ ethiopic_syllable = inserters.space_before,
+ ethiopic_word = inserters.space_before,
+ ethiopic_sentence = inserters.space_before,
},
ethiopic_sentence = {
- ethiopic_syllable = insert_space_before,
- ethiopic_word = insert_space_before,
- ethiopic_sentence = insert_space_before,
+ ethiopic_syllable = inserters.space_before,
+ ethiopic_word = inserters.space_before,
+ ethiopic_sentence = inserters.space_before,
},
}
@@ -111,8 +57,8 @@ local function process(head,first,last)
local injector = false
local current = first
while current do
- local id = getid(current)
- if id == glyph_code then
+ local char, id = ischar(current)
+ if char then
local scriptstatus = getattr(current,a_scriptstatus)
local category = numbertocategory[scriptstatus]
if injector then
@@ -122,8 +68,6 @@ local function process(head,first,last)
end
end
injector = injectors[category]
- else
- -- nothing yet
end
if current == last then
break
diff --git a/tex/context/base/mkiv/scrp-ini.lua b/tex/context/base/mkiv/scrp-ini.lua
index 3cac3f9de..d1ba30cab 100644
--- a/tex/context/base/mkiv/scrp-ini.lua
+++ b/tex/context/base/mkiv/scrp-ini.lua
@@ -22,73 +22,75 @@ local report_splitting = logs.reporter("scripts","splitting")
local utfbyte, utfsplit = utf.byte, utf.split
local gmatch = string.gmatch
-local attributes = attributes
-local nodes = nodes
-local context = context
+local attributes = attributes
+local nodes = nodes
+local context = context
-local texsetattribute = tex.setattribute
+local texsetattribute = tex.setattribute
-local nodecodes = nodes.nodecodes
-local unsetvalue = attributes.unsetvalue
+local nodecodes = nodes.nodecodes
+local unsetvalue = attributes.unsetvalue
-local implement = interfaces.implement
+local implement = interfaces.implement
-local glyph_code = nodecodes.glyph
-local glue_code = nodecodes.glue
+local glyph_code = nodecodes.glyph
+local glue_code = nodecodes.glue
-local emwidths = fonts.hashes.emwidths
-local exheights = fonts.hashes.exheights
+local emwidths = fonts.hashes.emwidths
+local exheights = fonts.hashes.exheights
-local a_scriptinjection = attributes.private('scriptinjection')
-local a_scriptsplitting = attributes.private('scriptsplitting')
-local a_scriptstatus = attributes.private('scriptstatus')
+local a_scriptinjection = attributes.private('scriptinjection')
+local a_scriptsplitting = attributes.private('scriptsplitting')
+local a_scriptstatus = attributes.private('scriptstatus')
-local fontdata = fonts.hashes.identifiers
-local allocate = utilities.storage.allocate
-local setnodecolor = nodes.tracers.colors.set
-local setmetatableindex = table.setmetatableindex
+local fontdata = fonts.hashes.identifiers
+local allocate = utilities.storage.allocate
+local setnodecolor = nodes.tracers.colors.set
+local setmetatableindex = table.setmetatableindex
-local enableaction = nodes.tasks.enableaction
-local disableaction = nodes.tasks.disableaction
+local enableaction = nodes.tasks.enableaction
+local disableaction = nodes.tasks.disableaction
-local nuts = nodes.nuts
+local nuts = nodes.nuts
-local getnext = nuts.getnext
-local getchar = nuts.getchar
-local getfont = nuts.getfont
-local getid = nuts.getid
-local getattr = nuts.getattr
-local setattr = nuts.setattr
-local isglyph = nuts.isglyph
+local getnext = nuts.getnext
+local getchar = nuts.getchar
+local getfont = nuts.getfont
+local getid = nuts.getid
+local getattr = nuts.getattr
+local setattr = nuts.setattr
+local isglyph = nuts.isglyph
-local insert_node_after = nuts.insert_after
-local first_glyph = nuts.first_glyph
+local insert_node_after = nuts.insert_after
+local insert_node_before = nuts.insert_before
------ traverse_id = nuts.traverse_id
------ traverse_char = nuts.traverse_char
-local nextglyph = nuts.traversers.glyph
-local nextchar = nuts.traversers.char
+local first_glyph = nuts.first_glyph
-local nodepool = nuts.pool
+----- traverse_id = nuts.traverse_id
+----- traverse_char = nuts.traverse_char
+local nextglyph = nuts.traversers.glyph
+local nextchar = nuts.traversers.char
-local new_glue = nodepool.glue
-local new_rule = nodepool.rule
-local new_penalty = nodepool.penalty
+local nodepool = nuts.pool
-scripts = scripts or { }
-local scripts = scripts
+local new_glue = nodepool.glue
+local new_rule = nodepool.rule
+local new_penalty = nodepool.penalty
-scripts.hash = scripts.hash or { }
-local hash = scripts.hash
+scripts = scripts or { }
+local scripts = scripts
-local handlers = allocate()
-scripts.handlers = handlers
+scripts.hash = scripts.hash or { }
+local hash = scripts.hash
-local injectors = allocate()
-scripts.injectors = handlers
+local handlers = allocate()
+scripts.handlers = handlers
-local splitters = allocate()
-scripts.splitters = splitters
+local injectors = allocate()
+scripts.injectors = handlers
+
+local splitters = allocate()
+scripts.splitters = splitters
local hash = { -- we could put these presets in char-def.lua
--
@@ -206,9 +208,12 @@ local hash = { -- we could put these presets in char-def.lua
--
[0x1361] = "ethiopic_word",
[0x1362] = "ethiopic_sentence",
+ --
-- tibetan:
+ --
[0x0F0B] = "breaking_tsheg",
[0x0F0C] = "nonbreaking_tsheg",
+
}
local function provide(t,k)
@@ -271,6 +276,7 @@ function scripts.installmethod(handler)
report_preprocessing("missing (default) dataset in script %a",name)
datasets.default = { } -- slower but an error anyway
end
+
for k, v in next, datasets do
setmetatableindex(v,defaults)
end
@@ -707,32 +713,6 @@ end)
local categories = characters.categories or { }
--- local function hit(root,head)
--- local current = getnext(head)
--- local lastrun = false
--- local lastfinal = false
--- while current and getid(current) == glyph_code do
--- local char = getchar(current)
--- local newroot = root[char]
--- if newroot then
--- local final = newroot.final
--- if final then
--- lastrun = current
--- lastfinal = final
--- end
--- root = newroot
--- elseif categories[char] == "mn" then
--- -- continue
--- else
--- return lastrun, lastfinal
--- end
--- current = getnext(current)
--- end
--- if lastrun then
--- return lastrun, lastfinal
--- end
--- end
-
local function hit(root,head)
local current = getnext(head)
local lastrun = false
@@ -1029,3 +1009,69 @@ implement {
name = "resetscript",
actions = scripts.reset
}
+
+-- some common helpers
+
+
+do
+
+ local parameters = fonts.hashes.parameters
+
+ local space, stretch, shrink, lastfont
+
+ local inter_character_space_factor = 1
+ local inter_character_stretch_factor = 1
+ local inter_character_shrink_factor = 1
+
+ local function space_glue(current)
+ local data = numbertodataset[getattr(current,a_scriptinjection)]
+ if data then
+ inter_character_space_factor = data.inter_character_space_factor or 1
+ inter_character_stretch_factor = data.inter_character_stretch_factor or 1
+ inter_character_shrink_factor = data.inter_character_shrink_factor or 1
+ end
+ local font = getfont(current)
+ if lastfont ~= font then
+ local pf = parameters[font]
+ space = pf.space
+ stretch = pf.space_stretch
+ shrink = pf.space_shrink
+ lastfont = font
+ end
+ return new_glue(
+ inter_character_space_factor * space,
+ inter_character_stretch_factor * stretch,
+ inter_character_shrink_factor * shrink
+ )
+ end
+
+ scripts.inserters = {
+
+ space_before = function(head,current)
+ return insert_node_before(head,current,space_glue(current))
+ end,
+ space_after = function(head,current)
+ return insert_node_after(head,current,space_glue(current))
+ end,
+
+ zerowidthspace_before = function(head,current)
+ return insert_node_before(head,current,new_glue(0))
+ end,
+ zerowidthspace_after = function(head,current)
+ return insert_node_after(head,current,new_glue(0))
+ end,
+
+ nobreakspace_before = function(head,current)
+ head, current = insert_node_before(head,current,new_penalty(10000))
+ return insert_node_before(head,current,space_glue(current))
+ end,
+ nobreakspace_after = function(head,current)
+ head, current = insert_node_after(head,current,space_glue(current))
+ return insert_node_after(head,current,new_penalty(10000))
+ end,
+
+ }
+
+end
+
+-- end of helpers
diff --git a/tex/context/base/mkiv/scrp-tib.lua b/tex/context/base/mkiv/scrp-tib.lua
index 2c4032f99..b67f69648 100644
--- a/tex/context/base/mkiv/scrp-tib.lua
+++ b/tex/context/base/mkiv/scrp-tib.lua
@@ -6,85 +6,20 @@ if not modules then modules = { } end modules ['scrp-tib'] = {
license = "see context related readme files"
}
--- at some point I will review the script code but for the moment we
--- do it this way; so space settings like with cjk yet
-
local nuts = nodes.nuts
local getnext = nuts.getnext
-local getfont = nuts.getfont
------ getid = nuts.getid
local getattr = nuts.getattr
local ischar = nuts.ischar
-local insert_node_after = nuts.insert_after
-local insert_node_before = nuts.insert_before
-
-local nodepool = nuts.pool
-
-local new_glue = nodepool.glue
-local new_penalty = nodepool.penalty
-
-local nodecodes = nodes.nodecodes
-local glyph_code = nodecodes.glyph
-
local a_scriptstatus = attributes.private('scriptstatus')
-local a_scriptinjection = attributes.private('scriptinjection')
-local categorytonumber = scripts.categorytonumber
local numbertocategory = scripts.numbertocategory
-local hash = scripts.hash
-local numbertodataset = scripts.numbertodataset
-
--- can be shared:
-
-local fonthashes = fonts.hashes
-local parameters = fonthashes.parameters
-
-local space, stretch, shrink, lastfont
-
-local inter_character_space_factor = 1
-local inter_character_stretch_factor = 1
-local inter_character_shrink_factor = 1
-
-local function space_glue(current)
- local data = numbertodataset[getattr(current,a_scriptinjection)]
- if data then
- inter_character_space_factor = data.inter_character_space_factor or 1
- inter_character_stretch_factor = data.inter_character_stretch_factor or 1
- inter_character_shrink_factor = data.inter_character_shrink_factor or 1
- end
- local font = getfont(current)
- if lastfont ~= font then
- local pf = parameters[font]
- space = pf.space
- stretch = pf.space_stretch
- shrink = pf.space_shrink
- lastfont = font
- end
- return new_glue(
- inter_character_space_factor * space,
- inter_character_stretch_factor * stretch,
- inter_character_shrink_factor * shrink
- )
-end
+local inserters = scripts.inserters
-local function insert_space_after(head,current)
- return insert_node_after(head,current,space_glue(current))
-end
-
--- local function insert_space_before(head,current)
--- return insert_node_before(head,current,space_glue(current))
--- end
-
-local function insert_zerowidthspace_before(head,current)
- return insert_node_before(head,current,new_glue(0))
-end
-
-local function insert_nobreakspace_before(head,current)
- head, current = insert_node_before(head,current,new_penalty(10000))
- return insert_node_before(head,current,space_glue(current))
-end
+local injectors = {
+ breaking_tsheg = inserters.space_after,
+}
-- more efficient is to check directly
--
@@ -97,22 +32,20 @@ end
--
-- but this is more general
-local injectors = {
- breaking_tsheg = insert_space_after,
-}
-
local function process(head,first,last)
if first ~= last then
local current = first
while current do
local char, id = ischar(current)
- local scriptstatus = getattr(current,a_scriptstatus)
- if scriptstatus and scriptstatus > 0 then
- local category = numbertocategory[scriptstatus]
- if category then
- local injector = injectors[category]
- if injector then
- head, current = insert_space_after(head,current)
+ if char then
+ local scriptstatus = getattr(current,a_scriptstatus)
+ if scriptstatus and scriptstatus > 0 then
+ local category = numbertocategory[scriptstatus]
+ if category then
+ local injector = injectors[category]
+ if injector then
+ head, current = injector(head,current)
+ end
end
end
end
diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua
index 06b05f5e0..aae9913f7 100644
--- a/tex/context/base/mkiv/spac-ver.lua
+++ b/tex/context/base/mkiv/spac-ver.lua
@@ -2040,65 +2040,82 @@ do
local ignoredepth = -65536000
- function vspacing.synchronizepage()
+ -- A previous version analyzed the number of lines moved to the next page in
+ -- synchronizepage because prevgraf is unreliable in that case. However, we cannot
+ -- tweak that parameter because it is also used in postlinebreak and hangafter, so
+ -- there is a danger for interference. Therefore we now do it dynamically.
+
+ -- We can also support other lists but there prevgraf probably is ok.
+
+ function vspacing.getnofpreviouslines(head)
if enabled then
- local newdepth = outer.prevdepth
- local olddepth = newdepth
- local oldlines = outer.prevgraf
- local newlines = 0
- local head = texlists.page_head
+ if not thead then
+ head = texlists.page_head
+ end
+ local noflines = 0
if head then
- head = tonut(head)
- if getid(head) == glue_code and getsubtype(head) == topskip_code then
- local tail = find_node_tail(head)
- while tail do
- local id = getid(tail)
- if id == hlist_code then
- if getsubtype(tail) == line_code then
- newlines = newlines + 1
- else
- break
- end
- elseif id == vlist_code then
+ local tail = find_node_tail(tonut(head))
+ while tail do
+ local id = getid(tail)
+ if id == hlist_code then
+ if getsubtype(tail) == line_code then
+ noflines = noflines + 1
+ else
break
- elseif id == glue_code then
- local subtype = getsubtype(tail)
- if subtype == baselineskip_code or subtype == lineskip_code then
- -- we're ok
- elseif subtype == parskip_code then
- if getwidth(tail) > 0 then
- break
- else
- -- we assume we're ok
- end
+ end
+ elseif id == vlist_code then
+ break
+ elseif id == glue_code then
+ local subtype = getsubtype(tail)
+ if subtype == baselineskip_code or subtype == lineskip_code then
+ -- we're ok
+ elseif subtype == parskip_code then
+ if getwidth(tail) > 0 then
+ break
+ else
+ -- we assume we're ok
end
- elseif id == penalty_code then
- -- we're probably ok
- elseif id == rule_code or id == kern_code then
- break
- else
- -- ins, mark, boundary, whatsit
end
- tail = getprev(tail)
+ elseif id == penalty_code then
+ -- we're probably ok
+ elseif id == rule_code or id == kern_code then
+ break
+ else
+ -- ins, mark, boundary, whatsit
end
+ tail = getprev(tail)
end
- else
- newdepth = ignoredepth
- texset("prevdepth",ignoredepth)
- outer.prevdepth = ignoredepth
- end
- texset("prevgraf", newlines)
- outer.prevgraf = newlines
- if trace then
- report("page %i, prevdepth %p => %p, prevgraf %i => %i",
- texgetcount("realpageno"),olddepth,newdepth,oldlines,newlines)
- report("list %s",nodes.idsandsubtypes(head))
end
+ return noflines
end
end
+ interfaces.implement {
+ name = "getnofpreviouslines",
+ public = true,
+ actions = vspacing.getnofpreviouslines,
+ }
-
+ function vspacing.synchronizepage()
+ if enabled then
+ if trace then
+ local newdepth = outer.prevdepth
+ local olddepth = newdepth
+ if not texlists.page_head then
+ newdepth = ignoredepth
+ texset("prevdepth",ignoredepth)
+ outer.prevdepth = ignoredepth
+ end
+ report("page %i, prevdepth %p => %p",texgetcount("realpageno"),olddepth,newdepth)
+ -- report("list %s",nodes.idsandsubtypes(head))
+ else
+ if not texlists.page_head then
+ texset("prevdepth",ignoredepth)
+ outer.prevdepth = ignoredepth
+ end
+ end
+ end
+ end
local trace = false
diff --git a/tex/context/base/mkiv/spac-ver.mkiv b/tex/context/base/mkiv/spac-ver.mkiv
index be1f7bdba..074edd969 100644
--- a/tex/context/base/mkiv/spac-ver.mkiv
+++ b/tex/context/base/mkiv/spac-ver.mkiv
@@ -1312,13 +1312,21 @@
\let\normaloffinterlineskip\offinterlineskip % knuth's original
-%D This is tricky. The prevdepth value is still set to the last
-%D one even if there is nothing on the page. The same is true for
-%D prevgraf, which doesn't resemble the value on the current page.
+%D This is tricky. The prevdepth value is still set to the last one even if there is
+%D nothing on the page. The same is true for prevgraf, which doesn't resemble the
+%D value on the current page.
%D
-%D So, here we kick in a checker but it has to happen after the
-%D output group and it only has to be done once (output can trigger
-%D itself!).
+%D So, here we kick in a checker but it has to happen after the output group and it
+%D only has to be done once (output can trigger itself!).
+%D
+%D However, prevgraf is somehow bound to hangindent so we can get very
+%D nasty side effects. So, in tne end we use our own variable!
+
+\ifdefined\getnofpreviouslines
+ % defined public at the lua end
+\else
+ \let\getnofpreviouslines\!!zerocount
+\fi
\unexpanded\def\page_otr_synchronize_page_yes
{\aftergroup\page_otr_synchronize_page_indeed
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 407b77157..0aad91c73 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 4e682b70b..b3ef64c67 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index f405eb969..e1a52e7d5 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 13d951b1d..620d1d368 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/context/modules/mkiv/m-maybe.mkiv b/tex/context/modules/mkiv/m-maybe.mkiv
new file mode 100644
index 000000000..d019828f5
--- /dev/null
+++ b/tex/context/modules/mkiv/m-maybe.mkiv
@@ -0,0 +1,57 @@
+%D \module
+%D [ file=m-maybe,
+%D version=2018.07.26,
+%D title=\CONTEXT\ Extra Modules,
+%D subtitle=Maybe some day,
+%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.
+
+%D The code here is not in the core and might never be as it's probably not
+%D of much use and|/|or can interfere.
+
+\unprotect
+
+% \showframe
+% \starttext
+% \tweakpagegoal[-\lineheight]
+% \dorecurse{40}{\inleftmargin{!}\input ward\par}
+% \stoptext
+
+\def\page_scale_text_box_indeed#1%
+ {\scratchheight\ht#1\relax
+ \scratchwidth \wd#1\relax
+ \setbox#1\vpack\bgroup
+ \hpack\bgroup
+ \scale
+ [\c!height=\dimexpr\textheight-\d_page_adapts_delta\relax,
+ \c!width=\scratchwidth]
+ {\box#1}%
+ \egroup
+ \egroup
+ \global\d_page_adapts_delta\zeropoint
+ \glet\page_scale_text_box\gobbleoneargument
+ \ht#1\scratchheight
+ \wd#1\scratchwidth}
+
+\unexpanded\def\tweakpagegoal[#1]%
+ {\ifx\currentoutputroutine\s!singlecolumn
+ \global\d_page_adapts_delta\dimexpr#1\relax
+ \ifdim\d_page_adapts_delta=\zeropoint
+ \glet\page_scale_text_box\gobbleoneargument
+ \else
+ \glet\page_scale_text_box\page_scale_text_box_indeed
+ \fi
+ \else
+ \global\d_page_adapts_delta\zeropoint
+ \glet\page_scale_text_box\gobbleoneargument
+ \fi
+ \page_otr_command_set_vsize}
+
+\protect
+
+\endinput
diff --git a/tex/context/modules/mkiv/m-scite.mkiv b/tex/context/modules/mkiv/m-scite.mkiv
index 92a498b37..f1a45574e 100644
--- a/tex/context/modules/mkiv/m-scite.mkiv
+++ b/tex/context/modules/mkiv/m-scite.mkiv
@@ -102,7 +102,8 @@ local function exportcolors()
local function black(f)
return (f[1] == f[2]) and (f[2] == f[3]) and (f[3] == 0)
end
- local result, r = { f_mapping }, 1
+-- local result, r = { f_mapping }, 1
+local result, r = { }, 0
for k, v in table.sortedhash(lexer.context.styles) do
local fore = v.fore
if fore and not black(fore) then
@@ -347,6 +348,18 @@ visualizers.register("sql", visualizer)
\let\slxe \space
\let\slxbreak\relax
+\let\slxL \letterleftbrace
+\let\slxR \letterrightbrace
+\let\slxM \letterdollar
+\let\slxV \letterbar
+\let\slxU \letterhat
+\let\slxD \letterunderscore
+\let\slxH \letterhash
+\let\slxB \letterbackslash
+\let\slxP \letterpercent
+\let\slxT \lettertilde
+\let\slxS \fixedspace
+
\let\slxS \buff_scite_slxs
\let\slxF \buff_scite_slxf