mule-ja
[Top][All Lists]
Advanced

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

[mule-ja:23] Re: extending composition-function-table rules to support V


From: YAMAMOTO Mitsuharu
Subject: [mule-ja:23] Re: extending composition-function-table rules to support VS15&16
Date: Mon, 07 Jan 2013 16:55:13 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Sat, 05 Jan 2013 16:04:20 +0900, YAMAMOTO Mitsuharu <address@hidden> 
>>>>> said:

> 先に、FONT-POS の無い形式について従来とは非互換な部分があると述べまし
> た。これは、上の例のように Variation Selector についてもどのフォント
> を用いるかの情報を取得できるようにするために、font_range (font.c) に
> おけるVariation Selector を飛ばす処理を削除するというものです。このた
> め、language/japanese.el で登録している
> compose-gstring-for-variation-glyph については、FONT-POS を -1 にした
> ものを rule として指定することになります。

この部分ですが、font_range では最初の文字が Variation Selector であった
場合にのみどのフォントを用いるかの情報を取得し、それ以外の場合は従来通
り飛ばすようにすれば、language/japanese.el への変更は必要なくなります。

1月10日に次の pretest が予定されているようですので、その後ぐらいにリリー
スする予定の Mac port で以下の変更を取り込んで、Variation Selector 15
および 16 のサポートを付加したいと思います。

                                        山本 光晴
                                address@hidden

=== modified file 'src/composite.c'
*** src/composite.c     2012-09-22 02:15:29 +0000
--- src/composite.c     2013-01-03 06:05:36 +0000
***************
*** 898,908 ****
  
  
  /* Try to compose the characters at CHARPOS according to composition
!    rule RULE ([PATTERN PREV-CHARS FUNC]).  LIMIT limits the characters
!    to compose.  STRING, if not nil, is a target string.  WIN is a
!    window where the characters are being displayed.  If characters are
!    successfully composed, return the composition as a glyph-string
!    object.  Otherwise return nil.  */
  
  static Lisp_Object
  autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t limit, struct window *win, struct face *face, Lisp_Object string)
--- 898,909 ----
  
  
  /* Try to compose the characters at CHARPOS according to composition
!    rule RULE (either [PATTERN PREV-CHARS FUNC] or [PATTERN PREV-CHARS
!    FUNC FONT-POS]).  LIMIT limits the characters to compose.  STRING,
!    if not nil, is a target string.  WIN is a window where the
!    characters are being displayed.  If characters are successfully
!    composed, return the composition as a glyph-string object.
!    Otherwise return nil.  */
  
  static Lisp_Object
  autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t limit, struct window *win, struct face *face, Lisp_Object string)
***************
*** 935,946 ****
  #ifdef HAVE_WINDOW_SYSTEM
    if (FRAME_WINDOW_P (f))
      {
        font_object = font_range (charpos, &to, win, face, string);
        if (! FONT_OBJECT_P (font_object)
!         || (! NILP (re)
              && to < limit
              && (fast_looking_at (re, charpos, bytepos, to, -1, string) <= 0)))
        return unbind_to (count, Qnil);
      }
    else
  #endif        /* not HAVE_WINDOW_SYSTEM */
--- 936,963 ----
  #ifdef HAVE_WINDOW_SYSTEM
    if (FRAME_WINDOW_P (f))
      {
+       bool use_font_pos = 0;
+ 
+       if (ASIZE (rule) == 4 && INTEGERP (AREF (rule, 3)))
+       {
+         ptrdiff_t offset = XINT (AREF (rule, 1)) + XINT (AREF (rule, 3));
+ 
+         if (offset >= 0 && offset < len)
+           {
+             charpos += offset;
+             to = charpos + 1;
+             use_font_pos = 1;
+           }
+       }
        font_object = font_range (charpos, &to, win, face, string);
        if (! FONT_OBJECT_P (font_object)
!         || (! use_font_pos
!             && ! NILP (re)
              && to < limit
              && (fast_looking_at (re, charpos, bytepos, to, -1, string) <= 0)))
        return unbind_to (count, Qnil);
+       if (use_font_pos)
+       to = limit;
      }
    else
  #endif        /* not HAVE_WINDOW_SYSTEM */
