[NTG-context] Chinese in utf-8

Hans Hagen pragma at wxs.nl
Mon Oct 10 22:35:00 CEST 2005


Radhelorn wrote:

> Duncan Hothersall wrote:
>
>> Hi all.
>>
>> I have ConTeXt set up to output Chinese using usemodule[chinese], all
>> fonts, encodings and maps are installed and the sample file works well.
>>
>> Now I have a whole load of Chinese text in utf-8 encoding. Can ConTeXt
>> process this, or do I have to convert it to another encoding? I tried
>> \enableregime[utf] and \useencoding[uc] but it just produced black blobs
>> instead of Chinese characters.
>>
>> I hope ConTeXt can do it? :-)
>>
>> Thanks,
>>
>> Duncan
>
>
> Please post output of texexec command. Maybe ConTeXt fails to find 
> some files?

that's tricky. the utf handler assumes named glyphs and noone named the 5000 chinese ones so far 

(some day pdftex will be unicode award so then problems will disappear) 

in the current utf handling mechanism i can envision something: 

- the utf code results in an expansion of the vector 
- instead of using a named glyph, we use a trick

some variant on: 

\startunicodevector chinese_unicode_page_number_1    
  getglyph{ChineseFont1}{#1}%
\stopunicodevector

or probably due to some used trickery (untested) something like the following (not sure, best make a new command): 

\startunicodevector chinese_unicode_page_number_1    
  getglyph\endcsname{ChineseFont1}{#1}\gobbleoneargument 
\stopunicodevector

so, then you only need to define the right fonts i.e. 

\definefont[ChineseFont1][whateverchinesefont_1]

which has the right glyphs in the right slots 

so ... it's actually simple, once you have the fonts split up 

probably the getgyph needs to be replaced by a more clever one that handles special chinese thingies, 

another option is to write another mapper analogue to the ones already there for chinese, i.e. is there some mapping from utf to big5 or so and  hook that into the utf handler. 

(beware, the font-chi modules talk about unicode while actually it's about dedicated mapings resembling a unicode approach; this \defineucharmapping stuff) 

Hans 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------



More information about the ntg-context mailing list