From 2ab598832d6c69a43f55cc0fce844b2464d1b339 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 19 Jun 2014 20:24:23 +0000 Subject: luatexko (19jun14) git-svn-id: svn://tug.org/texlive/trunk@34320 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/luatex/luatexko/ChangeLog | 13 +++ Master/texmf-dist/doc/luatex/luatexko/README | 2 +- .../doc/luatex/luatexko/luatexko-doc.pdf | Bin 320828 -> 324946 bytes .../doc/luatex/luatexko/luatexko-doc.tex | 105 +++++++++++++-------- .../tex/luatex/luatexko/luatexko-core.sty | 14 +-- .../tex/luatex/luatexko/luatexko-normalize.lua | 4 +- .../tex/luatex/luatexko/luatexko-uhc2utf8.lua | 22 +++-- Master/texmf-dist/tex/luatex/luatexko/luatexko.lua | 29 +++++- Master/texmf-dist/tex/luatex/luatexko/luatexko.sty | 101 +++++++++++--------- 9 files changed, 177 insertions(+), 113 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/luatex/luatexko/ChangeLog b/Master/texmf-dist/doc/luatex/luatexko/ChangeLog index e952c2ba297..475b5ffaed3 100644 --- a/Master/texmf-dist/doc/luatex/luatexko/ChangeLog +++ b/Master/texmf-dist/doc/luatex/luatexko/ChangeLog @@ -1,3 +1,16 @@ +2014-06-17 Dohyun Kim + + Version 1.6 + + * luatexko.sty, luatexko.lua: new font option [NoEmbedding] prevents + inclusion of fonts into PDF file. + * luatexko-uhc2utf8.lua: fix a bug in utf-8 detection routine, + reported by Karnes Kim + * luatexko.lua: put underline leader node before text, so that text + should not be overprinted by a color box. Requested by Karnes Kim + * luatexko.sty: [Ligatures=TeX] is now default option for main/sans + hangul/hanja/fallback fonts. Requires fontspec v2.4 + 2014-05-11 Dohyun Kim Version 1.5 diff --git a/Master/texmf-dist/doc/luatex/luatexko/README b/Master/texmf-dist/doc/luatex/luatexko/README index c8f761aba45..298549704d3 100644 --- a/Master/texmf-dist/doc/luatex/luatexko/README +++ b/Master/texmf-dist/doc/luatex/luatexko/README @@ -1,4 +1,4 @@ -LuaTeX-ko Package version 1.5 (2014/05/11) +LuaTeX-ko Package version 1.6 (2014/06/17) ========================================== This is a Lua(La)TeX macro package that supports typesetting Korean diff --git a/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdf b/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdf index 214982bcd70..6ac1f6c731e 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 515c581eed7..59ac82224dc 100644 --- a/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex +++ b/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex @@ -7,23 +7,21 @@ %% public domain \documentclass[a4paper]{article} -\usepackage[hmargin=3.9cm]{geometry} +\usepackage[hmargin=3.8cm]{geometry} \usepackage[hangul]{luatexko} \usepackage{luamplib} -\setmainhangulfont[ - Ligatures=TeX, +\setmainhangulfont{KoPubBatang_Pro}[ AutoFakeSlant, UprightFont=* Light, BoldFont=* Bold, InterLatinCJK=.125em, Expansion, Protrusion, -]{KoPubBatang_Pro} -\setsanshangulfont[ - Ligatures=TeX, +] +\setsanshangulfont{KoPubDotum_Pro}[ UprightFont=* Light, BoldFont=* Bold, InterLatinCJK=.125em, -]{KoPubDotum_Pro} +] \usepackage[svgnames]{xcolor} \usepackage{hologo} \def\luatex{\hologo{LuaTeX}} @@ -49,13 +47,13 @@ \title{\luatexko\ 간단 매뉴얼} \author{Dohyun Kim \normalsize || \and \normalsize \url{}} -\date{Version 1.5\quad 2014/05/11} +\date{Version 1.6\quad 2014/06/17} \maketitle \begin{quote}\small For a summary introduction in English, please see |README| file. - \begin{itemize}\itemsep=0pt +\begin{itemize}\linespread{1.1}\selectfont \item[v1.0] ------ \item \hyperref[sec:loading]{플레인텍에서도 luatexko.sty을 불러야 한다.} \item \hyperref[sec:packageopt]{패키지 옵션 |unfonts|가 선언되지 않으면 @@ -66,7 +64,7 @@ \item[v1.3] ------ \item \hyperref[sec:fontcmds]{fallbackfont 계열의 명령이 추가되었다.} \item \hyperref[sec:fontswitch]{\cs{hangulpunctuations} 선언이 추가되고, - |QuoteRaise| 옵션이 없어졌다.} + |[QuoteRaise]| 옵션이 없어졌다.} \item \hyperref[sec:autojosa]{\cs{josaignoreparens=1}이 선언되면 자동조사 결정시 괄호 부분을 무시한다.} \item[v1.5] ------ @@ -76,17 +74,23 @@ \item \hyperref[sec:fontswitch]{한글·한자 글꼴의 지정이 없으면 나눔 Type1을 이용한다.} \item \hyperref[sec:packageopt]{패키지 옵션 |[nofontspec]|이 추가되었다.} + \item[v1.6] ------ + \item \hyperref[sec:fontoption]{글꼴 옵션 |[NoEmbedding]|이 추가되었다.} + \item \hyperref[sec:fontcmds]{main/sans hangul/hanja/fallback 폰트의 + 디폴트 옵션으로 |[Ligatures=TeX]|이 주어진다.} \end{itemize} \end{quote} +\smallskip + \section{} \hemph{\texlive\ 2013 이상}을 사용해야 한다. 세로쓰기를 위해서는 \texlive\ 2014 이상이 필요하다. 아직 \luatex은 베타 상태로 개발 중에 있으므로 안정적인 동작을 보장하지 않는다. \section{}\label{sec:loading} -\luatexko\ 로드하기: \cs{usepackage{luatexko}}. 플레인텍은 -\cs{input luatexko.sty}. 입력은 원칙적으로 UTF-8으로 한다. +\luatexko\ 로드하기: \cs{usepackage{luatexko}} 혹은 \cs{usepackage{kotex}}. +플레인텍에서는 \cs{input luatexko.sty}. 입력은 원칙적으로 UTF-8으로 한다. BOM (Byte Order Mark)은 있어도 좋고 없어도 좋다. CP949 인코딩에 관해서는 제\ref{sec:uhcencoding}절 참조. @@ -121,6 +125,8 @@ CP949 인코딩에 관해서는 제\ref{sec:uhcencoding}절 참조. \end{verbatim} \cs{adhochangulfont} \cs{adhochanjafont} \cs{addhocfallbackfont}는 각각 \cs{hangulfontspec} \cs{hanjafontspec} \cs{fallbackfontspec}의 다른 이름이다. +첫 두 줄의 명령들, 즉 main/sans hangul/hanja/fallback 글꼴에는 +|Ligatures=TeX| 옵션이 자동으로 주어진다. \begin{itemize}\item[] 플레인텍에서 한글 글꼴 설정은 영문 글꼴 지정하는 방식과 거의 같다. \begin{verbatim} @@ -161,10 +167,14 @@ fontspec의 글꼴 옵션 외에 \luatexko가 따로 제공하는 것들이 있다.\footnote{ 옛한글 식자를 위해서는 |[Script=Hangul]| 옵션을 사용하는 것으로 충분하다.} +그러나 \cs{defaulthangulfontfeatures} 따위 명령은 따로 구현돼 있지 않으며, +설혹 사용하더라도 fontspec의 \cs{defaultfontfeatures}와 같은 효과를 가진다. +다시 말해 한글 폰트 옵션과 라틴 폰트 옵션에 차이는 없다. + \begin{figure} \fboxsep=1em - \fbox{\vbox{\hsize\dimexpr\linewidth-2.1em\relax - \fontspec[Script=Hangul,Ligatures=Required]{HCR Dotum LVT} + \fbox{\parbox{\dimexpr\linewidth-2.1em\relax}{% + \fontspec{HCR Dotum LVT}[Script=Hangul,Ligatures=Required] \leftskip2.5cm 뎨 가ᄂᆞᆫ 뎌 각시 본 듯도 ᄒᆞᆫ뎌이고.\\ 天텬上상白ᄇᆡᆨ玉옥京경을 엇디ᄒᆞ야 離니別별ᄒᆞ고\\ @@ -216,48 +226,60 @@ fontspec의 글꼴 옵션 외에 \luatexko가 따로 제공하는 것들이 [PunctRaise=-0.125em] \end{verbatim} +\item[NoEmbedding] |NoEmbed|와 동의어. + 폰트를 내장하지 않으므로 결과물의 크기가 대폭 줄어든다. + 하지만 대외적 배포에 적합하지 않음에 유의.\footnote{% + Adobe Reader에 번들된 폰트를 쓴다면 대외적 배포도 대체로 무난하다.} + 플레인텍에서는 |embedding=no|. +\begin{verbatim} + [NoEmbedding] +\end{verbatim} + \item[Protrusion] 특정 글자가 행 끌에 왔을 때 판면 바깥으로 끌어내는 기능이다. Lua\LaTeX의 기본값은 구두점들만 완전히 글자내밀기 한다. 즉 - hanging punctuation이 작동한다. 플레인텍에서는 |protrusion|. + hanging punctuation이 작동한다. \begin{verbatim} [Protrusion] \end{verbatim} - 이는 |Protrusion=default|와 마찬가지 뜻이다. 마이크로타입에 관심 - 있으면 자신만의 설정을 만들어 지정할 수 있다. + 이는 |Protrusion=default|와 같은 뜻이다. + 플레인텍에서는 |protrusion=default|. + 마이크로타입에 관심 있으면 자신만의 설정을 만들어 지정할 수 있다. \item[Expansion] 판면의 균일한 조판을 위해 글자들을 미세하게 늘이거나 - 줄이는 기능이다. 플레인텍에서는 |expansion|. + 줄이는 기능이다. \begin{verbatim} [Expansion] \end{verbatim} 이는 |Expansion=default|와 마찬가지 뜻이다. + 플레인텍에서는 |expansion=default|. \end{description} \section{} -\begin{figure}\linespread{1.388}\selectfont\hfil -\fbox{\vbox{\hsize=36em \begin{chinese} \setmainfont{STFangsong} +고문헌·일본어·중국어 조판을 위해 japanese, Schinese, Tchinese 환경을 +제공한다. chinese는 Schinese의 다른 이름이다. korean 환경도 +마련했는데 이들 환경 안에서 잠깐 한국어를 조판하는 데 +사용한다. 일본어·중국어라도 글꼴 설정은 \cs{newhangulfontfamily} +\cs{newhanjafontfamily} 따위를 이용한다. 그림~\ref{fig:ancientdoc} 참조. +플레인텍에서는 {\small(문서 전체에 적용하지 않는다면 그룹을 열고)} +\cs{chinese} \cs{japanese} 따위를 사용한다. + +\begin{figure} + \centering + \fbox{\parbox{37em}{\begin{chinese}\setmainfont{STFangsong} 子曰:「學而時習之,不亦說乎?有朋自遠方來,不亦樂乎?人不知而不慍, 不亦君子乎?」\par -有子曰:「其為人也孝弟,而好犯上者,鮮矣!不好犯上,而好作亂者,未之有也! -君子務本,本立而道生;孝弟也者,其為仁之本歟?」\par +有子曰:「其爲人也孝弟,而好犯上者,鮮矣!不好犯上,而好作亂者,未之有也! +君子務本,本立而道生;孝弟也者,其爲仁之本與?」\par 子曰:「巧言令色,鮮矣仁!」\par -曾子曰:「吾日三省吾身:為人謀,而不忠乎?與朋友交,而不信乎?傳, +曾子曰:「吾日三省吾身:爲人謀,而不忠乎?與朋友交,而不信乎?傳, 不習乎?」\par 子曰:「道千乘之國,敬事而信,節用而愛人,使民以時。」\par 子曰:「弟子入則孝,出則弟;謹而信,汎愛衆;而親仁,行有餘力,則以學文。」 -\end{chinese}}}\hfil + \end{chinese}}} \caption{고문헌 조판 보기}\label{fig:ancientdoc} \end{figure} -고문헌·일본어·중국어 조판을 위해 japanese, Schinese, Tchinese 환경을 -제공한다. chinese는 Schinese의 다른 이름이다. korean 환경도 -마련했는데 이들 환경 안에서 잠깐 한국어를 조판하는 데 -사용한다. 일본어·중국어라도 글꼴 설정은 \cs{newhangulfontfamily} -\cs{newhanjafontfamily} 따위를 이용한다. 그림~\ref{fig:ancientdoc} 참조. -플레인텍에서는 {\small(문서 전체에 적용하지 않는다면 그룹을 열고)} -\cs{chinese} \cs{japanese} 따위를 사용한다. - \luatexko가 글자 사이에 삽입하는 미세간격을 사용자가 영(zero)으로 강제하기 위해선 \cs{inhibitglue} 명령을 이용한다. 대체로 일본어·중국어 환경에서만 문제된다. @@ -276,13 +298,9 @@ fontspec의 글꼴 옵션 외에 \luatexko가 따로 제공하는 것들이 그림~\ref{fig:vertical} 참조. 플레인텍에서는 \cs{vertical{}} \ldots\ \cs{endvertical}. -문서 전체를 세로쓰기한다면 이 환경을 쓰는 대신 -\cs{verticaltypesetting} 명령을 전처리부에 선언한다. -이때 면주의 폰트에는 세로쓰기 옵션이 없어야 할 것이다. - \begin{figure} \framebox[\linewidth]{\begin{vertical}{17em} -\fontspec[Vertical=RotatedGlyphs,RawFeature=+vhal]{Adobe Myungjo Std} +\fontspec{Adobe Myungjo Std}[Vertical=RotatedGlyphs,RawFeature=+vhal] \parindent-1em\leftskip1em \linespread{1.5}\selectfont \noindent 님의 침묵(The Silent Beloved) \smallbreak @@ -302,6 +320,10 @@ fontspec의 글꼴 옵션 외에 \luatexko가 따로 제공하는 것들이 \caption{세로쓰기의 예}\label{fig:vertical} \end{figure} +문서 전체를 세로쓰기한다면 이 환경을 쓰는 대신 +\cs{verticaltypesetting} 명령을 전처리부에 선언한다. +이때 면주의 폰트에는 세로쓰기 옵션이 없어야 할 것이다. + \section{}\label{sec:metapost} 전처리부에서 \cs{usepackage{luamplib}}을 선언하면 \MP\ 코드를 문서 중간에 삽입할 수 있다. 한글이나 수식은 |btex| \ldots\ |etex| 안에 넣어야 한다. @@ -430,7 +452,7 @@ ulem 패키지가 \luatexko와 궁합이 잘 맞지 않아{\small (줄바꿈에 PDF에서 텍스트로 추출할 수 있게 해준다. 인자가 두 페이지에 나눠지지 않도록 유의한다. 모든 PDF 리더가 이를 지원하는 것은 아니다. 예: $\actualtext{\sqrt 2}$, -{\fontspec[Script=Hangul,Ligatures=Required]{HCR Dotum LVT} +{\fontspec{HCR Dotum LVT}[Script=Hangul,Ligatures=Required] \actualtext{ᄆᆞᄎᆞᆷ〮내〯}}. 인자가 글자 없이 그림으로만 돼있다면 \cs{actualtext*{...}} 방식을 이용한다. @@ -442,9 +464,10 @@ $\actualtext{\sqrt 2}$, \XeTeX의 그것에 비해 기능이 한참 모자란다. \section{}\label{sec:uhcencoding} -권장하지 않지만 불가피하게 입력 인코딩이 UHC {\small(CP949라고도 하며 -EUC-KR을 포함한다)}인 파일을 처리할 때는 \cs{luatexuhcinputencoding=1}을 -선언한다. |0|을 할당하면 다시 UTF-8 입력으로 간주한다. +권장하지 않지만 불가피하게 입력 인코딩이 UHC (Unified Hangul Code)\footnote{% + CP949라고도 하며 EUC-KR을 포함한다}로 되어 있는 파일을 처리할 때는 +\cs{luatexuhcinputencoding=1}을 선언한다. +|0|을 할당하면 다시 UTF-8 입력으로 간주한다. \XeTeX의 \cs{XeTeXinputencoding} 명령과 유사하나 오직 한국어 문자만 처리할 수 있어 \XeTeX의 그것에 비해 기능이 한참 모자란다. diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty index 835f8b14baf..5cddf331113 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty +++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty @@ -15,7 +15,7 @@ \ifcsname ifpdf\endcsname\else \input ifpdf.sty \fi \catcode`@ = 11 \else - \ProvidesPackage{luatexko-core}[2014/05/11 v1.5 Typesetting Korean with LuaTeX] + \ProvidesPackage{luatexko-core}[2014/06/17 v1.6 Typesetting Korean with LuaTeX] \RequirePackage{luaotfload}[2013/05/23] \fi @@ -205,7 +205,7 @@ % strike-out \protected\def\sout#1{{\def\ulinedown{-0.5ex-\ulinewidth/2}\uline{#1}}} % ulem with arbitray box -\protected\def\markoverwidth#1#2{% +\protected\def\markoverwith#1#2{% \ifnum\luakoulineboxcnt > 65535 \luakoulineboxcnt\z@ \fi \global\advance\luakoulineboxcnt\@ne \setbox\z@\hbox{#1}% @@ -214,15 +214,15 @@ #2\special{luako:ulineend}} \protected\def\uuline{\dimen@ii-\dimexpr\ulinedown\relax \dimen@\dimexpr\ulinedown+\ulinewidth\relax - \markoverwidth{\vtop{\hrule width.2em height\dimen@ii depth\dimen@ + \markoverwith{\vtop{\hrule width.2em height\dimen@ii depth\dimen@ \kern.1em\hrule height\dimen@ii depth\dimen@}}} \protected\def\uwave {\ifx\ltxko@sixly\undefined \font\ltxko@sixly=lasy6 \fi - \markoverwidth{\lower4\p@\hbox{\ltxko@sixly\char58}}} -\protected\def\xout {\markoverwidth{\hbox to.35em{/\hss}}} -\protected\def\dashuline{\markoverwidth{\kern.125em\vtop{\kern\ulinedown + \markoverwith{\lower4\p@\hbox{\ltxko@sixly\char58}}} +\protected\def\xout {\markoverwith{\hbox to.35em{/\hss}}} +\protected\def\dashuline{\markoverwith{\kern.125em\vtop{\kern\ulinedown \hrule width.3em height\z@ depth\ulinewidth}\kern.125em}} \protected\def\dotuline{\dimen@\dimexpr\ulinedown+0.1ex\relax - \markoverwidth{\lower\dimen@\hbox{\kern.1em .\kern.04em}}} + \markoverwith{\lower\dimen@\hbox{\kern.1em .\kern.04em}}} %% hangul font -- core \def\luatexko@hangul@selectfont{% diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua index 4c2fde7fff0..32377748f24 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua +++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua @@ -12,8 +12,8 @@ luatexbase.provides_module({ name = "luatexko-normalize", - version = 1.5, - date = "2014/05/11", + version = 1.6, + date = "2014/06/17", author = "Dohyun Kim", 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 3d28a668b1f..95c29ac71bd 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua +++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua @@ -12,8 +12,8 @@ luatexbase.provides_module({ name = "luatexko-uhc2utf8", - version = 1.5, - date = "2014/05/11", + version = 1.6, + date = "2014/06/17", author = "Dohyun Kim", description = "UHC (CP949) input encoding", license = "LPPL v1.3+", @@ -63,14 +63,16 @@ local t_uhc2ucs = t_uhc2ucs or get_uhc_uni_table() local uhc_to_utf8 = function(buffer) if not buffer then return end -- check if buffer is already utf-8; better solution? - local isutf = true - for v in utfvalues(buffer) do - if v == 0xFFFD then -- REPLACEMENT CHARACTER - isutf = false - break - end - end - if isutf == true then return buffer end + local ubuffer = buffer + ubuffer = gsub(ubuffer,"[\000-\127]","") + ubuffer = gsub(ubuffer,"[\194-\223][\128-\191]","") + ubuffer = gsub(ubuffer,"\224[\160-\191][\128-\191]","") + ubuffer = gsub(ubuffer,"[\225-\236\238\239][\128-\191][\128-\191]","") + ubuffer = gsub(ubuffer,"\237[\128-\159][\128-\191]","") + ubuffer = gsub(ubuffer,"\240[\144-\191][\128-\191][\128-\191]","") + ubuffer = gsub(ubuffer,"[\241-\243][\128-\191][\128-\191][\128-\191]","") + ubuffer = gsub(ubuffer,"\244[\128-\143][\128-\191][\128-\191]","") + if ubuffer == "" then return buffer end -- now convert to utf8 buffer = gsub(buffer, "([\129-\253])([\65-\254])", function(a, b) diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua index aa14bbc249f..fd0c5c1d68c 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua +++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua @@ -12,8 +12,8 @@ local err,warn,info,log = luatexbase.provides_module({ name = 'luatexko', - date = '2014/05/11', - version = 1.5, + date = '2014/06/17', + version = 1.6, description = 'Korean linebreaking and font-switching', author = 'Dohyun Kim', license = 'LPPL v1.3+', @@ -1123,7 +1123,7 @@ local function inject_char_widow_penalty (head,curr,uni,cjattr) end if np and np.id == penaltynode then curr = np - if curr.penalty < pv then + if curr.penalty < pv and curr.penalty > 0 then -- bypass \\ case curr.penalty = pv end elseif curr and curr.id == gluenode then @@ -1663,8 +1663,8 @@ local function draw_underline(head,curr,width,ulinenum,ulstart) local glue = get_gluenode(width) glue.subtype = 101 -- cleaders glue.leader = copy_node(ulinebox[ulinenum]) - insert_before(head, curr, get_kernnode(-width)) - insert_before(head, curr, glue) + head = insert_before(head, ulstart, glue) + head = insert_before(head, ulstart, get_kernnode(-width)) end for _,nd in ipairs({ulstart,curr}) do if nd.id == whatsitnode @@ -1871,6 +1871,24 @@ otffeatures.register { } } +------------------------------------ +-- no embedding +------------------------------------ +local function dontembedthisfont (tfmdata, value) + if value == "no" then + fonts.constructors.dontembed[tfmdata.properties.filename] = 1 + end +end + +otffeatures.register { + name = "embedding", + description = "dont embed this font", + initializers = { + base = dontembedthisfont, + node = dontembedthisfont, + } +} + ------------------------------------ -- italic correction for fake-slant font ------------------------------------ @@ -1937,6 +1955,7 @@ add_to_callback("luaotfload.patch_font", ------------------------------------ local function actualtext (str) local t = {} + str = stringgsub(str,"##","#") for uni in string.utfvalues(str) do if uni < 0x10000 then t[#t+1] = stringformat("%04X",uni) diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty index a34b53bae9a..d7df0c2581c 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty +++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty @@ -22,7 +22,7 @@ \expandafter\endinput \fi -\ProvidesPackage{luatexko}[2014/05/11 v1.5 Typesetting Korean with LuaLaTeX] +\ProvidesPackage{luatexko}[2014/06/17 v1.6 Typesetting Korean with LuaLaTeX] %% package options \newif\if@hangul @@ -38,7 +38,7 @@ \if@luatexko@loadfontspec %% euenc redefines \f@size by \DeclareErrorFont. sigh \let\luatexko@f@size\f@size - \RequirePackage{fontspec} + \RequirePackage{fontspec}[2014/05/25] \let\f@size\luatexko@f@size \fi @@ -51,6 +51,10 @@ \newfontfeature{InterLatinCJK}{interlatincjk=#1} \newfontfeature{PunctRaise}{punctraise=#1} \newfontfeature{CharRaise}{charraise=#1} + \newfontfeature{NoEmbed}{embedding=no} + \aliasfontfeature{NoEmbed}{NoEmbedding} + \newfontfeature{protrusion}{protrusion=#1} + \newfontfeature{expansion}{expansion=#1} \ExplSyntaxOn \DeclareDocumentCommand \newhangulfontfeature {mmmm} { @@ -58,8 +62,7 @@ { #1 .code:n = { - \fontspec_update_featstr:n {#2=##1} - #4 + \keys_set:nn { fontspec } { #2 = {##1} } #4 }, #1 .default:n = {#3} } @@ -68,10 +71,20 @@ {\aftergroup\pdfprotrudechars\aftergroup\tw@} \newhangulfontfeature{Expansion}{expansion}{default} {\aftergroup\pdfadjustspacing\aftergroup\tw@} + %% default font features + \cs_set_eq:NN \defaulthangulfontfeatures \defaultfontfeatures + \cs_set_eq:NN \defaulthanjafontfeatures \defaultfontfeatures + \cs_set_eq:NN \defaultfallbackfontfeatures \defaultfontfeatures + \defaultfontfeatures + [ + \serifhangul@font, \serifhanja@font, \seriffallback@font, + \sanshangul@font, \sanshanja@font, \sansfallback@font, + ] + {Ligatures=TeX} %% macros for Korean fonts - \DeclareDocumentCommand \setmainhangulfont { O{} m } + \DeclareDocumentCommand \setmainhangulfont { O{} m O{} } { - \newfontfamily \serifhangul@font [#1] {#2} + \newfontfamily \serifhangul@font [#1,#3] {#2} \str_if_eq_x:nnT \familydefault \rmdefault { \cs_set_eq:NN \hangul@font \serifhangul@font @@ -79,9 +92,9 @@ } \ignorespaces } - \DeclareDocumentCommand \setmainhanjafont { O{} m } + \DeclareDocumentCommand \setmainhanjafont { O{} m O{} } { - \newfontfamily \serifhanja@font [#1] {#2} + \newfontfamily \serifhanja@font [#1,#3] {#2} \str_if_eq_x:nnT \familydefault \rmdefault { \cs_set_eq:NN \hanja@font \serifhanja@font @@ -89,9 +102,9 @@ } \ignorespaces } - \DeclareDocumentCommand \setmainfallbackfont { O{} m } + \DeclareDocumentCommand \setmainfallbackfont { O{} m O{} } { - \newfontfamily \seriffallback@font [#1] {#2} + \newfontfamily \seriffallback@font [#1,#3] {#2} \str_if_eq_x:nnT \familydefault \rmdefault { \cs_set_eq:NN \fallback@font \seriffallback@font @@ -99,9 +112,9 @@ } \ignorespaces } - \DeclareDocumentCommand \setsanshangulfont { O{} m } + \DeclareDocumentCommand \setsanshangulfont { O{} m O{} } { - \newfontfamily \sanshangul@font [#1] {#2} + \newfontfamily \sanshangul@font [#1,#3] {#2} \str_if_eq_x:nnT \familydefault \sfdefault { \cs_set_eq:NN \hangul@font \sanshangul@font @@ -109,9 +122,9 @@ } \ignorespaces } - \DeclareDocumentCommand \setsanshanjafont { O{} m } + \DeclareDocumentCommand \setsanshanjafont { O{} m O{} } { - \newfontfamily \sanshanja@font [#1] {#2} + \newfontfamily \sanshanja@font [#1,#3] {#2} \str_if_eq_x:nnT \familydefault \sfdefault { \cs_set_eq:NN \hanja@font \sanshanja@font @@ -119,9 +132,9 @@ } \ignorespaces } - \DeclareDocumentCommand \setsansfallbackfont { O{} m } + \DeclareDocumentCommand \setsansfallbackfont { O{} m O{} } { - \newfontfamily \sansfallback@font [#1] {#2} + \newfontfamily \sansfallback@font [#1,#3] {#2} \str_if_eq_x:nnT \familydefault \sfdefault { \cs_set_eq:NN \fallback@font \sansfallback@font @@ -129,9 +142,9 @@ } \ignorespaces } - \DeclareDocumentCommand \setmonohangulfont { O{} m } + \DeclareDocumentCommand \setmonohangulfont { O{} m O{} } { - \newfontfamily \monohangul@font [#1] {#2} + \newfontfamily \monohangul@font [#1,#3] {#2} \str_if_eq_x:nnT \familydefault \ttdefault { \cs_set_eq:NN \hangul@font \monohangul@font @@ -139,9 +152,9 @@ } \ignorespaces } - \DeclareDocumentCommand \setmonohanjafont { O{} m } + \DeclareDocumentCommand \setmonohanjafont { O{} m O{} } { - \newfontfamily \monohanja@font [#1] {#2} + \newfontfamily \monohanja@font [#1,#3] {#2} \str_if_eq_x:nnT \familydefault \ttdefault { \cs_set_eq:NN \hanja@font \monohanja@font @@ -149,9 +162,9 @@ } \ignorespaces } - \DeclareDocumentCommand \setmonofallbackfont { O{} m } + \DeclareDocumentCommand \setmonofallbackfont { O{} m O{} } { - \newfontfamily \monofallback@font [#1] {#2} + \newfontfamily \monofallback@font [#1,#3] {#2} \str_if_eq_x:nnT \familydefault \ttdefault { \cs_set_eq:NN \fallback@font \monofallback@font @@ -159,30 +172,27 @@ } \ignorespaces } - \DeclareDocumentCommand \newhangulfontfamily { m O{} m } + \DeclareDocumentCommand \newhangulfontfamily { m O{} m O{} } { - \exp_after:wN \newfontfamily - \cs:w luatexkofont@ \token_to_str:N #1 \cs_end: [#2] {#3} + \exp_args:Nc \newfontfamily { luatexkofont@ \token_to_str:N #1 } [#2,#4] {#3} \DeclareRobustCommand #1 { \cs_set_eq:Nc \hangul@font { luatexkofont@ \token_to_str:N #1 } \luatexko@hangul@selectfont } } - \DeclareDocumentCommand \newhanjafontfamily { m O{} m } + \DeclareDocumentCommand \newhanjafontfamily { m O{} m O{} } { - \exp_after:wN \newfontfamily - \cs:w luatexkofont@ \token_to_str:N #1 \cs_end: [#2] {#3} + \exp_args:Nc \newfontfamily { luatexkofont@ \token_to_str:N #1 } [#2,#4] {#3} \DeclareRobustCommand #1 { \cs_set_eq:Nc \hanja@font { luatexkofont@ \token_to_str:N #1 } \luatexko@hanja@selectfont } } - \DeclareDocumentCommand \newfallbackfontfamily { m O{} m } + \DeclareDocumentCommand \newfallbackfontfamily { m O{} m O{} } { - \exp_after:wN \newfontfamily - \cs:w luatexkofont@ \token_to_str:N #1 \cs_end: [#2] {#3} + \exp_args:Nc \newfontfamily { luatexkofont@ \token_to_str:N #1 } [#2,#4] {#3} \DeclareRobustCommand #1 { \cs_set_eq:Nc \fallback@font { luatexkofont@ \token_to_str:N #1 } @@ -191,51 +201,48 @@ } \DeclareDocumentCommand \newhangulfontface { m O{} m } { - \exp_after:wN \newfontface - \cs:w luatexkofont@ \token_to_str:N #1 \cs_end: [#2] {#3} + \exp_args:Nc \newfontface { luatexkofont@ \token_to_str:N #1 } [#2] {#3} \DeclareRobustCommand #1 { \cs_set_eq:Nc \hangul@font { luatexkofont@ \token_to_str:N #1 } \luatexko@hangul@selectfont } } - \DeclareDocumentCommand \newhanjafontface { m O{} m } + \DeclareDocumentCommand \newhanjafontface { m O{} m O{} } { - \exp_after:wN \newfontface - \cs:w luatexkofont@ \token_to_str:N #1 \cs_end: [#2] {#3} + \exp_args:Nc \newfontface { luatexkofont@ \token_to_str:N #1 } [#2,#4] {#3} \DeclareRobustCommand #1 { \cs_set_eq:Nc \hanja@font { luatexkofont@ \token_to_str:N #1 } \luatexko@hanja@selectfont } } - \DeclareDocumentCommand \newfallbackfontface { m O{} m } + \DeclareDocumentCommand \newfallbackfontface { m O{} m O{} } { - \exp_after:wN \newfontface - \cs:w luatexkofont@ \token_to_str:N #1 \cs_end: [#2] {#3} + \exp_args:Nc \newfontface { luatexkofont@ \token_to_str:N #1 } [#2,#4] {#3} \DeclareRobustCommand #1 { \cs_set_eq:Nc \fallback@font { luatexkofont@ \token_to_str:N #1 } \luatexko@fallback@selectfont } } - \DeclareDocumentCommand \hangulfontspec { O{} m } + \DeclareDocumentCommand \hangulfontspec { O{} m O{} } { - \newfontfamily \hangul@font [#1] {#2} + \newfontfamily \hangul@font [#1,#3] {#2} \luatexko@hangul@selectfont \ignorespaces } \cs_set_eq:NN \adhochangulfont \hangulfontspec - \DeclareDocumentCommand \hanjafontspec { O{} m } + \DeclareDocumentCommand \hanjafontspec { O{} m O{} } { - \newfontfamily \hanja@font [#1] {#2} + \newfontfamily \hanja@font [#1,#3] {#2} \luatexko@hanja@selectfont \ignorespaces } \cs_set_eq:NN \adhochanjafont \hanjafontspec - \DeclareDocumentCommand \fallbackfontspec { O{} m } + \DeclareDocumentCommand \fallbackfontspec { O{} m O{} } { - \newfontfamily \fallback@font [#1] {#2} + \newfontfamily \fallback@font [#1,#3] {#2} \luatexko@fallback@selectfont \ignorespaces } @@ -292,9 +299,9 @@ } \cs_set_eq:NN \addfallbackfontfeatures \addfallbackfontfeature % hangul math font command - \DeclareDocumentCommand \setmathhangulfont { O{} m } + \DeclareDocumentCommand \setmathhangulfont { O{} m O{} } { - \fontspec_set_family:Nnn \luatexko@math@hangul@family {#1} {#2} + \fontspec_set_family:Nnn \luatexko@math@hangul@family {#1,#3} {#2} } \ExplSyntaxOff \fi -- cgit v1.2.3