summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-01-14 17:29:49 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-01-14 17:29:49 +0100
commita16cd078a5cc00d7c789093b5209b6f8d2dfdb1a (patch)
tree3385cd79be0c9b3b66ed3c465b03eefc92001b21 /tex/context/base
parent52c5102fab837626fe9bb359b3eda6066e1a968e (diff)
downloadcontext-a16cd078a5cc00d7c789093b5209b6f8d2dfdb1a.tar.gz
2018-01-14 16:05:00
Diffstat (limited to 'tex/context/base')
-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/mkii/mult-nl.mkii14
-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-gbn.lua2
-rw-r--r--tex/context/base/mkiv/lang-mis.mkiv35
-rw-r--r--tex/context/base/mkiv/mtx-context-listing.tex16
-rw-r--r--tex/context/base/mkiv/mtx-context-meaning.tex83
-rw-r--r--tex/context/base/mkiv/spac-ali.mkiv7
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25770 -> 25775 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin250727 -> 250728 bytes
-rw-r--r--tex/context/base/mkiv/strc-con.mkvi12
-rw-r--r--tex/context/base/mkiv/task-ini.lua6
-rw-r--r--tex/context/base/mkiv/typo-del.mkiv24
-rw-r--r--tex/context/base/mkiv/typo-fln.lua40
16 files changed, 213 insertions, 34 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 81868a917..15910dcf9 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.01.12 15:56}
+\newcontextversion{2018.01.14 15:55}
%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 4c654db20..4a48e5d24 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.01.12 15:56}
+\edef\contextversion{2018.01.14 15:55}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-nl.mkii b/tex/context/base/mkii/mult-nl.mkii
index b67d7d7ae..ba7c5a42c 100644
--- a/tex/context/base/mkii/mult-nl.mkii
+++ b/tex/context/base/mkii/mult-nl.mkii
@@ -376,6 +376,7 @@
\setinterfacevariable{norepeat}{norepeat}
\setinterfacevariable{normal}{normaal}
\setinterfacevariable{nospacing}{geenspatiering}
+\setinterfacevariable{nostopper}{geenafsluiter}
\setinterfacevariable{not}{niet}
\setinterfacevariable{notation}{notation}
\setinterfacevariable{note}{note}
@@ -621,6 +622,10 @@
\setinterfaceconstant{align}{uitlijnen}
\setinterfaceconstant{aligncharacter}{karakteruitlijnen}
\setinterfaceconstant{alignmentcharacter}{uitlijnkarakter}
+\setinterfaceconstant{alignmentleftsample}{alignmentleftsample}
+\setinterfaceconstant{alignmentleftwidth}{alignmentleftwidth}
+\setinterfaceconstant{alignmentrightsample}{alignmentrightsample}
+\setinterfaceconstant{alignmentrightwidth}{alignmentrightwidth}
\setinterfaceconstant{alignsymbol}{alignsymbol}
\setinterfaceconstant{aligntitle}{titeluitlijnen}
\setinterfaceconstant{alternative}{variant}
@@ -907,6 +912,7 @@
\setinterfaceconstant{leftoffset}{linkeroffset}
\setinterfaceconstant{leftquotation}{linkercitaat}
\setinterfaceconstant{leftquote}{linkerciteer}
+\setinterfaceconstant{leftsample}{leftsample}
\setinterfaceconstant{leftsentence}{linkerzin}
\setinterfaceconstant{leftspeech}{linkeruitspraak}
\setinterfaceconstant{leftstyle}{linkerletter}
@@ -978,7 +984,8 @@
\setinterfaceconstant{nleft}{nlinks}
\setinterfaceconstant{nlines}{nregels}
\setinterfaceconstant{norm}{norm}
-\setinterfaceconstant{note}{note}
+\setinterfaceconstant{note}{noot}
+\setinterfaceconstant{notes}{noten}
\setinterfaceconstant{nr}{nr}
\setinterfaceconstant{nright}{nrechts}
\setinterfaceconstant{ntop}{nboven}
@@ -998,6 +1005,7 @@
\setinterfaceconstant{numberset}{numberset}
\setinterfaceconstant{numberstarter}{numberstarter}
\setinterfaceconstant{numberstopper}{numberstopper}
+\setinterfaceconstant{numberstrut}{nummerstrut}
\setinterfaceconstant{numberstyle}{nummerletter}
\setinterfaceconstant{numberwidth}{nummerbreedte}
\setinterfaceconstant{nx}{nx}
@@ -1109,6 +1117,7 @@
\setinterfaceconstant{rightoffset}{rechteroffset}
\setinterfaceconstant{rightquotation}{rechtercitaat}
\setinterfaceconstant{rightquote}{rechterciteer}
+\setinterfaceconstant{rightsample}{rightsample}
\setinterfaceconstant{rightsentence}{rechterzin}
\setinterfaceconstant{rightspeech}{rechteruitspraak}
\setinterfaceconstant{rightstyle}{rechterletter}
@@ -1165,7 +1174,9 @@
\setinterfaceconstant{source}{bron}
\setinterfaceconstant{space}{spatie}
\setinterfaceconstant{spaceafter}{nawit}
+\setinterfaceconstant{spaceafterside}{witnazij}
\setinterfaceconstant{spacebefore}{voorwit}
+\setinterfaceconstant{spacebeforeside}{witvoorzij}
\setinterfaceconstant{spaceinbetween}{tussenwit}
\setinterfaceconstant{spacing}{spatiering}
\setinterfaceconstant{specification}{specification}
@@ -1230,6 +1241,7 @@
\setinterfaceconstant{titledistance}{titelafstand}
\setinterfaceconstant{titleleft}{titellinks}
\setinterfaceconstant{titleright}{titelrechts}
+\setinterfaceconstant{titlestrut}{titelstrut}
\setinterfaceconstant{titlestyle}{titelletter}
\setinterfaceconstant{to}{aan}
\setinterfaceconstant{toffset}{toffset}
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index df7d91ce0..cd2bb382b 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.01.12 15:56}
+\newcontextversion{2018.01.14 15:55}
%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 54316346a..f9958698d 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -41,7 +41,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.01.12 15:56}
+\edef\contextversion{2018.01.14 15:55}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-gbn.lua b/tex/context/base/mkiv/font-gbn.lua
index 3256a1649..8f1acac65 100644
--- a/tex/context/base/mkiv/font-gbn.lua
+++ b/tex/context/base/mkiv/font-gbn.lua
@@ -235,7 +235,7 @@ function nodes.handlers.nodepass(head,groupcode,size,packtype,direction)
end
function nodes.handlers.basepass(head)
- if not basemodepass then
+ if basemodepass then
head = n_ligaturing(head)
head = n_kerning(head)
end
diff --git a/tex/context/base/mkiv/lang-mis.mkiv b/tex/context/base/mkiv/lang-mis.mkiv
index e8609ec04..eb7dc7d80 100644
--- a/tex/context/base/mkiv/lang-mis.mkiv
+++ b/tex/context/base/mkiv/lang-mis.mkiv
@@ -139,16 +139,13 @@
%D \stop
%D \macros
-%D {compoundhyphen,
-%D beginofsubsentence,endofsubsentence}
+%D {compoundhyphen}
%D
%D Now let's go to the macros. First we define some variables. In the main \CONTEXT\
%D modules these can be tuned by a setup command. Watch the (maybe) better looking
%D compound hyphen.
\ifx\compoundhyphen \undefined \unexpanded\def\compoundhyphen {\hbox{-\kern-.25ex-}} \fi
-\ifx\beginofsubsentence\undefined \unexpanded\def\beginofsubsentence{\hbox{\emdash}} \fi
-\ifx\endofsubsentence \undefined \unexpanded\def\endofsubsentence {\hbox{\emdash}} \fi
%D The last two variables are needed for subsentences |<|like this one|>| which we
%D did not yet mention. We want to enable breaking but at the same time don't want
@@ -162,14 +159,17 @@
\unexpanded\def\permithyphenation{\ifhmode\prewordbreak\fi} % doesn't remove spaces
%D \macros
-%D {beginofsubsentencespacing,endofsubsentencespacing}
+%D {beginofsubsentence,endofsubsentence,
+%D beginofsubsentencespacing,endofsubsentencespacing}
%D
%D In the previous macros we provided two hooks which can be used to support nested
%D sub||sentences. In \CONTEXT\ these hooks are used to insert a small space when
%D needed.
-\ifx\beginofsubsentencespacing\undefined \let\beginofsubsentencespacing\relax \fi
-\ifx\endofsubsentencespacing \undefined \let\endofsubsentencespacing \relax \fi
+% \ifx\beginofsubsentence \undefined \unexpanded\def\beginofsubsentence{\hbox{\emdash}} \fi
+% \ifx\endofsubsentence \undefined \unexpanded\def\endofsubsentence {\hbox{\emdash}} \fi
+% \ifx\beginofsubsentencespacing\undefined \let\beginofsubsentencespacing\relax \fi
+% \ifx\endofsubsentencespacing \undefined \let\endofsubsentencespacing \relax \fi
%D The following piece of code is a torture test compound handling. The \type
%D {\relax} before the \type {\ifmmode} is needed because of the alignment scanner
@@ -313,7 +313,7 @@
\prewordbreak\discretionary{\hbox{#2}}{}{\hbox{#2}}\allowbreak\postwordbreak
\fi\fi
\fi\fi
- \nextnextnext} % lookahead in commands
+ \nextnextnext}
%D \macros
%D {directdiscretionary}
@@ -412,14 +412,27 @@
{\prewordbreak\discretionary{\hbox{\normalstartimath|\normalstopimath}}{}{\hbox{\normalstartimath|\normalstopimath}}%
\allowbreak\postwordbreak} % bugged
+% \definetextmodediscretionary <
+% {\beginofsubsentence\prewordbreak\beginofsubsentencespacing}
+%
+% \definetextmodediscretionary >
+% {\endofsubsentencespacing\prewordbreak\endofsubsentence}
+%
+% \definetextmodediscretionary =
+% {\prewordbreak\midsentence\prewordbreak}
+
\definetextmodediscretionary <
- {\beginofsubsentence\prewordbreak\beginofsubsentencespacing}
+ {\beginofsubsentence\prewordbreak\beginofsubsentencespacing
+ \aftergroup\ignorespaces} % tricky, we need to go over the \nextnextnext
\definetextmodediscretionary >
- {\endofsubsentencespacing\prewordbreak\endofsubsentence}
+ {\removeunwantedspaces
+ \endofsubsentencespacing\prewordbreak\endofsubsentence}
\definetextmodediscretionary =
- {\prewordbreak\midsentence\prewordbreak} % {\prewordbreak\compoundhyphen}
+ {\removeunwantedspaces
+ \prewordbreak\midsentence\prewordbreak
+ \aftergroup\ignorespaces}
% french
diff --git a/tex/context/base/mkiv/mtx-context-listing.tex b/tex/context/base/mkiv/mtx-context-listing.tex
index 41e468e1f..f7c3d2868 100644
--- a/tex/context/base/mkiv/mtx-context-listing.tex
+++ b/tex/context/base/mkiv/mtx-context-listing.tex
@@ -97,12 +97,15 @@
context.usemodule { "scite" }
end
- if #document.files > 0 then
+ local done = false
+ local files = document.files
+
+ if #files > 0 then
if document.arguments.sort then
- table.sort(document.files)
+ table.sort(files)
end
- for i=1,#document.files do
- local filename = document.files[i]
+ for i=1,#files do
+ local filename = files[i]
if not string.find(filename,"^mtx%-context%-") then
local pretty = document.arguments.pretty
if pretty == true then
@@ -129,9 +132,12 @@
else
context.typefile(filename)
end
+ done = true
end
end
- else
+ end
+
+ if not done then
context("no files given")
end
diff --git a/tex/context/base/mkiv/mtx-context-meaning.tex b/tex/context/base/mkiv/mtx-context-meaning.tex
new file mode 100644
index 000000000..88ca21759
--- /dev/null
+++ b/tex/context/base/mkiv/mtx-context-meaning.tex
@@ -0,0 +1,83 @@
+%D \module
+%D [ file=mtx-context-meaning,
+%D version=2018.01.12,
+%D title=\CONTEXT\ Extra Trickry,
+%D subtitle=Show Meanings,
+%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.
+
+% begin help
+%
+% usage: context --extra=meaning [options] list-of-commands
+%
+% --pattern : match given pattern
+%
+% example: context --extra=meaning --pattern=*paper*
+% context --extra=meaning setuplayout
+% context --extra=meaning setup_layout
+%
+% end help
+
+\input mtx-context-common.tex
+
+\setupbodyfont
+ [dejavu]
+
+\def\showmeaning#1%
+ {\writestatus{meaning}{\strippedcsname#1}%
+ \writestring{}%
+ \writestring{\expandafter\meaning\begincsname#1\endcsname}}
+
+\starttext
+
+\startluacode
+ local h = tex.hashtokens()
+
+ local function showmeaning(str)
+ local s = string.gsub(str,"^\\","")
+ local p = "^" .. string.topattern(s) .. "$"
+ context("pattern: ")
+ context.type(s)
+ context.blank()
+ for i=1,#h do
+ local hi = h[i]
+ if string.find(h[i],p) then
+ context.type(hi)
+ context.par()
+ context.showmeaning(hi)
+ end
+ end
+ context.page()
+ end
+
+ local done = false
+ local pattern = document.arguments.pattern
+
+ if pattern then
+ pattern = { pattern}
+ else
+ pattern = document.files
+ end
+
+ if type(pattern) == "table" then
+ table.sort(pattern)
+ for i=1,#pattern do
+ local p = pattern[i]
+ if not string.find(p,"^mtx%-context%-") then
+ done = true
+ showmeaning(p)
+ end
+ end
+ end
+
+ if not done then
+ context("no search pattern given")
+ end
+\stopluacode
+
+\stoptext
diff --git a/tex/context/base/mkiv/spac-ali.mkiv b/tex/context/base/mkiv/spac-ali.mkiv
index eff4cbcbf..e5e7bd40f 100644
--- a/tex/context/base/mkiv/spac-ali.mkiv
+++ b/tex/context/base/mkiv/spac-ali.mkiv
@@ -791,10 +791,17 @@
\setvalue{\??aligncommand\v!extremestretch }{\toksapp\t_spac_align_collected{\spac_align_set_extreme_stretch}}
\setvalue{\??aligncommand \v!final}{\c_spac_align_state_par_fill\plusone}
+\setvalue{\??aligncommand1*\v!final}{\c_spac_align_state_par_fill\plusone}
\setvalue{\??aligncommand2*\v!final}{\c_spac_align_state_par_fill\plustwo} % hardcoded multiplier
\setvalue{\??aligncommand3*\v!final}{\c_spac_align_state_par_fill\plusthree}
\setvalue{\??aligncommand4*\v!final}{\c_spac_align_state_par_fill\plusfour}
+% a one shot (only usefull in e.g. framed, also needs tolerance and stretch)
+
+\setvalue{\??aligncommand \v!more}{\toksapp\t_spac_align_collected{\looseness\plusone}}
+\setvalue{\??aligncommand1*\v!more}{\toksapp\t_spac_align_collected{\looseness\plusone}}
+\setvalue{\??aligncommand2*\v!more}{\toksapp\t_spac_align_collected{\looseness\plustwo}}
+
% \setvalue{\??aligncommand ... }{\toksapp\t_spac_align_collected{\nopenalties}}
% \setvalue{\??aligncommand ... }{\toksapp\t_spac_align_collected{\setdefaultpenalties}}
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index c5feca20c..b04345260 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 044d5ab28..60dc11947 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/base/mkiv/strc-con.mkvi b/tex/context/base/mkiv/strc-con.mkvi
index 0aa7e69da..57b69cc7f 100644
--- a/tex/context/base/mkiv/strc-con.mkvi
+++ b/tex/context/base/mkiv/strc-con.mkvi
@@ -524,6 +524,11 @@
[\v!empty]
[\c!renderingsetup=\??constructionrenderings:\v!empty]
+\defineconstructionalternative
+ [\v!label]
+ [\c!renderingsetup=\??constructionrenderings:\v!label,
+ \c!width=]
+
\newbox \constructionheadbox
\newskip \leftconstructionskip
\newskip \rightconstructionskip
@@ -906,6 +911,13 @@
\ignorespaces
\stopsetups
+\startsetups[\??constructionrenderings:\v!label]
+ \dontleavehmode
+ \begingroup
+ \constructionparameter\c!headcommand{\flushconstructionheadbox}
+ \endgroup
+\stopsetups
+
% you can use \placeclosesymbol or \qed to place a symbol at the end of a
% construction
diff --git a/tex/context/base/mkiv/task-ini.lua b/tex/context/base/mkiv/task-ini.lua
index 36b346342..f41fb9b08 100644
--- a/tex/context/base/mkiv/task-ini.lua
+++ b/tex/context/base/mkiv/task-ini.lua
@@ -44,15 +44,15 @@ appendaction("processors", "characters", "scripts.injectors.handler")
appendaction("processors", "words", "languages.words.check") -- disabled -- might move up, no disc check needed then
appendaction("processors", "words", "languages.hyphenators.handler") -- always on
appendaction("processors", "words", "typesetters.initials.handler") -- disabled -- might move up
-appendaction("processors", "words", "typesetters.firstlines.handler") -- disabled -- might move down
+appendaction("processors", "words", "typesetters.firstlines.handler") -- disabled
appendaction("processors", "fonts", "builders.paragraphs.solutions.splitters.split") -- experimental
appendaction("processors", "fonts", "nodes.handlers.characters") -- maybe todo
appendaction("processors", "fonts", "nodes.injections.handler")
appendaction("processors", "fonts", "typesetters.fontkerns.handler")
appendaction("processors", "fonts", "nodes.handlers.protectglyphs", nil, "nohead") -- maybe todo
-appendaction("processors", "fonts", "builders.kernel.ligaturing") -- always on (could be selective: if only node mode)
-appendaction("processors", "fonts", "builders.kernel.kerning") -- always on (could be selective: if only node mode)
+appendaction("processors", "fonts", "builders.kernel.ligaturing") -- not always on (could be selective: if only node mode)
+appendaction("processors", "fonts", "builders.kernel.kerning") -- not always on (could be selective: if only node mode)
appendaction("processors", "fonts", "nodes.handlers.stripping") -- disabled (might move)
------------("processors", "fonts", "typesetters.italics.handler") -- disabled (after otf/kern handling)
appendaction("processors", "fonts", "nodes.handlers.flatten")
diff --git a/tex/context/base/mkiv/typo-del.mkiv b/tex/context/base/mkiv/typo-del.mkiv
index 1ef7f74c6..33688b9d3 100644
--- a/tex/context/base/mkiv/typo-del.mkiv
+++ b/tex/context/base/mkiv/typo-del.mkiv
@@ -140,6 +140,18 @@
% \def\beforesubsentence{\removeunwantedspaces}
% \def\aftersubsentence {\ignorespaces}
+\newconditional\c_typo_subsentence_cleanup % \settrue\c_typo_subsentence_cleanup
+
+\def\typo_subsentence_cleanup_start
+ {\ifconditional\c_typo_subsentence_cleanup
+ \expandafter\ignorespaces
+ \fi}
+
+\def\typo_subsentence_cleanup_stop
+ {\ifconditional\c_typo_subsentence_cleanup
+ \removeunwantedspaces
+ \fi}
+
\unexpanded\def\midsentence
{\dostarttagged\t!subsentencesymbol\empty
\dotagsetsubsentencesymbol\s!middle
@@ -162,10 +174,11 @@
\symbol[\ifodd\c_typo_subsentence_nesting\c!leftsentence\else\c!leftsubsentence\fi]%
\dostoptagged
\dostarttagged\t!subsentencecontent\empty
- }% \ignorespaces}
+ \typo_subsentence_cleanup_start}
\unexpanded\def\endofsubsentence % relax prevents space gobbling
- {\dostoptagged
+ {\typo_subsentence_cleanup_stop
+ \dostoptagged
\dostarttagged\t!subsentencesymbol\empty
\dotagsetsubsentencesymbol\s!right
\symbol[\ifodd\c_typo_subsentence_nesting\c!rightsentence\else\c!rightsubsentence\fi]%
@@ -184,7 +197,7 @@
\unskip
\hskip\hspaceamount\currentusedlanguage{intersentence}%
% no good, actually language dependent:
-% \ignorespaces
+ % \ignorespaces
\else
\unskip
\fi}
@@ -199,9 +212,10 @@
%D \typebuffer
%D \getbuffer
-\unexpanded\def\startsubsentence{\beginofsubsentence \prewordbreak\beginofsubsentencespacing}
-\unexpanded\def\stopsubsentence {\endofsubsentencespacing\prewordbreak\endofsubsentence}
+\unexpanded\def\startsubsentence{\beginofsubsentence\prewordbreak\beginofsubsentencespacing\typo_subsentence_cleanup_start}
+\unexpanded\def\stopsubsentence {\typo_subsentence_cleanup_stop\endofsubsentencespacing\prewordbreak\endofsubsentence}
\unexpanded\def\subsentence {\groupedcommand\startsubsentence\stopsubsentence}
+\unexpanded\def\midsubsentence {\typo_subsentence_cleanup_start\prewordbreak\midsentence\prewordbreak\typo_subsentence_cleanup_stop}
\definehspace [quotation] [\zeropoint]
\definehspace [interquotation] [.125em]
diff --git a/tex/context/base/mkiv/typo-fln.lua b/tex/context/base/mkiv/typo-fln.lua
index 0cebd4b37..4fb82ce44 100644
--- a/tex/context/base/mkiv/typo-fln.lua
+++ b/tex/context/base/mkiv/typo-fln.lua
@@ -38,7 +38,8 @@ local getprev = nuts.getprev
local getboth = nuts.getboth
local setboth = nuts.setboth
local getid = nuts.getid
-local getfield = nuts.getfield
+local getsubtype = nuts.getsubtype
+local getwidth = nuts.getwidth
local getlist = nuts.getlist
local setlist = nuts.setlist
local getattr = nuts.getattr
@@ -53,14 +54,19 @@ local nodecodes = nodes.nodecodes
local glyph_code = nodecodes.glyph
local disc_code = nodecodes.disc
local kern_code = nodecodes.kern
+local glue_code = nodecodes.glue
+
+local spaceskip_code = nodes.gluecodes.spaceskip
local traverse_id = nuts.traverse_id
local flush_node_list = nuts.flush_list
local flush_node = nuts.flush_node
local copy_node_list = nuts.copy_list
+local insert_node_before = nuts.insert_before
local insert_node_after = nuts.insert_after
local remove_node = nuts.remove
local list_dimensions = nuts.dimensions
+local hpack_node_list = nuts.hpack
local nodepool = nuts.pool
local newpenalty = nodepool.penalty
@@ -114,7 +120,7 @@ implement {
}
actions[v_line] = function(head,setting)
- -- local attribute = fonts.specifiers.contextnumber(setting.feature) -- was experimental
+ -- local attribute = fonts.specifiers.contextnumber(setting.feature) -- was experimental
local dynamic = setting.dynamic
local font = setting.font
local noflines = setting.n or 1
@@ -165,11 +171,28 @@ actions[v_line] = function(head,setting)
hsize = hsize - hangindent
end
+ local function list_dimensions(list,start)
+ local temp = copy_node_list(list,start)
+ temp = tonode(temp)
+ temp = nodes.handlers.characters(temp)
+ temp = nodes.injections.handler(temp)
+ -- temp = typesetters.fontkerns.handler(temp) -- maybe when enabled
+ -- nodes.handlers.protectglyphs(temp) -- not needed as we discard
+ -- temp = typesetters.spacings.handler(temp) -- maybe when enabled
+ -- temp = typesetters.kerns.handler(temp) -- maybe when enabled
+ temp = tonut(temp)
+ temp = hpack_node_list(temp)
+ local width = getwidth(temp)
+ flush_node_list(temp)
+ return width
+ end
+
local function try(extra)
local width = list_dimensions(list,start)
if extra then
width = width + list_dimensions(extra)
end
+ -- report_firstlines("line length: %p, progression: %p, text: %s",hsize,width,nodes.listtoutf(list,nil,nil,start))
if width > hsize then
list = prev
return true
@@ -187,7 +210,10 @@ actions[v_line] = function(head,setting)
elseif id == disc_code then
-- this could be an option
n = n + 1
- if try(getfield(start,"pre")) then
+ local pre, post, replace = getdisc(start)
+ if pre and try(pre) then
+ break
+ elseif replace and try(replace) then
break
end
elseif id == kern_code then -- todo: fontkern
@@ -203,6 +229,9 @@ actions[v_line] = function(head,setting)
linebreaks[i] = n
end
end
+
+ flush_node_list(temp)
+
local start = head
local n = 0
@@ -224,6 +253,7 @@ actions[v_line] = function(head,setting)
local linebreak = linebreaks[i]
while start and n < nofchars do
local id = getid(start)
+ local ok = false
if id == glyph_code then
n = n + 1
update(start)
@@ -268,6 +298,8 @@ actions[v_line] = function(head,setting)
end
setdisc(disc,pre,post,replace)
flush_node(disc)
+ elseif id == glue_code then
+ head = insert_node_before(head,start,newpenalty(10000)) -- nobreak
end
if linebreak == n then
if trace_firstlines then
@@ -281,7 +313,7 @@ actions[v_line] = function(head,setting)
start = getnext(start)
end
end
- flush_node_list(temp)
+
return head, true
end