OSDN Git Service

Changed implementation of \zw, \zh.
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sun, 28 Aug 2011 11:50:26 +0000 (20:50 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sun, 28 Aug 2011 11:50:26 +0000 (20:50 +0900)
12 files changed:
doc/sample1.pdf
doc/sample1.tex
src/lltjfont.sty
src/luatexja-core.lua
src/luatexja-core.sty
src/luatexja/jfont.lua
test/test01-noembed.pdf
test/test01-noembed.tex
test/test01.pdf
test/test02-latex.pdf
test/test03-after.pdf
test/test04-jfm.pdf

index 4e21aba..eac5880 100644 (file)
Binary files a/doc/sample1.pdf and b/doc/sample1.pdf differ
index f34a978..2ca172a 100644 (file)
@@ -55,8 +55,7 @@
 \item {\tt src/}: 核となる\TeX ソースとLuaコードはこのディレクトリ内に入っている.
 \itemitem \TeX 用スタイルファイル達
 \itemT {\tt luatexja.sty}: 利用者はこのファイルを読み込む.
-拡張子は{\tt sty}であるが,plain \TeX と\LaTeX 両方に対応させる方針である.しかし,
-{\bf 現時点で\LaTeX での使用は考慮されていない.}
+拡張子は{\tt sty}であるが,plain \TeX と\LaTeX 両方に対応させる方針である.
 \itemT {\tt luatexja-core.sty}: 
 \itemT {\tt luatexja-base.sty}: 
 \itemT {\tt luatexja-cctbreg.sty}: 
 \itemT {\tt mk-rmlgbm-data.tex}: {\tt luatexja-rmlgbm-data.lua}作成用スクリプト
 {\small(小塚明朝を{\tt luaotfload}で読み込んだ時のキャッシュが必要)\inhibitglue}.
 
+\itemitem \LaTeX 用スタイルファイル達
+\itemT {\tt luatexja-latex.sty}: 
+\itemT {\tt lltjdefs.sty}: 
+\itemT {\tt lltjfont.sty}: 
+
+
 \itemitem Luaコード達(旧フォーマット)
 \itemT {\tt luatexja-core.lua}: コア部分に使われるLuaコード.
 \itemT {\tt luatexja-rmlgbm-data.lua}: 非埋込和文フォント用のデータ(小塚明朝Pr6N R由来).
@@ -84,6 +89,7 @@
 \itemT {\tt jfont.lua}: 和文フォント定義部のLuaコード.
 \itemT {\tt rmlgbm.lua}: 非埋込和文フォント (Ryumin-Light etc.) 定義用コード.
 \itemT {\tt jfmglue.lua}: 和文処理に伴う空白の挿入処理部.
+\itemT {\tt math.lua}: 数式モード中の和文文字のフォント置換部分.
 \itemT {\tt tangle.lua}
 \itemT {\tt charrange.lua}: 「和文文字の範囲」管理部.
 \itemT {\tt debug.lua}
@@ -93,7 +99,7 @@
 
 \beginsection 使用方法
 
-大é\9b\91æ\8a\8aã\81«è¨\80ã\81\86ã\81¨ï¼\8cplain \TeX ã\81®ç\8a¶æ³\81ã\81§ï¼\8c以ä¸\8bã\81®ã\82\88ã\81\86ã\81«ã\81\99ã\82\8cã\81°ã\82\88ã\81\84ï¼\8e
+大é\9b\91æ\8a\8aã\81«è¨\80ã\81\86ã\81¨ï¼\8cplain \TeX ã\81®ç\8a¶æ³\81ã\81§ï¼\8c以ä¸\8bã\81®ã\82\88ã\81\86ã\81«ã\81\99ã\82\8bã\81\8bï¼\8c
 \begintt
 \input luatexja.sty               % ←マクロ本体を読み込み
 \jfont\tenipam={file:ipam.ttf:jfm=ujis} at 13.5\jQ 
 
 \rm\tenipam abcほげほげ)(あいう本文本文……
 \endtt
+\LaTeX において preamble 部で
+\begintt
+\usepackage{luatexja}
+\endtt
+と書けばよい.標準では非埋込の標準和文フォントRyumin-Light, GothicBBB-Mediumが使われる.
 
 \beginparagraph 和文フォントの定義
 
@@ -338,7 +349,9 @@ $n\notin [1,216]$の場合は,「どの文字範囲にも属さない|U+0080|
 
 \beginparagraph その他の命令
 
-\item dimen |\zw|, |\zh|: 現在の和文フォントの「幅」/「高さ」(メトリックから指定)
+\item |\zw|, |\zh|: 現在の和文フォントの「幅」/「高さ」(メトリックにより指定)\hfil\break
+今の版では,これは純粋なdimenレジスタではなくなっている.
+
 \item dimen |\jQ|, |\jH|${}= 0.25\,{\rm mm}$.
 \item |\inhibitglue|: 
 指定箇所でのJFM由来のglue/kernの挿入を禁止する.
index 1d36965..a4a0d64 100644 (file)
 \def\extract@jfont{%
     \get@external@font
     \expandafter\globaljfont\font@name\external@font\relax
-    \font@name\global\zw=\zw\global\zh=\zh
+    \font@name%\global\zw=\zw\global\zh=\zh
     \csname \f@encoding+\f@family\endcsname
     \csname\curr@fontshape\endcsname}
 
index 8fdd9a3..35448bd 100644 (file)
@@ -36,6 +36,7 @@ local attr_jchar_class = luatexbase.attributes['ltj@charclass']
 local attr_curjfnt = luatexbase.attributes['ltj@curjfnt']
 local attr_yablshift = luatexbase.attributes['ltj@yablshift']
 local attr_icflag = luatexbase.attributes['ltj@icflag']
+local cat_lp = luatexbase.catcodetables['latex-package']
 
 local ITALIC = 1
 local PACKED = 2
@@ -178,7 +179,7 @@ end
 
 -- EXT: print \global if necessary
 function ltj.ext_print_global()
-  if ltj.isglobal=='global' then tex.sprint('\\global') end
+  if ltj.isglobal=='global' then tex.sprint(cat_lp, '\\global') end
 end
 
 -- main process
index 81926ea..233bd13 100644 (file)
 \newdimen\ltj@tempdima
 \newskip\ltj@tempskipa
 
-\newdimen\zw
-\newdimen\zh
+\newdimen\ltj@zw
+\newdimen\ltj@zh
 \newdimen\jQ \jQ=0.25mm
 \newdimen\jH \jH=0.25mm
 
   \afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(true)}}
 \def\ltj@@jfont{\directlua{luatexja.jfont.jfontdefY()}}
 
