summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--otfl-fonts-merged.lua38
-rw-r--r--otfl-fonts.lua24
2 files changed, 22 insertions, 40 deletions
diff --git a/otfl-fonts-merged.lua b/otfl-fonts-merged.lua
index e095153..314305a 100644
--- a/otfl-fonts-merged.lua
+++ b/otfl-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 04/17/13 18:36:10
+-- merge date : 04/20/13 13:33:53
do -- begin closure to overcome local limits and interference
@@ -1401,7 +1401,7 @@ function table.tofile(filename,root,name,specification)
io.flush()
end
end
-local function flattened(t,f,depth)
+local function flattened(t,f,depth)
if f==nil then
f={}
depth=0xFFFF
@@ -1416,19 +1416,16 @@ local function flattened(t,f,depth)
if depth>0 and type(v)=="table" then
flattened(v,f,depth-1)
else
- f[k]=v
+ f[#f+1]=v
end
end
end
- local n=#f
for k=1,#t do
local v=t[k]
if depth>0 and type(v)=="table" then
flattened(v,f,depth-1)
- n=#f
else
- n=n+1
- f[n]=v
+ f[#f+1]=v
end
end
return f
@@ -2926,7 +2923,7 @@ storage={
register=dummyfunction,
shared={},
}
-logs=logs or {
+logs={
new=dummyreporter,
reporter=dummyreporter,
messenger=dummyreporter,
@@ -2988,7 +2985,7 @@ end
do
local cachepaths=kpse.expand_path('$TEXMFCACHE') or ""
if cachepaths=="" then
- cachepaths=kpse.expand_path('$TEXMFVAR') or ""
+ cachepaths=kpse.expand_path('$TEXMFVAR')
end
if cachepaths=="" then
cachepaths=kpse.expand_path('$VARTEXMF')
@@ -10379,6 +10376,7 @@ local variants=allocate()
specifiers.variants=variants
definers.methods=definers.methods or {}
local internalized=allocate()
+local lastdefined=nil
local loadedfonts=constructors.loadedfonts
local designsizes=constructors.designsizes
local resolvefile=fontgoodies and fontgoodies.filenames and fontgoodies.filenames.resolve or function(s) return s end
@@ -10579,18 +10577,7 @@ function definers.loadfont(specification)
end
return tfmdata
end
-local function checkvirtual(tfmdata)
- local fonts=tfmdata.fonts
- local selfid=font.nextid()
- if fonts and #fonts>0 then
- for i=1,#fonts do
- if fonts[i][2]==0 then
- fonts[i][2]=selfid
- end
- end
- else
- tfmdata.fonts={ "id",selfid }
- end
+function constructors.checkvirtualids()
end
function constructors.readanddefine(name,size)
local specification=definers.analyze(name,size)
@@ -10604,7 +10591,8 @@ function constructors.readanddefine(name,size)
if not id then
local tfmdata=definers.loadfont(specification)
if tfmdata then
- checkvirtual(tfmdata)
+ tfmdata.properties.hash=hash
+ constructors.checkvirtualids(tfmdata)
id=font.define(tfmdata)
definers.register(tfmdata,id)
else
@@ -10613,8 +10601,6 @@ function constructors.readanddefine(name,size)
end
return fontdata[id],id
end
-local lastdefined=nil
-local internalized={}
function definers.current()
return lastdefined
end
@@ -10625,7 +10611,9 @@ end
function definers.register(tfmdata,id)
if tfmdata and id then
local hash=tfmdata.properties.hash
- if not internalized[hash] then
+ if not hash then
+ report_defining("registering font, id %a, name %a, invalid hash",id,tfmdata.properties.filename or "?")
+ elseif not internalized[hash] then
internalized[hash]=id
if trace_defining then
report_defining("registering font, id %s, hash %a",id,hash)
diff --git a/otfl-fonts.lua b/otfl-fonts.lua
index 7e32465..96f3501 100644
--- a/otfl-fonts.lua
+++ b/otfl-fonts.lua
@@ -16,6 +16,10 @@ if not modules then modules = { } end modules ['luatex-fonts'] = {
-- places where in context other code is plugged in, but this does not affect the core code. Users
-- can (given that their macro package provides this option) access the font data (characters,
-- descriptions, properties, parameters, etc) of this main table.
+--
+-- Future versions will probably have some more specific context code removed, like tracing and
+-- obscure hooks, so that we have a more efficient version (and less files too). So, don't depend
+-- too much on low level code that is meant for context as it can change without notice.
utf = utf or unicode.utf8
@@ -37,12 +41,10 @@ if not generic_context then
generic_context = { }
end
-local printinfo = function(s) texio.write_nl("log", s) end
-
if not generic_context.push_namespaces then
function generic_context.push_namespaces()
- printinfo(" <push namespace>")
+ texio.write(" <push namespace>")
local normalglobal = { }
for k, v in next, _G do
normalglobal[k] = v
@@ -52,7 +54,7 @@ if not generic_context.push_namespaces then
function generic_context.pop_namespaces(normalglobal,isolate)
if normalglobal then
- printinfo(" <pop namespace>")
+ texio.write(" <pop namespace>")
for k, v in next, _G do
if not normalglobal[k] then
generic_context[k] = v
@@ -112,7 +114,7 @@ local function loadmodule(name,continue)
end
else
if verbose then
- printinfo(string.format(" <%s>",foundname)) -- no file.basename yet
+ texio.write(string.format(" <%s>",foundname)) -- no file.basename yet
end
dofile(foundname)
end
@@ -158,19 +160,11 @@ if non_generic_context.luatex_fonts.skip_loading ~= true then
loadmodule("l-string.lua")
loadmodule("l-table.lua")
loadmodule("l-io.lua")
- ----------("l-number.lua")
- ----------("l-set.lua")
- ----------("l-os.lua")
loadmodule("l-file.lua")
- ----------("l-md5.lua")
- ----------("l-url.lua")
- ----------("l-dir.lua")
loadmodule("l-boolean.lua")
- ----------("l-unicode.lua")
loadmodule("l-math.lua")
loadmodule("util-str.lua")
-
-- The following modules contain code that is either not used at all outside context or will fail
-- when enabled due to lack of other modules.
@@ -192,7 +186,7 @@ if non_generic_context.luatex_fonts.skip_loading ~= true then
-- with context. The mtx-fonts script can be used to genate this file (using the --names option).
-- in 2013/14 we will merge/move some generic files into luatex-fonts-* files (copies) so that
- -- intermediate updates of context not interfere
+ -- intermediate updates of context not interfere; we can then also use the general merger
loadmodule('font-ini.lua')
loadmodule('font-con.lua')
@@ -254,6 +248,6 @@ end
-- We're done.
---texio.write(string.format(" <luatex-fonts.lua loaded in %0.3f seconds>", os.gettimeofday()-starttime))
+texio.write(string.format(" <luatex-fonts.lua loaded in %0.3f seconds>", os.gettimeofday()-starttime))
generic_context.pop_namespaces(whatever)