diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-03 05:44:46 -0700 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-03 05:44:46 -0700 |
commit | 42b334a51fde9a8f93f4da3b10d2917c213d3b70 (patch) | |
tree | 27df2d2f1bee98c36731d219bf7e3535aef218f8 | |
parent | eb4fdd2afe34627abece6f75187a2cd691bcf6db (diff) | |
parent | 8c5fb4b380191aefd6ddc0fcb738b24f740f4496 (diff) | |
download | luaotfload-42b334a51fde9a8f93f4da3b10d2917c213d3b70.tar.gz |
Merge pull request #5 from lualatex/master
modifications by Élie
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | luaotfload-auxiliary.lua | 25 | ||||
-rw-r--r-- | tests/pln-aux-1.tex | 8 |
3 files changed, 11 insertions, 24 deletions
@@ -3,7 +3,7 @@ NAME = luaotfload DOC = $(NAME).pdf DTX = $(NAME).dtx -OTFL = $(wildcard otfl-*.lua) otfl-blacklist.cnf font-age.lua +OTFL = $(wildcard luaotfload-*.lua) luaotfload-blacklist.cnf SCRIPT = luaotfload-tool.lua GLYPHSCRIPT = mkglyphlist diff --git a/luaotfload-auxiliary.lua b/luaotfload-auxiliary.lua index 2cf1e00..844c170 100644 --- a/luaotfload-auxiliary.lua +++ b/luaotfload-auxiliary.lua @@ -155,25 +155,6 @@ end aux.font_has_glyph = font_has_glyph ---- int -> bool -local current_font_has_glyph = function (codepoint) - return font_has_glyph (font.current(), codepoint) -end - -aux.current_font_has_glyph = current_font_has_glyph - -local do_if_glyph_else = function (chr, positive, negative) - local codepoint = tonumber(chr) - if not codepoint then codepoint = utf8.byte(chr) end - if current_font_has_glyph(codepoint) then - tex.sprint(positive) - else - tex.sprint(negative) - end -end - -aux.do_if_glyph_else = do_if_glyph_else - --[[doc-- This one is approximately “name_to_slot” from the microtype package; @@ -184,9 +165,9 @@ aux.do_if_glyph_else = do_if_glyph_else --doc]]-- ---- string -> (int | false) -local slot_of_name = function (glyphname) - local fontdata = identifiers[font.current()] +--- int -> string -> (int | false) +local slot_of_name = function (font_id, glyphname) + local fontdata = identifiers[font_id] if fontdata then local unicode = fontdata.resources.unicodes[glyphname] if unicode and type(unicode) == "number" then diff --git a/tests/pln-aux-1.tex b/tests/pln-aux-1.tex index a504850..a228be0 100644 --- a/tests/pln-aux-1.tex +++ b/tests/pln-aux-1.tex @@ -12,7 +12,13 @@ %% wrap tests in macros (could move to style file) \def\doifglyphelse#1#2#3{% \directlua{ - luaotfload.aux.do_if_glyph_else([[#1]], [[#2]], [[#3]]) + local codepoint = tonumber('\string#1') + if not codepoint then codepoint = unicode.utf8.byte('\string#1') end + if luaotfload.aux.font_has_glyph(font.current(), codepoint) then + tex.sprint('\string#2') + else + tex.sprint('\string#3') + end }% } |