[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

devps/pdf, composite characters, and overstriking

From: G. Branden Robinson
Subject: devps/pdf, composite characters, and overstriking
Date: Sun, 9 May 2021 14:39:24 +1000
User-agent: NeoMutt/20180716

Hi folks,

I've contrived a solution to getting our gpinyin(1) man page to render
both to UTF-8 terminals and to PostScript and PDF.

One might assume that the problem was CJK characters, but it was not;
none are in the page.  The problem is with (relatively) ordinary
accented Latin characters.  The problematic ones seem to have committed
the grievous sin of not being in ISO Latin-1, so they don't show up in
Postscript or PDF.

Here's what I had to do (inlined and attached).  Comments below.

diff --git a/contrib/gpinyin/ b/contrib/gpinyin/
index 04fb4b37..f9e14a48 100644
--- a/contrib/gpinyin/
+++ b/contrib/gpinyin/
@@ -219,15 +219,20 @@ Some output devices will not be able to render every 
output example.
+.\" XXX: This is so gross.  Why can't grops and gropdf figure this out?
+.if t .ds a- \za\[a-]
+.if n .ds a- \[a a-]
+.if t .ds a< \za\[ah]
+.if n .ds a< \[a ah]
 .if t .ne 8 \" Try to keep the table on one page for printed output.
 l l l l l.
 Tone   Description     Diacritic       Example Input   Example Output
-first  flat    \[a-]   ma1     m\[u0061_0304]
-second rising  \[aa]   ma2     m\[u0061_0301]
-third  falling-rising  \[ah]   ma3     m\[u0061_030C]
-fourth falling \[ga]   ma4     m\[u0061_0300]
+first  flat    \[a-]   ma1     m\*[a-]
+second rising  \[aa]   ma2     m\[a aa]
+third  falling-rising  \[ah]   ma3     m\*[a<]
+fourth falling \[ga]   ma4     m\[a ga]
 fifth  neutral (none)  ma0     ma
 \^     \^      \^      ma5     \^

As you can see, I replaced Bernd's composite Unicode escapes with more
human-friendly composite special characters.

I can't just say \[a a-] or \[a ah]; if I do, it works fine for devutf8
but for devps (and devpdf) troff gets upset and prints nothing for the

$ ./build/test-groff -ww -t -man gpinyin.1 >|
troff: gpinyin.1:232: warning: can't find special character 'u0061_0304'
troff: gpinyin.1:234: warning: can't find special character 'u0061_030C'

If I tell the formatter to overstrike, it works fine on grops but, of
course, my non-overstriking terminal emulator shows me only the accent
mark instead.

What gives?  Why doesn't troff translate these composites into an
overstriking command itself?

(If any of the above special character syntax is unfamiliar, I recommend
a perusal of our recently revamped groff_char(7) man page.)


Attachment: signature.asc
Description: PGP signature

reply via email to

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