xelatex 使用 noto sans cjk 产生错误字体,全部还原为 jp 版本

xelatex 使用 noto sans cjk 产生错误字体,全部还原为 jp 版本

latex的源代码:

\documentclass[12pt]{article}
\usepackage[no-math]{fontspec}
\setmainfont{Noto Sans CJK SC}
\setmonofont{Noto Sans Mono CJK SC}
\setsansfont{Noto Sans CJK SC}  
\begin{document}
我是
\end{document}

Noto Sans CJK SC 的名称(如果来自 fc-list)

/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK JP,Noto Sans CJK JP Regular:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK KR,Noto Sans CJK KR Regular:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK SC,Noto Sans CJK SC Regular:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK TC,Noto Sans CJK TC Regular:style=Regular

然后我使用 Adob​​e Reader 打开输出的 pdf 文件并选择文件、属性、字体。

它显示字体是 NotoSansCJKjp-Regular。但是,我设置

\setmainfont{Noto Sans CJK SC}

在源文件中,字体应该是NotoSansCJKsc-Regular。我还尝试了其他字体Noto Sans CJK TC和Noto Sans CJK KR,它们都缩小为NotoSansCJKjp-Regular。

如何解决这个问题?

但是,lualatex 给了我正确的前端。这意味着使用 Adob​​e Reader 打开输出的 PDF 文件并选择文件、属性、字体。它显示字体是 NotoSansCJKsc-Regular。

我使用 texlive 2016 和 ubuntu 16.04。

我将 \XeTeXtracingfonts=1 添加到源文件中并看到:

