emacs-devel
[Top][All Lists]
Advanced

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

Need to check face_id < BASIC_FACE_ID_SENTINEL in get_*_face_and_encodin


From: YAMAMOTO Mitsuharu
Subject: Need to check face_id < BASIC_FACE_ID_SENTINEL in get_*_face_and_encoding?
Date: Mon, 06 Feb 2006 20:54:30 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/22.0.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

When I was profiling display code, I noticed that rif->encode_char is
often called from get_char_face_and_encoding if many faces are used.

  else if (c < 128 && face_id < BASIC_FACE_ID_SENTINEL)
    {
      /* Case of ASCII in a face known to fit ASCII.  */
      STORE_XCHAR2B (char2b, 0, c);
    }
  else
    {
      int c1, c2, charset;

      /* Split characters into bytes.  If c2 is -1 afterwards, C is
         really a one-byte character so that byte1 is zero.  */
      SPLIT_CHAR (c, charset, c1, c2);
      if (c2 > 0)
        STORE_XCHAR2B (char2b, c1, c2);
      else
        STORE_XCHAR2B (char2b, 0, c1);

      /* Maybe encode the character in *CHAR2B.  */
      if (face->font != NULL)
        {
          struct font_info *font_info
            = FONT_INFO_FROM_ID (f, face->font_info_id);
          if (font_info)
            rif->encode_char (c, char2b, font_info, 0);
        }
    }

First I thought that `if (face->font != NULL)' above could be changed
to `if (charset != CHARSET_ASCII && face->font != NULL)' because the
added condition had been there until the change
http://cvs.savannah.gnu.org/viewcvs/emacs/src/xterm.c?root=emacs&r1=1.494&r2=1.495,
But if `&& face_id < BASIC_FACE_ID_SENTINEL' in the outer `if' can be
removed, then that would be much simpler and similar change might also
be applied to get_glyph_face_and_encoding.  Do we need to check
whether face_id is less than BASIC_FACE_ID_SENTINEL here?

                                     YAMAMOTO Mitsuharu
                                address@hidden




reply via email to

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