From 4e14b2da1e3675f3877ada80cd77fa6792127fb9 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 1 May 2013 11:24:37 +0200 Subject: [doc] make examples for XeTeX notation uppercase --- luaotfload.dtx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/luaotfload.dtx b/luaotfload.dtx index 8f7c8a1..dd43990 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -296,7 +296,7 @@ and the derived files % % ::= \{ {\sc all_characters} - `]' \} ; % -% ::= `/', (`i' | `b' | `bi' | `ib') ; +% ::= `/', (`I' | `B' | `BI' | `IB') ; % % ::= `(', \{ {\sc digit} \}, `)' ; % @@ -410,9 +410,9 @@ and the derived files % % \noindent % Currently, four style modifiers are supported: -% \verb|i| for italic shape, -% \verb|b| for bold weight, -% \verb|bi| or \verb|ib| for the combination of both. +% \verb|I| for italic shape, +% \verb|B| for bold weight, +% \verb|BI| or \verb|IB| for the combination of both. % Other “slashed” modifiers are too specific to the \XETEX engine and % have no meaning in \LUATEX. % @@ -510,9 +510,9 @@ and the derived files % % \begin{quote} % \begin{verbatim} -% \font\iwonaitalic =Iwona/i at 20pt -% \font\iwonabold =Iwona/b at 20pt -% \font\iwonabolditalic=Iwona/bi at 20pt +% \font\iwonaitalic =Iwona/I at 20pt +% \font\iwonabold =Iwona/B at 20pt +% \font\iwonabolditalic=Iwona/BI at 20pt % \end{verbatim} % \end{quote} % -- cgit v1.2.3 From fcdbafd0c86fdba0830c7408409f767f0b75b110 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 1 May 2013 11:25:46 +0200 Subject: perform match on other font names if family but not subfamily matches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit preliminary fix for issue #26 here’s an example that works now but either broke (pre-v1.3) or retrieved the wrong shape with ``/B``: \ifdefined\directlua\input luaotfload.sty\fi %% this should be mono bold \font\libertinemono="Linux Libertine Mono O" at 42pt foo {\libertinemono bar} baz\endgraf %% this should be bold, but isn’t \font\myriadbold="Myriad Pro/B" at 42pt foo {\myriadbold bar} baz\endgraf %% this is bold \font\minionbold="Minion Pro/B" at 42pt foo {\minionbold bar} baz\endgraf \bye also, I refactored parts of the matching function for more clarity --- luaotfload-database.lua | 102 ++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/luaotfload-database.lua b/luaotfload-database.lua index f78cc67..aaba55a 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -337,13 +337,6 @@ crude_file_lookup_verbose = function (filename) filename, found[1]) return found end --- found = data.fullnames[filename] --- if found and mappings[found] then --- found = mappings[found].filename[1] --- "crude file lookup: req=%s; hit=bare; ret=%s", --- filename, found[1]) --- return found --- end found = data.basenames[filename] if found and mappings[found] then found = mappings[found].filename @@ -369,7 +362,6 @@ crude_file_lookup = function (filename) local data = names.data local mappings = data.mappings local found = data.barenames[filename] --- or data.fullnames[filename] or data.basenames[filename] if found then found = data.mappings[found] @@ -477,6 +469,27 @@ resolve_cached = function (_, _, specification) return filename, subfont, true end +--- this used to be inlined; with the lookup cache we don’t +--- have to be parsimonious wrt function calls anymore +--- “found” is the match accumulator +local add_to_match = function ( + found, optsize, dsnsize, size, + minsize, maxsize, face) + local continue = true + if optsize then + if dsnsize == size or (size > minsize and size <= maxsize) then + found[1] = face + continue = false ---> break + else + found[#found+1] = face + end + else + found[1] = face + continue = false ---> break + end + return found, continue +end + --[[doc-- Luatex-fonts, the font-loader package luaotfload imports, comes with @@ -585,54 +598,43 @@ resolve = function (_,_,specification) -- the 1st two parameters are used by Con if name == family then if subfamily == style then - if optsize then - if dsnsize == size - or (size > minsize and size <= maxsize) then - found[1] = face - break - else - found[#found+1] = face - end - else - found[1] = face - break - end + local continue + found, continue = add_to_match( + found, optsize, dsnsize, size, + minsize, maxsize, face) + if continue == false then break end elseif synonym_set[style] and synonym_set[style][subfamily] then - if optsize then - if dsnsize == size - or (size > minsize and size <= maxsize) then - found[1] = face - break - else - found[#found+1] = face - end - else - found[1] = face - break - end + local continue + found, continue = add_to_match( + found, optsize, dsnsize, size, + minsize, maxsize, face) + if continue == false then break end elseif subfamily == "regular" or - synonym_set.regular[subfamily] then + synonym_set.regular[subfamily] then found.fallback = face + elseif name == fullname + or name == pfullname + or name == fontname + or name == psname + then + local continue + found, continue = add_to_match( + found, optsize, dsnsize, size, + minsize, maxsize, face) + if continue == false then break end end - end - - if name == fullname - or name == pfullname - or name == fontname - or name == psname then - if optsize then - if dsnsize == size - or (size > minsize and size <= maxsize) then - found[1] = face - break - else - found[#found+1] = face - end - else - found[1] = face - break + else + if name == fullname + or name == pfullname + or name == fontname + or name == psname then + local continue + found, continue = add_to_match( + found, optsize, dsnsize, size, + minsize, maxsize, face) + if continue == false then break end end end end -- cgit v1.2.3