changeset 92183:275e5e980fc4

If the font driver doesn't have `shape' function, return Qnil.
author Kenichi Handa <handa@m17n.org>
date Mon, 25 Feb 2008 01:43:02 +0000
parents 7545cca794d5
children 6218afb021ac
files src/font.c
diffstat 1 files changed, 6 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/src/font.c	Mon Feb 25 01:40:09 2008 +0000
+++ b/src/font.c	Mon Feb 25 01:43:02 2008 +0000
@@ -3625,6 +3625,12 @@
   Lisp_Object gstring, n;
   int len, i, j;
 
+  if (! FONT_OBJECT_P (font_object))
+    return Qnil;
+  CHECK_FONT_GET_OBJECT (font_object, font);
+  if (! font->driver->shape)
+    return Qnil;
+
   if (NILP (string))
     {
       validate_region (&from, &to);
@@ -3641,49 +3647,9 @@
 	args_out_of_range_3 (string, from, to);
     }
 
-  if (! FONT_OBJECT_P (font_object))
-    return to;
-
-  CHECK_FONT_GET_OBJECT (font_object, font);
   len = end - start;
   gstring = Ffont_make_gstring (font_object, make_number (len));
   Ffont_fill_gstring (gstring, font_object, from, to, string);
-  if (! font->driver->shape)
-    {
-      /* Make zero-width glyphs to have one pixel width to make the
-	 display routine not lose the cursor.  */
-      for (i = 0; i < len; i++)
-	{
-	  Lisp_Object g = LGSTRING_GLYPH (gstring, i);
-	  unsigned code;
-	  struct font_metrics metrics;
-
-	  if (NILP (g))
-	    break;
-	  code = LGLYPH_CODE (g);
-	  if (font->driver->text_extents (font, &code, 1, &metrics) == 0)
-	    {
-	      Lisp_Object gstr = Ffont_make_gstring (font_object,
-						     make_number (1));
-	      LGSTRING_SET_WIDTH (gstr, 1);
-	      LGSTRING_SET_LBEARING (gstr, metrics.lbearing);
-	      LGSTRING_SET_RBEARING (gstr, metrics.rbearing + 1);
-	      LGSTRING_SET_ASCENT (gstr, metrics.ascent);
-	      LGSTRING_SET_DESCENT (gstr, metrics.descent);
-	      LGLYPH_SET_FROM (g, 0);
-	      LGLYPH_SET_TO (g, 1);
-	      LGSTRING_SET_GLYPH (gstr, 0, g);
-	      from = make_number (start + i);
-	      to = make_number (start + i + 1);
-	      if (NILP (string))
-		Fcompose_region_internal (from, to, gstr, Qnil);
-	      else
-		Fcompose_string_internal (string, from, to, gstr, Qnil);
-	    }
-	}
-      return make_number (end);
-    }
-
   
   /* Try at most three times with larger gstring each time.  */
   for (i = 0; i < 3; i++)