all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: 黄建忠 <jianzhong.huang@i-soft.com.cn>
To: Eli Zaretskii <eliz@gnu.org>
Cc: kanru@kanru.info, emacs-devel@gnu.org
Subject: Re: A patch for enforcing double-width CJK character display
Date: Thu, 12 Apr 2012 19:18:39 +0800	[thread overview]
Message-ID: <4F86BA0F.4080301@i-soft.com.cn> (raw)
In-Reply-To: <83hawp46p7.fsf@gnu.org>

于 2012年04月12日 17:53, Eli Zaretskii 写道:
>> Date: Thu, 12 Apr 2012 16:56:16 +0800
>> From: 黄建忠<jianzhong.huang@i-soft.com.cn>
>> Cc: emacs-devel@gnu.org
>>
>> FRAME_COLUMN_WIDTH and FRAME_SPACE_WIDTH never changed, it only be
>> initialized when first font loaded.
> Right, and that's by design.
Can be understood, since the width/height of a lot of UI components was determined via these values.

>
>> Can anybody provide a clue how to catch the new width of default font
>> via FRAME_PTR when scale happened?
> I don't think there is a way to do that, if all you have is the frame
> pointer.  text-scale-mode does not modify the frame's default font, it
> remaps the 'default' face to another face which specifies a larger or
> a smaller font.  So the way to find the width of the font after
> scaling is to get hold of the font itself, or of the face to which
> 'default' was remapped.  Then you can use FONT_WIDTH, I think (but I
> didn't test this).
I can get the default font(the first font loaded when frame be 
initialized) via FRAME_FONT, it's great that it can not be changed after 
first font loaded.
But I still can not get the current width after scale, since the props 
of FRAME_FONT also not be changed.

Since FRAME_FONT always return the initial value, FONT_WIDTH defined in 
xterm.h and FONT_WIDTH_NUMERIC defined in font.h DO works but only get 
the initial value of font width.

Of couse a new FcPattern can be created, the family of default font and 
the pixel_size of current loaded font can be set to the newly created 
FcPattern,
After a FcPatternMatch call , width/average_width can be caculated. But 
since this function will be involked by "xftfont_text_extents" and 
"xftfont_draw" many many times, It should not be too complex and time 
consuming, Otherwise it will affect the performance of font drawing.

The problem exist in current patch is the "global variable" and a "dirty 
workaround function that a little bit difficult to be understood", I 
need to find a better and clean way to accomplish it.

I noticed there were some global Lisp_Object such as 
"f_Vface_font_rescale_alist"/"f_Vface_remapping_alist"/"f_Vface_new_frame_defaults", 
maybe I can use them, Hope so.
Thanks.



  reply	other threads:[~2012-04-12 11:18 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4F85A138.6090900@i-soft.com.cn>
2012-04-11 15:48 ` A patch for enforcing double-width CJK character display Kan-Ru Chen
2012-04-11 16:16   ` 黄建忠
2012-04-12  8:56     ` 黄建忠
2012-04-12  9:53       ` Eli Zaretskii
2012-04-12 11:18         ` 黄建忠 [this message]
2012-04-12 14:27           ` Eli Zaretskii
2012-04-12 17:56             ` 黄建忠
2012-04-12 20:33               ` Stefan Monnier
     [not found]                 ` <4F8782C8.2030005@i-soft.com.cn>
2012-04-13 11:42                   ` 黄建忠
2012-04-13 12:03                     ` 黄建忠
2012-04-13 13:27                   ` Stefan Monnier
2012-04-15  5:10                     ` Miles Bader
2012-04-15 13:27                       ` 黄建忠
2012-04-15 16:08                       ` William Xu
2012-04-15 22:19                         ` Miles Bader
2012-04-16  0:51                           ` 黄建忠
2012-04-16  5:27                             ` Miles Bader
2012-04-16  5:40                               ` 黄建忠
2012-04-16  6:37                                 ` 黄建忠
2012-04-16  9:21                                   ` 黄建忠
2012-04-17  2:16                                     ` 黄建忠
2012-04-17  0:13                                   ` Miles Bader
2012-04-17  0:39                                     ` Miles Bader
2012-04-17  2:00                                       ` 黄建忠
2012-04-17  2:30                                         ` Miles Bader
2012-04-17  3:00                                           ` 黄建忠
2012-04-17  4:08                                             ` Miles Bader
2012-04-17  4:56                                               ` Werner LEMBERG
2012-04-17  5:02                                                 ` 黄建忠
2012-04-17  6:33                                                   ` Miles Bader
2012-04-17  7:03                                                   ` Werner LEMBERG
2012-04-17  5:52                                                 ` Miles Bader
2012-04-17  6:10                                                   ` 黄建忠
2012-04-17  7:02                                                     ` Miles Bader
2012-04-17  8:06                                                       ` Werner LEMBERG
2012-04-17  8:25                                                         ` Miles Bader
2012-04-17  9:06                                                           ` Werner LEMBERG
2012-04-17  8:51                                                       ` 黄建忠
2012-04-17  6:45                                                   ` Werner LEMBERG
2012-04-17  9:07                                       ` James Cloos
2012-04-17  9:27                                         ` 黄建忠
2012-04-17  1:47                                     ` 黄建忠
2012-04-18  6:54                               ` Kenichi Handa
2012-04-18  8:13                                 ` 黄建忠
2012-04-18 13:58                                 ` Miles Bader
2014-04-28  5:35 JunJie Nan
2014-04-29  5:39 ` Stefan Monnier
2014-04-29  6:36   ` Jan D.
2014-04-29  8:16   ` Thien-Thi Nguyen
2014-04-29 20:41 ` Liang Wang
  -- strict thread matches above, loose matches on Subject: below --
2014-04-30  2:00 Hui Liu
2014-04-30 17:08 ` Liang Wang
2014-10-04  3:26 Feng Shu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F86BA0F.4080301@i-soft.com.cn \
    --to=jianzhong.huang@i-soft.com.cn \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=kanru@kanru.info \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.