bugGNU roff - Bugs: bug #57524, [gpinyin] bad rendering for...

 
 

bug #57524: [gpinyin] bad rendering for "ü" and "Ü" with tone marks

Submitter:  Dave <barx>
Submitted:  Fri 03 Jan 2020 12:07:01 AM UTC
   
 
Category:  Preprocessor - others/general Severity:  3 - Normal
Item Group:  Rendering/Cosmetics Status:  None
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Open Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 02 Mar 2022 07:34:58 PM UTC, comment #4: 

I don't when I'll get back to this, but my proposed solution is sketched in comment #2 with example output.

G. Branden Robinson <gbranden>
Group administrator
Mon 10 May 2021 01:31:20 PM UTC, comment #3: 


commit a475f646d1458025666ac8aeedbd43ddb2017635
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Mon May 10 06:55:55 2021 +1000

    [gpinyin]: Fix erroneous case folding of "Ü".

    * contrib/gpinyin/subs.pl (vowel_t): Fix incorrect rendering of base
      glyph 'U', which was being forced to lowercase when a dieresis and
      tone mark were both being applied.  This caused the tone mark to
      overlap the dieresis, so decrease the font size of the base glyph even
      more to compensate.  The result is ugly but comprehensible.

    See <https://savannah.gnu.org/bugs/?57524>, partially mitigated but not
    completely resolved.


G. Branden Robinson <gbranden>
Group administrator
Sun 09 May 2021 07:41:48 PM UTC, comment #2: 

Generalized summary.  The problem isn't with any specific syllable, but for the u-with-dieresis vowel in general.

Further, the problem with the capital U-with-dieresis is worse than suboptimal--a flat-wrong base glyph is rendered, and even if you correct that the tone mark and dieresis collide to the point of unreadability.

The good news?

