aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2008-01-07 02:02:05 +0000
committerKenichi Handa2008-01-07 02:02:05 +0000
commite8912e41f82c859e38a6d52443d8667974377bee (patch)
tree4fbc69ef5f9b7048631c23f75b1b860e6b31e1fd /src
parent0c757b8d8fc7a7a8ac5f0def29ffcef40eb16ffb (diff)
downloademacs-e8912e41f82c859e38a6d52443d8667974377bee.tar.gz
emacs-e8912e41f82c859e38a6d52443d8667974377bee.zip
(Ffont_shape_text): If the font driver doesn't have a
shaper function, make zero-width glyphs to have at least one-pixel width.
Diffstat (limited to 'src')
-rw-r--r--src/font.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/src/font.c b/src/font.c
index 8347a0d5b23..9a0e621d95f 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3567,12 +3567,42 @@ FONT-OBJECT. */)
3567 } 3567 }
3568 3568
3569 CHECK_FONT_GET_OBJECT (font_object, font); 3569 CHECK_FONT_GET_OBJECT (font_object, font);
3570 if (! font->driver->shape)
3571 return from;
3572
3573 len = end - start; 3570 len = end - start;
3574 gstring = Ffont_make_gstring (font_object, make_number (len)); 3571 gstring = Ffont_make_gstring (font_object, make_number (len));
3575 Ffont_fill_gstring (gstring, font_object, from, to, string); 3572 Ffont_fill_gstring (gstring, font_object, from, to, string);
3573 if (! font->driver->shape)
3574 {
3575 /* Make zero-width glyphs to have one pixel width to make the
3576 display routine not lose the cursor. */
3577 for (i = 0; i < len; i++)
3578 {
3579 Lisp_Object g = LGSTRING_GLYPH (gstring, i);
3580 unsigned code = LGLYPH_CODE (g);
3581 struct font_metrics metrics;
3582
3583 if (font->driver->text_extents (font, &code, 1, &metrics) == 0)
3584 {
3585 Lisp_Object gstr = Ffont_make_gstring (font_object,
3586 make_number (1));
3587 LGSTRING_SET_WIDTH (gstr, 1);
3588 LGSTRING_SET_LBEARING (gstr, metrics.lbearing);
3589 LGSTRING_SET_RBEARING (gstr, metrics.rbearing + 1);
3590 LGSTRING_SET_ASCENT (gstr, metrics.ascent);
3591 LGSTRING_SET_DESCENT (gstr, metrics.descent);
3592 LGLYPH_SET_FROM (g, 0);
3593 LGLYPH_SET_TO (g, 1);
3594 LGSTRING_SET_GLYPH (gstr, 0, g);
3595 from = make_number (start + i);
3596 to = make_number (start + i + 1);
3597 if (NILP (string))
3598 Fcompose_region_internal (from, to, gstr, Qnil);
3599 else
3600 Fcompose_region_internal (string, from, to, gstr, Qnil);
3601 }
3602 }
3603 return make_number (end);
3604 }
3605
3576 3606
3577 /* Try at most three times with larger gstring each time. */ 3607 /* Try at most three times with larger gstring each time. */
3578 for (i = 0; i < 3; i++) 3608 for (i = 0; i < 3; i++)
@@ -3653,7 +3683,13 @@ FONT-OBJECT. */)
3653 LGSTRING_SET_ASCENT (gstr, metrics.ascent); 3683 LGSTRING_SET_ASCENT (gstr, metrics.ascent);
3654 LGSTRING_SET_DESCENT (gstr, metrics.descent); 3684 LGSTRING_SET_DESCENT (gstr, metrics.descent);
3655 for (k = i; i < j; i++) 3685 for (k = i; i < j; i++)
3656 LGSTRING_SET_GLYPH (gstr, i - k, LGSTRING_GLYPH (gstring, i)); 3686 {
3687 Lisp_Object g = LGSTRING_GLYPH (gstring, i);
3688
3689 LGLYPH_SET_FROM (g, LGLYPH_FROM (g) - this_from);
3690 LGLYPH_SET_TO (g, LGLYPH_TO (g) - this_to);
3691 LGSTRING_SET_GLYPH (gstr, i - k, LGSTRING_GLYPH (gstring, i));
3692 }
3657 from = make_number (start + this_from); 3693 from = make_number (start + this_from);
3658 to = make_number (start + this_to); 3694 to = make_number (start + this_to);
3659 if (NILP (string)) 3695 if (NILP (string))