- local t = fontloader.info(id.filename)
- if not t then return dest end
- local fl
- if t.fontname then
- fl = fontloader.open(id.filename)
- else
- fl = fontloader.open(id.filename, id.fontname) -- マニュアルにはこっちで書いてあるが?
- if not fl then
- local index
- for i,v in ipairs(t) do
- if v.fontname == id.fontname then index=i; break end
- end
- fl = fontloader.open(id.filename, index)
- end
- end
- if not fl then fontloader.close(fl); return dest end
- local ind_to_uni, unicodes = {}, {}
- for i,v in pairs(id.characters) do
- ind_to_uni[v.index] = i
- end
- if fl.glyphs then
- local tg, glyphmin, glyphmax = fl.glyphs, fl.glyphmin, fl.glyphmax
- 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, id)
- end
- if fl.subfonts then
- for _,v in pairs(fl.subfonts) do
- local tg, glyphmin, glyphmax = v.glyphs, v.glyphmin, v.glyphmax
- 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, id)
- end