emacs-devel
[Top][All Lists]
Advanced

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

Automatic composition case is missing in x_compute_glyph_string_overhang


From: YAMAMOTO Mitsuharu
Subject: Automatic composition case is missing in x_compute_glyph_string_overhangs
Date: Thu, 11 Jun 2009 09:30:46 +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)

I think the automatic composition case is missing in the current
x_compute_glyph_string_overhangs.  With some changes like below, I can
observe a difference as attached.  (The screenshots are those of my
own Mac Core Text font backend driver containing the `shape' function,
not the ns one.)

                                     YAMAMOTO Mitsuharu
                                address@hidden

Index: src/xterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
retrieving revision 1.1026
diff -c -p -r1.1026 xterm.c
*** src/xterm.c 19 May 2009 00:26:46 -0000      1.1026
--- src/xterm.c 11 Jun 2009 00:04:48 -0000
*************** x_compute_glyph_string_overhangs (s)
*** 1194,1209 ****
       struct glyph_string *s;
  {
    if (s->cmp == NULL
!       && s->first_glyph->type == CHAR_GLYPH)
      {
-       unsigned *code = alloca (sizeof (unsigned) * s->nchars);
-       struct font *font = s->font;
        struct font_metrics metrics;
-       int i;
  
!       for (i = 0; i < s->nchars; i++)
!       code[i] = (s->char2b[i].byte1 << 8) | s->char2b[i].byte2;
!       font->driver->text_extents (font, code, s->nchars, &metrics);
        s->right_overhang = (metrics.rbearing > metrics.width
                           ? metrics.rbearing - metrics.width : 0);
        s->left_overhang = metrics.lbearing < 0 ? - metrics.lbearing : 0;
--- 1194,1220 ----
       struct glyph_string *s;
  {
    if (s->cmp == NULL
!       && (s->first_glyph->type == CHAR_GLYPH
!         || s->first_glyph->type == COMPOSITE_GLYPH))
      {
        struct font_metrics metrics;
  
!       if (s->first_glyph->type == CHAR_GLYPH)
!       {
!         unsigned *code = alloca (sizeof (unsigned) * s->nchars);
!         struct font *font = s->font;
!         int i;
! 
!         for (i = 0; i < s->nchars; i++)
!           code[i] = (s->char2b[i].byte1 << 8) | s->char2b[i].byte2;
!         font->driver->text_extents (font, code, s->nchars, &metrics);
!       }
!       else
!       {
!         Lisp_Object gstring = composition_gstring_from_id (s->cmp_id);
! 
!         composition_gstring_width (gstring, s->cmp_from, s->cmp_to, &metrics);
!       }
        s->right_overhang = (metrics.rbearing > metrics.width
                           ? metrics.rbearing - metrics.width : 0);
        s->left_overhang = metrics.lbearing < 0 ? - metrics.lbearing : 0;

PNG image

PNG image


reply via email to

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