bugGNU troff - Bugs: bug #44941, Add a `zh.tmac' file for improved...

 
 

bug #44941: Add a `zh.tmac' file for improved Chinese typesetting

Submitted by:  Darcy Shen <sadhen>
Submitted on:  Mon 27 Apr 2015 04:49:34 PM UTC  
 
Category:  None Severity:  3 - Normal
Item Group:  New feature Status:  Fixed
Privacy:  Public Assigned to:  Werner LEMBERG <wl>
Open/Closed:  Closed Planned Release:  1.22.4

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Tue 13 Dec 2016 01:05:48 PM UTC, comment #10:

Ah, the previous comment expresses my intent, but there was a bug. Fixed in git:

http://git.savannah.gnu.org/cgit/man-db.git/commit/?id=d450d4c2d3c09a629ef95d02d250a6cb290764ca

Colin Watson <cjwatson>
Project Member
Tue 13 Dec 2016 12:10:30 PM UTC, comment #9:

man-db actually extracts just the language from the path, so it loads zh.tmac rather than zh_CN.tmac.

I consider this mostly as a useful backstop. It's still a good idea for individual pages to load the appropriate macros themselves; but loading them automatically system-wide gives users a better experience more quickly.

Colin Watson <cjwatson>
Project Member
Sat 09 May 2015 09:18:18 AM UTC, comment #8:

I agree with you and decide to solve it by adding `. mso zh.tmac`.

Thanks for your help.

Darcy Shen <sadhen>
Fri 01 May 2015 01:45:51 PM UTC, comment #7:

> [...] at least there should be an entry in tmac/tmac.am
> to install `zh.tmac`.


Fixed.

> Another problem is there should be two files zh_CN.tmac
> and zh_TW.tmac.


Here I disagree. The `zh' indicates the language, while `CN' and `TW' gives the country. The language is the same, even if there are different conventions, e.g. different punctuation characters and simplified vs. traditional glyphs. Your`zh.tmac' covers both, so no need for two separate files.

> As far as I know the `man` command uses
> the path info to determine what language the
> groff-format file is using.
>
> eg.
> /usr/share/man/zh_CN/man1/man.1
>
> It seems the string 'zh_CN' is extracted.


I consider this a bug. If there is no `xx_XX.tmac', it should try `xx.tmac' next. On the other hand, I would rather expect that the language selection file is part of the man page itself!
IMHO, it's not the job of the `man' program to supply this data. Just imagine to view the man page directly with groff – how shall I know the file's language?

Colin, can you chime in, please?

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Fri 01 May 2015 01:13:39 PM UTC, comment #6:

Hi Werner LEMBERG,

I checkout the source code but only zh.tmac is added. I am not familiar with groff itself and how the command man works. But at least there should be an entry in tmac/tmac.am to install `zh.tmac`.

Another problem is there should be two files zh_CN.tmac and zh_TW.tmac.

As far as I know the `man` command use the path info to determine what language the groff-format file is using.

eg.
/usr/share/man/zh_CN/man1/man.1
It seems the string 'zh_CN' is extracted.

Thanks a lot for your work on improving Chinese typesetting.

Darcy Shen <sadhen>
Thu 30 Apr 2015 07:40:43 AM UTC, comment #5:

Thanks a lot! Committed to git, please test.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Wed 29 Apr 2015 10:54:54 AM UTC, comment #4:

.\" The following rules are for zh_CN and should be put into zh_CN.tmac
.\" And these rules should work for zh_TW too.
.\" Locale string
.
.ds locale chinese\"
.
.
.class [CJKprepunct] \
, : ; > } \
\[u2026] \[u201D] \
\[u3001] \[u3002] \[u3009] \[u300B] \[u300D] \[u300F] \[u3011] \
\[uFF01] \[uFF09] \[uFF0C] \[uFF1A] \[uFF1B] \[uFF1F]
.class [CJKpostpunct] \
\[u201C] \[u3008] \[u300A] \[u300C] \[u300E] \[u3010] \[uFF08]

.
.\" Chinese glyphs.
.class [CJKnormal] \
\[u4E00]-\[u9FFF]
.
.cflags 128 \C'[CJKprepunct]'
.cflags 266 \C'[CJKpostpunct]'
.cflags 512 \C'[CJKnormal]'

Darcy Shen <sadhen>
Tue 28 Apr 2015 08:46:13 AM UTC, comment #3:

> I am willing to write a zh.tmac for groff.


Great! Assuming that only minor changes are necessary compared to ja.tmac, I guess it's OK if you simply post a patch here, not needing a copyright disclaimer.

Of course, the main problem is CJK output for non-TTY devices, due to lack of native TTF and OTF support. But this is a different issue.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Tue 28 Apr 2015 08:22:12 AM UTC, comment #2:

Thanks for your awesome work. I put the Chinese man.1 in ~/.local/man/ja/man1/man.1 and browser it using Japanese typesetting.

Cool, just what the effect I want to see.

I am willing to write a zh.tmac for groff.

Darcy Shen <sadhen>
Mon 27 Apr 2015 05:52:03 PM UTC, comment #1:

Have you played around with the `.class' request? In particular, you should read the documentation in groff's info file, then check the file `ja.tmac', which sets up punctuation rules for Japanese. In other words, if you have a Japanese manpage you should load `ja.tmac'.

Do you want to contribute something similar for Chinese?

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Mon 27 Apr 2015 04:49:34 PM UTC, original submission:

There are severe typesetting problems. Please see the attached screenshot.

1. Typesetting for pure Chinese text is quite easy. Just place it there. Chinese characters do not separate by spaces. There is no need to streach spaces.

2. When typesetting Chinese with English. Just regard each Chinese character as an English word. Current rule seems to regard a Chinese sentence as an English word, since there are no spaces between Chinese characters.

3. Line break algorithm. A line should not begin with punctuation characters. When there are conflicts, feel free to put some spaces at the end of the line.

These rules should also work for Korean and Japanese man pages.

Darcy Shen <sadhen>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #33818:  man.png added by sadhen (215KiB - image/png - man man in Chinese)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by cjwatson (Posted a comment)
  • -email is unavailable- added by wl
  • -email is unavailable- added by wl (Posted a comment)
  • -email is unavailable- added by sadhen (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-05-01 wl Carbon-Copy- => Added cjwatson
    2015-04-30 wl StatusNone => Fixed
        Assigned toNone => wl
        Open/ClosedOpen => Closed
        Planned ReleaseNone => 1.22.4
    2015-04-27 wl SummaryImprove CJK typesetting => Add a `zh.tmac' file for improved Chinese typesetting
    2015-04-27 sadhen Attached File- => Added man.png, #33818

    Back to the top


    Powered by Savane 3.4