unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@gnu.org>
To: Kenichi Handa <handa@gnu.org>
Cc: 11860@debbugs.gnu.org, smias@yandex.ru
Subject: bug#11860: 24.1; Arabic - Harakat (diacritics, short vowels) don't appear
Date: Sun, 16 Sep 2012 21:03:25 +0900	[thread overview]
Message-ID: <87k3vudvjm.fsf@gnu.org> (raw)
In-Reply-To: <87bohcty0r.fsf@gnu.org> (message from Kenichi Handa on Tue, 11 Sep 2012 23:49:40 +0900)

In article <87bohcty0r.fsf@gnu.org>, Kenichi Handa <handa@gnu.org> writes:

> I'll try to fix Ffont_shape_gstring, and check whether or
> not it breaks rendersing of some scripts.

I've just installed this change.  With this change, I tried
to render several scripts that require CTL (complex text
layout) while setting a breakpoint at this line:
  shaper_error:
    return Qnil;
but, Emacs has never reach that line on GNU/Linux system
(i.e. with m17n-lib and libotf).

---
Kenichi Handa
handa@gnu.org

=== modified file 'src/font.c'
--- src/font.c	2012-09-15 07:06:56 +0000
+++ src/font.c	2012-09-16 11:47:45 +0000
@@ -4295,7 +4295,10 @@
 header of the glyph-string.
 
 If the shaping was successful, the value is GSTRING itself or a newly
