![如何在 ConTeXt 中混合 CJK 字体和其他字体?](https://linux22.com/image/438659/%E5%A6%82%E4%BD%95%E5%9C%A8%20ConTeXt%20%E4%B8%AD%E6%B7%B7%E5%90%88%20CJK%20%E5%AD%97%E4%BD%93%E5%92%8C%E5%85%B6%E4%BB%96%E5%AD%97%E4%BD%93%EF%BC%9F.png)
在 XeTex 或 LuaTex 中,我们可以自动在 CJK 和英语之间切换 sans 字体。我们如何在 ConText 中做类似的事情?
\setmainfont[]{Optima}
\setsansfont[]{Optima}
\ifXeTeX
\usepackage{xeCJK}
\setCJKmainfont[]{IPAexGothic}
\fi
\ifLuaTeX
\usepackage[]{luatexja-fontspec}
\setmainjfont[]{IPAexGothic}
\fi
答案1
我不会使用与您相同的字体,因为我的系统中没有安装它们,但这可能可以作为您的模板。我假设您的字体完全支持您想要显示的字符。我的示例涉及韩语,因为它对我来说更熟悉,但这也适用于中文和日文。
%%% Only for this example
%\setuppapersize[A6]
%%% The following presets are available
%%% 1. range:korean
%%% 2. range:chinese
%%% 3. range:japanese
%%% See font-sel.mkxl for more presets
%%% Otherwise, use ranges (range={...})
%%% https://wiki.contextgarden.net/List_of_Unicode_blocks
%%% You can add fallbacks and families for serif, sans, mono and math, if needed.
%%% I'm only following your example
\definefallbackfamily[main][serif][Noto Serif CJK KR]
[preset=range:korean,
force=yes] %force=yes is necessary here
\definefontfamily[main][serif][URW Classico]
\definefontfamily[main][sans][URW Classico]
%%% Enable it for line breaking across CJK words
%\setscript[hangul]
\setupbodyfont[main]
\starttext
일식(日蝕) 'solar eclipse' and 일식(日食) 'Japanese food' are homophones in Korean.
%https://colorcodedlyrics.com/2020/12/taeyeon-taeyeon-what-do-i-call-you
What do I call you
남이잖아
별일 없던 척
말을 거나
그렇게 꼭 껴안았는데
So what do I call you now
What do I call you
이럴 때엔
이름이 역시
무난할까
내 연인이었던
my honey
my daisy
my only
So what do I call you now
\stoptext