summaryrefslogtreecommitdiff
path: root/src/fontloader/misc/fontloader-font-otf.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-12-22 16:42:02 +0100
committerPhilipp Gesang <phg42.2a@gmail.com>2014-12-22 16:42:02 +0100
commit3a5009d6feedc1a4c4e5a8d61c7e67b9c35399fa (patch)
tree299468068c249d5e8edf663687b3d17c35bc342c /src/fontloader/misc/fontloader-font-otf.lua
parentd2a1af0a62a2540c8b88345b8d1e84ba61a8a49f (diff)
downloadluaotfload-3a5009d6feedc1a4c4e5a8d61c7e67b9c35399fa.tar.gz
[fontloader] sync with Context as of 2014-12-22
Diffstat (limited to 'src/fontloader/misc/fontloader-font-otf.lua')
-rw-r--r--src/fontloader/misc/fontloader-font-otf.lua33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/fontloader/misc/fontloader-font-otf.lua b/src/fontloader/misc/fontloader-font-otf.lua
index 302d8ea..1bb608f 100644
--- a/src/fontloader/misc/fontloader-font-otf.lua
+++ b/src/fontloader/misc/fontloader-font-otf.lua
@@ -2000,6 +2000,8 @@ actions["reorganize glyph lookups"] = function(data,filename,raw)
end
+local zero = { 0, 0 }
+
actions["reorganize glyph anchors"] = function(data,filename,raw) -- when we replace inplace we safe entries
local descriptions = data.descriptions
for unicode, description in next, descriptions do
@@ -2008,14 +2010,37 @@ actions["reorganize glyph anchors"] = function(data,filename,raw) -- when we rep
for class, data in next, anchors do
if class == "baselig" then
for tag, specification in next, data do
- for i=1,#specification do
- local si = specification[i]
- specification[i] = { si.x or 0, si.y or 0 }
+ -- for i=1,#specification do
+ -- local si = specification[i]
+ -- specification[i] = { si.x or 0, si.y or 0 }
+ -- end
+ -- can be sparse so we need to fill the holes
+ local n = 0
+ for k, v in next, specification do
+ if k > n then
+ n = k
+ end
+ local x, y = v.x, v.y
+ if x or y then
+ specification[k] = { x or 0, y or 0 }
+ else
+ specification[k] = zero
+ end
end
+ local t = { }
+ for i=1,n do
+ t[i] = specification[i] or zero
+ end
+ data[tag] = t -- so # is okay (nicer for packer)
end
else
for tag, specification in next, data do
- data[tag] = { specification.x or 0, specification.y or 0 }
+ local x, y = specification.x, specification.y
+ if x or y then
+ data[tag] = { x or 0, y or 0 }
+ else
+ data[tag] = zero
+ end
end
end
end