From 696c569fe209253982cc2918ad81fc6a3cb98152 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 12 Jul 2010 23:52:22 +0000 Subject: luaotfload 1.16 (12jul10) git-svn-id: svn://tug.org/texlive/trunk@19406 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/luatex/luaotfload/NEWS | 7 +- .../doc/luatex/luaotfload/luaotfload.pdf | Bin 293999 -> 303438 bytes .../scripts/luaotfload/mkluatexfontdb.lua | 1 - .../source/luatex/luaotfload/luaotfload.dtx | 39 ++++++- .../tex/luatex/luaotfload/luaotfload.lua | 10 +- .../tex/luatex/luaotfload/luaotfload.sty | 2 +- .../tex/luatex/luaotfload/otfl-font-nms.lua | 122 +++++---------------- .../tex/luatex/luaotfload/otfl-font-xtx.lua | 2 +- 8 files changed, 78 insertions(+), 105 deletions(-) diff --git a/Master/texmf-dist/doc/luatex/luaotfload/NEWS b/Master/texmf-dist/doc/luatex/luaotfload/NEWS index 662cc7c5900..d5369fd725e 100644 --- a/Master/texmf-dist/doc/luatex/luaotfload/NEWS +++ b/Master/texmf-dist/doc/luatex/luaotfload/NEWS @@ -1,7 +1,12 @@ Change History -------------- -2010/06/28, luaotfload v1.14: +2010/07/12, luaotfload v1.16: + * support keys prefixed by "+", for compatibility with XeTeX + * remove the progress bar from mkluatexfontdb, it is of little use now + * minor code a documentation cleanups + +2010/06/28, luaotfload v1.15: * anum feature did not work as advertised * add system shipped TTC fonts on Mac OS X to the blacklist, until the culprit ones are isolated diff --git a/Master/texmf-dist/doc/luatex/luaotfload/luaotfload.pdf b/Master/texmf-dist/doc/luatex/luaotfload/luaotfload.pdf index 74187bbd2a9..52c50219d09 100644 Binary files a/Master/texmf-dist/doc/luatex/luaotfload/luaotfload.pdf and b/Master/texmf-dist/doc/luatex/luaotfload/luaotfload.pdf differ diff --git a/Master/texmf-dist/scripts/luaotfload/mkluatexfontdb.lua b/Master/texmf-dist/scripts/luaotfload/mkluatexfontdb.lua index 455edecaa91..98db09505fc 100755 --- a/Master/texmf-dist/scripts/luaotfload/mkluatexfontdb.lua +++ b/Master/texmf-dist/scripts/luaotfload/mkluatexfontdb.lua @@ -125,7 +125,6 @@ end process_cmdline() local function generate(force) - log("generating font names database.") local savepath = output_directory if not lfs.isdir(savepath) then log("creating directory %s", savepath) diff --git a/Master/texmf-dist/source/luatex/luaotfload/luaotfload.dtx b/Master/texmf-dist/source/luatex/luaotfload/luaotfload.dtx index eb94174f964..6c68db17c03 100644 --- a/Master/texmf-dist/source/luatex/luaotfload/luaotfload.dtx +++ b/Master/texmf-dist/source/luatex/luaotfload/luaotfload.dtx @@ -35,7 +35,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: luaotfload 2010/06/28 v1.15 ConTeXt font loading system} +\Msg{* Package: luaotfload 2010/07/12 v1.16 ConTeXt font loading system} \Msg{************************************************************************} \keepsilent @@ -102,7 +102,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{luaotfload.drv}% - [2010/06/28 v1.15 ConTeXt font loading system]% + [2010/07/12 v1.16 ConTeXt font loading system]% \documentclass{ltxdoc} \usepackage{metalogo,multicol,mdwlist,fancyvrb} \usepackage[colorlinks=true]{hyperref} @@ -140,7 +140,7 @@ and the derived files % \GetFileInfo{luaotfload.drv} % % \title{The \textsf{luaotfload} package} -% \date{2010/06/28 v1.15} +% \date{2010/07/12 v1.16} % \author{ Elie Roux\footnote{\texttt{elie.roux@telecom-bretagne.eu}} % \and Khaled Hosny\footnote{\texttt{khaledhosny@eglug.org}}} % @@ -163,7 +163,9 @@ and the derived files % appeared, most notably the so called \emph{smart font} technologies like % \textsf{OpenType} fonts. These fonts can contain a lot of characters, and % additional functionalities like ligatures, old-style numbers, small capitals, -% etc., and support more complex writing systems like Arabic and Indic scripts. +% etc., and support more complex writing systems like Arabic and +% Indic\footnote{Unfortunately, \textsf{luaotfload} doesn't support Indic +% scripts right now} scripts. % They are widely deployed and available for all modern operating systems and % are becoming the de facto standard fonts for advanced text layout. % Until now the only way to use them directly in the \TeX\ world was by using @@ -436,7 +438,7 @@ module('luaotfload', package.seeall) luaotfload.module = { name = "luaotfload", version = 1.15, - date = "2010/06/28", + date = "2010/07/12", description = "ConTeXt font loading system.", author = "Elie Roux & Hans Hagen", copyright = "Elie Roux", @@ -445,6 +447,18 @@ luaotfload.module = { luatexbase.provides_module(luaotfload.module) +% \end{macrocode} +% +% This is a necessary initalization in order not to rebuild an existing font. +% Maybe 600 should be replaced by |\pdfpkresolution| or |texconfig.pk_dpi| +% (and it should be replaced dynamically), but we don't have access (yet) to +% the |texconfig| table, so we let it be 600. Anyway, it does still work +% fine even if |\pdfpkresolution| is changed. +% +% \begin{macrocode} + +kpse.init_prog('', 600, '/') + % \end{macrocode} % % Some helper functions. @@ -571,6 +585,19 @@ luaotfload.loadmodule('font-def.lua') luaotfload.loadmodule('font-xtx.lua') luaotfload.loadmodule('font-dum.lua') +% \end{macrocode} +% +% This is a patch for |otfl-font-def.lua|, that defines a reader for ofm +% fonts, this is necessary if we set the forced field of the specification +% to |ofm|, we use it only when using \textsf{luaotfload}, not +% |mkluatexfontdb|. +% +% \begin{macrocode} + +if fonts and fonts.tfm and fonts.tfm.readers then + fonts.tfm.readers.ofm = fonts.tfm.readers.tfm +end + % \end{macrocode} % % \textsf{luaotfload} specific modules. @@ -702,7 +729,7 @@ end \else \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luaotfload}% - [2010/06/28 v1.15 ConTeXt font loading system] + [2010/07/12 v1.16 ConTeXt font loading system] \RequirePackage{luatextra} \fi diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua index 75562d58f3b..4cdbd127de6 100644 --- a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua +++ b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua @@ -21,7 +21,7 @@ module('luaotfload', package.seeall) luaotfload.module = { name = "luaotfload", version = 1.15, - date = "2010/06/28", + date = "2010/07/12", description = "ConTeXt font loading system.", author = "Elie Roux & Hans Hagen", copyright = "Elie Roux", @@ -31,6 +31,9 @@ luaotfload.module = { luatexbase.provides_module(luaotfload.module) +kpse.init_prog('', 600, '/') + + local format = string.format local function log(...) @@ -106,6 +109,11 @@ luaotfload.loadmodule('font-xtx.lua') luaotfload.loadmodule('font-dum.lua') +if fonts and fonts.tfm and fonts.tfm.readers then + fonts.tfm.readers.ofm = fonts.tfm.readers.tfm +end + + luaotfload.loadmodule('font-nms.lua') luaotfload.loadmodule('font-clr.lua') diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.sty b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.sty index 6ccfa8b4fe2..65260b18e9b 100644 --- a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.sty +++ b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.sty @@ -24,7 +24,7 @@ \else \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luaotfload}% - [2010/06/28 v1.15 ConTeXt font loading system] + [2010/07/12 v1.16 ConTeXt font loading system] \RequirePackage{luatextra} \fi diff --git a/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-nms.lua b/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-nms.lua index ac3f0ba0b79..1f37d164a75 100644 --- a/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-nms.lua +++ b/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-nms.lua @@ -6,20 +6,6 @@ if not modules then modules = { } end modules ['font-nms'] = { license = "GNU GPL v2" } --- This is a patch for otfl-font-def.lua, that defines a reader for ofm fonts, --- this is necessary if we set the forced field of the specification to 'ofm' --- we use it only when using luaotfload, not mkluatexfontdb. -if fonts and fonts.tfm and fonts.tfm.readers then - fonts.tfm.readers.ofm = fonts.tfm.readers.tfm -end - --- This is a necessary initalization in order not to rebuild an existing font. --- Maybe 600 should be replaced by \pdfpkresolution --- or texconfig.pk_dpi (and it should be replaced dynamically), but we don't --- have access (yet) to the texconfig table, so we let it be 600. Anyway, it --- does still work fine even if \pdfpkresolution is changed. -kpse.init_prog('', 600, '/') - fonts = fonts or { } fonts.names = fonts.names or { } @@ -42,7 +28,6 @@ local gmatch, sub, find = string.gmatch, string.sub, string.find local utfgsub = unicode.utf8.gsub local trace_short = false --tracing adapted to rebuilding of the database inside a document -local trace_progress = true --trackers.register("names.progress", function(v) trace_progress = v end) local trace_search = false --trackers.register("names.search", function(v) trace_search = v end) local trace_loading = false --trackers.register("names.loading", function(v) trace_loading = v end) @@ -63,8 +48,6 @@ local function fontnames_init() end function names.load() - -- this sets the output of the database building accordingly. - names.set_log_level(-1) local localpath = file.join(names.path.localdir, names.path.basename) local systempath = file.join(names.path.systemdir, names.path.basename) local kpsefound = kpse.find_file(names.path.basename) @@ -121,7 +104,7 @@ function names.resolve(specification) if type(data) == "table" and data.version == names.version then if data.mappings then local found = { } - for _,face in ipairs(data.mappings) do + for _,face in next, data.mappings do local family = sanitize(face.names.family) local subfamily = sanitize(face.names.subfamily) local fullname = sanitize(face.names.fullname) @@ -201,7 +184,7 @@ function names.resolve(specification) -- least difference from the requested size. local closest local least = math.huge -- initial value is infinity - for i,face in ipairs(found) do + for i,face in next, found do local dsnsize = face.size[1]/10 local difference = math.abs(dsnsize-size) if difference < least then @@ -245,14 +228,9 @@ end names.resolvespec = names.resolve function names.set_log_level(level) - if level == -1 then - trace_progress = false - trace_short = true - elseif level == 2 then - trace_progress = false + if level == 2 then trace_loading = true elseif level >= 3 then - trace_progress = false trace_loading = true trace_search = true end @@ -272,26 +250,6 @@ logs.info = logs.info or log local log = names.log --- The progress bar -local function progress(current, total) - if trace_progress then --- local width = os.getenv("COLUMNS") -2 --doesn't work - local width = 78 - local percent = current/total - local gauge = format("[%s]", rpadd(" ", width, " ")) - if percent > 0 then - local done = rpadd("=", (width * percent) - 1, "=") .. ">" - gauge = format("[%s]", rpadd(done, width, " ") ) - end - if lastislog == 1 then - texio.write_nl("") - lastislog = 0 - end - io.stderr:write("\r"..gauge) - io.stderr:flush() - end -end - local function font_fullinfo(filename, subfont, texmf) local t = { } local f = fontloader.open(filename, subfont) @@ -306,14 +264,14 @@ local function font_fullinfo(filename, subfont, texmf) collectgarbage('collect') -- see http://www.microsoft.com/typography/OTSPEC/features_pt.htm#size if m.fontstyle_name then - for _,v in pairs(m.fontstyle_name) do + for _,v in next, m.fontstyle_name do if v.lang == 1033 then t.fontstyle_name = v.name end end end if m.names then - for _,v in pairs(m.names) do + for _,v in next, m.names do if v.lang == "English (US)" then t.names = { -- see @@ -372,7 +330,7 @@ local function load_font(filename, fontnames, newfontnames, texmf) newstatus[basefile].index = newstatus[basefile].index or { } if db_timestamp == timestamp and not newstatus[basefile].index[1] then - for _,v in ipairs(status[basefile].index) do + for _,v in next, status[basefile].index do local index = #newstatus[basefile].index newmappings[#newmappings+1] = mappings[v] newstatus[basefile].index[index+1] = #newmappings @@ -385,7 +343,7 @@ local function load_font(filename, fontnames, newfontnames, texmf) local info = fontloader.info(filename) if info then if type(info) == "table" and #info > 1 then - for i in ipairs(info) do + for i in next, info do local fullinfo = font_fullinfo(filename, i-1, texmf) local index = newstatus[basefile].index[i] if newstatus[basefile].index[i] then @@ -423,9 +381,8 @@ local function path_normalize(path) - /cygdrive/a/b -> a:/b - reading symlinks under non-Win32 - using kpse.readable_file on Win32 - --]] + ]] if os.type == "windows" or os.type == "msdos" or os.name == "cygwin" then --- path = kpse.readable_file(path) path = path:gsub('\\', '/') path = path:lower() path = path:gsub('^/cygdrive/(%a)/', '%1:/') @@ -479,12 +436,12 @@ local font_extensions = { "otf", "ttf", "ttc", "dfont" } local function scan_dir(dirname, fontnames, newfontnames, texmf) --[[ - this function scans a directory and populates the list of fonts + This function scans a directory and populates the list of fonts with all the fonts it finds. - dirname is the name of the directory to scan - names is the font database to fill - texmf is a boolean saying if we are scanning a texmf directory - --]] + ]] local list, found = { }, { } local nbfound = 0 if trace_search then @@ -517,30 +474,18 @@ end local function scan_texmf_fonts(fontnames, newfontnames) --[[ - The function that scans all fonts in the texmf tree, through kpathsea + This function scans all fonts in the texmf tree, through kpathsea variables OPENTYPEFONTS and TTFONTS of texmf.cnf - --]] - if trace_progress then - if expandpath("$OSFONTDIR"):is_empty() then - logs.report("Scanning TEXMF fonts:") - else - logs.report("Scanning TEXMF and OS fonts:") - end - elseif trace_short then - if expandpath("$OSFONTDIR"):is_empty() then - logs.info("Scanning TEXMF fonts...") - else - logs.info("Scanning TEXMF and OS fonts...") - end + ]] + if expandpath("$OSFONTDIR"):is_empty() then + logs.info("Scanning TEXMF fonts...") + else + logs.info("Scanning TEXMF and OS fonts...") end local fontdirs = expandpath("$OPENTYPEFONTS"):gsub("^\.", "") fontdirs = fontdirs .. expandpath("$TTFONTS"):gsub("^\.", "") if not fontdirs:is_empty() then - fontdirs = splitpath(fontdirs) - count = 0 - for _,d in ipairs(fontdirs) do - count = count + 1 - progress(count, #fontdirs) + for _,d in next, splitpath(fontdirs) do scan_dir(d, fontnames, newfontnames, true) end end @@ -559,12 +504,11 @@ end in OSFONTDIR. ]] ---[[ - This function parses /etc/fonts/fonts.conf and returns all the dir it finds. - The code is minimal, please report any error it may generate. -]] - local function read_fonts_conf(path, results) + --[[ + This function parses /etc/fonts/fonts.conf and returns all the dir it finds. + The code is minimal, please report any error it may generate. + ]] local f = io.open(path) if not f then error("Cannot open the file "..path) @@ -622,8 +566,7 @@ local function read_fonts_conf(path, results) -- be found otherwise read_fonts_conf(include, results) elseif lfs.isdir(include) then - found = glob(file.join(include, "*.conf")) - for _, f in ipairs(found) do + for _,f in next, glob(file.join(include, "*.conf")) do read_fonts_conf(f, results) end end @@ -659,20 +602,12 @@ local function scan_os_fonts(fontnames, newfontnames) This function scans the OS fonts through - fontcache for Unix (reads the fonts.conf file and scans the directories) - a static set of directories for Windows and MacOSX - --]] - if trace_progress then - logs.report("Scanning OS fonts:") - elseif trace_short then - logs.info("Scanning OS fonts...") - end + ]] + logs.info("Scanning OS fonts...") if trace_search then logs.info("Searching in static system directories...") end - count = 0 - local os_dirs = get_os_dirs() - for _,d in ipairs(os_dirs) do - count = count + 1 - progress(count, #os_dirs) + for _,d in next, get_os_dirs() do scan_dir(d, fontnames, newfontnames, false) end end @@ -682,10 +617,9 @@ local function update_names(fontnames, force) The main function, scans everything - fontnames is the final table to return - force is whether we rebuild it from scratch or not - --]] - if trace_short then - logs.info("Updating the font names database:") - end + ]] + logs.info("Updating the font names database:") + if force then fontnames = fontnames_init() else diff --git a/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-xtx.lua b/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-xtx.lua index 8d81e02f98f..8237851c907 100644 --- a/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-xtx.lua +++ b/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-xtx.lua @@ -181,7 +181,7 @@ local fontname = (lpeg.P("name:")/isname * (namespec/thename)) + lpeg.P(true)/ local sometext = (lpeg.R("az","AZ","09") + lpeg.S("+-."))^1 local truevalue = lpeg.P("+") * spaces * (sometext/istrue) local falsevalue = lpeg.P("-") * spaces * (sometext/isfalse) -local keyvalue = (lpeg.C(sometext) * spaces * lpeg.P("=") * spaces * lpeg.C(sometext))/iskey +local keyvalue = lpeg.P("+") + (lpeg.C(sometext) * spaces * lpeg.P("=") * spaces * lpeg.C(sometext))/iskey local somevalue = sometext/istrue local subvalue = lpeg.P("(") * (lpeg.C(lpeg.P(1-lpeg.S("()"))^1)/issub) * lpeg.P(")") -- for Kim local option = spaces * (keyvalue + falsevalue + truevalue + somevalue) * spaces -- cgit v1.2.3