diff options
author | Karl Berry <karl@freefriends.org> | 2015-10-03 23:10:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-10-03 23:10:37 +0000 |
commit | e8e1fd35ed424eab3ed84b2f3ae4bfc32513932d (patch) | |
tree | bf295533d082f8e18747fae7417803f2db5aeb95 /Master/texmf-dist/tex/luatex | |
parent | 1d864db4b9bf32da99c0166a256ef52b08c8f132 (diff) |
luatexko (3oct15)
git-svn-id: svn://tug.org/texlive/trunk@38540 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
5 files changed, 62 insertions, 43 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty index e9b50ff2985..464e9c186dc 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty +++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty @@ -17,10 +17,14 @@ \ifcsname ifpdf\endcsname\else \input ifpdf.sty \fi \catcode`@ = 11 \else - \ProvidesPackage{luatexko-core}[2015/07/02 v1.9 Typesetting Korean with LuaTeX] + \ProvidesPackage{luatexko-core}[2015/10/02 v1.10 Typesetting Korean with LuaTeX] \RequirePackage{luaotfload}[2013/05/23] \fi +\ifdefined\luatexfontid\else + \let\luatexfontid\fontid % latex 2015/10/01 +\fi + %% make hangul catcode 12 \count@"1100 \loop \catcode\count@ 12 diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua index 9cafe63c677..bdaaf1bc240 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua +++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua @@ -13,8 +13,8 @@ luatexbase.provides_module({ name = "luatexko-normalize", - version = 1.9, - date = "2015/07/02", + version = "1.10", + date = "2015/10/02", author = "Dohyun Kim, Soojin Nam", description = "Hangul normalization", license = "LPPL v1.3+", diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua index 0a795c42350..0812b2bd5e1 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua +++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua @@ -13,8 +13,8 @@ luatexbase.provides_module({ name = "luatexko-uhc2utf8", - version = 1.9, - date = "2015/07/02", + version = "1.10", + date = "2015/10/02", author = "Dohyun Kim, Soojin Nam", description = "UHC (CP949) input encoding", license = "LPPL v1.3+", diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua index 9a076f151c0..b84f7521af7 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua +++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua @@ -11,18 +11,20 @@ -- and version 1.3c or later is part of all distributions of LaTeX -- version 2006/05/20 or later. -local err,warn,info,log = luatexbase.provides_module({ +luatexbase.provides_module { name = 'luatexko', - date = '2015/07/02', - version = 1.9, + date = '2015/10/02', + version = '1.10', description = 'Korean linebreaking and font-switching', author = 'Dohyun Kim, Soojin Nam', license = 'LPPL v1.3+', -}) +} luatexko = luatexko or {} local luatexko = luatexko +local warn = function(...) return luatexbase.module_warning("luatexko", format(...)) end + local dotemphnode,rubynode,ulinebox = {},{},{} luatexko.dotemphnode = dotemphnode luatexko.rubynode = rubynode @@ -261,6 +263,7 @@ local postbreakpenalty = { [0xFF40] = 10000, [0xFF5B] = 10000, [0xFE37] = 10000, + [0xFF62] = 10000, -- 「 } local prebreakpenalty = { @@ -351,6 +354,7 @@ local prebreakpenalty = { [0xFE48] = 10000, [0xFF5D] = 10000, [0xFE38] = 10000, + [0xFF63] = 10000, -- 」 } local xspcode = { @@ -944,6 +948,31 @@ end ---------------------------------- -- compress fullwidth punctuations ---------------------------------- +local function check_next_halt_kern (head, curr) + -- glyph halt_kern glue -> glyph halt_kern rule glue + local nn = d_nodenext(curr) + if nn and d_getid(nn) == kernnode and d_nodenext(nn) then + d_insert_after(head, nn, d_get_rulenode(0)) + end +end + +local function check_prev_halt_kern (head, curr) + local pn = d_nodeprev(curr) + if pn and d_getid(pn) == kernnode and d_nodeprev(pn) then + -- glue halt_kern glyph -> glue rule halt_kern glyph + head = d_insert_before(head, pn, d_get_rulenode(0)) + elseif pn and d_getid(pn) == gluenode and d_has_attribute(pn, luakoglueattr) then + -- halt_kern ko_glue glyph -> ko_glue rule halt_kern glyph + local ppn = d_nodeprev(pn) + if d_getid(ppn) == kernnode then + head = d_remove_node(head, ppn) + head = d_insert_before(head, curr, ppn) + head = d_insert_before(head, ppn, d_get_rulenode(0)) + end + end + return head +end + local function compress_fullwidth_punctuations (head) for curr in d_traverse_id(glyphnode,head) do local currfont, currchar = d_getfont(curr), d_getchar(curr) @@ -974,14 +1003,10 @@ local function compress_fullwidth_punctuations (head) end else if halt_on then - -- gluph halt_kern glue -> glyph halt_kern rule glue (kern is a breakpoint if followed by a glue) - local nn = d_nodenext(curr) - if nn and d_getid(nn) == kernnode then - wd = 0 - curr = nn - end + check_next_halt_kern(head, curr) + else + d_insert_after(head, curr, d_get_rulenode(wd)) end - d_insert_after(head, curr, d_get_rulenode(wd)) end elseif class == 1 then local wd @@ -997,22 +1022,10 @@ local function compress_fullwidth_punctuations (head) end else if halt_on then - local pn = d_nodeprev(curr) - if pn and d_getid(pn) == kernnode then - -- glue halt_kern glyph -> glue rule halt_kern glyph - wd = 0 - curr = pn - elseif pn and d_getid(pn) == gluenode and d_getfield(d_getfield(pn,"spec"),"width") == 0 then - -- halt_kern glue glyph -> glue rule halt_kern glyph - local ppn = d_nodeprev(pn) - if ppn and d_getid(ppn) == kernnode then - wd = 0 - head = d_remove_node(head, ppn) - head, curr = d_insert_before(head, curr, ppn) - end - end + head = check_prev_halt_kern(head, curr) + else + head = d_insert_before(head, curr, d_get_rulenode(wd)) end - head = d_insert_before(head, curr, d_get_rulenode(wd)) end elseif class == 3 then local lwd, rwd @@ -1029,8 +1042,11 @@ local function compress_fullwidth_punctuations (head) head = d_insert_before(head, curr, d_get_kernnode(lwd)) end else - if halt_on then lwd = 0 end -- there's already penalty 10000 - head = d_insert_before(head, curr, d_get_rulenode(lwd)) + if halt_on then -- there's already penalty 10000 + head = check_prev_halt_kern(head, curr) + else + head = d_insert_before(head, curr, d_get_rulenode(lwd)) + end end if chr.right_protruding then if not halt_on then @@ -1038,13 +1054,10 @@ local function compress_fullwidth_punctuations (head) end else if halt_on then - local nn = d_nodenext(curr) - if nn and d_getid(nn) == kernnode then - rwd = 0 - curr = nn - end + check_next_halt_kern(head, curr) + else + d_insert_after (head, curr, d_get_rulenode(rwd)) end - d_insert_after (head, curr, d_get_rulenode(rwd)) end end end @@ -1644,6 +1657,7 @@ local function reorderTM (head) if pc == 9 then elseif pc == 7 or pc == 8 then head = d_remove_node(head,curr) + d_setfield(curr, "prev", nil) -- prev might survive! head, curr = d_insert_before(head,p,curr) done = true break @@ -1668,14 +1682,15 @@ end ---------------------------------- -- add to callback : pre-linebreak ---------------------------------- -add_to_callback('hpack_filter', function(head) + +add_to_callback("hpack_filter", function(head) head = d_todirect(head) assign_unicode_codevalue(head) korean_autojosa(head) remove_cj_spaceskip(head) font_substitute(head) return d_tonode(head) -end, 'luatexko.hpack_filter_first',1) +end, 'luatexko.hpack_filter_first', 1) add_to_callback('hpack_filter', function(head) head = d_todirect(head) @@ -1695,7 +1710,7 @@ add_to_callback('pre_linebreak_filter', function(head) remove_cj_spaceskip(head) font_substitute(head) return d_tonode(head) -end, 'luatexko.pre_linebreak_filter_first',1) +end, 'luatexko.pre_linebreak_filter_first', 1) add_to_callback('pre_linebreak_filter', function(head) head = d_todirect(head) diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty index 9dec1eb9639..f84c3b5f5fb 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty +++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty @@ -23,7 +23,7 @@ \expandafter\endinput \fi -\ProvidesPackage{luatexko}[2015/07/02 v1.9 Typesetting Korean with LuaLaTeX] +\ProvidesPackage{luatexko}[2015/10/02 v1.10 Typesetting Korean with LuaLaTeX] %% package options \newif\if@hangul |