From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?6buE5bu65b+g?= Newsgroups: gmane.emacs.devel Subject: Re: A patch for enforcing double-width CJK character display Date: Tue, 17 Apr 2012 10:16:20 +0800 Message-ID: <4F8CD274.2030904@i-soft.com.cn> References: <4F85A138.6090900@i-soft.com.cn> <87vcl646c7.fsf@isil.kanru.info> <4F85AE69.9050002@i-soft.com.cn> <4F8698B0.2030703@i-soft.com.cn> <83hawp46p7.fsf@gnu.org> <4F86BA0F.4080301@i-soft.com.cn> <83ehrt3u0p.fsf@gnu.org> <4F87173F.3070801@i-soft.com.cn> <4F8782C8.2030005@i-soft.com.cn> <87d379h971.fsf@catnip.gol.com> <877gxghc3d.fsf@catnip.gol.com> <4F8B6D0F.2050700@i-soft.com.cn> <4F8BB0D3.6060202@i-soft.com.cn> <4F8BBE1F.9080701@i-soft.com.cn> <4F8BE4B0.7020303@i-soft.com.cn> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060907040906060304000701" X-Trace: dough.gmane.org 1334629008 5231 80.91.229.3 (17 Apr 2012 02:16:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 17 Apr 2012 02:16:48 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 17 04:16:44 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SJxyG-0001Hv-5U for ged-emacs-devel@m.gmane.org; Tue, 17 Apr 2012 04:16:44 +0200 Original-Received: from localhost ([::1]:34707 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJxyF-0003Kc-DV for ged-emacs-devel@m.gmane.org; Mon, 16 Apr 2012 22:16:43 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJxy9-0003KX-UO for emacs-devel@gnu.org; Mon, 16 Apr 2012 22:16:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SJxy5-0007KG-D7 for emacs-devel@gnu.org; Mon, 16 Apr 2012 22:16:37 -0400 Original-Received: from mta319.sina.net ([202.108.3.197]:34867) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJxy3-0007JY-GS for emacs-devel@gnu.org; Mon, 16 Apr 2012 22:16:33 -0400 X-Originating-IP: [218.240.45.242] Original-Received: from unknown (HELO mta319.sina.net) ([10.54.5.51]) by irxd5-206.sina.net with ESMTP; 17 Apr 2012 10:16:27 +0800 Original-Received: by smtp-5-51.sina.net (SINAMAIL, from userid 1074) id 796FBDCA8C8; Tue, 17 Apr 2012 10:16:21 +0800 (CST) Original-Received: from piggy.pure64.org (unknown [218.240.45.242]) by smtp-5-51.sina.net (SINAMAIL) with ESMTPA id D58AEDCA8B8 for ; Tue, 17 Apr 2012 10:16:20 +0800 (CST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120327 Thunderbird/10.0.2 In-Reply-To: <4F8BE4B0.7020303@i-soft.com.cn> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 202.108.3.197 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:149712 Archived-At: This is a multi-part message in MIME format. --------------060907040906060304000701 Content-Type: multipart/alternative; boundary="------------080705070007030107010101" --------------080705070007030107010101 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Patch update, fix CJK offset calculation in minibuffer after font rescaling happened. Font in some buffers will not rescale when "text-scale-increase/decrease". we need use original FONT_WIDTH as reference value. Eli already gives me a hint, it's my fault. 于 2012年04月16日 17:21, 黄建忠 写道: > Hi, All, > Patch updated, add support for CJK half-width letters. > > 1, There are some forms in Japanese: > Full-width Hirakana/katakana > Half-width katakana > The width of Half-Width katakana equals to 1/2 of Full-width Katakana > letters. > > 2, There are also some forms for Korean basic letters. Full-Width > letters and Half-Width letters. > > The half-width letters for J/K is ignored in previous patch, since the > width is even smaller than English letters from monospace font. > > The updated patch add support for such half-width letters and align it > according to single English glyph width, > Normal CJK glyphs still use 2 * English glyph width as reference. > > NOTE the second line in attachments, It shows the result of half-width > katakana before/after the patch applied. > > The link below provides a full list of such half-width letters. > http://svn.jacekowski.org/chromium/trunk/third_party/icu/source/data/translit/Fullwidth_Halfwidth.txt > > 于 2012年04月16日 14:37, 黄建忠 写道: >> [mail rejected again and again , resend to list] >> >> Hi, Miles. >> >> I had downloaded the font and try it with such settings: >> >> 1, LANG=ja_JP.utf8 >> 2, remove all zh/ja fonts existed on my Linux, and just let it match >> "kiloji" font. >> 3, set emacs font size 10 or 13. >> >> And got the result as attachments, It is readable and just looks like >> before, but the alignment issue is fixed. (NOTE the alignment of >> VERTICAL BAR) >> >> I think you have some misunderstanding about the fix and character >> width and font width. >> >> 1, although the "kiloji" character width looks as small as monospace >> font width, but the real pixel width of the glyph is already wide >> enough, >> It's the font choose to leave too much space left and right of the >> character. >> >> 2, for Monospace 10, the pixelsize is 14, then it matches a "koliji >> 10" with pixelsize 12. that's to say, >> *the fix only added ONE pixel left and ONE pixel right.* Can anybody >> feel such a little alignment change? >> >> The patch should be good enough for you and I am sure you will never >> fell the change of the alignment after the fix. >> >> Do not guess the result and just have a try :-D >> >> >> 于 2012年04月16日 13:40, 黄建忠 写道: >>> Got it, I will try this font. >>> >>> by the way, You can add a line to your .emacs. >>> (set-fontset-font "fontset-default" 'han "FONTFAMILY FONTSIZE" ) >>> replace "FONTFAMILY" and FONTSIZE according to your environment. >>> And FONTSIZE can be ignored if you had no need to specify a size for >>> this font. >>> >>> 于 2012年04月16日 13:27, Miles Bader 写道: >>>> 黄建忠 writes: >>>>> Would you please provide some example characters and such a font to >>>>> help us make it better? >>>> Here's an example from my (Debian) system; the font I chose in Emacs >>>> is "Droid Sans Mono"; the "x11 size" is 13 [which isn't exactly the >>>> size chosen in the UI; fontconfig sizes and X font sizes seem to be >>>> only loosely related... :( ] >>>> >>>> I set the font to "Droid Sans Mono", and the Japanese font Emacs >>>> automatically chose was "きろ字". I don't know _why_ Emacs chose that >>>> font, as other apps don't seem to -- If I select Droid S M in GTK >>>> apps, for instance, they use something much better looking, probably >>>> "Droid Fallback" (which is a matching font for Droid S M). >>>> >>>> I've attached an image file showing what this looks like on my >>>> computer. >>>> >>>> The things I notice: >>>> >>>> (1) The font chosen by Emacs for Japanese might be a bit odd, and >>>> doesn't seem to match what other apps choose. >>>> >>>> (2) The "きろ字" font is already pretty widely spaced, maybe near >>>> the limit of readability IMO. >>>> >>>> (3) It looks like forcing CJK alignment to 2*ASCII will increase the >>>> width of characters in this font by about 30%. Given the already >>>> very wide spacing, I think the result might look funny. >>>> >>>> [ (4) If I grow or shrink the font-size, the ASCII and Japanese grow >>>> by different, and varying amounts (that is, there are obvious >>>> "jumps" in the size increases, and the jumps occur at different >>>> places for the ASCII font and the Japanese font); my guess is that >>>> this is probably due to rounding by the font renderer. So there >>>> will be. ] >>>> >>>> Now that I think about it, I'd say that the problem seems to lie more >>>> with Emacs' choice of fonts for Japanese (both the funny automatic >>>> choice, and the lack of good methods for users to tweak it). >>>> >>>> Thanks, >>>> >>>> -Miles >>>> >>>> >>>> >>> >>> >>> -- >>> Huang JianZhong >> >> >> -- >> Huang JianZhong > > > -- > Huang JianZhong -- Huang JianZhong --------------080705070007030107010101 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch update, fix CJK offset calculation in minibuffer after font rescaling happened.

