summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-01-20 23:18:34 +0000
committerKarl Berry <karl@freefriends.org>2014-01-20 23:18:34 +0000
commit72cab7bce1d68c5d53ee82a50de80e3aa10950fb (patch)
treec89406b3242fc2d891c83a37bac1c3664bff67aa /Master/texmf-dist/tex
parent70a9a637489e651f4aee19179e792b79d7ab79f6 (diff)
luatexko (20jan14)
git-svn-id: svn://tug.org/texlive/trunk@32740 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty19
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko.lua455
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko.sty33
3 files changed, 289 insertions, 218 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty
index 871a4a29cab..22cf34ffdfa 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty
@@ -14,7 +14,7 @@
\input luaotfload.sty
\catcode`@ = 11
\else
- \ProvidesPackage{luatexko-core}[2013/12/06 v1.3 Typesetting Korean with LuaTeX]
+ \ProvidesPackage{luatexko-core}[2014/01/04 v1.4 Typesetting Korean with LuaTeX]
\RequirePackage{luaotfload}[2013/05/23]
\fi
@@ -33,12 +33,9 @@
\RequireLuaModule{luatexko}
%% japanese/chinese/pre-modern
-\protected\def\japanese{\frenchspacing\cjtypesetattr\@ne
- \luatexkolatinspaceskip\parindent1em }
-\protected\def\Schinese{\frenchspacing\cjtypesetattr\tw@
- \luatexkolatinspaceskip\parindent2em }
-\protected\def\Tchinese{\frenchspacing\cjtypesetattr\thr@@
- \luatexkolatinspaceskip\parindent2em }
+\protected\def\japanese{\frenchspacing\cjtypesetattr\@ne \parindent1em }
+\protected\def\Schinese{\frenchspacing\cjtypesetattr\tw@ \parindent2em }
+\protected\def\Tchinese{\frenchspacing\cjtypesetattr\thr@@\parindent2em }
\let\chinese\Schinese
% korean in japanese/chinese env.
\protected\def\korean{\unsetluatexattribute\cjtypesetattr}
@@ -46,9 +43,6 @@
% inhibitglue
\protected\def\inhibitglue{{\unsetluatexattribute\cjtypesetattr\hskip\z@skip}}
-\def\luatexkolatinspaceskip{\spaceskip\fontdimen\tw@\the\font
- plus \fontdimen\thr@@\the\font minus \fontdimen4\the\font}
-
%% auto josa
\def\josaignoreparens{\afterassignment\josa@ignore@parens\count@}
\def\josa@ignore@parens{%
@@ -245,7 +239,6 @@
\expandafter\expandafter\expandafter
\endgroup
\expandafter\hanjfntattr\luatexfontid\font\relax
-% \ifnum\cjtypesetattr>\z@\luatexkolatinspaceskip\fi
}
\def\luatexko@fallback@selectfont{%
\begingroup
@@ -257,7 +250,6 @@
\expandafter\expandafter\expandafter
\endgroup
\expandafter\fallbackfntattr\luatexfontid\font\relax
-% \ifnum\cjtypesetattr>\z@\luatexkolatinspaceskip\fi
}
\let\check@hangul@family\relax
\let\check@hanja@family \relax
@@ -364,9 +356,6 @@
\fi\fi
}
-%% frenchspacing is default
-\frenchspacing
-
%% 말줄임표
\def\hellipsis{^^^^2026^^^^2026}
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko.lua
index 3d24259379d..8ef25e1f439 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 = '2013/12/06',
- version = 1.3,
+ date = '2014/01/06',
+ version = 1.4,
description = 'Korean linebreaking and font-switching',
author = 'Dohyun Kim',
license = 'LPPL v1.3+',
@@ -528,6 +528,11 @@ local function is_jungjongsong (c)
or c == 0x302E or c == 0x302F -- tone marks
end
+local function is_unicode_vs (c)
+ return (c >= 0xFE00 and c <= 0xFE0F )
+ or (c >= 0xE0100 and c <= 0xE01EF)
+end
+
local function get_cjk_class (ch, cjtype)
if ch then
if is_hangul(ch) then return 7 end -- hangul = 7
@@ -890,60 +895,63 @@ end
----------------------------------
local function compress_fullwidth_punctuations (head)
for curr in traverse_id(glyphnode,head) do
- local uni = get_unicode_char(curr)
- local class = uni and get_cjk_class(uni, has_attribute(curr, cjtypesetattr))
- local chr = get_font_char(curr.font, curr.char)
- if chr and class and class >= 1 and class <= 4 then
- local width = curr.width or 655360
- emsize = get_font_emsize(curr.font)
- local ensize = emsize/2
- local oneoften = emsize/10
- local bbox = get_char_boundingbox(curr.font, curr.char)
- if not bbox then return head end --
- if class == 2 or class == 4 then
- local wd
- if get_font_feature(curr.font,'vertical') then
- wd = ensize<width and ensize-width or 0
- else
- wd = (bbox[3] < ensize) and ensize-width or bbox[3]-width+oneoften
- end
- if chr.right_protruding then
- -- kern is a breakpoint if followed by a glue
- insert_after(head, curr, get_kernnode(wd))
- else
- insert_after(head, curr, get_rulenode(wd))
- end
- elseif class == 1 then
- local wd
- if get_font_feature(curr.font,'vertical') then
- wd = ensize<width and ensize-width or 0
- else
- wd = (width-bbox[1] < ensize) and ensize-width or -bbox[1]+oneoften
- end
- if chr.left_protruding then
- head = insert_before(head, curr, get_kernnode(wd))
- else
- head = insert_before(head, curr, get_rulenode(wd))
- end
- elseif class == 3 then
- local lwd, rwd
- local quarter, thirdquarter, halfwd = ensize/2, ensize*1.5, width/2
- if get_font_feature(curr.font,'vertical') then
- rwd = quarter<halfwd and quarter-halfwd or 0
- lwd = rwd
- else
- rwd = (bbox[3] < thirdquarter) and quarter-halfwd or bbox[3]-width
- lwd = (width-bbox[1] < thirdquarter) and quarter-halfwd or -bbox[1]
- end
- if chr.left_protruding then
- head = insert_before(head, curr, get_kernnode(lwd))
- else
- head = insert_before(head, curr, get_rulenode(lwd))
- end
- if chr.right_protruding then
- insert_after (head, curr, get_kernnode(rwd))
- else
- insert_after (head, curr, get_rulenode(rwd))
+ if get_font_feature(curr.font,'halt') or get_font_feature(curr.font,'vhal') then
+ else
+ local uni = get_unicode_char(curr)
+ local class = uni and get_cjk_class(uni, has_attribute(curr, cjtypesetattr))
+ local chr = get_font_char(curr.font, curr.char)
+ if chr and class and class >= 1 and class <= 4 then
+ local width = curr.width or 655360
+ emsize = get_font_emsize(curr.font)
+ local ensize = emsize/2
+ local oneoften = emsize/10
+ local bbox = get_char_boundingbox(curr.font, curr.char)
+ if not bbox then return head end --
+ if class == 2 or class == 4 then
+ local wd
+ if get_font_feature(curr.font,'vertical') then
+ wd = ensize<width and ensize-width or 0
+ else
+ wd = (bbox[3] < ensize) and ensize-width or bbox[3]-width+oneoften
+ end
+ if chr.right_protruding then
+ -- kern is a breakpoint if followed by a glue
+ insert_after(head, curr, get_kernnode(wd))
+ else
+ insert_after(head, curr, get_rulenode(wd))
+ end
+ elseif class == 1 then
+ local wd
+ if get_font_feature(curr.font,'vertical') then
+ wd = ensize<width and ensize-width or 0
+ else
+ wd = (width-bbox[1] < ensize) and ensize-width or -bbox[1]+oneoften
+ end
+ if chr.left_protruding then
+ head = insert_before(head, curr, get_kernnode(wd))
+ else
+ head = insert_before(head, curr, get_rulenode(wd))
+ end
+ elseif class == 3 then
+ local lwd, rwd
+ local quarter, thirdquarter, halfwd = ensize/2, ensize*1.5, width/2
+ if get_font_feature(curr.font,'vertical') then
+ rwd = quarter<halfwd and quarter-halfwd or 0
+ lwd = rwd
+ else
+ rwd = (bbox[3] < thirdquarter) and quarter-halfwd or bbox[3]-width
+ lwd = (width-bbox[1] < thirdquarter) and quarter-halfwd or -bbox[1]
+ end
+ if chr.left_protruding then
+ head = insert_before(head, curr, get_kernnode(lwd))
+ else
+ head = insert_before(head, curr, get_rulenode(lwd))
+ end
+ if chr.right_protruding then
+ insert_after (head, curr, get_kernnode(rwd))
+ else
+ insert_after (head, curr, get_rulenode(rwd))
+ end
end
end
end
@@ -1408,7 +1416,7 @@ local function font_substitute(head)
end
end
end
- if not korid then
+ if not korid and not is_unicode_vs(curr.char) then
warn("!Missing character: %s U+%04X", utf8char(curr.char),curr.char)
end
end
@@ -1427,136 +1435,9 @@ local function assign_unicode_codevalue (head)
return head
end
-
-------------------------------------
--- vertical typesetting: EXPERIMENTAL -- don't use this
-------------------------------------
----[[no vwidth in luaotfload v2
-local tsbtable = {}
-
-local function read_tsb_table(filename)-- for ttx-generated vmtx table
- if tsbtable[filename] then
- return tsbtable[filename]
- end
- local filepath = kpse.find_file(filename)
- if not filepath then return end
- local file = io.open(filepath, "r")
- if not file then return end
- local tsbtb = {}
- local patt = 'name="(.-)" height="(.-)" tsb="(.-)"'
- while true do
- local l = file:read("*line")
- if not l then break end
- for name, height, tsb in stringgmatch(l,patt) do
- tsbtb[name] = {}
- tsbtb[name].height = height
- tsbtb[name].tsb = tsb
- end
- end
- file:close()
- tsbtable[filename] = tsbtb
- return tsbtb
-end
-
-local function cjk_vertical_font (vf)
- if not vf.shared then return end
- if not vf.shared.features then return end
- if not vf.shared.features["vertical"] then return end
- if vf.type == "virtual" then return end
-
- --- for read-ttx
- local filename = vf.filename
- filename = stringgsub(filename,".*/","")
- filename = stringgsub(filename,"[tToO][tT][fF]$","ttx")
- local tsbtable = read_tsb_table(filename)
- if not tsbtable then
- warn("Cannot read %s. Aborting vertical typesetting.",filename)
- return
- end
- ---
-
- local tmp = table.copy(vf) -- fastcopy takes time too long.
- local id = fontdefine(tmp)
-
- local hash = vf.properties and vf.properties.hash and vf.properties.hash..' @ vertical'
- hash = hash or (vf.name and vf.size and vf.name..' @ '..vf.size..' @ vertical')
-
- vf.properties = vf.properties or {}
- vf.properties.hash = vf.properties.hash or ""
- vf.properties.hash = hash
- vf.type = 'virtual'
- vf.fonts = {{ id = id }}
- local quad = vf.parameters and vf.parameters.quad or 655360
- local descriptions = vf.shared and vf.shared.rawdata and vf.shared.rawdata.descriptions
- local ascender = vf.parameters and vf.parameters.ascender
- local factor = vf.parameters and vf.parameters.factor
- local halfxht = (vf.parameters and vf.parameters.x_height and vf.parameters.x_height/2) or quad/4
- for i,v in pairs(vf.characters) do
- local dsc = descriptions[i]
- local gname = dsc.name
- -- local vw = dsc and dsc.vwidth
- --- for read-ttx
- local vw = tsbtable and tsbtable[gname] and tsbtable[gname].height
- local tsb = tsbtable and tsbtable[gname] and tsbtable[gname].tsb
- if not vw and dsc.index then
- local cid = stringformat("cid%05d", dsc.index)
- vw = tsbtable and tsbtable[cid] and tsbtable[cid].height
- tsb = tsbtable and tsbtable[cid] and tsbtable[cid].tsb
- end
- tsb = tsb and factor and tsb*factor
- ---
- vw = vw and factor and vw * factor
- vw = vw or quad
- local vh = dsc and dsc.boundingbox and dsc.boundingbox[3]
- vh = vh and factor and vh * factor
- vh = vh and vh - quad/2 or quad/2
- vh = vh + halfxht
- vh = vh > 0 and vh or nil
- local vd = dsc and dsc.boundingbox and dsc.boundingbox[1]
- vd = vd and factor and vd * factor
- vd = vd and quad/2 - vd or quad/2
- vd = vd - halfxht
- vd = vd > 0 and vd or nil
- local bb4 = dsc and dsc.boundingbox and dsc.boundingbox[4]
- bb4 = bb4 and factor and bb4*factor
- local asc = bb4 and tsb and bb4 + tsb
- asc = asc or ascender
- v.commands = {
- {'right', asc}, -- bbox4 + top_side_bearing! But, tsb not available!
- {'down', halfxht},
- {'special', 'pdf: q 0 1 -1 0 0 0 cm'},
- {'push'},
- {'char', i},
- {'pop'},
- {'special', 'pdf: Q'},
- }
- v.width = vw
- v.height = vh
- v.depth = vd
- end
- return vf
-end
-
-local function activate_vertical_virtual (tfmdata,value)
- local loaded = luatexbase.priority_in_callback("luaotfload.patch_font",
- "luatexko.vertical_virtual_font")
- if value and not loaded then
- add_to_callback("luaotfload.patch_font",
- cjk_vertical_font,
- "luatexko.vertical_virtual_font")
- end
-end
-
-local otffeatures = fonts.constructors.newfeatures("otf")
-otffeatures.register {
- name = "vertical",
- description = "vertical typesetting",
- initializers = {
- node = activate_vertical_virtual,
- }
-}
---no vwidth in luaotfload v2]]
-
+-----------------------------
+-- reorder hangul tone marks
+-----------------------------
local function reorderTM (head)
for curr in traverse_id(glyphnode, head) do
if curr.width > 0 then -- old hangul vertical typesetting is broken?
@@ -1579,6 +1460,29 @@ local function reorderTM (head)
return head
end
+-----------------------------
+-- ideographic variation selector
+-----------------------------
+local function hanja_vs_support (head)
+ for curr in traverse_id(glyphnode, head) do
+ local cc = curr.char
+ if is_unicode_vs(cc) then
+ local prev = curr.prev
+ if prev and prev.id == glyphnode then
+ local f = get_font_table(prev.font)
+ local ivs = f and f.resources and f.resources.variants
+ ivs = ivs and ivs[cc] and ivs[cc][prev.char]
+ -- !!! ARRRG! the font table doesn't have variants for non-BMP chars.
+ if ivs then
+ prev.char = ivs
+ head = remove_node(head,curr)
+ end
+ end
+ end
+ end
+ return head
+end
+
----------------------------------
-- add to callback : pre-linebreak
----------------------------------
@@ -1587,6 +1491,7 @@ add_to_callback('hpack_filter', function(head)
korean_autojosa(head)
remove_cj_spaceskip(head)
font_substitute(head)
+ head = hanja_vs_support(head)
return head
end, 'luatexko.hpack_filter_first',1)
@@ -1605,6 +1510,7 @@ add_to_callback('pre_linebreak_filter', function(head)
korean_autojosa(head)
remove_cj_spaceskip(head)
font_substitute(head)
+ head = hanja_vs_support(head)
return head
end, 'luatexko.pre_linebreak_filter_first',1)
@@ -1669,7 +1575,7 @@ local function after_linebreak_ruby (head)
after_linebreak_ruby(curr.head) -- hlist may be nested!!!
local attr = has_attribute(curr,luakorubyattr)
if attr then
- local ruby = rubynode[attr][1]
+ local ruby = rubynode[attr] and rubynode[attr][1]
if ruby then
if ruby.width < curr.width then
local rubyhead = ruby.head
@@ -1759,3 +1665,176 @@ add_to_callback("post_linebreak_filter", function(head)
return head
end, 'luatexko.post_linebreak_filter')
+
+------------------------------------
+-- vertical typesetting: EXPERIMENTAL -- don't use this
+------------------------------------
+---[[no vwidth in luaotfload v2
+local tsbtable = {}
+
+local function read_tsb_table(filename)-- for ttx-generated vmtx table
+ if tsbtable[filename] then
+ return tsbtable[filename]
+ end
+ local filepath = kpse.find_file(filename)
+ if not filepath then return end
+ local file = io.open(filepath, "r")
+ if not file then return end
+ local tsbtb = {}
+ local patt = 'name="(.-)" height="(.-)" tsb="(.-)"'
+ while true do
+ local l = file:read("*line")
+ if not l then break end
+ for name, height, tsb in stringgmatch(l,patt) do
+ tsbtb[name] = {}
+ tsbtb[name].height = height
+ tsbtb[name].tsb = tsb
+ end
+ end
+ file:close()
+ tsbtable[filename] = tsbtb
+ return tsbtb
+end
+
+local function cjk_vertical_font (vf)
+ if not vf.shared then return end
+ if not vf.shared.features then return end
+ if not vf.shared.features["vertical"] then return end
+ if vf.type == "virtual" then return end
+
+ ---[[ for read-ttx
+ local filename = vf.filename
+ filename = stringgsub(filename,".*/","")
+ filename = stringgsub(filename,"[tToO][tT][fF]$","ttx")
+ local tsbtable = read_tsb_table(filename)
+ if not tsbtable then
+ warn("Cannot read %s. Aborting vertical typesetting.",filename)
+ return
+ end
+ --]]
+
+ local tmp = table.copy(vf) -- fastcopy takes time too long.
+ local id = fontdefine(tmp)
+
+ local hash = vf.properties and vf.properties.hash and vf.properties.hash..' @ vertical'
+ hash = hash or (vf.name and vf.size and vf.name..' @ '..vf.size..' @ vertical')
+
+ vf.properties = vf.properties or {}
+ vf.properties.hash = hash
+ vf.type = 'virtual'
+ vf.fonts = {{ id = id }}
+ local quad = vf.parameters and vf.parameters.quad or 655360
+ local descriptions = vf.shared and vf.shared.rawdata and vf.shared.rawdata.descriptions
+ local ascender = vf.parameters and vf.parameters.ascender or quad*0.8
+ local factor = vf.parameters and vf.parameters.factor or 655.36
+ local xheight = vf.parameters and vf.parameters.x_height or quad/2
+ local halfxht = xheight/2
+ for i,v in pairs(vf.characters) do
+ local dsc = descriptions[i]
+ local gname = dsc.name
+ -- local vw = dsc and dsc.vwidth
+ ---[[ for read-ttx
+ local vw = tsbtable and tsbtable[gname] and tsbtable[gname].height
+ local tsb = tsbtable and tsbtable[gname] and tsbtable[gname].tsb
+ if not vw and dsc.index then
+ local cid = stringformat("cid%05d", dsc.index)
+ vw = tsbtable and tsbtable[cid] and tsbtable[cid].height
+ tsb = tsbtable and tsbtable[cid] and tsbtable[cid].tsb
+ end
+ tsb = tsb and factor and tsb*factor
+ --]]
+ vw = vw and vw * factor or quad
+ local hw = v.width or quad
+ local offset = hw/2 - quad/2 + halfxht
+ local vh = (hw > 0) and hw/2 or nil
+ local bb4 = dsc and dsc.boundingbox and dsc.boundingbox[4]
+ bb4 = bb4 and bb4*factor
+ local asc = bb4 and tsb and (bb4 + tsb)
+ asc = asc or ascender
+ v.commands = {
+ {'right', asc}, -- bbox4 + top_side_bearing! But, tsb not available!
+ {'down', offset},
+ {'special', 'pdf: q 0 1 -1 0 0 0 cm'},
+ {'push'},
+ {'char', i},
+ {'pop'},
+ {'special', 'pdf: Q'},
+ }
+ v.width = vw
+ v.height = vh
+ v.depth = vh
+ end
+ --- vertical gpos
+ local res = vf.resources or {}
+ if res.verticalgposhack then
+ return vf -- avoid multiple running
+ end
+ 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
+ for _,vv in ipairs(v.subtables) do
+ vposkeys[#vposkeys+1] = vv
+ end
+ end
+ end
+ end
+ local lookups = res.lookuphash or {}
+ for _,v in ipairs(vposkeys) do
+ local vp = lookups[v]
+ if vp then
+ for i,vv in pairs(vp) do
+ if #vv == 4 then
+ vp[i] = { -vv[2], vv[1], vv[4], vv[3] }
+ end
+ end
+ end
+ end
+ res.verticalgposhack = true
+ return vf
+end
+
+local function activate_vertical_virtual (tfmdata,value)
+ local loaded = luatexbase.priority_in_callback("luaotfload.patch_font",
+ "luatexko.vertical_virtual_font")
+ if value and not loaded then
+ add_to_callback("luaotfload.patch_font",
+ cjk_vertical_font,
+ "luatexko.vertical_virtual_font")
+ end
+end
+
+local otffeatures = fonts.constructors.newfeatures("otf")
+otffeatures.register {
+ name = "vertical",
+ description = "vertical typesetting",
+ initializers = {
+ node = activate_vertical_virtual,
+ }
+}
+--no vwidth in luaotfload v2]]
+
+------------------------------------
+-- italic correction for fake-slant font
+------------------------------------
+local function fakeslant_itlc (tfmdata)
+ local slfactor = tfmdata.parameters.slantfactor
+ if slfactor and slfactor > 0 then else return end
+ tfmdata.parameters.slant = slfactor * 65536
+ local factor = tfmdata.parameters.factor or 655.36
+ local itlcoff = (tfmdata.shared.rawdata.metadata.uwidth or 40)/2 * factor
+ local chrs = tfmdata.characters
+ for i,v in pairs(chrs) do
+ local italic = v.height * slfactor - itlcoff
+ if italic > 0 then
+ chrs[i].italic = italic
+ end
+ end
+end
+
+add_to_callback("luaotfload.patch_font",
+ fakeslant_itlc,
+ "luatexko.fakeslant_itlc")
+
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
index 454fd857e1c..5d6d6d69fa8 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}[2013/11/22 v1.3 Typesetting Korean with LuaLaTeX]
+\ProvidesPackage{luatexko}[2014/01/15 v1.4 Typesetting Korean with LuaLaTeX]
\RequirePackage{fontspec}
\RequirePackage{luatexko-core}
@@ -131,29 +131,29 @@
\protected\def\addhangulfontfeature#1{%
\begingroup
\check@hangul@family
- \ifdefined\hangul@font\hangul@font\fi\addfontfeature{#1}\global
- \let\luatexko@fontspec@temp\f@family
+ \ifdefined\hangul@font\hangul@font\fi\addfontfeature{#1}%
+ \global\let\luatexko@fontspec@temp\f@family
\endgroup
- \def\hangul@font{\fontfamily\luatexko@fontspec@temp
- \luatexko@orig@selectfont}\luatexko@hangul@selectfont \ignorespaces}
+ \def\hangul@font{\fontfamily\luatexko@fontspec@temp\selectfont}%
+ \luatexko@hangul@selectfont \ignorespaces}
\let\addhangulfontfeatures\addhangulfontfeature
\protected\def\addhanjafontfeature#1{%
\begingroup
\check@hanja@family
- \ifdefined\hanja@font\hanja@font\fi\addfontfeature{#1}\global
- \let\luatexko@fontspec@temp\f@family
+ \ifdefined\hanja@font\hanja@font\fi\addfontfeature{#1}%
+ \global\let\luatexko@fontspec@temp\f@family
\endgroup
- \def\hanja@font{\fontfamily\luatexko@fontspec@temp
- \luatexko@orig@selectfont}\luatexko@hanja@selectfont \ignorespaces}
+ \def\hanja@font{\fontfamily\luatexko@fontspec@temp\selectfont}%
+ \luatexko@hanja@selectfont \ignorespaces}
\let\addhanjafontfeatures\addhanjafontfeature
\protected\def\addfallbackfontfeature#1{%
\begingroup
\check@fallback@family
- \ifdefined\fallback@font\fallback@font\fi\addfontfeature{#1}\global
- \let\luatexko@fontspec@temp\f@family
+ \ifdefined\fallback@font\fallback@font\fi\addfontfeature{#1}%
+ \global\let\luatexko@fontspec@temp\f@family
\endgroup
- \def\fallback@font{\fontfamily\luatexko@fontspec@temp
- \luatexko@orig@selectfont}\luatexko@fallback@selectfont \ignorespaces}
+ \def\fallback@font{\fontfamily\luatexko@fontspec@temp\selectfont}%
+ \luatexko@fallback@selectfont \ignorespaces}
\let\addfallbackfontfeatures\addfallbackfontfeature
% check hangul/hanja family
@@ -179,8 +179,8 @@
\fi\fi\fi
}
-\let\luatexko@orig@selectfont\selectfont
-\protected\def\selectfont{\luatexko@orig@selectfont
+\RequirePackage{everysel}
+\EverySelectfont{%
\luatexko@hangul@selectfont
\luatexko@hanja@selectfont
\luatexko@fallback@selectfont
@@ -245,6 +245,8 @@
\unless\ifdefined\sanshangul@font \let\sanshangul@font\serifhangul@font\fi
\unless\ifdefined\monohangul@font \let\monohangul@font\sanshangul@font \fi
\luatexko@hangul@selectfont
+\luatexko@hanja@selectfont
+\luatexko@fallback@selectfont
% for hyperref
\@ifpackageloaded{hyperref}{\pdfstringdefDisableCommands{%
\let\dotemph\@firstofone
@@ -297,6 +299,7 @@
\footnotesep=1.3888\footnotesep
\skip\footins=1.3888\skip\footins plus6pt minus3pt
\hangulpunctuations=1
+ \frenchspacing
\fi
\endinput