summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexko
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-06-10 23:27:21 +0000
committerKarl Berry <karl@freefriends.org>2021-06-10 23:27:21 +0000
commit9e6a83ac8fd75c415c29905fc4bf917c354a49ed (patch)
tree40804c1578b62e0831b6adb856d32d493b1fe1ec /Master/texmf-dist/tex/luatex/luatexko
parent69b8416816163ea9fe6cac0a166a2ee6aaae1cfc (diff)
luatexko (11jun21)
git-svn-id: svn://tug.org/texlive/trunk@59545 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexko')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua4
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko-uhc2utf8.lua4
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko.lua195
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko.sty344
4 files changed, 314 insertions, 233 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua
index a86b7093900..96a0d12cf3d 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 = "3.1",
- date = "2021/04/20",
+ version = "3.2",
+ date = "2021/06/10",
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 d3d86fcb25e..2c5fd64f9e5 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 = "3.1",
- date = "2021/04/20",
+ version = "3.2",
+ date = "2021/06/10",
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 d0360a8b728..aa1aa4149f4 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua
@@ -13,8 +13,8 @@
luatexbase.provides_module {
name = 'luatexko',
- date = '2021/04/20',
- version = '3.1',
+ date = '2021/06/10',
+ version = '3.2',
description = 'typesetting Korean with LuaTeX',
author = 'Dohyun Kim, Soojin Nam',
license = 'LPPL v1.3+',
@@ -72,6 +72,7 @@ local attributes = luatexbase.attributes
local call_callback = luatexbase.call_callback
local create_callback = luatexbase.create_callback
local module_warning = luatexbase.module_warning
+local new_attribute = luatexbase.new_attribute
local new_user_whatsit = luatexbase.new_user_whatsit
local registernumber = luatexbase.registernumber
@@ -85,6 +86,7 @@ local glueid = node.id"glue"
local glyphid = node.id"glyph"
local hlistid = node.id"hlist"
local kernid = node.id"kern"
+local localparid = node.id"local_par"
local mathid = node.id"math"
local penaltyid = node.id"penalty"
local ruleid = node.id"rule"
@@ -98,6 +100,7 @@ local italcorr = 3
local lua_number = 100
local lua_value = 108
local spaceskip = 13
+local indentbox = 3
local nohyphen = registernumber"l@nohyphenation" or -1 -- verbatim
local langkor = registernumber"koreanlanguage" or 16383
@@ -107,11 +110,12 @@ local fallbackfontattr = attributes.luatexkofallbackfontattr
local autojosaattr = attributes.luatexkoautojosaattr
local classicattr = attributes.luatexkoclassicattr
local dotemphattr = attributes.luatexkodotemphattr
-local ulineattr = attributes.luatexkoulineattr
local rubyattr = attributes.luatexkorubyattr
local hangulbyhangulattr = attributes.luatexkohangulbyhangulattr
local hanjabyhanjaattr = attributes.luatexkohanjabyhanjaattr
+local unicodeattr = new_attribute"luatexkounicodeattr"
+
local stretch_f = 5/100 -- should be consistent for ruby
local function get_font_data (fontid)
@@ -537,12 +541,15 @@ local special_classes = {
[0xFF01] = 4, [0xFF1A] = 2, [0xFF1B] = 2, [0xFF1F] = 4,
}, { __index = charclass }),
setmetatable({ -- TC
- [0x3001] = 3, [0x3002] = 3, [0xFF0C] = 3, [0xFF0E] = 3,
+ [0x3001] = 3, [0x3002] = 5, [0xFF0C] = 3, [0xFF0E] = 5,
}, { __index = charclass }),
setmetatable({ -- TC vert
- [0x3001] = 3, [0x3002] = 3, [0xFF0C] = 3, [0xFF0E] = 3,
+ [0x3001] = 3, [0x3002] = 5, [0xFF0C] = 3, [0xFF0E] = 5,
[0xFF1A] = 7, [0xFF1B] = 7, -- 0xFE13, 0xFE14
}, { __index = charclass }),
+ setmetatable({ -- JP vert
+ [0xFF1B] = 7, -- 0xFE14
+ }, { __index = charclass }),
}
local function get_char_class (c, classic)
@@ -684,8 +691,8 @@ local function process_fonts (head)
while curr do
local id = curr.id
if id == glyphid then
- local props = my_node_props(curr)
- if not props.unicode then
+ if curr.font ~= 0 -- exclude nullfont
+ and not has_attribute(curr, unicodeattr) then
local c = curr.char
@@ -735,7 +742,7 @@ local function process_fonts (head)
end
end
- props.unicode = c
+ set_attribute(curr, unicodeattr, c)
end
elseif id == discid then
curr.pre = process_fonts(curr.pre)
@@ -779,11 +786,11 @@ local function hbox_char_font (box, init, glyfonly)
while curr do
local id = curr.id
if id == glyphid then
- local c = my_node_props(curr).unicode or curr.char
+ local c = has_attribute(curr, unicodeattr) or curr.char
if c and not is_cjk_combining(c) then
return c, curr.font
end
- elseif id == hlistid and curr.list then
+ elseif curr.list then
return hbox_char_font(curr, init, glyfonly)
elseif not glyfonly and is_blocking_node(curr) then
return
@@ -858,7 +865,7 @@ local function process_linebreak (head, par)
while curr do
local id = curr.id
if id == glyphid then
- local c = my_node_props(curr).unicode or curr.char
+ local c = has_attribute(curr, unicodeattr) or curr.char
if c and not is_unicode_var_sel(c) then
local old = has_attribute(curr, classicattr)
head, pc, pcl = maybe_linebreak(head, curr, pc, pcl, c, old, curr.font, par)
@@ -913,7 +920,7 @@ local function process_interhangul (head, par)
while curr do
local id = curr.id
if id == glyphid then
- local c = my_node_props(curr).unicode or curr.char
+ local c = has_attribute(curr, unicodeattr) or curr.char
if c and not is_unicode_var_sel(c) then
head, pc = do_interhangul_option(head, curr, pc, c, curr.font, par)
@@ -975,7 +982,7 @@ local function process_interlatincjk (head, par)
while curr do
local id = curr.id
if id == glyphid then
- local c = my_node_props(curr).unicode or curr.char
+ local c = has_attribute(curr, unicodeattr) or curr.char
if c and not is_unicode_var_sel(c) then
head, pc, pf, pcl = do_interlatincjk_option(head, curr, pc, pf, pcl, c, curr.font, par)
pc = breakable_after[c] and pc or 0
@@ -1033,7 +1040,7 @@ local function process_glyph_width (head)
if curr.lang ~= nohyphen
and fontoptions.compresspunctuations[curr.font] then
- local cc = my_node_props(curr).unicode or curr.char
+ local cc = has_attribute(curr, unicodeattr) or curr.char
local old = has_attribute(curr, classicattr)
local class = get_char_class(cc, old)
if class >= 1 and class <= 4 and
@@ -1087,11 +1094,11 @@ local function process_remove_spaces (head)
local vchar, vfont
if id == glyphid and v.lang ~= nohyphen then
- local c = my_node_props(v).unicode or v.char or 0
+ local c = has_attribute(v, unicodeattr) or v.char or 0
if is_unicode_var_sel(c) then
v = getprev(v) or v
end
- vchar, vfont = my_node_props(v).unicode or v.char, v.font
+ vchar, vfont = has_attribute(v, unicodeattr) or v.char, v.font
elseif id == hlistid and v.list then
vchar, vfont = hbox_char_font(v, k == "n")
end
@@ -1131,6 +1138,23 @@ local josa_table = {
[0xC774] = {0xC774, nil, 0xC774}, -- 이(라) = 이, , 이
}
+local hanja2hangul = { }
+
+local function add_to_hanja2hangul (filename, i, last)
+ local f = kpse.find_file(filename)
+ if f then
+ for c in io.lines(f) do
+ hanja2hangul[i] = tonumber(c)
+ i = i + 1
+ end
+ else
+ warning("cannot find %s", filename)
+ for c = i, last do
+ hanja2hangul[c] = c
+ end
+ end
+end
+
local josa_code = setmetatable({
[0x30] = 3, [0x31] = 1, [0x33] = 3, [0x36] = 3,
[0x37] = 1, [0x38] = 1, [0x4C] = 1, [0x4D] = 3,
@@ -1156,16 +1180,37 @@ local josa_code = setmetatable({
[0xFF13] = 3, [0xFF16] = 3, [0xFF17] = 1, [0xFF18] = 1,
[0xFF2C] = 1, [0xFF2D] = 3, [0xFF2E] = 3, [0xFF4C] = 1,
[0xFF4D] = 3, [0xFF4E] = 3,
-},{ __index = function(_,c)
+},{ __index = function(t, cc)
+ local c = cc
+ -- xetexko에 포함된 .tab 파일들을 이용해 한자를 한글로 변환
+ if c >= 0x4E00 and c <= 0x9FA5 then
+ if not hanja2hangul[c] then
+ add_to_hanja2hangul("hanja_hangul.tab", 0x4E00, 0x9FA5)
+ end
+ c = hanja2hangul[c]
+ elseif c >= 0xF900 and c <= 0xFA2D then
+ if not hanja2hangul[c] then
+ add_to_hanja2hangul("hanjacom_hangul.tab", 0xF900, 0xFA2D)
+ end
+ c = hanja2hangul[c]
+ elseif c >= 0x3400 and c <= 0x4DB5 then
+ if not hanja2hangul[c] then
+ add_to_hanja2hangul("hanjaexa_hangul.tab", 0x3400, 0x4DB5)
+ end
+ c = hanja2hangul[c]
+ end
if is_hangul(c) then
c = (c - 0xAC00) % 28 + 0x11A7
end
if is_chosong(c) then
- return c == 0x1105 and 1 or 3
+ c = c == 0x1105 and 1 or 3
+ t[cc] = c; return c
elseif is_jungsong(c) then
- return c ~= 0x1160 and 2
+ c = c ~= 0x1160 and 2
+ t[cc] = c; return c
elseif is_jongsong(c) then
- return c == 0x11AF and 1 or 3
+ c = c == 0x11AF and 1 or 3
+ t[cc] = c; return c
elseif is_noncjk_char(c) and c <= 0x7A
or c >= 0x2160 and c <= 0x217F -- roman
or c >= 0x2460 and c <= 0x24E9 -- ①
@@ -1175,11 +1220,13 @@ local josa_code = setmetatable({
or c >= 0xFF10 and c <= 0xFF19 -- 0
or c >= 0xFF21 and c <= 0xFF3A -- A
or c >= 0xFF41 and c <= 0xFF5A -- a
- then return 2
+ then
+ t[cc] = 2; return 2
elseif c >= 0x3131 and c <= 0x314E or c >= 0x3165 and c <= 0x3186 -- ㄱ
or c >= 0x3200 and c <= 0x320D -- ㈀
or c >= 0x3260 and c <= 0x326D -- ㉠
- then return 3
+ then
+ t[cc] = 3; return 3
end
end })
@@ -1188,7 +1235,7 @@ local function prevjosacode (n, parenlevel, ignore_parens)
while n do
local id = n.id
if id == glyphid then
- local c = my_node_props(n).unicode or n.char -- beware hlist/vlist
+ local c = has_attribute(n, unicodeattr) or n.char -- beware hlist/vlist
if ignore_parens and c == 0x29 then -- )
parenlevel = parenlevel + 1
elseif ignore_parens and c == 0x28 then -- (
@@ -1287,8 +1334,8 @@ local function process_dotemph (head)
elseif curr.id == glyphid then
local dotattr = has_attribute(curr, dotemphattr)
- if dotattr then
- local c = my_node_props(curr).unicode or curr.char
+ if dotattr and dotemphbox[dotattr] then
+ local c = has_attribute(curr, unicodeattr) or curr.char
if is_hangul(c) or
is_compat_jamo(c) or
is_chosong(c) or
@@ -1425,7 +1472,7 @@ end
local ulitems = {}
local function process_uline (head, parent, level)
- local curr, level, attr = head, level or 0
+ local curr, level = head, level or 0
while curr do
if curr.list then
curr.list = process_uline(curr.list, curr, level+1)
@@ -1439,33 +1486,28 @@ local function process_uline (head, parent, level)
list = list,
subtype = subtype,
level = level,
+ start = getnext(curr) or curr,
}
else
local item = ulitems[value]
if item then
head = draw_uline(head, curr, parent, item, true)
ulitems[value] = nil
- attr = nil
end
end
- else
- local currattr = has_attribute(curr, ulineattr)
- if currattr then
- local item = ulitems[currattr]
- if item and not item.start then
- item.start = curr
- attr = currattr
- end
- end
+ local to_free = curr
+ head, curr = noderemove(head, curr)
+ nodefree(to_free)
+ goto nextnode
end
curr = getnext(curr)
+ ::nextnode::
end
- if attr then
- local item = ulitems[attr]
- if item and item.level == level then
+ for _, item in pairs(ulitems) do
+ if item.level == level then
head = draw_uline(head, nodeslide(head), parent, item)
item.start = nil
end
@@ -1496,13 +1538,23 @@ local function process_ruby_pre_linebreak (head)
local rubyid = has_attribute(curr, rubyattr)
if rubyid then
local ruby_t = rubybox[rubyid]
- if ruby_t[3] then -- rubyoverlap
+ if ruby_t and ruby_t[3] then -- rubyoverlap
local side = (ruby_t[1].width - curr.width)/2
if side > 0 then -- ruby is wide
local k, r = nodenew(kernid), nodenew(ruleid)
k.subtype, k.kern = userkern, -side
r.width, r.height, r.depth = side, 0, 0
local k2, r2 = nodecopy(k), nodecopy(r)
+
+ local prev = curr.prev -- 문단 첫머리에 루비 돌출 방지
+ if prev then
+ if prev.id == localparid or
+ prev.id == hlistid and prev.subtype == indentbox and prev.width == 0
+ then
+ k.kern = 0
+ end
+ end
+
head = insert_before(head, curr, k)
head = insert_before(head, curr, r)
head, curr = insert_after(head, curr, r2)
@@ -1540,17 +1592,19 @@ local function process_ruby_post_linebreak (head)
-- consider charraise
local shift = shift_put_top(curr, ruby)
- local _, f = hbox_char_font(curr, true, true)
- local ascender = tableunpack(fontoptions.asc_desc[f]) or curr.height
- ruby.shift = shift - ascender - ruby.depth - ruby_t[2] -- rubysep
+ local f, ascender, descender
+ _, f = hbox_char_font(curr, true, true)
+ ascender = fontoptions.asc_desc[f][1] or curr.height
+ _, f = hbox_char_font(ruby, true, true)
+ descender = fontoptions.asc_desc[f][2] or ruby.depth
+
+ ruby.shift = shift - ascender - descender - ruby_t[2] -- rubysep
head = insert_before(head, curr, ruby)
end
- ruby_t = nil
- elseif curr.list then
- curr.list = process_ruby_post_linebreak(curr.list)
+ rubybox[rubyid] = nil
end
- elseif curr.list then
- curr.list = process_ruby_post_linebreak(curr.list)
+ elseif id == mathid then
+ curr = end_of_math(curr)
end
curr = getnext(curr)
end
@@ -1600,7 +1654,7 @@ local function process_reorder_tonemarks (head)
fontoptions.is_not_harf[curr.font] and
fontoptions.is_hangulscript[curr.font] then
- local uni = my_node_props(curr).unicode or curr.char
+ local uni = has_attribute(curr, unicodeattr) or curr.char
if is_hangul(uni) or is_chosong(uni) or uni == 0x25CC then
init = curr
elseif is_jungsong(uni) or is_jongsong(uni) then
@@ -1609,7 +1663,7 @@ local function process_reorder_tonemarks (head)
local n, syllable = init, { init = init }
while n do
if n.id == glyphid then
- local u = my_node_props(n).unicode or n.char
+ local u = has_attribute(n, unicodeattr) or n.char
if u then tableinsert(syllable, u) end
end
if n == curr then break end
@@ -1912,7 +1966,7 @@ end
-- charraise
-local raiseattr = luatexbase.new_attribute"luatexkoraiseattr"
+local raiseattr = new_attribute"luatexkoraiseattr"
local function process_charraise (head)
local curr = head
@@ -1957,7 +2011,7 @@ local function process_fake_slant_corr (head) -- for font fallback
tableinsert(t, char_in_font(p.font, p.char).italic or 0)
end
- local c = my_node_props(p).unicode or p.char
+ local c = has_attribute(p, unicodeattr) or p.char
if is_jungsong(c) or is_jongsong(c) or hangul_tonemark[c] then
else
break
@@ -2034,13 +2088,6 @@ end,
local pass_fun = function(...) return ... end
create_callback("luatexko_prelinebreak_first", "data", pass_fun)
create_callback("luatexko_prelinebreak_second", "data", pass_fun)
-create_callback("luatexko_do_atbegshi", "data", pass_fun)
-
-function luatexko.process_atbegshi (box)
- if box and box.list then
- box.list = call_callback("luatexko_do_atbegshi", box.list)
- end
-end
add_to_callback("pre_shaping_filter", function(h, gc)
local par = gc == ""
@@ -2250,14 +2297,20 @@ otfregister {
local auxiliary_procs = {
dotemph = {
- luatexko_do_atbegshi = process_dotemph,
+ post_linebreak_filter = process_dotemph,
+ hpack_filter = process_dotemph,
},
uline = {
- luatexko_do_atbegshi = process_uline,
+ post_linebreak_filter = function(h) return process_uline(h) end,
+ hpack_filter = function(h) return process_uline(h) end,
},
ruby = {
- pre_linebreak_filter = process_ruby_pre_linebreak,
- luatexko_do_atbegshi = process_ruby_post_linebreak,
+ pre_linebreak_filter = function(h)
+ h = process_ruby_pre_linebreak(h)
+ h = process_ruby_post_linebreak(h)
+ return h
+ end,
+ hpack_filter = process_ruby_post_linebreak,
},
autojosa = {
luatexko_prelinebreak_first = process_josa,
@@ -2267,9 +2320,16 @@ local auxiliary_procs = {
},
}
+-- dotemph 등을 수식 한글에서도 작동하게 하려면
+-- post_mlist_to_hlist_filter 콜백을 이용해야 한다.
+
function luatexko.activate (name)
for cbnam, cbfun in pairs( auxiliary_procs[name] ) do
- add_to_callback(cbnam, cbfun, "luatexko."..cbnam.."."..name)
+ local prior
+ if cbnam == "hpack_filter" then
+ prior = luatexbase.priority_in_callback(cbnam, "luaotfload.color_handler") or nil
+ end
+ add_to_callback(cbnam, cbfun, "luatexko."..cbnam.."."..name, prior)
end
active_processes[name] = true
end
@@ -2281,8 +2341,9 @@ function luatexko.deactivateall (str)
for _, name in ipairs{ "pre_shaping_filter",
"post_shaping_filter",
"pre_linebreak_filter",
+ "hpack_filter",
"hyphenate",
- "luatexko_do_atbegshi", -- might not work properly
+ "post_linebreak_filter",
} do
local t = {}
for i, v in ipairs( luatexbase.callback_descriptions(name) ) do
@@ -2304,7 +2365,3 @@ function luatexko.reactivateall ()
luatexko.deactivated = nil
end
-function luatexko.currenthashangulchars (cnt)
- texcount[cnt] = char_in_font(fontcurrent(), 0xAC00) and 1 or 0
-end
-
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
index c44ccedcbe0..b3f78f4ba42 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
@@ -12,9 +12,9 @@
% version 2006/05/20 or later.
\ifdefined\luatexkohangulfontattr \endinput\fi
-\ifdefined\selectfont
- \NeedsTeXFormat{LaTeX2e}[2020/10/01]
- \ProvidesPackage{luatexko}[2021/04/20 v3.1 typesetting Korean with LuaTeX]
+\ifdefined\ProvidesPackage
+ \NeedsTeXFormat{LaTeX2e}[2021/06/01]
+ \ProvidesPackage{luatexko}[2021/06/10 v3.2 typesetting Korean with LuaTeX]
\RequirePackage{luatexbase}
\RequirePackage{fontspec}[2020/02/03]
\else
@@ -25,52 +25,43 @@
\catcode`\@=11
\fi
\newlanguage\koreanlanguage
-\protected\def\pdfliteral{\pdfextension literal}
\newattribute\luatexkohangulfontattr
\newattribute\luatexkohanjafontattr
\newattribute\luatexkofallbackfontattr
\newattribute\luatexkoautojosaattr
\newattribute\luatexkoclassicattr
\newattribute\luatexkodotemphattr
-\newattribute\luatexkoulineattr
\newattribute\luatexkorubyattr \chardef\luatexkorubyalloc\allocationnumber
\newattribute\luatexkohangulbyhangulattr
\newattribute\luatexkohanjabyhanjaattr
\directlua{ require"luatexko" }
-\ifdefined\AtBegShi@Hook
- \edef\AtBegShi@Hook{% occupy the first position
- \unexpanded{%
- \AtBegShi@Item{%
- \directlua{%
- luatexko.process_atbegshi(tex.getbox(\the\AtBeginShipoutBox))
- }%
- }%
- }%
- \unexpanded\expandafter{\AtBegShi@Hook}%
- }
-\else
- \AddToHook{shipout/before}{%
- \directlua{ luatexko.process_atbegshi(tex.getbox(\the\ShipoutBox)) }%
- }
- \DeclareHookRule{shipout/before}{.}{before}{luacolor}
-\fi
-% classic
-\protected\def\typesetclassic{% 0
+% classics
+% 0: horizontal KO, JP
+% 1: vertical KO, SC
+% 2: horizontal SC
+% 3: horizontal TC
+% 4: vertical TC
+% 5: vertical JP
+\chardef\luatexkolangCJK=\z@ % 0:KO, 1:JP, 2:SC, 3:TC
+\protected\def\typesetclassic{%
\ifnum\luatexkoclassicattr<\z@
\luatexkoclassicattr\z@
\parindent1em
\fi
}
-\protected\def\typesetvertical{% 1
- \ifcase\luatexkoclassicattr
+\protected\def\typesetvertical{% 1, 4, 5
+ \ifcase\luatexkolangCJK
\luatexkoclassicattr\@ne
\parindent1em
\or
+ \luatexkoclassicattr=5\relax
+ \parindent1em
\or
\luatexkoclassicattr\@ne
+ \parindent2em
\or
\luatexkoclassicattr=4\relax
- \or
+ \parindent2em
\else
\luatexkoclassicattr\@ne
\parindent1em
@@ -78,7 +69,25 @@
}
\protected\def\typesetmodern{\unsetattribute\luatexkoclassicattr}
\protected\def\inhibitglue{\hskip\z@skip}
+\protected\def\japanese{% 0, 5
+ \chardef\luatexkolangCJK=\@ne
+ \ifcase\luatexkoclassicattr
+ \or
+ \luatexkoclassicattr=5\relax
+ \or
+ \luatexkoclassicattr\z@
+ \or
+ \luatexkoclassicattr\z@
+ \or
+ \luatexkoclassicattr=5\relax
+ \or
+ \else
+ \luatexkoclassicattr\z@
+ \fi
+ \parindent1em
+ }
\protected\def\Schinese{% 2, 1
+ \chardef\luatexkolangCJK=\tw@
\ifcase\luatexkoclassicattr
\luatexkoclassicattr\tw@
\or
@@ -87,12 +96,15 @@
\luatexkoclassicattr\tw@
\or
\luatexkoclassicattr\@ne
+ \or
+ \luatexkoclassicattr\@ne
\else
\luatexkoclassicattr\tw@
\fi
\parindent2em
}
\protected\def\Tchinese{% 3, 4
+ \chardef\luatexkolangCJK=\thr@@
\ifcase\luatexkoclassicattr
\luatexkoclassicattr\thr@@
\or
@@ -101,12 +113,14 @@
\luatexkoclassicattr\thr@@
\or
\or
+ \or
+ \luatexkoclassicattr=4\relax
\else
\luatexkoclassicattr\thr@@
\fi
\parindent2em
}
-\let\korean\typesetmodern \let\japanese\typesetclassic \let\chinese\Schinese
+\let\korean\typesetmodern \let\chinese\Schinese
% josa
\count@"AC00
\loop
@@ -189,19 +203,16 @@
% dotemph
\newcount\luatexkodotemphcount
\def\dotemphraise{1ex }
-\unless\ifdefined\bfseries\let\bfseries\bf\fi
-\def\dotemphchar{\bfseries\char"02D9 }
+\edef\dotemphchar{\expandafter\noexpand\ifdefined\bfseries\bfseries\else\bf\fi ^^^^02d9}
\protected\def\dotemph#1{%
\global\advance\luatexkodotemphcount\@ne
+ \ifnum\luatexkodotemphcount=\@ne \directlua{ luatexko.activate"dotemph" }\fi
\begingroup
+ \count@=\luatexkodotemphcount
\setbox\z@\hbox{\raise\dotemphraise\hbox{\dotemphchar}}%
- \directlua{
- if \the\luatexkodotemphcount == 1 then luatexko.activate("dotemph") end
- luatexko.dotemphbox[\the\luatexkodotemphcount] = node.copy(tex.box[0])
- }\luatexkodotemphattr\luatexkodotemphcount #1%
- \directlua{
- luatexko.dotemphboundary(\the\luatexkodotemphattr)
- }%
+ \directlua{ luatexko.dotemphbox[\number\count@] = node.copy(tex.box[0]) }%
+ \luatexkodotemphattr\count@ #1\relax
+ \directlua{ luatexko.dotemphboundary(\number\count@) }%
\endgroup }
% uline
\newcount\luatexkoulinecount
@@ -215,19 +226,15 @@
\luatexkomarkoverwith }
\def\luatexkomarkoverwith#1#2{%
\global\advance\luatexkoulinecount\@ne
+ \ifnum\luatexkoulinecount=\@ne \directlua{ luatexko.activate"uline" }\fi
\begingroup
+ \count@=\luatexkoulinecount
\leavevmode
\setbox\z@\hbox{#1}%
- \directlua{
- if \the\luatexkoulinecount == 1 then luatexko.activate("uline") end
- luatexko.ulboundary(\the\luatexkoulinecount,
- tex.box[0].list,
- \luatexkoleaderstype)
- }%
- \luatexkoulineattr\luatexkoulinecount #2\relax
- \directlua{
- luatexko.ulboundary(\the\luatexkoulineattr)
- }\endgroup }
+ \directlua{ luatexko.ulboundary(\number\count@, tex.box[0].list, \luatexkoleaderstype) }%
+ #2\relax
+ \directlua{ luatexko.ulboundary(\number\count@) }%
+ \endgroup }
\protected\def\uline{\markoverwith{%
\vrule width\z@ height-\ulinedown depth\dimexpr\ulinedown+\ulinewidth\relax }}
\protected\def\dashuline{\markoverwith*{%
@@ -271,15 +278,16 @@
\let\rubynooverlap\ruby@overlapfalse
\rubyoverlap % ruby may hangover neighboring chars
\newcount\luatexkorubycount
-\def\luatexkorubybasehbox{\hbox attr\luatexkorubyalloc=\luatexkorubycount}
\protected\def\ruby#1#2{%
\global\advance\luatexkorubycount\@ne
+ \ifnum\luatexkorubycount=\@ne \directlua{ luatexko.activate"ruby" }\fi
\begingroup
+ \count@=\luatexkorubycount
\leavevmode
- \setbox\z@\luatexkorubybasehbox{#1}% base
+ \setbox\z@\hbox attr\luatexkorubyalloc=\count@{#1}% base
\setbox\tw@\hbox{% ruby
\ifdefined\rubyfont \rubyfont \fi
- \ifdefined\selectfont % <- latex
+ \ifcsname ver@luatexko.sty\endcsname % <- latex
\dimen@\dimexpr\rubysize em\relax
\fontsize\dimen@\dimen@\selectfont
\fi
@@ -291,13 +299,13 @@
\ifruby@overlap
\dimen@\dimexpr\wd\tw@-\wd\z@-\dimen@ii\relax % overhang .5 rubysize
\ifdim\dimen@ > \z@
- \setbox\z@\luatexkorubybasehbox spread\dimen@{%
+ \setbox\z@\hbox attr\luatexkorubyalloc=\count@ spread\dimen@{%
\hskip\z@ plus \luatexkostretchfactor em\relax
\unhbox\z@
\hskip\z@ plus \luatexkostretchfactor em\relax }%
\fi
\else
- \setbox\z@\luatexkorubybasehbox to\wd\tw@{%
+ \setbox\z@\hbox attr\luatexkorubyalloc=\count@ to\wd\tw@{%
\hskip\z@ plus \luatexkostretchfactor em\relax
\unhbox\z@
\hskip\z@ plus \luatexkostretchfactor em\relax }%
@@ -316,8 +324,7 @@
\fi
\fi
\directlua{
- if \the\luatexkorubycount == 1 then luatexko.activate("ruby") end
- luatexko.rubybox[\the\luatexkorubycount] = {
+ luatexko.rubybox[\number\count@] = {
node.copy(tex.box[2]),
\number\numexpr\dimexpr\rubysep\relax\relax,
\ifruby@overlap true\else false\fi, }}%
@@ -337,56 +344,62 @@
% vertical writing
\protected\def\vertical#1{%
\leavevmode
- \setbox\z@\vbox\bgroup
- \hsize#1\relax
- \typesetvertical }
+ \ifx\empty#1\empty
+ \setbox\z@\hbox\bgroup
+ \else
+ \setbox\z@\vbox\bgroup \hsize#1\relax
+ \fi
+ \typesetvertical }
\protected\def\endvertical{%
\egroup
\luatexkorotatebox\z@
\box\z@ }
\protected\def\luatexkorotatebox#1{%
- \setbox#1\hbox to\dimexpr\ht#1+\dp#1{%
+ \dimen@\dimexpr\ht#1+\dp#1\relax
+ \setbox#1\hbox to\dimen@\bgroup
\hfil
- \vbox to\wd#1{%
- \wd#1\z@ \ht#1\z@ \dp#1\z@
- \pdfliteral{q 0 -1 1 0 0 0 cm}\box#1\pdfliteral{Q}%
- \vfil }}}
+ \vbox to\wd#1\bgroup
+ \wd#1\z@
+ \pdfextension save\relax
+ \pdfextension setmatrix{0 -1 1 0}\relax
+ \box#1\relax
+ \kern-\dimen@
+ \pdfextension restore\relax
+ \vfil
+ \egroup
+ \egroup
+}
% horizontal box inside vertical writing
\def\luatexkohorizboxmoveright{0.5ex}
\protected\def\horizontal#1{%
\directlua{ luatexko.gethorizboxmoveright() }%
\leavevmode
- \setbox\z@\vbox\bgroup
- \hsize#1\relax
- \typesetmodern }
+ \ifx\empty#1\empty
+ \setbox\z@\hbox\bgroup
+ \else
+ \setbox\z@\vbox\bgroup \hsize#1\relax
+ \fi
+ \typesetmodern }
\protected\def\endhorizontal{%
\egroup
- \dimen@=\dimexpr.5\wd\z@-\luatexkohorizboxmoveright\relax
\luatexkounrotatebox\z@
- \lower\dimen@\box\z@ }
+ \raise\luatexkohorizboxmoveright
+ \box\z@ }
\protected\def\luatexkounrotatebox#1{%
- \setbox#1\hbox to\dimexpr\ht#1+\dp#1{%
- \vbox to\wd#1{%
+ \dimen@\dimexpr\ht#1+\dp#1\relax
+ \setbox#1\hbox to\dimen@\bgroup
+ \lower.5\wd#1\vbox to\wd#1\bgroup
\vfil
- \wd#1\z@ \ht#1\z@ \dp#1\z@
- \pdfliteral{q 0 1 -1 0 0 0 cm}\box#1\pdfliteral{Q}}%
- \hfil }}
-% do not veticalize headline/footline
-\ifdefined\selectfont
- \def\verticaltypesetting{%
- \maxdepth\z@ \typesetvertical
- \dimen@\textwidth \textwidth\textheight \textheight\dimen@
- \edef\@outputpage{\unexpanded{\luatexkorotatebox\@outputbox
- \textwidth\textheight}\unexpanded\expandafter{\@outputpage}}}
-\else
- \def\verticaltypesetting{%
- \dimen@\hsize \hsize\vsize \vsize\dimen@
- \edef\plainoutput{\unexpanded{\dimen@\hsize \hsize\vsize \vsize\dimen@}%
- \unexpanded\expandafter{\plainoutput}}%
- \def\pagebody{\setbox\z@\vbox to\hsize{\boxmaxdepth=\maxdepth
- \pagecontents}\luatexkorotatebox\z@\box\z@}%
- \maxdepth\z@ \typesetvertical }
-\fi
+ \wd#1\z@
+ \pdfextension save\relax
+ \pdfextension setmatrix{0 1 -1 0}\relax
+ \box#1\relax
+ \kern-\dimen@
+ \pdfextension restore\relax
+ \egroup
+ \hfil
+ \egroup
+}
% hangul normalize
\def\luatexhangulnormalize{%
\directlua{require"luatexko-normalize"}%
@@ -443,16 +456,51 @@
\fi
\fi }
% plain
-\ifdefined\selectfont\else
+\ifcsname ver@luatexko.sty\endcsname\else
+ % do not verticalize headline/footline.
+ \def\verticaltypesetting{%
+ \dimen@\hsize \hsize\vsize \vsize\dimen@
+ \edef\plainoutput{\dimen@\hsize \hsize\vsize \vsize\dimen@
+ \unexpanded\expandafter{\plainoutput}}%
+ \def\pagebody{\setbox\z@\vbox to\hsize{\boxmaxdepth=\maxdepth \pagecontents}%
+ \luatexkorotatebox\z@\box\z@}%
+ \maxdepth\z@ \typesetvertical
+ \let\verticaltypesetting\relax % prevent multiple running
+ }
+ \def\beginverticaltypesetting{\vfill\supereject \begingroup \verticaltypesetting}
+ \def\endverticaltypesetting{\vfill\supereject \endgroup}
+ % hangul fonts
\protected\def\hangulfont{%
\afterassignment\luatexkohangulselectfont\font\luatexkohangulfont}
\protected\def\hanjafont{%
\afterassignment\luatexkohanjaselectfont\font\luatexkohanjafont}
\protected\def\fallbackfont{%
\afterassignment\luatexkofallbackselectfont\font\luatexkofallbackfont}
- \newfam\symmathhangul
+ \def\sethangulfont#1{%
+ \def\@tempa{#1}\edef\@tempb{\csstring#1}%
+ \expandafter\afterassignment\expandafter\luatexko@sethangulfont
+ \expandafter\font\csname luatexko.hangulfont.\@tempb\endcsname }
+ \def\luatexko@sethangulfont{%
+ \expandafter\protected\expandafter\edef\@tempa{%
+ \luatexkohangulfontattr\fontid\csname luatexko.hangulfont.\@tempb\endcsname\relax }}
+ \def\sethanjafont#1{%
+ \def\@tempa{#1}\edef\@tempb{\csstring#1}%
+ \expandafter\afterassignment\expandafter\luatexko@sethanjafont
+ \expandafter\font\csname luatexko.hanjafont.\@tempb\endcsname }
+ \def\luatexko@sethanjafont{%
+ \expandafter\protected\expandafter\edef\@tempa{%
+ \luatexkohanjafontattr\fontid\csname luatexko.hanjafont.\@tempb\endcsname\relax }}
+ \def\setfallbackfont#1{%
+ \def\@tempa{#1}\edef\@tempb{\csstring#1}%
+ \expandafter\afterassignment\expandafter\luatexko@setfallbackfont
+ \expandafter\font\csname luatexko.fallbackfont.\@tempb\endcsname }
+ \def\luatexko@setfallbackfont{%
+ \expandafter\protected\expandafter\edef\@tempa{%
+ \luatexkofallbackfontattr\fontid\csname luatexko.fallbackfont.\@tempb\endcsname\relax }}
+ \hangulfont={UnBatang:mode=node;script=hang;+tlig} at 10pt % default: unbatang
\protected\def\setmathhangulfonts#1#2#3{% font identifiers
- \ifnum\Umathcharfam"AC00=\symmathhangul\else
+ \ifnum\Umathcodenum"AC00="AC00\relax
+ \csname newfam\endcsname\symmathhangul
\setmathhangulblock{AC00}{D7A3}%
\fi
\textfont\symmathhangul=#1\relax
@@ -471,17 +519,41 @@
\catcode`\@=\luatexkoatcatcode
\endinput\fi
% latex
-\IfHookExistsTF{selectfont}{
- \AddToHook{selectfont}{%
- \luatexkohangulselectfont
- \luatexkohanjaselectfont
- \luatexkofallbackselectfont }
-}{
- \RequirePackage{everysel}
- \EverySelectfont{%
- \luatexkohangulselectfont
- \luatexkohanjaselectfont
- \luatexkofallbackselectfont }
+% do not verticalize headline/footline
+\def\verticaltypesetting{%
+ \ifx\@nodocument\relax % not in the preamble
+ \clearpage
+ \begingroup
+ \fi
+ \hsize\textheight \vsize\textwidth
+ \textwidth\hsize \textheight\vsize
+ \@colroom\vsize \@colht\vsize
+ \if@twocolumn
+ \columnwidth=.5\dimexpr\textwidth-\columnsep\relax
+ \linewidth\columnwidth \hsize\columnwidth
+ \else
+ \linewidth\hsize \columnwidth\hsize
+ \fi
+ \expandafter\def\expandafter\@outputpage\expandafter{%
+ \expandafter\luatexkorotatebox\expandafter\@outputbox
+ \expandafter\textwidth\expandafter\textheight
+ \@outputpage
+ }%
+ \maxdepth\z@ \typesetvertical
+ \let\verticaltypesetting\relax % prevent multiple running
+}
+\def\endverticaltypesetting{%
+ \clearpage
+ \endgroup
+ \global\@colroom\textheight
+ \global\@colht\textheight
+ \global\vsize\textheight
+}
+% hangul fonts
+\AddToHook{selectfont}{%
+ \luatexkohangulselectfont
+ \luatexkohanjaselectfont
+ \luatexkofallbackselectfont
}
\AddToHook{rmfamily}{%
\let\luatexkohangulfont \luatexkomainhangulfont
@@ -505,26 +577,9 @@
}
% fontspec-like
\ExplSyntaxOn
-\cs_new_nopar:Npn \l_luatexko_silent_upshape {
- \tl_map_inline:nn { \mddefault \bfdefault }
- {
- \cs_if_exist:cF
- { \g_fontspec_encoding_tl/\l_fontspec_family_tl/##1/\updefault }
- {
- \cs_if_exist:cT
- { \g_fontspec_encoding_tl/\l_fontspec_family_tl/##1/\shapedefault }
- {
- \cs_set_eq:cc
- { \g_fontspec_encoding_tl/\l_fontspec_family_tl/##1/\updefault }
- { \g_fontspec_encoding_tl/\l_fontspec_family_tl/##1/\shapedefault }
- }
- }
- }
-}
\DeclareDocumentCommand \setmainhangulfont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkomainhangulfamily { Ligatures=TeX, #1, #3 } { #2 }
- \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkomainhangulfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -541,7 +596,6 @@
\DeclareDocumentCommand \setsanshangulfont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkosanshangulfamily { Ligatures=TeX, #1, #3 } { #2 }
- \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkosanshangulfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -558,7 +612,6 @@
\DeclareDocumentCommand \setmonohangulfont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkomonohangulfamily { #1, #3 } { #2 }
- \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkomonohangulfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -575,7 +628,6 @@
\DeclareDocumentCommand \newhangulfontfamily { m O{} m O{} }
{
\fontspec_set_family:cnn { luatexko_user_family_ \cs_to_str:N #1 } { #2, #4 } { #3 }
- \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn #1
{
\cs_set_nopar:Npn \luatexkohangulfont
@@ -594,7 +646,6 @@
\DeclareDocumentCommand \hangulfontspec { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkohangulfontfamily { #1, #3 } { #2 }
- \l_luatexko_silent_upshape
\cs_set_nopar:Npn \luatexkohangulfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -606,7 +657,6 @@
\DeclareDocumentCommand \setmainhanjafont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkomainhanjafamily { Ligatures=TeX, #1, #3 } { #2 }
- \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkomainhanjafont
{
\fontencoding \g_fontspec_encoding_tl
@@ -623,7 +673,6 @@
\DeclareDocumentCommand \setsanshanjafont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkosanshanjafamily { Ligatures=TeX, #1, #3 } { #2 }
- \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkosanshanjafont
{
\fontencoding \g_fontspec_encoding_tl
@@ -640,7 +689,6 @@
\DeclareDocumentCommand \setmonohanjafont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkomonohanjafamily { #1, #3 } { #2 }
- \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkomonohanjafont
{
\fontencoding \g_fontspec_encoding_tl
@@ -657,7 +705,6 @@
\DeclareDocumentCommand \newhanjafontfamily { m O{} m O{} }
{
\fontspec_set_family:cnn { luatexko_user_family_ \cs_to_str:N #1 } { #2, #4 } { #3 }
- \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn #1
{
\cs_set_nopar:Npn \luatexkohanjafont
@@ -676,7 +723,6 @@
\DeclareDocumentCommand \hanjafontspec { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkohanjafontfamily { #1, #3 } { #2 }
- \l_luatexko_silent_upshape
\cs_set_nopar:Npn \luatexkohanjafont
{
\fontencoding \g_fontspec_encoding_tl
@@ -689,7 +735,6 @@
\DeclareDocumentCommand \setmainfallbackfont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkomainfallbackfamily { Ligatures=TeX, #1, #3 } { #2 }
- \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkomainfallbackfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -706,7 +751,6 @@
\DeclareDocumentCommand \setsansfallbackfont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkosansfallbackfamily { Ligatures=TeX, #1, #3 } { #2 }
- \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkosansfallbackfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -723,7 +767,6 @@
\DeclareDocumentCommand \setmonofallbackfont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkomonofallbackfamily { #1, #3 } { #2 }
- \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn \luatexkomonofallbackfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -740,7 +783,6 @@
\DeclareDocumentCommand \newfallbackfontfamily { m O{} m O{} }
{
\fontspec_set_family:cnn { luatexko_user_family_ \cs_to_str:N #1 } { #2, #4 } { #3 }
- \l_luatexko_silent_upshape
\cs_set_protected_nopar:Npn #1
{
\cs_set_nopar:Npn \luatexkofallbackfont
@@ -759,7 +801,6 @@
\DeclareDocumentCommand \fallbackfontspec { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkofallbackfontfamily { #1, #3 } { #2 }
- \l_luatexko_silent_upshape
\cs_set_nopar:Npn \luatexkofallbackfont
{
\fontencoding \g_fontspec_encoding_tl
@@ -771,9 +812,8 @@
\DeclareDocumentCommand \setmathhangulfont { O{} m O{} }
{
\fontspec_set_family:Nnn \luatexkomathhangulfamily { #1, #3 } { #2 }
- \l_luatexko_silent_upshape
\DeclareSymbolFont { mathhangul }
- \g_fontspec_encoding_tl \luatexkomathhangulfamily \mddefault \updefault
+ \g_fontspec_encoding_tl \luatexkomathhangulfamily \seriesdefault \shapedefault
\int_compare:nNnF { \Umathcharfam"AC00 } = { \symmathhangul }
{
\setmathhangulblock{AC00}{D7A3}
@@ -785,22 +825,11 @@
\let\adhochanjafont\hanjafontspec
\let\adhocfallbackfont\fallbackfontspec
% interhangul, interlatincjk, charraise
-\def\luatexkosilentupshape{%
- \@tfor \@tempa := \mddefault \bfdefault \do {%
- \ifcsname \f@encoding/\f@family/\@tempa/\updefault\endcsname \else
- \ifcsname \f@encoding/\f@family/\@tempa/\shapedefault\endcsname
- \global \expandafter\let
- \csname \f@encoding/\f@family/\@tempa/\updefault \expandafter\endcsname
- \csname \f@encoding/\f@family/\@tempa/\shapedefault\endcsname
- \fi\fi
- }%
-}
\protected\def\addhangulfontfeature#1{%
\begingroup
\ifdefined\luatexkohangulfont
- \fontseries\mddefault\fontshape\shapedefault \luatexkohangulfont \fi
+ \fontseries\seriesdefault\fontshape\shapedefault \luatexkohangulfont \fi
\addfontfeature{#1}%
- \luatexkosilentupshape
\edef\x{\endgroup
\def\noexpand\luatexkohangulfont{%
\noexpand\fontencoding{\UTFencname}%
@@ -811,9 +840,8 @@
\protected\def\addhanjafontfeature#1{%
\begingroup
\ifdefined\luatexkohanjafont
- \fontseries\mddefault\fontshape\shapedefault \luatexkohanjafont \fi
+ \fontseries\seriesdefault\fontshape\shapedefault \luatexkohanjafont \fi
\addfontfeature{#1}%
- \luatexkosilentupshape
\edef\x{\endgroup
\def\noexpand\luatexkohanjafont{%
\noexpand\fontencoding{\UTFencname}%
@@ -824,9 +852,8 @@
\protected\def\addfallbackfontfeature#1{%
\begingroup
\ifdefined\luatexkofallbackfont
- \fontseries\mddefault\fontshape\shapedefault \luatexkofallbackfont \fi
+ \fontseries\seriesdefault\fontshape\shapedefault \luatexkofallbackfont \fi
\addfontfeature{#1}%
- \luatexkosilentupshape
\edef\x{\endgroup
\def\noexpand\luatexkofallbackfont{%
\noexpand\fontencoding{\UTFencname}%
@@ -854,25 +881,22 @@
\AtBeginDocument{
% default hangul fonts
\ifdefined\luatexkomainhangulfont\else
- \begingroup\rmfamily
- \directlua{ luatexko.currenthashangulchars(255) }\expandafter\endgroup
- \ifnum\count@=\z@
+ \begingroup\rmfamily\expandafter\endgroup
+ \iffontchar\font"AC00 \else
\IfFontExistsTF{UnBatang.ttf}
{\setmainhangulfont{UnBatang}[Script=Hangul,Language=Korean]}
{}
\fi
\fi
\ifdefined\luatexkosanshangulfont\else
- \begingroup\sffamily
- \directlua{ luatexko.currenthashangulchars(255) }\expandafter\endgroup
- \ifnum\count@=\z@
+ \begingroup\sffamily\expandafter\endgroup
+ \iffontchar\font"AC00 \else
\IfFontExistsTF{UnDotum.ttf}{\setsanshangulfont{UnDotum}}{}
\fi
\fi
\ifdefined\luatexkomonohangulfont\else
- \begingroup\ttfamily
- \directlua{ luatexko.currenthashangulchars(255) }\expandafter\endgroup
- \ifnum\count@=\z@
+ \begingroup\ttfamily\expandafter\endgroup
+ \iffontchar\font"AC00 \else
\def\@tempa{lmtt}\def\@tempb{LatinModernMono(0)}
\ifnum 0\ifx\ttdefault\@tempa 1\else\ifx\ttdefault\@tempb 1\fi\fi >\z@
\IfFontExistsTF{UnDotum.ttf}