Font in some buffers will not rescale when "text-scale-increase/decrease".  we need use original FONT_WIDTH as reference value.

Eli already gives me a hint, it's my fault.

于 2012年04月16日 17:21, 黄建忠 写道:
Hi, All,
Patch updated, add support for CJK half-width letters.

1, There are some forms in Japanese:
Full-width Hirakana/katakana
Half-width katakana
The width of Half-Width katakana equals to 1/2 of Full-width Katakana letters.

2, There are also some forms for Korean basic letters. Full-Width letters and Half-Width letters.

The half-width letters for J/K is ignored in previous patch, since the width is even smaller than English letters from monospace font.

The updated patch add support for such half-width letters and align it according to single English glyph width,
Normal CJK glyphs still use 2 * English glyph width as reference.

NOTE the second line in attachments, It shows the result of half-width katakana before/after the patch applied.

The link below provides a full list of such half-width letters.
http://svn.jacekowski.org/chromium/trunk/third_party/icu/source/data/translit/Fullwidth_Halfwidth.txt

于 2012年04月16日 14:37, 黄建忠 写道:
[mail rejected again and again , resend to list]

Hi, Miles.

I had downloaded the font and try it with such settings:

1, LANG=ja_JP.utf8
2, remove all zh/ja fonts existed on my Linux, and just let it match "kiloji" font.
3, set emacs font size 10 or 13.

