[XeTeX] zhspacing: definition of font

Yin Dian yindian at gmail.com
Thu Jan 17 02:40:46 CET 2008


Hello Wilfred,

On 1/17/08, Wilfred van Rooijen <wvanrooijen at yahoo.com> wrote:
> Hello Yin Dian,
>
> I've compiled xetex 0.997 and I am trying to use
> zhspacing.sty. By default, zhspacing has a \zhfont
> defined, but this font is not on my system, so it
> doesn't work. I have TeXLive 2007, there is at least
> one Japanese font available but I don't know about the
> Chinese font. What is the cleanest way of avoiding
> this missing font? I use a \fontspec[]{Kozuka Mincho
> Pro-VI} in the main document anyway.

The cleanest way is to define the macro \zhfont and \zhpunctfont
before you load the package. For example, say
\newfontfamily\zhfont{foo} etc before \usepackage{zhspacing}.

There's no need to change the main text font using \fontspec etc.
Zhspacing preserves the font for western characters, and uses \zhfont
etc only for Chinese.

>
> Observation: the package nruby.sty also works WITHOUT
> zhspacing, after I applied your patch, so thank you.
>
> Observation: Linebreaking in vertical mode WITHOUT
> zhspacing does not look pretty (in fact, I have to use

Maybe you should set \XeTeXlinebreakskip to have larger stretchability.

> a minipage inside the rotatebox to get any
> linebreaking going at all, even with
> \XeTeXlinebreaklocale="zh"). Will zhspacing improve
> the situation?

When using zhspacing, certain hskips are inserted between Chinese
characters, and punctuation prohibitions are concerned; it should
generate good result.

>
> Thanks,
> Wilfred
>
> Note: I have some Chinese otf fonts available, but
> apparently your package wants a font in \zhfont
> (NFSS?).

Yes. \zhfont is called every time the text changes to Chinese. There's
some description in the simple document.

HTH.

