diff options
-rw-r--r-- | filegraph.dot | 20 | ||||
-rw-r--r-- | luaotfload-database.lua | 14 | ||||
-rw-r--r-- | luaotfload-font-afk.lua | 200 | ||||
-rw-r--r-- | luaotfload-loaders.lua | 12 | ||||
-rw-r--r-- | luaotfload-merged.lua | 171 | ||||
-rwxr-xr-x | luaotfload-tool.lua | 4 | ||||
-rw-r--r-- | luaotfload.dtx | 4 | ||||
-rwxr-xr-x | mkstatus | 1 | ||||
-rwxr-xr-x | mktests | 35 |
9 files changed, 214 insertions, 247 deletions
diff --git a/filegraph.dot b/filegraph.dot index 0837032..92506e5 100644 --- a/filegraph.dot +++ b/filegraph.dot @@ -63,8 +63,6 @@ strict digraph luaotfload_files { //looks weird with circo ... luaotfload_libs -> font_names [label="luaotfload-database.lua"] luaotfload_libs -> typo_krn [label="luaotfload-extralibs.lua"] - luaotfload_libs -> font_afk [label="luaotfload-loaders.lua"] - mkstatus -> status [label="generates from distribution files", style=dashed] @@ -149,14 +147,6 @@ strict digraph luaotfload_files { //looks weird with circo ... style = "filled,rounded", penwidth=2] - font_afk [label = "luaotfload-font-afk.lua", - shape = rect, - width = "3.2cm", - height = "1.2cm", - color = "#01012222", - style = "filled,rounded", - penwidth=2] - typo_krn [label = "luaotfload-typo-krn.lua", shape = rect, width = "3.2cm", @@ -274,9 +264,13 @@ strict digraph luaotfload_files { //looks weird with circo ... <tr> <td>luatex-basics-gen.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-fonts-tfm.lua</td> <td>luatex-fonts-chr.lua</td> </tr> - <tr> <td>luatex-fonts-lua.lua</td> <td>luatex-fonts-def.lua</td> </tr> - <tr> <td>luatex-fonts-ext.lua</td> <td>luatex-fonts-cbk.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-def.lua</td> <td>luatex-fonts-ext.lua</td> </tr> + <tr> <td>luatex-fonts-cbk.lua</td> </tr> + + + </table> >, ] diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 9bf6823..755ad52 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -1112,20 +1112,20 @@ find_closest = function (name, limit) local cnames = current.sanitized --[[ This is simplistic but surpisingly fast. - Matching is performed against the “family” name - of a db record. We then store its “fullname” at - it edit distance. + Matching is performed against the “fullname” field + of a db record in preprocessed form. We then store the + raw “fullname” at its edit distance. We should probably do some weighting over all the font name categories as well as whatever agrep does. --]] if cnames then - local fullname, family = cnames.fullname, cnames.family + local fullname, sfullname = current.fullname, cnames.fullname - local dist = cached[family]--- maybe already calculated + local dist = cached[sfullname]--- maybe already calculated if not dist then - dist = iterative_levenshtein(name, family) - cached[family] = dist + dist = iterative_levenshtein(name, sfullname) + cached[sfullname] = dist end local namelst = by_distance[dist] if not namelst then --- first entry diff --git a/luaotfload-font-afk.lua b/luaotfload-font-afk.lua deleted file mode 100644 index 8b65b06..0000000 --- a/luaotfload-font-afk.lua +++ /dev/null @@ -1,200 +0,0 @@ -if not modules then modules = { } end modules ['font-afk'] = { - version = 1.001, - comment = "companion to font-afm.lua", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files", - dataonly = true, -} - ---[[ldx-- -<p>For ligatures, only characters with a code smaller than 128 make sense, -anything larger is encoding dependent. An interesting complication is that a -character can be in an encoding twice but is hashed once.</p> ---ldx]]-- - -local allocate = utilities.storage.allocate - -fonts.handlers.afm.helpdata = { - ligatures = allocate { -- okay, nowadays we could parse the name but type 1 fonts - ['f'] = { -- don't have that many ligatures anyway - { 'f', 'ff' }, - { 'i', 'fi' }, - { 'l', 'fl' }, - }, - ['ff'] = { - { 'i', 'ffi' } - }, - ['fi'] = { - { 'i', 'fii' } - }, - ['fl'] = { - { 'i', 'fli' } - }, - ['s'] = { - { 't', 'st' } - }, - ['i'] = { - { 'j', 'ij' } - }, - }, - texligatures = allocate { - -- ['space'] = { - -- { 'L', 'Lslash' }, - -- { 'l', 'lslash' } - -- }, - -- ['question'] = { - -- { 'quoteleft', 'questiondown' } - -- }, - -- ['exclam'] = { - -- { 'quoteleft', 'exclamdown' } - -- }, - ['quoteleft'] = { - { 'quoteleft', 'quotedblleft' } - }, - ['quoteright'] = { - { 'quoteright', 'quotedblright' } - }, - ['hyphen'] = { - { 'hyphen', 'endash' } - }, - ['endash'] = { - { 'hyphen', 'emdash' } - } - }, - leftkerned = allocate { - AEligature = "A", aeligature = "a", - OEligature = "O", oeligature = "o", - IJligature = "I", ijligature = "i", - AE = "A", ae = "a", - OE = "O", oe = "o", - IJ = "I", ij = "i", - Ssharp = "S", ssharp = "s", - }, - rightkerned = allocate { - AEligature = "E", aeligature = "e", - OEligature = "E", oeligature = "e", - IJligature = "J", ijligature = "j", - AE = "E", ae = "e", - OE = "E", oe = "e", - IJ = "J", ij = "j", - Ssharp = "S", ssharp = "s", - }, - bothkerned = allocate { - Acircumflex = "A", acircumflex = "a", - Ccircumflex = "C", ccircumflex = "c", - Ecircumflex = "E", ecircumflex = "e", - Gcircumflex = "G", gcircumflex = "g", - Hcircumflex = "H", hcircumflex = "h", - Icircumflex = "I", icircumflex = "i", - Jcircumflex = "J", jcircumflex = "j", - Ocircumflex = "O", ocircumflex = "o", - Scircumflex = "S", scircumflex = "s", - Ucircumflex = "U", ucircumflex = "u", - Wcircumflex = "W", wcircumflex = "w", - Ycircumflex = "Y", ycircumflex = "y", - - Agrave = "A", agrave = "a", - Egrave = "E", egrave = "e", - Igrave = "I", igrave = "i", - Ograve = "O", ograve = "o", - Ugrave = "U", ugrave = "u", - Ygrave = "Y", ygrave = "y", - - Atilde = "A", atilde = "a", - Itilde = "I", itilde = "i", - Otilde = "O", otilde = "o", - Utilde = "U", utilde = "u", - Ntilde = "N", ntilde = "n", - - Adiaeresis = "A", adiaeresis = "a", Adieresis = "A", adieresis = "a", - Ediaeresis = "E", ediaeresis = "e", Edieresis = "E", edieresis = "e", - Idiaeresis = "I", idiaeresis = "i", Idieresis = "I", idieresis = "i", - Odiaeresis = "O", odiaeresis = "o", Odieresis = "O", odieresis = "o", - Udiaeresis = "U", udiaeresis = "u", Udieresis = "U", udieresis = "u", - Ydiaeresis = "Y", ydiaeresis = "y", Ydieresis = "Y", ydieresis = "y", - - Aacute = "A", aacute = "a", - Cacute = "C", cacute = "c", - Eacute = "E", eacute = "e", - Iacute = "I", iacute = "i", - Lacute = "L", lacute = "l", - Nacute = "N", nacute = "n", - Oacute = "O", oacute = "o", - Racute = "R", racute = "r", - Sacute = "S", sacute = "s", - Uacute = "U", uacute = "u", - Yacute = "Y", yacute = "y", - Zacute = "Z", zacute = "z", - - Dstroke = "D", dstroke = "d", - Hstroke = "H", hstroke = "h", - Tstroke = "T", tstroke = "t", - - Cdotaccent = "C", cdotaccent = "c", - Edotaccent = "E", edotaccent = "e", - Gdotaccent = "G", gdotaccent = "g", - Idotaccent = "I", idotaccent = "i", - Zdotaccent = "Z", zdotaccent = "z", - - Amacron = "A", amacron = "a", - Emacron = "E", emacron = "e", - Imacron = "I", imacron = "i", - Omacron = "O", omacron = "o", - Umacron = "U", umacron = "u", - - Ccedilla = "C", ccedilla = "c", - Kcedilla = "K", kcedilla = "k", - Lcedilla = "L", lcedilla = "l", - Ncedilla = "N", ncedilla = "n", - Rcedilla = "R", rcedilla = "r", - Scedilla = "S", scedilla = "s", - Tcedilla = "T", tcedilla = "t", - - Ohungarumlaut = "O", ohungarumlaut = "o", - Uhungarumlaut = "U", uhungarumlaut = "u", - - Aogonek = "A", aogonek = "a", - Eogonek = "E", eogonek = "e", - Iogonek = "I", iogonek = "i", - Uogonek = "U", uogonek = "u", - - Aring = "A", aring = "a", - Uring = "U", uring = "u", - - Abreve = "A", abreve = "a", - Ebreve = "E", ebreve = "e", - Gbreve = "G", gbreve = "g", - Ibreve = "I", ibreve = "i", - Obreve = "O", obreve = "o", - Ubreve = "U", ubreve = "u", - - Ccaron = "C", ccaron = "c", - Dcaron = "D", dcaron = "d", - Ecaron = "E", ecaron = "e", - Lcaron = "L", lcaron = "l", - Ncaron = "N", ncaron = "n", - Rcaron = "R", rcaron = "r", - Scaron = "S", scaron = "s", - Tcaron = "T", tcaron = "t", - Zcaron = "Z", zcaron = "z", - - dotlessI = "I", dotlessi = "i", - dotlessJ = "J", dotlessj = "j", - - AEligature = "AE", aeligature = "ae", AE = "AE", ae = "ae", - OEligature = "OE", oeligature = "oe", OE = "OE", oe = "oe", - IJligature = "IJ", ijligature = "ij", IJ = "IJ", ij = "ij", - - Lstroke = "L", lstroke = "l", Lslash = "L", lslash = "l", - Ostroke = "O", ostroke = "o", Oslash = "O", oslash = "o", - - Ssharp = "SS", ssharp = "ss", - - Aumlaut = "A", aumlaut = "a", - Eumlaut = "E", eumlaut = "e", - Iumlaut = "I", iumlaut = "i", - Oumlaut = "O", oumlaut = "o", - Uumlaut = "U", uumlaut = "u", - } -} diff --git a/luaotfload-loaders.lua b/luaotfload-loaders.lua index 20eb277..523dc24 100644 --- a/luaotfload-loaders.lua +++ b/luaotfload-loaders.lua @@ -11,18 +11,6 @@ local readers = fonts.readers local handlers = fonts.handlers local formats = fonts.formats ---[[doc-- - - As of 2013-08-25 AFM support has been included in the fontloader - package. - - We still have to load the font feature definitions (font-afk.lua) to - achieve kerning and ligatures. - ---doc]]-- - -require "luaotfload-font-afk.lua" - local pfb_reader = function (specification) return readers.opentype (specification, "pfb", "type1") end diff --git a/luaotfload-merged.lua b/luaotfload-merged.lua index b39d4a8..649c537 100644 --- a/luaotfload-merged.lua +++ b/luaotfload-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 08/24/13 13:59:18 +-- merge date : 08/26/13 16:41:50 do -- begin closure to overcome local limits and interference @@ -5992,6 +5992,175 @@ end -- closure do -- begin closure to overcome local limits and interference +if not modules then modules={} end modules ['font-afk']={ + version=1.001, + comment="companion to font-afm.lua", + author="Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright="PRAGMA ADE / ConTeXt Development Team", + license="see context related readme files", + dataonly=true, +} +local allocate=utilities.storage.allocate +fonts.handlers.afm.helpdata={ + ligatures=allocate { + ['f']={ + { 'f','ff' }, + { 'i','fi' }, + { 'l','fl' }, + }, + ['ff']={ + { 'i','ffi' } + }, + ['fi']={ + { 'i','fii' } + }, + ['fl']={ + { 'i','fli' } + }, + ['s']={ + { 't','st' } + }, + ['i']={ + { 'j','ij' } + }, + }, + texligatures=allocate { + ['quoteleft']={ + { 'quoteleft','quotedblleft' } + }, + ['quoteright']={ + { 'quoteright','quotedblright' } + }, + ['hyphen']={ + { 'hyphen','endash' } + }, + ['endash']={ + { 'hyphen','emdash' } + } + }, + leftkerned=allocate { + AEligature="A",aeligature="a", + OEligature="O",oeligature="o", + IJligature="I",ijligature="i", + AE="A",ae="a", + OE="O",oe="o", + IJ="I",ij="i", + Ssharp="S",ssharp="s", + }, + rightkerned=allocate { + AEligature="E",aeligature="e", + OEligature="E",oeligature="e", + IJligature="J",ijligature="j", + AE="E",ae="e", + OE="E",oe="e", + IJ="J",ij="j", + Ssharp="S",ssharp="s", + }, + bothkerned=allocate { + Acircumflex="A",acircumflex="a", + Ccircumflex="C",ccircumflex="c", + Ecircumflex="E",ecircumflex="e", + Gcircumflex="G",gcircumflex="g", + Hcircumflex="H",hcircumflex="h", + Icircumflex="I",icircumflex="i", + Jcircumflex="J",jcircumflex="j", + Ocircumflex="O",ocircumflex="o", + Scircumflex="S",scircumflex="s", + Ucircumflex="U",ucircumflex="u", + Wcircumflex="W",wcircumflex="w", + Ycircumflex="Y",ycircumflex="y", + Agrave="A",agrave="a", + Egrave="E",egrave="e", + Igrave="I",igrave="i", + Ograve="O",ograve="o", + Ugrave="U",ugrave="u", + Ygrave="Y",ygrave="y", + Atilde="A",atilde="a", + Itilde="I",itilde="i", + Otilde="O",otilde="o", + Utilde="U",utilde="u", + Ntilde="N",ntilde="n", + Adiaeresis="A",adiaeresis="a",Adieresis="A",adieresis="a", + Ediaeresis="E",ediaeresis="e",Edieresis="E",edieresis="e", + Idiaeresis="I",idiaeresis="i",Idieresis="I",idieresis="i", + Odiaeresis="O",odiaeresis="o",Odieresis="O",odieresis="o", + Udiaeresis="U",udiaeresis="u",Udieresis="U",udieresis="u", + Ydiaeresis="Y",ydiaeresis="y",Ydieresis="Y",ydieresis="y", + Aacute="A",aacute="a", + Cacute="C",cacute="c", + Eacute="E",eacute="e", + Iacute="I",iacute="i", + Lacute="L",lacute="l", + Nacute="N",nacute="n", + Oacute="O",oacute="o", + Racute="R",racute="r", + Sacute="S",sacute="s", + Uacute="U",uacute="u", + Yacute="Y",yacute="y", + Zacute="Z",zacute="z", + Dstroke="D",dstroke="d", + Hstroke="H",hstroke="h", + Tstroke="T",tstroke="t", + Cdotaccent="C",cdotaccent="c", + Edotaccent="E",edotaccent="e", + Gdotaccent="G",gdotaccent="g", + Idotaccent="I",idotaccent="i", + Zdotaccent="Z",zdotaccent="z", + Amacron="A",amacron="a", + Emacron="E",emacron="e", + Imacron="I",imacron="i", + Omacron="O",omacron="o", + Umacron="U",umacron="u", + Ccedilla="C",ccedilla="c", + Kcedilla="K",kcedilla="k", + Lcedilla="L",lcedilla="l", + Ncedilla="N",ncedilla="n", + Rcedilla="R",rcedilla="r", + Scedilla="S",scedilla="s", + Tcedilla="T",tcedilla="t", + Ohungarumlaut="O",ohungarumlaut="o", + Uhungarumlaut="U",uhungarumlaut="u", + Aogonek="A",aogonek="a", + Eogonek="E",eogonek="e", + Iogonek="I",iogonek="i", + Uogonek="U",uogonek="u", + Aring="A",aring="a", + Uring="U",uring="u", + Abreve="A",abreve="a", + Ebreve="E",ebreve="e", + Gbreve="G",gbreve="g", + Ibreve="I",ibreve="i", + Obreve="O",obreve="o", + Ubreve="U",ubreve="u", + Ccaron="C",ccaron="c", + Dcaron="D",dcaron="d", + Ecaron="E",ecaron="e", + Lcaron="L",lcaron="l", + Ncaron="N",ncaron="n", + Rcaron="R",rcaron="r", + Scaron="S",scaron="s", + Tcaron="T",tcaron="t", + Zcaron="Z",zcaron="z", + dotlessI="I",dotlessi="i", + dotlessJ="J",dotlessj="j", + AEligature="AE",aeligature="ae",AE="AE",ae="ae", + OEligature="OE",oeligature="oe",OE="OE",oe="oe", + IJligature="IJ",ijligature="ij",IJ="IJ",ij="ij", + Lstroke="L",lstroke="l",Lslash="L",lslash="l", + Ostroke="O",ostroke="o",Oslash="O",oslash="o", + Ssharp="SS",ssharp="ss", + Aumlaut="A",aumlaut="a", + Eumlaut="E",eumlaut="e", + Iumlaut="I",iumlaut="i", + Oumlaut="O",oumlaut="o", + Uumlaut="U",uumlaut="u", + } +} + +end -- closure + +do -- begin closure to overcome local limits and interference + if not modules then modules={} end modules ['luatex-fonts-tfm']={ version=1.001, comment="companion to luatex-*.tex", diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua index faa5f10..c4670e8 100755 --- a/luaotfload-tool.lua +++ b/luaotfload-tool.lua @@ -859,7 +859,9 @@ actions.query = function (job) end else logs.names_report(false, 0, - "resolve", "Cannot find %q.", query) + "resolve", "Cannot find %q in index.", query) + logs.names_report(false, 0, + "resolve", "Hint: use the --fuzzy option to display suggestions.", query) if job.fuzzy == true then logs.names_report(false, 0, "resolve", "Looking for close matches, this may take a while ...") diff --git a/luaotfload.dtx b/luaotfload.dtx index 622c902..d1ed313 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -1217,10 +1217,6 @@ and the derived files % Context libraries. % \ouritem {luaotfload-letterspace.lua} font-based letterspacing. % \ouritem {luaotfload-typo-krn.lua} attribute-based letterspacing. -% \ouritem {luaotfload-font-afk.lua} supplementary glyph -% information for \abbrev{afm} -% fonts (enables ligatures -% and kerning). % \end{itemize} % % \begin{figure}[b] @@ -42,7 +42,6 @@ local names = { "luaotfload-diagnostics.lua", "luaotfload-extralibs.lua", "luaotfload-features.lua", - "luaotfload-font-afk.lua", "luaotfload-fonts-cbk.lua", "luaotfload-fonts-def.lua", "luaotfload-fonts-enc.lua", @@ -5,8 +5,8 @@ -- DESCRIPTION: test the behavior of Luaotfload -- REQUIREMENTS: Luatex > 0.76, Luaotfload -- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com> --- VERSION: 2.3 --- CREATED: 2013-07-11 11:32:24+0200 +-- VERSION: 2.4 +-- MODIFIED: 2013-08-26 09:31:22+0200 ----------------------------------------------------------------------- -- --===================================================================-- @@ -58,9 +58,10 @@ local pprint_result = function (name, failed, total) end local pprint_spec = function (spec) - return string.format ("%s*%.2fpt", + return string.format ("%s/%s*%.2fpt", spec.specification, - spec.optsize) + spec.style or "regular", + spec.optsize or 0) end ----------------------------------------------------------------------- @@ -72,9 +73,10 @@ end local infer_regular_style = { --- inferring which one is the correct style for “regular”; can be --- obscured by synonyms like “book” etc. - { "Iwona", "Iwona-Regular.otf" }, -- trivial case - { "DejaVu Serif", "DejaVuSerif.ttf" }, - { "Adobe Garamond Pro", "agaramondpro_regular.otf" }, + { "Iwona", "Iwona-Regular.otf" }, -- trivial case + { "DejaVu Serif", "DejaVuSerif.ttf" }, + { "DejaVu Sans", "DejaVuSans.ttf" }, + { "Adobe Garamond Pro", "agaramondpro_regular.otf" }, { "Garamond Premier Pro", "GaramondPremrPro-Capt.otf" }, } @@ -93,9 +95,27 @@ local choose_optical_size = { { { name = "Garamond Premier Pro", optsize = 42 }, "GaramondPremrPro-Disp.otf" }, } +--- this needs a database built with --formats=+pfa,pfb,afm + +local resolve_t1_font = { + { { name = "URW Gothic L", style = "regular" }, "uagk8a.pfb" }, + { { name = "URW Gothic L", style = "italic" }, "uagko8a.pfb" }, + { { name = "URW Gothic L", style = "bold" }, "uagd8a.pfb" }, + { { name = "URW Gothic L", style = "bolditalic" }, "uagdo8a.pfb" }, + { { name = "Century Schoolbook L", style = "regular" }, "uncr8a.pfb" }, + { { name = "Century Schoolbook L", style = "italic" }, "uncri8a.pfb" }, + { { name = "Century Schoolbook L", style = "bold" }, "uncb8a.pfb" }, + { { name = "Century Schoolbook L", style = "bolditalic" }, "uncbi8a.pfb" }, + { { name = "Nimbus Roman No9 L", style = "regular" }, "utmr8a.pfb" }, + { { name = "Nimbus Roman No9 L", style = "italic" }, "utmri8a.pfb" }, + { { name = "Nimbus Roman No9 L", style = "bold" }, "utmb8a.pfb" }, --- medium, actually + { { name = "Nimbus Roman No9 L", style = "bolditalic" }, "utmbi8a.pfb" }, +} + local font_name_tests = { infer_regular_style, choose_optical_size, + resolve_t1_font, } local default_spec = { @@ -132,7 +152,6 @@ local resolve_font_name = function () or default_spec.lookup) .. ":" .. input_spec.name input_spec.optsize = input_spec.optsize or default_spec.optsize - --print( resolve_name (nil, nil, input_spec) ) local result = resolve_name (nil, nil, input_spec) == output total = total + 1 if not result then |