[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff] improved hpf request
From: |
Werner LEMBERG |
Subject: |
[Groff] improved hpf request |
Date: |
Fri, 22 Mar 2002 15:55:56 +0100 (CET) |
Dear friends,
as mentioned earlier on this list, distributing a modified version of
Knuth's `hyphen.tex' is a copyright violation. To fix this, I've
improved the `hpf' request to read many (but not all) of TeX's
hyphenation patterns unmodified. From groff_diff.7:
.hpf file
Read hyphenation patterns from file; this will be
searched for in the same way that name.tmac is
searched for when the -mname option is specified.
It should have the same format as (simple) TeX pat
terns files. More specifically, the following
scanning rules are implemented.
· A percent sign starts a comment (up to the
end of the line) even if preceded by a back
slash.
· No support for `digraphs' like \$.
· The only multi-character construction recog
nized is ^^xx (x is 0-9 or a-f); other use
of ^ causes an error.
· No macro expansion.
· hpf checks for the expression \patterns{...}
(possibly with whitespace before and after
the braces). Everything between the braces
is taken as hyphenation patterns. Conse
quently, { and } are not allowed in pat
terns.
· Similarly, \hyphenation{...} gives a list of
hyphenation exceptions.
· \endinput is recognized also.
· For backwards compatibility, if \patterns is
missing, the whole file is treated as a list
of hyphenation patterns (only recognizing
the % character as the start of a comment).
Use the hpfcode request to map the encoding used in
hyphenation patterns files to groff's input encod
ing.
The set of hyphenation patterns is associated with
the current language set by the hla request. The
hpf request is usually invoked by the troffrc file;
a second call replaces the old patterns with the
new ones.
And here the description of the new hpfcode request:
.hpfcode a b c d ...
After reading a hyphenation patterns file with the
hpf or hpfa request, convert all characters with
character code a in the recently read patterns to
character code b, character code c to d, etc. Ini
tially, all character codes map to themselves. The
arguments of hpfcode must be integers in the range
0 to 255. Note that it is even possible to use
character codes which are invalid in groff other
wise.
Here an example for Danish.
.hla dansk
.
.\" for the file dkspecial.tex
.hpfcode 88 230 \" X æ
.hpfcode 89 248 \" Y ø
.hpfcode 90 229 \" Z å
.
.hcode Æ æ æ æ
.hcode Ø ø ø ø
.hcode Å å å å
.
.hpf dkcommon.tex
.hpfa dkspecial.tex
.
.
.ll 1.3i
.hla us
The phrase \[lq]See also\[rq] means
.hla dansk
\[lq]Se også\[rq]
.hla us
in Danish.
The result with the latin1 device:
The phrase
"See also"
means "Se og
så" in Dan
ish.
Please test and enjoy!
Werner
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Groff] improved hpf request,
Werner LEMBERG <=