-created glyph-string.  Otherwise, the value is nil.  */)
+created glyph-string.  Otherwise, the value is nil.
+
+See the documentation of `composition-get-gstring' for the format of
+GSTRING.  */)
   (Lisp_Object gstring)
 {
   struct font *font;
@@ -4326,44 +4329,45 @@
   if (XINT (n) < LGSTRING_GLYPH_LEN (gstring))
     LGSTRING_SET_GLYPH (gstring, XINT (n), Qnil);
 
+  /* Check FROM_IDX and TO_IDX of each GLYPH in GSTRING to assure that
+     GLYPHS covers all characters in GSTRING.  More formally, provided
+     that NCHARS is the number of characters in GSTRING, N is the
+     number of glyphs, and GLYPHS[i] is the ith glyph, FROM_IDX and
+     TO_IDX of each glyph must satisfy these conditions:
+
+       GLYPHS[0].FROM_IDX == 0
+       GLYPHS[i].FROM_IDX <= GLYPHS[i].TO_IDX
+       if (GLYPHS[i].FROM_IDX == GLYPHS[i-1].FROM_IDX)
+         ;; GLYPHS[i] and GLYPHS[i-1] belongs to the same grapheme cluster
+         GLYPHS[i].TO_IDX == GLYPHS[i-1].TO_IDX
+       else
+         ;; Be sure to cover all characters.
+         GLYPHS[i].FROM_IDX == GLYPHS[i-1].TO_IDX + 1
+       GLYPHS[N-1].TO_IDX == NCHARS - 1 */
   glyph = LGSTRING_GLYPH (gstring, 0);
   from = LGLYPH_FROM (glyph);
   to = LGLYPH_TO (glyph);
-  for (i = 1, j = 0; i < LGSTRING_GLYPH_LEN (gstring); i++)
+  if (from != 0 || to < from)
+    goto shaper_error;
+  for (i = 1; i < LGSTRING_GLYPH_LEN (gstring); i++)
     {
-      Lisp_Object this = LGSTRING_GLYPH (gstring, i);
-
-      if (NILP (this))
+      glyph = LGSTRING_GLYPH (gstring, i);
+      if (NILP (glyph))
 	break;
-      if (NILP (LGLYPH_ADJUSTMENT (this)))
-	{
-	  if (j < i - 1)
-	    for (; j < i; j++)
-	      {
-		glyph = LGSTRING_GLYPH (gstring, j);
-		LGLYPH_SET_FROM (glyph, from);
-		LGLYPH_SET_TO (glyph, to);
-	      }
-	  from = LGLYPH_FROM (this);
-	  to = LGLYPH_TO (this);
-	  j = i;
-	}
-      else
-	{
-	  if (from > LGLYPH_FROM (this))
-	    from = LGLYPH_FROM (this);
-	  if (to < LGLYPH_TO (this))
-	    to = LGLYPH_TO (this);
-	}
+      if (! (LGLYPH_FROM (glyph) <= LGLYPH_TO (glyph)
+	     && (LGLYPH_FROM (glyph) == from
+		 ? LGLYPH_TO (glyph) == to
+		 : LGLYPH_FROM (glyph) == to + 1)))
+	goto shaper_error;
+      from = LGLYPH_FROM (glyph);
+      to = LGLYPH_TO (glyph);
     }
-  if (j < i - 1)
-    for (; j < i; j++)
-      {
-	glyph = LGSTRING_GLYPH (gstring, j);
-	LGLYPH_SET_FROM (glyph, from);
-	LGLYPH_SET_TO (glyph, to);
-      }
+  if (to != LGSTRING_CHAR_LEN (gstring) - 1)
+    goto shaper_error;
   return composition_gstring_put_cache (gstring, XINT (n));
+
+ shaper_error:
+  return Qnil;
 }
 
 DEFUN ("font-variation-glyphs", Ffont_variation_glyphs, Sfont_variation_glyphs,






  parent reply	other threads:[~2012-09-16 12:03 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-04  9:17 bug#11860: 24.1; Arabic - Harakat (diacritics, short vowels) don't appear Steffan
2012-07-04 20:22 ` Eli Zaretskii
2012-07-05 17:53 ` Steffan
2012-08-05  5:27 ` Steffan
2012-08-05 15:49   ` Eli Zaretskii
2012-08-13  0:02     ` Kenichi Handa
2012-08-18  2:45       ` Kenichi Handa
2012-08-18  7:14         ` Eli Zaretskii
2012-08-18  9:19           ` Kenichi Handa
2012-08-18 15:33             ` Eli Zaretskii
2012-08-19  7:32               ` YAMAMOTO Mitsuharu
2012-08-19 12:51                 ` Kenichi Handa
2012-08-19 13:20               ` Kenichi Handa
2012-08-19 18:44                 ` Eli Zaretskii
2012-08-19 18:53                   ` Werner LEMBERG
2012-08-20 17:24                   ` Eli Zaretskii
2012-08-19  3:02             ` Jason Rumney
2012-08-19 13:37               ` Kenichi Handa
2012-08-19 16:16                 ` Jason Rumney
2012-08-19 18:54                   ` Eli Zaretskii
2012-08-20 14:57                     ` Kenichi Handa
2012-08-20 17:16                       ` Eli Zaretskii
2012-08-21  9:20                         ` Kenichi Handa
2012-08-19 18:52                 ` Eli Zaretskii
2012-08-19 17:56               ` Eli Zaretskii
2012-08-19  4:34         ` YAMAMOTO Mitsuharu
2012-09-09  4:06           ` YAMAMOTO Mitsuharu
2012-09-11 14:49             ` Kenichi Handa
2012-09-11 17:48               ` Eli Zaretskii
2012-09-12 13:14                 ` Kenichi Handa
2012-09-12 16:34                   ` Eli Zaretskii
2012-09-13  6:07                     ` Kenichi Handa
2012-09-13 17:00                       ` Eli Zaretskii
2012-09-13 23:26                         ` Kenichi Handa
2012-09-16 12:03               ` Kenichi Handa [this message]
2012-09-16 12:41                 ` Eli Zaretskii
2012-09-16 15:43                   ` Stefan Monnier
2012-09-16 15:50                     ` Eli Zaretskii
2012-09-17 14:08                       ` Kenichi Handa
2012-09-17 16:58                         ` Stefan Monnier
2012-08-19 18:22         ` Eli Zaretskii
2012-08-21 13:16           ` Kenichi Handa
2012-08-21 17:32             ` Eli Zaretskii
2012-08-22  9:15               ` Kenichi Handa
2012-08-22 19:52 ` Steffan
2012-08-23  2:50   ` Eli Zaretskii
2012-08-22 21:40 ` Steffan
2012-08-23  2:49   ` Eli Zaretskii
2012-08-27 21:10 ` Steffan
2012-08-29  8:09   ` Kenichi Handa
2012-09-01 13:59     ` Eli Zaretskii
2012-09-03 13:55       ` Kenichi Handa
2012-09-03 15:53         ` Eli Zaretskii
2012-09-04  9:03           ` Kenichi Handa
2012-08-29  8:57 ` Steffan
2012-09-01 14:06   ` Eli Zaretskii
2012-09-03 15:31 ` Steffan
2012-09-03 16:28   ` Eli Zaretskii
2012-09-04 17:18   ` Eli Zaretskii
2012-09-03 16:24 ` Steffan
2012-09-03 17:49 ` Steffan
2012-09-06  2:09   ` YAMAMOTO Mitsuharu
2012-09-06  8:52 ` Steffan
2012-09-06  9:56   ` YAMAMOTO Mitsuharu
2012-09-06 10:47     ` Eli Zaretskii
2012-09-06 14:52 ` Steffan
2012-09-10 16:13 ` Steffan
2020-08-17 22:45 ` Stefan Kangas
2020-08-18  4:40   ` Eli Zaretskii
2020-08-18  9:47     ` Stefan Kangas
     [not found] <14231341502795@web11e.yandex.ru>
2012-07-05 17:16 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k3vudvjm.fsf@gnu.org \
    --to=handa@gnu.org \
    --cc=11860@debbugs.gnu.org \
    --cc=smias@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).