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

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