安装\LuaTeX-ja之前,需要如下:
%</zh>
\begin{itemize}
-%<*en>
-\item \LuaTeX\ (version 0.65.0-beta or later) and its supporting packages.
-
-You might need to add the following lines to
-\texttt{lualatex.ini} (just before \verb+\dump+ in the last line),
-if you are using recent \LuaTeX\ whose Lua is 5.2.
-%</en>
-%<*ja>
-\item \LuaTeX(バージョン 0.65.0-beta以降)とその支援パッケージ.
-
-Lua 5.2を用いた\LuaTeX(バージョン0.74.0-beta以降)では,\texttt{lualatex.ini}\
-に次の行を加える必要があるかもしれない(\verb+\dump+ の前に).
-%</ja>
-%<*!zh>
-\begin{lstlisting}
-{\catcode`\#=12\catcode`\~=12%
-\global\everyjob\expandafter{\the\everyjob%
- \directlua{%
- if not table.maxn then
- table.maxn = function(t)
- local r = 0
- for i,_ in pairs(t) do
- if type(i)=='number' then
- if i>r then r=i end
- end
- end
- return r
- end
- end
- if not package.loaders then package.loaders=package.searchers end
- if not string.explode then
- string.explode = function (str, separator)
- if not separator then separator=" +" end
- local t, nexti, pos = { }, 1, 1
- while true do
- local st, sp = str:find (separator, pos)
- if not st then break end
- if pos ~= st then
- t [ nexti ] = str:sub ( pos , st - 1 )
- nexti = nexti + 1
- end
- pos = sp + 1
- end
- t [ nexti ] = str:sub ( pos )
- return t
- end
- end
- }%
-}}%
-\end{lstlisting}
-%</!zh>
-%<*zh>
-\item \LuaTeX(版本号为大于0.65)和相关支持宏包。
-%如果用户使用的是\TeX Live2011以及最新版本的W32\TeX,可不考虑此项。
-%</zh>
-%<*en>
-\item The source archive of \LuaTeX-ja, of course\texttt{:)}
-%</en>
-%<*ja>
-\item \LuaTeX-jaのソースアーカイブ(もちろん\texttt{:)}).
-%</ja>
-%<*zh>
-\item \LuaTeX-ja的源码(当然喽\texttt{:)})。
-%</zh>
-%<*en>
-\item The \Pkg{xunicode} package, which version is \emph{just v0.981 (2011/09/09)}.\\
-If you have the \Pkg{fontspec} package, this \Pkg{xunicode} package must be exist.
-But be careful about the version; other versions may not work correctly with \LuaTeX-ja.
-%</en>
-%<*ja>
-\item \Pkg{xunicode}パッケージ(\textbf{2011/09/09,~v0.981}).\\
-\Pkg{fontspec}パッケージが導入されていればこのパッケージも導入されているはずであるが,
-このv0.981以外のバージョンでは\LuaTeX-ja上で正しく動作しない危険性がある.
-%</ja>
-%<*zh>
-\Pkg{xunicode}宏包,当前版本必须为\textit{v0.981(2011/09/09)}。\\
-如果你使用\Pkg{fontspec}宏包,\Pkg{xunicode}就必须存在。但是请注意该包的
-版本,其他版本可能不会正常工作。
-%</zh>
+\item \LuaTeX\ beta-0.74.0 (or later)
+\item \Pkg{luaotfload} v2.2~(2013/05/05)
+\item \Pkg{luatexbase} v0.6~(2013/05/04)
+\item \Pkg{xunicode} v0.981~(2011/09/09)
\end{itemize}
%<*en>
また,行長と自然長との差の絶対値を計算し,それを\textit{total}とおく.
\subsection{行末文字の位置調整}
-まず,行末が文字クラス$n$の\textbf{Jachar}であった場合,
+まず,行末が文字クラス$n$の\textbf{JAchar}であった場合,
それを動かすことによって,\textbf{JAglue} が負担する調整量を少なくしようとする.
この行末文字の左右の移動可能量は,JFM中にある文字クラス$n$の定義の
\texttt{end\_stretch},~\texttt{end\_shrink}フィールドに全角単位の値として記述されている.
local cid_reg, cid_order, cid_supp, cid_name
local taux_dir = 'luatex-cache/luatexja'
local cid_replace = {
- ["Adobe-Japan1"] = {"UniJIS2004-UTF32", 23057,
+ ["Adobe-Japan1"] = {"UniJIS2004-UTF32", 23057, 6,
function (i)
if (231<=i and i<=632) or (8718<=i and i<=8719)
or (12063<=i and i<=12087) then
end
end},
-- 基本的には JIS X 0213:2004 に沿ったマッピング
- ["Adobe-Korea1"] = {"UniKS-UTF32", 18351,
+ ["Adobe-Korea1"] = {"UniKS-UTF32", 18351, 2,
function (i)
if 8094<=i and i<=8100 then
return 327680 -- 655360/2
end
end},
- ["Adobe-GB1"] = {"UniGB-UTF32", 30283,
+ ["Adobe-GB1"] = {"UniGB-UTF32", 30283, 5,
function (i)
if (814<=i and i<=939) or (i==7716)
or (22355<=i and i<=22357) then
return 327680 -- 655360/2
end
end},
- ["Adobe-CNS1"] = {"UniCNS-UTF32", 19155,
+ ["Adobe-CNS1"] = {"UniCNS-UTF32", 19155, 6,
function (i)
if (13648<=i and i<=13742) or (i==17603) then
return 327680 -- 655360/2
return {index = a}
end
function make_cid_font()
+ local kx = cid_replace[cid_name]
local k = {
- cidinfo = { ordering=cid_order, registry=cid_reg, supplement=cid_supp },
+ cidinfo = { ordering=cid_order, registry=cid_reg, supplement=kx[3] },
encodingbytes = 2, extend=1000, format = 'opentype',
direction = 0, characters = {}, parameters = {}, embedding = "no", cache = "yes",
ascender = 0, descender = 0, factor = 0, hfactor = 0, vfactor = 0,
tounicode = 1,
}
- local kx = cid_replace[cid_name]
cidfont_data[cid_name] = k
-- CID => Unicode 符号空間
end,
function(a) return a[1] ..string.format('%04X',a[2]) end)
-- tt は cid -> tounicode になっているので cidm -> tounicode に変換
+ local kxf = kx[4]
for i,v in ipairs(cidmo) do
- k.characters[v].width = kx[3](i)
+ k.characters[v].width = kxf(i)
if v>=0xF0000 then
k.characters[v].tounicode = tt[i]
end
end
-- High-level
+
+local definers = fonts.definers
local function mk_rml(name, size, id)
- local specification = fonts.definers.analyze(name,size)
- specification = fonts.definers.resolve(specification)
- local features = specification.features.normal
+ local specification = definers.analyze(name,size)
+ specification = definers.resolve(specification)
+ specification.detail = specification.detail or ''
local fontdata = {}
local cachedata = {}
-- characters & scaling
if size < 0 then size = -size * 655.36 end
local scale = size / 655360
- local def_height = 0.88 * size -- character's default height (optimized for jfm-ujis.lua)
- local def_depth = 0.12 * size -- and depth.
- if not cache_chars[cid_name][size] then
- cache_chars[cid_name][size] = {}
- for k, v in pairs(cache_chars[cid_name][655360]) do
- cache_chars[cid_name][size][k] = {
- index = v.index, width = v.width * scale,
- height = def_height, depth = def_depth, tounicode = v.tounicode,
- }
+
+ do
+ local def_height = 0.88 * size
+ -- character's default height (optimized for jfm-ujis.lua)
+ local def_depth = 0.12 * size -- and depth.
+ if not cache_chars[cid_name][size] then
+ cache_chars[cid_name][size] = {}
+ for k, v in pairs(cache_chars[cid_name][655360]) do
+ cache_chars[cid_name][size][k] = {
+ index = v.index, width = v.width * scale,
+ height = def_height, depth = def_depth, tounicode = v.tounicode,
+ }
+ end
end
+ fontdata.characters = cache_chars[cid_name][size]
+ cachedata.characters = cache_chars[cid_name][size]
end
- fontdata.characters = cache_chars[cid_name][size]
- cachedata.characters = cache_chars[cid_name][size]
- local parameters = {}
- for k, v in pairs(s.parameters) do
- parameters[k] = v * scale
+ -- other parameters
+ do
+ local parameters = {}
+ for k, v in pairs(s.parameters) do
+ parameters[k] = v * scale
+ end
+ fontdata.parameters = parameters
+ fontdata.ascender = fontdata.ascender * scale
+ fontdata.descender = fontdata.descender * scale
+ fontdata.factor = fontdata.factor * scale
+ fontdata.hfactor = fontdata.hfactor * scale
+ fontdata.vfactor = fontdata.vfactor * scale
+ fontdata.size = size
+ fontdata.resources = s.resources
+ cachedata.parameters = parameters
+ cachedata.ascender = fontdata.ascender
+ cachedata.descender = fontdata.descender
+ cachedata.factor = fontdata.factor
+ cachedata.hfactor = fontdata.hfactor
+ cachedata.vfactor = fontdata.vfactor
+ cachedata.size = size
+ cachedata.resources = s.resources
end
- fontdata.parameters = parameters; cachedata.parameters = parameters
- fontdata.ascender = fontdata.ascender * scale; cachedata.ascender = fontdata.ascender
- fontdata.descender = fontdata.descender * scale; cachedata.descender = fontdata.descender
- fontdata.factor = fontdata.factor * scale; cachedata.factor = fontdata.factor
- fontdata.hfactor = fontdata.hfactor * scale; cachedata.hfactor = fontdata.hfactor
- fontdata.vfactor = fontdata.vfactor * scale; cachedata.vfactor = fontdata.vfactor
- fontdata.size = size; cachedata.size = size
- fontdata.resources = s.resources
- cachedata.resources = s.resources
-
+
-- no embedding
local var = ''
- -- if features.slant then
- -- fontdata.slant = features.slant*1000; cachedata.slant = fontdata.slant
- -- var = var .. 's' .. tostring(features.slant)
- -- end
- -- if features.extend then
- -- fontdata.extend = features.extend*1000; cachedata.extend = fontdata.extend
- -- var = var .. 'x' .. tostring(features.extend)
- -- end
+ local s = string.match(specification.detail, 'slant=([+-]*[0-9]*%.[0-9]*)')
+ if s and e~=1 then
+ s = s * 1000
+ var, fontdata.slant = var .. 's' .. tostring(s), s
+ end
+ local e = string.match(specification.detail, 'extend=([+-]*[0-9]*%.[0-9]*)')
+ if e and e~=1 then
+ e = e * 1000
+ var, fontdata.extend = var .. 'x' .. tostring(e), e
+ end
fontdata.name = specification.name .. size .. var; cachedata.name = fontdata.name
fontdata.fullname = specification.name .. var; cachedata.fullname = fontdata.fullname
fontdata.psname = specification.name; cachedata.psname = fontdata.psname