+\def\zw{\directlua{luatexja.jfont.load_zw()}\ltj@zw}
+\def\zh{\directlua{luatexja.jfont.load_zh()}\ltj@zh}
+
 %%%%%%%% \inhibitglue
 \protected\def\inhibitglue{\directlua{luatexja.jfmglue.create_inhibitglue_node()}}
 
 %%------------------ all done
 \ltj@core@AtEnd
 \endinput
-%% EOF
+%% EOF
\ No newline at end of file
index 61a3af6..0db5f42 100644 (file)
@@ -20,7 +20,7 @@ local attr_icflag = luatexbase.attributes['ltj@icflag']
 local attr_curjfnt = luatexbase.attributes['ltj@curjfnt']
 local id_glyph = node.id('glyph')
 local id_kern = node.id('kern')
-
+local cat_lp = luatexbase.catcodetables['latex-package']
 local ITALIC = 1
 ------------------------------------------------------------------------
 -- LOADING JFM
@@ -120,7 +120,7 @@ function jfontdefX(g)
   local t = token.get_next()
   cstemp=token.csname_name(t)
   if g then ltj.is_global = '\\global' else ltj.is_global = '' end
-  tex.sprint('\\expandafter\\font\\csname ' .. cstemp .. '\\endcsname')
+  tex.sprint(cat_lp, '\\expandafter\\font\\csname ' .. cstemp .. '\\endcsname')
 end
 
 -- EXT
@@ -133,19 +133,35 @@ function jfontdefY() -- for horizontal font
                         "bad JFM `" .. jfm_file_name .. "'",
                         'The JFM file you specified is not valid JFM file.\n'..
                            'So defining Japanese font is cancelled.')
-      tex.sprint(ltj.is_global .. '\\expandafter\\let\\csname '
-                .. cstemp .. '\\endcsname=\\relax')
+      tex.sprint(cat_lp, ltj.is_global .. '\\expandafter\\let\\csname ' ..cstemp 
+             .. '\\endcsname=\\relax')
      return 
    end
    font_metric_table[fn]={}
    font_metric_table[fn].jfm=j
    font_metric_table[fn].size=f.size
    font_metric_table[fn].var=jfm_var
-   tex.sprint(ltj.is_global .. '\\protected\\expandafter\\def\\csname '
-              .. cstemp .. '\\endcsname'
-              .. '{\\csname ltj@curjfnt\\endcsname=' .. fn
-              .. ' \\zw=' .. round(f.size*metrics[j].zw) .. 'sp'
-              .. '\\zh=' .. round(f.size*metrics[j].zh) .. 'sp\\relax}')
+   tex.sprint(cat_lp, ltj.is_global .. '\\protected\\expandafter\\def\\csname ' 
+          .. cstemp  .. '\\endcsname{\\ltj@curjfnt=' .. fn .. '\\relax}')
+end
+
+-- zw, zh
+function load_zw()
+   local a = font_metric_table[tex.attribute[attr_curjfnt]]
+   if a then
+      tex.setdimen('ltj@zw', round(a.size*metrics[a.jfm].zw))
+   else 
+      tex.setdimen('ltj@zw',0)
+   end
+end
+
+function load_zh()
+   local a = font_metric_table[tex.attribute[attr_curjfnt]]
+   if a then
+      tex.setdimen('ltj@zh', round(a.size*metrics[a.jfm].zh))
+   else 
+      tex.setdimen('ltj@zh', round(a.size*metrics[a.jfm].zh))
+   end
 end
 
 -- extract jfm_file_name and jfm_var
index 3f92bad..8cc2ba7 100644 (file)
Binary files a/test/test01-noembed.pdf and b/test/test01-noembed.pdf differ
index 81e0393..7abebd7 100644 (file)
@@ -1,8 +1,7 @@
 %#! luatex
 \input luatexja-core.sty
 
-\jfont\tenmin={psft:Ryumin-Light:jfm=ujis}\tenmin
-\jfont\tengoth={psft:GothicBBB-Medium:jfm=ujis}
+\let\tengoth=\tengt
 \jfont\jisse={psft:Ryumin-Light:script=latn;+jp78;jfm=ujis}
 \jfont\jisexpt={psft:Ryumin-Light:script=latn;+expt;jfm=ujis}
 \jfont\jishwid={psft:Ryumin-Light:script=latn;+hwid;jfm=ujis}
index ef939f6..a4cc3ce 100644 (file)
Binary files a/test/test01.pdf and b/test/test01.pdf differ
index 74ec84f..cbcc3e2 100644 (file)
Binary files a/test/test02-latex.pdf and b/test/test02-latex.pdf differ
index 221be0f..021230e 100644 (file)
Binary files a/test/test03-after.pdf and b/test/test03-after.pdf differ
index 679b21a..2115345 100644 (file)
Binary files a/test/test04-jfm.pdf and b/test/test04-jfm.pdf differ