From: Kenichi Handa Date: Mon, 25 Feb 2008 01:43:02 +0000 (+0000) Subject: If the font driver doesn't have `shape' function, return Qnil. X-Git-Tag: emacs-pretest-23.0.90~7687 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b876ea9155f1f244515e1af4287b6f899b754db0;p=emacs.git If the font driver doesn't have `shape' function, return Qnil. --- diff --git a/src/font.c b/src/font.c index c63a15889fc..57609a8dab4 100644 --- a/src/font.c +++ b/src/font.c @@ -3625,6 +3625,12 @@ FONT-OBJECT. */) 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 @@ FONT-OBJECT. */) 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++)