OSDN Git Service

changed spec. of JFM
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sat, 8 Nov 2014 12:44:24 +0000 (21:44 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sat, 8 Nov 2014 12:44:24 +0000 (21:44 +0900)
doc/luatexja.dtx
src/ltj-jfmglue.lua
src/ltj-jfont.lua
src/ltj-rmlgbm.lua

index 0ed544c..b1caf8c 100644 (file)
 \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}パラメータについてはこのような問題は起こらない.
 %</ja>
 
@@ -4147,93 +4132,79 @@ using  \texttt{jfm-test.lua} which contains the following:
 %</en>
 \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}
-%<ja>句点「。」の幅は二分であるので
+%<ja>ここで,次のような入力とその実行結果を考える:
 %<en>Now consider the following input/output:
 \begin{LTXexample}[width=0.3\textwidth]
-\jfont\a=file:KozMinPr6N-Regular.otf:jfm=test;+vert
-\setbox0\hbox{\a ã\80\82\inhibitglue 漢}
+\jfont\a=file:KozMinPr6N-Regular.otf:jfm=test;+hwid
+\setbox0\hbox{\a ã\83\92漢}
 \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}}.
 %</en>
 %<*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の適用によるグリフ置換の後に行われる}ことを
 示している.
 %</ja>
 
 %<*en>
-However, a starred specification like ``\texttt{'、*'}'' changes the rule.
+However, ...
 Consider the following input:
 %</en>
 %<*ja>
-但し,「\texttt{'、*'}」のようにアスタリスクつきの指定があると
+但し,JFMによって決まる置換後のグリフの文字クラスが0である場合は
 状況は異なる.
 %</ja>
 \begin{LTXexample}[width=0.3\textwidth]
 \jfont\a=file:KozMinPr6N-Regular.otf:jfm=test;+vert
-\a æ¼¢ã\80\81\inhibitglue 漢
+\a æ¼¢ã\80\82\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 ``ã\80\82'', the ideographic comma ``ã\80\81'' 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 ``ã\80\81'' is \emph{non-zero value}, namely, 2000.
-\item Hence the ideographic comma ``、'' in above belongs the character class~2000.
+\item As the case of ``ã\83\92'', the ideographic full stop ``ã\80\82'' 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 ``ã\80\82'' is \emph{non-zero value}, namely, 2000.
+\item Hence the ideographic full stop ``。'' in above belongs the character class~2000.
 \end{enumerate}
 %</en>
 %<*ja>
-ここで,読点「、」(\texttt{U+3001})の文字クラスは,以下のようにして決まる.
+ここで,句点「。」(\texttt{U+3002})の文字クラスは,以下のようにして決まる.
 \begin{enumerate}
-\item とりあえず句点の時と同じように,\Pkg{luaotfload} によって縦組用読点のグリフに置き換わる.
-\item 置換後のグリフは \texttt{U+FE11} であり,そのままでは文字クラスは0と判定される.
-\item ã\81¨ã\81\93ã\82\8dã\81\8cï¼\8cJFMã\81«ã\81¯ã\80\8c\texttt{'ã\80\81*'}ã\80\8dæ\8c\87å®\9aã\81\8cã\81\82ã\82\8bã\81®ã\81§ï¼\8cç½®æ\8f\9bå\89\8dã\81®æ¨ªçµ\84ç\94¨èª­点のグリフによって文字クラスを判定する.
-\item 結果として,上の出力例中の点の文字クラスは2000となる.
+\item \Pkg{luaotfload} によって縦組用句点のグリフに置き換わる.
+\item 置換後のグリフは \texttt{U+FE12} であり,JFMに従えば文字クラスは\emph{0}と判定される.
+\item ã\81\93ã\81®å ´å\90\88ï¼\8cç½®æ\8f\9bå\89\8dã\81®æ¨ªçµ\84ç\94¨å\8f¥点のグリフによって文字クラスを判定する.
+\item 結果として,上の出力例中の点の文字クラスは2000となる.
 \end{enumerate}
 %</ja>
 
-%<*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となる.
-%</ja>
 
 %<ja>\paragraph{仮想的な文字}
 %<en>\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>
 %<*showexpl>
index a4c0895..84e1100 100644 (file)
@@ -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
index c8743e5..66f9407 100644 (file)
@@ -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
index b1be806..f79c445 100644 (file)
@@ -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()
-
-