[XeTeX] ZHSPACING - Newbie questions

Yin Dian yindian at gmail.com
Sat Nov 3 13:42:06 CET 2007


Hi,

The first problem is caused by the character class setting for the
Unicode left/right quotes, which are CJK ambiguous characters. By
default zhspacing treat them as fullwidth like the fullwidth
parentheses whose character classes are assigned to 2 and 3, and use
\zhpunct font to type them out. So they become wide, as in common
Chinese articles. You can avoid this by changing their classes as
follows,

   \XeTeXcharclass`"=6
   \XeTeXcharclass`"=6
   \XeTeXcharclass`'=6
   \XeTeXcharclass`'=6
(In zhspacing class 6 is used for halfwidth punctuations.)

In this way the quotes use the same font as the English text, appearing narrow.

As for the second problem, it seems to me that you aren't using the
right way in specifying the Chinese font. You should change the macro
\zhfont, rather than executing other font commands, which would change
the font for the English text, but theoretically takes no effect on
Chinese, because the macro \zhfont is called when switching to Chinese
text. So I suggest you change the definition to something like this:

\newcommand{\CJKTitle}[1]{
			\parbox{1cm}{\huge{\let\zhfont\zhsffont #1}}
	}

However, as you are using \parbox{1cm} to put one character per line,
you don't need to use the Vertical feature of fontspec. Just remove
it. This generates the desired output on my machine. HTH.

Regards

-YIN Dian

On 11/3/07, arnen at shentang.net <arnen at shentang.net> wrote:
> Hi all !
>
> I have been using XeTex to reformat some chinese medical texts that I
> had originally done in Framemaker (Mac). These contain a mix of
> english, pinyin and hanzi.
> A long time ago I looked at Tex but it was not practical to sort out
> CJK vs Omega vs etc. XeTex rules.
>
> The current setup is TexLive 2007:
>        XeTeX 3.141592-2.2-0.997 (Web2C 7.5.6)
>        kpathsea version 3.5.6
>        Compiled with ICU version 3.6 [with modifications for XeTeX]
>        Compiled with zlib version 1.2.3; using 1.2.3
>        Compiled with FreeType2 version 2.3.5; using 2.3.5
>        Using Mac OS X Carbon, Cocoa & QuickTime frameworks
>
> I have been having a few hassles that I haven't been able to sort out.
>
> (The mail reader I am using (Eudora Mac) doesn't yet support UTF so I
> will also attach examples.)
>
> 1. Apostrophes & quotes seem to have too much white space. Initially
> this seemed to be due to using one font eg. STSong, to cover the
> hanzi and diacritics.
>
> Looking through the posts I tried  \lccode"2019="0027 but this made
> no difference.
>
> Using zhspacing made some improvement as I could use other fonts
> however it introduced it's own problem with the apostrophe.
>
> test.tex follows:
>
> %%%%%%%%%%%%%%
> %!TEX TS-program = xelatex -output-driver="xdvipdfmx -v"
> %!TEX encoding = UTF-8 Unicode
>
> \documentclass[12pt]{book}
> \usepackage{fontspec,xltxtra,xunicode}
>
> \defaultfontfeatures{Mapping=tex-text}
> \setmainfont{Times New Roman}
>
> % Un/Comment the following:
> %\newfontfamily\zhfont{Apple LiSung} % Have to declare as don't have SimHei
> %\usepackage{zhspacing}
> %\zhspacing
>
> \begin{document}
> `It's hard to 'say' if ``it'' doesn't like "fancy quotes".'
>
> \fontspec{STSong}
>
> `It's hard to 'say' if ``it'' doesn't like "fancy quotes".'
>
> \end{document}
> %%%%%%%%%%%%%%
>
> I could just replace all right quotes with ' and rely on the Tex
> mapping but part of the exercise has been to get everything into
> Unicode.
>
> 2. I also seem to be having difficulties in getting grey text when
> using zhspacing.
> Originally I had grey vertical text for chapter titles eg.:
>
> (Extract from test2.tex)
>
> %%%%%%%%%%%%%%
> \newcommand{\myvertical}[1]{
>        \rotatebox{-90}{
>        \fontspec[Renderer=AAT,Vertical=RotatedGlyphs,Color=888888]{Hiragino
> Mincho Pro}#1}
>        }
>
> \newcommand{\CJKTitle}[1]{
>        \parbox{1cm}{\huge{\myvertical{#1}}}
>        }
>
> ...........
>
> \chapter[     Eight Principles and Causes of Disease]{
>        \CJKTitle{    } etc.
> %%%%%%%%%%%%%%
>
> If I enable I enable zhspacing  and delete the \rotatebox I get the
> vertical text but lose the grey colour.
>
>
> --
> Arnen
>
>
> Alcohol and calculus don't mix; don't drink and derive.
> _______________________________________________
> XeTeX mailing list
> postmaster at tug.org
> http://tug.org/mailman/listinfo/xetex
>
>
>


More information about the XeTeX mailing list