From fc3a285ed7c00f251e1ed7e85f1e6014918d9a7a Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 10 Sep 2008 05:54:23 +0000 Subject: [PATCH] (Ffont_shape_gstring): Make glyphs of non-nil adjustment compose a grapheme cluster with the preceding base glyph. --- src/ChangeLog | 7 +++++++ src/font.c | 35 +++++++++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5fbadba606..b8333c6bb2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2008-09-10 Kenichi Handa + + * font.c (Ffont_shape_gstring): Make glyphs of non-nil adjustment + compose a grapheme cluster with the preceding base glyph. + + * composite.c (composition_compute_stop_pos): Fix previous change. + 2008-09-10 Glenn Morris * Makefile.in (character.o, chartab.o): Fix config.h typo. diff --git a/src/font.c b/src/font.c index 340b69869a..ba05b57a00 100644 --- a/src/font.c +++ b/src/font.c @@ -4224,7 +4224,7 @@ created glyph-string. Otherwise, the value is nil. */) { struct font *font; Lisp_Object font_object, n, glyph; - int i; + int i, j, from, to; if (! composition_gstring_p (gstring)) signal_error ("Invalid glyph-string: ", gstring); @@ -4250,23 +4250,42 @@ created glyph-string. Otherwise, the value is nil. */) return Qnil; glyph = LGSTRING_GLYPH (gstring, 0); - for (i = 1; i < LGSTRING_GLYPH_LEN (gstring); i++) + from = LGLYPH_FROM (glyph); + to = LGLYPH_TO (glyph); + for (i = 1, j = 0; i < LGSTRING_GLYPH_LEN (gstring); i++) { Lisp_Object this = LGSTRING_GLYPH (gstring, i); if (NILP (this)) break; if (NILP (LGLYPH_ADJUSTMENT (this))) - glyph = 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 { - int from = LGLYPH_FROM (glyph); - int to = LGLYPH_TO (glyph); - - LGLYPH_SET_FROM (this, from); - LGLYPH_SET_TO (this, to); + if (from > LGLYPH_FROM (this)) + from = LGLYPH_FROM (this); + if (to < LGLYPH_TO (this)) + to = LGLYPH_TO (this); } } + if (j < i - 1) + for (; j < i; j++) + { + glyph = LGSTRING_GLYPH (gstring, j); + LGLYPH_SET_FROM (glyph, from); + LGLYPH_SET_TO (glyph, to); + } return composition_gstring_put_cache (gstring, XINT (n)); } -- 2.20.1