diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexko/luatexko.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luatexko/luatexko.lua | 65 |
1 files changed, 30 insertions, 35 deletions
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) |