ソースコードの管理場所
Revision | 2bcf3daf5ca72ba3ea1fb83a672372604d05edb9 (tree) |
---|---|
Time | 2013-05-20 01:23:09 |
Author | maqiyuan <maqiyuan@user...> |
Commiter | maqiyuan |
Doc on Chinese fonts.
@@ -0,0 +1,250 @@ | ||
1 | +\documentclass[DIV=13]{article} | |
2 | +\usepackage{typearea} | |
3 | +\usepackage{hologo} | |
4 | +\def\pTeX{p\TeX} | |
5 | +\def\LuaTeX{Lua\TeX} | |
6 | +\def\XeTeX{\hologo{XeTeX}} | |
7 | +\usepackage{booktabs} | |
8 | +\usepackage{multicol} | |
9 | +\usepackage{indentfirst} | |
10 | +\usepackage{luatexja-fontspec} | |
11 | +\parindent2\zw | |
12 | +\setmainjfont[BoldFont={FZXiaoBiaoSong-B05}]{FZShuSong-Z01} | |
13 | +\title{\LuaTeX-ja简体中文字体配置} | |
14 | +\author{马起园 苏 杰} | |
15 | +\date{2013年5月} | |
16 | +\begin{document} | |
17 | +\maketitle | |
18 | +\section{\LuaTeX-ja项目简介} | |
19 | +\LuaTeX-ja项目旨在将\pTeX 处理汉字的机制移植到\LuaTeX 下,当前项目的成员 | |
20 | +有:北川弘典、前田一貴、八登崇之、黒木裕介 、阿部紀行、山本宗宏、本田知 | |
21 | +亮、齋藤修三郎和馬起園。 | |
22 | + | |
23 | +\LuaTeX 虽然在编码上支持Unicode,但并不能直接处理汉字断行以及禁则应用,而 | |
24 | +在\pTeX 系列中则能够处理断行并应用禁则,但并不支持pdf输出。\LuaTeX 下处理 | |
25 | +汉字的断行和应用禁则需要使用其内建的诸多callback来进行。\pTeX 扩展TFM为JFM, | |
26 | +但是JFM抽象程度更高,该文件涉及到的内容是字体的标点压缩,可以用于多个汉字字体。 | |
27 | + | |
28 | +当前版本的\LuaTeX-ja 可以应用于\TeX\ Live和W32\TeX,但不能在MikTeX下使用, | |
29 | +因为MikTeX下的\LuaTeX 存在bug。 | |
30 | +\section{字体使用} | |
31 | +\subsection{关于Lua\TeX-ja的字体调用} | |
32 | +\XeTeX 在调用字体的时候需要使用freetype和fontconfig库,所以需要更新字体缓 | |
33 | +存,但是在\LuaTeX 下就不太一样。\LuaTeX 只需要在初次使用的时候刷新字体数据 | |
34 | +库即可(此数据库是一个lua文件)。\LuaTeX 下的字体缓存实际上是将字体的各种 | |
35 | +信息导出并保存的文件,在调用一个新字体的时候会生成一个。\LuaTeX 对于字体的 | |
36 | +处理并没有使用freetype,而是使用了fontforge,不过可能由于该库的接口有一些 | |
37 | +问题,导致部分字体无法在\LuaTeX 下使用。 | |
38 | + | |
39 | +在使用\LuaTeX-ja的时候,需要先刷新字体数据库,该命令的使用方法如下: | |
40 | +\begin{verbatim} | |
41 | +Usage: mkluatexfontdb [OPTION]... | |
42 | + | |
43 | +Rebuild the LuaTeX font database. | |
44 | + | |
45 | +Valid options: | |
46 | + -f --force force re-indexing all fonts | |
47 | + -q --quiet don't output anything | |
48 | + -v --verbose=LEVEL be more verbose (print the searched directories) | |
49 | + -vv print the loaded fonts | |
50 | + -vvv print all steps of directory searching | |
51 | + -V --version print version and exit | |
52 | + -h --help print this message | |
53 | +\end{verbatim} | |
54 | + | |
55 | +又是可能遇到通不过的字体,需要将这个字体的绝对路径添加到otfl-blacklist.cnf中, | |
56 | +这个文件的内容如下: | |
57 | +\begin{verbatim} | |
58 | +% Tackes ages to load | |
59 | +LastResort.ttf % a MacOSX font, but also available for free from unicode.org | |
60 | + | |
61 | +% Mac OS X TTC fonts, this list need to be filtered out | |
62 | +/Library/Fonts/AmericanTypewriter.ttc | |
63 | +/Library/Fonts/Baskerville.ttc | |
64 | +/Library/Fonts/Chalkboard.ttc | |
65 | +/Library/Fonts/Cochin.ttc | |
66 | +/Library/Fonts/Copperplate.ttc | |
67 | +/Library/Fonts/Didot.ttc | |
68 | +/Library/Fonts/Futura.ttc | |
69 | +/Library/Fonts/GillSans.ttc | |
70 | +/Library/Fonts/Hoefler Text.ttc | |
71 | +/Library/Fonts/MarkerFelt.ttc | |
72 | +/Library/Fonts/Optima.ttc | |
73 | +/Library/Fonts/Papyrus.ttc | |
74 | +/Library/Fonts/STHeiti Medium.ttc | |
75 | +/System/Library/Fonts/AquaKana.ttc | |
76 | +/System/Library/Fonts/HelveticaNeue.ttc | |
77 | +/System/Library/Fonts/LucidaGrande.ttc | |
78 | +/System/Library/Fonts/Menlo.ttc | |
79 | +/System/Library/Fonts/STHeiti Light.ttc | |
80 | +\end{verbatim} | |
81 | + | |
82 | +Lua\TeX 调用TrueType和OpenType字体并没有固定的方式,\XeTeX 使用了固定的接口, | |
83 | +而Lua\TeX 需要使用luaotfload包来进行字体的调用。这两种字体一般都有高级特性, | |
84 | +在\TeX\ Live或者W32\TeX 中可以使用otfinfo命令来查看相关的信息: | |
85 | +\begin{verbatim} | |
86 | +'Otfinfo' reports information about an OpenType font to standard output. | |
87 | +Options specify what information to print. | |
88 | + | |
89 | +Usage: otfinfo [-sfzpg | OPTIONS] [OTFFILES...] | |
90 | + | |
91 | +Query options: | |
92 | + -s, --scripts Report font's supported scripts. | |
93 | + -f, --features Report font's GSUB/GPOS features. | |
94 | + -z, --optical-size Report font's optical size information. | |
95 | + -p, --postscript-name Report font's PostScript name. | |
96 | + -a, --family Report font's family name. | |
97 | + -v, --font-version Report font's version information. | |
98 | + -i, --info Report font's names and designer/vendor info. | |
99 | + -g, --glyphs Report font's glyph names. | |
100 | + -t, --tables Report font's OpenType tables. | |
101 | + -T, --dump-table NAME Output font's 'NAME' table. | |
102 | + | |
103 | +Other options: | |
104 | + --script=SCRIPT[.LANG] Set script used for --features [latn]. | |
105 | + -V, --verbose Print progress information to standard error. | |
106 | + -h, --help Print this message and exit. | |
107 | + -q, --quiet Do not generate any error messages. | |
108 | + --version Print version number and exit. | |
109 | + | |
110 | +Report bugs to <ekohler@gmail.com>. | |
111 | +\end{verbatim} | |
112 | +\subsection{使用字体的方法} | |
113 | +目前\LuaTeX-ja支持在plain \TeX 和\LaTeX 下使用。如果你使用texinfo,那么很 | |
114 | +不幸,你不太可能使用\LuaTeX-ja来处理中文,因为texinfo是针对pdf\TeX 设计的, | |
115 | +在\LuaTeX 下使用已经有了一定的不兼容现象,即使完全兼容也需要对texinfo中的 | |
116 | +字体配置进行调整,如果你急需使用texinfo来处理中文,请尝试W32\TeX 下的texinfo, | |
117 | +这个发行版中的texinfo已经打了补丁。对于Con\TeX t用户,请使用李延瑞的zhfonts模块 | |
118 | +\footnote{见https://github.com/liyanrui/zhfonts}。 | |
119 | + | |
120 | +在plain \TeX 中使用Lua\TeX-ja可以在源文件中写入: | |
121 | +\begin{verbatim} | |
122 | +\input luatexja-core.sty | |
123 | +\end{verbatim} | |
124 | +Lua\TeX-ja移植的了\verb!\jfont!命令,在plain \TeX 下需要通过该命令来 | |
125 | +控制输出的汉字字体,例如: | |
126 | +\begin{verbatim} | |
127 | +\jfont\song={name:SimSun:jfm=banjiao} at 10pt | |
128 | +\song 我能吞下玻璃而不伤身体。 | |
129 | +\end{verbatim} | |
130 | +上文中的\verb!jfm=banjiao!使用来控制标点压缩的,如果此项未设定,则 | |
131 | +使用默认的\verb!ujis!压缩模式,对于简体中文来讲,可用的模式有: | |
132 | +\texttt{quanjiao,banjiao,kaiming}。 | |
133 | + | |
134 | +而在\LaTeX 下使用则较为简单,使用: | |
135 | +\begin{verbatim} | |
136 | +\usepackage{luatexja-fontspec} | |
137 | +\end{verbatim} | |
138 | +这个包对fontspec包进行了封装,令其能够较为便利地设定汉字字体。 | |
139 | +这个包提供的命令如下: | |
140 | +\begin{table}[htbp] | |
141 | + \centering | |
142 | + \begin{tabular}{ll} | |
143 | + \toprule | |
144 | + \multicolumn{1}{c}{\textbf{命令}} & \multicolumn{1}{c}{\textbf{用途}} \\ | |
145 | + \midrule | |
146 | + \verb!\jfontspec! & 改变当前汉字字体 \\ | |
147 | + \verb!\setmainjfont! & 设定文档主汉字字体 \\ | |
148 | + \verb!\setsansjfont! & 设定文档的无衬线汉字字体(黑体) \\ | |
149 | + \verb!\newjfontfamily! & 设定新的汉字字体族命令 \\ | |
150 | + \verb!\newjfontface! & 设定新的汉字字体命令 \\ | |
151 | + \verb!\defaultjfontfeatures! & 默认汉字字体的特性 \\ | |
152 | + \verb!\addjfontfeatures! & 设定当前字体的特性 \\ | |
153 | + \bottomrule | |
154 | + \end{tabular}% | |
155 | +\end{table}% | |
156 | + | |
157 | + | |
158 | +\subsection{不可用字体系列} | |
159 | +中文字体在丰度上与日文字体对比并不占优势,所以中文\TeX 文档在使用使用字体 | |
160 | +上没有太大变化。当你想在\LuaTeX-ja下是有部分特色字体的时候,请做好此种字体 | |
161 | +可能无法使用的准备。目前报错明显的字体有数个: | |
162 | +\begin{itemize} | |
163 | +\item 灵格斯词典附带的音标字体,这些字体会安装到系统字体文件夹下,在更新 | |
164 | + 字体数据库的时候会出现程序崩溃的情况,这是字体本身的原因,需要添加到黑名单中 | |
165 | +\item 康熙字典体,这是中国大陆一位业余字体设计者所设计的字体,由于该作者 | |
166 | + 缺乏相关技术知识,导致此字体的CMap出错,无论是完全版还是试用版都会出现 | |
167 | + 问题,此外该字体的boundingbox也是错误的,在嵌入pdf文档中十分影响阅读 | |
168 | +\item 信黑体,这个字体也是CMap的问题,无法使用 | |
169 | +\end{itemize} | |
170 | +\subsection{华文字体系列} | |
171 | +在微软提供的Office套装中附带了一定数量的中文字体, | |
172 | +这些字体是常州华文印刷新技术有限公司制造的。 | |
173 | +这些字体安装在系统字体文件夹下,在使用\LuaTeX-ja 的时候 | |
174 | +可以酌情使用。在本文档中,我们推荐简体中文用户使用 | |
175 | +此套字体,从使用率上看,各大学都会装有微软的操作系统 | |
176 | +和微软的Office,可以说已经相当普及,故做推荐。 | |
177 | + | |
178 | +\begin{table}[htbp] | |
179 | + \centering | |
180 | + \begin{tabular}{llll} | |
181 | + \toprule | |
182 | + \multicolumn{1}{c}{\textbf{字体名}} & \multicolumn{1}{c}{\textbf{文件名}} & \multicolumn{1}{c}{\textbf{PostScript名}} & \multicolumn{1}{c}{\textbf{样例}} \\ | |
183 | + \midrule | |
184 | + 华文宋体 & \texttt{STSONG.TTF} & STSong & {\jfontspec{STSong}我能吞下玻璃而不伤身体} \\ | |
185 | + 华文中宋 & \texttt{STZHONGS.TTF} & STZhongsong & {\jfontspec{STZhongsong}我能吞下玻璃而不伤身体} \\ | |
186 | + 华文细黑 & \texttt{STXIHEI.TTF} & STXihei & {\jfontspec{STXihei}我能吞下玻璃而不伤身体} \\ | |
187 | + 华文楷体 & \texttt{STKAITI.TTF} & STKaiti & {\jfontspec{STKaiti}我能吞下玻璃而不伤身体} \\ | |
188 | + 华文仿宋 & \texttt{STFANGSO.TTF} & STFangsong & {\jfontspec{STFangsong}我能吞下玻璃而不伤身体} \\ | |
189 | + \bottomrule | |
190 | + \end{tabular}% | |
191 | +\end{table}% | |
192 | +\subsection{中易字体系列} | |
193 | +在Windows系统简体中文版中,附带了数种中文字体。 | |
194 | +这些字体为中易中标电子信息技术有限公司制造的。 | |
195 | +同我们强烈推荐的第一种方案比较,没有中宋。 | |
196 | +如果按照CCT的传统,一般使用黑体替换。 | |
197 | + | |
198 | +\begin{table}[htbp] | |
199 | + \centering | |
200 | + \begin{tabular}{llll} | |
201 | + \toprule | |
202 | + \multicolumn{1}{c}{\textbf{字体名}} & \multicolumn{1}{c}{\textbf{文件名}} & \multicolumn{1}{c}{\textbf{PostScript名}} & \multicolumn{1}{c}{\textbf{样例}} \\ | |
203 | + \midrule | |
204 | + 宋体 & \texttt{simsun.ttc} & SimSun & {\jfontspec{SimSun}我能吞下玻璃而不伤身体} \\ | |
205 | + 黑体 & \texttt{simhei.ttf} & SimHei & {\jfontspec{SimHei}我能吞下玻璃而不伤身体} \\ | |
206 | + 楷体 & \texttt{simkai.ttf} & KaiTi & {\jfontspec{KaiTi}我能吞下玻璃而不伤身体} \\ | |
207 | + 仿宋 & \texttt{simkai.ttf} & FangSong & {\jfontspec{FangSong}我能吞下玻璃而不伤身体} \\ | |
208 | + \bottomrule | |
209 | + \end{tabular}% | |
210 | +\end{table}% | |
211 | +\subsection{Adobe字体系列} | |
212 | +在Adobe Reader简体中文版中,附带了宋体和黑体两种字体。 | |
213 | +这两种字体实际上是华文字体,但是和华文字体不能混用, | |
214 | +因为Adobe Reader中的中文字体的基线都进行了调整, | |
215 | +不能互相匹配。在Adobe InDesign中还附带了楷体和仿宋体。 | |
216 | +Adobe的中文字体的Postscript名即为文件名去掉后缀名。 | |
217 | + | |
218 | +\begin{table}[htbp] | |
219 | + \centering | |
220 | + \begin{tabular}{lll} | |
221 | + \toprule | |
222 | + \multicolumn{1}{c}{\textbf{字体名}} & \multicolumn{1}{c}{\textbf{文件名}} & \multicolumn{1}{c}{\textbf{样例}} \\ | |
223 | + \midrule | |
224 | + Adobe 宋体 Std & \texttt{AdobeSongStd-Light.otf} & {\jfontspec{AdobeSongStd-Light}我能吞下玻璃而不伤身体} \\ | |
225 | + Adobe 黑体 Std & \texttt{AdobeHeitiStd-Regular.otf} & {\jfontspec{AdobeHeitiStd-Regular}我能吞下玻璃而不伤身体} \\ | |
226 | + Adobe 楷体 Std & \texttt{AdobeKaitiStd-Regular.otf} & {\jfontspec{AdobeKaitiStd-Regular}我能吞下玻璃而不伤身体} \\ | |
227 | + Adobe 仿宋 Std & \texttt{AdobeFangsongStd-Regular.otf} & {\jfontspec{AdobeFangsongStd-Regular}我能吞下玻璃而不伤身体} \\ | |
228 | + \bottomrule | |
229 | + \end{tabular}% | |
230 | +\end{table}% | |
231 | +\subsection{方正字体系列} | |
232 | +方正字体的来源有两种,第一种是使用方正的排版系统的时候会 | |
233 | +安装到Windows系统的字体文件夹下,第二种是针对Linux系统 | |
234 | +来说的,WPS for Linux附带了部分方正字体。 | |
235 | + | |
236 | +\begin{table}[htbp] | |
237 | + \centering | |
238 | + \begin{tabular}{llll} | |
239 | + \toprule | |
240 | + \multicolumn{1}{c}{\textbf{字体名}} & \multicolumn{1}{c}{\textbf{文件名}} & \multicolumn{1}{c}{\textbf{全名}} & \multicolumn{1}{c}{\textbf{样例}} \\ | |
241 | + \midrule | |
242 | + 方正书宋\_GBK & \texttt{FZSSK.TTF} & FZShuSong-Z01 & {\jfontspec{FZShuSong-Z01}我能吞下玻璃而不伤身体} \\ | |
243 | + 方正小标宋\_GBK & \texttt{FZXBSK.TTF} & FZXiaoBiaoSong-B05 & {\jfontspec{FZXiaoBiaoSong-B05}我能吞下玻璃而不伤身体} \\ | |
244 | + 方正黑体\_GBK & \texttt{FZHTK.TTF} & FZHei-B01 & {\jfontspec{FZHei-B01}我能吞下玻璃而不伤身体} \\ | |
245 | + 方正楷体\_GBK & \texttt{FZKTK.TTF} & FZKai-Z03 & {\jfontspec{FZKai-Z03}我能吞下玻璃而不伤身体} \\ | |
246 | + 方正仿宋\_GBK & \texttt{FZFSK.TTF} & FZFangSong-Z02 & {\jfontspec{FZFangSong-Z02}我能吞下玻璃而不伤身体} \\ | |
247 | + \bottomrule | |
248 | + \end{tabular}% | |
249 | +\end{table}% | |
250 | +\end{document} |