• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

ソースコードの管理場所


Commit MetaInfo

Revisão1b275d5cdba514210a85c2802870d807ba4326b8 (tree)
Hora2016-05-06 19:52:45
AutorHironori Kitagawa <h_kitagawa2001@yaho...>
CommiterHironori Kitagawa

Mensagem de Log

ltj-jfont.lua, ltj-pretreat.lua: vertical forms

('ltj.v_advance' in ltj-jfont.lua is temporaly disabled, since
it causes an error)

Mudança Sumário

Diff

--- a/src/ltj-jfont.lua
+++ b/src/ltj-jfont.lua
@@ -659,6 +659,18 @@ do
659659 end
660660
661661 ------------------------------------------------------------------------
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+------------------------------------------------------------------------
662674 -- 追加のフォント情報
663675 ------------------------------------------------------------------------
664676 font_extra_info = {}
@@ -682,7 +694,7 @@ do
682694 end
683695
684696 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)
686698 local glyphmin, glyphmax = glyphs.glyphmin, glyphs.glyphmax
687699 if glyphmax < 0 then return dest end
688700 local tg = glyphs.glyphs
@@ -707,9 +719,20 @@ do
707719 end
708720 end
709721 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
710733 -- vertical metric
711734 local vw, tsb, vk = glyph_vmetric(gv)
712- local gi = unitable[i]
735+ local gi = unitable[gv.name]
713736 if gi and vw and vw~=asc_des then
714737 -- We do not use tsidebearing, since (1) fontloader does not read VORG table
715738 -- and (2) 'tsidebearing' doea not appear in the returned table by fontloader.fields.
@@ -757,7 +780,7 @@ do
757780 end
758781 end
759782 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)
761784 end
762785 if fl.subfonts then
763786 for _,v in pairs(fl.subfonts) do
@@ -770,7 +793,7 @@ do
770793 end
771794 for _,v in pairs(fl.subfonts) do
772795 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)
774797 end
775798 end
776799 if dest then dest.unicodes = unicodes end
@@ -796,7 +819,7 @@ end
796819
797820 --
798821 do
799- local cache_ver = 9
822+ local cache_ver = 11
800823 local checksum = file.checksum
801824
802825 local function prepare_extra_data_base(id)
@@ -891,7 +914,7 @@ luatexbase.add_to_callback(
891914 local vorg = {}; fmtable.v_origin = vorg
892915 local ft = font_getfont(fnum)
893916 local subtables = {}
894- if ft.specification then
917+ if false and ft.specification then
895918 for feat_name,v in pairs(ft.specification.features.normal) do
896919 if v==true then
897920 for _,i in pairs(ft.resources.sequences) do
@@ -994,15 +1017,3 @@ do
9941017 end
9951018 end
9961019
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});
--- a/src/ltj-pretreat.lua
+++ b/src/ltj-pretreat.lua
@@ -42,6 +42,7 @@ local attr_icflag = luatexbase.attributes['ltj@icflag']
4242 local is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char_direct
4343 local ltjs_orig_char_table = ltjs.orig_char_table
4444 local ltjf_replace_altfont = ltjf.replace_altfont
45+local ltjf_font_extra_info = ltjf.font_extra_info
4546 local attr_orig_char = luatexbase.attributes['ltj@origchar']
4647 local STCK = luatexja.userid_table.STCK
4748 local DIR = luatexja.userid_table.DIR
@@ -121,7 +122,6 @@ end
121122
122123 -- mode: true iff this function is called from hpack_filter
123124 local ltjs_report_stack_level = ltjs.report_stack_level
124-local ltjf_vert_form_table = ltjf.vert_form_table
125125 local ltjf_font_metric_table = ltjf.font_metric_table
126126 local font_getfont = font.getfont
127127 local function set_box_stack_level(head, mode)
@@ -140,8 +140,9 @@ local function set_box_stack_level(head, mode)
140140 local nf = ltjf_replace_altfont( has_attr(p, attr_curtfnt) or getfont(p) , pc)
141141 setfield(p, 'font', nf)
142142 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
145146 end
146147 end
147148 end