[XeTeX] bopomofo ruby characters

Jonathan Kew jonathan_kew at sil.org
Mon Apr 7 22:01:29 CEST 2008

On 7 Apr 2008, at 6:53 pm, Ján Zahornadský wrote:

> Hello everyone!
> First, thanks for being such a great community!
> Now I'm in a problem of attaching a bopomofo pronunciation hints into
> Chinese characters. I've found Wang fonts, which have these as a  
> part of
> a glyph, but due to multiple readings of the characters it's necessary
> to switch between these fonts, often not having idea which fonts  
> carries
> which reading.
> The second approach I tried is to write a command to attach those
> symbols to a character. As I'm pretty unskilled in (Xe)LaTeX, my  
> code so
> far looks like this (for 綽/ㄔㄨㄛˋ character):
> \fontsize{36}{36}\ming\fbox{綽\kern 8pt\raise 28pt\hbox{%
> \fontsize{12}{12}%
> \fontspec[RawFeature={vertical:}]{Ming(for ISO10646)}%
> \rotatebox{270}{\raise 1pt\hbox{\makebox[32pt]{\hfil ㄔㄨㄛ 
> {\kern-16pt\
> lower-7pt\hbox{ˋ}}\hfil}}}%
> }\kern -4pt}

I don't have the same fonts as you, but here's a version of an \annot  
macro that seems to work OK for me; you can just change font names in  
the test doc to match your setup. A couple of points to note here:

- I've used "em" rather than absolute "pt" units in the \annot macro  
so that it will scale to whatever text size you're using. You can of  
course adjust the various dimensions to fine-tune the results, but it  
looks pretty reasonable to my (ignorant) eye.

- It's very inefficient to use \fontspec{....} repeatedly for a  
typeface that you use frequently; better to use \newfontfamily to  
declare it ahead of time.

- The use of \addfontfeature here is also inefficient, but was  
simpler than using \newfontfamily to declare a vertical variant of  
each font, so I took the easy way out.

For more Chinese support, Google for the zhspacing package. I've also  
seen a reference to something called xeCJK, but don't know anything  
about it (the pages I saw were in Chinese, which I don't understand  
beyond a handful of words).



% - - - - - - - - - - - - - - - -










% - - - - - - - - - - - - - - - -

More information about the XeTeX mailing list