diff options
author | Marius <mariausol@gmail.com> | 2013-04-28 00:00:18 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2013-04-28 00:00:18 +0300 |
commit | 7b94bc10110c2642e10f1951d3b161e204829a1c (patch) | |
tree | 4c196d16fa77b010198d54185ee280382249cf83 /tex/generic | |
parent | b2d6e3f2d74984616ec498cf03500f608eea37aa (diff) | |
download | context-7b94bc10110c2642e10f1951d3b161e204829a1c.tar.gz |
beta 2013.04.27 22:36
Diffstat (limited to 'tex/generic')
-rw-r--r-- | tex/generic/context/luatex/luatex-basics-gen.lua | 1 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 41 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-syn.lua | 43 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-test.tex | 2 |
4 files changed, 60 insertions, 27 deletions
diff --git a/tex/generic/context/luatex/luatex-basics-gen.lua b/tex/generic/context/luatex/luatex-basics-gen.lua index 61f3910eb..590b538fa 100644 --- a/tex/generic/context/luatex/luatex-basics-gen.lua +++ b/tex/generic/context/luatex/luatex-basics-gen.lua @@ -205,7 +205,6 @@ end local function makefullname(path,name) if path and path ~= "" then - name = "temp-" .. name -- clash prevention return file.addsuffix(file.join(path,name),"lua"), file.addsuffix(file.join(path,name),usingjit and "lub" or "luc") end end diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 0cf2ce466..63f1381ae 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 04/26/13 15:13:48 +-- merge date : 04/27/13 22:36:05 do -- begin closure to overcome local limits and interference @@ -3039,7 +3039,6 @@ function caches.getreadablepaths(category,subcategory) end local function makefullname(path,name) if path and path~="" then - name="temp-"..name return file.addsuffix(file.join(path,name),"lua"),file.addsuffix(file.join(path,name),usingjit and "lub" or "luc") end end @@ -4829,22 +4828,35 @@ end local fonts=fonts fonts.names=fonts.names or {} fonts.names.version=1.001 -fonts.names.basename="luatex-fonts-names.lua" +fonts.names.basename="luatex-fonts-names" fonts.names.new_to_old={} fonts.names.old_to_new={} +fonts.names.cache=containers.define("fonts","data",fonts.names.version,true) local data,loaded=nil,false local fileformats={ "lua","tex","other text files" } +function fonts.names.reportmissingbase() + texio.write("<missing font database, run: mtxrun --script fonts --reload --simple>") + fonts.names.reportmissingbase=nil +end +function fonts.names.reportmissingname() + texio.write("<unknown font in database, run: mtxrun --script fonts --reload --simple>") + fonts.names.reportmissingname=nil +end function fonts.names.resolve(name,sub) if not loaded then local basename=fonts.names.basename if basename and basename~="" then - for i=1,#fileformats do - local format=fileformats[i] - local foundname=resolvers.findfile(basename,format) or "" - if foundname~="" then - data=dofile(foundname) - texio.write("<font database loaded: ",foundname,">") - break + data=containers.read(fonts.names.cache,basename) + if not data then + basename=file.addsuffix(basename,"lua") + for i=1,#fileformats do + local format=fileformats[i] + local foundname=resolvers.findfile(basename,format) or "" + if foundname~="" then + data=dofile(foundname) + texio.write("<font database loaded: ",foundname,">") + break + end end end end @@ -4860,9 +4872,12 @@ function fonts.names.resolve(name,sub) else return filename,false end - else + elseif fonts.names.reportmissingname then + fonts.names.reportmissingname() return name,false end + elseif fonts.names.reportmissingbase then + fonts.names.reportmissingbase() end end fonts.names.resolvespec=fonts.names.resolve @@ -7713,7 +7728,7 @@ function injections.handler(head,where,keep) if rlmode and rlmode>=0 then n.xoffset=p.xoffset-p.width+d[1] else - n.xoffset=p.xoffset-d[1]-x + n.xoffset=p.xoffset-d[1]-x end end else @@ -10054,6 +10069,8 @@ for s=1,#datasets do if ok then success=true break + elseif not start then + break end end else diff --git a/tex/generic/context/luatex/luatex-fonts-syn.lua b/tex/generic/context/luatex/luatex-fonts-syn.lua index 36a74d0f4..ea6e3cab5 100644 --- a/tex/generic/context/luatex/luatex-fonts-syn.lua +++ b/tex/generic/context/luatex/luatex-fonts-syn.lua @@ -23,8 +23,9 @@ end -- The format of the file is as follows: -- -- return { --- ["version"] = 1.001, --- ["mappings"] = { +-- ["version"] = 1.001, +-- ["cache_version"] = 1.001, +-- ["mappings"] = { -- ["somettcfontone"] = { "Some TTC Font One", "SomeFontA.ttc", 1 }, -- ["somettcfonttwo"] = { "Some TTC Font Two", "SomeFontA.ttc", 2 }, -- ["somettffont"] = { "Some TTF Font", "SomeFontB.ttf" }, @@ -35,26 +36,41 @@ end local fonts = fonts fonts.names = fonts.names or { } -fonts.names.version = 1.001 -- not the same as in context -fonts.names.basename = "luatex-fonts-names.lua" +fonts.names.version = 1.001 -- not the same as in context but matches mtx-fonts --simple +fonts.names.basename = "luatex-fonts-names" fonts.names.new_to_old = { } fonts.names.old_to_new = { } +fonts.names.cache = containers.define("fonts","data",fonts.names.version,true) local data, loaded = nil, false local fileformats = { "lua", "tex", "other text files" } +function fonts.names.reportmissingbase() + texio.write("<missing font database, run: mtxrun --script fonts --reload --simple>") + fonts.names.reportmissingbase = nil +end + +function fonts.names.reportmissingname() + texio.write("<unknown font in database, run: mtxrun --script fonts --reload --simple>") + fonts.names.reportmissingname = nil +end + function fonts.names.resolve(name,sub) if not loaded then local basename = fonts.names.basename if basename and basename ~= "" then - for i=1,#fileformats do - local format = fileformats[i] - local foundname = resolvers.findfile(basename,format) or "" - if foundname ~= "" then - data = dofile(foundname) - texio.write("<font database loaded: ",foundname,">") - break + data = containers.read(fonts.names.cache,basename) + if not data then + basename = file.addsuffix(basename,"lua") + for i=1,#fileformats do + local format = fileformats[i] + local foundname = resolvers.findfile(basename,format) or "" + if foundname ~= "" then + data = dofile(foundname) + texio.write("<font database loaded: ",foundname,">") + break + end end end end @@ -70,9 +86,12 @@ function fonts.names.resolve(name,sub) else return filename, false end - else + elseif fonts.names.reportmissingname then + fonts.names.reportmissingname() return name, false -- fallback to filename end + elseif fonts.names.reportmissingbase then + fonts.names.reportmissingbase() end end diff --git a/tex/generic/context/luatex/luatex-test.tex b/tex/generic/context/luatex/luatex-test.tex index f757445d5..e11106e20 100644 --- a/tex/generic/context/luatex/luatex-test.tex +++ b/tex/generic/context/luatex/luatex-test.tex @@ -19,8 +19,6 @@ \pdfoutput=1 -% \directlua{generic_context.caches.compilemethod = "both" } % none luac dump both - \font\testa=file:lmroman10-regular at 12pt \testa \input tufte \par \font\testb=file:lmroman12-regular:+liga; at 24pt \testb effe flink fietsen \par \font\testc=file:lmroman12-regular:mode=node;+liga; at 24pt \testc effe flink fietsen \par |