summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexko
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-01-19 23:43:39 +0000
committerKarl Berry <karl@freefriends.org>2015-01-19 23:43:39 +0000
commitb6574e6c71befc9e13ec7be5107ebc9104256269 (patch)
tree6390b348e311f566e2166b793f9979a761332b03 /Master/texmf-dist/tex/luatex/luatexko
parent83b4f07dfc662cf6c2632a34e88a1aad0009e35a (diff)
luatexko (19jan15)
git-svn-id: svn://tug.org/texlive/trunk@36096 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexko')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty49
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua6
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua6
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko.lua65
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko.sty67
5 files changed, 86 insertions, 107 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty
index 5cddf331113..1c1f7cf46a6 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty
@@ -1,6 +1,6 @@
% luatexko-core.sty
%
-% Copyright (c) 2013-2014 Dohyun Kim <nomos at ktug org>
+% Copyright (c) 2013-2015 Dohyun Kim <nomos at ktug org>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
@@ -10,12 +10,13 @@
% and version 1.3c or later is part of all distributions of LaTeX
% version 2006/05/20 or later.
-\ifx\ProvidesPackage\undefined
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname selectfont\endcsname\relax
\input luaotfload.sty
\ifcsname ifpdf\endcsname\else \input ifpdf.sty \fi
\catcode`@ = 11
\else
- \ProvidesPackage{luatexko-core}[2014/06/17 v1.6 Typesetting Korean with LuaTeX]
+ \ProvidesPackage{luatexko-core}[2015/01/16 v1.7 Typesetting Korean with LuaTeX]
\RequirePackage{luaotfload}[2013/05/23]
\fi
@@ -100,11 +101,7 @@
\vrule width\z@ height.88em depth\z@\relax #1}%
\setbox\tw@\hbox{% ruby
\ifdefined\rubyfont \rubyfont \fi
- \ifcsname selectfont\endcsname
- \expandafter\dimen@\pdffontsize\font
- \dimen@\rubysize\dimen@
- \fontsize\dimen@\dimen@\selectfont
- \else
+ \expandafter\ifx\csname selectfont\endcsname\relax % plain
\ifdefined\rubyfont \else
\luatexko@resize@font\font\resized@font\font\rubysize
\ifdefined\hangul@font
@@ -117,6 +114,10 @@
\luatexko@resize@font\fallbackfont{}\fallback@font\rubysize
\fi
\fi
+ \else % latex
+ \expandafter\dimen@\pdffontsize\font
+ \dimen@\rubysize\dimen@
+ \fontsize\dimen@\dimen@\selectfont
\fi #2}\ht\tw@\z@\dp\tw@\z@
\directlua{%
luatexko.rubynode[\the\luakorubyattrcnt] = {
@@ -126,7 +127,8 @@
\leavevmode\box\z@
\endgroup}
-\ifcsname selectfont\endcsname\else
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname selectfont\endcsname\relax
% font resize under plain tex
\begingroup\edef\x{\endgroup
\def\noexpand\rem@vesizepart##1\detokenize{ at}##2\noexpand\end{##1}}\x
@@ -171,13 +173,8 @@
}
% do not veticalize headline/footline
-\ifdefined\ProvidesPackage % for latex
- \def\verticaltypesetting{%
- \maxdepth\z@ \luatexko@vertical
- \dimen@\textwidth \textwidth\textheight \textheight\dimen@
- \edef\@outputpage{\unexpanded{\luatexkorotatebox\@outputbox
- \textwidth\textheight}\unexpanded\expandafter{\@outputpage}}}
-\else % for plain
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname selectfont\endcsname\relax % plain
\def\verticaltypesetting{%
\dimen@\hsize\hsize\vsize\vsize\dimen@
\edef\plainoutput{\unexpanded{\dimen@\hsize\hsize\vsize\vsize\dimen@}%
@@ -185,6 +182,12 @@
\def\pagebody{\setbox\z@\vbox to\hsize{\boxmaxdepth=\maxdepth
\pagecontents}\luatexkorotatebox\z@\box\z@}%
\maxdepth\z@ \luatexko@vertical}
+\else % latex
+ \def\verticaltypesetting{%
+ \maxdepth\z@ \luatexko@vertical
+ \dimen@\textwidth \textwidth\textheight \textheight\dimen@
+ \edef\@outputpage{\unexpanded{\luatexkorotatebox\@outputbox
+ \textwidth\textheight}\unexpanded\expandafter{\@outputpage}}}
\fi
%% underline using post_linebreak_filter
@@ -278,7 +281,8 @@
\ifnum\count@<"#2
\advance\count@\@ne
\repeat}
-\ifdefined\ProvidesPackage\else
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname selectfont\endcsname\relax
% for plain; see luatexko.sty for latex
\newfam\symmathhangul
\def\setmathhangulfont#1#{\setmathhangul@font@}
@@ -371,11 +375,18 @@
\expandafter\actualtext@\expandafter*%
\fi
}
-\def\actualtext@#1#2{%
+\def\actualtext@{%
+ \begingroup
+ \catcode`\\=12 \catcode`\$=12 \catcode`\&=12 \catcode`\#=12
+ \catcode`\^=12 \catcode`\_=12 \catcode`\~=12 %catcode`\%=12
+ \actualtext@@
+}
+\def\actualtext@@#1#2{%
+ \endgroup
\luatexko@pdfspecial{/Span<</ActualText\directlua{
luatexko.actualtext("\luatexluaescapestring{\detokenize{#2}}")
}>>BDC}%
- #2%
+ \luatexscantextokens{#2}%
\ifx*#1%
\begingroup
\ifdefined\actualtext@spacefont\else
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua
index 32377748f24..83909ca6b79 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua
@@ -1,6 +1,6 @@
-- luatexko-normalize.lua
--
--- Copyright (c) 2013-2014 Dohyun Kim <nomos at ktug org>
+-- Copyright (c) 2013-2015 Dohyun Kim <nomos at ktug org>
--
-- This work may be distributed and/or modified under the
-- conditions of the LaTeX Project Public License, either version 1.3c
@@ -12,8 +12,8 @@
luatexbase.provides_module({
name = "luatexko-normalize",
- version = 1.6,
- date = "2014/06/17",
+ version = 1.7,
+ date = "2015/01/16",
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 95c29ac71bd..068b35434f2 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua
@@ -1,6 +1,6 @@
-- luatexko-uhc2utf8.lua
--
--- Copyright (c) 2013-2014 Dohyun Kim <nomos at ktug org>
+-- Copyright (c) 2013-2015 Dohyun Kim <nomos at ktug org>
--
-- This work may be distributed and/or modified under the
-- conditions of the LaTeX Project Public License, either version 1.3c
@@ -12,8 +12,8 @@
luatexbase.provides_module({
name = "luatexko-uhc2utf8",
- version = 1.6,
- date = "2014/06/17",
+ version = 1.7,
+ date = "2015/01/16",
author = "Dohyun Kim",
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 fd0c5c1d68c..e9cad856664 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua
@@ -1,6 +1,6 @@
-- luatexko.lua
--
--- Copyright (c) 2013-2014 Dohyun Kim <nomos at ktug org>
+-- Copyright (c) 2013-2015 Dohyun Kim <nomos at ktug org>
--
-- This work may be distributed and/or modified under the
-- conditions of the LaTeX Project Public License, either version 1.3c
@@ -12,8 +12,8 @@
local err,warn,info,log = luatexbase.provides_module({
name = 'luatexko',
- date = '2014/06/17',
- version = 1.6,
+ date = '2015/01/16',
+ version = 1.7,
description = 'Korean linebreaking and font-switching',
author = 'Dohyun Kim',
license = 'LPPL v1.3+',
@@ -266,12 +266,12 @@ local prebreakpenalty = {
[0x0022] = 10000,
[0x0027] = 10000,
[0x0029] = 10000,
- [0x002A] = 500,
- [0x002B] = 500,
+ [0x002A] = 5000, -- 500, -- *
+ [0x002B] = 5000, -- 500, -- +
[0x002C] = 10000,
[0x002D] = 10000,
[0x002E] = 10000,
- [0x002F] = 500,
+ [0x002F] = 5000, -- 500, -- /
[0x003A] = 10000,
[0x003B] = 10000,
[0x003E] = 10000, -- >
@@ -284,11 +284,11 @@ local prebreakpenalty = {
[0x2015] = 10000,
[0x2019] = 10000,
[0x201D] = 10000,
- [0x2025] = 250,
- [0xFE30] = 250,
- [0x2026] = 250,
- [0xFE19] = 250,
- [0x2212] = 200,
+ [0x2025] = 5000, -- 250, -- ‥
+ [0xFE30] = 5000, -- 250, -- ︰
+ [0x2026] = 5000, -- 250, -- …
+ [0xFE19] = 5000, -- 250, -- ︙
+ [0x2212] = 5000, -- 200, -- − minus sign
[0x3001] = 10000,
[0xFE11] = 10000,
[0x3002] = 10000,
@@ -335,7 +335,7 @@ local prebreakpenalty = {
[0xFF01] = 10000,
[0xFF09] = 10000,
[0xFE36] = 10000,
- [0xFF0B] = 200,
+ [0xFF0B] = 5000, -- 200, -- +
[0xFF0C] = 10000,
[0xFE10] = 10000,
[0xFF0E] = 10000,
@@ -343,7 +343,7 @@ local prebreakpenalty = {
[0xFE13] = 10000,
[0xFF1B] = 10000,
[0xFE14] = 10000,
- [0xFF1D] = 200,
+ [0xFF1D] = 5000, -- 200, -- =
[0xFF1F] = 10000,
[0xFF3D] = 10000,
[0xFE48] = 10000,
@@ -600,13 +600,14 @@ end
local function get_unicode_char(curr)
local uni = curr.char
if (uni > 0xFF and uni < 0xE000) or (uni > 0xF8FF and uni < 0xF0000) then
- return uni -- no pua. no nanumgtm??
+ return uni -- no pua. no nanumgtm
+ end
+ if uni < 0xE000 or (uni > 0xF8FF and uni < 0xF0000) then -- no pua
+ uni = get_font_char(curr.font, curr.char)
+ uni = uni and uni.tounicode
+ uni = uni and string_sub(uni,1,4) -- seems ok for old hangul
+ if uni then return tonumber(uni,16) end
end
- -- tounicode is now reliable. backend is fixed
- uni = get_font_char(curr.font, curr.char)
- uni = uni and uni.tounicode
- uni = uni and string_sub(uni,1,4) -- seems ok for old hangul
- if uni then return tonumber(uni,16) end
uni = has_attribute(curr, luakounicodeattr)
if uni then return uni end
return curr.char
@@ -722,10 +723,13 @@ local function cjk_insert_nodes(head,curr,currchar,currfont,prevchar,prevfont)
end
end
--raise latin puncts]]
- if prebreakpenalty[currchar] then
+ if c == 5 and p == 5 then -- skip ------ ......
+ return currchar,currfont
+ end
+ if p and p < 10 and prebreakpenalty[currchar] then
was_penalty = true
insert_before(head,curr,get_penaltynode(prebreakpenalty[currchar]))
- elseif postbreakpenalty[prevchar] then
+ elseif c and c < 10 and postbreakpenalty[prevchar] then
was_penalty = true
insert_before(head,curr,get_penaltynode(postbreakpenalty[prevchar]))
end
@@ -1810,18 +1814,22 @@ local function cjk_vertical_font (vf)
v.width = vw
v.height = vh
v.depth = vh
+ v.italic = nil
end
--- vertical gpos
local res = vf.resources or {}
if res.verticalgposhack then
return vf -- avoid multiple running
end
+ local fea = vf.shared and vf.shared.features or {}
+ fea.kern = nil -- only for horizontal typesetting
+ fea.vert = true -- should be activated by default
local vposkeys = {}
local seq = res.sequences or {}
for _,v in ipairs(seq) do
if v.type == "gpos_single" and v.subtables then -- todo: gpos_pair...
local feature = v.features or {}
- if feature.vhal or feature.vkrn or feature.valt or feature.vpal then
+ if feature.vhal or feature.vkrn or feature.valt or feature.vpal or feature.vert then
for _,vv in ipairs(v.subtables) do
vposkeys[#vposkeys+1] = vv
end
@@ -1917,7 +1925,6 @@ local function tounicode_oldhangul (tfmdata)
local chrs = tfmdata.characters
if not desc or not chrs then return end
if not chrs[0x1100] then return end
- local last = 0
for _,v in ipairs({{0x1100,0x11FF},{0xA960,0xA97C},{0xD7B0,0xD7FB}}) do
for i = v[1],v[2] do
local ds = desc[i] and desc[i].slookups
@@ -1925,22 +1932,11 @@ local function tounicode_oldhangul (tfmdata)
for _,s in pairs(ds) do
if type(s) == "number" and s >= 0xF0000 and chrs[s] and not chrs[s].tounicode then
chrs[s].tounicode = stringformat("%04X",i)
- last = s > last and s or last
end
end
end
end
end
- if stringfind(tfmdata.fontname,"^HCR.+LVT") then
- local touni = "1112119E"
- for i = last+1, last+2 do
- local dsc,chr = desc[i],chrs[i]
- if dsc and chr and dsc.class == "ligature" and not chr.tounicode then
- chr.tounicode = touni
- end
- touni = touni.."11AB"
- end
- end
end
add_to_callback("luaotfload.patch_font",
@@ -1955,7 +1951,6 @@ 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 d7df0c2581c..49bdad415f9 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
@@ -1,6 +1,6 @@
% luatexko.sty
%
-% Copyright (c) 2013-2014 Dohyun Kim <nomos at ktug org>
+% Copyright (c) 2013-2015 Dohyun Kim <nomos at ktug org>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
@@ -10,10 +10,10 @@
% and version 1.3c or later is part of all distributions of LaTeX
% version 2006/05/20 or later.
-\ifx\luatexkocatcodeofatchar\undefined\else
- \expandafter\endinput\fi % no multiple loading
-\ifx\ProvidesPackage\relax \let\ProvidesPackage\undefined \fi
-\ifx\ProvidesPackage\undefined % plain tex
+\ifx\luatexkocatcodeofatchar\undefined\else\endinput\fi % no multiple loading
+
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname selectfont\endcsname\relax % plain tex
\edef\luatexkocatcodeofatchar{\catcode`@=\the\catcode`@}
\input luatexko-core.sty
%\hangulfont{name:NanumGothic:interlatincjk=0.125em} at 10pt
@@ -22,16 +22,15 @@
\expandafter\endinput
\fi
-\ProvidesPackage{luatexko}[2014/06/17 v1.6 Typesetting Korean with LuaLaTeX]
+\ProvidesPackage{luatexko}[2015/01/16 v1.7 Typesetting Korean with LuaLaTeX]
%% package options
\newif\if@hangul
\newif\if@hanja
-\newif\if@unfonts
\newif\if@luatexko@loadfontspec\@luatexko@loadfontspectrue
\DeclareOption{hangul}{\@hangultrue}
\DeclareOption{hanja}{\@hangultrue\@hanjatrue}
-\DeclareOption{unfonts}{\@unfontstrue}
+\DeclareOption{unfonts}{}
\DeclareOption{nofontspec}{\@luatexko@loadfontspecfalse}
\ProcessOptions\relax
@@ -345,57 +344,31 @@
\edef\verbatim@font{\unexpanded\expandafter{\verbatim@font
\unsetluatexattribute\finemathattr}}
+\AtBeginDocument{
+\unless\ifdefined\serifhangul@font\let\serifhangul@font\sanshangul@font\fi
+\unless\ifdefined\sanshangul@font \let\sanshangul@font\serifhangul@font\fi
+\unless\ifdefined\monohangul@font \let\monohangul@font\sanshangul@font \fi
+\unless\ifdefined\serifhangul@font\unless\ifdefined\sanshangul@font
+ \hangulpunctuations=0 % nanumtype1
+\fi\fi
% don't forget to redefine \normalfont
\expandafter\ifx\familydefault\rmdefault
\protected\edef\normalfont{%
\unexpanded{\luatexko@serif@fonts}\unexpanded\expandafter{\normalfont}}
- \finemathattr\tw@
+ % and current hangul font
+ \luatexko@serif@fonts
\else\expandafter\ifx\familydefault\sfdefault
\protected\edef\normalfont{%
\unexpanded{\luatexko@sans@fonts}\unexpanded\expandafter{\normalfont}}
- \finemathattr\@ne
+ \luatexko@sans@fonts
\else
\protected\edef\normalfont{%
\unexpanded{\luatexko@mono@fonts}\unexpanded\expandafter{\normalfont}}
- \finemathattr\z@
+ \luatexko@mono@fonts
\fi\fi
\let\reset@font\normalfont
-
-\if@unfonts\if@luatexko@loadfontspec
- \setmainhangulfont[
- InterHangul=-0.04em,
- InterLatinCJK=0.125em,
- PunctRaise=-0.125em,
- Ligatures=TeX,
- SlantedFont=*, SlantedFeatures={FakeSlant=0.2},
- ItalicFont=*, ItalicFeatures={FakeSlant=0.2},
- BoldSlantedFont=*Bold, BoldSlantedFeatures={FakeSlant=0.2},
- BoldItalicFont=*Bold, BoldItalicFeatures={FakeSlant=0.2},
- ]{UnBatang}
- \setsanshangulfont[
- InterLatinCJK=0.125em,
- PunctRaise=-0.125em,
- Ligatures=TeX,
- SlantedFont=*, SlantedFeatures={FakeSlant=0.2},
- ItalicFont=*, ItalicFeatures={FakeSlant=0.2},
- BoldSlantedFont=*Bold, BoldSlantedFeatures={FakeSlant=0.2},
- BoldItalicFont=*Bold, BoldItalicFeatures={FakeSlant=0.2},
- ]{UnDotum}
- \setmonohangulfont[
- SlantedFont=*, SlantedFeatures={FakeSlant=0.2},
- ItalicFont=*, ItalicFeatures={FakeSlant=0.2},
- BoldSlantedFont=*Bold, BoldSlantedFeatures={FakeSlant=0.2},
- BoldItalicFont=*Bold, BoldItalicFeatures={FakeSlant=0.2},
- ]{UnDotum}
-\fi\fi
-
-\AtBeginDocument{
-\unless\ifdefined\serifhangul@font\let\serifhangul@font\sanshangul@font\fi
-\unless\ifdefined\sanshangul@font \let\sanshangul@font\serifhangul@font\fi
-\unless\ifdefined\monohangul@font \let\monohangul@font\sanshangul@font \fi
-\unless\ifdefined\serifhangul@font\unless\ifdefined\sanshangul@font
- \hangulpunctuations=0 % nanumtype1
-\fi\fi
+% reset hangul font
+\selectfont
% for hyperref
\@ifpackageloaded{hyperref}{\pdfstringdefDisableCommands{%
\let\dotemph\@firstofone