Re: [NTG-context] Chinese in utf-8

2005-10-16 Thread Lutz Haseloff
Hi Duncan,



Duncan Hothersall schrieb:
> 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


i prepared a small perl script to convert chinese utf-8 encoded
tex-files to gbk coded tex-files. I call it right
before using texexec.pl to create a pdf from the resulting
tex-file. It has the advantage that you can use both simplified
and traditional characters in one file, if you have full gbk
enabled font files. (all chinese ht*.ttf)
You can easy see all chinese characters on the screen with any
unicode enabled Editor (Scite)

Here you are:

utf82gbk.pl

-

#!/usr\bin\perl -w

use strict;
use utf8;
use Encode::HanConvert;

our ($filename, $recoded);

$filename = $ARGV[0];
$filename=~ s/\.tex$//io ;
if (open(INP,"<:utf8","$filename.tex"))
 {
   print "processing file $filename.tex\n" ;
   $/ = "\0777" ;
   $_ =  ;
   close(INP) ;
simp_to_gb($_);
use bytes;
if ((open(OUT,">","$filename-gbk.tex")))
 { print OUT $_ ;
   close(OUT) ;
   }
   }
   else
 { print "invalid filename\n" }
if (-e "$filename-gbk.tex") {print "created file $filename-gbk.tex\n"}

sub unirecode
  { my ($a,$b) = @_ ;
if ((ord($b)<0x80)&&($b !~ /[a-zA-Z0-9]/))
  { print "$b" ; ++$recoded ;
return "\\uc\{" . ord($a) . "\}\{". ord($b) . "\}" }
else
  { return "$a$b" } }

if (open(INP,"$filename-gbk.tex"))
 { $recoded  = 0 ;
   print "processing file $filename-gbk.tex " ;
   $/ = "\0777" ;
   $_ =  ;
   close(INP) ;
   s/([\x80-\xFF])(.)/unirecode($1,$2)/mgoe ;
   if (($recoded)&&(open(OUT,">$filename.tmp")))
 {  print OUT $_ ;
close(OUT) ;
unlink "$filename-gbk.tex" ;
rename "$filename-gbk.tmp", "$filename-gbk.tex" ;
unlink "$filename-gbk.tmp" ;
}
   if ($recoded)
 { print " - $recoded glyphs recoded - original saved as
$filename-gbk.tec\n" }
   else
 { print "- no glyphs recoded\n" } }
   else
 { print "invalid filename\n" }


-
usage:
utf82tex filename.tex
texexec filename-gbk.tex

It's a combination of Hans Hagens tex2uc.pl wich converts
codes including tex related characters (\, {, } ...) into
\unicodeglyph commands and an easy utf-8 to gbk converter.
It needs the module Encode::HanConvert.

I created 2 new Menuentries in my Scite Editor.
"Create gbk texfile" wich creates filename-gbk.tex and
"Process gbk texfile" wich runs texexec on this new file.
It works for me very well.

I hope this helps a bit until pdftex can handle unicode.

Greetings from Potsdam, Germany

Lutz

P.S. Excuse my bad english
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] German ß

2005-10-16 Thread Mojca Miklavec
Wolfgang Zillig <[EMAIL PROTECTED]> wrote:
> Hello,
>
> i have some problems with an selfcreated typescriptfile. Until one of
> the last context-updates everythin works fine. The font I use is from
> the hfbright package (the hfbright package is a free version of the
> cmbright font) but when I created that typescript I did't relalize that
> a full font package was available and I renamed the fonts (therefore I
> will not provide that ugly typescript file here). I don't know what has
> changed but the german ß is not working any more. I use as font encoding
> ec and as regime win.
>
> I'm a bit confused where exactly my problem lies: either the encoding is
> wrong, but I do't know which one is right because in the latex package
> hfbright the encoding is called OT1. Has anyone an idea how to fix this
> problem or can anyone help me to set up a context module like the
> hfbright-module?
>
> Many thanks
>
> Wolfgang

Out of curiosity: what happens if you add the following line somewhere
after the definition of encoding and after font switching?

\definecharacter ssharp 25

