X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=src%2Fltj-jfont.lua;h=87635b95aaec84c3d109b72e1d5fab8d36b21601;hb=dacc55e7f694533f79264530afc2fa2249120bc6;hp=6695eb90c2f12d01248f10c48152b630472139c2;hpb=c5d6a2be5a9a6f7516b03f23db53dbb8ec421d6e;p=luatex-ja%2Fluatexja.git diff --git a/src/ltj-jfont.lua b/src/ltj-jfont.lua index 6695eb9..87635b9 100644 --- a/src/ltj-jfont.lua +++ b/src/ltj-jfont.lua @@ -683,7 +683,9 @@ do local sort = table.sort local function add_fl_table(dest, glyphs, unitable, asc_des, units) - local tg, glyphmin, glyphmax = glyphs.glyphs, glyphs.glyphmin, glyphs.glyphmax + local glyphmin, glyphmax = glyphs.glyphmin, glyphs.glyphmax + if glyphmax < 0 then return dest end + local tg = glyphs.glyphs for i = glyphmin, glyphmax do local gv = tg[i] if gv then @@ -700,7 +702,7 @@ do end if uniq_flag then dest = dest or {}; dest[bu] = dest[bu] or {} - dest[bu][vsel] = unitable[i] + dest[bu][vsel] = unitable[gv.name] end end end @@ -743,33 +745,37 @@ do end prepare_fl_data = function (dest, id) local fl = fontloader.open(id.filename) - local unicodes = {} + local ind_to_uni, unicodes = {}, {} for i,v in pairs(id.characters) do - unicodes[v.index] = i + ind_to_uni[v.index] = i end - if fl.glyphs then local tg, glyphmin, glyphmax = fl.glyphs, fl.glyphmin, fl.glyphmax - for i = glyphmin, glyphmax do - if tg[i] and tg[i].name then unicodes[tg[i].name] = unicodes[i] end - end + if 0 <= glyphmax then + for i = glyphmin, glyphmax do + if tg[i] and tg[i].name then unicodes[tg[i].name] = ind_to_uni[i] end + end + end dest = add_fl_table(dest, fl, unicodes, fl.ascent + fl.descent, fl.units_per_em) end if fl.subfonts then for _,v in pairs(fl.subfonts) do local tg, glyphmin, glyphmax = v.glyphs, v.glyphmin, v.glyphmax - for i = glyphmin, glyphmax do - if tg[i] and tg[i].name then unicodes[tg[i].name] = unicodes[i] end - end - end + if 0 <= glyphmax then + for i = glyphmin, glyphmax do + if tg[i] and tg[i].name then unicodes[tg[i].name] = ind_to_uni[i] end + end + end + end for _,v in pairs(fl.subfonts) do dest = add_fl_table(dest, v, unicodes, fl.ascent + fl.descent, fl.units_per_em) end - end - fontloader.close(fl); collectgarbage("collect") - return dest + end + if dest then dest.unicodes = unicodes end + fontloader.close(fl); collectgarbage("collect") + return dest end -- supply vkern table supply_vkern_table = function(id, bname) @@ -790,7 +796,7 @@ end -- do - local cache_ver = 7 + local cache_ver = 9 local checksum = file.checksum local function prepare_extra_data_base(id)