From: Hironori Kitagawa Date: Sat, 8 Nov 2014 12:44:24 +0000 (+0900) Subject: changed spec. of JFM X-Git-Tag: 20150420.0~85 X-Git-Url: http://git.osdn.jp/view?a=commitdiff_plain;ds=sidebyside;h=8aaf369e3416a57db130fe10083e9d8118927c7a;p=luatex-ja%2Fluatexja.git changed spec. of JFM --- diff --git a/doc/luatexja.dtx b/doc/luatexja.dtx index 0ed544c..b1caf8c 100644 --- a/doc/luatexja.dtx +++ b/doc/luatexja.dtx @@ -16,21 +16,6 @@ \makeatletter %%%%%%%% -%%%%%%%% record loaded packages -\let\ltjpkglist\empty -\newif\if@real@append@list -\def\@append@newentry#1#2{{% - \@real@append@listtrue \def\@tempa{#2}% - \let\@pkglist\@append@newentry@pkglist#1% - \if@real@append@list - \let\@pkglist=\relax\xdef#1{#1\@pkglist{#2}}% - \fi}} -\def\@append@newentry@pkglist#1{% - \def\@tempb{#1}% - \ifx\@tempa\@tempb\@real@append@listfalse\fi} -\def\@addtofilelist#1{\@append@newentry\ltjpkglist{#1}} -\let\@listfiles\empty - %<*en> \usepackage[margin=25mm,lmargin=30mm,rmargin=30mm,footskip=6mm]{geometry} \usepackage{luatexja-adjust}\ltjdisableadjust @@ -2296,12 +2281,12 @@ xyz漢字 Note that setting positive \Param{yalbaselineshift}~or~\Param{talbaselineshift} parameters does not increase the depth of one-letter ``syllable'' $p$ of \textbf{Alchar}, if its left-protrusion~(\cs{lpcode}) and right-protrusion~(\cs{rpcode}) are both non-zero. -This is because +This is because \begin{itemize} \item These two parameters are implemented by setting yoffset field of a glyph node, and this does not increase the depth of the glyph. -\item To cope with the above situation, \LuaTeX-ja automatically supplies -a rule in every ``syllable''. +\item To cope with the above situation, \LuaTeX-ja automatically supplies +a rule in every ``syllable''. \item However, we cannot use this ``supplying a rule'' method if \dots \end{itemize} @@ -2313,7 +2298,7 @@ This problem does not apply for \Param{yjabaselineshift}~nor~\Param{tjabaselines \item \Param{yalbaselineshift},~\Param{talbaselineshift}パラメータが正になっている. \item 「音節」を構成する唯一の文字$p$の 左余白への突出量(\cs{lpcode}),右余白への突出量(\cs{rpcode})がどちらも非零である. -\end{itemize} +\end{itemize} \Param{yjabaselineshift},~\Param{tjabaselineshift}パラメータについてはこのような問題は起こらない. % @@ -4147,93 +4132,79 @@ using \texttt{jfm-test.lua} which contains the following: % \begin{lstlisting} [0] = { - chars = { '漢', 'ヒ*' }, + chars = { '漢' }, align = 'left', left = 0.0, down = 0.0, width = 1.0, height = 0.88, depth = 0.12, italic=0.0, }, [2000] = { - chars = { '。', '、*', 'ヒ' }, + chars = { '。', 'ヒ' }, align = 'left', left = 0.0, down = 0.0, width = 0.5, height = 0.88, depth = 0.12, italic=0.0, }, \end{lstlisting} -%句点「。」の幅は二分であるので +%ここで,次のような入力とその実行結果を考える: %Now consider the following input/output: \begin{LTXexample}[width=0.3\textwidth] -\jfont\a=file:KozMinPr6N-Regular.otf:jfm=test;+vert -\setbox0\hbox{\a 。\inhibitglue 漢} +\jfont\a=file:KozMinPr6N-Regular.otf:jfm=test;+hwid +\setbox0\hbox{\a ヒ漢} \the\wd0 \end{LTXexample} %<*en> -Now we look why the above source outputs 20\,pt, not 15\,pt. +Now we look why the above source outputs 15\,pt. \begin{enumerate} -\item The ideographic full stop ``。'' is converted to its vertical form ``\char"FE12''~(\texttt{U+FE12}), %" -by \verb+vert+ feature. -\item The character class of ``\char"FE12'' is zero, hence its width is fullwidth.%" -\item The character class of ``漢'', hence its width is fullwidth. -\item \cs{inhibitglue} makes that no glue will be inserted between ``。'' and ``漢''. -\item Hence the width of \cs{hbox} equals to 20\,pt. +\item The character ``ヒ'' is converted to its half width form ``ヒ'' by \verb+hwid+ feature. +\item According to the JFM, the character class of ``ヒ'' is 2000, hence its width is halfwidth. +\item The character class of ``漢'' is zero, hence its width is fullwidth. +\item Hence the width of \cs{hbox} equals to 15\,pt. \end{enumerate} -This example shows that the character class of a character is determined \emph{after +This example shows that the character class of a character is generally determined \emph{after applying font features by \Pkg{luaotfload}}. % %<*ja> -では,全角二分(15.0\,pt)となるのが自然……と思うかもしれないが,上の実行結果では20\,ptとなっている. -それは以下の事情によるものである: +上記の出力結果が,15\,ptとなっているのは理由によるものである: \begin{enumerate} -\item \verb+vert+ featureによって句点(\texttt{U+3002})が縦組用のグリフと置き換わる(\Pkg{luaotfload} による処理). -\item この縦組用句点のグリフは \texttt{U+FE12} であるため,その文字クラスは0となる. -\item 以上により文字クラス0とみなされるため,結果として「。」の幅は全角だと認識されてしまう. +\item \verb+hwid+ featureによって「ヒ」が半角幅のグリフ「ヒ」と置き換わる(\Pkg{luaotfload} による処理). +\item JFMによれば,この「ヒ」のグリフの文字クラスは2000である. +\item 以上により文字クラス2000とみなされるため,結果として「ヒ」の幅は半角だと認識される. \end{enumerate} この例は,\emph{文字クラスの決定はfont featureの適用によるグリフ置換の後に行われる}ことを 示している. % %<*en> -However, a starred specification like ``\texttt{'、*'}'' changes the rule. +However, ... Consider the following input: % %<*ja> -但し,「\texttt{'、*'}」のようにアスタリスクつきの指定があると, +但し,JFMによって決まる置換後のグリフの文字クラスが0である場合は, 状況は異なる. % \begin{LTXexample}[width=0.3\textwidth] \jfont\a=file:KozMinPr6N-Regular.otf:jfm=test;+vert -\a 漢、\inhibitglue 漢 +\a 漢。\inhibitglue 漢 \end{LTXexample} %<*en> -Here, the character class of the ideographic comma ``、''~(\texttt{U+3001}) is determined +Here, the character class of the ideographic full stop ``。''~(\texttt{U+3002}) is determined as following: \begin{enumerate} -\item As the case of ``。'', the ideographic comma ``、'' is converted to its vertical - form ``\char"FE11''~(\texttt{U+FE11}).%" -\item The character class of ``\char"FE11'' is zero. -\item However, \LuaTeX-ja remembers that this ``\char"FE11'' is obtained from ``、'' by - font features. The character class of ``、'' is \emph{non-zero value}, namely, 2000. -\item Hence the ideographic comma ``、'' in above belongs the character class~2000. +\item As the case of ``ヒ'', the ideographic full stop ``。'' is converted to its vertical + form ``\char"FE12''~(\texttt{U+FE12}).%" +\item The character class of ``\char"FE12'' is \emph{zero}. +\item However, \LuaTeX-ja remembers that this ``\char"FE12'' is obtained from ``。'' by + font features. The character class of ``。'' is \emph{non-zero value}, namely, 2000. +\item Hence the ideographic full stop ``。'' in above belongs the character class~2000. \end{enumerate} % %<*ja> -ここで,読点「、」(\texttt{U+3001})の文字クラスは,以下のようにして決まる. +ここで,句点「。」(\texttt{U+3002})の文字クラスは,以下のようにして決まる. \begin{enumerate} -\item とりあえず句点の時と同じように,\Pkg{luaotfload} によって縦組用読点のグリフに置き換わる. -\item 置換後のグリフは \texttt{U+FE11} であり,そのままでは文字クラスは0と判定される. -\item ところが,JFMには「\texttt{'、*'}」指定があるので,置換前の横組用読点のグリフによって文字クラスを判定する. -\item 結果として,上の出力例中の読点の文字クラスは2000となる. +\item \Pkg{luaotfload} によって縦組用句点のグリフに置き換わる. +\item 置換後のグリフは \texttt{U+FE12} であり,JFMに従えば文字クラスは\emph{0}と判定される. +\item この場合,置換前の横組用句点のグリフによって文字クラスを判定する. +\item 結果として,上の出力例中の句点の文字クラスは2000となる. \end{enumerate} % -%<*ja> -なお,「\texttt{'\hbox{}ヒ*'}」のようにアスタリスクつきの指定があっても, -置換後のグリフで判定した文字クラスの値が0でなければ,そちらをそのまま作用する. -\begin{LTXexample}[width=0.3\textwidth] -\jfont\a=file:KozMinPr6N-Regular.otf:jfm=test;+hwid -\a 漢ヒひ -\end{LTXexample} -上の例では, -\texttt{hwid} featureにより,「ヒ」が半角の「ヒ」に置き換わるが, -文字クラスは「ヒ」の属する0\emph{ではなく},「ヒ」の属する2000となる. -% %\paragraph{仮想的な文字} %\paragraph{Imaginary characters} @@ -7395,7 +7366,7 @@ In this case, the \textit{id} is \textit{id\_jglyph}. %<*en> \item A list which begins from a \textit{glyph\_node} which represents a \textbf{ALchar}, - and consists of \textbf{ALchar} \textit{glyph\_node}s, + and consists of \textbf{ALchar} \textit{glyph\_node}s, kerns for adjusting accents~(its subtype is 2), kerns for italic corrections and kerns which are automatically inserted by \LuaTeX~or~luaotfload. In this case, the \textit{id} is \textit{id\_glyph}. @@ -8911,29 +8882,6 @@ ISO 32000-1:2008, \textit{Document management -- Portable document format -- Par \url{http://www.iso.org/iso/iso\_catalogue/catalogue_tc/catalogue\_detail.htm?csnumber=51502} \end{thebibliography} -\newpage -\appendix - -\section{Package versions used in this document} -This document was typeset using the following packages: - -\medskip - -{\makeatletter\tt\footnotesize - \def\@pkglist#1{% - \filename@parse{#1}\def\@temp{sty} - \ifx\@temp\filename@ext - \edef\reserved@a{% - \filename@base.% - \ifx\filename@ext\relax tex\else\filename@ext\fi}% - \leavevmode\hskip-13em\hbox to 13em{\filename@area\reserved@a\hss}% - \csname ver@\reserved@a\endcsname\par - \fi - }% -\parindent0pt\leftskip13em -\ltjpkglist - -\makeatother} \end{document} % %<*showexpl> diff --git a/src/ltj-jfmglue.lua b/src/ltj-jfmglue.lua index a4c0895..84e1100 100644 --- a/src/ltj-jfmglue.lua +++ b/src/ltj-jfmglue.lua @@ -113,7 +113,7 @@ do slow_find_char_class = function (c, m, oc) local cls = ltjf_find_char_class(oc, m) if c and oc~=c and cls==0 then - return ltjf_find_char_class(-c, m), oc + return ltjf_find_char_class(c, m), oc else return cls, oc end diff --git a/src/ltj-jfont.lua b/src/ltj-jfont.lua index c8743e5..66f9407 100644 --- a/src/ltj-jfont.lua +++ b/src/ltj-jfont.lua @@ -78,11 +78,6 @@ function define_jfm(t) real_char = true; w = utf.byte(w) elseif type(w) == 'string' and utf.len(w)==2 and utf.sub(w,2) == '*' then real_char = true; w = utf.byte(utf.sub(w,1,1)) - if not t.chars[-w] then - t.chars[-w] = i - else - defjfm_res= nil; return - end end if not t.chars[w] then t.chars[w] = i @@ -355,7 +350,7 @@ do end if jfm_dir == 'tate' then if not name:match('vert') and not name:match('vrt2') then - name = name .. ';vrt2' + name = name .. ';vert;vrt2' end end return name @@ -723,31 +718,31 @@ end -- 縦書き用字形への変換テーブル local prepare_vert_data do - local function add_feature_table(tname, src, dest) - for i,v in pairs(src) do - if type(v.slookups)=='table' then - local s = v.slookups[tname] - if s then - dest = dest or {} - dest[i] = dest[i] or {} - dest[i].vert = dest[i].vert or s - end - end - end - return dest - end - prepare_vert_data = function (dest, id) - local a = id.resources.sequences - if a then - local s = id.shared.rawdata.descriptions - for i,v in pairs(a) do - if v.features.vert or v.features.vrt2 then - dest= add_feature_table(v.subtables[1], s, dest) - end - end - end - return dest - end + -- local function add_feature_table(tname, src, dest) + -- for i,v in pairs(src) do + -- if type(v.slookups)=='table' then + -- local s = v.slookups[tname] + -- if s then + -- dest = dest or {} + -- dest[i] = dest[i] or {} + -- dest[i].vert = dest[i].vert or s + -- end + -- end + -- end + -- return dest + -- end + -- prepare_vert_data = function (dest, id) + -- local a = id.resources.sequences + -- if a then + -- local s = id.shared.rawdata.descriptions + -- for i,v in pairs(a) do + -- if v.features.vert or v.features.vrt2 then + -- dest= add_feature_table(v.subtables[1], s, dest) + -- end + -- end + -- end + -- return dest + -- end -- -- 縦書き用字形への変換 -- function get_vert_glyph(n, chr) -- local fn = font_extra_info[n] @@ -809,8 +804,8 @@ do end, 'ltj.prepare_extra_data', 1) - local function a (n, dat) font_extra_info[n] = dat end - ltjr.vert_addfunc = a + local nulltable = {} -- dummy + ltjr.vert_addfunc = function (n) font_extra_info[n] = nulltable end local identifiers = fonts.hashes.identifiers for i=1,font.nextid()-1 do diff --git a/src/ltj-rmlgbm.lua b/src/ltj-rmlgbm.lua index b1be806..f79c445 100644 --- a/src/ltj-rmlgbm.lua +++ b/src/ltj-rmlgbm.lua @@ -5,7 +5,7 @@ luatexja.load_module('base'); local ltjb = luatexja.base local cidfont_data = {} local cache_chars = {} -local cache_ver = '3' +local cache_ver = '4' local cid_reg, cid_order, cid_supp, cid_name local cid_replace = { @@ -138,29 +138,30 @@ do ttu[cid_order .. '.' .. i] = cidmo[i] end - -- 縦書用字形 - tt, cidm = {}, {} - for i = 0,kx[2] do cidm[i] = -1 end - open_cmap_file(kx[1] .. "-V", increment, tonumber, entry) - local ttv = {} - for i,v in pairs(tt) do ttv[i] = cidmo[v.index] end - -- shared k.shared = { otfdata = { cidinfo= k.cidinfo, verbose = false, shared = { featuredata = {}, }, - luatex = { features = {}, + luatex = { features = {}, defaultwidth=1000, }, }, dynamics = {}, features = {}, processes = {}, - ltj_vert_table = ttv - } + --rawdata = { descriptions = {} }, + } k.resources = { unicodes = ttu, } k.descriptions = {} cache_chars[cid_name] = { [655360] = k.characters } + -- 縦書用字形 + tt, cidm = {}, {} + for i = 0,kx[2] do cidm[i] = -1 end + open_cmap_file(kx[1] .. "-V", increment, tonumber, entry) + for i,v in pairs(tt) do + ttv[i] = cidmo[v.index] + end + -- tounicode エントリ local cidp = {nil, nil}; tt, ttu, cidm = {}, {}, {} open_cmap_file(cid_name .. "-UCS2", @@ -223,7 +224,7 @@ local function mk_rml(name, size, id) local fontdata = {} local cachedata = {} local s = cidfont_data[cid_name] - luatexja.rmlgbm.vert_addfunc(id, s.shared.ltj_vert_table) + luatexja.rmlgbm.vert_addfunc(id) for k, v in pairs(s) do fontdata[k] = v cachedata[k] = v @@ -351,5 +352,3 @@ luatexja.rmlgbm = { cid_reg, cid_order, cid_name, cid_supp = 'Adobe', 'Japan1', 'Adobe-Japan1' read_cid_font() - -