And got the result as attachments, It is readable and just looks like before, but the alignment issue is fixed. (NOTE the alignment of VERTICAL BAR)

I think you have some misunderstanding about the fix and character width and font width.

1, although the "kiloji" character width looks as small as monospace font width, but the real pixel width of the glyph is already wide enough,
   It's the font choose to leave too much space left and right of the character.

2, for Monospace 10, the pixelsize is 14, then it matches a "koliji 10" with pixelsize 12. that's to say,
the fix only added ONE pixel left and ONE pixel right. Can  anybody feel such a little alignment change?

The patch should be good enough for you and I am sure you will never fell the change of the alignment after the fix.

Do not guess the result and just have a try :-D


于 2012年04月16日 13:40, 黄建忠 写道:
Got it, I will try this font.

by the way, You can add a line to your .emacs.
(set-fontset-font "fontset-default" 'han "FONTFAMILY FONTSIZE" )
replace "FONTFAMILY" and FONTSIZE according to your environment.
And FONTSIZE can be ignored if you had no need to specify a size for this font.

于 2012年04月16日 13:27, Miles Bader 写道:
黄建忠 <jianzhong.huang@i-soft.com.cn> writes:
Would you please provide some example characters and such a font to
help us make it better?
Here's an example from my (Debian) system; the font I chose in Emacs
is "Droid Sans Mono"; the "x11 size" is 13 [which isn't exactly the
size chosen in the UI; fontconfig sizes and X font sizes seem to be
only loosely related... :( ]

I set the font to "Droid Sans Mono", and the Japanese font Emacs
automatically chose was "きろ字".  I don't know _why_ Emacs chose that
font, as other apps don't seem to -- If I select Droid S M in GTK
apps, for instance, they use something much better looking, probably
"Droid Fallback" (which is a matching font for Droid S M).

I've attached an image file showing what this looks like on my
computer.

The things I notice:

  (1) The font chosen by Emacs for Japanese might be a bit odd, and
  doesn't seem to match what other apps choose.

  (2) The "きろ字" font is already pretty widely spaced, maybe near
  the limit of readability IMO.

  (3) It looks like forcing CJK alignment to 2*ASCII will increase the
  width of characters in this font by about 30%.  Given the already
  very wide spacing, I think the result might look funny.

  [ (4) If I grow or shrink the font-size, the ASCII and Japanese grow
  by different, and varying amounts (that is, there are obvious
  "jumps" in the size increases, and the jumps occur at different
  places for the ASCII font and the Japanese font); my guess is that
  this is probably due to rounding by the font renderer.  So there
  will be. ]

Now that I think about it, I'd say that the problem seems to lie more
with Emacs' choice of fonts for Japanese (both the funny automatic
choice, and the lack of good methods for users to tweak it).

Thanks,

-Miles





-- 
Huang JianZhong


-- 
Huang JianZhong


-- 
Huang JianZhong


-- 
Huang JianZhong
--------------080705070007030107010101-- --------------060907040906060304000701 Content-Type: text/plain; name="emacs-cjk-monospace-v12.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="emacs-cjk-monospace-v12.patch" LS0tIGVtYWNzL3NyYy94ZnRmb250LmMJMjAxMi0wNC0xNiAxODozOTozMy41OTY3MzgwNzkg KzA4MDAKKysrIGVtYWNzLmNqay9zcmMveGZ0Zm9udC5jCTIwMTItMDQtMTYgMTg6NDA6MDUu OTk3NzQwNDQ5ICswODAwCkBAIC02MSw2ICs2MSw4IEBACiAgIERpc3BsYXkgKmRpc3BsYXk7 CiAgIGludCBzY3JlZW47CiA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ERUZBVUxUX0ZB Q0VfSUQpIC8qIG5vdCByZW1hcHBlZCAqLworICAgICAgcmV0dXJuIEZSQU1FX1NQQUNFX1dJ RFRIKGYpOworICAgIGVsc2UgLyogcmVtYXBwZWQsIHJldHVybiBuZXcgd2lkdGggKi8KKyAg ICAgIHJldHVybiBmYWNlLT5mb250LT5zcGFjZV93aWR0aDsgIAorICB9CisgIHJldHVybiAw OworfQorCiBzdGF0aWMgTGlzcF9PYmplY3QgeGZ0Zm9udF9saXN0IChMaXNwX09iamVjdCwg TGlzcF9PYmplY3QpOwogc3RhdGljIExpc3BfT2JqZWN0IHhmdGZvbnRfbWF0Y2ggKExpc3Bf T2JqZWN0LCBMaXNwX09iamVjdCk7CiBzdGF0aWMgTGlzcF9PYmplY3QgeGZ0Zm9udF9vcGVu IChGUkFNRV9QVFIsIExpc3BfT2JqZWN0LCBpbnQpOwpAQCAtNDM0LDYgKzUwMiwxNCBAQAog ICAgICAgWGZ0VGV4dEV4dGVudHM4IChkaXNwbGF5LCB4ZnRmb250LCBhc2NpaV9wcmludGFi bGUgKyAxLCA5NCwgJmV4dGVudHMpOwogICAgICAgZm9udC0+YXZlcmFnZV93aWR0aCA9IChm b250LT5zcGFjZV93aWR0aCArIGV4dGVudHMueE9mZikgLyA5NTsKICAgICB9CisKKyAgLyog dG8gZml4IENKSyBkb3VibGUgd2lkdGggYWxpZ25tZW50IGlzc3VlLgorICAgICBwYXNzIEZS QU1FX1BUUiB0byBldmVyeSB4ZnRmb250X2luZm8gc3RydWN0dXJlLAorICAgICB3ZSBjYW4g bm90IGdldCBpdCBpbiAieGZ0Zm9udF90ZXh0X2V4dGVudHMiLiAqLworICB4ZnRmb250X2lu Zm8tPmZyYW1lID0gZjsKKyAgLyogbWFyayBpdCBpcyBDSksgZm9udCBvciBub3Qgd2hlbiBm b250IG9wZW5lZCwKKyAgICAgYXZvaWQgY2FsbGluZyAieGZ0Zm9udF9pc19jamtfZm9udCIg bWFueSB0aW1lcy4gKi8KKyAg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Vsc2UgeyAKKyAgICAgICAgIC8q IGRyYXcgQ0pLIGdseXBocyBvbmUgYnkgb25lIGFuZCBhZGp1c3QgdGhlIG9mZnNldCAqLwor ICAgICAgICAgaW50IGRlZmF1bHRfd2lkdGggPSB4ZnRmb250X2dldF9kZWZhdWx0X3dpZHRo KHhmdGZvbnRfaW5mby0+ZnJhbWUpOworICAgICAgICAgZm9yIChpID0gMDsgaSA8IGxlbjsg aSsrKSB7CisgICAgICAgICAgIGludCBjamtfcGFkZGluZyA9IDA7CisgICAgICAgICAgIGlu dCBvZmZzZXQgPSAwOworICAgICAgICAgICBpbnQgaGFsZl93aWR0aF9jamsgPSAwOworICAg ICAgICAgICBYR2x5cGhJbmZvIGV4dGVudHM7CisgICAgICAgICAgIFhmdEdseXBoRXh0ZW50 cyAoeGZ0Zm9udF9pbmZvLT5kaXNwbGF5LCB4ZnRmb250X2luZm8tPnhmdGZvbnQsIGNvZGUr aSwgMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXh0ZW50cyk7CisgICAgICAg ICAgIGNqa19wYWRkaW5nID0geGZ0Zm9udF9nZXRfY2prX3BhZGRpbmcoZGVmYXVsdF93aWR0 aCxleHRlbnRzLnhPZmYsICZoYWxmX3dpZHRoX2Nqayk7CisgICAgICAgICAgIGlmKGNqa19w YWRkaW5nKSAKKyAgICAgICAgICAgICBvZmZzZXQgPSBkZWZhdWx0X3dpZHRoICogaSAqICho YWxmX3dpZHRoX2NqayA/IDEgOiAyKSArIChjamtfcGFkZGluZz4+MSk7CisgICAgICAgICAg IGVsc2UKKyAgICAgICAgICAgICBvZmZzZXQgPSBleHRlbnRzLnhPZmYgKiBpOyAKKyAgICAg ICAgICAgWGZ0RHJhd0dseXBocyAoeGZ0X2RyYXcsICZmZywgeGZ0Zm9udF9pbmZvLT54ZnRm b250LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHgrb2Zmc2V0LCB5LCBjb2RlK2ks IDEpOworICAgICAgICAgfQorICAgICAgfQorICB9CiAgIFVOQkxPQ0tfSU5QVVQ7CiAKICAg cmV0dXJuIGxlbjsK --------------060907040906060304000701--