diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2010-04-01 22:59:58 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2010-04-01 23:03:27 +0200 |
commit | 868e6b8d73fc2e9d75d39507ff261c7b34b78002 (patch) | |
tree | 9a883e51dd44257b32644e741f0f6c35483d1279 | |
parent | aefd8aafbae9531277b95e775b25a257e02a19ef (diff) | |
download | luaotfload-868e6b8d73fc2e9d75d39507ff261c7b34b78002.tar.gz |
Support loading fonts by fullname
Now, if we didn't find a matching family name, we then try fullname.
-rw-r--r-- | otfl-font-nms.lua | 31 | ||||
-rw-r--r-- | tests/fullname.tex | 7 |
2 files changed, 22 insertions, 16 deletions
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua index a54724c..3cedaa2 100644 --- a/otfl-font-nms.lua +++ b/otfl-font-nms.lua @@ -84,14 +84,12 @@ function names.resolve(specification) if subfamily == style then if optsize then if dsnsize == rqssize or (rqssize > minsize and rqssize <= maxsize) then - found = filename - logs.report("load font", "font family='%s', subfamily='%s' found: %s", name, style, found) - break + logs.report("load font", "font family='%s', subfamily='%s' found: %s", name, style, filename) + return filename, false end else - found = filename - logs.report("load font", "font family='%s', subfamily='%s' found: %s", name, style, found) - break + logs.report("load font", "font family='%s', subfamily='%s' found: %s", name, style, filename) + return filename, false end else if synonyms[style] then @@ -99,14 +97,12 @@ function names.resolve(specification) if subfamily == v then if optsize then if dsnsize == rqssize or (rqssize > minsize and rqssize <= maxsize) then - found = filename - logs.report("load font", "font family='%s', subfamily='%s' found: %s", name, style, found) - break + logs.report("load font", "font family='%s', subfamily='%s' found: %s", name, style, filename) + return filename, false end else - found = filename - logs.report("load font", "font family='%s', subfamily='%s' found: %s", name, style, found) - break + logs.report("load font", "font family='%s', subfamily='%s' found: %s", name, style, filename) + return filename, false end end end @@ -114,12 +110,15 @@ function names.resolve(specification) end end end - if found then - return found, false - else - return name, false -- fallback to filename + else + for i,v in ipairs(data.mappings) do + if sanitize(v.fullname) == sanitize(name) or sanitize(v.names.fullname) == sanitize(name) then + logs.report("load font", "font fullname='%s' found: %s", name, v.filename) + return v.filename, false + end end end + return name, false -- fallback to filename end else logs.report("load font", "no font names database loaded") diff --git a/tests/fullname.tex b/tests/fullname.tex new file mode 100644 index 0000000..ec73cb3 --- /dev/null +++ b/tests/fullname.tex @@ -0,0 +1,7 @@ +\input luaotfload.sty + +\font\testa={LM Roman Slanted 10 Regular} at 10pt +\font\testb={LM Roman 9 Italic} at 10pt +\testa abcd ABCD\par +\testb abcd ABCD\par +\bye |