[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] editing chinese?
From: |
Werner LEMBERG |
Subject: |
Re: [Groff] editing chinese? |
Date: |
Sat, 10 Mar 2012 17:20:24 +0100 (CET) |
> For grodvi, support is possible too, I think (using e.g. my gbsn
> subfonts from TeXLive, called `gbsnuXX{.pfb,.afm}', with `XX' two
> hexadecimal digits, and registering all those fonts with groff's
> `.special' request), but I haven't tested it.
I couldn't resist to implement this :-)
0. Create a working subdirectory and change into it.
1. Call the attached script `make-dvimapfiles'. It creates 256 files
`mapXX' to be used as map files for tfmtodit. This is far from
perfect since it always uses the `uXXXX' notation, but for CJK
characters this is just fine.
2. From TeXLive, copy the CJK subfont TFM files for Unicode encoding,
for example `gbsnuXX.tfm'.
3. Call the attached script `make-ditfiles' to create the groff font
description files. If a TFM subfont file is called `fooXX.tfm',
the corresponding dit file is called `fooXX'.
Install these files to your favourite `font/devdvi' directory.
4. Call the attached script `make-tmac' to generate a macro file. It
defines a single command to activate the CJK font; use this instead
of issuing a `\f[...]' command.
5. The `mapXX' and TFM files can now be deleted since they are no
longer used.
Doing the above for the gbsn font, I get the attached output. The
calling sequence was
groff -Tdvi -k -ww chinese-test-dvi > chinese-test-dvi.dvi
dvipdfmx chinese-test-dvi
Werner
for ((i=0; i<256; i++)); do
printf -v f "map%02x" $i
rm -f $f
for ((j=0; j<256; j++)); do
printf "%d u%02X%02X\n" $j $i $j >> $f
done
done
for i in *.tfm; do
mapfile=`echo $i | sed -e 's/.*\(..\)\.tfm$/map\1/'`
fontfile=`echo $i | sed -e 's/\.tfm$//'`
echo $fontfile
tfmtodit $i $mapfile $fontfile
done
.so gbsnu.tmac
.gbsnu
This is a test of Chinese in groff.
Some phrases:
你 家 有 几 口 人 ?
.br
你们 学校 有 多少 学生 ?
.br
我 想 , 大概 有 三 万 个 .
.br
老板 让 我 去 那里 工作 .
The end.
chinese-test-dvi.pdf
Description: Adobe PDF document