From e8e1fd35ed424eab3ed84b2f3ae4bfc32513932d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 3 Oct 2015 23:10:37 +0000 Subject: luatexko (3oct15) git-svn-id: svn://tug.org/texlive/trunk@38540 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/luatex/luatexko/ChangeLog | 8 ++ Master/texmf-dist/doc/luatex/luatexko/README | 4 +- .../doc/luatex/luatexko/luatexko-doc.pdf | Bin 220315 -> 221572 bytes .../doc/luatex/luatexko/luatexko-doc.tex | 26 +++--- .../tex/luatex/luatexko/luatexko-core.sty | 6 +- .../tex/luatex/luatexko/luatexko-normalize.lua | 4 +- .../tex/luatex/luatexko/luatexko-uhc2utf8.lua | 4 +- Master/texmf-dist/tex/luatex/luatexko/luatexko.lua | 89 ++++++++++++--------- Master/texmf-dist/tex/luatex/luatexko/luatexko.sty | 2 +- 9 files changed, 89 insertions(+), 54 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/luatex/luatexko/ChangeLog b/Master/texmf-dist/doc/luatex/luatexko/ChangeLog index f73273ee213..d77b69b50b5 100644 --- a/Master/texmf-dist/doc/luatex/luatexko/ChangeLog +++ b/Master/texmf-dist/doc/luatex/luatexko/ChangeLog @@ -1,3 +1,11 @@ +2015-10-02 Dohyun Kim + + Version 1.10 + + * luatexko.lua: adapt to latex 2015/10/01 and luatexbase v1.0 + * luatexko.lua: assing pre/post penalty to U+FF62, U+FF63 + * luatexko.lua: fix an infinite loop in reorderTM + 2015-07-02 Dohyun Kim Version 1.9 diff --git a/Master/texmf-dist/doc/luatex/luatexko/README b/Master/texmf-dist/doc/luatex/luatexko/README index 1e88c8737da..ef0eb6bab9a 100644 --- a/Master/texmf-dist/doc/luatex/luatexko/README +++ b/Master/texmf-dist/doc/luatex/luatexko/README @@ -1,5 +1,5 @@ -LuaTeX-ko Package version 1.9 (2015/07/02) -========================================== +LuaTeX-ko Package version 1.10 (2015/10/02) +=========================================== This is a Lua(La)TeX macro package that supports typesetting Korean documents including Old Hangul texts. As LuaTeX has opened up access to diff --git a/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdf b/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdf index 6ca4fa7f99e..bd7dbf1a57b 100644 Binary files a/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdf and b/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdf differ diff --git a/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex b/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex index f9ebfd7c51f..b96296bb901 100644 --- a/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex +++ b/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex @@ -27,7 +27,15 @@ BoldFont=* Bold, InterLatinCJK=.125em, ] -\setmonofont{Source Han Sans HW K}[Color=191970] % MidnightBlue +\setmonofont{Inconsolatazi4}[ + Color=191970, % MidnightBlue +] +\setmonohangulfont{Source Han Sans K}[ + UprightFont=* Normal, + BoldFont=* Bold, + CharRaise=-.25ex, + Color=191970, % MidnightBlue +] \usepackage{hologo} \def\luatex{\hologo{LuaTeX}} \def\MP{\hologo{METAPOST}} @@ -52,7 +60,7 @@ \author{Dohyun Kim \normalsize || \and Soojin Nam \normalsize || \and \normalsize \url{}} -\date{Version 1.9\quad 2015/07/02} +\date{Version 1.10\quad 2015/10/02} \maketitle \begin{quote}\small @@ -175,10 +183,6 @@ fontspec의 글꼴 옵션 외에 \luatexko가 따로 제공하는 것들이 |[Script=Hangul]| 옵션을 사용하는 것으로 충분하다. 플레인텍이라면 |script=hang|.} -그러나 \cs{defaulthangulfontfeatures} 따위 명령은 따로 구현돼 있지 않으며, -설혹 사용하더라도 fontspec의 \cs{defaultfontfeatures}와 같은 효과를 가진다. -다시 말해 한글 폰트 옵션과 라틴 폰트 옵션에 차이는 없다. - \begin{figure} \fboxsep=1em \fbox{\parbox{\dimexpr\linewidth-2.1em\relax}{% @@ -203,6 +207,10 @@ fontspec의 글꼴 옵션 외에 \luatexko가 따로 제공하는 것들이 \caption{옛한글 조판 보기}\label{fig:yethangul} \end{figure} +그러나 \cs{defaulthangulfontfeatures} 따위 명령은 따로 구현돼 있지 않으며, +설혹 사용하더라도 fontspec의 \cs{defaultfontfeatures}와 같은 효과를 가진다. +다시 말해 한글 폰트 옵션과 라틴 폰트 옵션에 차이는 없다. + \begin{description} \item[InterHangul] {\addhangulfontfeature{InterHangul=.5ex}한글 글자 사이의 자간}. 아래는 $-0.04$em 만큼 한글 @@ -274,9 +282,6 @@ fontspec의 글꼴 옵션 외에 \luatexko가 따로 제공하는 것들이 플레인텍에서는 {\small(문서 전체에 적용하지 않는다면 그룹을 열고)} \cs{chinese} \cs{japanese} 따위를 사용한다. -일본어·중국어라도 글꼴 설정은 \cs{newhangulfontfamily} -\cs{newhanjafontfamily} 따위를 이용한다. - \begin{figure} \centering \fbox{\parbox{37em}{\japanese\sffamily @@ -293,6 +298,9 @@ fontspec의 글꼴 옵션 외에 \luatexko가 따로 제공하는 것들이 \caption{고문헌 조판 보기. japanese 환경을 이용했다.}\label{fig:ancientdoc} \end{figure} +일본어·중국어라도 글꼴 설정은 \cs{newhangulfontfamily} +\cs{newhanjafontfamily} 따위를 이용한다. + \luatexko가 글자 사이에 삽입하는 미세간격을 사용자가 영(zero)으로 강제하기 위해선 \cs{inhibitglue} 명령을 이용한다. 대체로 일본어·중국어 환경에서만 문제된다. 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 -- cgit v1.2.3