Hello all,

This is my first message to the list. I've been using ConTeXt for a few
months now, and so far it does everything I want to do with it, plus much
and much more!

Recently, I've made the 'unwise' decision to start studying Japanese next
year, and of course I want to keep on using ConTeXt to write my school
papers. I am already able to create Japanese documents using a terrific
Japanese TeX distribution (w32tex) and pLaTeX, but everyone on this
mailinglists knows that LaTeX is kinda 'weird' (to put it mildly) when you
are used to the beauty that is ConTexT! :-)  So I decided to find a way to
write Japanese in ConTeXt.

First I tried using the eOmega/ConTeXt combination since I have some great
OTPs for it, but soon found out that Omega is still "the TeX of the future",
in other words, not the "TeX of today" and extremely unstable.

Then I decided to try ConTeXt's UTF-8 support. I created the following test
file:
--------------
\chardef\utfunihashmode=1

\setupunicodefont
  [japanese]
  [scale=1.0]

\definefontsynonym [JapaneseMinchoRegular][cyberb]
\defineunicodefont [Mincho][JapaneseMincho][japanese]

\Mincho \enableregime[utf]

\starttext
...
<Imagine a bunch of UTF-8 encoded Japanese characters here>
...
\stoptext
--------------
cyberb is the Unicode font cyberbit.ttf which I installed using ttf2tfm:
ttf2tfm cyberbit.ttf [EMAIL PROTECTED]@

For output I use dvipdfmx with the following line added to the map file:
[EMAIL PROTECTED]@              Identity-H      :0:cyberbit.ttf

Well, to my big surprise, it worked! I saw the characters without a problem.
Using the 'scale' option of \setupunicodefont I could also change the size
of the characters. Great!

But since there are usually no spaces in a Japanese sentence, there is no
line breaking. And as you can imagine, line breaking is a useful feature to
have! :-)

I imagined that the line breaking problem is also happening when someone
wants to write Chinese, so I decided to take a look in ConTeXt's Chinese
module to see how it is handled there.

I saw that the Chinese module adds an interglyph space after a character,
which is breakable by TeX. This happens in a macro that is (indirectly)
called using \setupunicodefont and the 'command' option. I decided to try
the same in my test file. But first, I checked to see if using the 'command'
option in \setupunicodefont actually worked:

I added the following macro:

\def\HandleJapaneseGlyph
  {\insertunicodeglyph}

And changed my \setupunicodefont into:

\setupunicodefont
  [japanese]
  [scale=1.0,
  command=\HandleJapaneseGlyph]

Well, I still get Japanese characters like normal. I imagined that if I
removed \insertunicodeglyph from my macro, I wouldn't get to see them. But
this is not the case. I found out that I can do anything in my macro, but it
doesn't have an effect on the Japanese characters. They still get printed. I
also found out that I can even use command=\whateveryoulike and it still
wouldn't complain that such a macro doesn't exist. I get the feeling that
the command option is completely ignored. Apparently, my idea isn't going to
work. :-(

To make a long story even longer, I would like to know why it doesn't work,
or what I should do in order to make it work. What is the correct method to
divert the Unicode character output to another macro so that I can add a
breakable space after each character?

Well, I've been using ConTeXt for only a few months now, so maybe the
complexity of this is way over my head. At least it kept me busy! But on the
other hand, I don't think writing Japanese is much more different than
writing Chinese. It must be possible to achieve without much trouble or
reinventing the wheel.

Thanks for listening,
Tim



_______________________________________________
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to