对于 XeLaTex 中的垂直 CJK,如何将罗马字符与中文字符对齐,并让中文字体正确“回退”?

对于 XeLaTex 中的垂直 CJK,如何将罗马字符与中文字符对齐,并让中文字体正确“回退”?

我正在尝试垂直排版中文,其中混入了一些罗马字符,以及一些需要“回退”到与主字体不同的字体的罕见字符。使用本文中的解决方案解决了罗马字符的问题:包含“CJK 后备系列字体”字符的垂直中文文本如下图 MWE 所示:

\documentclass[landscape,12pt,a4paper]{bxjsarticle}
\usepackage[a4paper]{geometry}
\usepackage{fontspec}
\usepackage[AutoFallBack=true]{xeCJK}
\usepackage{zxjatype}
\usepackage{flowfram}

%command borrowed from the aforementioned post to properly align roman characters with chinese characters:
\newcommand*\CJKmovesymbol[1]{\raise.35em\hbox{#1}}
\newcommand*\CJKmove{\punctstyle{plain}
  \let\CJKsymbol\CJKmovesymbol
  \let\CJKpunctsymbol\CJKsymbol}

%font settings:
\setmainfont{Linux Libertine O}
\setCJKmainfont[Scale=MatchLowercase,Mapping=tex-text,RawFeature={vertical}]{Kozuka Mincho Pro L}
\setCJKfallbackfamilyfont{rm}[Script=CJK,RawFeature={vertical}]{SimSun}

%settings for a 90-degree rotated "flowframe" to enable vertical typesetting
\newflowframe{\textheight}{\textwidth+2em}{0pt}{\textheight}[mainframe] 
\setflowframe{1}{angle=-90} 

\begin{document}

% This next line appears to be the problem: It seems to be needed to enable the command created above, but seems to prevent the CJK fonts from "falling back" properly
\CJKmove

\begin{quote}
別說則慢有八種。此屬增上。真出假位現種種形調伏眾生。故名大慢。大經三十云。菩薩若見眾<the character 眾 doesn't display but the character 衆 does 生有憍慢者。
\end{quote}
\end{document}

此代码为字符“眾”生成了一个“豆腐”框,因为它似乎不包含在字体中Kozuka Mincho Pro L。相反,它应该“回退”到SimSun字体,但是\CJKmove命令中的某些内容(需要保持罗马字体和中文基线对齐)似乎阻止它这样做。如果我删除该行\CJKmove后面的命令\begin{document},中文可以正常显示,但英文会错位。加上该命令后,英文可以对齐,但一些中文字符会显示为“豆腐块”。

看起来问题可能与\CJKsymbol包装有关xeCJK有没有什么方法既能正确对齐罗马字符,又能使用垂直排版的 CJK 后备字符?

答案1

您的问题是您将\CJKsymbol和重新定义\CJKpunctsymbol\raise.35em\hbox{#1}。您完全丢失了包含字体回退代码的原始定义。

您需要在新定义中包含原始定义,如下所示:

\let\CJKsymbolOrig\CJKsymbol
\let\CJKpunctsymbolOrig\CJKpunctsymbol
\newcommand*\CJKmovesymbol[1]{\raise.35em\hbox{\CJKsymbolOrig{#1}}}
\newcommand*\CJKmovepunctsymbol[1]{\raise.35em\hbox{\CJKpunctsymbolOrig{#1}}}
\newcommand*\CJKmove{\punctstyle{plain}
  \let\CJKsymbol\CJKmovesymbol
  \let\CJKpunctsymbol\CJKmovepunctsymbol}

完整 MWE:

\documentclass[landscape,12pt,a4paper]{bxjsarticle}
\usepackage[a4paper]{geometry}
\usepackage{fontspec}
\usepackage[AutoFallBack=true]{xeCJK}
\usepackage{zxjatype}
\usepackage{flowfram}

%command borrowed from the aforementioned post to properly align roman characters with chinese characters:
\let\CJKsymbolOrig\CJKsymbol
\let\CJKpunctsymbolOrig\CJKpunctsymbol
\newcommand*\CJKmovesymbol[1]{\raise.35em\hbox{\CJKsymbolOrig{#1}}}
\newcommand*\CJKmovepunctsymbol[1]{\raise.35em\hbox{\CJKpunctsymbolOrig{#1}}}
\newcommand*\CJKmove{\punctstyle{plain}
  \let\CJKsymbol\CJKmovesymbol
  \let\CJKpunctsymbol\CJKmovepunctsymbol}

%font settings:
\setmainfont{Linux Libertine O}
\setCJKmainfont[Scale=MatchLowercase,Mapping=tex-text,RawFeature={vertical}]{Kozuka Mincho Pro L}
\setCJKfallbackfamilyfont{rm}[Script=CJK,RawFeature={vertical}]{SimSun}

%settings for a 90-degree rotated "flowframe" to enable vertical typesetting
\newflowframe{\textheight}{\textwidth+2em}{0pt}{\textheight}[mainframe] 
\setflowframe{1}{angle=-90} 

\begin{document}

% This next line appears to be the problem: It seems to be needed to enable the command created above, but seems to prevent the CJK fonts from "falling back" properly
\CJKmove

\begin{quote}
別說則慢有八種。此屬增上。真出假位現種種形調伏眾生。故名大慢。大經三十云。菩薩若見眾<the character 眾 doesn't display but the character 衆 does 生有憍慢者。
\end{quote}
\end{document}

在此处输入图片描述

相关内容