ソースコードの管理場所
Revisão | 1b275d5cdba514210a85c2802870d807ba4326b8 (tree) |
---|---|
Hora | 2016-05-06 19:52:45 |
Autor | Hironori Kitagawa <h_kitagawa2001@yaho...> |
Commiter | Hironori Kitagawa |
ltj-jfont.lua, ltj-pretreat.lua: vertical forms
@@ -659,6 +659,18 @@ do | ||
659 | 659 | end |
660 | 660 | |
661 | 661 | ------------------------------------------------------------------------ |
662 | +-- VERT VARIANT TABLE | |
663 | +------------------------------------------------------------------------ | |
664 | +local vert_form_table = { | |
665 | + [0x2013]=0xFE32, [0x2014]=0xFE31, [0x2025]=0xFE30, | |
666 | + [0xFF08]=0xFE35, [0xFF09]=0xFE36, [0xFF5B]=0xFE37, [0xFF5D]=0xFE38, | |
667 | + [0x3014]=0xFE39, [0x3015]=0xFE3A, [0x3010]=0xFE3B, [0x3011]=0xFE3C, | |
668 | + [0x300A]=0xFE3D, [0x300B]=0xFE3E, [0x3008]=0xFE3F, [0x3009]=0xFE40, | |
669 | + [0x300C]=0xFE41, [0x300D]=0xFE42, [0x300E]=0xFE43, [0x300F]=0xFE44, | |
670 | + [0xFF3B]=0xFE47, [0xFF3D]=0xFE48, [0xFF3F]=0xFE33, | |
671 | +} | |
672 | + | |
673 | +------------------------------------------------------------------------ | |
662 | 674 | -- 追加のフォント情報 |
663 | 675 | ------------------------------------------------------------------------ |
664 | 676 | font_extra_info = {} |
@@ -682,7 +694,7 @@ do | ||
682 | 694 | end |
683 | 695 | |
684 | 696 | local sort = table.sort |
685 | - local function add_fl_table(dest, glyphs, unitable, asc_des, units) | |
697 | + local function add_fl_table(dest, glyphs, unitable, asc_des, units, id) | |
686 | 698 | local glyphmin, glyphmax = glyphs.glyphmin, glyphs.glyphmax |
687 | 699 | if glyphmax < 0 then return dest end |
688 | 700 | local tg = glyphs.glyphs |
@@ -707,9 +719,20 @@ do | ||
707 | 719 | end |
708 | 720 | end |
709 | 721 | end |
722 | + -- vertical form | |
723 | + local gi = unitable[gv.name] | |
724 | + if gi then | |
725 | + if unitable[gv.name .. '.vert'] then | |
726 | + dest = dest or {}; dest[gi] = dest[gi] or {}; | |
727 | + dest[gi].vform = unitable[gv.name .. '.vert'] | |
728 | + elseif id.characters[gi] and vert_form_table[gi] then | |
729 | + dest = dest or {}; dest[gi] = dest[gi] or {}; | |
730 | + dest[gi].vform = vert_form_table[gi] | |
731 | + end | |
732 | + end | |
710 | 733 | -- vertical metric |
711 | 734 | local vw, tsb, vk = glyph_vmetric(gv) |
712 | - local gi = unitable[i] | |
735 | + local gi = unitable[gv.name] | |
713 | 736 | if gi and vw and vw~=asc_des then |
714 | 737 | -- We do not use tsidebearing, since (1) fontloader does not read VORG table |
715 | 738 | -- and (2) 'tsidebearing' doea not appear in the returned table by fontloader.fields. |
@@ -757,7 +780,7 @@ do | ||
757 | 780 | end |
758 | 781 | end |
759 | 782 | dest = add_fl_table(dest, fl, unicodes, |
760 | - fl.ascent + fl.descent, fl.units_per_em) | |
783 | + fl.ascent + fl.descent, fl.units_per_em, id) | |
761 | 784 | end |
762 | 785 | if fl.subfonts then |
763 | 786 | for _,v in pairs(fl.subfonts) do |
@@ -770,7 +793,7 @@ do | ||
770 | 793 | end |
771 | 794 | for _,v in pairs(fl.subfonts) do |
772 | 795 | dest = add_fl_table(dest, v, unicodes, |
773 | - fl.ascent + fl.descent, fl.units_per_em) | |
796 | + fl.ascent + fl.descent, fl.units_per_em, id) | |
774 | 797 | end |
775 | 798 | end |
776 | 799 | if dest then dest.unicodes = unicodes end |
@@ -796,7 +819,7 @@ end | ||
796 | 819 | |
797 | 820 | -- |
798 | 821 | do |
799 | - local cache_ver = 9 | |
822 | + local cache_ver = 11 | |
800 | 823 | local checksum = file.checksum |
801 | 824 | |
802 | 825 | local function prepare_extra_data_base(id) |
@@ -891,7 +914,7 @@ luatexbase.add_to_callback( | ||
891 | 914 | local vorg = {}; fmtable.v_origin = vorg |
892 | 915 | local ft = font_getfont(fnum) |
893 | 916 | local subtables = {} |
894 | - if ft.specification then | |
917 | + if false and ft.specification then | |
895 | 918 | for feat_name,v in pairs(ft.specification.features.normal) do |
896 | 919 | if v==true then |
897 | 920 | for _,i in pairs(ft.resources.sequences) do |
@@ -994,15 +1017,3 @@ do | ||
994 | 1017 | end |
995 | 1018 | end |
996 | 1019 | |
997 | ------------------------------------------------------------------------- | |
998 | --- VERT VARIANT TABLE | |
999 | ------------------------------------------------------------------------- | |
1000 | -vert_form_table = { | |
1001 | - [0x2013]=0xFE32, [0x2014]=0xFE31, [0x2025]=0xFE30, | |
1002 | - [0xFF08]=0xFE35, [0xFF09]=0xFE36, [0xFF5B]=0xFE37, [0xFF5D]=0xFE38, | |
1003 | - [0x3014]=0xFE39, [0x3015]=0xFE3A, [0x3010]=0xFE3B, [0x3011]=0xFE3C, | |
1004 | - [0x300A]=0xFE3D, [0x300B]=0xFE3E, [0x3008]=0xFE3F, [0x3009]=0xFE40, | |
1005 | - [0x300C]=0xFE41, [0x300D]=0xFE42, [0x300E]=0xFE43, [0x300F]=0xFE44, | |
1006 | - [0xFF3B]=0xFE47, [0xFF3D]=0xFE48, [0xFF3F]=0xFE33, | |
1007 | -} | |
1008 | -setmetatable(vert_form_table, {__index=function(t,k) return k end}); |
@@ -42,6 +42,7 @@ local attr_icflag = luatexbase.attributes['ltj@icflag'] | ||
42 | 42 | local is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char_direct |
43 | 43 | local ltjs_orig_char_table = ltjs.orig_char_table |
44 | 44 | local ltjf_replace_altfont = ltjf.replace_altfont |
45 | +local ltjf_font_extra_info = ltjf.font_extra_info | |
45 | 46 | local attr_orig_char = luatexbase.attributes['ltj@origchar'] |
46 | 47 | local STCK = luatexja.userid_table.STCK |
47 | 48 | local DIR = luatexja.userid_table.DIR |
@@ -121,7 +122,6 @@ end | ||
121 | 122 | |
122 | 123 | -- mode: true iff this function is called from hpack_filter |
123 | 124 | local ltjs_report_stack_level = ltjs.report_stack_level |
124 | -local ltjf_vert_form_table = ltjf.vert_form_table | |
125 | 125 | local ltjf_font_metric_table = ltjf.font_metric_table |
126 | 126 | local font_getfont = font.getfont |
127 | 127 | local function set_box_stack_level(head, mode) |
@@ -140,8 +140,9 @@ local function set_box_stack_level(head, mode) | ||
140 | 140 | local nf = ltjf_replace_altfont( has_attr(p, attr_curtfnt) or getfont(p) , pc) |
141 | 141 | setfield(p, 'font', nf) |
142 | 142 | if ltjf_font_metric_table[nf].vert_activated then |
143 | - pc = ltjf_vert_form_table [getchar(p)] | |
144 | - if font_getfont(nf).characters[pc] then setfield(p, 'char', pc) end | |
143 | + local pc = getchar(p) | |
144 | + pc = (ltjf_font_extra_info[nf] and ltjf_font_extra_info[nf][pc] and ltjf_font_extra_info[nf][pc].vform) | |
145 | + if pc and font_getfont(nf).characters[pc] then setfield(p, 'char', pc) end | |
145 | 146 | end |
146 | 147 | end |
147 | 148 | end |