Requested font "Noto Sans CJK SC" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans CJK SC/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
\g__fontspec_family_NotoSansCJKSC_int=\count121
Requested font "Noto Sans CJK SC/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans CJK SC/BI/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc
Requested font "Noto Sans CJK SC/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans CJK SC/B/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc
Requested font "Noto Sans CJK SC/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans CJK SC/I/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
.................................................
. fontspec info: "no-font-shape"
. 
. Could not resolve font Noto Sans CJK SC/I (it probably doesn't exist).
.................................................
Requested font "Noto Sans CJK SC/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans CJK SC/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans CJK SC/B/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc
Requested font "Noto Sans CJK SC/B/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc
Requested font "Noto Sans CJK SC/BI/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc
Requested font "Noto Sans CJK SC/BI/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc
.................................................
. fontspec info: "defining-font"
. 
. Font family 'NotoSansCJKSC(0)' created for font 'Noto Sans CJK SC' with
. options [Ligatures=TeX].
. 
. This font family consists of the following NFSS series/shapes:
. - 'normal' (m/n) with NFSS spec.: <->"Noto Sans CJK
. SC/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'small caps'  (m/sc) with NFSS spec.: - 'bold' (bx/n) with NFSS spec.:
. <->"Noto Sans CJK SC/B/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'bold small caps'  (bx/sc) with NFSS spec.: - 'bold italic' (bx/it) with
. NFSS spec.: <->"Noto Sans CJK
. SC/BI/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'bold italic small caps'  (bx/itsc) with NFSS spec.: 
.................................................
Requested font "Noto Sans CJK SC/OT:script=latn;language=DFLT;mapping=tex-text;
" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans Mono CJK SC" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans Mono CJK SC/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
\g__fontspec_family_NotoSansMonoCJKSC_int=\count122
Requested font "Noto Sans Mono CJK SC/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans Mono CJK SC/BI/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc
Requested font "Noto Sans Mono CJK SC/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans Mono CJK SC/B/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc
 Requested font "Noto Sans Mono CJK SC/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans Mono CJK SC/I/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
.................................................
. fontspec info: "no-font-shape"
. 
. Could not resolve font Noto Sans Mono CJK SC/I (it probably doesn't exist).
.................................................
Requested font "Noto Sans Mono CJK SC/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans Mono CJK SC/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans Mono CJK SC/B/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc
Requested font "Noto Sans Mono CJK SC/B/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc
Requested font "Noto Sans Mono CJK SC/BI/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc
Requested font "Noto Sans Mono CJK SC/BI/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc
.................................................
. fontspec info: "defining-font"
. 
. Font family 'NotoSansMonoCJKSC(0)' created for font 'Noto Sans Mono CJK SC'
. with options [WordSpace={1,0,0},PunctuationSpace=WordSpace].
. 
. This font family consists of the following NFSS series/shapes:
. - 'normal' (m/n) with NFSS spec.: <->"Noto Sans Mono CJK
. SC/OT:script=latn;language=DFLT;"
. - 'small caps'  (m/sc) with NFSS spec.: 
. and font adjustment code:
. \fontdimen 2\font =1\fontdimen 2\font \fontdimen 3\font =0\fontdimen 3\font
. \fontdimen 4\font =0\fontdimen 4\font \fontdimen 7\font =0\fontdimen 2\font
. - 'bold' (bx/n) with NFSS spec.: <->"Noto Sans Mono CJK
. SC/B/OT:script=latn;language=DFLT;"
. - 'bold small caps'  (bx/sc) with NFSS spec.: 
. and font adjustment code:
. \fontdimen 2\font =1\fontdimen 2\font \fontdimen 3\font =0\fontdimen 3\font
. \fontdimen 4\font =0\fontdimen 4\font \fontdimen 7\font =0\fontdimen 2\font
. - 'bold italic' (bx/it) with NFSS spec.: <->"Noto Sans Mono CJK
. SC/BI/OT:script=latn;language=DFLT;"
. - 'bold italic small caps'  (bx/itsc) with NFSS spec.: 
. and font adjustment code:
. \fontdimen 2\font =1\fontdimen 2\font \fontdimen 3\font =0\fontdimen 3\font
 . \fontdimen 4\font =0\fontdimen 4\font \fontdimen 7\font =0\fontdimen 2\font 
.................................................
Requested font "Noto Sans CJK SC" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans CJK SC/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc

最后的输出:

Requested font "Noto Sans CJK SC" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc
Requested font "Noto Sans CJK SC/OT" at 12.0pt
 -> /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc

摘自 noto cjk 网站https://www.google.com/get/noto/help/cjk/

CJK OTF fonts with different default language (S Chinese, T Chinese,
Japanese, and Korean packages). Each font file supports all four 
languages. However, you need an application program that can invoke an  
opentype locl feature (e.g. Adobe InDesign) to access language-specific 
variants other than the default language. 

看起来 xelatex 无法调用 opentype locl 特性,只能获取默认语言。但是从https://en.wikipedia.org/wiki/XeTeX

Support for OpenType local typographic conventions (locl tag) is also present

也许我需要找到某种方法来使用 locl 标签,但该怎么做呢?

答案1

来自你提到的 Noto Sans CJK 网站https://www.google.com/get/noto/help/cjk/

Noto Sans CJK 字体有四种包装格式。无论采用哪种包装格式,字形设计都是相同的。

尽管不清楚为什么 Noto San CJK JP 在 xetex 模式下加载,但您可以尝试Language明确指定该选项以获取正确的字形。

\documentclass[12pt]{article}
\usepackage[no-math]{fontspec}
\begin{document}
\LARGE
{
\fontspec{Noto Sans CJK SC}
我是 Noto Sans CJK SC

我能吞下玻璃而不伤身体。
}

{
\fontspec{Noto Sans CJK SC}[Language=Japanese]
我是 Noto Sans CJK SC,  jan

我能吞下玻璃而不伤身体。
}

{
\fontspec{Noto Sans CJK SC}[Language={Chinese Simplified}]
我是 Noto Sans CJK SC, zhs

我能吞下玻璃而不伤身体。
}

{
\fontspec{Source Han Sans SC Regular}
我是 Source Han Sans SC Regular

我能吞下玻璃而不伤身体。

简体中文测试。
}

\end{document}

最后一种是 Source Han Sans SC,这是 Adob​​e 命名的 Noto Sans CJK SC 的别名,这里将其作为基准进行测试。您可以从以下位置下载github

比较这些字体在有/无选项情况下的差异Language,例如“能”字的效果。

有关选项的详细信息,请参阅 fontspec 文档Language(第 10.18 和 28.0.22 节)。

相关内容