summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/char-cmp.lua261
-rw-r--r--tex/context/base/char-def.lua2
-rw-r--r--tex/context/base/char-ini.lua79
-rw-r--r--tex/context/base/char-ini.mkiv12
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-con.lua19
-rw-r--r--tex/context/base/core-fnt.mkiv7
-rw-r--r--tex/context/base/font-afm.lua243
-rw-r--r--tex/context/base/sort-ini.lua3
-rw-r--r--tex/context/base/status-files.pdfbin23256 -> 23236 bytes
-rw-r--r--tex/context/base/syst-aux.mkiv20
-rw-r--r--tex/context/base/syst-lua.lua22
-rw-r--r--tex/context/base/typo-cap.lua49
-rw-r--r--tex/context/base/typo-cln.lua16
-rw-r--r--tex/context/base/typo-krn.lua12
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua2
19 files changed, 357 insertions, 398 deletions
diff --git a/tex/context/base/char-cmp.lua b/tex/context/base/char-cmp.lua
deleted file mode 100644
index d972788c9..000000000
--- a/tex/context/base/char-cmp.lua
+++ /dev/null
@@ -1,261 +0,0 @@
-if not modules then modules = { } end modules ['char-cmp'] = {
- version = 1.001,
- comment = "companion to char-ini.mkiv",
- author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright = "PRAGMA ADE / ConTeXt Development Team",
- license = "see context related readme files"
-}
-
--- There is some overlap here with shcodes ... this file is only used
--- for afm loading.
-
-local type = type
-local utfchar, utfbyte = utf.char, utf.byte
-local unpack = unpack or table.unpack
-
-local allocate = utilities.storage.allocate
-
-local characters = characters
-local chardata = characters.data
-
-characters.uncomposed = allocate()
-local uncomposed = characters.uncomposed
-
---[[ldx--
-<p>The code defined here may move to the big character table.</p>
---ldx]]--
-
-characters.basedigits = allocate {
- ['zero'] = 48, ['one'] = 49,
- ['two'] = 50, ['three'] = 51,
- ['four'] = 52, ['five'] = 53,
- ['six'] = 54, ['seven'] = 55,
- ['eight'] = 56, ['nine'] = 57
-}
-
---[[ldx--
-<p>The next three tables can for instance be be used to enhance
-kerning tables that lack kerning pairs for these special characters.
-Of course they may come in handy elsewhere too. Using shcodes is
-not handy here (incpmplete).</p>
---ldx]]--
-
-local left = allocate {
- AEligature = "A", aeligature = "a",
- OEligature = "O", oeligature = "o",
- IJligature = "I", ijligature = "i",
- AE = "A", ae = "a",
- OE = "O", oe = "o",
- IJ = "I", ij = "i",
- Ssharp = "S", ssharp = "s",
-}
-
-local right = allocate {
- AEligature = "E", aeligature = "e",
- OEligature = "E", oeligature = "e",
- IJligature = "J", ijligature = "j",
- AE = "E", ae = "e",
- OE = "E", oe = "e",
- IJ = "J", ij = "j",
- Ssharp = "S", ssharp = "s",
-}
-
-local both = allocate {
- Acircumflex = "A", acircumflex = "a",
- Ccircumflex = "C", ccircumflex = "c",
- Ecircumflex = "E", ecircumflex = "e",
- Gcircumflex = "G", gcircumflex = "g",
- Hcircumflex = "H", hcircumflex = "h",
- Icircumflex = "I", icircumflex = "i",
- Jcircumflex = "J", jcircumflex = "j",
- Ocircumflex = "O", ocircumflex = "o",
- Scircumflex = "S", scircumflex = "s",
- Ucircumflex = "U", ucircumflex = "u",
- Wcircumflex = "W", wcircumflex = "w",
- Ycircumflex = "Y", ycircumflex = "y",
-
- Agrave = "A", agrave = "a",
- Egrave = "E", egrave = "e",
- Igrave = "I", igrave = "i",
- Ograve = "O", ograve = "o",
- Ugrave = "U", ugrave = "u",
- Ygrave = "Y", ygrave = "y",
-
- Atilde = "A", atilde = "a",
- Itilde = "I", itilde = "i",
- Otilde = "O", otilde = "o",
- Utilde = "U", utilde = "u",
- Ntilde = "N", ntilde = "n",
-
- Adiaeresis = "A", adiaeresis = "a", Adieresis = "A", adieresis = "a",
- Ediaeresis = "E", ediaeresis = "e", Edieresis = "E", edieresis = "e",
- Idiaeresis = "I", idiaeresis = "i", Idieresis = "I", idieresis = "i",
- Odiaeresis = "O", odiaeresis = "o", Odieresis = "O", odieresis = "o",
- Udiaeresis = "U", udiaeresis = "u", Udieresis = "U", udieresis = "u",
- Ydiaeresis = "Y", ydiaeresis = "y", Ydieresis = "Y", ydieresis = "y",
-
- Aacute = "A", aacute = "a",
- Cacute = "C", cacute = "c",
- Eacute = "E", eacute = "e",
- Iacute = "I", iacute = "i",
- Lacute = "L", lacute = "l",
- Nacute = "N", nacute = "n",
- Oacute = "O", oacute = "o",
- Racute = "R", racute = "r",
- Sacute = "S", sacute = "s",
- Uacute = "U", uacute = "u",
- Yacute = "Y", yacute = "y",
- Zacute = "Z", zacute = "z",
-
- Dstroke = "D", dstroke = "d",
- Hstroke = "H", hstroke = "h",
- Tstroke = "T", tstroke = "t",
-
- Cdotaccent = "C", cdotaccent = "c",
- Edotaccent = "E", edotaccent = "e",
- Gdotaccent = "G", gdotaccent = "g",
- Idotaccent = "I", idotaccent = "i",
- Zdotaccent = "Z", zdotaccent = "z",
-
- Amacron = "A", amacron = "a",
- Emacron = "E", emacron = "e",
- Imacron = "I", imacron = "i",
- Omacron = "O", omacron = "o",
- Umacron = "U", umacron = "u",
-
- Ccedilla = "C", ccedilla = "c",
- Kcedilla = "K", kcedilla = "k",
- Lcedilla = "L", lcedilla = "l",
- Ncedilla = "N", ncedilla = "n",
- Rcedilla = "R", rcedilla = "r",
- Scedilla = "S", scedilla = "s",
- Tcedilla = "T", tcedilla = "t",
-
- Ohungarumlaut = "O", ohungarumlaut = "o",
- Uhungarumlaut = "U", uhungarumlaut = "u",
-
- Aogonek = "A", aogonek = "a",
- Eogonek = "E", eogonek = "e",
- Iogonek = "I", iogonek = "i",
- Uogonek = "U", uogonek = "u",
-
- Aring = "A", aring = "a",
- Uring = "U", uring = "u",
-
- Abreve = "A", abreve = "a",
- Ebreve = "E", ebreve = "e",
- Gbreve = "G", gbreve = "g",
- Ibreve = "I", ibreve = "i",
- Obreve = "O", obreve = "o",
- Ubreve = "U", ubreve = "u",
-
- Ccaron = "C", ccaron = "c",
- Dcaron = "D", dcaron = "d",
- Ecaron = "E", ecaron = "e",
- Lcaron = "L", lcaron = "l",
- Ncaron = "N", ncaron = "n",
- Rcaron = "R", rcaron = "r",
- Scaron = "S", scaron = "s",
- Tcaron = "T", tcaron = "t",
- Zcaron = "Z", zcaron = "z",
-
- dotlessI = "I", dotlessi = "i",
- dotlessJ = "J", dotlessj = "j",
-
- AEligature = "AE", aeligature = "ae", AE = "AE", ae = "ae",
- OEligature = "OE", oeligature = "oe", OE = "OE", oe = "oe",
- IJligature = "IJ", ijligature = "ij", IJ = "IJ", ij = "ij",
-
- Lstroke = "L", lstroke = "l", Lslash = "L", lslash = "l",
- Ostroke = "O", ostroke = "o", Oslash = "O", oslash = "o",
-
- Ssharp = "SS", ssharp = "ss",
-
- Aumlaut = "A", aumlaut = "a",
- Eumlaut = "E", eumlaut = "e",
- Iumlaut = "I", iumlaut = "i",
- Oumlaut = "O", oumlaut = "o",
- Uumlaut = "U", uumlaut = "u",
-
-}
-
-uncomposed.left = left
-uncomposed.right = right
-uncomposed.both = both
-
---[[ldx--
-<p>The following function is used in the indexing code, where we
-need some sort of default fallback mapping. (This is obsolete!)</p>
---ldx]]--
-
-function characters.uncompose(n) -- n == string|number, returns string
- local cdn = type(n) == "string" and chardata[utfbyte(n)] or chardata[n]
- if cdn then
- local shcode = cdn.shcode
- if not shcode then
- return both[cdn.contextname] or n
- elseif type(shcode) == "table" then
- return utfchar(unpack(cdn.shcode))
- else
- return utfchar(cdn.shcode)
- end
- end
- return n
-end
-
---[[ldx--
-<p>Only characters with a code smaller than 128 make sense,
-anything larger is encoding dependent. An interesting complication
-is that a character can be in an encoding twice but is hashed
-once.</p>
---ldx]]--
-
-characters.ligatures = allocate {
- ['f'] = {
- { 'f', 'ff' },
- { 'i', 'fi' },
- { 'l', 'fl' },
- },
- ['ff'] = {
- { 'i', 'ffi' }
- },
- ['fi'] = {
- { 'i', 'fii' }
- },
- ['fl'] = {
- { 'i', 'fli' }
- },
- ['s'] = {
- { 't', 'st' }
- },
- ['i'] = {
- { 'j', 'ij' }
- },
-}
-
-characters.texligatures = allocate {
- -- ['space'] = {
- -- { 'L', 'Lslash' },
- -- { 'l', 'lslash' }
- -- },
- -- ['question'] = {
- -- { 'quoteleft', 'questiondown' }
- -- },
- -- ['exclam'] = {
- -- { 'quoteleft', 'exclamdown' }
- -- },
- ['quoteleft'] = {
- { 'quoteleft', 'quotedblleft' }
- },
- ['quoteright'] = {
- { 'quoteright', 'quotedblright' }
- },
- ['hyphen'] = {
- { 'hyphen', 'endash' }
- },
- ['endash'] = {
- { 'hyphen', 'emdash' }
- }
-}
-
---~ U+2019: right single quotation mark / quoteright
diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua
index e63024e6d..9549cab68 100644
--- a/tex/context/base/char-def.lua
+++ b/tex/context/base/char-def.lua
@@ -2245,7 +2245,7 @@ characters.data={
description="LATIN SMALL LETTER SHARP S",
direction="l",
linebreak="al",
- uccodes={ 0x0053, 0x0053 },
+ uccode={ 0x0053, 0x0053 },
unicodeslot=0x00DF,
},
{
diff --git a/tex/context/base/char-ini.lua b/tex/context/base/char-ini.lua
index 8e94d5917..798e79e18 100644
--- a/tex/context/base/char-ini.lua
+++ b/tex/context/base/char-ini.lua
@@ -647,6 +647,12 @@ function characters.setcodes()
if not lc then chr.lccode, lc = code, code end
if not uc then chr.uccode, uc = code, code end
texsetcatcode(code,11) -- letter
+ if type(lc) == "table" then
+ lc = code
+ end
+ if type(uc) == "table" then
+ uc = code
+ end
texsetlccode(code,lc,uc)
if cc == "lu" then
texsetsfcode(code,999)
@@ -691,38 +697,6 @@ function characters.category(n,verbose)
end
end
---[[ldx--
-<p>Requesting lower and uppercase codes:</p>
---ldx]]--
-
-function characters.uccode(n) return data[n].uccode or n end
-function characters.lccode(n) return data[n].lccode or n end
-
-function characters.flush(n,direct)
- local c = data[n]
- if c and c.contextname then
- c = "\\" .. c.contextname
- else
- c = utfchar(n)
- end
- if direct then
- return c
- else
- texsprint(c)
- end
-end
-
-function characters.shape(n)
- local shcode = data[n].shcode
- if not shcode then
- return n, nil
- elseif type(shcode) == "table" then
- return shcode[1], shcode[#shcode]
- else
- return shcode, nil
- end
-end
-
-- xml support (moved)
function characters.remapentity(chr,slot)
@@ -753,7 +727,7 @@ characters.activeoffset = 0x10000 -- there will be remapped in that byte range
local function utfstring(s)
if type(s) == "table" then
- return concat { utfchar( unpack(s) ) }
+ return utfchar(unpack(s)) -- concat { utfchar( unpack(s) ) }
else
return utfchar(s)
end
@@ -777,8 +751,12 @@ characters.lcchars = allocate() local lcchars = characters.lcchars -- lazy tabl
characters.ucchars = allocate() local ucchars = characters.ucchars -- lazy table
characters.shchars = allocate() local shchars = characters.shchars -- lazy table
-setmetatable(lcchars, { __index = function(t,u) if u then local c = data[u] c = c and c.lccode c = c and utfchar (c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end } )
-setmetatable(ucchars, { __index = function(t,u) if u then local c = data[u] c = c and c.uccode c = c and utfchar (c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end } )
+--~ setmetatable(lcchars, { __index = function(t,u) if u then local c = data[u] c = c and c.lccode c = c and utfchar (c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end } )
+--~ setmetatable(ucchars, { __index = function(t,u) if u then local c = data[u] c = c and c.uccode c = c and utfchar (c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end } )
+--~ setmetatable(shchars, { __index = function(t,u) if u then local c = data[u] c = c and c.shcode c = c and utfstring(c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end } )
+
+setmetatable(lcchars, { __index = function(t,u) if u then local c = data[u] c = c and c.lccode c = c and utfstring(c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end } )
+setmetatable(ucchars, { __index = function(t,u) if u then local c = data[u] c = c and c.uccode c = c and utfstring(c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end } )
setmetatable(shchars, { __index = function(t,u) if u then local c = data[u] c = c and c.shcode c = c and utfstring(c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end } )
characters.specialchars = allocate() local specialchars = characters.specialchars -- lazy table
@@ -865,6 +843,37 @@ function characters.lettered(str,spacing)
end
return concat(new)
end
+--[[ldx--
+<p>Requesting lower and uppercase codes:</p>
+--ldx]]--
+
+function characters.uccode(n) return uccodes[n] end -- obsolete
+function characters.lccode(n) return lccodes[n] end -- obsolete
+
+function characters.flush(n,direct)
+ local c = data[n]
+ if c and c.contextname then
+ c = "\\" .. c.contextname
+ else
+ c = utfchar(n)
+ end
+ if direct then
+ return c
+ else
+ texsprint(c)
+ end
+end
+
+function characters.shape(n)
+ local shcode = shcodes[n]
+ if not shcode then
+ return n, nil
+ elseif type(shcode) == "table" then
+ return shcode[1], shcode[#shcode]
+ else
+ return shcode, nil
+ end
+end
-- -- some day we might go this route, but it does not really save that much
-- -- so not now (we can generate a lot using mtx-unicode that operates on the
diff --git a/tex/context/base/char-ini.mkiv b/tex/context/base/char-ini.mkiv
index 67ba25173..cf27fdc14 100644
--- a/tex/context/base/char-ini.mkiv
+++ b/tex/context/base/char-ini.mkiv
@@ -15,7 +15,6 @@
\registerctxluafile{char-def}{1.001} % let's load this one first
\registerctxluafile{char-ini}{1.001}
-\registerctxluafile{char-cmp}{1.001} % maybe we will load this someplace else
\registerctxluafile{char-map}{1.001} % maybe we will load this someplace else
\registerctxluafile{char-tex}{1.001}
@@ -49,18 +48,11 @@
%D them (unless of course we have adapted the table). It is on the agenda
%D to do this with \type {tex.lccode} cum suis once they're available.
-\def\setcclcuc#1#2#3{\global\catcode#1=\lettercatcode\global\lccode#1=#2\global\uccode#1=#3\relax}
-\def\setcclcucself#1{\global\catcode#1=\lettercatcode\global\lccode#1=#1\global\uccode#1=#1\relax }
+% \def\setcclcuc#1#2#3{\global\catcode#1=\lettercatcode\global\lccode#1=#2\global\uccode#1=#3\relax}
+% \def\setcclcucself#1{\global\catcode#1=\lettercatcode\global\lccode#1=#1\global\uccode#1=#1\relax }
\ctxlua{characters.setcodes()}
-%D There may be a problem with the turkisch patterns. By now it's taken care of in
-%D ctxtools (thanks to Mojca). There seems to be a bug in the patterns (^^11 refers
-%D to a double quote but it should be ^^19 since the original is in ec encoding).
-
-% \setcclcuc "201C "201C "201C
-% \setcclcuc "201D "201D "201D
-
% Is setting up vrb tpa and tpb needed?
\ctxlua {
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 9dcdf261e..1b0f227c0 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2011.02.14 19:48}
+\newcontextversion{2011.02.14 23:30}
%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/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 17d3a9959..53b25bfce 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2011.02.14 19:48}
+\newcontextversion{2011.02.14 23:30}
%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/context.mkii b/tex/context/base/context.mkii
index 8f888a30c..218e94c87 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2011.02.14 19:48}
+\edef\contextversion{2011.02.14 23:30}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 2791cd0f0..b524df868 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2011.02.14 19:48}
+\edef\contextversion{2011.02.14 23:30}
%D For those who want to use this:
diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua
index e2f0b164e..277a7354d 100644
--- a/tex/context/base/core-con.lua
+++ b/tex/context/base/core-con.lua
@@ -166,11 +166,10 @@ converters.chr = chr
converters.chrs = chrs
converters.maxchrs = maxchrs
-local flushcharacter = characters and characters.flush or function(s) return utfchar(s) end
-local lowercharacter = characters and characters.lccode or function(s) return s end
-local uppercharacter = characters and characters.uccode or function(s) return s end
+local lowercharacter = characters.lcchars
+local uppercharacter = characters.ucchars
-local function do_alphabetic(n,mapping,mapper,verbose,t)
+local function do_alphabetic(n,mapping,mapper,t)
if not t then
t = { }
end
@@ -180,14 +179,10 @@ local function do_alphabetic(n,mapping,mapper,verbose,t)
end
local max = #mapping
if n > max then
- do_alphabetic(floor((n-1)/max),mapping,mapper,verbose,t)
- n = (n-1)%max+1
- end
- if verbose or type(chr) ~= "number" then
- t[#t+1] = chr
- else
- t[#t+1] = utfchar(chr)
+ do_alphabetic(floor((n-1)/max),mapping,mapper,t)
+ n = (n-1) % max + 1
end
+ t[#t+1] = chr
if n <= max then
return concat(t)
end
@@ -543,7 +538,7 @@ local function convert(method,n) -- todo: language
local lowermethod = lower(method)
local linguistic = counters[lowermethod]
if linguistic then
- return do_alphabetic(n,linguistic,lowermethod == method and lowercharacter or uppercharacter,false)
+ return do_alphabetic(n,linguistic,lowermethod == method and lowercharacter or uppercharacter)
end
local sequence = sequences[method]
if sequence then
diff --git a/tex/context/base/core-fnt.mkiv b/tex/context/base/core-fnt.mkiv
index bd91b5578..90dd93496 100644
--- a/tex/context/base/core-fnt.mkiv
+++ b/tex/context/base/core-fnt.mkiv
@@ -32,10 +32,13 @@
%D for verbatim data.
\appendtoks
- \disablecompoundcharacters
- \disablediscretionaries
+ \disablecompoundcharacters
+ \disablediscretionaries
\to \everycleanupfeatures
+%D The following code will me mkiv'd when needed. It's rather easy to
+%D extend the kerner with glue.
+
%D \macros
%D {stretched}
%D
diff --git a/tex/context/base/font-afm.lua b/tex/context/base/font-afm.lua
index a9d03b47e..3e6625386 100644
--- a/tex/context/base/font-afm.lua
+++ b/tex/context/base/font-afm.lua
@@ -37,6 +37,8 @@ fonts.afm = fonts.afm or { }
local afm = fonts.afm
local tfm = fonts.tfm
+-- so far
+
afm.version = 1.403 -- incrementing this number one up will force a re-cache
afm.syncspace = true -- when true, nicer stretch values
afm.addligatures = true -- best leave this set to true
@@ -270,7 +272,7 @@ by adding ligatures and kern information to the afm derived data. That
way we can set them faster when defining a font.</p>
--ldx]]--
-local addkerns, addligatures, unify -- we will implement these later
+local addkerns, addligatures, addtexligatures, unify -- we will implement these later
function afm.load(filename)
-- hm, for some reasons not resolved yet
@@ -306,15 +308,15 @@ function afm.load(filename)
unify(data,filename)
if afm.addligatures then
report_afm( "add ligatures")
- addligatures(data,'ligatures') -- easier this way
+ addligatures(data)
end
if afm.addtexligatures then
- report_afm( "add tex-ligatures")
- addligatures(data,'texligatures') -- easier this way
+ report_afm( "add tex ligatures")
+ addtexligatures(data)
end
if afm.addkerns then
report_afm( "add extra kerns")
- addkerns(data) -- faster this way
+ addkerns(data)
end
report_afm( "add tounicode data")
fonts.map.addtounicode(data,filename)
@@ -388,22 +390,77 @@ end
and extra kerns. This saves quite some lookups later.</p>
--ldx]]--
-addligatures = function(afmdata,ligatures)
+--[[ldx--
+<p>Only characters with a code smaller than 128 make sense,
+anything larger is encoding dependent. An interesting complication
+is that a character can be in an encoding twice but is hashed
+once.</p>
+--ldx]]--
+
+local ligatures = { -- okay, nowadays we could parse the name
+ ['f'] = {
+ { 'f', 'ff' },
+ { 'i', 'fi' },
+ { 'l', 'fl' },
+ },
+ ['ff'] = {
+ { 'i', 'ffi' }
+ },
+ ['fi'] = {
+ { 'i', 'fii' }
+ },
+ ['fl'] = {
+ { 'i', 'fli' }
+ },
+ ['s'] = {
+ { 't', 'st' }
+ },
+ ['i'] = {
+ { 'j', 'ij' }
+ },
+}
+
+local texligatures = {
+ -- ['space'] = {
+ -- { 'L', 'Lslash' },
+ -- { 'l', 'lslash' }
+ -- },
+ -- ['question'] = {
+ -- { 'quoteleft', 'questiondown' }
+ -- },
+ -- ['exclam'] = {
+ -- { 'quoteleft', 'exclamdown' }
+ -- },
+ ['quoteleft'] = {
+ { 'quoteleft', 'quotedblleft' }
+ },
+ ['quoteright'] = {
+ { 'quoteright', 'quotedblright' }
+ },
+ ['hyphen'] = {
+ { 'hyphen', 'endash' }
+ },
+ ['endash'] = {
+ { 'hyphen', 'emdash' }
+ }
+}
+
+local addthem = function(afmdata,ligatures)
local glyphs, luatex = afmdata.glyphs, afmdata.luatex
local indices, unicodes, names = luatex.indices, luatex.unicodes, luatex.names
- for k,v in next, characters[ligatures] do -- main characters table
- local one = glyphs[names[k]]
+ for ligname, ligdata in next, ligatures do
+ local one = glyphs[names[ligname]]
if one then
- for _, b in next, v do
- two, three = b[1], b[2]
+ for _, pair in next, ligdata do
+ local two, three = pair[1], pair[2]
if two and three and names[two] and names[three] then
- local ol = one[ligatures]
+ local ol = one.ligatures
if ol then
if not ol[two] then -- was one.ligatures ... bug
ol[two] = three
end
else
- one[ligatures] = { [two] = three }
+ one.ligatures = { [two] = three }
end
end
end
@@ -411,22 +468,168 @@ addligatures = function(afmdata,ligatures)
end
end
+addligatures = function(afmdata) addthem(afmdata,ligatures ) end
+addtexligatures = function(afmdata) addthem(afmdata,texligatures) end
+
--[[ldx--
<p>We keep the extra kerns in separate kerning tables so that we can use
them selectively.</p>
--ldx]]--
+-- This is rather old code (from the beginning when we had only tfm). If
+-- we unify the afm data (now we have names all over the place) then
+-- we can use shcodes but there will be many more looping then. But we
+-- could get rid of the tables in char-cmp then.
+
+local left = {
+ AEligature = "A", aeligature = "a",
+ OEligature = "O", oeligature = "o",
+ IJligature = "I", ijligature = "i",
+ AE = "A", ae = "a",
+ OE = "O", oe = "o",
+ IJ = "I", ij = "i",
+ Ssharp = "S", ssharp = "s",
+}
+
+local right = {
+ AEligature = "E", aeligature = "e",
+ OEligature = "E", oeligature = "e",
+ IJligature = "J", ijligature = "j",
+ AE = "E", ae = "e",
+ OE = "E", oe = "e",
+ IJ = "J", ij = "j",
+ Ssharp = "S", ssharp = "s",
+}
+
+local both = {
+ Acircumflex = "A", acircumflex = "a",
+ Ccircumflex = "C", ccircumflex = "c",
+ Ecircumflex = "E", ecircumflex = "e",
+ Gcircumflex = "G", gcircumflex = "g",
+ Hcircumflex = "H", hcircumflex = "h",
+ Icircumflex = "I", icircumflex = "i",
+ Jcircumflex = "J", jcircumflex = "j",
+ Ocircumflex = "O", ocircumflex = "o",
+ Scircumflex = "S", scircumflex = "s",
+ Ucircumflex = "U", ucircumflex = "u",
+ Wcircumflex = "W", wcircumflex = "w",
+ Ycircumflex = "Y", ycircumflex = "y",
+
+ Agrave = "A", agrave = "a",
+ Egrave = "E", egrave = "e",
+ Igrave = "I", igrave = "i",
+ Ograve = "O", ograve = "o",
+ Ugrave = "U", ugrave = "u",
+ Ygrave = "Y", ygrave = "y",
+
+ Atilde = "A", atilde = "a",
+ Itilde = "I", itilde = "i",
+ Otilde = "O", otilde = "o",
+ Utilde = "U", utilde = "u",
+ Ntilde = "N", ntilde = "n",
+
+ Adiaeresis = "A", adiaeresis = "a", Adieresis = "A", adieresis = "a",
+ Ediaeresis = "E", ediaeresis = "e", Edieresis = "E", edieresis = "e",
+ Idiaeresis = "I", idiaeresis = "i", Idieresis = "I", idieresis = "i",
+ Odiaeresis = "O", odiaeresis = "o", Odieresis = "O", odieresis = "o",
+ Udiaeresis = "U", udiaeresis = "u", Udieresis = "U", udieresis = "u",
+ Ydiaeresis = "Y", ydiaeresis = "y", Ydieresis = "Y", ydieresis = "y",
+
+ Aacute = "A", aacute = "a",
+ Cacute = "C", cacute = "c",
+ Eacute = "E", eacute = "e",
+ Iacute = "I", iacute = "i",
+ Lacute = "L", lacute = "l",
+ Nacute = "N", nacute = "n",
+ Oacute = "O", oacute = "o",
+ Racute = "R", racute = "r",
+ Sacute = "S", sacute = "s",
+ Uacute = "U", uacute = "u",
+ Yacute = "Y", yacute = "y",
+ Zacute = "Z", zacute = "z",
+
+ Dstroke = "D", dstroke = "d",
+ Hstroke = "H", hstroke = "h",
+ Tstroke = "T", tstroke = "t",
+
+ Cdotaccent = "C", cdotaccent = "c",
+ Edotaccent = "E", edotaccent = "e",
+ Gdotaccent = "G", gdotaccent = "g",
+ Idotaccent = "I", idotaccent = "i",
+ Zdotaccent = "Z", zdotaccent = "z",
+
+ Amacron = "A", amacron = "a",
+ Emacron = "E", emacron = "e",
+ Imacron = "I", imacron = "i",
+ Omacron = "O", omacron = "o",
+ Umacron = "U", umacron = "u",
+
+ Ccedilla = "C", ccedilla = "c",
+ Kcedilla = "K", kcedilla = "k",
+ Lcedilla = "L", lcedilla = "l",
+ Ncedilla = "N", ncedilla = "n",
+ Rcedilla = "R", rcedilla = "r",
+ Scedilla = "S", scedilla = "s",
+ Tcedilla = "T", tcedilla = "t",
+
+ Ohungarumlaut = "O", ohungarumlaut = "o",
+ Uhungarumlaut = "U", uhungarumlaut = "u",
+
+ Aogonek = "A", aogonek = "a",
+ Eogonek = "E", eogonek = "e",
+ Iogonek = "I", iogonek = "i",
+ Uogonek = "U", uogonek = "u",
+
+ Aring = "A", aring = "a",
+ Uring = "U", uring = "u",
+
+ Abreve = "A", abreve = "a",
+ Ebreve = "E", ebreve = "e",
+ Gbreve = "G", gbreve = "g",
+ Ibreve = "I", ibreve = "i",
+ Obreve = "O", obreve = "o",
+ Ubreve = "U", ubreve = "u",
+
+ Ccaron = "C", ccaron = "c",
+ Dcaron = "D", dcaron = "d",
+ Ecaron = "E", ecaron = "e",
+ Lcaron = "L", lcaron = "l",
+ Ncaron = "N", ncaron = "n",
+ Rcaron = "R", rcaron = "r",
+ Scaron = "S", scaron = "s",
+ Tcaron = "T", tcaron = "t",
+ Zcaron = "Z", zcaron = "z",
+
+ dotlessI = "I", dotlessi = "i",
+ dotlessJ = "J", dotlessj = "j",
+
+ AEligature = "AE", aeligature = "ae", AE = "AE", ae = "ae",
+ OEligature = "OE", oeligature = "oe", OE = "OE", oe = "oe",
+ IJligature = "IJ", ijligature = "ij", IJ = "IJ", ij = "ij",
+
+ Lstroke = "L", lstroke = "l", Lslash = "L", lslash = "l",
+ Ostroke = "O", ostroke = "o", Oslash = "O", oslash = "o",
+
+ Ssharp = "SS", ssharp = "ss",
+
+ Aumlaut = "A", aumlaut = "a",
+ Eumlaut = "E", eumlaut = "e",
+ Iumlaut = "I", iumlaut = "i",
+ Oumlaut = "O", oumlaut = "o",
+ Uumlaut = "U", uumlaut = "u",
+
+}
+
addkerns = function(afmdata) -- using shcodes is not robust here
local glyphs = afmdata.glyphs
local names = afmdata.luatex.names
- local uncomposed = characters.uncomposed
local function do_it_left(what)
for index, glyph in next, glyphs do
local kerns = glyph.kerns
if kerns then
local extrakerns = glyph.extrakerns or { }
- for complex, simple in next, uncomposed[what] do
- if names[compex] then
+ for complex, simple in next, what do
+ if names[complex] then
local ks = kerns[simple]
if ks and not kerns[complex] then
extrakerns[complex] = ks
@@ -440,7 +643,7 @@ addkerns = function(afmdata) -- using shcodes is not robust here
end
end
local function do_it_copy(what)
- for complex, simple in next, uncomposed[what] do
+ for complex, simple in next, what do
local c = glyphs[names[complex]]
if c then -- optional
local s = glyphs[names[simple]]
@@ -462,11 +665,11 @@ addkerns = function(afmdata) -- using shcodes is not robust here
end
end
-- add complex with values of simplified when present
- do_it_left("left")
- do_it_left("both")
+ do_it_left(left)
+ do_it_left(both)
-- copy kerns from simple char to complex char unless set
- do_it_copy("both")
- do_it_copy("right")
+ do_it_copy(both)
+ do_it_copy(right)
end
--[[ldx--
diff --git a/tex/context/base/sort-ini.lua b/tex/context/base/sort-ini.lua
index f08ba0e26..dc6765c79 100644
--- a/tex/context/base/sort-ini.lua
+++ b/tex/context/base/sort-ini.lua
@@ -479,6 +479,9 @@ function splitters.utf(str) -- we could append m and u but this is cleaner, s is
local l = lower[sc]
n = n + 1
l = l and utfbyte(l) or lccodes[b]
+ if type(l) == "table" then
+ l = l[1] -- there are currently no tables in lccodes but it can be some, day
+ end
z_case[n] = l
if l ~= b then
m_case[n] = l - 1
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 56441cb1e..e9fde1cd5 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv
index 17169acbf..f9c339dff 100644
--- a/tex/context/base/syst-aux.mkiv
+++ b/tex/context/base/syst-aux.mkiv
@@ -59,23 +59,15 @@
%D to use development versions of \MKIV\ for real documents.
%D
%D \starttyping
-%D \doifolderversionelse\contextversion{2001.02.03}{yes}{no}
-%D \doifolderversionelse\contextversion{3001.02.03}{yes}{no}
+%D \doifolderversionelse\contextversion{1010.10.10} {OLDER} {OKAY} => OLDER
+%D \doifolderversionelse\contextversion{2020.20.20} {OLDER} {OKAY} => OKAY
+%D \doifolderversionelse\contextversion{2020} {OLDER} {OKAY} => OKAY
%D \stoptyping
%D
-%D The \type {yyyy.mm.dd} syntax is rather strict.
+%D The version pattern is \type {yyyy.mm.dd} (with mm and dd being optional).
-% todo: lua
-
-\def\@@versiontonumber#1.#2.#3#4#5\relax
- {\numexpr#1*\plustenthousand+#2*\plushundred+#3#4\relax}
-
-\def\doifolderversionelse#1#2%
- {\normalexpanded{\noexpand\ifnum\noexpand\@@versiontonumber#1\relax<\noexpand\@@versiontonumber#2\relax}\relax
- \expandafter\firstoftwoarguments
- \else
- \expandafter\secondoftwoarguments
- \fi}
+\def\doifolderversionelse#1#2{\ctxcommand{doifolderversionelse("#1","#2")}}
+\def\doifoldercontextelse #1{\ctxcommand{doifolderversionelse("#1")}}
%D \macros
%D {normalspace}
diff --git a/tex/context/base/syst-lua.lua b/tex/context/base/syst-lua.lua
index fefe415cf..7c619b6d3 100644
--- a/tex/context/base/syst-lua.lua
+++ b/tex/context/base/syst-lua.lua
@@ -8,7 +8,8 @@ if not modules then modules = { } end modules ['syst-lua'] = {
local texsprint, texprint, texwrite, texiowrite_nl = tex.sprint, tex.print, tex.write, texio.write_nl
local format, find = string.format, string.find
-local lpegmatch = lpeg.match
+local tonumber = tonumber
+local S, Ct, lpegmatch, lpegsplitat = lpeg.S, lpeg.Ct, lpeg.match, lpeg.splitat
local ctxcatcodes = tex.ctxcatcodes
@@ -53,7 +54,7 @@ function commands.doifelsespaces(str)
return commands.doifelse(find(str,"^ +$"))
end
-local s = lpeg.Ct(lpeg.splitat(","))
+local s = Ct(lpegsplitat(","))
local h = { }
function commands.doifcommonelse(a,b)
@@ -87,3 +88,20 @@ local pattern = lpeg.patterns.validdimen
function commands.doifdimenstringelse(str)
testcase(lpegmatch(pattern,str))
end
+
+local splitter = lpegsplitat(S(". "))
+
+function commands.doifolderversionelse(one,two) -- no checking done
+ if not two then
+ one, two = environment.version, one
+ elseif one == "" then
+ one = environment.version
+ end
+ local y_1, m_1, d_1 = lpeg.match(splitter,one)
+ local y_2, m_2, d_2 = lpeg.match(splitter,two)
+ commands.testcase ( not (
+ (tonumber(y_2) or 0) >= (tonumber(y_1) or 0) and
+ (tonumber(m_2) or 99) >= (tonumber(m_1) or 0) and
+ (tonumber(d_2) or 99) >= (tonumber(d_1) or 0)
+ ) )
+end
diff --git a/tex/context/base/typo-cap.lua b/tex/context/base/typo-cap.lua
index aaa9de933..a8e714a9b 100644
--- a/tex/context/base/typo-cap.lua
+++ b/tex/context/base/typo-cap.lua
@@ -63,9 +63,12 @@ local lastfont = nil
--
-- \WORD {far too \Word{many \WORD{more \word{pushed} in between} useless} words}
-local function helper(start, code, codes, special, attribute, once)
+local uccodes = characters.uccodes
+local lccodes = characters.lccodes
+
+local function helper(start, codes, special, attribute, once)
local char = start.char
- local dc = chardata[char]
+ local dc = codes[char]
if dc then
local fnt = start.font
if special then
@@ -84,16 +87,16 @@ local function helper(start, code, codes, special, attribute, once)
end
end
local ifc = fontchar[fnt]
- local ucs = dc[codes]
- if ucs then
+ if type(dc) == "table" then
local ok = true
- for i=1,#ucs do
- ok = ok and ifc[ucs[i]]
+ for i=1,#dc do
+ ok = ok and ifc[dc[i]]
end
if ok then
+ -- tood; use generic injector
local prev, original = start, start
- for i=1,#ucs do
- local chr = ucs[i]
+ for i=1,#dc do
+ local chr = dc[i]
prev = start
if i == 1 then
start.char = chr
@@ -115,10 +118,8 @@ local function helper(start, code, codes, special, attribute, once)
end
if once then lastfont = nil end
return start, false
- end
- local uc = dc[code]
- if uc and ifc[uc] then
- start.char = uc
+ elseif ifc[dc] then
+ start.char = dc
if once then lastfont = nil end
return start, true
end
@@ -129,12 +130,12 @@ end
actions[1] = function(start,attribute)
lastfont = nil
- return helper(start,'uccode','uccodes')
+ return helper(start,uccodes)
end
actions[2] = function(start,attribute)
lastfont = nil
- return helper(start,'lccode','lccodes')
+ return helper(start,lccodes)
end
actions[3] = function(start,attribute,attr)
@@ -154,7 +155,7 @@ actions[3] = function(start,attribute,attr)
end
-- we could return the last in the range and save some scanning
-- but why bother
- return helper(start,'uccode','uccodes')
+ return helper(start,uccodes)
else
return start, false
end
@@ -167,18 +168,18 @@ actions[4] = function(start,attribute)
prev = prev.prev
end
if not prev or prev.id ~= glyph_code then
- return helper(start,'uccode','uccodes')
+ return helper(start,uccodes)
else
return start, false
end
end
actions[5] = function(start,attribute) -- 3
- return helper(start,'uccode','uccodes',true,attribute,true)
+ return helper(start,uccodes,true,attribute,true)
end
actions[6] = function(start,attribute) -- 4
- return helper(start,'uccode','uccodes',true,attribute,false)
+ return helper(start,uccodes,true,attribute,false)
end
actions[8] = function(start)
@@ -187,23 +188,23 @@ actions[8] = function(start)
local mr = math.random
-- local tfm = fontdata[start.font].characters
local tfm = fontchar[start.font]
- if chardata[ch].lccode then
+ if lccodes[ch] then
while true do
local d = chardata[mr(1,0xFFFF)]
if d then
- local uc = d.uccode
- if uc and tfm[uc] then
+ local uc = uccodes[d]
+ if uc and tfm[uc] then -- this also intercepts tables
start.char = uc
return start, true
end
end
end
- elseif chardata[ch].uccode then
+ elseif uccodes[ch] then
while true do
local d = chardata[mr(1,0xFFFF)]
if d then
- local lc = d.lccode
- if lc and tfm[lc] then
+ local lc = lccodes[d]
+ if lc and tfm[lc] then -- this also intercepts tables
start.char = lc
return start, true
end
diff --git a/tex/context/base/typo-cln.lua b/tex/context/base/typo-cln.lua
index 09e8744ea..2327ef6be 100644
--- a/tex/context/base/typo-cln.lua
+++ b/tex/context/base/typo-cln.lua
@@ -32,7 +32,7 @@ local traverse_id = node.traverse_id
local glyph_code = nodecodes.glyph
local uccodes = characters.uccodes
-local a_cleaner = attributes.private("cleaner")
+local a_cleaner = attributes.private("cleaner")
local resetter = { -- this will become an entry in char-def
[utfbyte(".")] = true
@@ -53,11 +53,15 @@ local function process(namespace,attribute,head)
local a = has_attribute(n,attribute)
if a == 1 then -- currently only one cleaner so no need to be fancy
local upper = uccodes[char]
- n.char = upper
- inline = true
- done = true
- if trace_autocase then
- report_autocase("")
+ if type(upper) == "table" then
+ -- some day, not much change that \SS ends up here
+ else
+ n.char = upper
+ inline = true
+ done = true
+ if trace_autocase then
+ report_autocase("")
+ end
end
end
end
diff --git a/tex/context/base/typo-krn.lua b/tex/context/base/typo-krn.lua
index 9bf3cb1f5..597950c6a 100644
--- a/tex/context/base/typo-krn.lua
+++ b/tex/context/base/typo-krn.lua
@@ -80,7 +80,7 @@ kerns.keeptogether = false -- just for fun (todo: control setting with key/value
-- can be optimized .. the prev thing .. but hardly worth the effort
-local function do_process(namespace,attribute,head,force)
+local function do_process(namespace,attribute,head,force) -- todo: glue so that we can fully stretch
local start, done, lastfont = head, false, nil
local keepligature = kerns.keepligature
local keeptogether = kerns.keeptogether
@@ -130,7 +130,7 @@ if keeptogether and prev.prev.id == glyph_code and keeptogether(prev.prev,start)
-- keep 'm
else
prev.subtype = userkern_code
- prev.kern = prev.kern + quaddata[lastfont]*krn
+ prev.kern = prev.kern + quaddata[lastfont]*krn -- here
done = true
end
elseif pid == glyph_code then
@@ -141,12 +141,12 @@ if keeptogether and keeptogether(prev,start) then
else
local kerns = chardata[lastfont][prevchar].kerns
local kern = kerns and kerns[lastchar] or 0
- krn = kern + quaddata[lastfont]*krn
+ krn = kern + quaddata[lastfont]*krn -- here
insert_node_before(head,start,new_kern(krn))
done = true
end
else
- krn = quaddata[lastfont]*krn
+ krn = quaddata[lastfont]*krn -- here
insert_node_before(head,start,new_kern(krn))
done = true
end
@@ -201,9 +201,9 @@ end
local prevchar, lastchar = prv.char, start.char
local kerns = chardata[lastfont][prevchar].kerns
local kern = kerns and kerns[lastchar] or 0
- krn = kern + quaddata[lastfont]*krn
+ krn = kern + quaddata[lastfont]*krn -- here
else
- krn = quaddata[lastfont]*krn
+ krn = quaddata[lastfont]*krn -- here
end
disc.replace = new_kern(krn)
end
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index bc825a306..77a5b5053 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 02/14/11 19:48:13
+-- merge date : 02/14/11 23:30:41
do -- begin closure to overcome local limits and interference