[Tex/LaTex] How to combine fonts for different scripts

cjkfontsluatexxetex

I want to combine Helvetica World (for roman, cyrillic, greek and arabic) and Hei Std (for simplified chinese) in one document with LuaLaTeX. Hei Std probably hasn't all the glyphs from Helvetica World and Helvetica World certainly hasn't all characters from Hei Std.

Can I get LuaLaTeX to automatically choose the right font based on the input, i.e. can I combine fonts into one "virtual font"? I don't want to switch the fonts manually.

Out of curiosity I'm also interested in a solution for XeLaTeX, but I need one for LuaLaTeX.

Best Answer

Yes, for XeLaTeX, you should use our xeCJK package. For Chinese typesetting in xeCJK, see my previous answers tagged cjk.

A simple example:

% UTF-8 encoding, compile with XeLaTeX
\documentclass{article}

\usepackage{xeCJK}
\setmainfont{Arial}
\setCJKmainfont{Microsoft YaHei}

\begin{document}
Arial font and 微软雅黑
\end{document}

And for LuaLaTeX, you can use luatexja-fontspec package from luatexja bundle. luatexja is originally designed for Japanese, but also useful for Chinese (due to Ma Qiyuan's work).

A simple example, very similar to xeCJK:

% UTF-8 encoding, compile with LuaLaTeX
\documentclass{article}

\usepackage{luatexja-fontspec}
\setmainfont{Arial}
\setmainjfont{Microsoft YaHei}

\begin{document}
Arial font and 微软雅黑
\end{document}

The English document of luatexja: http://mirror.ctan.org/macros/luatex/generic/luatexja/doc/luatexja-en.pdf

In ctex bundle, we shall also support luatexja as one of the background package. The new version has not been released.