[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A patch for enforcing double-width CJK character display

From: Thien-Thi Nguyen
Subject: Re: A patch for enforcing double-width CJK character display
Date: Tue, 29 Apr 2014 10:16:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

() Stefan Monnier <address@hidden>
() Tue, 29 Apr 2014 01:39:39 -0400

   > +    return 1;
   > +  return 0; 

   Please make the return type "bool", then.  And use "true" and "false"
   rather than 1 and 0.  Also, you can apply eta-reduction to the above
   code and just write

  return (XftCharExists (xftfont_info->display, xftfont_info->xftfont, 0x4E00)
          || XftCharExists (xftfont_info->display, xftfont_info->xftfont, 

   [ Tho that would step over the 80 columns limit, so you may then want to
     introduce a local var to hold xftfont_info->display, maybe.  ]

Another wrinkle is func ‘XftCharExists’ returns ‘FcBool’, so to be
excruciatingly correct, we would want to compare each call's rv against
‘FcTrue’, something like:

#define EXISTS(c) \
  (FcTrue == XftCharExists (i->display, i->xftfont, c))

  return EXISTS (0x4E00) || EXISTS (0xAC00);

#undef EXISTS
(I'm a fan of local macros (#define/#undef inside a function), but
that's inappropriate for Emacs, it seems.  Hmm, i see one other call to
‘XftCharExists’ in that file, so maybe a top-level macro is warranted.)
Also, although we could use ‘(FcChar32) c’ as third arg, that's probably
not a good idea; better to let callers cast if need be.

Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
      read my lisp: (responsep (questions 'technical)
                               (not (via 'mailing-list)))
                     => nil

Attachment: pgpNRcoH6okzd.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]