summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv')
-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/context.mkxl2
-rw-r--r--tex/context/base/mkiv/font-imp-combining.lua170
-rw-r--r--tex/context/base/mkiv/font-imp-dimensions.lua2
-rw-r--r--tex/context/base/mkiv/font-lib.mkvi1
-rw-r--r--tex/context/base/mkiv/font-otj.lua2
-rw-r--r--tex/context/base/mkiv/font-ots.lua10
-rw-r--r--tex/context/base/mkiv/font-pre.mkiv7
-rw-r--r--tex/context/base/mkiv/math-frc.mkiv23
-rw-r--r--tex/context/base/mkiv/math-ini.mkiv38
-rw-r--r--tex/context/base/mkiv/mult-fun.lua2
-rw-r--r--tex/context/base/mkiv/mult-low.lua4
-rw-r--r--tex/context/base/mkiv/node-nut.lua27
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin27727 -> 27765 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin251333 -> 251365 bytes
16 files changed, 265 insertions, 27 deletions
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 529130815..9ce4dacf5 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2020.04.27 22:21}
+\newcontextversion{2020.04.30 11:10}
%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 25557437b..6f17f2868 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -45,7 +45,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.04.27 22:21}
+\edef\contextversion{2020.04.30 11:10}
\edef\contextkind {beta}
%D Kind of special:
diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl
index 2fb25036b..4bdb96da8 100644
--- a/tex/context/base/mkiv/context.mkxl
+++ b/tex/context/base/mkiv/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.04.27 22:21}
+\edef\contextversion{2020.04.30 11:10}
\edef\contextkind {beta}
%D Kind of special:
diff --git a/tex/context/base/mkiv/font-imp-combining.lua b/tex/context/base/mkiv/font-imp-combining.lua
new file mode 100644
index 000000000..7db3b905a
--- /dev/null
+++ b/tex/context/base/mkiv/font-imp-combining.lua
@@ -0,0 +1,170 @@
+if not modules then modules = { } end modules ['font-imp-combining'] = {
+ version = 1.001,
+ comment = "companion to font-ini.mkiv",
+ author = "Hans Hagen, PRAGMA ADE",
+ copyright = "ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+if not context then return end
+
+local next, unpack = next, unpack
+local sort, copy, insert = table.sort, table.copy, table.insert
+local setmetatableindex = table.setmetatableindex
+
+local fontdata = fonts.hashes.identifiers
+local otf = fonts.handlers.otf
+
+local nuts = nodes.nuts
+
+local nextnode = nuts.traversers.node
+local ischar = nuts.ischar
+local getprev = nuts.getprev
+local getnext = nuts.getnext
+local setprev = nuts.setprev
+local setnext = nuts.setnext
+local setboth = nuts.setboth
+local setlink = nuts.setlink
+local exchange = nuts.exchange
+
+local class = { } -- reused
+local point = { } -- reused
+local classes = { }
+local sorters = { }
+local slide = { }
+local count = 0
+
+-- List provided by Joey McCollum (Hebrew Layout Intelligence):
+--
+-- 1. The consonants (Unicode points 05D0-05EA) have no combining class and are never reordered; this is typographically correct.
+-- 2. Shin dot and sin dot (05C1-05C2) should be next, but Unicode places them in combining classes 24 and 25, after the characters in recommended classes 3-5 and many of the characters in recommended class 6.
+-- 3. Dagesh / mapiq (05BC) should be next, but Unicode assigns it a combining class of 21. This means that it will be incorrectly ordered before characters in recommended class 2 and after characters in recommended classes 4-6 after Unicode normalization.
+-- 4. Rafe (05BF) should be next, but Unicode assigns it a combining class of 23. Thus, it will be correctly placed after characters in recommended class 3, but incorrectly placed before characters in recommended class 2 after Unicode normalization.
+-- 5. The holam and holam haser vowel points (05B9-05BA) should be next, but Unicode places them in combining class 19. This means that it will be placed incorrectly before characters in recommended classes 2-4 and after all characters in recommended class 6 except 05BB after Unicode normalization.
+-- 6. The characters in 0591, 0596, 059B, 05A2-05A7, 05AA, 05B0-05B8, 05BB, 05BD, 05C5, 05C7 should be treated as being in the same class, but Unicode places them in combining classes 10-18, 20, 22, and 220.
+-- 7. The prepositive marks yetiv and dehi (059A, 05AD) should be next; Unicode places them in combining class 222, so they should correctly come after all characters in recommended classes 1-6.
+-- 8. The characters 0307, 0593-0595, 0597-0598, 059C-05A1, 05A8, 05AB-05AC, 05AF, 05C4 should be treated as being in the same class; Unicode places them in combining class 230, so they should correctly come after all characters in recommended classes 1-7.
+-- 9. The postpositive marks segolta, pashta, telisha qetana, and zinor (0592, 0599, 05A9, 05AE) should be next; Unicode places them in combining class 230, so they will need to be reordered after the characters in recommended class 8.
+--
+-- Some tests by Joey:
+--
+-- Arial, Calibri, and Times New Roman will correctly typeset most combinations of points even in Unicode's canonical order, but they typeset the normalized sequences (hiriq, shin dot, tipeha) and (qamatz, dagesh, shin dot) incorrectly and their typographically recommended reorderings correctly.
+-- Cardo will correctly typeset most combinations of points even in Unicode's canonical order, but it typesets the normalized sequences (hiriq, shin dot, tipeha) incorrectly and its typographically recommended reorderings correctly.
+-- Frank Ruehl CLM typesets most combinations of points even in Unicode's canonical order, but it consistently does a poor job positioning cantillation marks even when they are placed in the typographically recommended position. Taamey Frank CLM is another version of the same font that handles this correctly, so it is possible that Frank Ruehl CLM is just an obsolete font that did not have well-implemented Hebrew font features for cantillation marks to begin with.
+-- For Linux Libertine, the text samples with both the normalized mark ordering and the typographically recommended mark ordering were typeset poorly. I think that this is just because that font does not have full support for the Hebrew glyph set (it lacks cantillation marks) or Hebrew font features (it does not place Hebrew diacritical marks intelligently), so no mark reordering would fix its problems.
+-- Taamey David CLM and Taamey Frank CLM exhibits the same typographical mistakes as SBL Hebrew when the input is in Unicode canonical order, and these mistakes go away if the marks are ordered in the typographically recommended way.
+--
+-- SBL Hebrew is used as reference font.
+
+classes.hebr = {
+ [0x05C1] = 1, [0x05C2] = 1,
+ [0x05BC] = 2,
+ [0x05BF] = 3,
+ [0x05B9] = 4, [0x05BA] = 4,
+ [0x0591] = 5, [0x0596] = 5, [0x059B] = 5, [0x05A2] = 5, [0x05A3] = 5, [0x05A4] = 5,
+ [0x05A5] = 5, [0x05A6] = 5, [0x05A7] = 5, [0x05AA] = 5, [0x05B0] = 5, [0x05B1] = 5,
+ [0x05B2] = 5, [0x05B3] = 5, [0x05B4] = 5, [0x05B5] = 5, [0x05B6] = 5, [0x05B7] = 5,
+ [0x05B8] = 5, [0x05BB] = 5, [0x05BD] = 5, [0x05C5] = 5, [0x05C7] = 5,
+ [0x059A] = 6, [0x05AD] = 6,
+ [0x0307] = 7, [0x0593] = 7, [0x0594] = 7, [0x0595] = 7, [0x0597] = 7, [0x0598] = 7,
+ [0x059C] = 7, [0x059D] = 7, [0x059E] = 7, [0x059F] = 7, [0x05A0] = 7, [0x05A1] = 7,
+ [0x05A8] = 7, [0x05AB] = 7, [0x05AC] = 7, [0x05AF] = 7, [0x05C4] = 7,
+ [0x0592] = 8, [0x0599] = 8, [0x05A9] = 8, [0x05AE] = 8,
+}
+
+sorters.hebr = function(a,b)
+ return class[a] < class[b]
+end
+
+-- local dflt = setmetatableindex(function(t,k,v)
+-- for k, v in next, characters.data do
+-- local c = v.combining
+-- if c then
+-- t[k] = c
+-- end
+-- end
+-- setmetatableindex(t,nil)
+-- return t[k]
+-- end)
+--
+-- classes.dflt = dflt
+-- sorters.dflt = function(a,b) return class[b] < class[a] end
+
+-- see analyzeprocessor in case we want scripts
+
+local function reorder(head)
+ if count == 2 then
+ local first = slide[1]
+ local last = slide[2]
+ if sorter(last,first) then
+ head = exchange(head,first,last)
+ end
+ elseif count > 1 then
+ local first = slide[1]
+ local last = slide[count]
+ local before = getprev(first)
+ local after = getnext(last)
+ setprev(first)
+ setnext(last)
+ sort(slide,sorter)
+ setlink(unpack(slide))
+ local first = slide[1]
+ local last = slide[count]
+ if before then
+ setlink(before,first)
+ end
+ setlink(last,after)
+ if first == head then
+ head = first
+ end
+ end
+ count = 0
+ return head
+end
+
+local function reorderprocessor(head,font,attr)
+ local tfmdata = fontdata[font]
+ local script = otf.scriptandlanguage(tfmdata,attr)
+ sorter = sorters[script]
+ if sorter then
+ local classes = classes[script]
+ for n in nextnode, head do
+ local char, id = ischar(n,font)
+ if char then
+ local c = classes[char]
+ if c then
+ if count == 0 then
+ count = 1
+ slide = { n }
+ else
+ count = count + 1
+ slide[count] = n
+ end
+ class[n] = c
+ point[n] = char
+ elseif count > 0 then
+ head = reorder(head)
+ end
+ elseif count > 0 then
+ head = reorder(head)
+ end
+ end
+ if count > 0 then
+ head = reorder(head)
+ end
+ end
+ return head
+end
+
+fonts.constructors.features.otf.register {
+ name = "reordercombining",
+ description = "reorder combining characters",
+-- default = true,
+-- initializers = {
+-- node = reorderinitializer,
+-- },
+ processors = {
+ position = 1,
+ node = reorderprocessor,
+ }
+}
diff --git a/tex/context/base/mkiv/font-imp-dimensions.lua b/tex/context/base/mkiv/font-imp-dimensions.lua
index 24891a2cd..760ce3719 100644
--- a/tex/context/base/mkiv/font-imp-dimensions.lua
+++ b/tex/context/base/mkiv/font-imp-dimensions.lua
@@ -47,6 +47,8 @@ local function initialize(tfmdata,key,value)
newdepth = gettexdimen("strutdp")
elseif value == "mono" then
newwidth = emwidth
+ elseif value == "halfmono" then
+ newwidth = emwidth / 2
else
-- there are fonts out there with no x_height ...
local spec = settings_to_array(value)
diff --git a/tex/context/base/mkiv/font-lib.mkvi b/tex/context/base/mkiv/font-lib.mkvi
index b3cade5ff..b2f42f0c2 100644
--- a/tex/context/base/mkiv/font-lib.mkvi
+++ b/tex/context/base/mkiv/font-lib.mkvi
@@ -117,6 +117,7 @@
\registerctxluafile{font-imp-dimensions}{}
\registerctxluafile{font-imp-spacekerns}{}
\registerctxluafile{font-imp-tweaks}{}
+\registerctxluafile{font-imp-combining}{}
\doifelsefileexists{font-imp-scripts.lua} {
\registerctxluafile{font-imp-scripts}{}
diff --git a/tex/context/base/mkiv/font-otj.lua b/tex/context/base/mkiv/font-otj.lua
index bb333755d..bec52d813 100644
--- a/tex/context/base/mkiv/font-otj.lua
+++ b/tex/context/base/mkiv/font-otj.lua
@@ -1554,7 +1554,7 @@ local function inject_everything(head,where)
end
--
if keepregisteredcounts then
- keepregisteredcounts = false
+ keepregisteredcounts = false
else
nofregisteredkerns = 0
nofregisteredpositions = 0
diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua
index 4df9c94ac..3b6ea6a72 100644
--- a/tex/context/base/mkiv/font-ots.lua
+++ b/tex/context/base/mkiv/font-ots.lua
@@ -533,19 +533,19 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
if not marks[char] then
baseindex = baseindex + componentindex
componentindex = count_components(start,marks)
- -- we can be more clever here: "not deletemarks or (skiphash and not skiphash[char])"
- -- and such:
+ -- we can be more clever here: "not deletemarks or (skiphash and not skiphash[char])"
+ -- and such:
elseif not deletemarks then
-- we can get a loop when the font expects otherwise (i.e. unexpected deletemarks)
setligaindex(start,baseindex + getligaindex(start,componentindex))
if trace_marks then
- logwarning("%s: keep mark %s, gets index %s",pref(dataset,sequence),gref(char),getligaindex(start))
+ logwarning("%s: keep ligature mark %s, gets index %s",pref(dataset,sequence),gref(char),getligaindex(start))
end
local n = copy_node(start)
copyinjection(n,start) -- is this ok ? we position later anyway
head, current = insert_node_after(head,current,n) -- unlikely that mark has components
elseif trace_marks then
- logwarning("%s: delete mark %s",pref(dataset,sequence),gref(char))
+ logwarning("%s: delete ligature mark %s",pref(dataset,sequence),gref(char))
end
start = getnext(start)
end
@@ -558,7 +558,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
if marks[char] then
setligaindex(start,baseindex + getligaindex(start,componentindex))
if trace_marks then
- logwarning("%s: set mark %s, gets index %s",pref(dataset,sequence),gref(char),getligaindex(start))
+ logwarning("%s: set ligature mark %s, gets index %s",pref(dataset,sequence),gref(char),getligaindex(start))
end
start = getnext(start)
else
diff --git a/tex/context/base/mkiv/font-pre.mkiv b/tex/context/base/mkiv/font-pre.mkiv
index 8e2e0a7a9..92da3892b 100644
--- a/tex/context/base/mkiv/font-pre.mkiv
+++ b/tex/context/base/mkiv/font-pre.mkiv
@@ -174,9 +174,14 @@
[fin2=yes,fin3=yes,med2=yes]
\definefontfeature
+ [reordercombining]
+ [reordercombining=yes]
+
+\definefontfeature
[hebrew]
[semitic-complete]
- [script=hebr]
+ [script=hebr,
+ reordercombining=yes] % seems to work best with reasonable fonts
\definefontfeature
[simplearabic]
diff --git a/tex/context/base/mkiv/math-frc.mkiv b/tex/context/base/mkiv/math-frc.mkiv
index 97107a6bf..8b068bc6c 100644
--- a/tex/context/base/mkiv/math-frc.mkiv
+++ b/tex/context/base/mkiv/math-frc.mkiv
@@ -361,10 +361,12 @@
\unexpanded\def\xfrac#1#2{\normalxfrac{\let\xfrac\xxfrac#1}{\let\xfrac\xxfrac#2}}
-%D Spacing:
+%D Spacing (sensitive for definition of \triggermathstyle:
-\unexpanded\def\nomathfractiongaps {\normalexpanded{\math_no_fraction_gaps \triggermathstyle\mathstyle}} % maybe collect settings
-\unexpanded\def\overlaymathfractiongaps{\normalexpanded{\math_overlay_fraction_gaps\triggermathstyle\mathstyle}} % maybe collect settings
+% \ifcase\contextlmtxmode
+
+\unexpanded\def\nomathfractiongaps {\normalexpanded{\math_no_fraction_gaps \mathstyletrigger\mathstyle}} % maybe collect settings
+\unexpanded\def\overlaymathfractiongaps{\normalexpanded{\math_overlay_fraction_gaps\mathstyletrigger\mathstyle}} % maybe collect settings
\unexpanded\def\math_no_fraction_gaps#1%
{\Umathfractionnumup #1\zeropoint
@@ -377,6 +379,21 @@
\Umathfractiondenomvgap#1\zeropoint
\Umathfractiondenomdown#1\zeropoint}
+% \else
+
+% \unexpanded\def\math_no_fraction_gaps
+% {\Umathfractionnumup \mathstyle\zeropoint
+% \Umathfractiondenomdown\mathstyle\zeropoint}
+%
+% \unexpanded\def\math_overlay_fraction_gaps
+% {\Umathfractionnumup \mathstyle\zeropoint
+% \Umathfractionnumvgap \mathstyle\zeropoint
+% %Umathfractionrule \mathstyle\zeropoint
+% \Umathfractiondenomvgap\mathstyle\zeropoint
+% \Umathfractiondenomdown\mathstyle\zeropoint}
+
+% \fi
+
\installcorenamespace{mathfractiondistance}
\letvalue{\??mathfractiondistance\v!none }\nomathfractiongaps
diff --git a/tex/context/base/mkiv/math-ini.mkiv b/tex/context/base/mkiv/math-ini.mkiv
index c79d3579c..ca92476ed 100644
--- a/tex/context/base/mkiv/math-ini.mkiv
+++ b/tex/context/base/mkiv/math-ini.mkiv
@@ -1828,18 +1828,32 @@
\crampedscriptscriptstyle \fi % 6 -> 7
#1}}
-\def\triggermathstyle#1% #1 is number
- {\ifcase\numexpr#1\relax
- \displaystyle \or % 0
- \crampeddisplaystyle \or % 1
- \textstyle \or % 2
- \crampedtextstyle \or % 3
- \scriptstyle \or % 4
- \crampedscriptstyle \or % 5
- \scriptscriptstyle \or % 6
- \crampedscriptscriptstyle \else
- % error
- \fi}
+\ifcase \contextlmtxmode
+
+ \def\triggermathstyle#1% #1 is number
+ {\ifcase\numexpr#1\relax
+ \displaystyle \or % 0
+ \crampeddisplaystyle \or % 1
+ \textstyle \or % 2
+ \crampedtextstyle \or % 3
+ \scriptstyle \or % 4
+ \crampedscriptstyle \or % 5
+ \scriptscriptstyle \or % 6
+ \crampedscriptscriptstyle \else
+ % error
+ \fi}
+
+ \let\mathstyletrigger\triggermathstyle
+
+\else
+
+ % mostly because it gives less tracing noise:
+
+ \def\triggermathstyle#1{\Ustyle\numexpr#1\relax}
+ %def\mathstyletrigger#1{\numexpr#1\relax}
+ \let\mathstyletrigger \firstofoneargument
+
+\fi
\def\triggeredmathstyleparameter#1% to bypass the relax
{\ifcase\numexpr\normalmathstyle\relax
diff --git a/tex/context/base/mkiv/mult-fun.lua b/tex/context/base/mkiv/mult-fun.lua
index 99700f474..095900861 100644
--- a/tex/context/base/mkiv/mult-fun.lua
+++ b/tex/context/base/mkiv/mult-fun.lua
@@ -89,7 +89,7 @@ return {
"verbatim",
"thelabel", "label",
"autoalign",
- "transparent", "withtransparency",
+ "transparent", "withtransparency", "withopacity",
"property", "properties", "withproperties",
"asgroup",
"infont", -- redefined using textext
diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua
index 2b3c1380c..ae7c750bd 100644
--- a/tex/context/base/mkiv/mult-low.lua
+++ b/tex/context/base/mkiv/mult-low.lua
@@ -414,7 +414,9 @@ return {
"normalsuperscript", "normalsubscript", "normalnosuperscript", "normalnosubscript",
"superscript", "subscript", "nosuperscript", "nosubscript",
--
- "uncramped", "cramped", "triggermathstyle", "mathstylefont", "mathsmallstylefont", "mathstyleface", "mathsmallstyleface", "mathstylecommand", "mathpalette",
+ "uncramped", "cramped",
+ "mathstyletrigger", "triggermathstyle",
+ "mathstylefont", "mathsmallstylefont", "mathstyleface", "mathsmallstyleface", "mathstylecommand", "mathpalette",
"mathstylehbox", "mathstylevbox", "mathstylevcenter", "mathstylevcenteredhbox", "mathstylevcenteredvbox",
"mathtext", "setmathsmalltextbox", "setmathtextbox",
"pushmathstyle", "popmathstyle",
diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua
index e722bbd66..5aafcee8e 100644
--- a/tex/context/base/mkiv/node-nut.lua
+++ b/tex/context/base/mkiv/node-nut.lua
@@ -326,6 +326,8 @@ nuts.setfam = direct.setfam
nuts.getboth = direct.getboth
nuts.setboth = direct.setboth
nuts.setlink = direct.setlink
+nuts.exchange = direct.exchange
+nuts.reverse = direct.reverse
nuts.setsplit = direct.setsplit
nuts.getlist = direct.getlist -- only hlist and vlist !
@@ -421,6 +423,31 @@ end
-- for now
+if not nuts.exchange then
+
+ local d_getprev = direct.getprev
+ local d_getnext = direct.getnext
+ local d_setlink = direct.setlink
+
+ function nuts.exchange(head,first,second)
+ if first then
+ if not second then
+ second = d_getnext(first)
+ end
+ if second then
+ d_setlink(d_getprev(first),second,first,d_getnext(second))
+ if first == head then
+ return second
+ end
+ end
+ end
+ return head
+ end
+
+end
+
+-- for now
+
if not nuts.getpre then
local d_getdisc = direct.getdisc
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 3420f73af..97606d8ba 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 769c98b57..858c331bb 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