-Yin Dian
>
> --- Yin Dian <yindian at gmail.com> wrote:
>
> > Hi,
> >
> > On Jan 10, 2008 9:50 AM, Wilfred van Rooijen
> > <wvanrooijen at yahoo.com> wrote:
> > > Hello all,
> > >
> > > I am a new addition to the XeTeX list.
> > >
> > > A couple of weeks ago a discussion started on the
> > > Dutch latex user group about setting Japanese with
> > > latex. Since I consider learning and reading
> > Japanese
> > > a hobby, the discussion was interesting for me.
> > >
> > > In 2002 I had the pleasure of working in Japan for
> > a
> > > while. I had to write a paper for a conference, in
> > > Latex with Japanese. At that time I used ptex, the
> > > 'patched' latex that is capable of reading EUC-JP
> > > input. This was teTeX 2.2 time, and I installed
> > > everything from scratch on Turbolinux. I remember
> > that
> > > it did work but especially the font trickery took
> > some
> > > time to get to work. Nowadays, I mainly use
> > OpenOffice
> > > to write Japanese (I have to write essays for my
> > > class).
> > >
> > > But being a latex afficionado I decided it was
> > time to
> > > research once and for all the possibilities of
> > > non-latin typesetting in Japanese. After some
> > > wikipedia'ing en several google sessions, I
> > understand
> > > the basics of character encodings etc.
> > >
> > > So I researched the latex options and came across
> > the
> > > usual suspects:
> > >
> > > - CJK packages. Seems to work well, full support
> > for
> > > ruby and associated tricks, many languages per
> > > document, but issues remain with character coding,
> > > preprocessors, and the need to explicitly switch
> > > between languages and fonts
> > There is a package xCJK, by Mr. Sun Wen-chang, which
> > allows you to use
> > the CJK package's way to handle CJK typesetting
> > issues, once you set
> > \XeTeXinputencoding to "bytes". Other CJK-dependent
> > packages such as
> > CJKpunct and ruby should work pretty well with it.
> > You can find xCJK
> > at this thread:
> > http://bbs.ctex.org/viewthread.php?tid=40232
> > (register
> > required to download).
> > >
> > > - latex + UCS. Using the correct combination of
> > > inputenc and fontenc seems to work, but no line
> > breaks
> > > in CJK for instance, and very minimal
> > documentation.
> > > Also availability of fonts is an issue. CJK
> > limited to
> > > one character set per document.
> > >
> > > - Omega/lambda + j-omega + dvipdfmx. Some
> > non-trivial
> > > patches are needed to work correctly, but once it
> > > works unicode input is straightforward. Again,
> > some
> > > issues with fonts remain, and there is no special
> > > support for CJK typesetting. But: no longer
> > developed
> > >
> > > - Hans Hagen pointed me to XeTeX, and after some
> > > browsing in my texlive I am now able to use it. I
> > have
> > > installed a bunch of Japanese ttf-files in my home
> > dir
> > > and it works pretty well. It is definitely the
> > best
> > > solution to typeset unicode input in a
> > straightforward
> > > manner to a pdf.
> > >
> > > So the question is: are there any CJK goodies for
> > > XeTeX yet, like \ruby or so? Also, it seems to me
> > that
> > The nruby.sty requires little change to work with
> > XeTeX and zhspacing
> > (a package for typesetting Chinese). Here's the
> > patch.
> > --- nruby.sty~  1994-02-12 23:00:00.000000000 +0800
> > +++ nruby.sty   2008-01-10 16:32:05.000000000 +0800
> > @@ -69,7 +69,7 @@
> >  \def\bx at sparse[#1]#2{\hbox to#1{\op at sparse{#2}}}
> >  \def\op at sparse#1{\sparse at skip%
> >   \@ifundefined{jintercharskip}{%
> > - \kanjiskip=0pt plus 1fil\xkanjiskip=\kanjiskip
> > #1}{%
> > + \def\skipzh{\hskip 0pt plus
> > 1fil}\let\skipenzh=\skipzh #1}{%
> >   \jintercharskip=0pt plus
> > 1fil\jasciikanjiskip=\jintercharskip
> >  #1}\sparse at skip}
> >  %
> >
> > > support for vertical typesetting is necessary. I
> > don't
> > > think the 'trick' of rotating the characters and
> > then
> > > rotating a box on the page will always give a good
> > > result (「 and 」could pose problems).
> > Rotating really works. The punctuation change
> > requires the font in use
> > to support Opentype feature +valt or +vhal. A
> > typical font setting is
> > as follows:
> >
> \newfontfamily\myfont[RawFeature={vertical:+vert:+vhal}]{font
> > name}
> > > What about punctuation symbols in the margin? And
> > how
> > > about kerning? Is that handled by the font itself?
> > If the font support Opentype feature +halt and you
> > do want to use
> > halfwidth punctuations, then there's nothing more
> > needed than applying
> > the feature. However, if your font doesn't have
> > halfwith alternatives
> > or you want to use fullwidth punctuations, then
> > something special
> > should be done to deal with the inter-char tokens
> > between punctuations
> > and other characters etc. You can refer to
> > zhspacing, which already
> > solved the problem for Chinese typesetting. (XeTeX
> > 0.997 in
> > development is required to utilize the inter-char
> > token feature.)
> > >
> > > I'd be happy to help if I can contribute anything.
> > That's great. Always welcome:)
> >
> > My package zhspacing currently doesn't deal with
> > fonts or
> > prohibitions(kinsoku) for Japanese kanas, so it may
> > not be suitable
> > for Japanese typesetting. There is a package
> > jspacing for dealing with
> > Japanese in XeTeX, but it seems that it's not open
> > to public for
> > download and I couldn't get it.
> > >
> > > Regards,
> > > Wilfred van Rooijen
> > >
> > Regards.
> >
> > -YIN Dian
> > _______________________________________________
> > XeTeX mailing list
> > postmaster at tug.org
> > http://tug.org/mailman/listinfo/xetex
> >
>
>
>
>      ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
> _______________________________________________
> XeTeX mailing list
> postmaster at tug.org
> http://tug.org/mailman/listinfo/xetex
>


More information about the XeTeX mailing list