diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-01 21:08:07 +0200 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-01 21:08:07 +0200 |
commit | c0f5ff48cd1685b69bc7570ff4fb98bea7142993 (patch) | |
tree | e5cbd0e6abaaecd8b1677322eb99735a35212e41 /tests/pln-aux-4.tex | |
parent | b5e475547fbd9cc6f9f9fe883f6ccd05d277b081 (diff) | |
download | luaotfload-c0f5ff48cd1685b69bc7570ff4fb98bea7142993.tar.gz |
add glyph name <-> codepoint resolver
Diffstat (limited to 'tests/pln-aux-4.tex')
-rw-r--r-- | tests/pln-aux-4.tex | 40 |
1 files changed, 40 insertions, 0 deletions
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 |