14

Is there a way to manually adjust the vertical position of a font using fontspec (in XeLaTeX)?

Such a feature would be quite useful when typesetting Asian text, since different font vendors often place Asian characters at different vertical positions.

1

1 Answer 1

7

I'm not sure if it is easy (and nessasary) to implement in fontspec. The wrong baseline position seems caused by current poor-designed (but almost all) Chinese fonts. However, I still want to know how other programs (like Microsoft Word) typeset Chinese vertical text properly. (But XeTeX cannot.)

Using xeCJK package (which should always used when typesetting Chinese through XeLaTeX), it is not difficult to fix the baseline of CJK symbols.

% coding:utf-8
\documentclass{article}

\usepackage{xeCJK}

\newfontlanguage{Chinese}{CHN}
\setCJKfamilyfont{songvert}% It is important to set these features
  [Script=CJK,Language=Chinese,Vertical=RotatedGlyphs]{SimSun}
\def\CJKmovesymbol#1{\raise.35em\hbox{#1}}
\def\CJKmove{\let\CJKsymbol\CJKmovesymbol
             \let\CJKpunctsymbol\CJKmovesymbol}

\begin{document}

\begin{tabular}{|ll|}
\hline
Original baseline:&
{\Huge\CJKfamily{songvert}文字 text 文字 text}\\
\hline
Fixed baseline:&
{\Huge\CJKmove\CJKfamily{songvert}文字 text 文字 text}\\
\hline
\end{tabular}

\end{document}

enter image description here

6
  • Thanks... I’m not performing vertical typesetting, though. What I’m trying to do is mix (serif and sans serif) fonts from different vendors, who place characters at distinct vertical positions (with regard to the base line). So are there font-specific versions of \CJKsymbol and \CJKpunctsymbol?
    – anon
    Commented Feb 24, 2011 at 5:53
  • No, \CJKsymbol and \CJKpunctsymbol works only for Chinese fonts. If you are trying to change the baseline of Chinese glyphs, it will work properly. And you may manually change different lengths of \raise for different Chinese fonts. However, it doesn't work for western fonts.
    – Leo Liu
    Commented Feb 24, 2011 at 10:09
  • What I was trying to say is, ... I have multiple Chinese fonts (for serif, sans, mono, resp.) from different vendors, which need distinct shift values; therefore I need a font-specific version \CJKsymbol and \CJKpunctsymbol. (我有若干個中文字體一起使用 (衬线体, 无衬线体, 等宽字体), 它们来自不同的制造商, 因此需要不同的纵向 shift 值; 所以我需要一个 专用於某一 (中文) 字体的 \CJKsymbol\CJKpunctsymbol。)
    – anon
    Commented Feb 24, 2011 at 10:36
  • I said 'no'. You must change the value manually, every time you change the font.
    – Leo Liu
    Commented Feb 24, 2011 at 11:31
  • But you can define a command to do it: \newcommand\foo{\CJKfamily{foo}\def\CJKsymbol{...}}
    – Leo Liu
    Commented Feb 24, 2011 at 11:34

You must log in to answer this question.