diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.tex | 2 | ||||
-rw-r--r-- | tex/context/base/context.tex | 2 | ||||
-rw-r--r-- | tex/context/base/core-ctx.lua | 6 | ||||
-rw-r--r-- | tex/context/base/grph-inc.lua | 78 | ||||
-rw-r--r-- | tex/context/base/l-file.lua | 18 | ||||
-rw-r--r-- | tex/context/base/l-os.lua | 15 | ||||
-rw-r--r-- | tex/context/base/trac-lmx.lua | 1 | ||||
-rw-r--r-- | tex/context/base/type-otf.mkiv | 16 | ||||
-rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 22 |
9 files changed, 114 insertions, 46 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 15542b66c..871233559 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.02.03 23:06} +\newcontextversion{2010.02.08 19:42} %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 ac06bfa14..122df5fdd 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.02.03 23:06} +\edef\contextversion{2010.02.08 19:42} %D For those who want to use this: diff --git a/tex/context/base/core-ctx.lua b/tex/context/base/core-ctx.lua index 816c8ff57..1dad7c2d7 100644 --- a/tex/context/base/core-ctx.lua +++ b/tex/context/base/core-ctx.lua @@ -73,7 +73,7 @@ local processfile = commands.processfile local doifinputfileelse = commands.doifinputfileelse function commands.processfile(name,maxreadlevel) -- overloaded - local prepname = found and resolve(name) + local prepname = resolve(name) if prepname then return processfile(prepname,0) end @@ -81,7 +81,7 @@ function commands.processfile(name,maxreadlevel) -- overloaded end function commands.doifinputfileelse(name,depth) - local prepname = found and resolve(name) + local prepname = resolve(name) if prepname then return doifinputfileelse(prepname,0) end @@ -89,5 +89,5 @@ function commands.doifinputfileelse(name,depth) end function commands.preparedfile(name) - return (found and resolve(name)) or name + return resolve(name) or name end diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index 352f071f7..b90a938bb 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -38,12 +38,14 @@ run TeX code from within Lua. Some more functionality will move to Lua. local format, lower, find, match, gsub, gmatch = string.format, string.lower, string.find, string.match, string.gsub, string.gmatch local texsprint, texbox, texwd, texht, texdp = tex.sprint, tex.box, tex.wd, tex.ht, tex.dp local contains = table.contains +local concat = table.concat local ctxcatcodes = tex.ctxcatcodes local variables = interfaces.variables -local trace_figures = false trackers.register("figures.locating",function(v) trace_figures = v end) -local trace_bases = false trackers.register("figures.bases", function(v) trace_bases = v end) +local trace_figures = false trackers.register("figures.locating", function(v) trace_figures = v end) +local trace_bases = false trackers.register("figures.bases", function(v) trace_bases = v end) +local trace_programs = false trackers.register("figures.programs", function(v) trace_programs = v end) --- some extra img functions --- @@ -198,7 +200,7 @@ function figures.setpaths(locationset,pathlist) figures.paths, last_pathlist = t, pathlist if trace_figures then commands.writestatus("figures","locations: %s",last_locationset) - commands.writestatus("figures","path list: %s",table.concat(figures.paths, " ")) + commands.writestatus("figures","path list: %s",concat(figures.paths, " ")) end end @@ -562,6 +564,7 @@ figures.checkers = figures.checkers or { } figures.includers = figures.includers or { } figures.converters = figures.converters or { } figures.identifiers = figures.identifiers or { } +figures.programs = figures.programs or { } figures.identifiers.list = { figures.identifiers.default @@ -796,25 +799,70 @@ function figures.checkers.tex(data) end figures.includers.tex = figures.includers.nongeneric +-- -- -- converters -- -- -- + +local function makeoptions(program) + local to = type(options) + return (to == "table" and concat(options," ")) or (to == "string" and options) or "" +end + +local function runprogram(...) + local command = format(...) + if trace_programs then + logs.report("figures","running %s",command) + end + os.spawn(command) +end + -- -- -- eps -- -- -- +figures.programs.gs = { + options = { + "-dAutoRotatePages=/None", + "-dPDFSETTINGS=/prepress", + "-dEPSCrop", + }, + command = (os.type == "windows" and "gswin32") or "gs" +} + function figures.converters.eps(oldname,newname) - -- hack, we need a lua based converter script, or better, we should use - -- rlx as alternative - local outputpath = file.dirname(newname) - local outputbase = file.basename(newname) - if outputpath == "" then outputpath = "." end - local command = format("mtxrun bin:pstopdf --outputpath=%s %s",outputpath,oldname) - os.spawn(command) + local gs = figures.programs.gs + runprogram ( + '%s -q -sDEVICE=pdfwrite -dNOPAUSE -dNOCACHE -dBATCH %s -sOutputFile="%s" "%s" -c quit', + gs.command, makeoptions(gs.options), newname, oldname + ) end -figures.converters.svg = figures.converters.eps +-- -- -- svg -- -- -- + +figures.programs.inkscape = { + command = "inkscape" +} + +function figures.converters.svg(oldname,newname) + -- inkscape on windows only works with complete paths + local inkscape = figures.programs.inkscape + oldname, newname = dir.expand_name(oldname), dir.expand_name(newname) + runprogram ( + '%s "%s" --export-pdf="%s" %s', + inkscape.command, oldname, newname, makeoptions(inkscape.options) + ) +end + +figures.converters.svgz = figures.converters.svg + +-- -- -- gif -- -- -- + +figures.programs.convert = { + command = "convert" -- imagemagick +} function figures.converters.gif(oldname,newname) - -- hack, we need a lua based converter script, or better, we should use - -- rlx as alternative - local command = format("mtxrun bin:convert %s %s",oldname,newname) - os.spawn(command) + local convert = figures.programs.convert + runprogram ( + "convert %s %s", + convert.command, makeoptions(convert.options), oldname, newname + ) end -- -- -- lowres -- -- -- diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua index c95ef658c..87ae6e7fe 100644 --- a/tex/context/base/l-file.lua +++ b/tex/context/base/l-file.lua @@ -107,15 +107,17 @@ function file.join_path(tab) end function file.collapse_path(str) - str = gsub(str,"/%./","/") - local n, m = 1, 1 - while n > 0 or m > 0 do - str, n = gsub(str,"[^/%.]+/%.%.$","") - str, m = gsub(str,"[^/%.]+/%.%./","") + if find(str,"/") then + str = gsub(str,"/%./","/") + local n, m = 1, 1 + while n > 0 or m > 0 do + str, n = gsub(str,"[^/%.]+/%.%.$","") + str, m = gsub(str,"[^/%.]+/%.%./","") + end + str = gsub(str,"([^/])/$","%1") + str = gsub(str,"^%./","") + str = gsub(str,"/%.$","") end - str = gsub(str,"([^/])/$","%1") - str = gsub(str,"^%./","") - str = gsub(str,"/%.$","") if str == "" then str = "." end return str end diff --git a/tex/context/base/l-os.lua b/tex/context/base/l-os.lua index d94c5b13a..7dd288877 100644 --- a/tex/context/base/l-os.lua +++ b/tex/context/base/l-os.lua @@ -231,6 +231,21 @@ elseif name == "freebsd" then return platform end +elseif name == "kfreebsd" then + + function os.resolvers.platform(t,k) + -- we sometims have HOSTTYPE set so let's check that first + local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" + if find(architecture,"x86_64") then + platform = "kfreebsd-64" + else + platform = "kfreebsd-i386" + end + os.setenv("MTX_PLATFORM",platform) + os.platform = platform + return platform + end + else -- platform = "linux" diff --git a/tex/context/base/trac-lmx.lua b/tex/context/base/trac-lmx.lua index 1ea4443cb..664815c66 100644 --- a/tex/context/base/trac-lmx.lua +++ b/tex/context/base/trac-lmx.lua @@ -118,6 +118,7 @@ local cache = { } local trace = false function lmx.new(data,variables) + data = data or "" local known = cache[data] if not known then local definitions = { } diff --git a/tex/context/base/type-otf.mkiv b/tex/context/base/type-otf.mkiv index 3779abe5f..c862701e7 100644 --- a/tex/context/base/type-otf.mkiv +++ b/tex/context/base/type-otf.mkiv @@ -419,9 +419,9 @@ % Whatever else we need: \starttypescript - \definefontsynonym [ZapfDingbats] [uzdr] - \definefontsynonym [RalfSmithFormalScript] [rsfs10] - \definefontsynonym [MartinVogel] [fmvr8x] + \definefontsynonym [ZapfDingbats] [uzdr] + \definefontsynonym [RalfSmithFormalScript] [rsfs10] + \definefontsynonym [MartinVogel] [fmvr8x] \stoptypescript % Temp here @@ -486,11 +486,11 @@ \stoptypescript \starttypescript[asana] - \definetypeface [\typescriptone] [rm] [serif] [palatino] [default] - \definetypeface [\typescriptone] [ss] [sans] [modern] [default] [rscale=1.075] - \definetypeface [\typescriptone] [tt] [mono] [modern] [default] [rscale=1.075] - \definetypeface [\typescriptone] [mm] [math] [\typescriptone] [default] - \quittypescriptscanning + \definetypeface [\typescriptone] [rm] [serif] [palatino] [default] + \definetypeface [\typescriptone] [ss] [sans] [modern] [default] [rscale=1.075] + \definetypeface [\typescriptone] [tt] [mono] [modern] [default] [rscale=1.075] + \definetypeface [\typescriptone] [mm] [math] [\typescriptone] [default] + \quittypescriptscanning \stoptypescript \stoptypescriptcollection diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index b6e57ed2a..69446a8e6 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 : 02/02/10 23:13:26 +-- merge date : 02/08/10 19:47:32 do -- begin closure to overcome local limits and interference @@ -1543,15 +1543,17 @@ function file.join_path(tab) end function file.collapse_path(str) - str = gsub(str,"/%./","/") - local n, m = 1, 1 - while n > 0 or m > 0 do - str, n = gsub(str,"[^/%.]+/%.%.$","") - str, m = gsub(str,"[^/%.]+/%.%./","") - end - str = gsub(str,"([^/])/$","%1") - str = gsub(str,"^%./","") - str = gsub(str,"/%.$","") + if find(str,"/") then + str = gsub(str,"/%./","/") + local n, m = 1, 1 + while n > 0 or m > 0 do + str, n = gsub(str,"[^/%.]+/%.%.$","") + str, m = gsub(str,"[^/%.]+/%.%./","") + end + str = gsub(str,"([^/])/$","%1") + str = gsub(str,"^%./","") + str = gsub(str,"/%.$","") + end if str == "" then str = "." end return str end |