diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua index e131ec384fd..2b8d33bd521 100644 --- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua +++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua @@ -10,17 +10,18 @@ -- and version 1.3c or later is part of all distributions of LaTeX -- version 2006/05/20 or later. -module('luatexkonormalize', package.seeall) - luatexbase.provides_module({ name = "luatexko-normalize", - version = 1.0, - date = "2013/05/10", + version = 1.2, + date = "2013/06/10", author = "Dohyun Kim", description = "Hangul normalization", license = "LPPL v1.3+", }) +luatexkonormalize = luatexkonormalize or {} +local luatexkonormalize = luatexkonormalize + local cho = "[\225\132\128-\225\132\146]" local jung = "[\225\133\161-\225\133\181]" local jong = "[\225\134\168-\225\135\130]" @@ -403,7 +404,7 @@ local char = unicode.utf8.char local add_to_callback = luatexbase.add_to_callback local remove_from_callback = luatexbase.remove_from_callback -local syllable2jamo = function(l,v,t) +local jamo2syllable = function(l,v,t) l, v = byte(l), byte(v) local s = (l - 0x1100) * 21 s = (s + v - 0x1161) * 28 @@ -449,9 +450,9 @@ end local hangulcompose = function(buffer) buffer = hanguldecompose(buffer) - buffer = gsub(buffer, "("..cho..")("..jung..")("..jong..")", syllable2jamo) + buffer = gsub(buffer, "("..cho..")("..jung..")("..jong..")", jamo2syllable) buffer = gsub(buffer, "("..cho..")("..jung..ojong..")", "%1\1%2") - buffer = gsub(buffer, "("..cho..")("..jung..")", syllable2jamo) + buffer = gsub(buffer, "("..cho..")("..jung..")", jamo2syllable) buffer = gsub(buffer, "([\225\132\128-\225\133\153])\225\133\160", jamo2cjamocho) buffer = gsub(buffer, "\225\133\159([\225\133\161-\225\134\161])", jamo2cjamojung) buffer = gsub(buffer, "\1", "") @@ -461,26 +462,28 @@ end local loaded = false -function compose() +local function compose() if loaded then remove_from_callback('process_input_buffer', 'luatexko-hangul-normalize') end loaded = true add_to_callback('process_input_buffer', hangulcompose, 'luatexko-hangul-normalize') end +luatexkonormalize.compose = compose -function decompose() +local function decompose() if loaded then remove_from_callback('process_input_buffer', 'luatexko-hangul-normalize') end loaded = true add_to_callback('process_input_buffer', hanguldecompose, 'luatexko-hangul-normalize') end +luatexkonormalize.decompose = decompose -function unload() +local function unload() if loaded then remove_from_callback('process_input_buffer', 'luatexko-hangul-normalize') end loaded = false end - +luatexkonormalize.unload = unload |