ソースコードの管理場所
Revision | c5d6a2be5a9a6f7516b03f23db53dbb8ec421d6e (tree) |
---|---|
Time | 2016-05-04 05:53:06 |
Author | Hironori Kitagawa <h_kitagawa2001@yaho...> |
Commiter | Hironori Kitagawa |
ltj-otf.lua: fix for luaotfload v2.7(?)
@@ -683,11 +683,8 @@ do | ||
683 | 683 | |
684 | 684 | local sort = table.sort |
685 | 685 | local function add_fl_table(dest, glyphs, unitable, asc_des, units) |
686 | - local tg, glyphmin, glyphmax = glyphs.glyphs, 0, glyphs.glyphmax | |
687 | - for _,v in pairs(fields(glyphs)) do | |
688 | - if v=='glyphmin' then glyphmin, glyphmax = glyphs.glyphmin, glyphmax+1; break end | |
689 | - end | |
690 | - for i = glyphmin, glyphmax-1 do | |
686 | + local tg, glyphmin, glyphmax = glyphs.glyphs, glyphs.glyphmin, glyphs.glyphmax | |
687 | + for i = glyphmin, glyphmax do | |
691 | 688 | local gv = tg[i] |
692 | 689 | if gv then |
693 | 690 | if gv.altuni then |
@@ -695,20 +692,22 @@ do | ||
695 | 692 | local bu, vsel = at.unicode, at.variant |
696 | 693 | if vsel then |
697 | 694 | if vsel>=0xE0100 then vsel = vsel - 0xE0100 end |
698 | - dest = dest or {}; dest[bu] = dest[bu] or {} | |
699 | 695 | local uniq_flag = true |
700 | - for i,_ in pairs(dest[bu]) do | |
701 | - if i==vs then uniq_flag = false; break end | |
702 | - end | |
696 | + if dest and dest[bu] then | |
697 | + for i,_ in pairs(dest[bu]) do | |
698 | + if i==vsel then uniq_flag = false; break end | |
699 | + end | |
700 | + end | |
703 | 701 | if uniq_flag then |
704 | - dest[bu][vsel] = unitable[gv.name] | |
702 | + dest = dest or {}; dest[bu] = dest[bu] or {} | |
703 | + dest[bu][vsel] = unitable[i] | |
705 | 704 | end |
706 | 705 | end |
707 | 706 | end |
708 | 707 | end |
709 | 708 | -- vertical metric |
710 | 709 | local vw, tsb, vk = glyph_vmetric(gv) |
711 | - local gi = unitable[gv.name] | |
710 | + local gi = unitable[i] | |
712 | 711 | if gi and vw and vw~=asc_des then |
713 | 712 | -- We do not use tsidebearing, since (1) fontloader does not read VORG table |
714 | 713 | -- and (2) 'tsidebearing' doea not appear in the returned table by fontloader.fields. |
@@ -744,13 +743,27 @@ do | ||
744 | 743 | end |
745 | 744 | prepare_fl_data = function (dest, id) |
746 | 745 | local fl = fontloader.open(id.filename) |
747 | - local unicodes = id.resources.unicodes | |
746 | + local unicodes = {} | |
747 | + for i,v in pairs(id.characters) do | |
748 | + unicodes[v.index] = i | |
749 | + end | |
750 | + | |
748 | 751 | if fl.glyphs then |
752 | + local tg, glyphmin, glyphmax = fl.glyphs, fl.glyphmin, fl.glyphmax | |
753 | + for i = glyphmin, glyphmax do | |
754 | + if tg[i] and tg[i].name then unicodes[tg[i].name] = unicodes[i] end | |
755 | + end | |
749 | 756 | dest = add_fl_table(dest, fl, unicodes, |
750 | 757 | fl.ascent + fl.descent, fl.units_per_em) |
751 | 758 | end |
752 | 759 | if fl.subfonts then |
753 | 760 | for _,v in pairs(fl.subfonts) do |
761 | + local tg, glyphmin, glyphmax = v.glyphs, v.glyphmin, v.glyphmax | |
762 | + for i = glyphmin, glyphmax do | |
763 | + if tg[i] and tg[i].name then unicodes[tg[i].name] = unicodes[i] end | |
764 | + end | |
765 | + end | |
766 | + for _,v in pairs(fl.subfonts) do | |
754 | 767 | dest = add_fl_table(dest, v, unicodes, |
755 | 768 | fl.ascent + fl.descent, fl.units_per_em) |
756 | 769 | end |
@@ -777,7 +790,7 @@ end | ||
777 | 790 | |
778 | 791 | -- |
779 | 792 | do |
780 | - local cache_ver = 6 | |
793 | + local cache_ver = 7 | |
781 | 794 | local checksum = file.checksum |
782 | 795 | |
783 | 796 | local function prepare_extra_data_base(id) |