gbranden pushed a commit to branch master
in repository groff.

commit 213742068f1521b93c81b223786e345e17460b7f
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Mar 20 20:16:40 2024 -0500

    tmac/{ja,ru,zh}.tmac: Warn when font inadequate.
    
    * tmac/{ja,ru,zh}.tmac: Add heuristic checks for glyph coverage of
      characteristic code points for these languages' scripts.  Throw the
      warning only once for each language.  The formatter will merrily spew
      "special character ... not defined" error diagnostics for each
      non-covered glyph encountered; this leads people to complain that
      "groff doesn't support Unicode".  (This additional warning diagnostic
      might not help much; the error diagnostics already refer to characters
      in these scripts _by their Unicode code points_, which should be a
      clue, but too often isn't.)  And this one will slip through even if
      someone runs groff (or troff) with the `-E` option.  If you want to
      typeset Unicode, you have to use a font that covers Unicode.  groff
      can't force one onto your system.  (We could do more to help the user
      configure one for use with groff, though; see Savannah #60930.)
    
    * src/roff/groff/tests/initialization_is_quiet.sh: Update test; check
      the "utf8" output device, not the "ps" default (which might not have
      been the configured default anyway), and which will lack glyph
      coverage for Chinese and Japanese (as the base 14 fonts of Adobe
      PostScript lacked it).
---
 ChangeLog                                       | 23 +++++++++++++++++++++++
 src/roff/groff/tests/initialization_is_quiet.sh |  6 ++++--
 tmac/ja.tmac                                    |  9 +++++++++
 tmac/ru.tmac                                    |  9 +++++++++
 tmac/zh.tmac                                    |  9 +++++++++
 5 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d5fc4d97f..08148000f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2024-03-20  G. Branden Robinson <[email protected]>
+
+       * tmac/{ja,ru,zh}.tmac: Add heuristic checks for glyph coverage
+       of characteristic code points for these languages' scripts.
+       Throw the warning only once for each language.  The formatter
+       will merrily spew "special character ... not defined" error
+       diagnostics for each non-covered glyph encountered; this leads
+       people to complain that "groff doesn't support Unicode".  (This
+       additional warning diagnostic might not help much; the error
+       diagnostics already refer to characters in these scripts _by
+       their Unicode code points_, which should be a clue, but too
+       often isn't.)  And this one will slip through even if someone
+       runs groff (or troff) with the `-E` option.  If you want to
+       typeset Unicode, you have to use a font that covers Unicode.
+       groff can't force one onto your system.  (We could do more to
+       help the user configure one for use with groff, though; see
+       Savannah #60930.)
+       * src/roff/groff/tests/initialization_is_quiet.sh: Update test;
+       check the "utf8" output device, not the "ps" default (which
+       might not have been the configured default anyway), and which
+       will lack glyph coverage for Chinese and Japanese (as the base
+       14 fonts of Adobe PostScript lacked it).
+
 2024-03-20  G. Branden Robinson <[email protected]>
 
        * tmac/an.tmac (an-reset-paragraph-spacing, RS, RE): Trivially
diff --git a/src/roff/groff/tests/initialization_is_quiet.sh 
b/src/roff/groff/tests/initialization_is_quiet.sh
index 38ac81ffc..46c847c54 100755
--- a/src/roff/groff/tests/initialization_is_quiet.sh
+++ b/src/roff/groff/tests/initialization_is_quiet.sh
@@ -46,8 +46,10 @@ do
   for locale in cs de en fr it ja sv zh
   do
     echo testing \"-m $locale$compat\" >&2
-    output=$("$groff" -ww -m $locale$compat -a </dev/null 2>/dev/null)
-    error=$("$groff" -ww -m $locale$compat -z </dev/null 2>&1)
+    output=$("$groff" -ww -m $locale$compat -a -Tutf8 </dev/null \
+        2>/dev/null)
+    error=$("$groff" -ww -m $locale$compat -z -Tutf8 </dev/null \
+        >/dev/null 2>&1)
     test -n "$error" && echo "$error"
     test -n "$output" && echo "$output"
     test -n "$error$output" && wail
diff --git a/tmac/ja.tmac b/tmac/ja.tmac
index bce125542..07dc01494 100644
--- a/tmac/ja.tmac
+++ b/tmac/ja.tmac
@@ -55,6 +55,15 @@
 .hydefault 0
 .hy
 .
+.\" Check (heuristically) for output device coverage of Japanese script.
+.if !r \*[locale]*device-checked-for-glyph-coverage \{\
+.  if !c \[u65E5] \{\
+.    tm \*[locale].tmac: warning: font \n[.fn] may lack coverage of \
+Japanese script
+.    nr \*[locale]*device-checked-for-glyph-coverage 1
+.  \}
+.\}
+.
 .cp \n[*groff_ja_tmac_C]
 .do rr *groff_ja_tmac_C
 .
diff --git a/tmac/ru.tmac b/tmac/ru.tmac
index 1d33809b1..2914072ed 100644
--- a/tmac/ru.tmac
+++ b/tmac/ru.tmac
@@ -173,6 +173,15 @@
 .
 .rr locale*use-trap-hyphenation-mode
 .
+.\" Check (heuristically) for output device coverage of Cyrillic script.
+.if !r \*[locale]*device-checked-for-glyph-coverage \{\
+.  if !c \[u0410] \{\
+.    tm \*[locale].tmac: warning: font \n[.fn] may lack coverage of \
+Cyrillic script
+.    nr \*[locale]*device-checked-for-glyph-coverage 1
+.  \}
+.\}
+.
 .hcode � �  � �
 .hcode � �  � �
 .hcode � �  � �
diff --git a/tmac/zh.tmac b/tmac/zh.tmac
index 5285a3dc4..6ff4a4262 100644
--- a/tmac/zh.tmac
+++ b/tmac/zh.tmac
@@ -54,6 +54,15 @@
 .hydefault 0
 .hy
 .
+.\" Check (heuristically) for output device coverage of Chinese script.
+.if !r \*[locale]*device-checked-for-glyph-coverage \{\
+.  if !c \[u7684] \{\
+.    tm \*[locale].tmac: warning: font \n[.fn] may lack coverage of \
+Chinese script
+.    nr \*[locale]*device-checked-for-glyph-coverage 1
+.  \}
+.\}
+.
 .cp \n[*groff_zh_tmac_C]
 .do rr *groff_zh_tmac_C
 .

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to