summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--otfl-font-nms.lua42
-rw-r--r--tests/fontconfig_conf_reading.tex5
2 files changed, 20 insertions, 27 deletions
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index a5cdbb1..fa9edca 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -154,29 +154,23 @@ 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
- 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
@@ -362,9 +356,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
@@ -375,10 +367,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
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