diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | doc/filegraph.dot | 64 | ||||
-rw-r--r-- | doc/luaotfload-latex.tex | 2 | ||||
-rw-r--r-- | doc/luaotfload-main.tex | 46 | ||||
-rw-r--r-- | doc/luaotfload-tool.rst | 8 | ||||
-rw-r--r-- | doc/luaotfload.conf.rst | 45 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-gbn.lua | 24 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-ots.lua | 52 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-oup.lua | 23 | ||||
-rw-r--r-- | src/fontloader/runtime/fontloader-reference.lua | 71 | ||||
-rw-r--r-- | src/luaotfload-configuration.lua | 36 | ||||
-rw-r--r-- | src/luaotfload-database.lua | 8 | ||||
-rw-r--r-- | src/luaotfload-features.lua | 21 | ||||
-rwxr-xr-x | src/luaotfload-tool.lua | 49 | ||||
-rw-r--r-- | src/luaotfload.sty | 2 |
16 files changed, 299 insertions, 155 deletions
@@ -6,6 +6,7 @@ Change History * Glyph fallbacks. * Latest fontloader code. * Adapt packaging to changed upstream file layout. + * Remove support for builtin Fontforge libraries. 2015/12/09, luaotfload v2.6 * Add ``sign`` target to makefile for automated package signing. @@ -30,7 +30,7 @@ The following people have contributed to this package. Khaled Hosny <khaledhosny@eglug.org> Elie Roux <elie.roux@telecom-bretagne.eu> Will Robertson <will.robertson@latex-project.org> -Philipp Gesang <philipp.gesang@alumni.uni-heidelberg.de> +Philipp Gesang <phg@phi-gamma.net> Dohyun Kim <nomosnomos@gmail.com> Reuben Thomas <https://github.com/rrthomas> Joseph Wright <joseph.wright@morningstar2.co.uk> diff --git a/doc/filegraph.dot b/doc/filegraph.dot index de60823..b274461 100644 --- a/doc/filegraph.dot +++ b/doc/filegraph.dot @@ -309,7 +309,7 @@ strict digraph luaotfload_files { //looks weird with circo ... <tr> <td>l-lua.lua</td> <td>l-lpeg.lua</td> <td>l-function.lua</td> </tr> <tr> <td>l-string.lua</td> <td>l-table.lua</td> <td>l-io.lua</td> </tr> <tr> <td>l-file.lua</td> <td>l-boolean.lua</td> <td>l-math.lua</td> </tr> - <tr> <td>util-str.lua</td> </tr> + <tr> <td>util-str.lua</td> <td>util-fil.lua</td> </tr> </table> >, ] @@ -322,13 +322,17 @@ strict digraph luaotfload_files { //looks weird with circo ... label = < <table border="0"> <th> <td colspan="2"> <font point-size="12" face="Iwona Italic">Font Loader (LuaTeX-Fonts)</font> </td> </th> - <tr> <td>luatex-fonts-cbk.lua</td> <td>luatex-basics-nod.lua</td> </tr> - <tr> <td>luatex-fonts-enc.lua</td> <td>luatex-fonts-syn.lua</td> </tr> - <tr> <td>luatex-font-tfm.lua</td> <td>luatex-font-afm.lua</td> </tr> - <tr> <td>luatex-font-afk.lua</td> <td>luatex-fonts-tfm.lua</td> </tr> - <tr> <td>luatex-fonts-chr.lua</td> <td>luatex-fonts-lua.lua</td> </tr> - <tr> <td>luatex-fonts-inj.lua</td> <td>luatex-fonts-otn.lua</td> </tr> - <tr> <td>luatex-fonts-def.lua</td> <td>luatex-fonts-ext.lua</td> </tr> + <tr> + <td>luatex-basics-nod.lua</td> + <td>luatex-basics-chr.lua</td> + </tr> + <tr> + <td>luatex-fonts-enc.lua</td> + <td>luatex-fonts-syn.lua</td> + </tr> + <tr> + <td>luatex-fonts-ext.lua</td> + </tr> </table> >, ] @@ -341,10 +345,46 @@ strict digraph luaotfload_files { //looks weird with circo ... label = < <table border="0"> <th> <td colspan="3"> <font point-size="12" face="Iwona Italic"> Font and Node Libraries from Context </font> </td> </th> - <tr> <td>data-con.lua</td> <td>font-ini.lua</td> <td>font-con.lua</td> </tr> - <tr> <td>font-cid.lua</td> <td>font-map.lua</td> <td>font-oti.lua</td> </tr> - <tr> <td>font-otf.lua</td> <td>font-otb.lua</td> <td>font-ota.lua</td> </tr> - <tr> <td>font-def.lua</td> </tr> + <tr> + <td>data-con.lua</td> + <td>font-ini.lua</td> + <td>font-con.lua</td> + </tr> + <tr> + <td>font-cid.lua</td> + <td>font-map.lua</td> + <td>font-tfm.lua</td> + </tr> + <tr> + <td>font-afm.lua</td> + <td>font-afk.lua</td> + <td>font-oti.lua</td> + </tr> + <tr> + <td>font-otr.lua</td> + <td>font-cff.lua</td> + <td>font-ttf.lua</td> + </tr> + <tr> + <td>font-dsp.lua</td> + <td>font-oup.lua</td> + <td>font-otl.lua</td> + </tr> + <tr> + <td>font-oto.lua</td> + <td>font-otj.lua</td> + <td>font-ota.lua</td> + </tr> + <tr> + <td>font-ots.lua</td> + <td>font-osd.lua</td> + <td>font-lua.lua</td> + </tr> + <tr> + <td>font-def.lua</td> + <td>font-xtx.lua</td> + <td>font-gbn.lua</td> + </tr> </table> >, ] diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex index bdcf45f..b4cd3c3 100644 --- a/doc/luaotfload-latex.tex +++ b/doc/luaotfload-latex.tex @@ -3,7 +3,7 @@ %% %% by Elie Roux <elie.roux@telecom-bretagne.eu> %% and Khaled Hosny <khaledhosny@eglug.org> -%% and Philipp Gesang <philipp.gesang@alumni.uni-heidelberg.de> +%% and Philipp Gesang <phg@phi-gamma.net> %% %% This file is part of Luaotfload. %% diff --git a/doc/luaotfload-main.tex b/doc/luaotfload-main.tex index d19906e..7099f3d 100644 --- a/doc/luaotfload-main.tex +++ b/doc/luaotfload-main.tex @@ -2,7 +2,7 @@ %% %% by Elie Roux <elie.roux@telecom-bretagne.eu> %% and Khaled Hosny <khaledhosny@eglug.org> -%% and Philipp Gesang <philipp.gesang@alumni.uni-heidelberg.de> +%% and Philipp Gesang <phg@phi-gamma.net> %% %% This file is part of Luaotfload. %% @@ -1160,6 +1160,7 @@ and have thus been omitted from the merge.\footnote{% \beginaltitem {l-boolean.lua} \endaltitem \beginaltitem {l-math.lua} \endaltitem \beginaltitem {util-str.lua} \endaltitem + \beginaltitem {util-fil.lua} \endaltitem \enddefinitions \enddoublecolumns @@ -1169,30 +1170,28 @@ grouped twofold as below: \begindefinitions \beginnormalitem The \emphasis{font loader} itself. - These files have been written for - \LUATEX-Fonts and they are distributed along - with \identifier{luaotfload}. + These files have been written for \LUATEX-Fonts and they are + distributed along with \identifier{luaotfload} so as to resemble + the state of the code when it was imported. Their purpose is either + to give a slightly aged version of a file if upstream considers + latest developments for not yet ready for use outside Context; or, + to install placeholders or minimalist versions of APIs relied upon + but usually provided by parts of Context not included in the + fontloader. \begindoublecolumns \begindefinitions \beginaltitem{luatex-basics-nod.lua} \endaltitem + \beginaltitem{luatex-basics-chr.lua} \endaltitem \beginaltitem{luatex-fonts-enc.lua} \endaltitem \beginaltitem{luatex-fonts-syn.lua} \endaltitem - \beginaltitem{luatex-fonts-tfm.lua} \endaltitem - \beginaltitem{luatex-fonts-chr.lua} \endaltitem - \beginaltitem{luatex-fonts-lua.lua} \endaltitem - \beginaltitem{luatex-fonts-inj.lua} \endaltitem - \beginaltitem{luatex-fonts-otn.lua} \endaltitem - \beginaltitem{luatex-fonts-def.lua} \endaltitem \beginaltitem{luatex-fonts-ext.lua} \endaltitem - \beginaltitem{luatex-fonts-cbk.lua} \endaltitem \enddefinitions \enddoublecolumns \endnormalitem \beginnormalitem - Code related to \emphasis{font handling and - node processing}, taken directly from - \CONTEXT. + Code related to \emphasis{font handling and node processing}, taken + directly from \CONTEXT. \begindoublecolumns \begindefinitions \beginaltitem{data-con.lua} \endaltitem @@ -1200,12 +1199,25 @@ grouped twofold as below: \beginaltitem{font-con.lua} \endaltitem \beginaltitem{font-cid.lua} \endaltitem \beginaltitem{font-map.lua} \endaltitem + \beginaltitem{font-tfm.lua} \endaltitem + \beginaltitem{font-afm.lua} \endaltitem + \beginaltitem{font-afk.lua} \endaltitem \beginaltitem{font-oti.lua} \endaltitem - \beginaltitem{font-otf.lua} \endaltitem - \beginaltitem{font-otb.lua} \endaltitem + \beginaltitem{font-otr.lua} \endaltitem + \beginaltitem{font-cff.lua} \endaltitem + \beginaltitem{font-ttf.lua} \endaltitem + \beginaltitem{font-dsp.lua} \endaltitem + \beginaltitem{font-oup.lua} \endaltitem + \beginaltitem{font-otl.lua} \endaltitem + \beginaltitem{font-oto.lua} \endaltitem + \beginaltitem{font-otj.lua} \endaltitem \beginaltitem{font-ota.lua} \endaltitem + \beginaltitem{font-ots.lua} \endaltitem + \beginaltitem{font-osd.lua} \endaltitem + \beginaltitem{font-lua.lua} \endaltitem \beginaltitem{font-def.lua} \endaltitem - \beginaltitem{font-otp.lua} \endaltitem + \beginaltitem{font-xtx.lua} \endaltitem + \beginaltitem{font-gbn.lua} \endaltitem \enddefinitions \enddoublecolumns \endnormalitem diff --git a/doc/luaotfload-tool.rst b/doc/luaotfload-tool.rst index 2e3b897..5b834b4 100644 --- a/doc/luaotfload-tool.rst +++ b/doc/luaotfload-tool.rst @@ -6,7 +6,7 @@ generate and query the Luaotfload font names database ----------------------------------------------------------------------- -:Date: 2016-04-07 +:Date: 2016-04-18 :Copyright: GPL v2.0 :Version: 2.7 :Manual section: 1 @@ -116,9 +116,6 @@ query mode For the meaning of the returned fields see the LuaTeX documentation. (requires ``--find``). ---warnings, -w Print the warnings generated by the fontloader - library (assumes ``-I``). Automatically enabled - if the verbosity level exceeds 2. --list=CRITERION Show entries, where *CRITERION* is one of the following: @@ -329,6 +326,5 @@ AUTHORS The fontloader code is provided by Hans Hagen of Pragma ADE, Hasselt NL (`<http://pragma-ade.com/>`__). -This manual page was written by Philipp Gesang -<philipp.gesang@alumni.uni-heidelberg.de>. +This manual page was written by Philipp Gesang <phg@phi-gamma.net>. diff --git a/doc/luaotfload.conf.rst b/doc/luaotfload.conf.rst index 5cb74f0..25f5a5c 100644 --- a/doc/luaotfload.conf.rst +++ b/doc/luaotfload.conf.rst @@ -6,7 +6,7 @@ Luaotfload configuration file ----------------------------------------------------------------------- -:Date: 2016-04-07 +:Date: 2016-04-18 :Copyright: GPL v2.0 :Version: 2.7 :Manual section: 5 @@ -126,23 +126,25 @@ the variable is unset. Section ``db`` ----------------------------------------------------------------------- -+---------------+--------+---------------------------+ -| variable | type | default | -+---------------+--------+---------------------------+ -| compress | b | ``true`` | -+---------------+--------+---------------------------+ -| formats | s | ``"otf,ttf,ttc,dfont"`` | -+---------------+--------+---------------------------+ -| max-fonts | n | ``2^51`` | -+---------------+--------+---------------------------+ -| scan-local | b | ``false`` | -+---------------+--------+---------------------------+ -| skip-read | b | ``false`` | -+---------------+--------+---------------------------+ -| strip | b | ``true`` | -+---------------+--------+---------------------------+ -| update-live | b | ``true`` | -+---------------+--------+---------------------------+ ++-----------------+--------+---------------------------+ +| variable | type | default | ++-----------------+--------+---------------------------+ +| compress | b | ``true`` | ++-----------------+--------+---------------------------+ +| formats | s | ``"otf,ttf,ttc,dfont"`` | ++-----------------+--------+---------------------------+ +| max-fonts | n | ``2^51`` | ++-----------------+--------+---------------------------+ +| scan-local | b | ``false`` | ++-----------------+--------+---------------------------+ +| skip-read | b | ``false`` | ++-----------------+--------+---------------------------+ +| strip | b | ``true`` | ++-----------------+--------+---------------------------+ +| update-live | b | ``true`` | ++-----------------+--------+---------------------------+ +| use-fontforge | b | ``false`` | ++-----------------+--------+---------------------------+ The flag ``compress`` determines whether the font index (usually ``luaotfload-names.lua[.gz]`` will be stored in compressed forms. @@ -189,6 +191,10 @@ If ``update-live`` is set, Luaotfload will reload the database if it cannot find a requested font. Those who prefer to update manually using **luaotfload-tool** should unset this flag. +The option ``use-fontforge`` switches name scanning back to the old +method that relies on the builtin ``fontloader`` library. This is +interesting for reference until the Fontforge code will be removed +eventually. Section ``default-features`` ----------------------------------------------------------------------- @@ -381,6 +387,5 @@ AUTHORS *Luaotfload* is maintained by the LuaLaTeX dev team (`<https://github.com/lualatex/>`_). -This manual page was written by Philipp Gesang -<philipp.gesang@alumni.uni-heidelberg.de>. +This manual page was written by Philipp Gesang <phg@phi-gamma.net>. diff --git a/src/fontloader/misc/fontloader-font-gbn.lua b/src/fontloader/misc/fontloader-font-gbn.lua index a645a97..daa072b 100644 --- a/src/fontloader/misc/fontloader-font-gbn.lua +++ b/src/fontloader/misc/fontloader-font-gbn.lua @@ -20,6 +20,7 @@ local nuts = nodes.nuts -- context abstraction of direct nodes local traverse_id = nuts.traverse_id local remove_node = nuts.remove +local free_node = nuts.free local glyph_code = nodes.nodecodes.glyph local disc_code = nodes.nodecodes.disc @@ -30,11 +31,13 @@ local tonut = nuts.tonut local getfont = nuts.getfont local getchar = nuts.getchar local getid = nuts.getid +local getboth = nuts.getboth local getprev = nuts.getprev local getnext = nuts.getnext local getdisc = nuts.getdisc local setchar = nuts.setchar local setlink = nuts.setlink +local setprev = nuts.setprev -- from now on we apply ligaturing and kerning here because it might interfere with complex -- opentype discretionary handling where the base ligature pass expect some weird extra @@ -136,7 +139,26 @@ function nodes.handlers.nodepass(head) end if redundant then for i=1,#redundant do - remove_node(nuthead,redundant[i],true) + local r = redundant[i] + local p, n = getboth(r) + if r == nuthead then + nuthead = n + setprev(n) + else + setlink(p,n) + end + if b > 0 then + for i=1,b do + local bi = basefonts[i] + if r == bi[1] then + bi[1] = n + end + if r == bi[2] then + bi[2] = n + end + end + end + free_node(r) end end for d in traverse_id(disc_code,nuthead) do diff --git a/src/fontloader/misc/fontloader-font-ots.lua b/src/fontloader/misc/fontloader-font-ots.lua index c3e1f48..6911872 100644 --- a/src/fontloader/misc/fontloader-font-ots.lua +++ b/src/fontloader/misc/fontloader-font-ots.lua @@ -696,6 +696,9 @@ end function handlers.gsub_ligature(head,start,dataset,sequence,ligature) local current = getnext(start) + if not current then + return head, start, false, nil + end local stop = nil local startchar = getchar(start) if marks[startchar] then @@ -756,6 +759,28 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature) -- kind of weird break elseif id == disc_code then + -- tricky .. we also need to do pre here + local replace = getfield(current,"replace") + if replace then + -- of{f-}{}{f}e o{f-}{}{f}fe o{-}{}{ff}e (oe and ff ligature) + -- we can end up here when we have a start run .. testruns start at a disc but + -- so here we have the other case: char + disc + while replace do + local char, id = ischar(replace,currentfont) + if char then + local lg = ligature[char] -- can there be multiple in a row? maybe in a bad font + if lg then + ligature = lg + replace = getnext(replace) + else + return head, start, false, false + end + else + return head, start, false, false + end + end + stop = current + end lastdisc = current current = getnext(current) else @@ -1281,6 +1306,7 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup local nofreplacements = 1 local skipmark = currentlookup.flags[1] -- sequence.flags? while current do + -- todo: ischar ... can there really be disc nodes here? local id = getid(current) if id == disc_code then if not discfound then @@ -2755,6 +2781,8 @@ local function kernrun(disc,k_run,font,attr,...) next = false end -- + -- we need to get rid of this nest mess some day .. has to be done otherwise + -- if pre then if k_run(pre,"injections",nil,font,attr,...) then done = true @@ -2762,7 +2790,7 @@ local function kernrun(disc,k_run,font,attr,...) if prev then local nest = getprev(pre) setlink(prev,pre) - if k_run(prevmarks,"preinjections",pre,font,attr,...) then -- getnext(pre)) + if k_run(prevmarks,"preinjections",pre,font,attr,...) then -- or prev? done = true end setprev(pre,nest) @@ -2860,7 +2888,7 @@ local function comprun(disc,c_run,...) setdisc(disc,pre,post,replace) end -- - return getnext(disc), done + return getnext(disc), renewed end local function testrun(disc,t_run,c_run,...) @@ -3000,8 +3028,9 @@ local nesting = 0 local function c_run_single(head,font,attr,lookupcache,step,dataset,sequence,rlmode,handler) local done = false - local start = sweephead[head] - if start then + local sweep = sweephead[head] + if sweep then + start = sweep sweephead[head] = nil else start = head @@ -3027,8 +3056,11 @@ local function c_run_single(head,font,attr,lookupcache,step,dataset,sequence,rlm end elseif char == false then return head, done + elseif sweep then + -- else we loose the rest + return head, done else - -- weird + -- in disc component start = getnext(start) end end @@ -3113,8 +3145,9 @@ end local function c_run_multiple(head,font,attr,steps,nofsteps,dataset,sequence,rlmode,handler) local done = false - local start = sweephead[head] - if start then + local sweep = sweephead[head] + if sweep then + start = sweep sweephead[head] = nil else start = head @@ -3154,8 +3187,11 @@ local function c_run_multiple(head,font,attr,steps,nofsteps,dataset,sequence,rlm elseif char == false then -- whatever glyph return head, done + elseif sweep then + -- else we loose the rest + return head, done else - -- very unlikely + -- in disc component start = getnext(start) end end diff --git a/src/fontloader/misc/fontloader-font-oup.lua b/src/fontloader/misc/fontloader-font-oup.lua index 59530af..7edaaf6 100644 --- a/src/fontloader/misc/fontloader-font-oup.lua +++ b/src/fontloader/misc/fontloader-font-oup.lua @@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['font-oup'] = { local next, type = next, type local P, R, S = lpeg.P, lpeg.R, lpeg.S local lpegmatch = lpeg.match -local insert, remove, copy = table.insert, table.remove, table.copy +local insert, remove, copy, unpack = table.insert, table.remove, table.copy, table.unpack local formatters = string.formatters local sortedkeys = table.sortedkeys @@ -737,8 +737,7 @@ local function stripredundant(fontdata) end function readers.getcomponents(fontdata) -- handy for resolving ligatures when names are missing - local resources = fontdata.resources - local descriptions = fontdata.descriptions + local resources = fontdata.resources if resources then local sequences = resources.sequences if sequences then @@ -761,7 +760,7 @@ function readers.getcomponents(fontdata) -- handy for resolving ligatures when n end end for i=1,#steps do - -- we actually had/have this in base mode + -- we actually had/have this in base mode local coverage = steps[i].coverage if coverage then for k, v in next, coverage do @@ -773,13 +772,25 @@ function readers.getcomponents(fontdata) -- handy for resolving ligatures when n end end if next(collected) then + -- remove self referring + -- for k, v in next, collected do + -- for i=1,#v do + -- local vi = v[i] + -- if vi == k then + -- -- report("removing self referring ligature @ slot %5X from collected (1)",k) + -- collected[k] = nil + -- end + -- end + -- end while true do local done = false for k, v in next, collected do for i=1,#v do local vi = v[i] if vi == k then + -- report("removing self referring ligature @ slot %5X from collected (2)",k) collected[k] = nil + break else local c = collected[vi] if c then @@ -787,7 +798,7 @@ function readers.getcomponents(fontdata) -- handy for resolving ligatures when n local t = { } local n = i - 1 for j=1,n do - t[j] = t[j] + t[j] = v[j] end for j=1,#c do n = n + 1 @@ -795,7 +806,7 @@ function readers.getcomponents(fontdata) -- handy for resolving ligatures when n end for j=i+1,#v do n = n + 1 - t[n] = t[j] + t[n] = v[j] end collected[k] = t break diff --git a/src/fontloader/runtime/fontloader-reference.lua b/src/fontloader/runtime/fontloader-reference.lua index 0d22a73..1595733 100644 --- a/src/fontloader/runtime/fontloader-reference.lua +++ b/src/fontloader/runtime/fontloader-reference.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 04/17/16 11:56:26 +-- merge date : 04/18/16 18:53:40 do -- begin closure to overcome local limits and interference @@ -13503,7 +13503,7 @@ if not modules then modules={} end modules ['font-oup']={ local next,type=next,type local P,R,S=lpeg.P,lpeg.R,lpeg.S local lpegmatch=lpeg.match -local insert,remove,copy=table.insert,table.remove,table.copy +local insert,remove,copy,unpack=table.insert,table.remove,table.copy,table.unpack local formatters=string.formatters local sortedkeys=table.sortedkeys local sortedhash=table.sortedhash @@ -14169,7 +14169,6 @@ local function stripredundant(fontdata) end function readers.getcomponents(fontdata) local resources=fontdata.resources - local descriptions=fontdata.descriptions if resources then local sequences=resources.sequences if sequences then @@ -14210,6 +14209,7 @@ function readers.getcomponents(fontdata) local vi=v[i] if vi==k then collected[k]=nil + break else local c=collected[vi] if c then @@ -14217,7 +14217,7 @@ function readers.getcomponents(fontdata) local t={} local n=i-1 for j=1,n do - t[j]=t[j] + t[j]=v[j] end for j=1,#c do n=n+1 @@ -14225,7 +14225,7 @@ function readers.getcomponents(fontdata) end for j=i+1,#v do n=n+1 - t[n]=t[j] + t[n]=v[j] end collected[k]=t break @@ -18678,6 +18678,9 @@ function handlers.gsub_multiple(head,start,dataset,sequence,multiple) end function handlers.gsub_ligature(head,start,dataset,sequence,ligature) local current=getnext(start) + if not current then + return head,start,false,nil + end local stop=nil local startchar=getchar(start) if marks[startchar] then @@ -18736,6 +18739,24 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature) elseif char==false then break elseif id==disc_code then + local replace=getfield(current,"replace") + if replace then + while replace do + local char,id=ischar(replace,currentfont) + if char then + local lg=ligature[char] + if lg then + ligature=lg + replace=getnext(replace) + else + return head,start,false,false + end + else + return head,start,false,false + end + end + stop=current + end lastdisc=current current=getnext(current) else @@ -20539,7 +20560,7 @@ local function comprun(disc,c_run,...) if renewed then setdisc(disc,pre,post,replace) end - return getnext(disc),done + return getnext(disc),renewed end local function testrun(disc,t_run,c_run,...) if trace_testruns then @@ -20605,8 +20626,9 @@ end local nesting=0 local function c_run_single(head,font,attr,lookupcache,step,dataset,sequence,rlmode,handler) local done=false - local start=sweephead[head] - if start then + local sweep=sweephead[head] + if sweep then + start=sweep sweephead[head]=nil else start=head @@ -20632,6 +20654,8 @@ local function c_run_single(head,font,attr,lookupcache,step,dataset,sequence,rlm end elseif char==false then return head,done + elseif sweep then + return head,done else start=getnext(start) end @@ -20696,8 +20720,9 @@ local function k_run_single(sub,injection,last,font,attr,lookupcache,step,datase end local function c_run_multiple(head,font,attr,steps,nofsteps,dataset,sequence,rlmode,handler) local done=false - local start=sweephead[head] - if start then + local sweep=sweephead[head] + if sweep then + start=sweep sweephead[head]=nil else start=head @@ -20734,6 +20759,8 @@ local function c_run_multiple(head,font,attr,steps,nofsteps,dataset,sequence,rlm end elseif char==false then return head,done + elseif sweep then + return head,done else start=getnext(start) end @@ -23867,6 +23894,7 @@ local nodes=nodes local nuts=nodes.nuts local traverse_id=nuts.traverse_id local remove_node=nuts.remove +local free_node=nuts.free local glyph_code=nodes.nodecodes.glyph local disc_code=nodes.nodecodes.disc local tonode=nuts.tonode @@ -23874,11 +23902,13 @@ local tonut=nuts.tonut local getfont=nuts.getfont local getchar=nuts.getchar local getid=nuts.getid +local getboth=nuts.getboth local getprev=nuts.getprev local getnext=nuts.getnext local getdisc=nuts.getdisc local setchar=nuts.setchar local setlink=nuts.setlink +local setprev=nuts.setprev local n_ligaturing=node.ligaturing local n_kerning=node.kerning local ligaturing=nuts.ligaturing @@ -23968,7 +23998,26 @@ function nodes.handlers.nodepass(head) end if redundant then for i=1,#redundant do - remove_node(nuthead,redundant[i],true) + local r=redundant[i] + local p,n=getboth(r) + if r==nuthead then + nuthead=n + setprev(n) + else + setlink(p,n) + end + if b>0 then + for i=1,b do + local bi=basefonts[i] + if r==bi[1] then + bi[1]=n + end + if r==bi[2] then + bi[2]=n + end + end + end + free_node(r) end end for d in traverse_id(disc_code,nuthead) do diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua index f19b9bc..50ac0bd 100644 --- a/src/luaotfload-configuration.lua +++ b/src/luaotfload-configuration.lua @@ -189,13 +189,14 @@ local permissible_color_callbacks = { local default_config = { db = { - formats = "otf,ttf,ttc,dfont", - scan_local = false, - skip_read = false, - strip = true, - update_live = true, - compress = true, - max_fonts = 2^51, + formats = "otf,ttf,ttc,dfont", + scan_local = false, + skip_read = false, + strip = true, + update_live = true, + compress = true, + max_fonts = 2^51, + use_fontforge = false, }, run = { resolver = "cached", @@ -203,7 +204,6 @@ local default_config = { log_level = 0, color_callback = "post_linebreak_filter", fontloader = default_fontloader (), - use_fontforge = false, }, misc = { bisect = false, @@ -377,7 +377,7 @@ local set_fontforge = function () logreport ("log", 4, "db", "Database not present.") return true end - local use_ff = config.luaotfload.run.use_fontforge + local use_ff = config.luaotfload.db.use_fontforge if use_ff == true then if not _G.fontloader then logreport ("both", 0, "db", @@ -500,6 +500,7 @@ local option_spec = { out_t = number_t, --- TODO int_t from 5.3.x on transform = tointeger, }, + use_fontforge = { in_t = boolean_t, }, }, run = { live = { in_t = boolean_t, }, --- false for the tool, true for TeX run @@ -535,7 +536,6 @@ local option_spec = { return id end, }, - use_fontforge = { in_t = boolean_t, }, log_level = { in_t = number_t, out_t = number_t, --- TODO int_t from 5.3.x on @@ -669,13 +669,14 @@ local conf_footer = [==[ local formatters = { db = { - compress = { false, format_boolean }, - formats = { false, format_string }, - max_fonts = { false, format_integer }, - scan_local = { false, format_boolean }, - skip_read = { false, format_boolean }, - strip = { false, format_boolean }, - update_live = { false, format_boolean }, + compress = { false, format_boolean }, + formats = { false, format_string }, + max_fonts = { false, format_integer }, + scan_local = { false, format_boolean }, + skip_read = { false, format_boolean }, + strip = { false, format_boolean }, + update_live = { false, format_boolean }, + use_fontforge = { false, format_boolean }, }, default_features = { __default = { true, format_keyval }, @@ -698,7 +699,6 @@ local formatters = { fontloader = { false, format_string }, log_level = { false, format_integer }, resolver = { false, format_string }, - use_fontforge = { false, format_boolean }, }, } diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua index fd806e0..4944de1 100644 --- a/src/luaotfload-database.lua +++ b/src/luaotfload-database.lua @@ -1437,14 +1437,12 @@ local get_raw_info = function (metadata, basename) local fullname = metadata.fullname local validation_state = metadata.validation_state - if (validation_state and tablecontains (validation_state, "bad_ps_fontname")) - or not fontname - then + if not fontname or not fullname then --- Broken names table, e.g. avkv.ttf with UTF-16 strings; --- we put some dummies in place like the fontloader --- (font-otf.lua) does. logreport ("both", 3, "db", - "%s has invalid postscript font names, using dummies.", + "invalid names table of font %s, using dummies.", basename) fontname = "bad-fontname-" .. basename fullname = "bad-fullname-" .. basename @@ -2955,7 +2953,7 @@ local collect_font_filenames = function () local bisect = config.luaotfload.misc.bisect local max_fonts = config.luaotfload.db.max_fonts --- XXX revisit for lua 5.3 wrt integers - --tableappend (filenames, collect_font_filenames_texmf ()) + tableappend (filenames, collect_font_filenames_texmf ()) tableappend (filenames, collect_font_filenames_system ()) if config.luaotfload.db.scan_local == true then tableappend (filenames, collect_font_filenames_local ()) diff --git a/src/luaotfload-features.lua b/src/luaotfload-features.lua index 250fbc8..9817e0b 100644 --- a/src/luaotfload-features.lua +++ b/src/luaotfload-features.lua @@ -36,12 +36,11 @@ local config = config or { luaotfload = { run = { } } } local as_script = true local normalize = function () end -if config.luaotfload.run.live == true then +if config.luaotfload.run.live ~= false then normalize = handlers.otf.features.normalize as_script = false end - --HH A bit of tuning for definitions. if fonts.constructors then @@ -1247,6 +1246,10 @@ local handle_request = function (specification) --- investigated it any further (luatex-fonts-ext), so it will --- just stay here. specification.features.normal = normalize (request.features) + local subfont = tonumber (specification.sub) + if subfont and subfont >= 0 then + specification.sub = subfont + 1 + end return specification end @@ -1854,12 +1857,18 @@ otf.addfeature = add_otf_feature local install_extra_features = function (data, filename, raw) for feature, specification in next, extrafeatures do + local fontname + local subfont + local metadata = data.metadata + if metadata then + fontname = tostring (data.metadata.fontname) + subfont = tonumber (metadata.subfontindex) + end + if not fontname then fontname = "<unknown>" end + if not subfont then subfont = -1 end logreport ("both", 3, "features", "register synthetic feature “%s” for %s font “%s”(%d)", - feature, - data.format, - tostring (data.metadata and data.metadata.fontname or "<unknown>"), - data.subfont or -1) + feature, data.format, fontname, subfont) otf.features.register { name = feature, description = specification[2] } otf.enhancers.addfeature (data, feature, specification[1]) end diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index 9b8ffc3..4b4dc50 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -267,8 +267,6 @@ Usage: %s [OPTIONS...] -i --info display basic font metadata -I --inspect display detailed font metadata - -w --warnings display warnings generated by the - fontloader library --list=<criterion> output list of entries by field <criterion> --list=<criterion>:<value> restrict to entries with <criterion>=<value> @@ -455,29 +453,6 @@ local show_info_items = function (fontinfo) texiowrite_nl "" end -local p_eol = S"\n\r"^1 -local p_space = S" \t\v"^0 -local p_line = p_space * C((1 - p_eol)^1)^-1 -local p_lines = Ct(p_line * (p_eol^1 * p_line^-1)^0) - -local show_fontloader_warnings = function (ws) - local nws = #ws - print_heading(stringformat( - [[the fontloader emitted %d warnings]], - nws), 2) - texiowrite_nl "" - for i=1, nws do - local w = ws[i] - texiowrite_nl (stringformat("%d:", i)) - local lines = lpegmatch(p_lines, w) - for i=1, #lines do - local line = lines[i] - texiowrite_nl(" · " .. line) - end - texiowrite_nl "" - end -end - local p_spacechar = S" \n\r\t\v" local p_wordchar = (1 - p_spacechar) local p_whitespace = p_spacechar^1 @@ -657,11 +632,8 @@ local display_features = function (features) end end -local show_full_info = function (path, subfont, warnings) +local show_full_info = function (path, subfont) local rawinfo, warn = fonts.handlers.otf.readers.loadfont (path, subfont) - if warnings then - show_fontloader_warnings(warn) - end if not rawinfo then texiowrite_nl(stringformat([[cannot open font %s]], path)) return @@ -694,7 +666,7 @@ The font info knows two levels of detail: returned by readers.loadfont(). --doc]]-- -local show_font_info = function (basename, askedname, detail, warnings) +local show_font_info = function (basename, askedname, detail) local filenames = fonts.names.data().files local index = filenames.base[basename] local fullname = filenames.full[index] @@ -720,7 +692,7 @@ local show_font_info = function (basename, askedname, detail, warnings) if subfont then show_info_items(subfont) if detail == true then - show_full_info(fullname, subfont, warnings) + show_full_info(fullname, subfont) end else -- list all subfonts logreport (true, 1, "resolve", @@ -730,14 +702,14 @@ local show_font_info = function (basename, askedname, detail, warnings) [[Showing info for font no. %d]], n) show_info_items(shortinfo[subfont]) if detail == true then - show_full_info(fullname, subfont, warnings) + show_full_info(fullname, subfont) end end end else show_info_items(shortinfo) if detail == true then - show_full_info(fullname, subfont, warnings) + show_full_info(fullname, subfont) end end else @@ -1212,7 +1184,7 @@ actions.query = function (job) "Resolved file name %q", foundname) end if job.show_info then - show_font_info (foundname, query, job.full_info, job.warnings) + show_font_info (foundname, query, job.full_info) iowrite "\n" end else @@ -1437,7 +1409,6 @@ local process_cmdline = function ( ) -- unit -> jobspec local result = { -- jobspec force_reload = nil, full_info = false, - warnings = false, criterion = "", query = "", log_level = nil, @@ -1478,10 +1449,9 @@ local process_cmdline = function ( ) -- unit -> jobspec update = "u", verbose = 1, version = "V", - warnings = "w", } - local short_options = "bcDfFiIlLnpqRSuvVhw" + local short_options = "bcDfFiIlLnpqRSuvVh" local options, _, optarg = alt_getopt.get_ordered_opts (arg, short_options, long_options) @@ -1513,12 +1483,7 @@ local process_cmdline = function ( ) -- unit -> jobspec if lvl then lvl = tonumber(lvl) result.log_level = lvl - if lvl > 2 then - result.warnings = true - end end - elseif v == "w" then - result.warnings = true elseif v == "log" then local str = optarg[n] if str then diff --git a/src/luaotfload.sty b/src/luaotfload.sty index 7b6d4cf..b6f03af 100644 --- a/src/luaotfload.sty +++ b/src/luaotfload.sty @@ -2,7 +2,7 @@ %% %% by Elie Roux <elie.roux@telecom-bretagne.eu> %% and Khaled Hosny <khaledhosny@eglug.org> -%% and Philipp Gesang <philipp.gesang@alumni.uni-heidelberg.de> +%% and Philipp Gesang <phg@phi-gamma.net> %% and Dohyun Kim <nomosnomos@gmail.com> %% and David Carlisle <d.p.carlisle@gmail.com> %% |