summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2009-10-22 23:27:00 +0200
committerHans Hagen <pragma@wxs.nl>2009-10-22 23:27:00 +0200
commitf89395483bb5154004626768dfcee7316254b1fa (patch)
treec77176cdb82b854eccde07395c0503eae7e1d43c /tex
parent8248cba2a913b762265cfb43c1cd93d0c36888ef (diff)
downloadcontext-f89395483bb5154004626768dfcee7316254b1fa.tar.gz
beta 2009.10.22 23:27
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/char-ini.lua38
-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.lua7
-rw-r--r--tex/context/base/font-def.lua50
-rw-r--r--tex/context/base/font-mis.lua2
-rw-r--r--tex/context/base/font-otc.lua4
-rw-r--r--tex/context/base/font-otf.lua20
-rw-r--r--tex/context/base/grph-inc.lua18
-rw-r--r--tex/context/base/luat-lib.mkiv1
-rw-r--r--tex/context/base/lxml-ent.lua27
-rw-r--r--tex/context/base/lxml-ini.mkiv8
-rw-r--r--tex/context/base/lxml-lpt.lua7
-rw-r--r--tex/context/base/lxml-tab.lua37
-rw-r--r--tex/context/base/math-vfu.lua155
-rw-r--r--tex/context/base/node-inj.lua133
-rw-r--r--tex/context/base/strc-itm.mkiv5
-rw-r--r--tex/context/base/strc-ref.lua1
-rw-r--r--tex/context/base/type-otf.mkiv56
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua209
20 files changed, 441 insertions, 341 deletions
diff --git a/tex/context/base/char-ini.lua b/tex/context/base/char-ini.lua
index 4a981bb9b..1970f7579 100644
--- a/tex/context/base/char-ini.lua
+++ b/tex/context/base/char-ini.lua
@@ -607,28 +607,28 @@ function characters.n_is_of_category(n,category) -- by name (string)
return cd and cd.category == category
end
--- xml support
-
-characters.active_offset = 0x10000
-
-xml.entities = xml.entities or { }
-
-storage.register("xml/entities",xml.entities,"xml.entities") -- this will move to lxml
+-- xml support (moved)
function characters.remapentity(chr,slot)
texsprint(format("{\\catcode%s=13\\xdef%s{\\string%s}}",slot,utfchar(slot),chr))
end
-function characters.setmkiventities()
- local entities = xml.entities
- entities.lt = "<"
- entities.amp = "&"
- entities.gt = ">"
-end
+characters.active_offset = 0x10000 -- there will be remapped in that byte range
-function characters.setmkiientities()
- local entities = xml.entities
- entities.lt = utfchar(characters.active_offset + utfbyte("<"))
- entities.amp = utfchar(characters.active_offset + utfbyte("&"))
- entities.gt = utfchar(characters.active_offset + utfbyte(">"))
-end
+-- xml.entities = xml.entities or { }
+--
+-- storage.register("xml/entities",xml.entities,"xml.entities") -- this will move to lxml
+--
+-- function characters.setmkiventities()
+-- local entities = xml.entities
+-- entities.lt = "<"
+-- entities.amp = "&"
+-- entities.gt = ">"
+-- end
+--
+-- function characters.setmkiientities()
+-- local entities = xml.entities
+-- entities.lt = utfchar(characters.active_offset + utfbyte("<"))
+-- entities.amp = utfchar(characters.active_offset + utfbyte("&"))
+-- entities.gt = utfchar(characters.active_offset + utfbyte(">"))
+-- end
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 0668640ef..acfa4e391 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.10.21 10:28}
+\newcontextversion{2009.10.22 23:27}
%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 231252724..857268890 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.10.21 10:28}
+\edef\contextversion{2009.10.22 23:27}
%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 f3b7879fb..8e42b0ab0 100644
--- a/tex/context/base/font-ctx.lua
+++ b/tex/context/base/font-ctx.lua
@@ -273,7 +273,9 @@ local P, C, Cc = lpeg.P, lpeg.C, lpeg.Cc
local space = P(" ")
local spaces = space^0
-local value = C((1-space)^1)
+local leftparent = (P"(")
+local rightparent = (P")")
+local value = C((leftparent * (1-rightparent)^0 * rightparent + (1-space))^1)
local rest = C(P(1)^0)
local scale_none = Cc(0)
local scale_at = P("at") * Cc(1) * spaces * value
@@ -333,7 +335,8 @@ function define.command_2(global,cs,str,size,classfeatures,fontfeatures,classfal
if lookup and lookup ~= "" then specification.lookup = lookup end
specification.name = name
specification.size = size
- specification.sub = sub
+--~ specification.sub = sub
+ specification.sub = (sub and sub ~= "" and sub) or specification.sub
specification.mathsize = mathsize
specification.textsize = textsize
if detail and detail ~= "" then
diff --git a/tex/context/base/font-def.lua b/tex/context/base/font-def.lua
index bc09d0f2e..c362e3867 100644
--- a/tex/context/base/font-def.lua
+++ b/tex/context/base/font-def.lua
@@ -78,18 +78,22 @@ and prepares a table that will move along as we proceed.</p>
local splitter, specifiers = nil, ""
+local P, C, S, Cc = lpeg.P, lpeg.C, lpeg.S, lpeg.Cc
+
+local left = P("(")
+local right = P(")")
+local colon = P(":")
+local space = P(" ")
+
function define.add_specifier(symbol)
specifiers = specifiers .. symbol
- local left = lpeg.P("(")
- local right = lpeg.P(")")
- local colon = lpeg.P(":")
- local method = lpeg.S(specifiers)
- local lookup = lpeg.C(lpeg.P("file")+lpeg.P("name")) * colon -- hard test, else problems with : method
- local sub = left * lpeg.C(lpeg.P(1-left-right-method)^1) * right
---~ local specification = lpeg.C(method) * lpeg.C(lpeg.P(1-method)^1)
- local specification = lpeg.C(method) * lpeg.C(lpeg.P(1)^1)
- local name = lpeg.C((1-sub-specification)^1)
- splitter = lpeg.P((lookup + lpeg.Cc("")) * name * (sub + lpeg.Cc("")) * (specification + lpeg.Cc("")))
+ local method = S(specifiers)
+ local lookup = C(P("file")+P("name")) * colon -- hard test, else problems with : method
+ local sub = left * C(P(1-left-right-method)^1) * right
+--~ local specification = C(method) * C(P(1-method)^1)
+ local specification = C(method) * C(P(1)^1)
+ local name = C((1-sub-specification)^1)
+ splitter = P((lookup + Cc("")) * name * (sub + Cc("")) * (specification + Cc("")))
end
function define.get_specification(str)
@@ -133,7 +137,7 @@ end
function define.analyze(specification, size)
-- can be optimized with locals
local lookup, name, sub, method, detail = define.get_specification(specification or "")
- return define.makespecification(specification,lookup, name, sub, method, detail, size)
+ return define.makespecification(specification, lookup, name, sub, method, detail, size)
end
--[[ldx--
@@ -409,16 +413,22 @@ function readers.afm(specification,method)
return tfmtable
end
-local function check_otf(specification,suffix,what)
- local fullname, tfmtable = resolvers.findbinfile(specification.name,suffix) or "", nil
+-- maybe some day a set of names
+
+local function check_otf(forced,specification,suffix,what)
+ local name = specification.name
+ if forced then
+ name = file.addsuffix(name,suffix)
+ end
+ local fullname, tfmtable = resolvers.findbinfile(name,suffix) or "", nil -- one shot
if fullname == "" then
- local fb = fonts.names.old_to_new[specification.name]
+ local fb = fonts.names.old_to_new[name]
if fb then
fullname = resolvers.findbinfile(fb,suffix) or ""
end
end
if fullname == "" then
- local fb = fonts.names.new_to_old[specification.name]
+ local fb = fonts.names.new_to_old[name]
if fb then
fullname = resolvers.findbinfile(fb,suffix) or ""
end
@@ -433,13 +443,11 @@ end
function readers.opentype(specification,suffix,what)
local forced = specification.forced or ""
if forced == "otf" then
- return check_otf(specification,forced,"opentype")
- elseif forced == "ttf" then
- return check_otf(specification,forced,"truetype")
- elseif forced == "ttf" then
- return check_otf(specification,forced,"truetype")
+ return check_otf(true,specification,forced,"opentype")
+ elseif forced == "ttf" or forced == "ttc" or forced == "dfont" then
+ return check_otf(true,specification,forced,"truetype")
else
- return check_otf(specification,suffix,what)
+ return check_otf(false,specification,suffix,what)
end
end
diff --git a/tex/context/base/font-mis.lua b/tex/context/base/font-mis.lua
index 6cdb076ac..dc60cf2a2 100644
--- a/tex/context/base/font-mis.lua
+++ b/tex/context/base/font-mis.lua
@@ -11,7 +11,7 @@ local lower, strip = string.lower, string.strip
fonts.otf = fonts.otf or { }
-fonts.otf.version = fonts.otf.version or 2.633
+fonts.otf.version = fonts.otf.version or 2.635
fonts.otf.pack = true
fonts.otf.cache = containers.define("fonts", "otf", fonts.otf.version, true)
diff --git a/tex/context/base/font-otc.lua b/tex/context/base/font-otc.lua
index f75da39cd..1fc1f2289 100644
--- a/tex/context/base/font-otc.lua
+++ b/tex/context/base/font-otc.lua
@@ -219,7 +219,9 @@ function otf.name_to_slot(name) -- todo: afm en tfm
if tfmdata and tfmdata.shared then
local otfdata = tfmdata.shared.otfdata
local unicode = otfdata.luatex.unicodes[name]
- if type(unicode) == "number" then
+ if not unicode then
+ return string.byte("?") -- nil
+ elseif type(unicode) == "number" then
return unicode
else
return unicode[1]
diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua
index 653d3e95a..be1873898 100644
--- a/tex/context/base/font-otf.lua
+++ b/tex/context/base/font-otf.lua
@@ -82,7 +82,7 @@ otf.features.default = otf.features.default or { }
otf.enhancers = otf.enhancers or { }
otf.glists = { "gsub", "gpos" }
-otf.version = 2.633 -- beware: also sync font-mis.lua
+otf.version = 2.635 -- beware: also sync font-mis.lua
otf.pack = true -- beware: also sync font-mis.lua
otf.syncspace = true
otf.notdef = false
@@ -104,6 +104,7 @@ otf.tables.global_fields = table.tohash {
"names",
"unicodes",
"names",
+--~ "math",
"anchor_classes",
"kern_classes",
"gpos",
@@ -228,7 +229,7 @@ function otf.load(filename,format,sub,featurefile)
local data = containers.read(otf.cache(), hash)
local size = lfs.attributes(filename,"size") or 0
if not data or data.verbose ~= fonts.verbose or data.size ~= size then
- logs.report("load otf","loading: %s",filename)
+ logs.report("load otf","loading: %s (hash: %s)",filename,hash)
local ff, messages
if sub then
ff, messages = fontloader.open(filename,sub)
@@ -527,7 +528,7 @@ otf.enhancers["analyse unicodes"] = function(data,filename)
end
-- cidmap heuristics, beware, there is no guarantee for a match unless
-- the chain resolves
- if not unicode and usedmap then
+ if (not unicode) and usedmap then
local foundindex = oparser:match(name)
if foundindex then
unicode = cidcodes[foundindex] -- name to number
@@ -571,21 +572,20 @@ otf.enhancers["analyse unicodes"] = function(data,filename)
originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1
end
else
- local done = true
+ local t = { }
for l=1,nplit do
local base = split[l]
local u = unicodes[base] or (agl and agl[base])
if not u then
- done = false
break
elseif type(u) == "table" then
- split[l] = u[1]
+ t[#t+1] = u[1]
else
- split[l] = u
+ t[#t+1] = u
end
end
- if done then
- originals[index], tounicode[index], nl, unicode = split, tounicode16sequence(split), nl + 1, true
+ if #t > 0 then -- done then
+ originals[index], tounicode[index], nl, unicode = t, tounicode16sequence(t), nl + 1, true
end
end
end
@@ -779,7 +779,7 @@ otf.enhancers["prepare unicode"] = function(data,filename)
end
end
end
- -- beware: the indeces table is used to initialize the tfm table
+ -- beware: the indices table is used to initialize the tfm table
for unicode, index in next, mapmap do
if not internals[index] then
local name = glyphs[index].name
diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua
index 57ac0bda4..db68d1f03 100644
--- a/tex/context/base/grph-inc.lua
+++ b/tex/context/base/grph-inc.lua
@@ -384,6 +384,9 @@ local function locate(request) -- name, format, cache
local askedformat = (request.format ~= "" and request.format ~= "unknown" and request.format) or file.extname(askedname) or ""
local askedcache = request.cache
if askedformat ~= "" then
+ if trace_figures then
+ commands.writestatus("figures","strategy: forced format")
+ end
askedformat = lower(askedformat)
local format = figures.suffixes[askedformat]
if not format then
@@ -442,6 +445,9 @@ local function locate(request) -- name, format, cache
end
end
elseif askedpath then
+ if trace_figures then
+ commands.writestatus("figures","strategy: rootbased path")
+ end
for _, format in ipairs(figures.order) do
local list = figures.formats[format].list or { format }
for _, suffix in ipairs(list) do
@@ -458,10 +464,14 @@ local function locate(request) -- name, format, cache
end
else
if figures.prefer_quality then
+ if trace_figures then
+ commands.writestatus("figures","strategy: unknown format, prefer quality")
+ end
for _, format in ipairs(figures.order) do
local list = figures.formats[format].list or { format }
for _, suffix in ipairs(list) do
- local name = file.replacesuffix(askedbase,suffix)
+--~ local name = file.replacesuffix(askedbase,suffix)
+ local name = file.replacesuffix(askedname,suffix)
for _, path in ipairs(figures.paths) do
local check = path .. "/" .. name
if figures.exists(check,format) then
@@ -476,6 +486,9 @@ local function locate(request) -- name, format, cache
end
end
else -- 'location'
+ if trace_figures then
+ commands.writestatus("figures","strategy: unknown format, prefer path")
+ end
for _, path in ipairs(figures.paths) do
for _, format in ipairs(figures.order) do
local list = figures.formats[format].list or { format }
@@ -494,6 +507,9 @@ local function locate(request) -- name, format, cache
end
end
if figures.defaultsearch then
+ if trace_figures then
+ commands.writestatus("figures","strategy: default tex path")
+ end
for _, format in ipairs(figures.order) do
local list = figures.formats[format].list or { format }
for _, suffix in ipairs(list) do
diff --git a/tex/context/base/luat-lib.mkiv b/tex/context/base/luat-lib.mkiv
index b52d9facb..53a2b2379 100644
--- a/tex/context/base/luat-lib.mkiv
+++ b/tex/context/base/luat-lib.mkiv
@@ -47,7 +47,6 @@
\registerctxluafile{lxml-xml} {1.001}
\registerctxluafile{lxml-aux} {1.001}
\registerctxluafile{lxml-mis} {1.001}
-%registerctxluafile{lxml-ent} {1.001}
\startruntimeluacode
\edef\asciia{\ctxlua{tex.sprint(logs.mode)}}
diff --git a/tex/context/base/lxml-ent.lua b/tex/context/base/lxml-ent.lua
index 9d93fded7..ee6077a76 100644
--- a/tex/context/base/lxml-ent.lua
+++ b/tex/context/base/lxml-ent.lua
@@ -21,24 +21,27 @@ original entity is returned.</p>
<p>We do things different now but it's still somewhat experimental</p>
--ldx]]--
+local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end)
+
xml.entities = xml.entities or { } -- xml.entity_handler == function
--- experimental, this will be done differently
+storage.register("xml/entities",xml.entities,"xml.entities") -- this will move to lxml
+
+local entities = xml.entities -- this is a shared hash
+
+xml.unknown_any_entity_format = nil -- has to be per xml
local parsedentity = xml.parsedentitylpeg
-function xml.merge_entities(root)
- local documententities = root.entities
- local allentities = xml.entities
- if documententities then
- for k, v in next, documententities do
- allentities[k] = v
- end
+function xml.register_entity(key,value)
+ entities[key] = value
+ if trace_entities then
+ logs.report("xml","registering entity '%s' as: %s",key,value)
end
end
function xml.resolved_entity(str)
- local e = xml.entities[str]
+ local e = entities[str]
if e then
local te = type(e)
if te == "function" then
@@ -60,6 +63,6 @@ function xml.resolved_entity(str)
end
end
-xml.entities.amp = function() tex.write("&") end
-xml.entities.lt = function() tex.write("<") end
-xml.entities.gt = function() tex.write(">") end
+entities.amp = function() tex.write("&") end
+entities.lt = function() tex.write("<") end
+entities.gt = function() tex.write(">") end
diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv
index 864c4729c..bb1f4ca44 100644
--- a/tex/context/base/lxml-ini.mkiv
+++ b/tex/context/base/lxml-ini.mkiv
@@ -347,7 +347,7 @@
\chardef\xmlautoentities=1 % 0=off, 1=upper, 2=upper,lower
-\def\xmlsetentity#1#2{\ctxlua{xml.entities['#1'] = \!!bs\detokenize{#2}\!!es}}
+\def\xmlsetentity#1#2{\ctxlua{xml.register_entity('#1',\!!bs\detokenize{#2}\!!es)}}
% \xmlsetentity{tex}{\TEX{}} % {} needed
@@ -363,13 +363,13 @@
\fi}
\def\xmle@none#1#2% safe
- {[#1]}
+ {#1}
\def\xmle@upper#1#2% can be abbreviation
{\ifcsname#2\endcsname
\csname#2\expandafter\endcsname
\else
- [#1]%
+ #1%
\fi}
\def\xmle@upperlower#1#2% can be anything, so unsafe
@@ -378,7 +378,7 @@
\else\ifcsname#1\endcsname
\csname#1\expandafter\expandafter\expandafter\endcsname
\else
- [#1]%
+ #1%
\fi\fi}
\protect \endinput
diff --git a/tex/context/base/lxml-lpt.lua b/tex/context/base/lxml-lpt.lua
index c656381c0..428080a9f 100644
--- a/tex/context/base/lxml-lpt.lua
+++ b/tex/context/base/lxml-lpt.lua
@@ -553,7 +553,9 @@ local parser = Ct { "patterns", -- can be made a bit faster by moving pattern ou
protocol = Cg(V("letters"),"protocol") * P("://") + Cg(Cc(nil),"protocol"),
- step = (V("shortcuts") + V("axis") * spaces * V("nodes")^0 + V("error")) * spaces * V("expressions")^0 * spaces * V("finalizer")^0,
+ -- the / is needed for // as descendant or self is somewhat special
+ -- step = (V("shortcuts") + V("axis") * spaces * V("nodes")^0 + V("error")) * spaces * V("expressions")^0 * spaces * V("finalizer")^0,
+ step = ((V("shortcuts") + P("/") + V("axis")) * spaces * V("nodes")^0 + V("error")) * spaces * V("expressions")^0 * spaces * V("finalizer")^0,
axis = V("descendant") + V("child") + V("parent") + V("self") + V("root") + V("ancestor") +
V("descendant_or_self") + V("following") + V("following_sibling") +
@@ -568,7 +570,8 @@ local parser = Ct { "patterns", -- can be made a bit faster by moving pattern ou
shortcuts = V("shortcuts_a") * (spaces * "/" * spaces * V("shortcuts_a"))^0,
- s_descendant_or_self = P("/") * Cc(register_descendant_or_self),
+ s_descendant_or_self = (P("***/") + P("/")) * Cc(register_descendant_or_self), --- *** is a bonus
+ -- s_descendant_or_self = P("/") * Cc(register_descendant_or_self),
s_descendant = P("**") * Cc(register_descendant),
s_child = P("*") * Cc(register_child ),
s_parent = P("..") * Cc(register_parent ),
diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua
index e5273d92e..88803ab16 100644
--- a/tex/context/base/lxml-tab.lua
+++ b/tex/context/base/lxml-tab.lua
@@ -142,8 +142,9 @@ element.</p>
local nsremap, resolvens = xml.xmlns, xml.resolvens
-local stack, top, dt, at, xmlns, errorstr, entities = {}, {}, {}, {}, {}, nil, {}
+local stack, top, dt, at, xmlns, errorstr, entities = { }, { }, { }, { }, { }, nil, { }
local strip, cleanup, utfize, resolve = false, false, false, false
+local dcache, hcache, acache = { }, { }, { }
local mt = { }
@@ -263,8 +264,6 @@ local function attribute_specification_error(str)
return str
end
-local dcache, hcache, acache = { }, { }, { }
-
function xml.unknown_dec_entity_format(str) return format("&%s;", str) end
function xml.unknown_hex_entity_format(str) return format("&#x%s;",str) end
function xml.unknown_any_entity_format(str) return format("&%s;", str) end
@@ -346,26 +345,37 @@ xml.parsedentitylpeg = parsedentity
local function handle_any_entity(str)
if resolve then
- local a = entities[str] -- per instance !
+ local a = acache[str] -- per instance ! todo
if not a then
- a = acache[str]
- if not a then
+ a = entities[str]
+ if a then
if trace_entities then
- logs.report("xml","ignoring entity &%s;",str)
+ logs.report("xml","resolved entity &%s; -> %s (internal)",str,a)
+ end
+ a = parsedentity:match(a) or a
+ else
+ if xml.unknown_any_entity_format then
+ a = xml.unknown_any_entity_format(str) or ""
+ end
+ if a then
+ if trace_entities then
+ logs.report("xml","resolved entity &%s; -> %s (external)",str,a)
+ end
else
- -- can be defined in a global mapper and intercepted elsewhere
- -- as happens in lxml-tex.lua
+ if trace_entities then
+ logs.report("xml","keeping entity &%s;",str)
+ end
+ a = "&" .. str .. ";"
end
- a = xml.unknown_any_entity_format(str) or ""
- acache[str] = a
end
+ acache[str] = a
elseif trace_entities then
if not acache[str] then
logs.report("xml","converting entity &%s; into %s",str,a)
acache[str] = a
end
end
- return (a and parsedentity:match(a)) or a
+ return a
else
local a = acache[str]
if not a then
@@ -503,7 +513,8 @@ local function xmlconvert(data, settings)
utfize = settings.utfize_entities
resolve = settings.resolve_entities
cleanup = settings.text_cleanup
- stack, top, at, xmlns, errorstr, result, entities = {}, {}, {}, {}, nil, nil, settings.entities or {}
+ stack, top, at, xmlns, errorstr, result, entities = { }, { }, { }, { }, nil, nil, settings.entities or { }
+ acache, hcache, dcache = { }, { }, { } -- not stored
reported_attribute_errors = { }
if settings.parent_root then
mt = getmetatable(settings.parent_root)
diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua
index e54d68fbe..57fde4ddf 100644
--- a/tex/context/base/math-vfu.lua
+++ b/tex/context/base/math-vfu.lua
@@ -225,20 +225,33 @@ end
local unique = 0 -- testcase: \startTEXpage \math{!\text{-}\text{-}\text{-}} \stopTEXpage
-function fonts.basecopy(tfmtable)
+function fonts.basecopy(tfmtable,name)
+ local characters, parameters, fullname = tfmtable.characters, tfmtable.parameters, tfmtable.fullname
local t, c, p = { }, { }, { }
for k, v in next, tfmtable do
t[k] = v
end
- for k, v in next, tfmtable.characters do
- c[k] = v
+ if characters then
+ for k, v in next, characters do
+ c[k] = v
+ end
+ t.characters = c
+ else
+ logs.report("math virtual","font %s has no characters",name)
+ end
+ if parameters then
+ for k, v in next, parameters do
+ p[k] = v
+ end
+ t.parameters = p
+ else
+ logs.report("math virtual","font %s has no parameters",name)
end
- for k, v in next, tfmtable.parameters do
- p[k] = v
+ -- tricky ... what if fullname does not exist
+ if fullname then
+ unique = unique + 1
+ t.fullname = fullname .. "-" .. unique
end
- t.characters, t.parameters = c, p
- unique = unique + 1
- t.fullname = t.fullname .. "-" .. unique
return t
end
@@ -287,10 +300,13 @@ function fonts.vf.math.define(specification,set)
end
end
-- beware, fnt[1] is already passed to tex (we need to make a simple copy then .. todo)
- main = fonts.basecopy(fnt[1])
+ main = fonts.basecopy(fnt[1],name)
main.name, main.fonts, main.virtualized, main.math_parameters = name, lst, true, { }
local characters, descriptions = main.characters, main.descriptions
- main.parameters.x_height = main.parameters.x_height or 0
+ local mp = main.parameters
+ if mp then
+ mp.x_height = mp.x_height or 0
+ end
local already_reported = false
for s=1,n do
local ss, fs = okset[s], fnt[s]
@@ -300,34 +316,38 @@ function fonts.vf.math.define(specification,set)
-- skip, redundant
else
local mm, fp = main.math_parameters, fs.parameters
- if ss.extension then
- mm.math_x_height = fp.x_height or 0 -- math_x_height height of x
- mm.default_rule_thickness = fp[ 8] or 0 -- default_rule_thickness thickness of \over bars
- mm.big_op_spacing1 = fp[ 9] or 0 -- big_op_spacing1 minimum clearance above a displayed op
- mm.big_op_spacing2 = fp[10] or 0 -- big_op_spacing2 minimum clearance below a displayed op
- mm.big_op_spacing3 = fp[11] or 0 -- big_op_spacing3 minimum baselineskip above displayed op
- mm.big_op_spacing4 = fp[12] or 0 -- big_op_spacing4 minimum baselineskip below displayed op
- mm.big_op_spacing5 = fp[13] or 0 -- big_op_spacing5 padding above and below displayed limits
- -- logs.report("math virtual","loading and virtualizing font %s at size %s, setting ex parameters",name,size)
- elseif ss.parameters then
- main.parameters.x_height = fp.x_height or main.parameters.x_height
- mm.x_height = mm.x_height or fp.x_height or 0 -- x_height height of x
- mm.num1 = fp[ 8] or 0 -- num1 numerator shift-up in display styles
- mm.num2 = fp[ 9] or 0 -- num2 numerator shift-up in non-display, non-\atop
- mm.num3 = fp[10] or 0 -- num3 numerator shift-up in non-display \atop
- mm.denom1 = fp[11] or 0 -- denom1 denominator shift-down in display styles
- mm.denom2 = fp[12] or 0 -- denom2 denominator shift-down in non-display styles
- mm.sup1 = fp[13] or 0 -- sup1 superscript shift-up in uncramped display style
- mm.sup2 = fp[14] or 0 -- sup2 superscript shift-up in uncramped non-display
- mm.sup3 = fp[15] or 0 -- sup3 superscript shift-up in cramped styles
- mm.sub1 = fp[16] or 0 -- sub1 subscript shift-down if superscript is absent
- mm.sub2 = fp[17] or 0 -- sub2 subscript shift-down if superscript is present
- mm.sup_drop = fp[18] or 0 -- sup_drop superscript baseline below top of large box
- mm.sub_drop = fp[19] or 0 -- sub_drop subscript baseline below bottom of large box
- mm.delim1 = fp[20] or 0 -- delim1 size of \atopwithdelims delimiters in display styles
- mm.delim2 = fp[21] or 0 -- delim2 size of \atopwithdelims delimiters in non-displays
- mm.axis_height = fp[22] or 0 -- axis_height height of fraction lines above the baseline
- -- logs.report("math virtual","loading and virtualizing font %s at size %s, setting sy parameters",name,size)
+ if mm and fp and mp then
+ if ss.extension then
+ mm.math_x_height = fp.x_height or 0 -- math_x_height height of x
+ mm.default_rule_thickness = fp[ 8] or 0 -- default_rule_thickness thickness of \over bars
+ mm.big_op_spacing1 = fp[ 9] or 0 -- big_op_spacing1 minimum clearance above a displayed op
+ mm.big_op_spacing2 = fp[10] or 0 -- big_op_spacing2 minimum clearance below a displayed op
+ mm.big_op_spacing3 = fp[11] or 0 -- big_op_spacing3 minimum baselineskip above displayed op
+ mm.big_op_spacing4 = fp[12] or 0 -- big_op_spacing4 minimum baselineskip below displayed op
+ mm.big_op_spacing5 = fp[13] or 0 -- big_op_spacing5 padding above and below displayed limits
+ -- logs.report("math virtual","loading and virtualizing font %s at size %s, setting ex parameters",name,size)
+ elseif ss.parameters then
+ mp.x_height = fp.x_height or mp.x_height
+ mm.x_height = mm.x_height or fp.x_height or 0 -- x_height height of x
+ mm.num1 = fp[ 8] or 0 -- num1 numerator shift-up in display styles
+ mm.num2 = fp[ 9] or 0 -- num2 numerator shift-up in non-display, non-\atop
+ mm.num3 = fp[10] or 0 -- num3 numerator shift-up in non-display \atop
+ mm.denom1 = fp[11] or 0 -- denom1 denominator shift-down in display styles
+ mm.denom2 = fp[12] or 0 -- denom2 denominator shift-down in non-display styles
+ mm.sup1 = fp[13] or 0 -- sup1 superscript shift-up in uncramped display style
+ mm.sup2 = fp[14] or 0 -- sup2 superscript shift-up in uncramped non-display
+ mm.sup3 = fp[15] or 0 -- sup3 superscript shift-up in cramped styles
+ mm.sub1 = fp[16] or 0 -- sub1 subscript shift-down if superscript is absent
+ mm.sub2 = fp[17] or 0 -- sub2 subscript shift-down if superscript is present
+ mm.sup_drop = fp[18] or 0 -- sup_drop superscript baseline below top of large box
+ mm.sub_drop = fp[19] or 0 -- sub_drop subscript baseline below bottom of large box
+ mm.delim1 = fp[20] or 0 -- delim1 size of \atopwithdelims delimiters in display styles
+ mm.delim2 = fp[21] or 0 -- delim2 size of \atopwithdelims delimiters in non-displays
+ mm.axis_height = fp[22] or 0 -- axis_height height of fraction lines above the baseline
+ -- logs.report("math virtual","loading and virtualizing font %s at size %s, setting sy parameters",name,size)
+ end
+ else
+ logs.report("math virtual","font %s, no parameters set",name)
end
local vectorname = ss.vector
if vectorname then
@@ -513,14 +533,17 @@ function fonts.vf.math.define(specification,set)
end
end
lst[#lst+1] = { id = font.nextid(), size = size }
- fonts.vf.math.alas(main,#lst,size)
+ if mp then -- weak catch
+ fonts.vf.math.alas(main,#lst,size)
+ end
if trace_virtual or trace_timings then
logs.report("math virtual","loading and virtualizing font %s at size %s took %0.3f seconds",name,size,os.clock()-start)
end
main.has_italic = true
main.type = "virtual" -- not needed
mathematics.scaleparameters(main,main,1)
-main.nomath = false
+--~ main.name = nil -- crashes
+ main.nomath = false
return main
end
@@ -1579,31 +1602,41 @@ mathematics.make_font ( "lucida-math", {
} )
mathematics.make_font ( "charter-math", {
- { name = "file:bchr8a", features = "virtualmath", main = true },
--- { name = "md-chr7m.tfm", vector = "tex-mr" },
- { name = "md-chri7m.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "md-chr7y.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
- { name = "md-chr7v.tfm", vector = "tex-ex", extension = true },
- { name = "msam10.tfm", vector = "tex-ma" },
- { name = "msbm10.tfm", vector = "tex-mb" },
+ { name = "file:bchr8a", features = "virtualmath", main = true },
+ -- { name = "md-chr7m.tfm", vector = "tex-mr" },
+ { name = "md-chri7m.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "md-chr7y.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "md-chr7v.tfm", vector = "tex-ex", extension = true },
+ { name = "msam10.tfm", vector = "tex-ma" },
+ { name = "msbm10.tfm", vector = "tex-mb" },
} )
mathematics.make_font ( "garamond-math", {
- { name = "file:ugmr8y", features = "virtualmath", main = true },
--- { name = "md-gmr7m.tfm", vector = "tex-mr" },
- { name = "md-gmri7m.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "md-gmr7y.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
- { name = "md-gmr7v.tfm", vector = "tex-ex", extension = true },
- { name = "msam10.tfm", vector = "tex-ma" },
- { name = "msbm10.tfm", vector = "tex-mb" },
+ { name = "file:ugmr8y", features = "virtualmath", main = true },
+ -- { name = "md-gmr7m.tfm", vector = "tex-mr" },
+ { name = "md-gmri7m.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "md-gmr7y.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "md-gmr7v.tfm", vector = "tex-ex", extension = true },
+ { name = "msam10.tfm", vector = "tex-ma" },
+ { name = "msbm10.tfm", vector = "tex-mb" },
} )
mathematics.make_font ( "utopia-math", {
- { name = "file:putr8y", features = "virtualmath", main = true },
--- { name = "md-utr7m.tfm", vector = "tex-mr" },
- { name = "md-utri7m.tfm", vector = "tex-mi", skewchar=0x7F },
- { name = "md-utr7y.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
- { name = "md-utr7v.tfm", vector = "tex-ex", extension = true },
- { name = "msam10.tfm", vector = "tex-ma" },
- { name = "msbm10.tfm", vector = "tex-mb" },
+ { name = "file:putr8y", features = "virtualmath", main = true },
+ -- { name = "md-utr7m.tfm", vector = "tex-mr" },
+ { name = "md-utri7m.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "md-utr7y.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "md-utr7v.tfm", vector = "tex-ex", extension = true },
+ { name = "msam10.tfm", vector = "tex-ma" },
+ { name = "msbm10.tfm", vector = "tex-mb" },
+} )
+
+mathematics.make_font ( "hvmath-math", {
+ { name = "texgyreheros-regular.otf", features = "virtualmath", main = true },
+ { name = "hvrm108r.tfm", vector="tex-mr", features = "virtualmath", main = true },
+ { name = "hvmi10.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "hvsy10.tfm", vector = "tex-sy", skewchar=0x30, parameters = true },
+ { name = "hvex10.tfm", vector = "tex-ex", extension = true },
+ { name = "hvam10.tfm", vector = "tex-ma" },
+ { name = "hvbm10.tfm", vector = "tex-mb" },
} )
diff --git a/tex/context/base/node-inj.lua b/tex/context/base/node-inj.lua
index 18077b159..4c5840978 100644
--- a/tex/context/base/node-inj.lua
+++ b/tex/context/base/node-inj.lua
@@ -74,7 +74,7 @@ function nodes.set_pair(current,factor,rlmode,r2lflag,spec,tfmchr)
else
bound = #kerns + 1
set_attribute(current,kernpair,bound)
- kerns[bound] = { rlmode, x, y, w, h, r2lflag }
+ kerns[bound] = { rlmode, x, y, w, h, r2lflag, tfmchr.width }
end
return x, y, w, h, bound
end
@@ -341,8 +341,23 @@ function nodes.inject_kerns(head,where,keep)
-- only w can be nil, can be sped up when w == nil
local rl, x, w, r2l = k[1], k[2] or 0, k[4] or 0, k[6]
local wx = w - x
--- we can probably listen to only one of them i.e. ignore rl here
- if rl < 0 then
+--~ if rl < 0 then
+--~ if r2l then
+--~ if wx ~= 0 then
+--~ insert_node_before(head,n,newkern(wx))
+--~ end
+--~ if x ~= 0 then
+--~ insert_node_after (head,n,newkern(x))
+--~ end
+--~ else
+--~ if x ~= 0 then
+--~ insert_node_before(head,n,newkern(x))
+--~ end
+--~ if wx ~= 0 then
+--~ insert_node_after(head,n,newkern(wx))
+--~ end
+--~ end
+--~ else
if r2l then
if wx ~= 0 then
insert_node_before(head,n,newkern(wx))
@@ -358,23 +373,7 @@ function nodes.inject_kerns(head,where,keep)
insert_node_after(head,n,newkern(wx))
end
end
- else
- if r2l then
- if wx ~= 0 then
- insert_node_before(head,n,newkern(wx))
- end
- if x ~= 0 then
- insert_node_after (head,n,newkern(x))
- end
- else
- if x ~= 0 then
- insert_node_before(head,n,newkern(x))
- end
- if wx ~= 0 then
- insert_node_after(head,n,newkern(wx))
- end
- end
- end
+--~ end
end
end
if next(cx) then
@@ -400,61 +399,61 @@ function nodes.inject_kerns(head,where,keep)
if trace_injections then
nodes.trace_injection(head)
end
- for n in traverse_id(glyph,head) do
- local k = has_attribute(n,kernpair)
- if k then
- local kk = kerns[k]
- if kk then
- local rl, x, y, w = kk[1], kk[2] or 0, kk[3], kk[4]
- if y and y ~= 0 then
- n.yoffset = y -- todo: h ?
- end
- if w then
- -- copied from above
- local r2l = kk[6]
- local wx = w - x
- if rl < 0 then
- if r2l then
- if wx ~= 0 then
- insert_node_before(head,n,newkern(wx))
- end
- if x ~= 0 then
- insert_node_after (head,n,newkern(x))
- end
- else
- if x ~= 0 then
- insert_node_before(head,n,newkern(x))
- end
- if wx ~= 0 then
- insert_node_after(head,n,newkern(wx))
- end
+ for n in traverse_id(glyph,head) do
+ local k = has_attribute(n,kernpair)
+ if k then
+ local kk = kerns[k]
+ if kk then
+ local rl, x, y, w = kk[1], kk[2] or 0, kk[3], kk[4]
+ if y and y ~= 0 then
+ n.yoffset = y -- todo: h ?
+ end
+ if w then
+ -- copied from above
+ local r2l = kk[6]
+ local wx = w - x
+--~ if rl < 0 then
+--~ if r2l then
+--~ if x ~= 0 then
+--~ insert_node_before(head,n,newkern(x))
+--~ end
+--~ if wx ~= 0 then
+--~ insert_node_after(head,n,newkern(wx))
+--~ end
+--~ else
+--~ if wx ~= 0 then
+--~ insert_node_before(head,n,newkern(wx))
+--~ end
+--~ if x ~= 0 then
+--~ insert_node_after (head,n,newkern(x))
+--~ end
+--~ end
+--~ else
+ if r2l then
+ if wx ~= 0 then
+ insert_node_before(head,n,newkern(wx))
+ end
+ if x ~= 0 then
+ insert_node_after (head,n,newkern(x))
end
else
- if r2l then
- if wx ~= 0 then
- insert_node_before(head,n,newkern(wx))
- end
- if x ~= 0 then
- insert_node_after (head,n,newkern(x))
- end
- else
- if x ~= 0 then
- insert_node_before(head,n,newkern(x))
- end
- if wx ~= 0 then
- insert_node_after(head,n,newkern(wx))
- end
+ if x ~= 0 then
+ insert_node_before(head,n,newkern(x))
+ end
+ if wx ~= 0 then
+ insert_node_after(head,n,newkern(wx))
end
end
- else
- -- simple (e.g. kernclass kerns)
- if x ~= 0 then
- insert_node_before(head,n,newkern(x))
- end
+--~ end
+ else
+ -- simple (e.g. kernclass kerns)
+ if x ~= 0 then
+ insert_node_before(head,n,newkern(x))
end
end
end
end
+ end
if not keep then
kerns = { }
end
diff --git a/tex/context/base/strc-itm.mkiv b/tex/context/base/strc-itm.mkiv
index b76abb9ed..c17e6044c 100644
--- a/tex/context/base/strc-itm.mkiv
+++ b/tex/context/base/strc-itm.mkiv
@@ -64,13 +64,15 @@
{\edef\currentnofitems {\ctxlua{structure.itemgroups.nofitems("\currentitemgroup",\number\currentnoflists)}}%
\edef\currentitemmaxwidth{\ctxlua{structure.itemgroups.maxwidth("\currentitemgroup",\number\currentnoflists)}\scaledpoint}}
+% todo: \dodosetreference
+
\def\dohandleitemreference % we will make a decent number helper
{\ifx\currentitemreference \empty \else
\setnextinternalreference
\ctxlua { jobreferences.setandgetattribute("\s!full", "\referenceprefix","\currentitemreference",
{
metadata = {
- kind = "list",
+ kind = "item",% ?
catcodes = \the\catcodetable,
xmlroot = \ifx\currentreferencecoding\s!xml "\xmldocument" \else nil \fi, % only useful when text
},
@@ -1120,7 +1122,6 @@
\marsymbol
\let\marsymbol\relax
\strut % added 11-08-99
-% \dohandleitemreference
\setfalse\concatnextitem % new, concat
\nobreak % else problems with intext items
\hskip\itemsignal % new, concat
diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua
index 53d45178a..fca30dfe4 100644
--- a/tex/context/base/strc-ref.lua
+++ b/tex/context/base/strc-ref.lua
@@ -972,6 +972,7 @@ filters.note = { default = filters.generic.number }
filters.formula = { default = filters.generic.number }
filters.float = { default = filters.generic.number }
filters.description = { default = filters.generic.number }
+filters.item = { default = filters.generic.number }
structure.references = structure.references or { }
structure.helpers = structure.helpers or { }
diff --git a/tex/context/base/type-otf.mkiv b/tex/context/base/type-otf.mkiv
index 1efd54488..0a29ba3d3 100644
--- a/tex/context/base/type-otf.mkiv
+++ b/tex/context/base/type-otf.mkiv
@@ -420,42 +420,54 @@
% new
-% cambria.ttc cambriab.ttf cambriai.ttf cambriaz.ttf
+% microsoft: cambria.ttc cambriab.ttf cambriai.ttf cambriaz.ttf
+% ascender : cambmath.ttf cambria.ttf cambriab.ttf cambriai.ttf cambriaz.ttf
-\starttypescript [math] [cambria] [name]
- \definefontsynonym [MathRoman] [name:cambriamath] [features=math\mathsizesuffix]
+\starttypescript [math,serif] [cambria,cambria-x,cambria-y]
+ % whatever matches
+ \definefontsynonym [CambriaMath] [name:cambriamath]
+ \definefontsynonym [CambriaSerif] [name:cambria]
+\stoptypescript
+\starttypescript [math,serif] [cambria-m]
+ % microsoft cabria
+ \definefontsynonym [CambriaMath] [file:cambria.ttc(Cambria Math)]
+ \definefontsynonym [CambriaSerif] [file:cambria.ttc(Cambria)]
+\stoptypescript
+\starttypescript [math,serif] [cambria-a]
+ % ascender cambria
+ \definefontsynonym [CambriaMath] [file:cambmath.ttf]
+ \definefontsynonym [CambriaSerif] [file:cambria.ttf]
+\stoptypescript
+
+\starttypescript [math] [cambria,cambria-m,cambria-a] [name]
+ \definefontsynonym [MathRoman] [CambriaMath] [features=math\mathsizesuffix]
\stoptypescript
\starttypescript [math] [cambria-x] [name]
- \definefontsynonym [MathRoman] [name:cambriamath] [features=math]
+ \definefontsynonym [MathRoman] [CambriaMath] [features=math]
\stoptypescript
\starttypescript [math] [cambria-y] [name]
- \definefontsynonym [MathRoman] [name:cambriamath] [features=math-nostack\mathsizesuffix]
+ \definefontsynonym [MathRoman] [CambriaMath] [features=math-nostack\mathsizesuffix]
\stoptypescript
-\starttypescript [serif] [cambria] [name]
+\starttypescript [serif] [cambria,cambria-m,cambria-a] [name]
\usetypescript[fallback:serif]
- \definefontsynonym [Serif] [name:cambria] [features=default]
+ \definefontsynonym [Serif] [CambriaSerif] [features=default]
\definefontsynonym [SerifBold] [name:cambriabold] [features=default]
\definefontsynonym [SerifItalic] [name:cambriaitalic] [features=default]
\definefontsynonym [SerifBoldItalic] [name:cambriabolditalic] [features=default]
\stoptypescript
-\starttypescript [cambria]
- \definetypeface [cambria] [rm] [serif] [cambria] [default]
- \definetypeface [cambria] [tt] [mono] [modern] [default]
- \definetypeface [cambria] [mm] [math] [cambria] [default]
+\starttypescript [cambria,cambria-m,cambria-a]
+ % any
+ \definetypeface [cambria] [rm] [serif] [\typescriptone] [default]
+ \definetypeface [cambria] [tt] [mono] [modern] [default]
+ \definetypeface [cambria] [mm] [math] [\typescriptone] [default]
\stoptypescript
-
-\starttypescript [cambria-x]
- \definetypeface [cambria-x] [rm] [serif] [cambria] [default]
- \definetypeface [cambria-x] [tt] [mono] [modern] [default]
- \definetypeface [cambria-x] [mm] [math] [cambria-x] [default]
-\stoptypescript
-
-\starttypescript [cambria-y]
- \definetypeface [cambria-y] [rm] [serif] [cambria] [default]
- \definetypeface [cambria-y] [tt] [mono] [modern] [default]
- \definetypeface [cambria-y] [mm] [math] [cambria-y] [default]
+\starttypescript [cambria-x,cambria-y]
+ % test x
+ \definetypeface [cambria-x] [rm] [serif] [cambria] [default]
+ \definetypeface [cambria-x] [tt] [mono] [modern] [default]
+ \definetypeface [cambria-x] [mm] [math] [\typescriptone] [default]
\stoptypescript
% math times
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index 6c9a341dc..d49fcadf4 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 : 10/21/09 10:32:02
+-- merge date : 10/22/09 23:31:21
do -- begin closure to overcome local limits and interference
@@ -2501,7 +2501,7 @@ function nodes.set_pair(current,factor,rlmode,r2lflag,spec,tfmchr)
else
bound = #kerns + 1
set_attribute(current,kernpair,bound)
- kerns[bound] = { rlmode, x, y, w, h, r2lflag }
+ kerns[bound] = { rlmode, x, y, w, h, r2lflag, tfmchr.width }
end
return x, y, w, h, bound
end
@@ -2768,24 +2768,23 @@ function nodes.inject_kerns(head,where,keep)
-- only w can be nil, can be sped up when w == nil
local rl, x, w, r2l = k[1], k[2] or 0, k[4] or 0, k[6]
local wx = w - x
--- we can probably listen to only one of them i.e. ignore rl here
- if rl < 0 then
- if r2l then
- if wx ~= 0 then
- insert_node_before(head,n,newkern(wx))
- end
- if x ~= 0 then
- insert_node_after (head,n,newkern(x))
- end
- else
- if x ~= 0 then
- insert_node_before(head,n,newkern(x))
- end
- if wx ~= 0 then
- insert_node_after(head,n,newkern(wx))
- end
- end
- else
+--~ if rl < 0 then
+--~ if r2l then
+--~ if wx ~= 0 then
+--~ insert_node_before(head,n,newkern(wx))
+--~ end
+--~ if x ~= 0 then
+--~ insert_node_after (head,n,newkern(x))
+--~ end
+--~ else
+--~ if x ~= 0 then
+--~ insert_node_before(head,n,newkern(x))
+--~ end
+--~ if wx ~= 0 then
+--~ insert_node_after(head,n,newkern(wx))
+--~ end
+--~ end
+--~ else
if r2l then
if wx ~= 0 then
insert_node_before(head,n,newkern(wx))
@@ -2801,7 +2800,7 @@ function nodes.inject_kerns(head,where,keep)
insert_node_after(head,n,newkern(wx))
end
end
- end
+--~ end
end
end
if next(cx) then
@@ -2827,61 +2826,61 @@ function nodes.inject_kerns(head,where,keep)
if trace_injections then
nodes.trace_injection(head)
end
- for n in traverse_id(glyph,head) do
- local k = has_attribute(n,kernpair)
- if k then
- local kk = kerns[k]
- if kk then
- local rl, x, y, w = kk[1], kk[2] or 0, kk[3], kk[4]
- if y and y ~= 0 then
- n.yoffset = y -- todo: h ?
- end
- if w then
- -- copied from above
- local r2l = kk[6]
- local wx = w - x
- if rl < 0 then
- if r2l then
- if wx ~= 0 then
- insert_node_before(head,n,newkern(wx))
- end
- if x ~= 0 then
- insert_node_after (head,n,newkern(x))
- end
- else
- if x ~= 0 then
- insert_node_before(head,n,newkern(x))
- end
- if wx ~= 0 then
- insert_node_after(head,n,newkern(wx))
- end
+ for n in traverse_id(glyph,head) do
+ local k = has_attribute(n,kernpair)
+ if k then
+ local kk = kerns[k]
+ if kk then
+ local rl, x, y, w = kk[1], kk[2] or 0, kk[3], kk[4]
+ if y and y ~= 0 then
+ n.yoffset = y -- todo: h ?
+ end
+ if w then
+ -- copied from above
+ local r2l = kk[6]
+ local wx = w - x
+--~ if rl < 0 then
+--~ if r2l then
+--~ if x ~= 0 then
+--~ insert_node_before(head,n,newkern(x))
+--~ end
+--~ if wx ~= 0 then
+--~ insert_node_after(head,n,newkern(wx))
+--~ end
+--~ else
+--~ if wx ~= 0 then
+--~ insert_node_before(head,n,newkern(wx))
+--~ end
+--~ if x ~= 0 then
+--~ insert_node_after (head,n,newkern(x))
+--~ end
+--~ end
+--~ else
+ if r2l then
+ if wx ~= 0 then
+ insert_node_before(head,n,newkern(wx))
+ end
+ if x ~= 0 then
+ insert_node_after (head,n,newkern(x))
end
else
- if r2l then
- if wx ~= 0 then
- insert_node_before(head,n,newkern(wx))
- end
- if x ~= 0 then
- insert_node_after (head,n,newkern(x))
- end
- else
- if x ~= 0 then
- insert_node_before(head,n,newkern(x))
- end
- if wx ~= 0 then
- insert_node_after(head,n,newkern(wx))
- end
+ if x ~= 0 then
+ insert_node_before(head,n,newkern(x))
+ end
+ if wx ~= 0 then
+ insert_node_after(head,n,newkern(wx))
end
end
- else
- -- simple (e.g. kernclass kerns)
- if x ~= 0 then
- insert_node_before(head,n,newkern(x))
- end
+--~ end
+ else
+ -- simple (e.g. kernclass kerns)
+ if x ~= 0 then
+ insert_node_before(head,n,newkern(x))
end
end
end
end
+ end
if not keep then
kerns = { }
end
@@ -5277,7 +5276,7 @@ otf.features.default = otf.features.default or { }
otf.enhancers = otf.enhancers or { }
otf.glists = { "gsub", "gpos" }
-otf.version = 2.633 -- beware: also sync font-mis.lua
+otf.version = 2.635 -- beware: also sync font-mis.lua
otf.pack = true -- beware: also sync font-mis.lua
otf.syncspace = true
otf.notdef = false
@@ -5299,6 +5298,7 @@ otf.tables.global_fields = table.tohash {
"names",
"unicodes",
"names",
+--~ "math",
"anchor_classes",
"kern_classes",
"gpos",
@@ -5423,7 +5423,7 @@ function otf.load(filename,format,sub,featurefile)
local data = containers.read(otf.cache(), hash)
local size = lfs.attributes(filename,"size") or 0
if not data or data.verbose ~= fonts.verbose or data.size ~= size then
- logs.report("load otf","loading: %s",filename)
+ logs.report("load otf","loading: %s (hash: %s)",filename,hash)
local ff, messages
if sub then
ff, messages = fontloader.open(filename,sub)
@@ -5722,7 +5722,7 @@ otf.enhancers["analyse unicodes"] = function(data,filename)
end
-- cidmap heuristics, beware, there is no guarantee for a match unless
-- the chain resolves
- if not unicode and usedmap then
+ if (not unicode) and usedmap then
local foundindex = oparser:match(name)
if foundindex then
unicode = cidcodes[foundindex] -- name to number
@@ -5766,21 +5766,20 @@ otf.enhancers["analyse unicodes"] = function(data,filename)
originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1
end
else
- local done = true
+ local t = { }
for l=1,nplit do
local base = split[l]
local u = unicodes[base] or (agl and agl[base])
if not u then
- done = false
break
elseif type(u) == "table" then
- split[l] = u[1]
+ t[#t+1] = u[1]
else
- split[l] = u
+ t[#t+1] = u
end
end
- if done then
- originals[index], tounicode[index], nl, unicode = split, tounicode16sequence(split), nl + 1, true
+ if #t > 0 then -- done then
+ originals[index], tounicode[index], nl, unicode = t, tounicode16sequence(t), nl + 1, true
end
end
end
@@ -5974,7 +5973,7 @@ otf.enhancers["prepare unicode"] = function(data,filename)
end
end
end
- -- beware: the indeces table is used to initialize the tfm table
+ -- beware: the indices table is used to initialize the tfm table
for unicode, index in next, mapmap do
if not internals[index] then
local name = glyphs[index].name
@@ -10417,7 +10416,9 @@ function otf.name_to_slot(name) -- todo: afm en tfm
if tfmdata and tfmdata.shared then
local otfdata = tfmdata.shared.otfdata
local unicode = otfdata.luatex.unicodes[name]
- if type(unicode) == "number" then
+ if not unicode then
+ return string.byte("?") -- nil
+ elseif type(unicode) == "number" then
return unicode
else
return unicode[1]
@@ -10519,18 +10520,22 @@ and prepares a table that will move along as we proceed.</p>
local splitter, specifiers = nil, ""
+local P, C, S, Cc = lpeg.P, lpeg.C, lpeg.S, lpeg.Cc
+
+local left = P("(")
+local right = P(")")
+local colon = P(":")
+local space = P(" ")
+
function define.add_specifier(symbol)
specifiers = specifiers .. symbol
- local left = lpeg.P("(")
- local right = lpeg.P(")")
- local colon = lpeg.P(":")
- local method = lpeg.S(specifiers)
- local lookup = lpeg.C(lpeg.P("file")+lpeg.P("name")) * colon -- hard test, else problems with : method
- local sub = left * lpeg.C(lpeg.P(1-left-right-method)^1) * right
---~ local specification = lpeg.C(method) * lpeg.C(lpeg.P(1-method)^1)
- local specification = lpeg.C(method) * lpeg.C(lpeg.P(1)^1)
- local name = lpeg.C((1-sub-specification)^1)
- splitter = lpeg.P((lookup + lpeg.Cc("")) * name * (sub + lpeg.Cc("")) * (specification + lpeg.Cc("")))
+ local method = S(specifiers)
+ local lookup = C(P("file")+P("name")) * colon -- hard test, else problems with : method
+ local sub = left * C(P(1-left-right-method)^1) * right
+--~ local specification = C(method) * C(P(1-method)^1)
+ local specification = C(method) * C(P(1)^1)
+ local name = C((1-sub-specification)^1)
+ splitter = P((lookup + Cc("")) * name * (sub + Cc("")) * (specification + Cc("")))
end
function define.get_specification(str)
@@ -10574,7 +10579,7 @@ end
function define.analyze(specification, size)
-- can be optimized with locals
local lookup, name, sub, method, detail = define.get_specification(specification or "")
- return define.makespecification(specification,lookup, name, sub, method, detail, size)
+ return define.makespecification(specification, lookup, name, sub, method, detail, size)
end
--[[ldx--
@@ -10850,16 +10855,22 @@ function readers.afm(specification,method)
return tfmtable
end
-local function check_otf(specification,suffix,what)
- local fullname, tfmtable = resolvers.findbinfile(specification.name,suffix) or "", nil
+-- maybe some day a set of names
+
+local function check_otf(forced,specification,suffix,what)
+ local name = specification.name
+ if forced then
+ name = file.addsuffix(name,suffix)
+ end
+ local fullname, tfmtable = resolvers.findbinfile(name,suffix) or "", nil -- one shot
if fullname == "" then
- local fb = fonts.names.old_to_new[specification.name]
+ local fb = fonts.names.old_to_new[name]
if fb then
fullname = resolvers.findbinfile(fb,suffix) or ""
end
end
if fullname == "" then
- local fb = fonts.names.new_to_old[specification.name]
+ local fb = fonts.names.new_to_old[name]
if fb then
fullname = resolvers.findbinfile(fb,suffix) or ""
end
@@ -10874,13 +10885,11 @@ end
function readers.opentype(specification,suffix,what)
local forced = specification.forced or ""
if forced == "otf" then
- return check_otf(specification,forced,"opentype")
- elseif forced == "ttf" then
- return check_otf(specification,forced,"truetype")
- elseif forced == "ttf" then
- return check_otf(specification,forced,"truetype")
+ return check_otf(true,specification,forced,"opentype")
+ elseif forced == "ttf" or forced == "ttc" or forced == "dfont" then
+ return check_otf(true,specification,forced,"truetype")
else
- return check_otf(specification,suffix,what)
+ return check_otf(false,specification,suffix,what)
end
end