Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
看这条 bbs.ctex.org/… –  Leo Liu Feb 24 '11 at 4:24

1 Answer 1

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

share|improve this answer
    
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? –  JC Chu Feb 24 '11 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 Feb 24 '11 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。) –  JC Chu Feb 24 '11 at 10:36
    
I said 'no'. You must change the value manually, every time you change the font. –  Leo Liu Feb 24 '11 at 11:31
    
But you can define a command to do it: \newcommand\foo{\CJKfamily{foo}\def\CJKsymbol{...}} –  Leo Liu Feb 24 '11 at 11:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.