diff options
author | Karl Berry <karl@freefriends.org> | 2019-11-02 21:05:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-11-02 21:05:54 +0000 |
commit | cd516af31cb2636de100df528f2fc0f98e99c73c (patch) | |
tree | 0fd202f2708346154445e3b4fbedbcf13e299221 /Master/texmf-dist/scripts/tex4ebook | |
parent | a6533ee0e9b4a659454300277fc787a14d44afd6 (diff) |
tex4ebook (2nov19)
git-svn-id: svn://tug.org/texlive/trunk@52616 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/tex4ebook')
-rwxr-xr-x | Master/texmf-dist/scripts/tex4ebook/config-t4e.lua | 19 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/tex4ebook/list-fonts.lua | 145 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/tex4ebook/tex4ebook | 4 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua (renamed from Master/texmf-dist/scripts/tex4ebook/exec_epub.lua) | 7 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub3.lua (renamed from Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua) | 2 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_mobi.lua (renamed from Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua) | 2 |
6 files changed, 6 insertions, 173 deletions
diff --git a/Master/texmf-dist/scripts/tex4ebook/config-t4e.lua b/Master/texmf-dist/scripts/tex4ebook/config-t4e.lua deleted file mode 100755 index 9cc6681efec..00000000000 --- a/Master/texmf-dist/scripts/tex4ebook/config-t4e.lua +++ /dev/null @@ -1,19 +0,0 @@ --- Config file for tex4ebook - --- Font config - -Font{ - name = "cmr", - file = "lmroman10-regular.otf", - family = "Latin Modern", - weight = "normal", - style = "normal" -} - -Font{ - name = "cmmi", - file = "lmroman10-italic.otf", - family = "Latin Modern", - weight = "normal", - style = "italic" -} diff --git a/Master/texmf-dist/scripts/tex4ebook/list-fonts.lua b/Master/texmf-dist/scripts/tex4ebook/list-fonts.lua deleted file mode 100755 index 9acd1665f60..00000000000 --- a/Master/texmf-dist/scripts/tex4ebook/list-fonts.lua +++ /dev/null @@ -1,145 +0,0 @@ -kpse.set_program_name("luatex") -local function exists(fn) - local f = io.open(fn,"r") - if f~=nil then io.close(f) return true else return false end -end -local function load_fontbase(pathtable) - -- path should point to possible location of luaotfload font database - -- pathtable should be array of strings - -- each path should not end with lua - - local path = pathtable - if type(pathtable) =="string" then path = {pathtable} end - if #path == 0 then return nil end - local currentpath = table.remove(path,1) - if exists(currentpath ..".lua") then return require(currentpath) - else return load_fontbase(path) end -end - ---local fontbase = require(kpse.expand_var("$TEXMFSYSVAR") .. "/luatex-cache/generic/names/luaotfload-names.lua") -local sysvar = kpse.expand_var("$TEXMFSYSVAR") -local var = kpse.expand_var("$TEXMFVAR") -local namespath = "/luatex-cache/generic/names/" -local oldnames = "otfl-names" -local newnames = "luaotfload-names" -local compose_path = function(path, name) return path .. namespath .. name end -local fontbase_path = { - compose_path(sysvar, newnames), - compose_path(var, newnames), - compose_path(sysvar, oldnames), - compose_path(var,oldnames) -} - -local fontbase = load_fontbase(fontbase_path) or {} -fontbase.mappings = fontbase.mappings or {} --- assert(fontbase, "Cannot load font names") - - --- [[ --- This is code for querying the database --- -local search = arg[1] or "" -search = unicode.utf8.lower(search) ---]] -local fonts = {} -for _,record in pairs(fontbase.mappings) do - local familyname = record.familyname - local styles = fonts[familyname] or {} - local sanitized = record.sanitized or record.names - local subfamily = sanitized.subfamily --record.sanitized.subfamily or record.names.subfamily - styles[subfamily] = record -- We add subfamily as key to prevent duplicates - fonts[familyname] = styles -end - -local FontLoader = {} - -FontLoader.__index = FontLoader - -FontLoader.load_family = function(familyname) - local self = setmetatable({},FontLoader) - local family = fonts[familyname] - --[[ for _, record in pairs(fontbase.mappings) do - if record.familyname == familyname then - local style = record.sanitized.subfamily - family[style] = record - end - end - --]] - self.family = family - return self -end -FontLoader.get_path =function(self,style) - local rec = self.family[style] - local filename = rec.filename - if type(filename) == "table" then - filename = filename[1] - end - return kpse.find_file(filename,'opentype fonts') or kpse.find_file(filename,'truetype fonts') -end - - -FontLoader.list = function(self) - for style,rec in pairs(self.family) do - print(style, self:get_path(style)) - end -end - - -local FontNames = {} -FontNames.__index = FontNames - -FontNames.new = function() - self = setmetatable({},FontNames) - self.names = {} - return self -end - -FontNames.add_family = function(self,properties) - local properties = properties or {} - return function(names) - local names = names or {} - for _,n in pairs(names) do - self.names[n] = properties - end - end -end - -FontNames.list = function(self) - for name,prop in pairs(self.names) do - local p = {} - for k,v in pairs(prop) do - table.insert(p,k..'='..v) - end - print(name, table.concat(p)) - end -end - ---[[ -local fontnames = {} -for fontname,_ in pairs(fonts) do - local lowername = unicode.utf8.lower(fontname) - if lowername:find(search) then - table.insert(fontnames, fontname) - end -end - -table.sort(fontnames) ---for fontname, styles in pairs (fonts) do -for _, name in pairs(fontnames) do - local fontname = name - local styles = fonts[fontname] - local t = {} - for n,_ in pairs(styles) do table.insert(t,n) end - print(fontname, table.concat(t,', ')) -end ---]] - -local testfont = FontLoader.load_family("math") ---testfont:list() - -local n= FontNames.new() -n:add_family {type = "serif", name = "LMMono10"} {"cmr"} -n:add_family {type = "serif", name = "TeXGyreTermes"} {"ts1-qtmr", "ec-qtmr","ec-qtmri"} ---n:list() - -return {FontLoader = FontLoader, FontNames = n} diff --git a/Master/texmf-dist/scripts/tex4ebook/tex4ebook b/Master/texmf-dist/scripts/tex4ebook/tex4ebook index 731607fc5b4..ebd7485c2d1 100755 --- a/Master/texmf-dist/scripts/tex4ebook/tex4ebook +++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook @@ -67,7 +67,7 @@ else end if args.version then - print "tex4ebook v0.3" + print "tex4ebook v0.3a" return end @@ -180,7 +180,7 @@ params["config_file"] = config_file if output_formats[output_format] then - executor=require("exec_"..output_format) + executor=require("tex4ebook-exec_"..output_format) params=executor.prepare(params) if #extensions > 0 then params = ebookutils.extensions_prepare_parameters(extensions,params) diff --git a/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua b/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua index 24cc626aad3..52e2ab6134d 100755 --- a/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua +++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua @@ -1,13 +1,10 @@ -module("exec_epub",package.seeall) +module(...,package.seeall) local lfs = require("lfs") local os = require("os") local io = require("io") local log = logging.new("exec_epub") --local ebookutils = require("ebookutils") local ebookutils = require "mkutils" --- font loading doesn't work, font database format changes often --- and it is different between TL and Miktex --- local load_font = require("list-fonts") local outputdir_name="OEBPS" local metadir_name = "META-INF" local mimetype_name="mimetype" @@ -173,7 +170,7 @@ function make_opf() end local tidyconf = nil if tidy then - tidyconf = kpse.find_file("tidyconf.conf") + tidyconf = kpse.find_file("tex4ebook-tidyconf.conf") end --local opf_first_part = outputdir .. "/content.opf" local opf_first_part = "content.opf" diff --git a/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua b/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub3.lua index edf6df01c22..650eea4e6db 100755 --- a/Master/texmf-dist/scripts/tex4ebook/exec_epub3.lua +++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub3.lua @@ -1,5 +1,5 @@ module(...,package.seeall) -local eb = require("exec_epub") +local eb = require("tex4ebook-exec_epub") local dom = require("luaxml-domobject") local log = logging.new "exec_epub3" diff --git a/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua b/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_mobi.lua index ce10b6da760..92b70af71c3 100755 --- a/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua +++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_mobi.lua @@ -1,5 +1,5 @@ module(...,package.seeall) -local eb = require("exec_epub") +local eb = require("tex4ebook-exec_epub") local ebookutils = require("mkutils") local log = logging.new "exec_mobi" |