summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-06-04 17:42:38 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-06-04 17:42:38 +0200
commit32f8047624c2fa49c3031a66edb5a039a813f276 (patch)
treed568ec496e3b4c95adc37ce435b0161a3f40c581 /tex/context/base/mkiv
parent3ab20dbdfa095edd8c6bc00b8e3bdccd78900257 (diff)
downloadcontext-32f8047624c2fa49c3031a66edb5a039a813f276.tar.gz
2017-06-04 17:01:00
Diffstat (limited to 'tex/context/base/mkiv')
-rw-r--r--tex/context/base/mkiv/cont-fil.mkiv3
-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-ctx.lua113
-rw-r--r--tex/context/base/mkiv/font-emp.mkvi18
-rw-r--r--tex/context/base/mkiv/font-hsh.lua2
-rw-r--r--tex/context/base/mkiv/font-ini.lua4
-rw-r--r--tex/context/base/mkiv/font-ots.lua18
-rw-r--r--tex/context/base/mkiv/font-pre.mkiv8
-rw-r--r--tex/context/base/mkiv/font-sol.lua2
-rw-r--r--tex/context/base/mkiv/font-sty.mkvi115
-rw-r--r--tex/context/base/mkiv/grph-inc.lua4
-rw-r--r--tex/context/base/mkiv/l-table.lua22
-rw-r--r--tex/context/base/mkiv/lang-hyp.lua2
-rw-r--r--tex/context/base/mkiv/math-act.lua29
-rw-r--r--tex/context/base/mkiv/math-dim.lua5
-rw-r--r--tex/context/base/mkiv/math-noa.lua2
-rw-r--r--tex/context/base/mkiv/math-vfu.lua40
-rw-r--r--tex/context/base/mkiv/node-met.lua36
-rw-r--r--tex/context/base/mkiv/node-nut.lua5
-rw-r--r--tex/context/base/mkiv/node-res.lua17
-rw-r--r--tex/context/base/mkiv/node-rul.lua51
-rw-r--r--tex/context/base/mkiv/node-rul.mkiv11
-rw-r--r--tex/context/base/mkiv/page-one.mkiv2
-rw-r--r--tex/context/base/mkiv/spac-ver.lua31
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25794 -> 25706 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin424658 -> 424698 bytes
-rw-r--r--tex/context/base/mkiv/strc-ref.mkvi2
28 files changed, 343 insertions, 203 deletions
diff --git a/tex/context/base/mkiv/cont-fil.mkiv b/tex/context/base/mkiv/cont-fil.mkiv
index e2c7f401e..69c45c0e5 100644
--- a/tex/context/base/mkiv/cont-fil.mkiv
+++ b/tex/context/base/mkiv/cont-fil.mkiv
@@ -74,7 +74,8 @@
\definefilesynonym [pre-balls] [present-balls]
\definefilesynonym [pre-15] [present-balls]
\definefilesynonym [pre-knot] [pre-16]
-\definefilesynonym [pre-weird] [pre-17]
+\definefilesynonym [pre-17] [present-weird]
+\definefilesynonym [pre-weird] [present-weird]
\definefilesynonym [pre-shade] [pre-18]
\definefilesynonym [pre-organic] [pre-19]
\definefilesynonym [pre-speckle] [pre-20]
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index c98444273..cd928701d 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{2017.05.28 19:30}
+\newcontextversion{2017.06.04 16: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 ac0e03320..f586f8706 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.05.28 19:30}
+\edef\contextversion{2017.06.04 16:55}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua
index d375d4679..e13da7f8a 100644
--- a/tex/context/base/mkiv/font-ctx.lua
+++ b/tex/context/base/mkiv/font-ctx.lua
@@ -1262,7 +1262,7 @@ do -- else too many locals
-- -- characters[0x2007] = { width = characters[0x0030] and characters[0x0030].width or parameters.space } -- figure
-- -- characters[0x2008] = { width = characters[0x002E] and characters[0x002E].width or parameters.space } -- period
-- --
--- constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference
+-- -- constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference
-- local id = definefont(tfmdata)
-- csnames[id] = specification.cs
-- tfmdata.properties.id = id
@@ -1429,7 +1429,7 @@ do -- else too many locals
-- characters[0x2007] = { width = characters[0x0030] and characters[0x0030].width or parameters.space } -- figure
-- characters[0x2008] = { width = characters[0x002E] and characters[0x002E].width or parameters.space } -- period
--
- constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference
+ -- constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference
local fallbacks = specification.fallbacks
local mathsize = (mathsize == 1 or mathsize == 2 or mathsize == 3) and mathsize or nil -- can be unset so we test 1 2 3
if fallbacks and fallbacks ~= "" and mathsize and not busy then
@@ -2383,26 +2383,24 @@ dimenfactors.pct = nil
to scale virtual characters.</p>
--ldx]]--
--- in versions > 0.82 0 is supported as equivalent of self
-
-function constructors.checkvirtualids(tfmdata)
- -- begin of experiment: we can use { "slot", 0, number } in virtual fonts
- local fonts = tfmdata.fonts
- local selfid = font.nextid()
- if fonts and #fonts > 0 then
- for i=1,#fonts do
- local fi = fonts[i]
- if fi[2] == 0 then
- fi[2] = selfid
- elseif fi.id == 0 then
- fi.id = selfid
- end
- end
- else
- -- tfmdata.fonts = { "id", selfid } -- conflicts with other next id's (vf math), too late anyway
- end
- -- end of experiment
-end
+-- function constructors.checkvirtualids(tfmdata)
+-- -- begin of experiment: we can use { "slot", 0, number } in virtual fonts
+-- local fonts = tfmdata.fonts
+-- local selfid = font.nextid()
+-- if fonts and #fonts > 0 then
+-- for i=1,#fonts do
+-- local fi = fonts[i]
+-- if fi[2] == 0 then
+-- fi[2] = selfid
+-- elseif fi.id == 0 then
+-- fi.id = selfid
+-- end
+-- end
+-- else
+-- -- tfmdata.fonts = { "id", selfid } -- conflicts with other next id's (vf math), too late anyway
+-- end
+-- -- end of experiment
+-- end
-- function constructors.getvirtualid(tfmdata)
-- -- since we don't know the id yet, we use 0 as signal
@@ -3091,3 +3089,74 @@ do
}
end
+
+-- for the moment here (and not in font-con.lua):
+
+local identical = table.identical
+local copy = table.copy
+local fontdata = fonts.hashes.identifiers
+local addcharacters = font.addcharacters
+
+-- This helper is mostly meant to add last-resort (virtual) characters
+-- or runtime generated fonts (so we forget about features and such). It
+-- will probably take a while before it get used.
+
+local trace_adding = false
+local report_adding = logs.reporter("fonts","add characters")
+
+trackers.register("fonts.addcharacters",function(v) trace_adding = v end)
+
+if addcharacters then
+
+ function fonts.constructors.addcharacters(id,list)
+ local newchar = list.characters
+ if newchar then
+ local data = fontdata[id]
+ local newfont = list.fonts
+ local oldchar = data.characters
+ local oldfont = data.fonts
+ addcharacters(id, {
+ characters = newchar,
+ fonts = newfont,
+ nomath = not data.properties.hasmath,
+ })
+ -- this is just for tracing, as the assignment only uses the fonts list
+ -- and doesn't store it otherwise
+ if newfont then
+ if oldfont then
+ local oldn = #oldfont
+ local newn = #newfont
+ for n=1,newn do
+ local ok = false
+ local nf = newfont[n]
+ for o=1,oldn do
+ if identical(nf,oldfont[o]) then
+ ok = true
+ break
+ end
+ end
+ if not ok then
+ oldn = oldn + 1
+ oldfont[oldn] = newfont[i]
+ end
+ end
+ else
+ data.fonts = newfont
+ end
+ end
+ -- this is because we need to know what goes on and also might
+ -- want to access character data
+ for u, c in next, newchar do
+ if trace_adding then
+ report_adding("adding character %U to font %!font:name!",u,id)
+ end
+ oldchar[u] = c
+ end
+ end
+ end
+
+else
+ function fonts.constructors.addcharacters(id,list)
+ report_adding("adding characters to %!font:name! is not yet supported",id)
+ end
+end
diff --git a/tex/context/base/mkiv/font-emp.mkvi b/tex/context/base/mkiv/font-emp.mkvi
index 8f87ff7a1..1b6d46798 100644
--- a/tex/context/base/mkiv/font-emp.mkvi
+++ b/tex/context/base/mkiv/font-emp.mkvi
@@ -62,6 +62,16 @@
\else \ifx\fontalternative\s!sl\bs
\else \bf\fi\fi}
+\unexpanded\def\normalitalicface % public
+ {\relax\ifx\fontalternative\s!tf\it
+ \else \ifx\fontalternative\s!bf\bi
+ \else \tf\fi\fi}
+
+\unexpanded\def\normalslantedface % public
+ {\relax\ifx\fontalternative\s!tf\sl
+ \else \ifx\fontalternative\s!bf\bs
+ \else \tf\fi\fi}
+
\unexpanded\def\normaltypeface % public
{\relax
\ifx\fontalternative\s!bi \it \else
@@ -77,9 +87,11 @@
\ifx\fontalternative\s!bi \bf \else
\emphasistypeface \fi\fi\fi\fi\fi}
-\let\typeface\normaltypeface % public
-\let\boldface\normalboldface % public
-\let\swapface\swaptypeface % public
+\let\typeface \normaltypeface % public
+\let\boldface \normalboldface % public
+\let\slantedface\normalslantedface % public
+\let\italicface \normalitalicface % public
+\let\swapface \swaptypeface % public
%D To be set with the default body font environment: \type
%D {em} being \type {slanted} or \type {italic}.
diff --git a/tex/context/base/mkiv/font-hsh.lua b/tex/context/base/mkiv/font-hsh.lua
index 12f7bdfc2..95914b50c 100644
--- a/tex/context/base/mkiv/font-hsh.lua
+++ b/tex/context/base/mkiv/font-hsh.lua
@@ -359,4 +359,4 @@ function font.getfont(id)
return identifiers[id]
end
-font.setfont = currentfont -- bah, no native 'setfont' as name
+-- font.setfont = currentfont -- bah, no native 'setfont' as name
diff --git a/tex/context/base/mkiv/font-ini.lua b/tex/context/base/mkiv/font-ini.lua
index 708961b97..7ac8f218b 100644
--- a/tex/context/base/mkiv/font-ini.lua
+++ b/tex/context/base/mkiv/font-ini.lua
@@ -27,4 +27,6 @@ fonts.readers = { }
fonts.definers = { methods = { } }
fonts.loggers = { register = function() end }
-fontloader = nil
+if context then
+ fontloader = nil
+end
diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua
index 1230475b3..bd54b61c9 100644
--- a/tex/context/base/mkiv/font-ots.lua
+++ b/tex/context/base/mkiv/font-ots.lua
@@ -224,7 +224,7 @@ local math_code = nodecodes.math
local dir_code = nodecodes.dir
local localpar_code = nodecodes.localpar
-local discretionary_code = disccodes.discretionary
+----- discretionary_code = disccodes.discretionary
local ligature_code = glyphcodes.ligature
local a_state = attributes.private('state')
@@ -3833,11 +3833,13 @@ otf.helpers.pardirstate = pardirstate
do
- -- experimental speedup (only with hyphenated text and multiple fonts per processing)
- --
- -- at some point this might become true by default
+ -- This is a measurable experimental speedup (only with hyphenated text and multiple
+ -- fonts per processor call), especially for fonts with lots of contextual lookups.
+
+ -- local fastdisc = true
+ local fastdisc = context and LUATEXVERSION >= 1.005
- local fastdisc = false directives.register("otf.fastdisc",function(v) fastdisc = v end)
+ directives.register("otf.fastdisc",function(v) fastdisc = v end)
function otf.featuresprocessor(head,font,attr,direction,n)
@@ -4023,9 +4025,9 @@ do
if ok then
done = true
end
- else
- start = getnext(start)
- end
+ else
+ start = getnext(start)
+ end
elseif id == math_code then
start = getnext(end_of_math(start))
elseif id == dir_code then
diff --git a/tex/context/base/mkiv/font-pre.mkiv b/tex/context/base/mkiv/font-pre.mkiv
index 9336fa352..45f933dd5 100644
--- a/tex/context/base/mkiv/font-pre.mkiv
+++ b/tex/context/base/mkiv/font-pre.mkiv
@@ -607,7 +607,7 @@
\definealternativestyle [\v!bigger] [\setbigbodyfont \tf] []
\definealternativestyle [\v!smaller] [\setsmallbodyfont\tf] []
-\definealternativestyle [\v!sans,\v!sansserif] [\ss] []
+\definealternativestyle [\v!sans,\v!sansserif] [\ss]
\definealternativestyle [\v!roman,\v!serif,\v!regular] [\rm]
\definealternativestyle [\v!handwritten] [\hw]
\definealternativestyle [\v!calligraphic] [\cg]
@@ -619,6 +619,12 @@
\definealternativestyle [\v!mononormal] [\tt\tf] []
\definealternativestyle [\v!monobold] [\tt\bf] []
+\definealternativestyle [typeface] [\typeface] [] % no translation here (quite basic)
+\definealternativestyle [boldface] [\boldface] []
+\definealternativestyle [slantedface] [\slantedface] []
+\definealternativestyle [italicface] [\italicface] []
+\definealternativestyle [swapface] [\swapface] []
+
% For Alan:
\definealternativestyle
diff --git a/tex/context/base/mkiv/font-sol.lua b/tex/context/base/mkiv/font-sol.lua
index 82fc3dc40..d89f41441 100644
--- a/tex/context/base/mkiv/font-sol.lua
+++ b/tex/context/base/mkiv/font-sol.lua
@@ -395,7 +395,7 @@ function splitters.split(head)
if m > max_more then max_more = m end
start, stop, done = nil, nil, true
end
- while current do -- also nextid
+ while current do -- also ischar
local next = getnext(current)
local id = getid(current)
if id == glyph_code then
diff --git a/tex/context/base/mkiv/font-sty.mkvi b/tex/context/base/mkiv/font-sty.mkvi
index cf49cd5eb..2d00c5ec8 100644
--- a/tex/context/base/mkiv/font-sty.mkvi
+++ b/tex/context/base/mkiv/font-sty.mkvi
@@ -18,34 +18,33 @@
%D \macros
%D {definealternativestyle}
%D
-%D In the main modules we are going to implement lots of
-%D parameterized commands and one of these parameters will
-%D concern the font to use. To suit consistent use of fonts we
-%D here implement a mechanism for defining the keywords that
-%D present a particular style or alternative.
+%D In the main modules we are going to implement lots of parameterized commands and
+%D one of these parameters will concern the font to use. To suit consistent use of
+%D fonts we here implement a mechanism for defining the keywords that present a
+%D particular style or alternative.
%D
%D \starttyping
%D \definealternativestyle [keywords] [\style] [\nostyle]
%D \stoptyping
%D
-%D The first command is used in the normal textflow, while the
-%D second command takes care of headings and alike. Consider
-%D the next two definitions:
+%D The first command is used in the normal textflow, while the second command takes
+%D care of headings and alike. Consider the next two definitions:
%D
%D \starttyping
%D \definealternativestyle [bold] [\bf] []
%D \definealternativestyle [cap] [\cap] [\cap]
%D \stoptyping
%D
-%D A change \type{\bf} in a heading which is to be set in
-%D \type{\tfd} does not look that well, so therefore we leave
-%D the second argument of \type{\definealternativestyle} empty.
-%D When we capatalize characters using the pseudo small cap
-%D command \type{\cap}, we want this to take effect in both
-%D text and headings, which is accomplished by assigning both
-%D arguments.
+%D A change \type {\bf} in a heading which is to be set in \type {\tfd} does not look
+%D that well, so therefore we leave the second argument of \type
+%D {\definealternativestyle} empty. When we capatalize characters using the pseudo
+%D small cap command \type {\cap}, we want this to take effect in both text and
+%D headings, which is accomplished by assigning both arguments.
-\installcorenamespace{alternativestyles}
+\installcorenamespace{alternativestyles} % settings
+\installcorenamespace{alternativestyle} % instances
+
+\installsetuponlycommandhandler \??alternativestyles {alternativestyles}
\setnewconstant \c_font_current_alternative_style_index \plusone
@@ -57,13 +56,21 @@
\let\definestyle\definealternativestyle % later redefined
+\newconstant\c_fonts_basics_alternative_style_method
+
\def\font_basics_define_alternative_style_indeed#variantone#varianttwo#command%
- {\ifcsname#command\endcsname
+ {\setvalue{\??alternativestyle#command}{\font_helpers_apply_alternative_style{#variantone}{#varianttwo}}%
+ \ifcsname#command\endcsname
% no redefinition
+ \else\ifnum\c_fonts_basics_alternative_style_method=\plusone
+ \ifthirdargument
+ \setuevalue{#command}{\groupedcommand{\expandafter\noexpand\begincsname\??alternativestyle#command\endcsname}{}}%
+ \else
+ \setuvalue{#command}{\groupedcommand{#variantone}{}}%
+ \fi
\else
\setuvalue{#command}{\groupedcommand{#variantone}{}}%
- \fi
- \setvalue{\??alternativestyles#command}{\font_helpers_apply_alternative_style{#variantone}{#varianttwo}}}%
+ \fi\fi}
\def\font_helpers_apply_alternative_style
{\ifcase\c_font_current_alternative_style_index
@@ -77,18 +84,24 @@
\fi}
\def\applyalternativestyle#name% public
- {\begincsname\??alternativestyles#name\endcsname}
+ {\begincsname\??alternativestyle#name\endcsname}
+
+\appendtoks
+ \doifelse{\alternativestylesparameter\c!method}\v!auto
+ {\c_fonts_basics_alternative_style_method\plusone}%
+ {\c_fonts_basics_alternative_style_method\zerocount}%
+\to \everysetupalternativestyles
-%D Maybe too geneneric, but probably ok is the following. (Maybe one
-%D day we will use a dedicated grouped command for styles.)
+%D Maybe too generic, but probably ok is the following. (Maybe one day we will use a
+%D dedicated grouped command for styles.)
% \appendtoks
% \let\groupedcommand\thirdofthreearguments
% \to \everysimplifycommands
-%D This command also defines the keyword as command. This means
-%D that the example definition of \type{bold} we gave before,
-%D results in a command \type{\bold} which can be used as:
+%D This command also defines the keyword as command. This means that the example
+%D definition of \type {bold} we gave before, results in a command \type {\bold}
+%D which can be used as:
%D
%D \startbuffer
%D He's a \bold{bold} man with a {\bold head}.
@@ -102,39 +115,33 @@
%D \definealternativestyle[bold][\bf][]\getbuffer
%D \stopexample
%D
-%D Such definitions are of course unwanted for \type{\cap}
-%D because this would result in an endless recursive call.
-%D Therefore we check on the existance of both the command and
-%D the substitution. The latter is needed because for instance
-%D \type{\type} is an entirely diferent command. That command
-%D handles verbatim, while the style command would just switch
-%D to teletype font. This is just an example of a tricky
-%D naming coincidence.
-
+%D Such definitions are of course unwanted for \type {\cap} because this would
+%D result in an endless recursive call. Therefore we check on the existance of both
+%D the command and the substitution. The latter is needed because for instance \type
+%D {\type} is an entirely diferent command. That command handles verbatim, while the
+%D style command would just switch to teletype font. This is just an example of a
+%D tricky naming coincidence.
+%D
%D \macros
%D {doconvertfont,noconvertfont,
%D dontconvertfont,redoconvertfont}
%D
-%D After having defined such keywords, we can call for them by
-%D using
+%D After having defined such keywords, we can call for them by using
%D
%D \starttyping
%D \doconvertfont{keyword}{text}
%D \stoptyping
%D
-%D We deliberately pass an argument. This enables us to
-%D assign converters that handle one argument, like
-%D \type{\cap}.
+%D We deliberately pass an argument. This enables us to assign converters that
+%D handle one argument, like \type {\cap}.
%D
-%D By default the first specification is used to set the style,
-%D exept when we say \type{\dontconvertfont}, after which the
-%D second specification is used. We can also directly call for
-%D \type{\noconvertfont}. In nested calls, we can restore the
-%D conversion by saying \type{\redoconvertfont}.
-
-%D These commands are not grouped! Grouping is most probably
-%D done by the calling macro's and would lead to unnecessary
-%D overhead.
+%D By default the first specification is used to set the style, exept when we say
+%D \type {\dontconvertfont}, after which the second specification is used. We can
+%D also directly call for \type {\noconvertfont}. In nested calls, we can restore
+%D the conversion by saying \type {\redoconvertfont}.
+%D
+%D These commands are not grouped! Grouping is most probably done by the calling
+%D macro's and would lead to unnecessary overhead.
\let\m_current_convert_font \empty
\let\m_current_convert_font_dt\empty
@@ -149,7 +156,7 @@
\def\font_helpers_do_convert_font
{\edef\m_current_convert_font_dt{\detokenize\expandafter{\m_current_convert_font}}%
- \ifcsname\??alternativestyles\m_current_convert_font_dt\endcsname
+ \ifcsname\??alternativestyle\m_current_convert_font_dt\endcsname
\expandafter\lastnamedcs
\else\ifcsname\m_current_convert_font_dt\endcsname
\doubleexpandafter\lastnamedcs
@@ -157,8 +164,8 @@
\doubleexpandafter\m_current_convert_font
\fi\fi}
-%D Low level switches (downward compatible, but we keep them as one can use
-%D them in styles):
+%D Low level switches (downward compatible, but we keep them as one can use them in
+%D styles):
%D
%D \starttyping
%D \usemodule[abr-02]
@@ -188,7 +195,7 @@
\unexpanded\def\dousecurrentstyleparameter % empty check outside here
{\edef\detokenizedstyleparameter{\detokenize\expandafter{\currentstyleparameter}}%
\settrue\fontattributeisset % reset is done elsewhere
- \ifcsname\??alternativestyles\detokenizedstyleparameter\endcsname
+ \ifcsname\??alternativestyle\detokenizedstyleparameter\endcsname
\lastnamedcs
\else\ifcsname\detokenizedstyleparameter\endcsname
\lastnamedcs
@@ -392,8 +399,8 @@
\unexpanded\edef\vsone#character{#character\normalUchar"FE00 } % used
\unexpanded\edef\vstwo#character{#character\normalUchar"FE01 } % not used but handy for testing
-%D For historic reasons we keep the following around but they are no longer
-%D that relevant for \MKIV.
+%D For historic reasons we keep the following around but they are no longer that
+%D relevant for \MKIV.
\unexpanded\def\doattributes#1#2#3#4%
{\begingroup % geen \bgroup, anders in mathmode lege \hbox
diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua
index b5e74b4c1..5f2fb88c9 100644
--- a/tex/context/base/mkiv/grph-inc.lua
+++ b/tex/context/base/mkiv/grph-inc.lua
@@ -89,10 +89,6 @@ local trace_usage = false trackers.register ("graphics.usage", func
local extra_check = false directives.register("graphics.extracheck", function(v) extra_check = v end)
local auto_transform = true directives.register("graphics.autotransform", function(v) auto_transform = v end)
-if LUATEXVERSION <= 1 then
- auto_transform = false
-end
-
local report_inclusion = logs.reporter("graphics","inclusion")
local report_figures = logs.reporter("system","graphics")
local report_figure = logs.reporter("used graphic")
diff --git a/tex/context/base/mkiv/l-table.lua b/tex/context/base/mkiv/l-table.lua
index 3c1ce6daf..5bfc4bc47 100644
--- a/tex/context/base/mkiv/l-table.lua
+++ b/tex/context/base/mkiv/l-table.lua
@@ -1092,7 +1092,9 @@ function table.unnest(t) -- bad name
end
local function are_equal(a,b,n,m) -- indexed
- if a and b and #a == #b then
+ if a == b then
+ return true
+ elseif a and b and #a == #b then
n = n or 1
m = m or #a
for i=n,m do
@@ -1114,16 +1116,18 @@ local function are_equal(a,b,n,m) -- indexed
end
local function identical(a,b) -- assumes same structure
- for ka, va in next, a do
- local vb = b[ka]
- if va == vb then
- -- same
- elseif type(va) == "table" and type(vb) == "table" then
- if not identical(va,vb) then
+ if a ~= b then
+ for ka, va in next, a do
+ local vb = b[ka]
+ if va == vb then
+ -- same
+ elseif type(va) == "table" and type(vb) == "table" then
+ if not identical(va,vb) then
+ return false
+ end
+ else
return false
end
- else
- return false
end
end
return true
diff --git a/tex/context/base/mkiv/lang-hyp.lua b/tex/context/base/mkiv/lang-hyp.lua
index b85295f19..b1b9e605a 100644
--- a/tex/context/base/mkiv/lang-hyp.lua
+++ b/tex/context/base/mkiv/lang-hyp.lua
@@ -1647,7 +1647,7 @@ featureset.hyphenonly = hyphenonly == v_yes
return head, done
end
- if LUATEXVERSION< 1.005 then
+ if LUATEXVERSION < 1.005 then
expanded = function(head)
local done = hyphenate(head)
diff --git a/tex/context/base/mkiv/math-act.lua b/tex/context/base/mkiv/math-act.lua
index ddc7510b1..69d85d01f 100644
--- a/tex/context/base/mkiv/math-act.lua
+++ b/tex/context/base/mkiv/math-act.lua
@@ -238,6 +238,8 @@ function mathematics.overloaddimensions(target,original,set)
local hfactor = parameters.hfactor
local vfactor = parameters.vfactor
local addprivate = fonts.helpers.addprivate
+target.type = "virtual"
+target.properties.virtualized = true
local function overload(dimensions)
for unicode, data in next, dimensions do
local character = characters[unicode]
@@ -249,9 +251,9 @@ function mathematics.overloaddimensions(target,original,set)
if trace_defining and (width or height or depth) then
report_math("overloading dimensions of %C, width %a, height %a, depth %a",unicode,width,height,depth)
end
- if width then character.width = width * hfactor end
- if height then character.height = height * vfactor end
- if depth then character.depth = depth * vfactor end
+ if width then character.width = width * hfactor end
+ if height then character.height = height * vfactor end
+ if depth then character.depth = depth * vfactor end
--
local xoffset = data.xoffset
local yoffset = data.yoffset
@@ -262,13 +264,22 @@ function mathematics.overloaddimensions(target,original,set)
yoffset = { "down", -yoffset * vfactor }
end
if xoffset or yoffset then
- local slot = { "slot", 1, addprivate(target,nil,fastcopy(character)) }
- if xoffset and yoffset then
- character.commands = { xoffset, yoffset, slot }
- elseif xoffset then
- character.commands = { xoffset, slot }
+ if character.commands then
+ if yoffset then
+ insert(character.commands,1,yoffset)
+ end
+ if xoffset then
+ insert(character.commands,1,xoffset)
+ end
else
- character.commands = { yoffset, slot }
+ local slot = { "slot", 0, addprivate(target,nil,fastcopy(character)) }
+ if xoffset and yoffset then
+ character.commands = { xoffset, yoffset, slot }
+ elseif xoffset then
+ character.commands = { xoffset, slot }
+ else
+ character.commands = { yoffset, slot }
+ end
end
character.index = nil
end
diff --git a/tex/context/base/mkiv/math-dim.lua b/tex/context/base/mkiv/math-dim.lua
index ba0235a5b..72b9d7e50 100644
--- a/tex/context/base/mkiv/math-dim.lua
+++ b/tex/context/base/mkiv/math-dim.lua
@@ -6,9 +6,6 @@ if not modules then modules = { } end modules ['math-dim'] = {
license = "see context related readme files"
}
--- Beware: only Taco and Ulrik really understands in depth what these dimensions
--- do so if you run into problems ask on the context list.
-
-- The radical_rule value is also used as a trigger. In luatex the accent
-- placement happens either the opentype way (using top_accent cum suis) or the
-- traditional way. In order to determine what method to use the \Umathradicalrule
@@ -18,6 +15,8 @@ if not modules then modules = { } end modules ['math-dim'] = {
-- which case the engine takes the rulethickness. In c-speak:
--
-- int compat_mode = (radical_rule(cur_style) == undefined_math_parameter) ;
+--
+-- In the meantime things have been updated and we now have two code paths.
local abs, next = math.abs, next
diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua
index 2e94f0d71..8b1fa87fd 100644
--- a/tex/context/base/mkiv/math-noa.lua
+++ b/tex/context/base/mkiv/math-noa.lua
@@ -1461,7 +1461,7 @@ do
local hash = setmetatableindex(function(t,font)
local g = fontdata[font].goodies
- local m = g and g[1].mathematics
+ local m = g and g[1] and g[1].mathematics
local k = m and m.kernpairs
t[font] = k
return k
diff --git a/tex/context/base/mkiv/math-vfu.lua b/tex/context/base/mkiv/math-vfu.lua
index a8a789d28..1e40d5ac4 100644
--- a/tex/context/base/mkiv/math-vfu.lua
+++ b/tex/context/base/mkiv/math-vfu.lua
@@ -603,22 +603,24 @@ local function copy_glyph(main,target,original,unicode,slot)
local olddata = original[unicode]
if olddata then
local newdata = {
- width = olddata.width,
- height = olddata.height,
- depth = olddata.depth,
- italic = olddata.italic,
- kerns = olddata.kerns,
- commands = { { "slot", slot, unicode } },
+ width = olddata.width,
+ height = olddata.height,
+ depth = olddata.depth,
+ italic = olddata.italic,
+ kerns = olddata.kerns,
+ tounicode = olddata.tounicode,
+ commands = { { "slot", slot, unicode } },
}
local glyphdata = newdata
local nextglyph = olddata.next
while nextglyph do
local oldnextdata = original[nextglyph]
local newnextdata = {
- commands = { { "slot", slot, nextglyph } },
- width = oldnextdata.width,
- height = oldnextdata.height,
- depth = oldnextdata.depth,
+ width = oldnextdata.width,
+ height = oldnextdata.height,
+ depth = oldnextdata.depth,
+ tounicode = olddata.tounicode,
+ commands = { { "slot", slot, nextglyph } },
}
local newnextglyph = addprivate(main,formatters["M-N-%H"](nextglyph),newnextdata)
newdata.next = newnextglyph
@@ -641,10 +643,11 @@ local function copy_glyph(main,target,original,unicode,slot)
local oldglyph = hvi.glyph
local olddata = original[oldglyph]
local newdata = {
- commands = { { "slot", slot, oldglyph } },
- width = olddata.width,
- height = olddata.height,
- depth = olddata.depth,
+ width = olddata.width,
+ height = olddata.height,
+ depth = olddata.depth,
+ tounicode = olddata.tounicode,
+ commands = { { "slot", slot, oldglyph } },
}
hvi.glyph = addprivate(main,formatters["M-H-%H"](oldglyph),newdata)
-- report_virtual("copied h variant: %X at index %i",hvi.glyph,i)
@@ -659,10 +662,11 @@ local function copy_glyph(main,target,original,unicode,slot)
local oldglyph = vvi.glyph
local olddata = original[oldglyph]
local newdata = {
- commands = { { "slot", slot, oldglyph } },
- width = olddata.width,
- height = olddata.height,
- depth = olddata.depth,
+ width = olddata.width,
+ height = olddata.height,
+ depth = olddata.depth,
+ tounicode = olddata.tounicode,
+ commands = { { "slot", slot, oldglyph } },
}
vvi.glyph = addprivate(main,formatters["M-V-%H"](oldglyph),newdata)
-- report_virtual("copied v variant: %X at index %i",vvi.glyph,i)
diff --git a/tex/context/base/mkiv/node-met.lua b/tex/context/base/mkiv/node-met.lua
index 9ebc8e411..e6d0f4689 100644
--- a/tex/context/base/mkiv/node-met.lua
+++ b/tex/context/base/mkiv/node-met.lua
@@ -669,39 +669,3 @@ end
nodes.keys = keys -- [id][subtype]
nodes.fields = nodefields -- (n)
-
--- temporary hack
-
-if LUATEXVERSION <= 1.002 then
-
- local get = tex.get
- local flush = node.free
-
- function tex.get(name,split)
- local s = get(name)
- if split == true then
- if s then
- local width = s.width
- local stretch = s.stretch
- local shrink = s.shrink
- local stretch_order = s.stretch_order
- local shrink_order = s.shrink_order
- flush(s)
- return width, stretch, shrink, stretch_order, shrink_order
- else
- return 0, 0, 0, 0, 0
- end
- elseif split == false then
- if s then
- local width = s.width
- flush(s)
- return width
- else
- return 0
- end
- else
- return s
- end
- end
-
-end
diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua
index b42727e06..787afd888 100644
--- a/tex/context/base/mkiv/node-nut.lua
+++ b/tex/context/base/mkiv/node-nut.lua
@@ -210,11 +210,6 @@ if LUATEXVERSION < 1.005 then
function direct.getsup (n) return getfield(n,"sup") end
end
--- if LUATEXVERSION < 1.004 then
--- local gc = direct.getcomponents
--- getcomponents = function(n) local c = gc(n) return c ~= 0 and c or nil end
--- end
-
-- local hash = table.setmetatableindex("number")
-- local ga = direct.get_attribute
-- function direct.get_attribute(n,a)
diff --git a/tex/context/base/mkiv/node-res.lua b/tex/context/base/mkiv/node-res.lua
index 8b7ec1a62..858408bd9 100644
--- a/tex/context/base/mkiv/node-res.lua
+++ b/tex/context/base/mkiv/node-res.lua
@@ -26,6 +26,7 @@ local skipcodes = nodes.skipcodes
local kerncodes = nodes.kerncodes
local rulecodes = nodes.rulecodes
local nodecodes = nodes.nodecodes
+local gluecodes = nodes.gluecodes
local boundarycodes = nodes.boundarycodes
local usercodes = nodes.usercodes
@@ -86,6 +87,8 @@ local setpenalty = nuts.setpenalty
local setdir = nuts.setdir
local setshift = nuts.setshift
local setwidth = nuts.setwidth
+local setsubtype = nuts.setsubtype
+local setleader = nuts.setleader
local copy_nut = nuts.copy
local new_nut = nuts.new
@@ -183,6 +186,8 @@ local noad = register_nut(new_nut("noad"))
local boundary = register_nut(new_nut("boundary",boundarycodes.user))
local wordboundary = register_nut(new_nut("boundary",boundarycodes.word))
+local cleader = register_nut(copy_nut(glue)) setsubtype(cleader,gluecodes.cleaders) setglue(cleader,0,65536,0,2,0)
+
-- the dir field needs to be set otherwise crash:
local rule = register_nut(new_nut("rule")) setdir(rule, "TLT")
@@ -362,6 +367,18 @@ function nutpool.userrule(width,height,depth,dir) -- w/h/d == nil will let them
return n
end
+function nutpool.leader(width,list)
+ local n = copy_nut(cleader)
+ if width then
+ setwidth(n,width)
+ end
+ if list then
+ setleader(n,list)
+ end
+ return n
+end
+
+
function nutpool.latelua(code)
local n = copy_nut(latelua)
setfield(n,"string",code)
diff --git a/tex/context/base/mkiv/node-rul.lua b/tex/context/base/mkiv/node-rul.lua
index 4ec651d3b..b6cb9c167 100644
--- a/tex/context/base/mkiv/node-rul.lua
+++ b/tex/context/base/mkiv/node-rul.lua
@@ -35,6 +35,7 @@ local setlink = nuts.setlink
local getnext = nuts.getnext
local getprev = nuts.getprev
local getid = nuts.getid
+local getdir = nuts.getdir
local getattr = nuts.getattr
local setattr = nuts.setattr
local getfont = nuts.getfont
@@ -57,6 +58,7 @@ local traverse_id = nuts.traverse_id
local list_dimensions = nuts.rangedimensions
local hpack_nodes = nuts.hpack
local current_attr = nuts.current_attr
+local copy_list = nuts.copy_list
local nodecodes = nodes.nodecodes
local rulecodes = nodes.rulecodes
@@ -82,6 +84,7 @@ local nodepool = nuts.pool
local new_rule = nodepool.rule
local new_userrule = nodepool.userrule
local new_kern = nodepool.kern
+local new_leader = nodepool.leader
local n_tostring = nodes.idstostring
local n_tosequence = nodes.tosequence
@@ -208,8 +211,19 @@ local trace_ruled = false trackers.register("nodes.rules", function(v) trace_
local report_ruled = logs.reporter("nodes","rules")
function rules.define(settings)
- data[#data+1] = settings
- context(#data)
+ local nofdata = #data+1
+ data[nofdata] = settings
+ local text = settings.text
+ if text then
+ local b = nuts.takebox(text)
+ if b then
+ nodepool.register(b)
+ settings.text = getlist(b)
+ else
+ settings.text = nil
+ end
+ end
+ context(nofdata)
end
local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but acceptable for this purpose
@@ -242,7 +256,6 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a
local method = d.method
local empty = d.empty == v_yes
local offset = d.offset
- local continue = d.continue
local dy = d.dy
local order = d.order
local max = d.max
@@ -322,18 +335,28 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a
}
inject(tonut(r),w,ht,dp)
else
- for i=1,level do
- local ht = (offset+(i-1)*dy)*e + rulethickness - m
- local dp = -(offset+(i-1)*dy)*e + rulethickness + m
- local r = new_rule(w,ht,dp)
- if color then
- setattr(r,a_colormodel,colorspace)
- setattr(r,a_color,color)
- end
- if transparency then
- setattr(r,a_transparency,transparency)
+ local tx = d.text
+ if tx then
+ tx = copy_list(tx)
+ if d["repeat"] == v_yes then
+ tx = new_leader(w,tx)
end
+ local r = hpack_nodes(tx,w,"exactly")
inject(r,w,ht,dp)
+ else
+ for i=1,level do
+ local ht = (offset+(i-1)*dy)*e + rulethickness - m
+ local dp = -(offset+(i-1)*dy)*e + rulethickness + m
+ local r = new_rule(w,ht,dp)
+ if color then
+ setattr(r,a_colormodel,colorspace)
+ setattr(r,a_color,color)
+ end
+ if transparency then
+ setattr(r,a_transparency,transparency)
+ end
+ inject(r,w,ht,dp)
+ end
end
end
return head
@@ -617,6 +640,8 @@ implement {
{ "ta", "integer" },
{ "mp" },
{ "empty" },
+ { "text", "integer" },
+ { "repeat" },
}
}
}
diff --git a/tex/context/base/mkiv/node-rul.mkiv b/tex/context/base/mkiv/node-rul.mkiv
index bfdd17d30..661c8d7ef 100644
--- a/tex/context/base/mkiv/node-rul.mkiv
+++ b/tex/context/base/mkiv/node-rul.mkiv
@@ -108,8 +108,14 @@
\setuevalue\currentbar{\node_rules_direct{\currentbar}}%
\to \everydefinebar
+\newbox\b_node_rules
+
\unexpanded\def\node_rules_define
{\edef\p_node_rules_color{\barparameter\c!color}%
+ \edef\p_node_text{\barparameter\c!text}%
+ \ifx\p_node_text\empty\else
+ \setbox\b_node_rules\hbox{\p_node_text}%
+ \fi
\setevalue{\??barattribute\currentbar}{\number
\clf_definerule
continue {\barparameter\c!continue}%
@@ -125,6 +131,11 @@
offset \barparameter\c!offset\space % number
dy \barparameter\c!dy\space % number
empty {\barparameter\c!empty}%
+ \ifx\p_node_text\empty\else
+ % not that useful and efficient, more for testing something
+ text \b_node_rules
+ repeat {\barparameter\c!repeat}%
+ \fi
\relax}}
\unexpanded\def\node_rules_redefine#1%
diff --git a/tex/context/base/mkiv/page-one.mkiv b/tex/context/base/mkiv/page-one.mkiv
index 59efbd204..180c63834 100644
--- a/tex/context/base/mkiv/page-one.mkiv
+++ b/tex/context/base/mkiv/page-one.mkiv
@@ -1,4 +1,4 @@
- %D \module
+%D \module
%D [ file=page-one,
%D version=2000.10.20,
%D title=\CONTEXT\ Page Macros,
diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua
index 2f0191e6a..d7c1a2cbb 100644
--- a/tex/context/base/mkiv/spac-ver.lua
+++ b/tex/context/base/mkiv/spac-ver.lua
@@ -1117,7 +1117,7 @@ end
-- we could inject a vadjust to force a recalculation .. a mess
--
-- So, the next is far from robust and okay but for the moment this overlaying
--- has to do. Always test this with the examples in spec-ver.mkvi!
+-- has to do. Always test this with the examples in spac-ver.mkvi!
local function check_experimental_overlay(head,current)
local p = nil
@@ -1131,7 +1131,12 @@ local function check_experimental_overlay(head,current)
-- We deal with this at the tex end .. we don't see spacing .. enabling this code
-- is probably harmless but then we need to test it.
--
+ -- we could calculate this before we call
+ --
+ -- problem: prev list and next list can be unconnected
+ --
local c = getnext(p)
+ local l = c
while c and c ~= n do
local id = getid(c)
if id == glue_code then
@@ -1139,19 +1144,28 @@ local function check_experimental_overlay(head,current)
elseif id == kern_code then
skips = skips + getkern(c)
end
+ l = c
c = getnext(c)
end
+ local c = getprev(n)
+ while c and c ~= n and c ~= l do
+ local id = getid(c)
+ if id == glue_code then
+ skips = skips + getwidth(c)
+ elseif id == kern_code then
+ skips = skips + getkern(c)
+ end
+ c = getprev(c)
+ end
--
local delta = n_ht + skips + p_dp
texsetdimen("global","d_spac_overlay",-delta) -- for tracing
+ -- we should adapt pagetotal ! (need a hook for that) .. now we have the wrong pagebreak
local k = new_kern(-delta)
+ head = insert_node_before(head,n,k)
if n_ht > p_ht then
- -- we should adapt pagetotal ! (need a hook for that) .. now we have the wrong pagebreak
- setheight(p,n_ht)
- end
- insert_node_before(head,n,k)
- if p == head then
- head = k
+ local k = new_kern(n_ht-p_ht)
+ head = insert_node_before(head,p,k)
end
if trace_vspacing then
report_vspacing("overlaying, prev height: %p, prev depth: %p, next height: %p, skips: %p, move up: %p",p_ht,p_dp,n_ht,skips,delta)
@@ -1177,7 +1191,7 @@ local function check_experimental_overlay(head,current)
c = current
while c do
local id = getid(c)
- if id == glue_code or id == penalty_code then
+ if id == glue_code or id == penalty_code then -- kern ?
c = getprev(c)
elseif id == hlist_code then
p = c
@@ -1190,6 +1204,7 @@ local function check_experimental_overlay(head,current)
if a_snapmethod == a_snapvbox then
-- quit, we're not on the mvl
else
+ -- inefficient when we're at the end of a page
local c = tonut(texlists.page_head)
while c and c ~= n do
local id = getid(c)
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 35991ae80..eb8c1fec7 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 d55d283f5..011c188be 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-ref.mkvi b/tex/context/base/mkiv/strc-ref.mkvi
index 9f2a7b91c..69a9e2219 100644
--- a/tex/context/base/mkiv/strc-ref.mkvi
+++ b/tex/context/base/mkiv/strc-ref.mkvi
@@ -372,7 +372,7 @@
{\begingroup
\dowithnextbox
{\strc_references_set_page_only_destination_attribute{#1}%
- \hbox
+ \hpack % \hbox
\ifnum\lastdestinationattribute=\attributeunsetvalue\else attr \destinationattribute \lastdestinationattribute \fi
{\box\b_strc_destination_nodes\box\nextbox}%
\endgroup}}