summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2010-10-07 15:53:01 +0300
committerMarius <mariausol@gmail.com>2010-10-07 15:53:01 +0300
commit2040be98036288cccf0384479819e8c0c17e8d8d (patch)
tree1e775ec1491e701839806c9768d865ab829adccc
parent592d84d67cf9d58d8a205b46bb912ed9fe84d7a2 (diff)
downloadcontext-2040be98036288cccf0384479819e8c0c17e8d8d.tar.gz
beta 2010.10.06 10:20
-rw-r--r--tex/context/base/bibl-bib.mkiv1
-rw-r--r--tex/context/base/char-cmp.lua41
-rw-r--r--tex/context/base/char-ini.lua2
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/font-afm.lua2
-rw-r--r--tex/context/base/font-fbk.lua316
-rw-r--r--tex/context/base/font-gds.lua42
-rw-r--r--tex/context/base/font-ini.mkiv2
-rw-r--r--tex/context/base/lpdf-fld.lua26
-rw-r--r--tex/context/base/m-barcodes.mkiv12
-rw-r--r--tex/context/base/node-ini.lua14
-rw-r--r--tex/context/base/node-tra.lua37
-rw-r--r--tex/context/base/page-lin.lua8
-rw-r--r--tex/context/base/page-lin.mkiv8
-rw-r--r--tex/context/base/sort-ini.lua31
-rw-r--r--tex/context/base/spac-ver.lua96
-rw-r--r--tex/context/base/strc-lnt.mkiv49
-rw-r--r--tex/context/base/strc-lst.lua8
-rw-r--r--tex/context/base/strc-lst.mkiv1
-rw-r--r--tex/context/base/strc-not.mkiv1
-rw-r--r--tex/context/base/strc-reg.mkiv25
-rw-r--r--tex/context/base/strc-syn.mkiv2
-rw-r--r--tex/context/base/type-otf.mkiv2
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua2
25 files changed, 408 insertions, 324 deletions
diff --git a/tex/context/base/bibl-bib.mkiv b/tex/context/base/bibl-bib.mkiv
index 4bdb7713a..020f6e921 100644
--- a/tex/context/base/bibl-bib.mkiv
+++ b/tex/context/base/bibl-bib.mkiv
@@ -280,7 +280,6 @@
*doi*
\stopxmlsetups
-
\startxmlsetups bibtex:format:doi
% \bibdoifelse{\@@pb@biburl}{#1\expanded{\bibgotoURL{\@@pb@thekey}{\@@pb@biburl}}#2}{#3}
*url*
diff --git a/tex/context/base/char-cmp.lua b/tex/context/base/char-cmp.lua
index 1f414d502..be75dc0fd 100644
--- a/tex/context/base/char-cmp.lua
+++ b/tex/context/base/char-cmp.lua
@@ -34,24 +34,10 @@ characters.basedigits = allocate {
--[[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</p>
+Of course they may come in handy elsewhere too. Using shcodes is
+not handy here (incpmplete).</p>
--ldx]]--
--- we can use shcodes, but then we also need slcode and srcode
---
--- AEligature
--- => slcode == ub('A')
--- => srcode == ub('E')
--- or
--- => shcode == { ub('A'), ub('E') }
--- => reduction = "AE"
---
--- eacute
--- => shcode == ub('A')
--- or
--- => shcode == { ub('a') }
--- => reduction = "a"
-
uncomposed.left = allocate {
AEligature = "A", aeligature = "a",
OEligature = "O", oeligature = "o",
@@ -191,9 +177,28 @@ uncomposed.both = allocate {
}
+-- adobename ... inclomplete
+--
+-- if characters.data then
+-- uncomposed.left, uncomposed.right, uncomposed.both = allocate(), allocate(), allocate()
+-- for k,v in next, characters.data do
+-- local s = v.shcode
+-- if s then
+-- local name = v.adobename
+-- if not name then
+-- -- table.print(v) -- only used for afm anyway
+-- elseif type(s) == "table" then
+-- uncomposed.left[name], uncomposed.right[name] = s[1], s[#s]
+-- else
+-- uncomposed.both[name] = s
+-- end
+-- end
+-- end
+-- end
+
--[[ldx--
-<p>The following function is used in the indexing code, where
-we need some sort of default fallback mapping.</p>
+<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
diff --git a/tex/context/base/char-ini.lua b/tex/context/base/char-ini.lua
index 10df66e47..369b4f2d2 100644
--- a/tex/context/base/char-ini.lua
+++ b/tex/context/base/char-ini.lua
@@ -377,7 +377,7 @@ if not characters.fallbacks then
end
-storage.register("characters/fallbacks", characters.fallbacks, "characters.fallbacks")
+storage.register("characters/fallbacks", characters.fallbacks, "characters.fallbacks") -- accents and such
storage.register("characters/directions", characters.directions, "characters.directions")
--[[ldx--
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 5a5e36911..c2577a3a6 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2010.10.03 18:07}
+\newcontextversion{2010.10.06 10:20}
%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.tex b/tex/context/base/context.tex
index 99e6f2f8c..17ab0279f 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2010.10.03 18:07}
+\edef\contextversion{2010.10.06 10:20}
%D For those who want to use this:
diff --git a/tex/context/base/font-afm.lua b/tex/context/base/font-afm.lua
index f0c440e9c..5897904b2 100644
--- a/tex/context/base/font-afm.lua
+++ b/tex/context/base/font-afm.lua
@@ -406,7 +406,7 @@ end
them selectively.</p>
--ldx]]--
-addkerns = function(afmdata)
+addkerns = function(afmdata) -- using shcodes is not robust here
local glyphs = afmdata.glyphs
local names = afmdata.luatex.names
local uncomposed = characters.uncomposed
diff --git a/tex/context/base/font-fbk.lua b/tex/context/base/font-fbk.lua
index 865e92623..ea6854456 100644
--- a/tex/context/base/font-fbk.lua
+++ b/tex/context/base/font-fbk.lua
@@ -7,12 +7,14 @@ if not modules then modules = { } end modules ['font-fbk'] = {
}
local cos, tan, rad, format = math.cos, math.tan, math.rad, string.format
-local byte = utf.byte
-
--- maybe use compose instead of combine
+local utfbyte, utfchar = utf.byte, utf.char
local trace_combining = false trackers.register("fonts.combining", function(v) trace_combining = v end)
+trackers.register("fonts.composing", "fonts.combining")
+
+local report_combining = logs.new("combining")
+
local allocate = utilities.storage.allocate
--[[ldx--
@@ -45,129 +47,22 @@ commands["set-tracing"] = function(g,v)
end
end
-local force_fallback = false
-
-commands["fake-character"] = function(g,v) -- g, nr, fallback_id
- local index, fallback = v[2], v[3]
- if (force_fallback or not g.characters[index]) and fallbacks[fallback] then
- g.characters[index], g.descriptions[index] = fallbacks[fallback](g)
- end
-end
-
-fallbacks['textcent'] = function (g)
- local c = ("c"):byte()
- local t = table.fastcopy(g.characters[c],true)
- local a = - tan(rad(g.italicangle or 0))
- local vfspecials = backends.tables.vfspecials
- local green, black
- if trace_combining then
- green, black = vfspecials.green, vfspecials.black
- end
- local startslant, stopslant = vfspecials.startslant, vfspecials.stopslant
- local quad = g.parameters.quad
- if a == 0 then
- if trace_combining then
- t.commands = {
- push, {"slot", 1, c}, pop,
- {"right", .5*t.width},
- {"down", .2*t.height},
- green,
- {"rule", 1.4*t.height, .02*quad},
- black,
- }
- else
- t.commands = {
- push, {"slot", 1, c}, pop,
- {"right", .5*t.width},
- {"down", .2*t.height},
- {"rule", 1.4*t.height, .02*quad},
- }
- end
- else
- if trace_combining then
- t.commands = {
- push,
- {"right", .5*t.width-.025*quad},
- {"down", .2*t.height},
- startslant(a),
- green,
- {"rule", 1.4*t.height, .025*quad},
- black,
- stopslant,
- pop,
- {"slot", 1, c} -- last else problems with cm
- }
- else
- t.commands = {
- push,
- {"right", .5*t.width-.025*quad},
- {"down", .2*t.height},
- startslant(a),
- {"rule", 1.4*t.height, .025*quad},
- stopslant,
- pop,
- {"slot", 1, c} -- last else problems with cm
- }
- end
- end
- -- somehow the width is messed up now
- -- todo: set height
- t.height = 1.2*t.height
- t.depth = 0.2*t.height
- g.virtualized = true
- local d = g.descriptions
- return t, d and d[c]
-end
-
-fallbacks['texteuro'] = function (g)
- local c = ("C"):byte()
- local t = table.fastcopy(g.characters[c],true)
- local d = cos(rad(90+(g.italicangle)))
- local vfspecials = backends.tables.vfspecials
- local green, black
- if trace_combining then
- green, black = vfspecials.green, vfspecials.black
- end
- local quad = g.parameters.quad
- t.width = 1.05*t.width
- if trace_combining then
- t.commands = {
- {"right", .05*t.width},
- push, {"slot", 1, c}, pop,
- {"right", .5*t.width*d},
- {"down", -.5*t.height},
- green,
- {"rule", .05*quad, .4*quad},
- black,
- }
- else
- t.commands = {
- {"right", .05*t.width},
- push, {"slot", 1, c}, pop,
- {"right", .5*t.width*d},
- {"down", -.5*t.height},
- {"rule", .05*quad, .4*quad},
- }
- end
- g.virtualized = true
- return t, g.descriptions[c]
-end
-
-- maybe store llx etc instead of bbox in tfm blob / more efficient
local force_composed = false
-local cache = { } -- we could make these weak
+local cache = { } -- we could make these weak
+local fraction = 0.15 -- 30 units for lucida
function vf.aux.compose_characters(g) -- todo: scaling depends on call location
-- this assumes that slot 1 is self, there will be a proper self some day
local chars, descs = g.characters, g.descriptions
- local X = byte("X")
- local xchar = chars[X]
- local xdesc = descs[X]
- if xchar and xdesc then
+ local Xdesc, xdesc = descs[utfbyte("X")], descs[utfbyte("x")]
+ if Xdesc and xdesc then
local scale = g.factor or 1
- local cap_ury = scale*xdesc.boundingbox[4]
+ local deltaxheight = scale * (Xdesc.boundingbox[4] - xdesc.boundingbox[4])
+ local extraxheight = fraction * deltaxheight -- maybe use compose value
+ -- local cap_ury = scale*xdesc.boundingbox[4]
local ita_cor = cos(rad(90+(g.italicangle or 0)))
local fallbacks = characters.fallbacks
local vfspecials = backends.tables.vfspecials
@@ -175,6 +70,10 @@ function vf.aux.compose_characters(g) -- todo: scaling depends on call location
if trace_combining then
red, green, blue, black = vfspecials.red, vfspecials.green, vfspecials.blue, vfspecials.black
end
+ local compose = fonts.goodies.getcompositions(g)
+ if compose and trace_combining then
+ report_combining("using compose information from goodies file")
+ end
local done = false
for i,c in next, characters.data do
if force_composed or not chars[i] then
@@ -206,6 +105,9 @@ function vf.aux.compose_characters(g) -- todo: scaling depends on call location
charsacc = acc and chars[acc]
end
if charsacc then
+ if trace_combining then
+ report_combining("%s (0x%05X) = %s (0x%05X) + %s (0x%05X)",utfchar(i),i,utfchar(chr),chr,utfchar(acc),acc)
+ end
local chr_t = cache[chr]
if not chr_t then
chr_t = {"slot", 1, chr}
@@ -218,6 +120,7 @@ function vf.aux.compose_characters(g) -- todo: scaling depends on call location
end
local cb = descs[chr].boundingbox
local ab = descs[acc].boundingbox
+ -- todo: adapt height
if cb and ab then
-- can be sped up for scale == 1
local c_llx, c_lly, c_urx, c_ury = scale*cb[1], scale*cb[2], scale*cb[3], scale*cb[4]
@@ -226,39 +129,64 @@ function vf.aux.compose_characters(g) -- todo: scaling depends on call location
local dd = (c_urx - c_llx)*ita_cor
if a_ury < 0 then
if trace_combining then
- t.commands = { push, {"right", dx-dd}, red, acc_t, black, pop, chr_t }
+ t.commands = { push, {"right", dx-dd}, red, acc_t, black, pop, chr_t }
else
- t.commands = { push, {"right", dx-dd}, acc_t, pop, chr_t }
+ t.commands = { push, {"right", dx-dd}, acc_t, pop, chr_t }
+ end
+ elseif c_ury > a_lly then -- messy test
+ -- local dy = cap_ury - a_lly
+ local dy
+ if compose then
+ -- experimental: we could use sx but all that testing
+ -- takes time and code
+ dy = compose[i]
+ if dy then
+ dy = dy.DY
+ end
+ if not dy then
+ dy = compose[acc]
+ if dy then
+ dy = dy and dy.DY
+ end
+ end
+ if not dy then
+ dy = compose.DY
+ end
+ if not dy then
+ dy = - deltaxheight + extraxheight
+ elseif dy > -1.5 and dy < 1.5 then
+ -- we assume a fraction of (percentage)
+ dy = - dy * deltaxheight
+ else
+ -- we assume fontunits (value smaller than 2 make no sense)
+ dy = - dy * scale
+ end
+ else
+ dy = - deltaxheight + extraxheight
end
- elseif c_ury > a_lly then
---~ local dy = cap_ury - a_lly
-local lower_x = byte("x")
-local upper_x = byte("X")
-local Xdesc = descs[upper_x]
-local xdesc = descs[lower_x]
-local dy = scale*(Xdesc.boundingbox[4] - xdesc.boundingbox[4] - 30) -- x height
-
if trace_combining then
- t.commands = { push, {"right", dx+dd}, {"down", -dy}, green, acc_t, black, pop, chr_t }
+ t.commands = { push, {"right", dx+dd}, {"down", dy}, green, acc_t, black, pop, chr_t }
else
- t.commands = { push, {"right", dx+dd}, {"down", -dy}, acc_t, pop, chr_t }
+ t.commands = { push, {"right", dx+dd}, {"down", dy}, acc_t, pop, chr_t }
end
else
if trace_combining then
- t.commands = { push, {"right", dx+dd}, blue, acc_t, black, pop, chr_t }
+ t.commands = { push, {"right", dx+dd}, blue, acc_t, black, pop, chr_t }
else
- t.commands = { push, {"right", dx+dd}, acc_t, pop, chr_t }
+ t.commands = { push, {"right", dx+dd}, acc_t, pop, chr_t }
end
end
done = true
end
+ elseif trace_combining then
+ report_combining("%s (0x%05X) = %s (0x%05X)",utfchar(i),i,utfchar(chr),chr)
end
chars[i] = t
local d = { }
for k, v in next, descs[chr] do
d[k] = v
end
- d.name = c.adobename or "unknown"
+ -- d.name = c.adobename or "unknown" -- TOO TRICKY ! CAN CLASH WITH THE SUBSETTER
-- d.unicode = i
descs[i] = d
end
@@ -276,13 +204,20 @@ commands["complete-composed-characters"] = function(g,v)
vf.aux.compose_characters(g)
end
---~ {'special', 'pdf: q ' .. s .. ' 0 0 '.. s .. ' 0 0 cm'},
---~ {'special', 'pdf: q 1 0 0 1 ' .. -w .. ' ' .. -h .. ' cm'},
---~ -- {'special', 'pdf: /Fm\XX\space Do'},
---~ {'special', 'pdf: Q'},
---~ {'special', 'pdf: Q'},
+-- {'special', 'pdf: q ' .. s .. ' 0 0 '.. s .. ' 0 0 cm'},
+-- {'special', 'pdf: q 1 0 0 1 ' .. -w .. ' ' .. -h .. ' cm'},
+-- {'special', 'pdf: /Fm\XX\space Do'},
+-- {'special', 'pdf: Q'},
+-- {'special', 'pdf: Q'},
--- for documentation purposes we provide:
+local force_fallback = false
+
+commands["fake-character"] = function(g,v) -- g, nr, fallback_id
+ local index, fallback = v[2], v[3]
+ if (force_fallback or not g.characters[index]) and fallbacks[fallback] then
+ g.characters[index], g.descriptions[index] = fallbacks[fallback](g)
+ end
+end
commands["enable-force"] = function(g,v)
force_composed = true
@@ -296,6 +231,109 @@ end
local install = fonts.definers.methods.install
+-- these are just examples used in the manuals, so they will end up in
+-- modules eventually
+
+fallbacks['textcent'] = function (g)
+ local c = utfbyte("c")
+ local t = table.fastcopy(g.characters[c],true)
+ local a = - tan(rad(g.italicangle or 0))
+ local vfspecials = backends.tables.vfspecials
+ local green, black
+ if trace_combining then
+ green, black = vfspecials.green, vfspecials.black
+ end
+ local startslant, stopslant = vfspecials.startslant, vfspecials.stopslant
+ local quad = g.parameters.quad
+ if a == 0 then
+ if trace_combining then
+ t.commands = {
+ push, {"slot", 1, c}, pop,
+ {"right", .5*t.width},
+ {"down", .2*t.height},
+ green,
+ {"rule", 1.4*t.height, .02*quad},
+ black,
+ }
+ else
+ t.commands = {
+ push, {"slot", 1, c}, pop,
+ {"right", .5*t.width},
+ {"down", .2*t.height},
+ {"rule", 1.4*t.height, .02*quad},
+ }
+ end
+ else
+ if trace_combining then
+ t.commands = {
+ push,
+ {"right", .5*t.width-.025*quad},
+ {"down", .2*t.height},
+ startslant(a),
+ green,
+ {"rule", 1.4*t.height, .025*quad},
+ black,
+ stopslant,
+ pop,
+ {"slot", 1, c} -- last else problems with cm
+ }
+ else
+ t.commands = {
+ push,
+ {"right", .5*t.width-.025*quad},
+ {"down", .2*t.height},
+ startslant(a),
+ {"rule", 1.4*t.height, .025*quad},
+ stopslant,
+ pop,
+ {"slot", 1, c} -- last else problems with cm
+ }
+ end
+ end
+ -- somehow the width is messed up now
+ -- todo: set height
+ t.height = 1.2*t.height
+ t.depth = 0.2*t.height
+ g.virtualized = true
+ local d = g.descriptions
+ return t, d and d[c]
+end
+
+fallbacks['texteuro'] = function (g)
+ local c = byte("C")
+ local t = table.fastcopy(g.characters[c],true)
+ local d = cos(rad(90+(g.italicangle)))
+ local vfspecials = backends.tables.vfspecials
+ local green, black
+ if trace_combining then
+ green, black = vfspecials.green, vfspecials.black
+ end
+ local quad = g.parameters.quad
+ t.width = 1.05*t.width
+ if trace_combining then
+ t.commands = {
+ {"right", .05*t.width},
+ push, {"slot", 1, c}, pop,
+ {"right", .5*t.width*d},
+ {"down", -.5*t.height},
+ green,
+ {"rule", .05*quad, .4*quad},
+ black,
+ }
+ else
+ t.commands = {
+ {"right", .05*t.width},
+ push, {"slot", 1, c}, pop,
+ {"right", .5*t.width*d},
+ {"down", -.5*t.height},
+ {"rule", .05*quad, .4*quad},
+ }
+ end
+ g.virtualized = true
+ return t, g.descriptions[c]
+end
+
+
install("fallback", { -- todo: auto-fallback with loop over data.characters
{ "fake-character", 0x00A2, 'textcent' },
{ "fake-character", 0x20AC, 'texteuro' }
@@ -317,3 +355,5 @@ install("demo-3", {
{ "complete-composed-characters" },
{ "disable-tracing" },
})
+
+-- end of examples
diff --git a/tex/context/base/font-gds.lua b/tex/context/base/font-gds.lua
index a0491a3cd..f18f8b395 100644
--- a/tex/context/base/font-gds.lua
+++ b/tex/context/base/font-gds.lua
@@ -177,7 +177,7 @@ fontgoodies.colorschemes = fontgoodies.colorschemes or { }
local colorschemes = fontgoodies.colorschemes
colorschemes.data = colorschemes.data or { }
-local function set_colorscheme(tfmdata,scheme)
+local function setcolorscheme(tfmdata,scheme)
if type(scheme) == "string" then
local goodies = tfmdata.goodies
-- todo : check for already defined in shared
@@ -244,7 +244,7 @@ function colorschemes.enable()
function colorschemes.enable() end
end
--- installation (collected to keep the overview)
+-- installation (collected to keep the overview) -- also for type 1
fonts.otf.tables.features['goodies'] = 'Goodies on top of built in features'
fonts.otf.tables.features['featurset'] = 'Goodie Feature Set'
@@ -267,8 +267,14 @@ node_initializers.goodies = setgoodies
base_initializers.featureset = setfeatureset
node_initializers.featureset = setfeatureset
-base_initializers.colorscheme = set_colorscheme
-node_initializers.colorscheme = set_colorscheme
+base_initializers.colorscheme = setcolorscheme
+node_initializers.colorscheme = setcolorscheme
+
+local base_initializers = fonts.initializers.base.afm
+local node_initializers = fonts.initializers.node.afm
+
+base_initializers.goodies = setgoodies
+node_initializers.goodies = setgoodies
-- experiment, we have to load the definitions immediately as they precede
-- the definition so they need to be initialized in the typescript
@@ -346,6 +352,34 @@ end
fonts.goodies.register("typefaces", initialize)
+local function initialize(goodies)
+ local typefaces = goodies.typefaces
+ if typefaces then
+ local ft = fonts.typefaces
+ for k, v in next, typefaces do
+ ft[k] = v
+ end
+ end
+end
+
+fonts.goodies.register("typefaces", initialize)
+
+local compositions = { }
+
+function fonts.goodies.getcompositions(tfmdata)
+ return compositions[file.nameonly(tfmdata.filename or "")]
+end
+
+local function initialize(goodies)
+ local gc = goodies.compositions
+ if gc then
+ for k, v in next, gc do
+ compositions[k] = v
+ end
+ end
+end
+
+fonts.goodies.register("compositions", initialize)
-- The following file (husayni.lfg) is the experimental setup that we used
-- for Idris font. For the moment we don't store this in the cache and quite
diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv
index f44ec9a58..630430e77 100644
--- a/tex/context/base/font-ini.mkiv
+++ b/tex/context/base/font-ini.mkiv
@@ -81,8 +81,8 @@
\registerctxluafile{font-def}{1.001}
\registerctxluafile{font-ctx}{1.001}
\registerctxluafile{font-xtx}{1.001}
-\registerctxluafile{font-fbk}{1.001}
\registerctxluafile{font-gds}{1.001}
+\registerctxluafile{font-fbk}{1.001}
\registerctxluafile{font-ext}{1.001}
\registerctxluafile{font-pat}{1.001}
\registerctxluafile{font-chk}{1.001}
diff --git a/tex/context/base/lpdf-fld.lua b/tex/context/base/lpdf-fld.lua
index 4044c691b..afb48ba53 100644
--- a/tex/context/base/lpdf-fld.lua
+++ b/tex/context/base/lpdf-fld.lua
@@ -516,19 +516,21 @@ end
function codeinjections.getfieldgroup(name)
local f = fields[name] or radios[name] or clones[name]
- local g = f and f.group
- if not g or g == "" then
- local v, p, k = f.variant, f.parent, f.kind
- if v == "clone" or v == "copy" then
- f = fields[p] or radios[p]
- g = f and f.group
- elseif k == "sub" then
- f = fields[p]
- g = f and f.group
+ if f then
+ local g = f.group
+ if not g or g == "" then
+ local v, p, k = f.variant, f.parent, f.kind
+ if v == "clone" or v == "copy" then
+ f = fields[p] or radios[p]
+ g = f and f.group
+ elseif k == "sub" then
+ f = fields[p]
+ g = f and f.group
+ end
+ end
+ if g then
+ texsprint(ctxcatcodes,g)
end
- end
- if g then
- texsprint(ctxcatcodes,g)
end
end
diff --git a/tex/context/base/m-barcodes.mkiv b/tex/context/base/m-barcodes.mkiv
index b86149cb9..fa230ba57 100644
--- a/tex/context/base/m-barcodes.mkiv
+++ b/tex/context/base/m-barcodes.mkiv
@@ -111,12 +111,12 @@ end
\egroup}
% \usemodule[barcodes]
-%
-% \starttext
-% \startTEXpage
-% \barcode[type=isbn,code=978-94-90688-01-1]
-% \stopTEXpage
-% \stoptext
+
+\starttext
+ \startTEXpage
+ \barcode[type=isbn,code=978-94-90688-01-1]
+ \stopTEXpage
+\stoptext
\endinput
diff --git a/tex/context/base/node-ini.lua b/tex/context/base/node-ini.lua
index e94e0c797..6c48ba21d 100644
--- a/tex/context/base/node-ini.lua
+++ b/tex/context/base/node-ini.lua
@@ -342,3 +342,17 @@ local reference = left * (1-left)^0 * left * space^0 * lpeg.C((1-space)^0)
function nodes.reference(n)
return lpegmatch(reference,tostring(n))
end
+
+--
+
+if not node.next then
+
+ function node.next(n)
+ return n and n.next
+ end
+
+ function node.prev(n)
+ return n and n.prev
+ end
+
+end
diff --git a/tex/context/base/node-tra.lua b/tex/context/base/node-tra.lua
index c5cf04126..a5056d88d 100644
--- a/tex/context/base/node-tra.lua
+++ b/tex/context/base/node-tra.lua
@@ -483,6 +483,43 @@ function nodes.idstostring(head,tail)
return concat(t," ")
end
+--~ function nodes.xidstostring(head,tail) -- only for special tracing of backlinks
+--~ local n = head
+--~ while n.next do
+--~ n = n.next
+--~ end
+--~ local t, last_id, last_n = { }, nil, 0
+--~ while n do
+--~ local id = n.id
+--~ if not last_id then
+--~ last_id, last_n = id, 1
+--~ elseif last_id == id then
+--~ last_n = last_n + 1
+--~ else
+--~ if last_n > 1 then
+--~ t[#t+1] = format("[%s*%s]",last_n,node_type(last_id) or "?")
+--~ else
+--~ t[#t+1] = format("[%s]",node_type(last_id) or "?")
+--~ end
+--~ last_id, last_n = id, 1
+--~ end
+--~ if n == head then
+--~ break
+--~ end
+--~ n = n.prev
+--~ end
+--~ if not last_id then
+--~ t[#t+1] = "no nodes"
+--~ elseif last_n > 1 then
+--~ t[#t+1] = format("[%s*%s]",last_n,node_type(last_id) or "?")
+--~ else
+--~ t[#t+1] = format("[%s]",node_type(last_id) or "?")
+--~ end
+--~ return table.concat(table.reverse(t)," ")
+--~ end
+
+
+
local function showsimplelist(h,depth,n)
while h do
write_nl(rep(" ",n) .. tostring(h))
diff --git a/tex/context/base/page-lin.lua b/tex/context/base/page-lin.lua
index 473685c4f..e814fd7c4 100644
--- a/tex/context/base/page-lin.lua
+++ b/tex/context/base/page-lin.lua
@@ -186,14 +186,18 @@ function boxed.stage_one(n)
local last_a, last_v, skip = nil, -1, false
for n in traverse_id(hlist_code,list) do -- attr test here and quit as soon as zero found
if n.height == 0 and n.depth == 0 then
- -- skip funny hlists
+ -- skip funny hlists -- todo: check line subtype
else
local list = n.list
local a = has_attribute(list,a_linenumber)
if a and a > 0 then
if last_a ~= a then
- if data[a].method == variables.next then
+ local da = data[a]
+ local ma = da.method
+ if ma == variables.next then
skip = true
+ elseif ma == variables.page then
+ da.start = 1 -- eventually we will have a normal counter
end
last_a = a
end
diff --git a/tex/context/base/page-lin.mkiv b/tex/context/base/page-lin.mkiv
index 220d6c1f8..84fa77813 100644
--- a/tex/context/base/page-lin.mkiv
+++ b/tex/context/base/page-lin.mkiv
@@ -12,14 +12,17 @@
%C details.
% generic or not ... maybe not bother too much and simplify to mkiv only
+% get rid of \mk*
\writestatus{loading}{ConTeXt Core Macros / Line Numbering}
\unprotect
% todo: save settings
-
+%
% low level interface
+%
+% we should use normal counters but then we need to sync settings
\registerctxluafile{page-lin}{1.001}
@@ -29,7 +32,7 @@
\appendtoksonce \attribute\linenumberattribute \attributeunsetvalue \to \everyforgetall
\appendtoksonce \attribute\displaymathattribute\plusone \to \everybeforedisplayformula
-\newcount\linenumber
+\newcount\linenumber % not used
\newbox \linenumberscratchbox
\newcount\linenumberchunk
\newcount\linerefcounter
@@ -464,6 +467,7 @@
{\vrule\!!width\onepoint\!!depth\strutdp\!!height.8\strutht\raise.85\strutht\hbox{\llap{\tt\txx#1}}}}%
\smashbox\scratchbox\box\scratchbox
\fi}
+
\def\mkshowstoplinereference#1%
{\ifconditional\tracelinenumbering
\setbox\scratchbox\hbox{\rlap
diff --git a/tex/context/base/sort-ini.lua b/tex/context/base/sort-ini.lua
index 28bd3b4d8..a8ad1a6e0 100644
--- a/tex/context/base/sort-ini.lua
+++ b/tex/context/base/sort-ini.lua
@@ -9,7 +9,36 @@ if not modules then modules = { } end modules ['sort-ini'] = {
-- It took a while to get there, but with Fleetwood Mac's "Don't Stop"
-- playing in the background we sort of got it done.
--- todo: cleanup splits (in other modules)
+--[[<p>The code here evolved from the rather old mkii approach. There
+we concatinate the key and (raw) entry into a new string. Numbers and
+special characters get some treatment so that they sort ok. In
+addition some normalization (lowercasing, accent stripping) takes
+place and again data is appended ror prepended. Eventually these
+strings are sorted using a regular string sorter. The relative order
+of character is dealt with by weighting them. It took a while to
+figure this all out but eventually it worked ok for most languages,
+given that the right datatables were provided.</p>
+
+<p>Here we do follow a similar approach but this time we don't append
+the manipulated keys and entries but create tables for each of them
+with entries being tables themselves having different properties. In
+these tables characters are represented by numbers and sorting takes
+place using these numbers. Strings are simplified using lowercasing
+as well as shape codes. Numbers are filtered and after getting an offset
+they end up at the right end of the spectrum (more clever parser will
+be added some day). There are definitely more solutions to the problem
+and it is a nice puzzle to solve.</p>
+
+<p>In the future more methods can be added, as there is practically no
+limit to what goes into the tables. For that we will provide hooks.</p>
+
+<p>Todo: decomposition with specific order of accents, this is
+relatively easy to do.</p>
+
+<p>Todo: investigate what standards and conventions there are and see
+how they map onto this mechanism. I've learned that users can come up
+with any demand so nothign here is frozen.</p>
+]]--
local utf = unicode.utf8
local gsub, rep, sub, sort, concat = string.gsub, string.rep, string.sub, table.sort, table.concat
diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua
index a0ced869f..5eb9b3683 100644
--- a/tex/context/base/spac-ver.lua
+++ b/tex/context/base/spac-ver.lua
@@ -1165,102 +1165,6 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also
return head, true
end
---~ function remove_node(head, current, free_too)
---~ local t = current
---~ -- node.slide(head)
---~ print("")
---~ print("BEFORE R",nodes.idstostring(head))
---~ print(" ",nodes.xidstostring(head))
---~ head, current = node.remove(head,current)
---~ print("MIDDLE R",nodes.idstostring(head))
---~ print(" ",nodes.xidstostring(head))
---~ if t then
---~ if free_too then
---~ node.free(t)
---~ t = nil
---~ else
---~ t.next, t.prev = nil, nil
---~ end
---~ end
---~ print("AFTER R",nodes.idstostring(head))
---~ print(" ",nodes.xidstostring(head))
---~ return head, current, t
---~ end
---~ function nodes.xidstostring(head,tail)
---~ local n = head
---~ while n.next do
---~ n = n.next
---~ end
---~ local t, last_id, last_n = { }, nil, 0
---~ while n do
---~ local id = n.id
---~ if not last_id then
---~ last_id, last_n = id, 1
---~ elseif last_id == id then
---~ last_n = last_n + 1
---~ else
---~ if last_n > 1 then
---~ t[#t+1] = string.format("[%s*%s]",last_n,node.type(last_id) or "?")
---~ else
---~ t[#t+1] = string.format("[%s]",node.type(last_id) or "?")
---~ end
---~ last_id, last_n = id, 1
---~ end
---~ if n == head then
---~ break
---~ end
---~ n = n.prev
---~ end
---~ if not last_id then
---~ t[#t+1] = "no nodes"
---~ elseif last_n > 1 then
---~ t[#t+1] = string.format("[%s*%s]",last_n,node.type(last_id) or "?")
---~ else
---~ t[#t+1] = string.format("[%s]",node.type(last_id) or "?")
---~ end
---~ return table.concat(table.reverse(t)," ")
---~ end
---~ local function collapser(head)
---~ local current, glue_data = head, nil
---~ while current do
---~ local id, subtype = current.id, current.subtype
---~ if id == glue_code and subtype == userskip_code then
---~ local sc = has_attribute(current,a_skipcategory)
---~ if not sc then
---~ if glue_data then
---~ head, current = nodes.before(head,current,glue_data)
---~ current = current.next
---~ else
---~ local previous = current.prev
---~ if previous and previous.id == glue_code and previous.subtype == userskip_code then
---~ if previous.spec.writable then
---~ if current.spec.writable then
---~ head, current = remove_node(head, current, true)
---~ else
---~ current = current.next
---~ end
---~ else
---~ current = current.next
---~ end
---~ else
---~ current = current.next
---~ end
---~ end
---~ glue_data = nil
---~ elseif not glue_data then
---~ head, current, glue_data = remove_node(head, current)
---~ else
---~ head, current = remove_node(head, current, true)
---~ end
---~ else
---~ current = current.next
---~ end
---~ end
---~ return head, true
---~ end
-
-
-
-- alignment after_output end box new_graf vmode_par hmode_par insert penalty before_display after_display
-- \par -> vmode_par
--
diff --git a/tex/context/base/strc-lnt.mkiv b/tex/context/base/strc-lnt.mkiv
index 0df44294b..1289057df 100644
--- a/tex/context/base/strc-lnt.mkiv
+++ b/tex/context/base/strc-lnt.mkiv
@@ -14,6 +14,8 @@
\writestatus{loading}{ConTeXt Structure Macros / Line Notes}
%D This module loads on top of the footnote and line numbering macros.
+%D
+%D ln: might go away
\unprotect
@@ -70,53 +72,54 @@
\definelinenote[\v!linenote]
+% beware: line numbers are added later on so grouping setups is a bad idea
+%
% \startbuffer[test]
% \startlinenumbering[100]
-% test \linenote {oeps} test test test test test test
-% test \startlinenote [well] {oeps} test test test test test test
-% test \linenote {oeps} test test test test test test
-% test \linenote {oeps} test test test test test test
-% test \linenote {oeps} test test test test test test
-% test \linenote {oeps} test test test test test test
+% test \linenote {oeps 1} test test test test test test
+% test \startlinenote [well] {oeps X} test test test test test test
+% test \linenote {oeps 2} test test test test test test
+% test \linenote {oeps 3} test test test test test test
+% test \linenote {oeps 4} test test test test test test
+% test \linenote {oeps 5} test test test test test test
% test \stoplinenote [well] test test test test test test
% \stoplinenumbering
% \stopbuffer
%
-% \setupnotedefinition[linenote] [location=serried,distance=.5em]
-%
-% {\typebuffer[test] \getbuffer[test]} \page
+% \typebuffer[test] \getbuffer[test] \page
%
% \startbuffer[setup]
% \setuplinenumbering
-% [align=left]
+% [align=flushleft]
% \stopbuffer
%
-% {\typebuffer[setup] \getbuffer[setup,test]} \page
+% \typebuffer[setup] \getbuffer[setup,test] \page
%
% \startbuffer[setup]
% \setuplinenumbering
-% [width=1em,
-% align=left]
+% [width=4em,
+% distance=1em,
+% align=flushright]
% \stopbuffer
%
-% {\typebuffer[setup] \getbuffer[setup,test]} \page
+% \typebuffer[setup] \getbuffer[setup,test] \page
%
% \startbuffer[setup]
% \setuplinenumbering
-% [width=2em,
-% distance=.5em,
-% align=left]
+% [width=4em,
+% align=flushleft]
% \stopbuffer
%
-% {\typebuffer[setup] \getbuffer[setup,test]} \page
+% \typebuffer[setup] \getbuffer[setup,test] \page
%
% \startbuffer[setup]
% \setuplinenumbering
% [width=2em,
+% distance=.5em,
% align=middle]
% \stopbuffer
%
-% {\typebuffer[setup] \getbuffer[setup,test]} \page
+% \typebuffer[setup] \getbuffer[setup,test] \page
%
% \startbuffer[setup]
% \setuplinenumbering
@@ -129,7 +132,7 @@
% width=1.5em]
% \stopbuffer
%
-% {\typebuffer[setup] \startnarrower\getbuffer[setup,test]\stopnarrower} \page
+% \typebuffer[setup] \getbuffer[setup] \startnarrower\getbuffer[test]\stopnarrower \page
%
% \startbuffer[setup]
% \setuplinenumbering
@@ -139,7 +142,7 @@
% align=middle]
% \stopbuffer
%
-% {\typebuffer[setup] \getbuffer[setup,test]} \page
+% \typebuffer[setup] \getbuffer[setup,test] \page
%
% \startbuffer[setup-1]
% \setuplinenumbering
@@ -159,7 +162,7 @@
% {#1}}
% \stopbuffer
%
-% {\typebuffer[setup-1,setup-2] \getbuffer[setup-1,setup-2,test]} \page
+% \typebuffer[setup-1,setup-2] \getbuffer[setup-1,setup-2,test] \page
%
% \startbuffer[setup-1]
% \setuplinenumbering
@@ -168,6 +171,6 @@
% command=\WatchThis]
% \stopbuffer
%
-% {\typebuffer[setup-1] \getbuffer[setup-1,setup-2,test]} \page
+% \typebuffer[setup-1] \getbuffer[setup-1,setup-2,test] \page
\protect \endinput
diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua
index ebdb68bd5..428bd8710 100644
--- a/tex/context/base/strc-lst.lua
+++ b/tex/context/base/strc-lst.lua
@@ -255,7 +255,7 @@ local function filtercollected(names, criterium, number, collected, forced, nest
for i=1,#collected do
local v = collected[i]
local r = v.references
- if r and (not block or block == r.block) then
+ if r and (not block or not r.block or block == r.block) then
local sectionnumber = sections.collected[r.section]
if sectionnumber then -- and not sectionnumber.hidenumber then
local cnumbers = sectionnumber.numbers
@@ -287,8 +287,8 @@ local function filtercollected(names, criterium, number, collected, forced, nest
for i=1,#collected do
local v = collected[i]
local r = v.references
- if r and (not block or block == r.block) then
-ctionnumber = sections.collected[r.section]
+ if r then -- and (not block or not r.block or block == r.block) then
+ local sectionnumber = sections.collected[r.section]
if sectionnumber then -- and not sectionnumber.hidenumber then
local cnumbers = sectionnumber.numbers
local metadata = v.metadata
@@ -319,7 +319,7 @@ ctionnumber = sections.collected[r.section]
for i=1,#collected do
local v = collected[i]
local r = v.references
- if r and (not block or block == r.block) then
+ if r and (not block or not r.block or block == r.block) then
local sectionnumber = sections.collected[r.section]
if sectionnumber then -- and not sectionnumber.hidenumber then
local cnumbers = sectionnumber.numbers
diff --git a/tex/context/base/strc-lst.mkiv b/tex/context/base/strc-lst.mkiv
index b61733cbc..4a88da083 100644
--- a/tex/context/base/strc-lst.mkiv
+++ b/tex/context/base/strc-lst.mkiv
@@ -77,6 +77,7 @@
\edef\currentlistnumber{\ctxlua{structures.lists.push{
references = {
internal = \nextinternalreference,
+ block = "\currentstructureblock", % handy for lists, like bibl
section = structures.sections.currentid(),
},
metadata = {
diff --git a/tex/context/base/strc-not.mkiv b/tex/context/base/strc-not.mkiv
index cfbfcea96..7d75340a5 100644
--- a/tex/context/base/strc-not.mkiv
+++ b/tex/context/base/strc-not.mkiv
@@ -763,7 +763,6 @@
%D by using an indirect call to the \type{\insert} primitive.
%D Making footnote numbers active is not always that logical,
-%D Making footnote numbers active is not always that logical,
%D especially when we keep the reference and text at one page.
%D On the other hand we need interactivity when we refer to
%D previous notes or use end notes. Therefore we support
diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv
index b1d0692fb..e1719bbc9 100644
--- a/tex/context/base/strc-reg.mkiv
+++ b/tex/context/base/strc-reg.mkiv
@@ -583,10 +583,7 @@
% {#1}}
\def\doregistercharacter#1%
- {\iflocation
- \pagereference[\currentregister:\v!section:#1]%
- \fi
- \expandcheckedcsname % why no \executeifdefined
+ {\expandcheckedcsname % why no \executeifdefined
{\??id:\c!indicator:}%
{\registerparameter\c!alternative}%
{a}%
@@ -601,8 +598,14 @@
\setvalue{\??id:\c!indicator:a}#1%
{\registerparameter\c!before
% bugged, why does leftskip gets set: \vskip\lineheight\goodbreak\vskip-\lineheight
- \begingroup\dosetregisterattributes\c!style\c!color
- \registerparameter\c!command{\strut#1}%
+ \begingroup
+ \dosetregisterattributes\c!style\c!color
+ \dontleavehmode
+ \strut
+ \iflocation
+ \pagereference[\currentregister:\v!section:#1]%
+ \fi
+ \registerparameter\c!command{#1}%
\endgroup
\registerparameter\c!after
\par
@@ -612,8 +615,14 @@
\setvalue{\??id:\c!indicator:b}#1% will be shared with a
{\registerparameter\c!before
- \begingroup\dosetregisterattributes\c!style\c!color
- \registerparameter\c!command{\strut#1}%
+ \begingroup
+ \dosetregisterattributes\c!style\c!color
+ \dontleavehmode
+ \strut
+ \iflocation
+ \pagereference[\currentregister:\v!section:#1]%
+ \fi
+ \registerparameter\c!command{#1}%
\endgroup
\registerparameter\c!after
\nobreak}
diff --git a/tex/context/base/strc-syn.mkiv b/tex/context/base/strc-syn.mkiv
index d46edaa39..3431e76e0 100644
--- a/tex/context/base/strc-syn.mkiv
+++ b/tex/context/base/strc-syn.mkiv
@@ -328,7 +328,7 @@
{\begingroup
% no kap currently, of .. we need to map cap onto WORD
\edef\currentsorting{#1}%
- \dosetsynonymattributes\c!style\c!color
+ \dosetsortingattributes\c!style\c!color
\ctxlua{structures.synonyms.synonym("#1","#2")}%
\normalexpanded{\endgroup\sortingparameter\c!next}}
diff --git a/tex/context/base/type-otf.mkiv b/tex/context/base/type-otf.mkiv
index 2879fa1bd..2cea1ba49 100644
--- a/tex/context/base/type-otf.mkiv
+++ b/tex/context/base/type-otf.mkiv
@@ -1316,7 +1316,7 @@
\starttypescriptcollection[lucida]
\starttypescript [serif] [lucida]
- \definefontsynonym [LucidaBright] [\s!name:LucidaBright]
+ \definefontsynonym [LucidaBright] [\s!name:LucidaBright] % [goodies=lucida-one]
\definefontsynonym [LucidaBright-Demi] [\s!name:LucidaBright-Demi]
\definefontsynonym [LucidaBright-Italic] [\s!name:LucidaBright-Italic]
\definefontsynonym [LucidaBright-DemiItalic] [\s!name:LucidaBright-DemiItalic]
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index a54ca0a09..085572e45 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 : 10/03/10 18:07:20
+-- merge date : 10/06/10 10:20:42
do -- begin closure to overcome local limits and interference