OSDN Git Service

Noted the clash between kerning from font and that from JFM.
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Fri, 23 Sep 2011 04:10:22 +0000 (13:10 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Fri, 23 Sep 2011 04:10:22 +0000 (13:10 +0900)
doc/man-en.pdf
doc/manual.dtx
src/jfm-prop.lua [new file with mode: 0644]
src/luatexja-fontspec.sty

index 23fce78..8dc18a0 100644 (file)
Binary files a/doc/man-en.pdf and b/doc/man-en.pdf differ
index 72a230d..d19704e 100644 (file)
@@ -398,8 +398,10 @@ alphabetic fonts
 
 
 Note that there is no command named \verb+\setmonojfont+, since it is
-popular for Japanese fonts that nearly all Japanese glyphs have same widths.
-
+popular for Japanese fonts that nearly all Japanese glyphs have same
+widths.  Also note that the kerning feature is set off by default in
+these 7~commands, since this feature and \textbf{JAglue} will clash (see
+\ref{para-kern}).
 
 \section{Changing Parameters}
 There are many parameters in \LuaTeX-ja. And due to the behavior of \LuaTeX,
@@ -687,7 +689,7 @@ To load a font as a Japanese font, you must use the
 so TrueType/OpenType fonts with features can be used for Japanese fonts:
 \begin{LTXexample}
 \jfont\tradgt={file:ipaexg.ttf:script=latn;%
-  +trad;jfm=ujis} at 14pt
+  +trad;-kern;jfm=ujis} at 14pt
 \tradgt{}当/体/医/区
 \end{LTXexample}
 
@@ -703,12 +705,29 @@ be used a prefix in \verb+\jfont+ (and~\verb+\font+) primitive.  Using
 this prefix, you can specify a font that has its name only and is not
 related to any real font.
 
-Mainly, use of this \texttt{psft:}\ prefix is for using non-embedding `standard' Japanese fonts (Ryumin-Light and GothicBBB-Medium).
-歴史
+Mainly, use of this \texttt{psft:}\ prefix is for using non-embedding
+`standard' Japanese fonts (Ryumin-Light and GothicBBB-Medium). 歴史
 
-\paragraph{Features}
+\paragraph{JFM}
 jfm, jfmvar
 
+\paragraph{Note: kern feature}\label{para-kern}
+Some fonts have information for inter-glyph spacing. However, this
+information is not well-compatible with \LuaTeX-ja.  More concretely,
+this kerning space from this information are inserted \emph{before} the
+insertion process of \textbf{JAglue}, and this causes incorrect spacing
+between two characters when both a glue/kern from the data in the font
+and it from JFM are present.
+
+\begin{itemize}
+\item You should specify {\tt -kern} in
+{\tt\char92jfont} primitive, when you want to use other font features,
+      such as {\tt script=...}\,.
+\item If you want to use Japanese fonts in proportinal width, and use
+      information from this font, use \texttt{jfm-prop.lua} for its JFM, and ...
+
+TODO: kanjiskip?
+\end{itemize}
 
 
 \subsection{Structure of JFM file}
diff --git a/src/jfm-prop.lua b/src/jfm-prop.lua
new file mode 100644 (file)
index 0000000..af1c12e
--- /dev/null
@@ -0,0 +1,9 @@
+luatexja.jfont.define_jfm {
+   dir = 'yoko',
+   zw = 1.0, zh = 1.0,
+
+   [0] = {
+      align = 'left', left = 0.0, down = 0.0,
+      width = 'prop', height = 0.88, depth = 0.12, italic=0.0,
+   }
+}
\ No newline at end of file
index 0d5f25a..80d80d9 100644 (file)
       \fontspec_update_featstr:n {jfm=##1}      
     }
   }
+  \keys_define:nn {fontspec} { JFM-var .code:n = {
+      \fontspec_update_fontid:n  {+jfmvar=##1}
+      \fontspec_update_featstr:n {jfmvar=##1}      
+    }
+  }
   \keys_define:nn {fontspec-preparse-external} { NoEmbed .code:n = {
       \cs_set:Nn \fontspec_namewrap:n {psft:####1}
     }
   }
   \tl_set:Nn \g_fontspec_encoding_tl {JY3}
   \tl_set:Nx \g_fontspec_default_fontopts_tl 
-             {JFM=ujis,Scale=0.960444,\g_ltj_fontspec_default_fontopts_tl}
+             {JFM=ujis,Scale=0.960444,Kerning=Off,\g_ltj_fontspec_default_fontopts_tl}
   \cs_set_eq:NN \DeclareFontFamily \DeclareKanjiFamily
   \fontspec_select:nn{#1}{#2}
   \group_end: