summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-04-26 22:05:58 +0000
committerKarl Berry <karl@freefriends.org>2016-04-26 22:05:58 +0000
commit60ba296e029b568481ab2ad00c7a003485ffbe4b (patch)
treeb1201a84a9c53a5090f80a74d6fc4f6fa0f1c69a
parent4280e8cda1c6ec8813b64aceffb11e9d32567ca9 (diff)
luatexko (26apr16)
git-svn-id: svn://tug.org/texlive/trunk@40775 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/luatex/luatexko/ChangeLog6
-rw-r--r--Master/texmf-dist/doc/luatex/luatexko/README2
-rw-r--r--Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdfbin214699 -> 214900 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex10
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty2
-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.lua183
-rw-r--r--Master/texmf-dist/tex/luatex/luatexko/luatexko.sty2
9 files changed, 151 insertions, 62 deletions
diff --git a/Master/texmf-dist/doc/luatex/luatexko/ChangeLog b/Master/texmf-dist/doc/luatex/luatexko/ChangeLog
index 6eac376a3d0..0b797e463da 100644
--- a/Master/texmf-dist/doc/luatex/luatexko/ChangeLog
+++ b/Master/texmf-dist/doc/luatex/luatexko/ChangeLog
@@ -1,3 +1,9 @@
+2016-04-25 Dohyun Kim <nomos at ktug org>
+
+ Version 1.13
+
+ * luatexko.lua: direct access to vmtx table; drop caching
+
2016-04-22 Dohyun Kim <nomos at ktug org>
Version 1.12
diff --git a/Master/texmf-dist/doc/luatex/luatexko/README b/Master/texmf-dist/doc/luatex/luatexko/README
index 8cf3e142367..0bdecbbe7cd 100644
--- a/Master/texmf-dist/doc/luatex/luatexko/README
+++ b/Master/texmf-dist/doc/luatex/luatexko/README
@@ -1,4 +1,4 @@
-LuaTeX-ko Package version 1.12 (2016/04/22)
+LuaTeX-ko Package version 1.13 (2016/04/25)
===========================================
This is a Lua(La)TeX macro package that supports typesetting Korean
diff --git a/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdf b/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdf
index 2825f0ccc6a..bf5864bb262 100644
--- a/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdf
+++ b/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex b/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex
index 3336b2bafc9..40171f9d3e8 100644
--- a/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex
+++ b/Master/texmf-dist/doc/luatex/luatexko/luatexko-doc.tex
@@ -61,7 +61,7 @@
\author{Dohyun Kim \normalsize |<nomos at ktug org>| \and
Soojin Nam \normalsize |<jsunam at gmail com>| \and
\normalsize \url{<http://github.com/dohyunkim/luatexko>}}
-\date{Version 1.12\quad 2016/04/22}
+\date{Version 1.13\quad 2016/04/25}
\maketitle
\begin{quote}\small
@@ -306,11 +306,11 @@ fontspec의 글꼴 옵션 외에 \luatexko가 따로 제공하는 것들이
대체로 일본어·중국어 환경에서만 문제된다.
\section{}\label{sec:verttype}
-세로쓰기는 폰트의 고급 오픈타입 자질을 이용하므로 폰트가 이를 지원해야
+세로쓰기는 폰트의 고급 오픈타입 속성을 이용하므로 폰트가 이를 지원해야
가능한 일이다. 폰트에 |Vertical=RotatedGlyphs| 옵션을 준다. 이는
-플레인텍에서 |vertical;+vrt2| 옵션을 주는 것과 같다.\footnote{|vrt2| 자질이 없는 폰트라면
- |vert|를 가져야 한다. 둘 다 없으면 세로쓰기에 적합치 않은 글꼴이다.
- 세로쓰기에서 |vert|는 자동으로 로드되므로 따로 지시할 필요가 없다.}
+플레인텍에서 |vertical;+vrt2| 옵션을 주는 것과 같다.\footnote{|vmtx| 정보를
+ 가지고 있지 않은 글꼴은 세로쓰기에 적합치 않은 글꼴이다.
+ |otfinfo -t <파일>| 명령으로 글꼴에 들어있는 테이블 정보를 알 수 있다.}
문서의 일부를 세로쓰기하려면 \cs{begin{vertical}{<dimen>}} \ldots\ \cs{end{vertical}}
환경을 이용하라. |<dimen>|으로 세로쓰기 박스의 높이를 지시한다.
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty
index 12ba335eee1..e34a222ef35 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko-core.sty
@@ -17,7 +17,7 @@
\ifcsname ifpdf\endcsname\else \input ifpdf.sty \fi
\catcode`@ = 11
\else
- \ProvidesPackage{luatexko-core}[2016/04/22 v1.12 Typesetting Korean with LuaTeX]
+ \ProvidesPackage{luatexko-core}[2016/04/25 v1.13 Typesetting Korean with LuaTeX]
\RequirePackage{luaotfload}[2016/04/21]
\RequirePackage{ifpdf}
\fi
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua b/Master/texmf-dist/tex/luatex/luatexko/luatexko-normalize.lua
index 6afb6d6738c..9ed25f4cb09 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 = "1.12",
- date = "2016/04/22",
+ version = "1.13",
+ date = "2016/04/25",
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 bea568bd27a..721d647aa9a 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 = "1.12",
- date = "2016/04/22",
+ version = "1.13",
+ date = "2016/04/25",
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 fa16225f023..a9ad5ab6229 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 = '2016/04/22',
- version = '1.12',
+ date = '2016/04/25',
+ version = '1.13',
description = 'Korean linebreaking and font-switching',
author = 'Dohyun Kim, Soojin Nam',
license = 'LPPL v1.3+',
@@ -1892,38 +1892,129 @@ end, 'luatexko.post_linebreak_filter')
------------------------------------
-- vertical typesetting: EXPERIMENTAL
------------------------------------
-local tsbtable, mytime, currtime, cachedir, fontloader, lfs, lfsattributes, lfstouch
-
-local function get_vwidth_tsb_table (filename,fontname)
- if tsbtable[fontname] then return tsbtable[fontname] end
- local cachefile = stringformat("%s/luatexko_vertical_metrics_%s.lua",
- cachedir,fontname:gsub("%W","_"))
- local cattr = lfs.isfile(cachefile) and lfsattributes(cachefile)
- local fonttime = lfsattributes(filename,"modification")
- if cattr and cattr.access > mytime and cattr.modification == fonttime then
- tsbtable[fontname] = dofile(cachefile)
- return tsbtable[fontname]
- end
- local fnt = fontloader.open(filename,fontname)
- if fnt then
- local fnt_t = fontloader.to_table(fnt) -- for tsidebearing
- fontloader.close(fnt)
- local glyph_t = {}
- local subfonts = fnt_t.subfonts or {fnt_t}
- for _,subfont in ipairs(subfonts) do
- local glyphs = subfont.glyphs or {}
- for i, gl in pairs(glyphs) do
- glyph_t[i] = { ht = gl.vwidth, tsb = gl.tsidebearing }
+local streamreader = utilities.files
+local openfile = streamreader.open
+local closefile = streamreader.close
+local readstring = streamreader.readstring
+local readulong = streamreader.readcardinal4
+local readushort = streamreader.readcardinal2
+local readfixed = streamreader.readfixed4
+local readshort = streamreader.readinteger2
+local setpos = streamreader.setposition
+
+local function getotftables (f, subfont)
+ if f then
+ local sfntversion = readstring(f,4)
+ if sfntversion == "ttcf" then
+ local ttcversion = readfixed(f)
+ local numfonts = readulong(f)
+ if subfont >= 1 and subfont <= numfonts then
+ local offsets = {}
+ for i = 1, numfonts do
+ offsets[i] = readulong(f)
+ end
+ setpos(f, offsets[subfont])
+ sfntversion = readstring(f,4)
end
end
- if lfstouch then
- table.tofile(cachefile,glyph_t,"return")
- if not lfstouch(cachefile,currtime,fonttime) then
- warn("Writing cache file '%s' failed!",cachefile)
+ if sfntversion == "OTTO" or sfntversion == "true" or sfntversion == "\0\1\0\0" then
+ local numtables = readushort(f)
+ local searchrange = readushort(f)
+ local entryselector = readushort(f)
+ local rangeshift = readushort(f)
+ local tables = {}
+ for i= 1, numtables do
+ local tag = readstring(f,4)
+ tables[tag] = {
+ checksum = readulong(f),
+ offset = readulong(f),
+ length = readulong(f),
+ }
end
+ return tables
+ end
+ end
+end
+
+local function readmaxp (f, t)
+ if f and t then
+ setpos(f, t.offset)
+ return {
+ version = readfixed(f),
+ numglyphs = readushort(f),
+ }
+ end
+end
+
+local function readvhea (f, t)
+ if f and t then
+ setpos(f, t.offset)
+ return {
+ version = readfixed(f),
+ ascent = readshort(f),
+ descent = readshort(f),
+ lineGap = readshort(f),
+ advanceheightmax = readshort(f),
+ mintopsidebearing = readshort(f),
+ minbottomsidebrearing = readshort(f),
+ ymaxextent = readshort(f),
+ caretsloperise = readshort(f),
+ caretsloperun = readshort(f),
+ caretoffset = readshort(f),
+ reserved1 = readshort(f),
+ reserved2 = readshort(f),
+ reserved3 = readshort(f),
+ reserved4 = readshort(f),
+ metricdataformat = readshort(f),
+ numheights = readushort(f),
+ }
+ end
+end
+
+local function readvmtx (f, t, numofheights, numofglyphs)
+ if f and t and numofheights and numofglyphs then
+ setpos(f, t.offset)
+ local vmtx = {}
+ local height = 0
+ for i = 0, numofheights-1 do
+ height = readushort(f)
+ vmtx[i] = {
+ ht = height,
+ tsb = readshort(f),
+ }
end
- tsbtable[fontname] = glyph_t
- return glyph_t
+ for i = numofheights, numofglyphs-1 do
+ vmtx[i] = {
+ ht = height,
+ tsb = readshort(f),
+ }
+ end
+ return vmtx
+ end
+end
+
+local tsbtable
+
+local function get_tsb_table (filename, subfont)
+ subfont = tonumber(subfont) or 1
+ local key = stringformat("%s::%s", filename, subfont)
+ if tsbtable[key] then
+ return tsbtable[key]
+ end
+ local f = openfile(filename, true) -- true: zero-based
+ if f then
+ local vmtx
+ local tables = getotftables(f, subfont)
+ if tables then
+ local vhea = readvhea(f, tables.vhea)
+ local numofheights = vhea and vhea.numheights
+ local maxp = readmaxp(f, tables.maxp)
+ local numofglyphs = maxp and maxp.numglyphs
+ vmtx = readvmtx(f, tables.vmtx, numofheights, numofglyphs)
+ end
+ closefile(f)
+ tsbtable[key] = vmtx
+ return vmtx
end
end
@@ -1933,8 +2024,12 @@ local function cjk_vertical_font (vf)
if not vf.shared.features["vertical"] then return end
if vf.type == "virtual" then return end
- local tsbtable = get_vwidth_tsb_table(vf.filename,vf.fontname)
- if not tsbtable then return end
+ local subfont = vf.specification and vf.specification.sub
+ local tsbtable = get_tsb_table(vf.filename, subfont)
+ if not tsbtable then
+ warn("%s does not have vertical metric info", vf.fontname)
+ return
+ end
local id = fontdefine(table.copy(vf)) -- fastcopy takes time too long.
@@ -2014,29 +2109,17 @@ local function cjk_vertical_font (vf)
return vf
end
-local function activate_vertical_virtual (tfmdata,value)
- if value and not tsbtable then
- fontloader = require "fontloader"
- lfs = require "lfs"
- lfstouch = lfs.touch
- lfsattributes = lfs.attributes
- tsbtable = {}
- currtime = os.time()
- mytime = kpse_find_file("luatexko.lua")
- mytime = mytime and lfsattributes(mytime,"modification")
- cachedir = caches.getwritablepath("..","luatexko")
- 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,
+ node = function (tfmdata,value)
+ if value and not tsbtable then
+ tsbtable = {}
+ add_to_callback("luaotfload.patch_font",cjk_vertical_font,"luatexko.vertical_virtual_font")
+ end
+ end
}
}
diff --git a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
index 4957ad3a99a..cdedc21db6d 100644
--- a/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
+++ b/Master/texmf-dist/tex/luatex/luatexko/luatexko.sty
@@ -23,7 +23,7 @@
\expandafter\endinput
\fi
-\ProvidesPackage{luatexko}[2016/04/22 v1.12 Typesetting Korean with LuaLaTeX]
+\ProvidesPackage{luatexko}[2016/04/25 v1.13 Typesetting Korean with LuaLaTeX]
\ifdefined\adjustspacing\else % luatex < 0.87
\let\adjustspacing\pdfadjustspacing