summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tex/context/base/buff-ini.lua17
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/font-ctx.lua14
-rw-r--r--tex/context/base/font-ext.lua15
-rw-r--r--tex/context/base/font-ini.lua12
-rw-r--r--tex/context/base/font-tfm.lua1
-rw-r--r--tex/context/base/grph-fig.mkiv19
-rw-r--r--tex/context/base/hand-ini.mkiv10
-rw-r--r--tex/context/base/l-aux.lua2
-rw-r--r--tex/context/base/l-table.lua2
-rw-r--r--tex/context/base/lang-ini.lua41
-rw-r--r--tex/context/base/node-rul.lua40
-rw-r--r--tex/context/base/node-rul.mkiv39
-rw-r--r--tex/context/base/node-tra.lua2
-rw-r--r--tex/context/base/pack-rul.mkiv11
-rw-r--r--tex/context/base/typo-brk.lua8
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua17
18 files changed, 147 insertions, 107 deletions
diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua
index 3cb4ccd36..7b304c27e 100644
--- a/tex/context/base/buff-ini.lua
+++ b/tex/context/base/buff-ini.lua
@@ -197,7 +197,10 @@ function buffers.typeline(str,n,m,line)
return n, line
end
-function buffers.save(name,list,encapsulate)
+-- The optional prefix hack is there for the typesetbuffer feature and
+-- in mkii we needed that (this hidden feature is used in a manual).
+
+function buffers.save(name,list,encapsulate,optionalprefix)
if not name or name == "" then
name = tex.jobname
end
@@ -207,7 +210,7 @@ function buffers.save(name,list,encapsulate)
list = name
name = tex.jobname .. "-" .. name .. ".tmp"
end
- local content = buffers.collect(list)
+ local content = buffers.collect(list,nil,optionalprefix)
if content == "" then
content = "empty buffer"
end
@@ -233,8 +236,8 @@ function buffers.get(name)
end
end
-local function content(name,separator) -- no print
- local b = data[name]
+local function content(name,separator,optionalprefix) -- no print
+ local b = data[name] or (optionalprefix and data[optionalprefix .. name])
if b then
if type(b) == "table" then
return concat(b,separator or "\n")
@@ -248,20 +251,20 @@ end
buffers.content = content
-function buffers.collect(names,separator) -- no print
+function buffers.collect(names,separator,optionalprefix) -- no print
-- maybe we should always store a buffer as table so
-- that we can pass if directly
local t = { }
if type(names) == "table" then
for i=1,#names do
- local c = content(names[i],separator)
+ local c = content(names[i],separator,optionalprefix)
if c ~= "" then
t[#t+1] = c
end
end
else
for name in names:gmatch("[^,%s]+") do
- local c = content(name,separator)
+ local c = content(name,separator,optionalprefix)
if c ~= "" then
t[#t+1] = c
end
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 0023eb812..547e0c325 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{2009.11.07 17:59}
+\newcontextversion{2009.11.09 17:47}
%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 17c73013a..23a718e90 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{2009.11.07 17:59}
+\edef\contextversion{2009.11.09 17:47}
%D For those who want to use this:
diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua
index 8e42b0ab0..c18fbe0ff 100644
--- a/tex/context/base/font-ctx.lua
+++ b/tex/context/base/font-ctx.lua
@@ -398,3 +398,17 @@ end
--~ return nil
--~ end
--~ end
+
+-- we need a place for this .. outside the generic scope
+
+local dimenfactors = number.dimenfactors
+
+function fonts.dimenfactor(unit,tfmdata)
+ if unit == "ex" then
+ return tfmdata.parameters.x_height
+ elseif unit == "em" then
+ return tfmdata.parameters.em_height
+ else
+ return dimenfactors[unit] or unit
+ end
+end
diff --git a/tex/context/base/font-ext.lua b/tex/context/base/font-ext.lua
index bc741cc5d..c6168e030 100644
--- a/tex/context/base/font-ext.lua
+++ b/tex/context/base/font-ext.lua
@@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['font-ext'] = {
}
local next, type, byte = next, type, string.byte
+local gmatch = string.gmatch
--[[ldx--
<p>When we implement functions that deal with features, most of them
@@ -228,6 +229,8 @@ vectors['default'] = {
[byte('2')] = 0.7, [byte('3')] = 0.7, [byte('6')] = 0.7, [byte('8')] = 0.7, [byte('9')] = 0.7,
}
+vectors['quality'] = vectors['default'] -- metatable ?
+
function initializers.common.expansion(tfmdata,value)
if value then
local class = classes[value]
@@ -237,8 +240,9 @@ function initializers.common.expansion(tfmdata,value)
tfmdata.stretch = (class.stretch or 0) * 10
tfmdata.shrink = (class.shrink or 0) * 10
tfmdata.step = (class.step or 0) * 10
- tfmdata.auto_expand = true
local factor = class.factor or 1
+--~ logs.report("fonts","define expansion %s, vector: %s, stretch: %s, shrink: %s, step: %s, factor: %s",value,class.vector,tfmdata.stretch,tfmdata.shrink,tfmdata.step,factor)
+ tfmdata.auto_expand = true
local data = characters.data
for i, chr in next, tfmdata.characters do
local v = vector[i]
@@ -288,7 +292,7 @@ local vectors = fonts.protrusions.vectors
-- the values need to be revisioned
-classes.preset = { factor = 1 }
+classes.preset = { factor = 1, left = 1, right = 1 }
function commands.setupfontprotrusion(class,settings)
aux.getparameters(classes,class,'preset',settings)
@@ -395,10 +399,13 @@ vectors['quality'] = table.merge( {},
function initializers.common.protrusion(tfmdata,value)
if value then
local class = classes[value]
+--~ logs.report("fonts","define protrusion %s",table.serialize(class))
if class then
local vector = vectors[class.vector]
if vector then
local factor = class.factor or 1
+ local left = class.left or 1
+ local right = class.right or 1
local data = characters.data
local emwidth = tfmdata.parameters.quad
tfmdata.auto_protrude = true
@@ -424,8 +431,8 @@ function initializers.common.protrusion(tfmdata,value)
end
end
end
- if pl and pl ~= 0 then chr.left_protruding = pl*factor end
- if pr and pr ~= 0 then chr.right_protruding = pr*factor end
+ if pl and pl ~= 0 then chr.left_protruding = left *pl*factor end
+ if pr and pr ~= 0 then chr.right_protruding = right*pr*factor end
end
end
end
diff --git a/tex/context/base/font-ini.lua b/tex/context/base/font-ini.lua
index a4a38ed71..5cff22760 100644
--- a/tex/context/base/font-ini.lua
+++ b/tex/context/base/font-ini.lua
@@ -115,15 +115,3 @@ function fonts.show_font_parameters()
end
end
end
-
-local dimenfactors = number.dimenfactors
-
-function fonts.dimenfactor(unit,tfmdata)
- if unit == "ex" then
- return tfmdata.parameters.x_height
- elseif unit == "em" then
- return tfmdata.parameters.em_height
- else
- return dimenfactors[unit] or unit
- end
-end
diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua
index 14c4d0a2e..576829369 100644
--- a/tex/context/base/font-tfm.lua
+++ b/tex/context/base/font-tfm.lua
@@ -365,6 +365,7 @@ local private = fonts.private
end
end
if hasquality then
+ -- we could move these calculations elsewhere (saves calculations)
local ve = v.expansion_factor
if ve then
chr.expansion_factor = ve*1000 -- expansionfactor, hm, can happen elsewhere
diff --git a/tex/context/base/grph-fig.mkiv b/tex/context/base/grph-fig.mkiv
index 415a2aa76..ad71809bf 100644
--- a/tex/context/base/grph-fig.mkiv
+++ b/tex/context/base/grph-fig.mkiv
@@ -407,6 +407,8 @@
%D NEW: used in styledesign manual
+% beware in mkiv we don't have the typeset- prefix
+%
% \setbuffer[typeset-b]\endbuffer
% \setbuffer[typeset-a]\endbuffer
%
@@ -431,14 +433,23 @@
\dodotypesetbuffer[\jobname][]
\fi\fi}
-\def\dodotypesetbuffer[#1][#2]% beware: this will mix up the mp graphics
+\def\dodotypesetbuffer[#1][#2]%
{\bgroup
\global\advance\noftypesetbuffers\plusone
\edef\bufferfilename{\jobname-buffer-\the\noftypesetbuffers}%
- \ctxlua{buffers.save("\bufferfilename.tmp","#1",true)}%
- \executesystemcommand{context \bufferfilename.tmp}%
+% \iftrialtypesetting
+% \externalfigure[\bufferfilename.pdf][#2]%
+% \global\advance\noftypesetbuffers\minusone
+% \else
+ \doifmode{*\v!first}
+ {\ctxlua{buffers.save("\bufferfilename.tmp","#1",true,"typeset-")}%
+ \executesystemcommand{context \bufferfilename.tmp}}%
\externalfigure[\bufferfilename.pdf][#2]%
+% \fi
\egroup}
+
+\def\dodotypesetbufferindeed#1%
+ {}
% for me only (manuals and such)
@@ -454,7 +465,7 @@
{\executeifdefined{\??tz#1}\gobbletwoarguments{#2}{#3}}
\def\dodotypesetfile#1#2#3#4% args settings file settings
- {\doifmode{*\v!first}{\executesystemcommand{texmfstart texexec.pl --batch --pdf #1 #3}}%
+ {\doifmode{*\v!first}{\executesystemcommand{context #1 #3}}%
\doglobal\beforesplitstring#3\at.\to\typesetfilename
\externalfigure[\typesetfilename.pdf][#2,#4]}
diff --git a/tex/context/base/hand-ini.mkiv b/tex/context/base/hand-ini.mkiv
index 41e9db415..9b1bc41c7 100644
--- a/tex/context/base/hand-ini.mkiv
+++ b/tex/context/base/hand-ini.mkiv
@@ -21,8 +21,14 @@
%D New stuff.
-\def\setupfontexpansion [#1][#2]{\ctxlua{commands.setupfontexpansion ("#1","#2")}}
-\def\setupfontprotrusion[#1][#2]{\ctxlua{commands.setupfontprotrusion("#1","#2")}}
+\def\setupfontexpansion {\dodoubleargument\dosetupfontexpansion }
+\def\setupfontprotrusion{\dodoubleargument\dosetupfontprotrusion}
+
+\def\dosetupfontexpansion [#1][#2]{\ctxlua{commands.setupfontexpansion ("#1","#2")}}
+\def\dosetupfontprotrusion[#1][#2]{\ctxlua{commands.setupfontprotrusion("#1","#2")}}
+
+% \setupfontprotrusion[quality-upright][vector=quality]
+% \setupfontprotrusion[quality-slanted][vector=quality,right=1.5]
%D Old stuff.
diff --git a/tex/context/base/l-aux.lua b/tex/context/base/l-aux.lua
index d74026f0f..c577fb104 100644
--- a/tex/context/base/l-aux.lua
+++ b/tex/context/base/l-aux.lua
@@ -169,7 +169,7 @@ function aux.getparameters(self,class,parentclass,settings)
sc = table.clone(self[parent])
self[class] = sc
end
- aux.add_settings_to_array(sc, settings)
+ aux.settings_to_hash(settings,sc)
end
-- temporary here
diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua
index b788f2f51..87e694c0a 100644
--- a/tex/context/base/l-table.lua
+++ b/tex/context/base/l-table.lua
@@ -796,7 +796,7 @@ function table.clone(t,p) -- t is optional or nil or table
elseif not t then
t = { }
end
- setmetatable(t, { __index = function(_,key) return p[key] end })
+ setmetatable(t, { __index = function(_,key) return p[key] end }) -- why not __index = p ?
return t
end
diff --git a/tex/context/base/lang-ini.lua b/tex/context/base/lang-ini.lua
index 4505aa130..b7b908144 100644
--- a/tex/context/base/lang-ini.lua
+++ b/tex/context/base/lang-ini.lua
@@ -142,12 +142,24 @@ function languages.hyphenation.n()
return table.count(langdata)
end
+languages.registered = languages.registered or { }
+languages.associated = languages.associated or { }
+languages.numbers = languages.numbers or { }
+
+storage.register("languages/registered",languages.registered,"languages.registered")
+storage.register("languages/associated",languages.associated,"languages.associated")
+
+local numbers = languages.numbers
+local registered = languages.registered
+local associated = languages.associated
+
-- we can speed this one up with locals if needed
local function tolang(what)
local kind = type(what)
if kind == "number" then
- return langdata[languages.numbers[what]]
+ local w = what >= 0 and what <= 0x7FFF and numbers[what]
+ return (w and langdata[w]) or 0
elseif kind == "string" then
return langdata[what]
else
@@ -164,16 +176,9 @@ end
languages.tolang = tolang
-languages.registered = languages.registered or { }
-languages.associated = languages.associated or { }
-languages.numbers = languages.numbers or { }
-
-storage.register("languages/registered",languages.registered,"languages.registered")
-storage.register("languages/associated",languages.associated,"languages.associated")
-
function languages.register(tag,parent,patterns,exceptions)
parent = parent or tag
- languages.registered[tag] = {
+ registered[tag] = {
parent = parent,
patterns = patterns or format("lang-%s.pat",parent),
exceptions = exceptions or format("lang-%s.hyp",parent),
@@ -183,14 +188,14 @@ function languages.register(tag,parent,patterns,exceptions)
end
function languages.associate(tag,script,language)
- languages.associated[tag] = { script, language }
+ associated[tag] = { script, language }
end
function languages.association(tag)
if type(tag) == "number" then
- tag = languages.numbers[tag]
+ tag = numbers[tag]
end
- local lat = tag and languages.associated[tag]
+ local lat = tag and associated[tag]
if lat then
return lat[1], lat[2]
else
@@ -199,7 +204,7 @@ function languages.association(tag)
end
function languages.loadable(tag)
- local l = languages.registered[tag]
+ local l = registered[tag]
if l and l.patterns and resolvers.find_file(patterns) then
return true
else
@@ -213,7 +218,7 @@ function languages.enable(tags)
-- beware: we cannot set tex.language, but need tex.normallanguage
for i=1,#tags do
local tag = tags[i]
- local l = languages.registered[tag]
+ local l = registered[tag]
if l then
if not l.loaded then
local tag = l.parent
@@ -225,7 +230,7 @@ function languages.enable(tags)
l.number = languages.hyphenation.define(tag)
languages.hyphenation.loadpatterns(tag,l.patterns)
languages.hyphenation.loadexceptions(tag,l.exceptions)
- languages.numbers[l.number] = tag
+ numbers[l.number] = tag
end
l.loaded = true
end
@@ -262,8 +267,8 @@ languages.logger = languages.logger or { }
function languages.logger.report()
local result = {}
- for _, tag in ipairs(table.sortedkeys(languages.registered)) do
- local l = languages.registered[tag]
+ for _, tag in ipairs(table.sortedkeys(registered)) do
+ local l = registered[tag]
if l.loaded then
local p = (l.patterns and "pat") or '-'
local e = (l.exceptions and "exc") or '-'
@@ -308,7 +313,7 @@ do
end
function languages.words.found(id, str)
- local tag = languages.numbers[id]
+ local tag = numbers[id]
if tag then
local data = languages.words.data[tag]
return data and (data[str] or data[lower(str)])
diff --git a/tex/context/base/node-rul.lua b/tex/context/base/node-rul.lua
index ea964327a..242ea7ace 100644
--- a/tex/context/base/node-rul.lua
+++ b/tex/context/base/node-rul.lua
@@ -8,7 +8,11 @@ if not modules then modules = { } end modules ['node-rul'] = {
-- todo: order and maybe other dimensions
+local trace_ruled = false trackers.register("nodes.ruled", function(v) trace_ruled = v end)
+
local floor = math.floor
+local topoints = number.topoints
+local n_tostring, n_tosequence = nodes.ids_tostring, nodes.tosequence
local a_ruled = attributes.private('ruled')
local a_color = attributes.private('color')
@@ -31,8 +35,8 @@ local list_dimensions, has_attribute, set_attribute = node.dimensions, node.has_
local dimenfactor = fonts.dimenfactor
local texwrite = tex.write
-local fontdata = fonts.ids
-local variables = interfaces.variables
+local fontdata = fonts.ids
+local variables = interfaces.variables
nodes.rules = nodes.rules or { }
nodes.rules.data = nodes.rules.data or { }
@@ -41,32 +45,31 @@ storage.register("nodes/rules/data", nodes.rules.data, "nodes.rules.data")
local data = nodes.rules.data
--- method, offset, continue, dy, rulethickness, unit, order, max, colorspace, color, transparency
-
-function nodes.rules.define(...)
- data[#data+1] = { ... }
+function nodes.rules.define(settings)
+ data[#data+1] = settings
texwrite(#data)
end
local function flush(head,f,l,d,level,parent) -- not that fast but acceptable for this purpose
local r, m
local w = list_dimensions(parent.glue_set,parent.glue_sign,parent.glue_order,f,l.next)
- local method, offset, continue, dy, rulethickness, unit, order, max = d[1], d[2], d[3], d[4], d[5]/2, d[6], d[7], d[8]
- local cs, co, tr = d[9], d[10], d[11]
+ local method, offset, continue, dy, rulethickness, unit, order, max, ma, ca, ta =
+ d.method, d.offset, d.continue, d.dy, d.rulethickness, d.unit, d.order, d.max, d.ma, d.ca, d.ta
local e = dimenfactor(unit,fontdata[f.font])
- local colorspace = (cs > 0 and cs) or has_attribute(f,a_colorspace) or 1
- local color = (co > 0 and co) or has_attribute(f,a_color)
- local transparency = (tr > 0 and tr) or has_attribute(f,a_transparency)
+ local colorspace = (ma > 0 and ma) or has_attribute(f,a_colorspace) or 1
+ local color = (ca > 0 and ca) or has_attribute(f,a_color)
+ local transparency = (ta > 0 and ta) or has_attribute(f,a_transparency)
local foreground = order == variables.foreground
+ rulethickness= rulethickness/2
+ if level > max then
+ level = max
+ end
if method == 0 then -- center
offset = 2*offset
m = (offset+(level-1)*dy+rulethickness)*e/2
else
m = 0
end
- if level > max then
- level = max
- end
for i=1,level do
local ht = (offset+(i-1)*dy+rulethickness)*e - m
local dp = -(offset+(i-1)*dy-rulethickness)*e + m
@@ -87,13 +90,17 @@ local function flush(head,f,l,d,level,parent) -- not that fast but acceptable fo
head, _ = insert_before(head,f,r)
insert_after(head,r,k)
end
- -- print(level,w,nodes.ids_to_string(f,l),nodes.tosequence(f,l,true))
+ if trace_ruled then
+ logs.report("ruled", "level: %s, width: %s, nodes: %s, text: %s",level,topoints(w),n_tostring(f,l),n_tosequence(f,l,true))
+ end
end
return head
end
-- todo: functions: word, sentence
+-- glyph rule unset whatsit glue margin_kern kern math disc
+
local function process(head,parent)
local n = head
local f, l, a, d, i, level
@@ -116,7 +123,7 @@ local function process(head,parent)
f, l, a = n, n, aa
level, i = floor(a/1000), a%1000
d = data[i]
- continue = d[3] == variables.yes
+ continue = d.continue == variables.yes
end
else
if f then
@@ -154,4 +161,3 @@ end
--~ tasks.appendaction ("shipouts", "normalizers", "nodes.rules.process")
--~ tasks.disableaction("shipouts", "nodes.rules.process") -- only kick in when used
-
diff --git a/tex/context/base/node-rul.mkiv b/tex/context/base/node-rul.mkiv
index 246e8d222..ea9f5364b 100644
--- a/tex/context/base/node-rul.mkiv
+++ b/tex/context/base/node-rul.mkiv
@@ -94,31 +94,32 @@
{\donefalse}%
\normalexpanded
{\egroup
- \scratchcounter\ctxlua{nodes.rules.define(
- \barparameter\c!method,
- \barparameter\c!offset,
- "\barparameter\c!continue",
- \barparameter\c!dy,
- \barparameter\c!rulethickness,
- "\barparameter\c!unit",
- "\barparameter\c!order",
- \barparameter\c!max,
- \ifdone\the\attribute\colormodelattribute\else0\fi,
- \ifdone\the\attribute\colorattribute\else0\fi,
- \ifdone\the\attribute\transparencyattribute\else0\fi)}}%
+ \scratchcounter\ctxlua{nodes.rules.define {
+ method = \barparameter\c!method,
+ offset = \barparameter\c!offset,
+ continue = "\barparameter\c!continue",
+ dy = \barparameter\c!dy,
+ rulethickness = \barparameter\c!rulethickness,
+ unit = "\barparameter\c!unit",
+ order = "\barparameter\c!order",
+ max = \barparameter\c!max,
+ ma = \ifdone\the\attribute\colormodelattribute \else0\fi,
+ ca = \ifdone\the\attribute\colorattribute \else0\fi,
+ ta = \ifdone\the\attribute\transparencyattribute\else0\fi
+ }}}%
\setevalue{\??on#1:a}{\the\scratchcounter}}
\let\doredefinebar\dodefinebarindeed
-\def\doruled
- {\ctxlua{nodes.rules.enable()}%
- \glet\doruled\doruledindeed
- \doruledindeed}
-
-\def\doruledindeed#1%
+\def\doruled#1%
{\groupedcommand{\dodoruled{#1}}\relax}
-\def\dodoruled#1%
+\def\dodoruled
+ {\ctxlua{nodes.rules.enable()}%
+ \glet\dodoruled\dodoruledindeed
+ \dodoruled}
+
+\def\dodoruledindeed#1%
{\advance\csname\??on:#1:c\endcsname\plusone
\scratchcounter\csname\??on:#1:c\endcsname
\dosetattribute{ruled}{\numexpr1000*\scratchcounter
diff --git a/tex/context/base/node-tra.lua b/tex/context/base/node-tra.lua
index 2b758fa24..004aa34fa 100644
--- a/tex/context/base/node-tra.lua
+++ b/tex/context/base/node-tra.lua
@@ -417,3 +417,5 @@ function nodes.ids_to_string(head,tail)
end
return concat(t," ")
end
+
+nodes.ids_tostring = nodes.ids_to_string
diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv
index ecf69d3d6..8bae7e754 100644
--- a/tex/context/base/pack-rul.mkiv
+++ b/tex/context/base/pack-rul.mkiv
@@ -2271,13 +2271,13 @@
%D \showsetup{vl}
%D \showsetup{hl}
-\def\complexvl[#1]%
+\def\dovlwdhtdp#1#2#3%
{\bgroup
- \!!dimena#1\strutht
- \!!dimenb#1\strutdp
+ \!!dimena#2\strutht
+ \!!dimenb#3\strutdp
\setbox\scratchbox\hbox
{\vrule
- \!!width \linewidth
+ \!!width #1\linewidth
\!!height\!!dimena
\!!depth \!!dimenb}%
\dp\scratchbox\strutdp
@@ -2285,6 +2285,9 @@
\box\scratchbox
\egroup}
+\def\complexvl[#1]%
+ {\dovlwdhtdp\linewidth{#1}{#1}}
+
\def\complexhl[#1]%
{\hbox
{\vrule
diff --git a/tex/context/base/typo-brk.lua b/tex/context/base/typo-brk.lua
index 6a4d20bc1..e3d0a8ad8 100644
--- a/tex/context/base/typo-brk.lua
+++ b/tex/context/base/typo-brk.lua
@@ -115,6 +115,8 @@ breakpoints.methods[4] = function(head,start) -- - => - - -
return head, start
end
+local methods = breakpoints.methods
+
function breakpoints.process(namespace,attribute,head)
local done, numbers = false, languages.numbers
local start, n = head, 0
@@ -129,7 +131,9 @@ function breakpoints.process(namespace,attribute,head)
if map then
local cmap = map[start.char]
if cmap then
- local smap = cmap[numbers[start.lang]] or cmap[""]
+ local lang = start.lang
+ -- we do a sanity check for language
+ local smap = lang and lang >= 0 and lang < 0x7FFF and (cmap[numbers[lang]] or cmap[""])
if smap then
if n >= smap[2] then
local m = smap[3]
@@ -140,7 +144,7 @@ function breakpoints.process(namespace,attribute,head)
if map[next.char] then
break
elseif m == 1 then
- local method = breakpoints.methods[smap[1]]
+ local method = methods[smap[1]]
if method then
head, start = method(head,start)
done = true
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index 875f03d8f..b86f16e21 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua
--- merge date : 11/07/09 18:04:39
+-- merge date : 11/09/09 17:53:45
do -- begin closure to overcome local limits and interference
@@ -1324,7 +1324,7 @@ function table.clone(t,p) -- t is optional or nil or table
elseif not t then
t = { }
end
- setmetatable(t, { __index = function(_,key) return p[key] end })
+ setmetatable(t, { __index = function(_,key) return p[key] end }) -- why not __index = p ?
return t
end
@@ -3248,18 +3248,6 @@ function fonts.show_font_parameters()
end
end
-local dimenfactors = number.dimenfactors
-
-function fonts.dimenfactor(unit,tfmdata)
- if unit == "ex" then
- return tfmdata.parameters.x_height
- elseif unit == "em" then
- return tfmdata.parameters.em_height
- else
- return dimenfactors[unit] or unit
- end
-end
-
end -- closure
do -- begin closure to overcome local limits and interference
@@ -3631,6 +3619,7 @@ local private = fonts.private
end
end
if hasquality then
+ -- we could move these calculations elsewhere (saves calculations)
local ve = v.expansion_factor
if ve then
chr.expansion_factor = ve*1000 -- expansionfactor, hm, can happen elsewhere