diff options
Diffstat (limited to 'src/fontloader/misc/fontloader-font-oup.lua')
-rw-r--r-- | src/fontloader/misc/fontloader-font-oup.lua | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/src/fontloader/misc/fontloader-font-oup.lua b/src/fontloader/misc/fontloader-font-oup.lua index 3b6d8ea..e2d209a 100644 --- a/src/fontloader/misc/fontloader-font-oup.lua +++ b/src/fontloader/misc/fontloader-font-oup.lua @@ -586,7 +586,8 @@ local function checklookups(fontdata,missing,nofmissing) local done = { } for i, r in next, missing do if r then - local name = descriptions[i].name or f_index(i) + local data = descriptions[i] + local name = data and data.name or f_index(i) if not ignore[name] then done[name] = true end @@ -706,6 +707,19 @@ local function unifyglyphs(fontdata,usenames) end end -- + local colorpalettes = resources.colorpalettes + if colorpalettes then + for index=1,#glyphs do + local colors = glyphs[index].colors + if colors then + for i=1,#colors do + local c = colors[i] + c.slot = indices[c.slot] + end + end + end + end + -- fontdata.private = private fontdata.glyphs = nil fontdata.names = names @@ -1158,6 +1172,7 @@ function readers.pack(data) local sequences = resources.sequences local sublookups = resources.sublookups local features = resources.features + local palettes = resources.colorpalettes local chardata = characters and characters.data local descriptions = data.descriptions or data.glyphs @@ -1190,6 +1205,14 @@ function readers.pack(data) end end end + -- if palettes then + -- local color = description.color + -- if color then + -- for i=1,#color do + -- color[i] = pack_normal(color[i]) + -- end + -- end + -- end end local function packthem(sequences) @@ -1314,6 +1337,16 @@ function readers.pack(data) end end + if palettes then + for i=1,#palettes do + local p = palettes[i] + for j=1,#p do + p[j] = pack_indexed(p[j]) + end + end + + end + if not success(1,pass) then return end @@ -1461,6 +1494,7 @@ function readers.unpack(data) local sequences = resources.sequences local sublookups = resources.sublookups local features = resources.features + local palettes = resources.colorpalettes local unpacked = { } setmetatable(unpacked,unpacked_mt) for unicode, description in next, descriptions do @@ -1487,6 +1521,17 @@ function readers.unpack(data) end end end + -- if palettes then + -- local color = description.color + -- if color then + -- for i=1,#color do + -- local tv = tables[color[i]] + -- if tv then + -- color[i] = tv + -- end + -- end + -- end + -- end end local function unpackthem(sequences) @@ -1716,6 +1761,18 @@ function readers.unpack(data) end end + if palettes then + for i=1,#palettes do + local p = palettes[i] + for j=1,#p do + local tv = tables[p[j]] + if tv then + p[j] = tv + end + end + end + end + data.tables = nil end end |