From c0f5ff48cd1685b69bc7570ff4fb98bea7142993 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 1 May 2013 21:08:07 +0200 Subject: add glyph name <-> codepoint resolver --- tests/pln-aux-4.tex | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/pln-aux-4.tex (limited to 'tests/pln-aux-4.tex') diff --git a/tests/pln-aux-4.tex b/tests/pln-aux-4.tex new file mode 100644 index 0000000..b025561 --- /dev/null +++ b/tests/pln-aux-4.tex @@ -0,0 +1,40 @@ +\input luaotfload.sty + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% unicode character mappings +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\font\ptserifregular = file:PTF55F.ttf \ptserifregular + +%% here we map the function luaotfload.aux.name_of_codepoint +%% on a short text, printing a list of letters, their codepoints +%% and names (as specified in the Adobe Glyph List). + +\directlua{ + local aux = luaotfload.aux + local cbk = function (str) + if string.match(str, "^EOF") then + luatexbase.remove_from_callback("process_input_buffer", "weird") + return [[the end!]] + end + local res = { } + for chr in string.utfcharacters(str) do + local val = unicode.utf8.byte(chr) + local line = chr .. " <> " .. tostring(val) + line = line .. " <> " .. (aux.name_of_codepoint(val) or "") + res[\string#res+1] = line + end + return table.concat(res, [[\endgraf]]) + end + + luatexbase.add_to_callback("process_input_buffer", cbk, "weird") +} + +Я узнал что у меня +Есть огромная семья +И тропинка и лесок +В поле каждый колосок + +EOF + +\bye -- cgit v1.2.3 From eb4fdd2afe34627abece6f75187a2cd691bcf6db Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 2 May 2013 12:34:41 +0200 Subject: =?UTF-8?q?use=20=E2=80=9Cslots=E2=80=9D=20instead=20of=20?= =?UTF-8?q?=E2=80=9Ccodepoints=E2=80=9D=20in=20auxlib?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/pln-aux-4.tex | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests/pln-aux-4.tex') diff --git a/tests/pln-aux-4.tex b/tests/pln-aux-4.tex index b025561..80ffc0b 100644 --- a/tests/pln-aux-4.tex +++ b/tests/pln-aux-4.tex @@ -6,9 +6,10 @@ \font\ptserifregular = file:PTF55F.ttf \ptserifregular -%% here we map the function luaotfload.aux.name_of_codepoint -%% on a short text, printing a list of letters, their codepoints -%% and names (as specified in the Adobe Glyph List). +%% here we map the function luaotfload.aux.name_of_slot +%% on a short text, printing a list of letters, their +%% code points and names (as specified in the Adobe +%% Glyph List). \directlua{ local aux = luaotfload.aux @@ -21,7 +22,7 @@ for chr in string.utfcharacters(str) do local val = unicode.utf8.byte(chr) local line = chr .. " <> " .. tostring(val) - line = line .. " <> " .. (aux.name_of_codepoint(val) or "") + line = line .. " <> " .. (aux.name_of_slot(val) or "") res[\string#res+1] = line end return table.concat(res, [[\endgraf]]) -- cgit v1.2.3