diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2014-12-22 17:24:25 +0100 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2014-12-22 17:24:25 +0100 |
commit | b966e35c9df3cca2a25baaf68574d0b8d94eef39 (patch) | |
tree | 299468068c249d5e8edf663687b3d17c35bc342c /src/fontloader/misc/fontloader-font-otf.lua | |
parent | 747e6fb2c41045add6a799498026ff0d2ddf115b (diff) | |
parent | 3a5009d6feedc1a4c4e5a8d61c7e67b9c35399fa (diff) | |
download | luaotfload-b966e35c9df3cca2a25baaf68574d0b8d94eef39.tar.gz |
Merge pull request #262 from phi-gamma/master
[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.lua | 33 |
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 |