groff
[Top][All Lists]
Advanced

[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 15:36:37 +0100 (CET)

Erich,


sorry for the late reply.

> Are there chances to generate dvi, ps, pdf output with groff, using
> afmtodit or tfmtodit or so?

At least PS output works just fine; the normal steps given in the
`grops' manpage are valid, see below.  groff's PDF output device
doesn't work; I suspect a bug (or it isn't implemented yet).  However,
calling ghostscript's `ps2pdf' is OK -- since grops doesn't do font
subsetting, this step is almost mandatory since it reduces the file
size enormously.

I did the following to install `gbsn00lp.ttf', a Chinese font covering
the GB 2312 character set.

1. Call

     fontforge gbsn00lp.ttf

   to generate a `Type42' font (menu `File', then `Generate Fonts').

     Output file: BousungEG-Light-GB.t42

2. Generate a `PS Type 1 binary' font; under `Options', select `Output AFM'.

     Output file: BousungEG-Light-GB.afm

   The also generated file `BousungEG-Light-GB.pfb' is not used and can be
   deleted.

3. Copy the file `textmap' from groff's `font/devps/generate' directory to
   the current directory.

4. Call

     afmtodit BousungEG-Light-GB.afm textmap gbsn

   to generate a groff font description file `gbsn'.

5. Move the files

     BousungEG-Light-GB.t42
     gbsn

   into a groff font directory, for example

     /usr/local/share/groff/site-font/font/devps

   (see the troff(1) man page, environment variable `GROFF_FONT_PATH',  for
   the default search path on your machine).

6. Currently, groff reads a single `download' file only; a typical location
   is for example

     /usr/local/share/groff/current/font/devps/download

   Append the following line to this file:

     BousungEG-Light-GB      BousungEG-Light-GB.t42

7. The UTF-8 encoded example file has been processed with

     groff -k -ww chinese-test > chinese-test.ps
     ps2pdf chinese-test.ps

   Note that I had problems with ghostscript 9.00 and 9.04.  However, a
   self-compiled version 9.05 worked just fine.

Attached is a sample output.

For special handling of CJK punctuation characters, have a look into
groff's `ja.tmac' file; it should be easy to adapt this to Chinese.
Due to missing inter-character spacing support in groff, real CJK
typesetting isn't possible if you want justified text.

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.


    Werner

Attachment: chinese-test.pdf
Description: Adobe PDF document

This is a test of Chinese in groff.

Some phrases:

\f[gbsn]\
你 家 有 几 口 人 ?
.br
你们 学校 有 多少 学生 ?
.br
我 想 , 大概 有 三 万 个 .
.br
老板 让 我 去 那里 工作 .

\fP\
The end.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]