Typographically, I have a solution.  An example document is below.  I used gpinyin to generate it (after applying the patch in comment #1) and then hand-tuned it.  Blissfully, a pretty straightforward technique of using vertical motions to place the tone marks worked fine.  The vertical motions are different for uppercase and lowercase base glyphs, however.  Serendipitously, one is half of the other.

A complication arose: groff doesn't allow us to nest a \v vertical motion escape inside a \o overstriking sequence escape.[1]


troff: <standard input>:16: error: normal or special character expected (got a node)


However, groff does let us cheat: by defining our own special characters that embed vertical motions, we can sneak them in anyway.

So that's what I did.  As can be seen, the character definitions are highly schematic.  I reckon the fix here is to make gpinyin inject these .char definitions into the troff mode branch of its output, use them where necessary, and subsequently delete them with .rchar.

Here's the input document.  I'm attaching a screenshot as well.


.ta T 1i
.char \[a-_uc] \v'-0.3v'\[a-]\v'+0.3v'
.char \[a-_lc] \v'-0.15v'\[a-]\v'+0.15v'
.char \[aa_uc] \v'-0.3v'\[aa]\v'+0.3v'
.char \[aa_lc] \v'-0.15v'\[aa]\v'+0.15v'
.char \[ah_uc] \v'-0.3v'\[ah]\v'+0.3v'
.char \[ah_lc] \v'-0.15v'\[ah]\v'+0.15v'
.char \[ga_uc] \v'-0.3v'\[ga]\v'+0.3v'
.char \[ga_lc] \v'-0.15v'\[ga]\v'+0.15v'
GBR     BW
.br
L\o'\[:U]\[a-_uc]' l\o'\[:u]\[a-_lc]'   L\o'\s-2\[:U]\s0\[a-]' l\o'\s-2\[:u]\s0\[a-]'
.br
L\o'\[:U]\[aa_uc]' l\o'\[:u]\[aa_lc]'   L\o'\s-2\[:U]\s0\[aa]' l\o'\s-2\[:u]\s0\[aa]'
.br
L\o'\[:U]\[ah_uc]' l\o'\[:u]\[ah_lc]'   L\o'\s-2\[:U]\s0\[ah]' l\o'\s-2\[:u]\s0\[ah]'
.br
L\o'\[:U]\[ga_uc]' l\o'\[:u]\[ga_lc]'   L\o'\s-2\[:U]\s0\[ga]' l\o'\s-2\[:u]\s0\[ga]'
.br
.sp
BW:     Zu\['o]ti\o'a\[a-]'n w\o'o\[ah]' b\o'a\[a-]'ng n\o'\s-2\[:u]\s0\[ah]'\['e]r q\[`u] y\o'\[.i]\[a-]' ji\o'a\[a-]' cha\o'o\[a-]'sh\[`i] ma\o'\[.i]\[ah]' k\o'e\[ah]'l\[`e],
x\o'\[.i]\[a-]'f\[`a]n,
do\[`u]p\['i].
.br
GBR:    Zu\['o]ti\o'a\[a-]'n w\o'o\[ah]' b\o'a\[a-]'ng n\o'\[:u]\[ah_lc]'\['e]r q\[`u] y\o'\[.i]\[a-]' ji\o'a\[a-]' cha\o'o\[a-]'sh\[`i] ma\o'\[.i]\[ah]' k\o'e\[ah]'l\[`e],
x\o'\[.i]\[a-]'f\[`a]n,
do\[`u]p\['i].


[1] I haven't checked if this is a limitation of Heirloom Doctools troff, and I have no way to check typesetter output on Version 7 Unix (with a mild effort I can check nroff output on the same platform), but that's utterly inapplicable here.  AT&T *roff can't be trusted to emit diagnostics.


G. Branden Robinson <gbranden>
Group administrator
Sun 09 May 2021 07:53:53 AM UTC, comment #1: 

Bernd also case-folded the U dieresis down, always, while he was at it.

You know, I'm not even going to file a separate bug for this.

Here's my fix for that part of the problem.  Apologies if the Perl isn't idiomatic; the only defense I can make for it is that I actually tested it.

I've never spent a lot of time in Perl.

This code base does not encourage me to start.


diff --git a/contrib/gpinyin/subs.pl b/contrib/gpinyin/subs.pl
index eda087bd..9eb1ed7c 100755
--- a/contrib/gpinyin/subs.pl
+++ b/contrib/gpinyin/subs.pl
@@ -525,8 +525,13 @@ sub vowel_t {      # named glyphs for troff

   # \o'\s-2\[:u]\s0\[a-]'
   if ( $vowel =~ /[üÜ]/ ) {
+    if ($vowel eq 'ü') {
+      $ue = q(\\[:u]);
+    } else {
+      $ue = q(\\[:U]);
+    }
     my $smaller = 2;
-    $vowel = q(\\o'\\s-) . $smaller . q(\\[:u]\\s0) .
+    $vowel = q(\\o'\\s-) . $smaller . $ue . q(\\s0) .
       $accents[$tone] . q(');
     return $vowel;
   }


G. Branden Robinson <gbranden>
Group administrator
Fri 03 Jan 2020 12:07:01 AM UTC, original submission:  

Originally reported on the email list:

http://lists.gnu.org/archive/html/groff/2014-10/msg00048.html

The recommended change is "to move the tone mark higher, instead of reducing the size of the base character."

Werner Lemberg's followup post said "I suggest to open a bug report so that it won't be forgotten...", so that's what this is.

Dave <barx>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-08-10 gbranden StatusPostponed None
    2022-03-02 gbranden StatusIn Progress Postponed
        Summarygpinyin: bad rendering for &quot;ü&quot; and &quot;Ü&quot; with tone marks [gpinyin] bad rendering for "ü" and "Ü" with tone marks
    2022-01-11 gbranden Item GroupNone Rendering/Cosmetics
    2021-05-09 gbranden Attached File- Added pinyin_bernd_vs_branden.png, #51407
        StatusNone In Progress
        Assigned toNone gbranden
        Summarygpinyin: suboptimal rendering for syllable &quot;lue3&quot; gpinyin: bad rendering for "ü" and "Ü" with tone marks
    2020-08-06 barx Carbon-CopyRemoved 93119 -

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code