unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Automatic composition case is missing in x_compute_glyph_string_overhangs
@ 2009-06-11  0:30 YAMAMOTO Mitsuharu
  2009-06-11  1:26 ` Kenichi Handa
  0 siblings, 1 reply; 4+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-06-11  0:30 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2249 bytes --]

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
				mituharu@math.s.chiba-u.ac.jp

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;

[-- Attachment #2: before.png --]
[-- Type: image/png, Size: 7003 bytes --]

[-- Attachment #3: after.png --]
[-- Type: image/png, Size: 6989 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Automatic composition case is missing in x_compute_glyph_string_overhangs
  2009-06-11  0:30 Automatic composition case is missing in x_compute_glyph_string_overhangs YAMAMOTO Mitsuharu
@ 2009-06-11  1:26 ` Kenichi Handa
  2009-06-11  1:57   ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 4+ messages in thread
From: Kenichi Handa @ 2009-06-11  1:26 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

In article <wlr5xrpq6h.wl%mituharu@math.s.chiba-u.ac.jp>, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:

> 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.)

You are right.  I've just committed your patch.  Thank you.

---
Kenichi Handa
handa@m17n.org




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Automatic composition case is missing in x_compute_glyph_string_overhangs
  2009-06-11  1:26 ` Kenichi Handa
@ 2009-06-11  1:57   ` YAMAMOTO Mitsuharu
  2009-06-11  2:35     ` Kenichi Handa
  0 siblings, 1 reply; 4+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-06-11  1:57 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

>>>>> On Thu, 11 Jun 2009 10:26:46 +0900, Kenichi Handa <handa@m17n.org> said:

> In article <wlr5xrpq6h.wl%mituharu@math.s.chiba-u.ac.jp>, YAMAMOTO
> Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:
>> 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.)

> You are right.  I've just committed your patch.  Thank you.

Thanks.  Could you also check if the following change is correct?

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

Index: src/xdisp.c
===================================================================
RCS file: /sources/emacs/emacs/src/xdisp.c,v
retrieving revision 1.1283
diff -c -p -r1.1283 xdisp.c
*** src/xdisp.c	10 Jun 2009 14:15:50 -0000	1.1283
--- src/xdisp.c	11 Jun 2009 01:51:24 -0000
*************** x_get_glyph_overhangs (glyph, f, left, r
*** 19926,19932 ****
  	  composition_gstring_width (gstring, glyph->u.cmp.from,
  				     glyph->u.cmp.to + 1, &metrics);
  	  if (metrics.rbearing > metrics.width)
! 	    *right = metrics.rbearing;
  	  if (metrics.lbearing < 0)
  	    *left = - metrics.lbearing;
  	}
--- 19926,19932 ----
  	  composition_gstring_width (gstring, glyph->u.cmp.from,
  				     glyph->u.cmp.to + 1, &metrics);
  	  if (metrics.rbearing > metrics.width)
! 	    *right = metrics.rbearing - metrics.width;
  	  if (metrics.lbearing < 0)
  	    *left = - metrics.lbearing;
  	}




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Automatic composition case is missing in x_compute_glyph_string_overhangs
  2009-06-11  1:57   ` YAMAMOTO Mitsuharu
@ 2009-06-11  2:35     ` Kenichi Handa
  0 siblings, 0 replies; 4+ messages in thread
From: Kenichi Handa @ 2009-06-11  2:35 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

In article <wlprdbbkgv.wl%mituharu@math.s.chiba-u.ac.jp>, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:

> Thanks.  Could you also check if the following change is correct?

Yes, I committed it too.

---
Kenichi Handa
handa@m17n.org

> Index: src/xdisp.c
> ===================================================================
> RCS file: /sources/emacs/emacs/src/xdisp.c,v
> retrieving revision 1.1283
> diff -c -p -r1.1283 xdisp.c
> *** src/xdisp.c	10 Jun 2009 14:15:50 -0000	1.1283
> --- src/xdisp.c	11 Jun 2009 01:51:24 -0000
> *************** x_get_glyph_overhangs (glyph, f, left, r
> *** 19926,19932 ****
>   	  composition_gstring_width (gstring, glyph->u.cmp.from,
>   				     glyph->u.cmp.to + 1, &metrics);
>   	  if (metrics.rbearing > metrics.width)
> ! 	    *right = metrics.rbearing;
>   	  if (metrics.lbearing < 0)
>   	    *left = - metrics.lbearing;
>   	}
> --- 19926,19932 ----
>   	  composition_gstring_width (gstring, glyph->u.cmp.from,
>   				     glyph->u.cmp.to + 1, &metrics);
>   	  if (metrics.rbearing > metrics.width)
> ! 	    *right = metrics.rbearing - metrics.width;
>   	  if (metrics.lbearing < 0)
>   	    *left = - metrics.lbearing;
>   	}





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-11  2:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-11  0:30 Automatic composition case is missing in x_compute_glyph_string_overhangs YAMAMOTO Mitsuharu
2009-06-11  1:26 ` Kenichi Handa
2009-06-11  1:57   ` YAMAMOTO Mitsuharu
2009-06-11  2:35     ` Kenichi Handa

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).