summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-05-02 12:34:41 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-05-02 12:34:41 +0200
commiteb4fdd2afe34627abece6f75187a2cd691bcf6db (patch)
treeb70a6b21034ce00c7b741329f4b5b50a29ef9e26
parent8929aa8fddc54b831cf6400c6553a393f767e0b8 (diff)
downloadluaotfload-eb4fdd2afe34627abece6f75187a2cd691bcf6db.tar.gz
use “slots” instead of “codepoints” in auxlib
-rw-r--r--luaotfload-auxiliary.lua32
-rw-r--r--tests/pln-aux-4.tex9
2 files changed, 29 insertions, 12 deletions
diff --git a/luaotfload-auxiliary.lua b/luaotfload-auxiliary.lua
index f7886be..2cf1e00 100644
--- a/luaotfload-auxiliary.lua
+++ b/luaotfload-auxiliary.lua
@@ -174,31 +174,47 @@ end
aux.do_if_glyph_else = do_if_glyph_else
---- this one is approximately “name_to_slot” from the microtype
---- package
+--[[doc--
+
+ This one is approximately “name_to_slot” from the microtype package;
+ note that it is all about Adobe Glyph names and glyph slots in the
+ font. The names and values may diverge from actual Unicode.
+
+ http://www.adobe.com/devnet/opentype/archives/glyph.html
+
+--doc]]--
--- string -> (int | false)
-local codepoint_of_name = function (glyphname)
+local slot_of_name = function (glyphname)
local fontdata = identifiers[font.current()]
if fontdata then
local unicode = fontdata.resources.unicodes[glyphname]
if unicode and type(unicode) == "number" then
return unicode
else
- return unicode[1] --- again, does that even happen?
+ return unicode[1] --- for multiple components
end
end
return false
end
-aux.codepoint_of_name = codepoint_of_name
+aux.slot_of_name = slot_of_name
---- inverse of above
+--[[doc--
+
+ Inverse of above; not authoritative as to my knowledge the official
+ inverse of the AGL is the AGLFN. Maybe this whole issue should be
+ dealt with in a separate package that loads char-def.lua and thereby
+ solves the problem for the next couple decades.
+
+ http://partners.adobe.com/public/developer/en/opentype/aglfn13.txt
+
+--doc]]--
local indices
--- int -> (string | false)
-local name_of_codepoint = function (codepoint)
+local name_of_slot = function (codepoint)
if not indices then --- this will load the glyph list
local unicodes = fonts.encodings.agl.unicodes
indices = table.swapped(unicodes)
@@ -210,7 +226,7 @@ local name_of_codepoint = function (codepoint)
return false
end
-aux.name_of_codepoint = name_of_codepoint
+aux.name_of_slot = name_of_slot
-----------------------------------------------------------------------
--- features / scripts / languages
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]])