diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-context.lua | 6 | ||||
-rw-r--r-- | scripts/context/lua/mtx-context.xml | 5 | ||||
-rw-r--r-- | scripts/context/lua/mtx-fonts.lua | 83 | ||||
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 10 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 10 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 10 | ||||
-rw-r--r-- | scripts/context/stubs/win64/mtxrun.lua | 10 |
7 files changed, 97 insertions, 37 deletions
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index d624f6831..0837a1b50 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -34,7 +34,7 @@ local formatters = string.formatters local application = logs.application { name = "mtx-context", - banner = "ConTeXt Process Management 0.61", + banner = "ConTeXt Process Management 0.62", -- helpinfo = helpinfo, -- table with { category_a = text_1, category_b = text_2 } or helpstring or xml_blob helpinfo = "mtx-context.xml", } @@ -173,7 +173,7 @@ end function ctxrunner.checkfile(ctxdata,ctxname,defaultname) - if not ctxdata.jobname or ctxdata.jobname == "" then + if not ctxdata.jobname or ctxdata.jobname == "" or getargument("noctx") then return end @@ -1600,7 +1600,7 @@ elseif getargument("make") then scripts.context.timed(function() scripts.context.make() end) elseif getargument("generate") then scripts.context.timed(function() scripts.context.generate() end) -elseif getargument("ctx") then +elseif getargument("ctx") and not getargument("noctx") then scripts.context.timed(scripts.context.ctx) -- elseif getargument("mp") or getargument("metapost") then -- scripts.context.timed(scripts.context.metapost) diff --git a/scripts/context/lua/mtx-context.xml b/scripts/context/lua/mtx-context.xml index c41093289..46e586153 100644 --- a/scripts/context/lua/mtx-context.xml +++ b/scripts/context/lua/mtx-context.xml @@ -4,7 +4,7 @@ <metadata> <entry name="name">mtx-context</entry> <entry name="detail">ConTeXt Process Management</entry> - <entry name="version">0.60</entry> + <entry name="version">0.62</entry> <entry name="comment">external helpinfo file</entry> </metadata> <flags> @@ -21,6 +21,9 @@ <flag name="ctx=name"> <short>use ctx file (process management specification)</short> </flag> + <flag name="noctx"> + <short>ignore ctx directives and flags</short> + </flag> <flag name="interface"> <short>use specified user interface (default: en)</short> </flag> diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index dde145e50..db2f06120 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -23,7 +23,8 @@ local helpinfo = [[ <flags> <category name="basic"> <subcategory> - <flag name="save"><short>save open type font in raw table</short></flag> + <flag name="save"><short>save open type font in raw table (ff format)</short></flag> + <flag name="convert"><short>save open type font in raw table (ctx format)</short></flag> <flag name="unpack"><short>save a tma file in a more readable format</short></flag> </subcategory> <subcategory> @@ -42,6 +43,7 @@ local helpinfo = [[ <flag name="info"><short>give more details</short></flag> <flag name="trackers" value="list"><short>enable trackers</short></flag> <flag name="statistics"><short>some info about the database</short></flag> + <flag name="names"><short>uise name instead of unicodes</short></flag> </subcategory> </category> </flags> @@ -69,6 +71,11 @@ local helpinfo = [[ <example><command>mtxrun --script font --list --file --all somename</command></example> <example><command>mtxrun --script font --list --file --pattern=*somename*</command></example> </subcategory> + <subcategory> + <example><command>mtxrun --script font --save --texgyrepagella-regular.otf</command></example> + <example><command>mtxrun --script font --convert --texgyrepagella-regular.otf</command></example> + <example><command>mtxrun --script font --convert --names --texgyrepagella-regular.otf</command></example> + </subcategory> </category> </examples> </application> @@ -86,17 +93,31 @@ local report = application.report if not fontloader then fontloader = fontforge end -dofile(resolvers.findfile("font-otr.lua","tex")) -dofile(resolvers.findfile("font-cff.lua","tex")) -dofile(resolvers.findfile("font-ttf.lua","tex")) -dofile(resolvers.findfile("font-tmp.lua","tex")) -------(resolvers.findfile("font-dsp.lua","tex")) -------(resolvers.findfile("font-off.lua","tex")) +local function loadmodule(filename) + local fullname = resolvers.findfile(filename,"tex") + if fullname and fullname ~= "" then + dofile(fullname) + end +end + +-- old loader code + +loadmodule("font-otp.lua") -- we need to unpack the font for analysis + +-- new loader code + +loadmodule("font-otr.lua") +loadmodule("font-cff.lua") +loadmodule("font-ttf.lua") +loadmodule("font-tmp.lua") +loadmodule("font-dsp.lua") -- not yet in distribution +loadmodule("font-oup.lua") -- not yet in distribution -dofile(resolvers.findfile("font-otp.lua","tex")) -- we need to unpack the font for analysis -dofile(resolvers.findfile("font-syn.lua","tex")) -dofile(resolvers.findfile("font-trt.lua","tex")) -dofile(resolvers.findfile("font-mis.lua","tex")) +-- extra code + +loadmodule("font-syn.lua") +loadmodule("font-trt.lua") +loadmodule("font-mis.lua") scripts = scripts or { } scripts.fonts = scripts.fonts or { } @@ -403,13 +424,17 @@ end function scripts.fonts.unpack() local name = file.removesuffix(file.basename(givenfiles[1] or "")) if name and name ~= "" then - local cache = containers.define("fonts", "otf", otfversion, true) + local cache = containers.define("fonts", getargument("cache") or "otf", otfversion, true) -- cache is temp local cleanname = containers.cleanname(name) local data = containers.read(cache,cleanname) if data then local savename = file.addsuffix(cleanname .. "-unpacked","tma") report("fontsave, saving data in %s",savename) - fonts.handlers.otf.enhancers.unpack(data) + if data.creator == "context mkiv" then + fonts.handlers.otf.readers.unpack(data) + else + fonts.handlers.otf.enhancers.unpack(data) + end io.savedata(savename,table.serialize(data,true)) else report("unknown file %a",name) @@ -462,6 +487,36 @@ function scripts.fonts.save() end end +function scripts.fonts.convert() -- new save + local name = givenfiles[1] or "" + local sub = givenfiles[2] or "" + if name and name ~= "" then + local filename = resolvers.findfile(name) -- maybe also search for opentype + if filename and filename ~= "" then + local suffix = string.lower(file.suffix(filename)) + if suffix == 'ttf' or suffix == 'otf' or suffix == 'ttc' then + local data = fonts.handlers.otf.readers.loadfont(filename,sub) + if data then + fonts.handlers.otf.readers.compact(data) + fonts.handlers.otf.readers.rehash(data,getargument("names") and "names" or "unicodes") + local savename = file.replacesuffix(string.lower(data.metadata.fullname or filename),"lua") + table.save(savename,data) + report("font: %a saved as %a",filename,savename) + else + report("font: %a not loaded",filename) + end + else + report("font: %a not saved",filename) + end + else + report("font: %a not found",name) + end + else + report("font: no name given") + end +end + + if getargument("names") then setargument("reload",true) setargument("simple",true) @@ -473,6 +528,8 @@ elseif getargument("reload") then scripts.fonts.reload() elseif getargument("save") then scripts.fonts.save() +elseif getargument("convert") then + scripts.fonts.convert() elseif getargument("justload") then scripts.fonts.justload() elseif getargument("unpack") then diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 19a23ceca..753ce8bbf 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -7964,7 +7964,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 29359, stripped down to: 20483 +-- original size: 29394, stripped down to: 20482 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -8453,7 +8453,7 @@ function logs.messenger(category,subcategory) end end end -local function setblocked(category,value) +local function setblocked(category,value) if category==true then category,value="*",true elseif category==false then @@ -8468,7 +8468,7 @@ local function setblocked(category,value) end else states=utilities.parsers.settings_to_hash(category,type(states)=="table" and states or nil) - for c,_ in next,states do + for c in next,states do local v=data[c] if v then v.state=value @@ -18336,8 +18336,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 757476 --- stripped bytes : 272592 +-- original bytes : 757511 +-- stripped bytes : 272628 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 19a23ceca..753ce8bbf 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -7964,7 +7964,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 29359, stripped down to: 20483 +-- original size: 29394, stripped down to: 20482 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -8453,7 +8453,7 @@ function logs.messenger(category,subcategory) end end end -local function setblocked(category,value) +local function setblocked(category,value) if category==true then category,value="*",true elseif category==false then @@ -8468,7 +8468,7 @@ local function setblocked(category,value) end else states=utilities.parsers.settings_to_hash(category,type(states)=="table" and states or nil) - for c,_ in next,states do + for c in next,states do local v=data[c] if v then v.state=value @@ -18336,8 +18336,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 757476 --- stripped bytes : 272592 +-- original bytes : 757511 +-- stripped bytes : 272628 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 19a23ceca..753ce8bbf 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -7964,7 +7964,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 29359, stripped down to: 20483 +-- original size: 29394, stripped down to: 20482 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -8453,7 +8453,7 @@ function logs.messenger(category,subcategory) end end end -local function setblocked(category,value) +local function setblocked(category,value) if category==true then category,value="*",true elseif category==false then @@ -8468,7 +8468,7 @@ local function setblocked(category,value) end else states=utilities.parsers.settings_to_hash(category,type(states)=="table" and states or nil) - for c,_ in next,states do + for c in next,states do local v=data[c] if v then v.state=value @@ -18336,8 +18336,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 757476 --- stripped bytes : 272592 +-- original bytes : 757511 +-- stripped bytes : 272628 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 19a23ceca..753ce8bbf 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -7964,7 +7964,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 29359, stripped down to: 20483 +-- original size: 29394, stripped down to: 20482 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -8453,7 +8453,7 @@ function logs.messenger(category,subcategory) end end end -local function setblocked(category,value) +local function setblocked(category,value) if category==true then category,value="*",true elseif category==false then @@ -8468,7 +8468,7 @@ local function setblocked(category,value) end else states=utilities.parsers.settings_to_hash(category,type(states)=="table" and states or nil) - for c,_ in next,states do + for c in next,states do local v=data[c] if v then v.state=value @@ -18336,8 +18336,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 757476 --- stripped bytes : 272592 +-- original bytes : 757511 +-- stripped bytes : 272628 -- end library merge |