From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/12428 Path: main.gmane.org!not-for-mail From: "Tim 't Hart" Newsgroups: gmane.comp.tex.context Subject: Writing Japanese using ConTeXt Date: Sun, 8 Jun 2003 13:48:58 +0200 Sender: ntg-context-admin@ntg.nl Message-ID: <000001c32db3$f5e81750$0a01a8c0@TIMBO> Reply-To: ntg-context@ntg.nl NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: main.gmane.org 1055073071 21558 80.91.224.249 (8 Jun 2003 11:51:11 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 8 Jun 2003 11:51:11 +0000 (UTC) Original-X-From: ntg-context-admin@ntg.nl Sun Jun 08 13:51:09 2003 Return-path: Original-Received: from ref.vet.uu.nl ([131.211.172.13] helo=ref.ntg.nl) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19OyhZ-0005bQ-00 for ; Sun, 08 Jun 2003 13:51:09 +0200 Original-Received: from ref.ntg.nl (localhost.localdomain [127.0.0.1]) by ref.ntg.nl (Postfix) with ESMTP id 352E410B47; Sun, 8 Jun 2003 13:53:35 +0200 (MEST) Original-Received: from post-21.mail.nl.demon.net (post-21.mail.nl.demon.net [194.159.73.20]) by ref.ntg.nl (Postfix) with ESMTP id 24DB410ACE for ; Sun, 8 Jun 2003 13:49:05 +0200 (MEST) Original-Received: from [212.238.244.167] (helo=TIMBO) by post-21.mail.nl.demon.net with esmtp (Exim 3.36 #1) id 19OyfY-0000zV-00 for ntg-context@ntg.nl; Sun, 08 Jun 2003 11:49:04 +0000 Original-To: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Errors-To: ntg-context-admin@ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.0.13 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.comp.tex.context:12428 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:12428 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=3D1 \setupunicodefont [japanese] [scale=3D1.0] \definefontsynonym [JapaneseMinchoRegular][cyberb] \defineunicodefont [Mincho][JapaneseMincho][japanese] \Mincho \enableregime[utf] \starttext ... ... \stoptext -------------- cyberb is the Unicode font cyberbit.ttf which I installed using ttf2tfm: ttf2tfm cyberbit.ttf cyberb@Unicode@ For output I use dvipdfmx with the following line added to the map file: cyberb@Unicode@ 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=3D1.0, command=3D\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=3D\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