***************
*** 1059,1065 ****
              for (ridx = 0; CONSP (val); val = XCDR (val), ridx++)
                {
                  elt = XCAR (val);
!                 if (VECTORP (elt) && ASIZE (elt) == 3
                      && NATNUMP (AREF (elt, 1))
                      && charpos - 1 - XFASTINT (AREF (elt, 1)) >= start)
                    break;
--- 1076,1082 ----
              for (ridx = 0; CONSP (val); val = XCDR (val), ridx++)
                {
                  elt = XCAR (val);
!                 if (VECTORP (elt) && ASIZE (elt) >= 3 && ASIZE (elt) <= 4
                      && NATNUMP (AREF (elt, 1))
                      && charpos - 1 - XFASTINT (AREF (elt, 1)) >= start)
                    break;
***************
*** 1116,1122 ****
              for (ridx = 0; CONSP (val); val = XCDR (val), ridx++)
                {
                  elt = XCAR (val);
!                 if (VECTORP (elt) && ASIZE (elt) == 3
                      && NATNUMP (AREF (elt, 1))
                      && charpos - XFASTINT (AREF (elt, 1)) > endpos)
                    {
--- 1133,1139 ----
              for (ridx = 0; CONSP (val); val = XCDR (val), ridx++)
                {
                  elt = XCAR (val);
!                 if (VECTORP (elt) && ASIZE (elt) >= 3 && ASIZE (elt) <= 4
                      && NATNUMP (AREF (elt, 1))
                      && charpos - XFASTINT (AREF (elt, 1)) > endpos)
                    {
***************
*** 1257,1264 ****
          for (; CONSP (val); val = XCDR (val))
            {
              elt = XCAR (val);
!             if (! VECTORP (elt) || ASIZE (elt) != 3
!                 || ! INTEGERP (AREF (elt, 1)))
                continue;
              if (XFASTINT (AREF (elt, 1)) != cmp_it->lookback)
                goto no_composition;
--- 1274,1281 ----
          for (; CONSP (val); val = XCDR (val))
            {
              elt = XCAR (val);
!             if (! VECTORP (elt) || ASIZE (elt) < 3 || ASIZE (elt) > 4
!                 || ! NATNUMP (AREF (elt, 1)))
                continue;
              if (XFASTINT (AREF (elt, 1)) != cmp_it->lookback)
                goto no_composition;
***************
*** 1594,1600 ****
            {
              Lisp_Object elt = XCAR (val);
  
!             if (VECTORP (elt) && ASIZE (elt) == 3 && NATNUMP (AREF (elt, 1)))
                {
                  EMACS_INT check_pos = cur.pos - XFASTINT (AREF (elt, 1));
                  struct position_record check;
--- 1611,1618 ----
            {
              Lisp_Object elt = XCAR (val);
  
!             if (VECTORP (elt) && ASIZE (elt) >= 3 && ASIZE (elt) <= 4
!                 && NATNUMP (AREF (elt, 1)))
                {
                  EMACS_INT check_pos = cur.pos - XFASTINT (AREF (elt, 1));
                  struct position_record check;
***************
*** 2010,2016 ****
  a function to call to compose that character.
  
  The element at index C in the table, if non-nil, is a list of
! composition rules of this form: ([PATTERN PREV-CHARS FUNC] ...)
  
  PATTERN is a regular expression which C and the surrounding
  characters must match.
--- 2028,2035 ----
  a function to call to compose that character.
  
  The element at index C in the table, if non-nil, is a list of
! composition rules where each rule is a vector of the form [PATTERN
! PREV-CHARS FUNC] or [PATTERN PREV-CHARS FUNC FONT-POS].
  
  PATTERN is a regular expression which C and the surrounding
  characters must match.
***************
*** 2027,2032 ****
--- 2046,2055 ----
  composition of the characters that match PATTERN.  It is
  called with one argument GSTRING.
  
+ FONT-POS is an integer specifying the position of the character from
+ which the font object passed to FUNC as a part of GSTRING is obtained.
+ The value is relative to the position of C.
+ 
  GSTRING is a template of a glyph-string to return.  It is already
  filled with a proper header for the characters to compose, and
  glyphs corresponding to those characters one by one.  The

=== modified file 'src/font.c'
*** src/font.c  2012-11-05 01:28:04 +0000
--- src/font.c  2013-01-06 05:20:06 +0000
***************
*** 3745,3751 ****
        category = CHAR_TABLE_REF (Vunicode_category_table, c);
        if (INTEGERP (category)
          && (XINT (category) == UNICODE_CATEGORY_Cf
!             || CHAR_VARIATION_SELECTOR_P (c)))
        continue;
        if (NILP (font_object))
        {
--- 3745,3751 ----
        category = CHAR_TABLE_REF (Vunicode_category_table, c);
        if (INTEGERP (category)
          && (XINT (category) == UNICODE_CATEGORY_Cf
!             || (! NILP (font_object) && CHAR_VARIATION_SELECTOR_P (c))))
        continue;
        if (NILP (font_object))
        {




reply via email to

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