Also try to test a word like "bi\ssharp chen" (this should prevent
problems with input regime).

If this works, it's necessary to add support for OT1 (if this is not
already default), see
http://source.contextgarden.net/enco-ec.tex for example.

Ec is not supposed to work properly (in LaTeX it's known under the
name T1), texnansi also has other character positions, but ssharp
could work there.

Mojca
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Modes for configuration

2005-10-16 Thread Willi Egger

Hi Alan,

This is simle to solve:

%\enablemode[screen]
\enablemode[print]
\envrionment yourenvironment

Important is to enable the required mode before loading the environment 
file. - Dit you know that you can select multiple modes e.g. you have a 
print-mode and the document should be created for
letter, A4 and A5. So you could define a letter-mode an A4-mode and an 
A5-mode.


In the document you can say

\enablemode[print,A4]
\envrionment yourenvironment

Hope that this helps

Willi

Alan Bowen wrote:

Following the example in the ConTeXt Wiki (http:// 
wiki.contextgarden.net/Modes) I have defined an environment file that  
specifies two modes (screen, print) for the production of the same  
source file. This works well when the appropriate texexec commands  
are given at the command line.


The problem is that I am trying to set  this production up for users  
who are happier with a GUI. Is there a way to do generate diverse  
outputs from the same source file without resorting to the command  
line? I have experimented with TeXShop—the users tend to works on Macs 
—but without success thus far.


Thanks for any suggestions.

Alan


___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


[NTG-context] German ß

2005-10-16 Thread Wolfgang Zillig


Hello,

i have some problems with an selfcreated typescriptfile. Until one of
the last context-updates everythin works fine. The font I use is from
the hfbright package (the hfbright package is a free version of the
cmbright font) but when I created that typescript I did't relalize that
a full font package was available and I renamed the fonts (therefore I
will not provide that ugly typescript file here). I don't know what has
changed but the german ß is not working any more. I use as font encoding
ec and as regime win.

I'm a bit confused where exactly my problem lies: either the encoding is
wrong, but I do't know which one is right because in the latex package
hfbright the encoding is called OT1. Has anyone an idea how to fix this
problem or can anyone help me to set up a context module like the
hfbright-module?

Many thanks

Wolfgang
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Getting icelandic letters (eth and thorn) to work.

2005-10-16 Thread Kári Hreinsson
Hello,

I installed teTeX manually following the instructions at
http://wiki.contextgarden.net/TeTeX_3.0_installation and this works
now!
It's strange though that such an old version of this software comes
with teTeX in the Ubuntu (debian) packages.

Anyhow, thanks for quick and good answers!

- Kári Hreinsson

On 10/15/05, Charles Doherty <[EMAIL PROTECTED]> wrote:
>
>
> On 15 Oct 2005, at 19:07, Kári Hreinsson wrote:
>
>
> Hello.
>
>
>
>
> I am trying to get the icelandic letters thorn (þ) and eth (ð) to work
>
> but nothing seems to do.  These letters work correctly in LaTeX and I
>
> am using ConTeXt and LaTeX from the TeTeX distribution.
>
> The file I currenty have is like this (It's in ISO 8859-1 encoding):
>
> Dear Kári,
>
> This works for me.
>
> \usetypescript[modern][ec]
> \setupbodyfont[10pt,rm]
>
> \enableregime[utf]
> \setupencoding[default=ec]
> \useencoding[ec]
>
> \starttext
> aábcdðeéfghiíjklmnoópqrstuúvxyzþæö
> AÁBCDÐEÉFGHIÍJKLMNOÓPQRSTUÚVXYZ\Thorn{}ÆÖ
> \stoptext
>
> Try that. I am using ConTeXt through the T2005 install by Gerben Wierda.
>
> Charlie
>
>
>
> ***
>
> Charles Doherty,
>
> Early Irish History,
>
> Room K113,
>
> School of History,
>
> John Henry Newman Building,
>
> University College Dublin,
>
> Belfield,
>
> Dublin 4
>
>
>
>
> Tel: +353 1 716 8381
>
>
> ___
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
>
>
>
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context