From b733e149bb606d57499115e90318b00c6fe19bc3 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 25 Apr 2013 14:41:10 +0200 Subject: remove unnecessary table indexing --- otfl-font-nms.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua index 50febab..b5c954d 100644 --- a/otfl-font-nms.lua +++ b/otfl-font-nms.lua @@ -154,6 +154,9 @@ function names.resolve(specification) elseif subfamily == "regular" or table.contains(synonyms.regular, subfamily) then found.fallback = face + elseif name = fullname then + found[1] = face + break end else if name == fullname @@ -357,9 +360,7 @@ local function load_font(filename, fontnames, newfontnames, texmf) return end local index = newstatus[basefile].index[i] - if newstatus[basefile].index[i] then - index = newstatus[basefile].index[i] - else + if not index then index = #newmappings+1 end newmappings[index] = fullinfo -- cgit v1.2.3 From 3a2b6eac9022524baab2d52ce9ba4aef819bd574 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 25 Apr 2013 14:54:07 +0200 Subject: remove another indexing duplication --- otfl-font-nms.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua index b5c954d..1f01693 100644 --- a/otfl-font-nms.lua +++ b/otfl-font-nms.lua @@ -371,10 +371,8 @@ local function load_font(filename, fontnames, newfontnames, texmf) if not fullinfo then return end - local index - if newstatus[basefile].index[1] then - index = newstatus[basefile].index[1] - else + local index = newstatus[basefile].index[1] + if not index then index = #newmappings+1 end newmappings[index] = fullinfo -- cgit v1.2.3 From 335446c44d46742513adf300e0066c4c4c36f623 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 25 Apr 2013 17:15:20 +0200 Subject: catch more odd subfamily strings --- otfl-font-nms.lua | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua index 1f01693..84cdf6e 100644 --- a/otfl-font-nms.lua +++ b/otfl-font-nms.lua @@ -154,27 +154,23 @@ function names.resolve(specification) elseif subfamily == "regular" or table.contains(synonyms.regular, subfamily) then found.fallback = face - elseif name = fullname then - found[1] = face - break end - else - 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 + 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 end end end -- cgit v1.2.3 From d12e5fa0d984a1716e10b6e9c88cf6d72412fc86 Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Thu, 25 Apr 2013 19:07:12 +0200 Subject: Reverting 6e65f027e185854a18375892bea2c76a84fa42ca, duplicate of 335446c44d46742513adf300e0066c4c4c36f623 --- otfl-font-nms.lua | 5 ----- 1 file changed, 5 deletions(-) diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua index e653d13..fa9edca 100644 --- a/otfl-font-nms.lua +++ b/otfl-font-nms.lua @@ -154,11 +154,6 @@ function names.resolve(specification) elseif subfamily == "regular" or table.contains(synonyms.regular, subfamily) then found.fallback = face - elseif name == fullname then - --- guard for Libertine Mono which has - --- subtype == “mono” - found[1] = face - break end end if name == fullname -- cgit v1.2.3 From 40266a4203c86d5a85dfaf9e471b7b8d54033bec Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 26 Apr 2013 00:53:39 +0200 Subject: fix fontconfig test --- tests/fontconfig_conf_reading.tex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/fontconfig_conf_reading.tex b/tests/fontconfig_conf_reading.tex index dbbbc3c..7ffda02 100644 --- a/tests/fontconfig_conf_reading.tex +++ b/tests/fontconfig_conf_reading.tex @@ -1,6 +1,9 @@ \directlua{ require("lualibs") require("otfl-font-nms.lua") -texio.write_nl(table.serialize(fonts.names.read_fonts_conf("fonts.conf.test", {}))) +local res = fonts.names.read_fonts_conf("fonts.conf.test", {}, {}) +if res then + texio.write_nl(table.serialize(res)) +end } \bye -- cgit v1.2.3