diff options
| author | Kenichi Handa | 2012-09-15 11:24:26 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-09-15 11:24:26 +0900 |
| commit | ea964864a66828ce2457e44c4c670160d5879ec6 (patch) | |
| tree | 48b4d1327b9ec3b7dea1cbf50045f1df8ca28f10 /src | |
| parent | 33bd7ff0f66acdab978b5c67e76c3676286ab3e6 (diff) | |
| download | emacs-ea964864a66828ce2457e44c4c670160d5879ec6.tar.gz emacs-ea964864a66828ce2457e44c4c670160d5879ec6.zip | |
font.c (Ffont_shape_gstring): Don't adjust grapheme cluster here, but just check the validity of glyphs in the glyph-string.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/font.c | 70 |
2 files changed, 42 insertions, 33 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5cda8241916..e598d4d465a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-09-15 Kenichi Handa <handa@gnu.org> | ||
| 2 | |||
| 3 | * font.c (Ffont_shape_gstring): Don't adjust grapheme cluster | ||
| 4 | here, but just check the validity of glyphs in the glyph-string. | ||
| 5 | |||
| 1 | 2012-09-14 Martin Rudalics <rudalics@gmx.at> | 6 | 2012-09-14 Martin Rudalics <rudalics@gmx.at> |
| 2 | 7 | ||
| 3 | * xdisp.c (Fformat_mode_line): Unconditionally save/restore | 8 | * xdisp.c (Fformat_mode_line): Unconditionally save/restore |
diff --git a/src/font.c b/src/font.c index 49a09bced28..ccbeb9956f4 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -4296,7 +4296,10 @@ to get the correct visual image of character sequences set in the | |||
| 4296 | header of the glyph-string. | 4296 | header of the glyph-string. |
| 4297 | 4297 | ||
| 4298 | If the shaping was successful, the value is GSTRING itself or a newly | 4298 | If the shaping was successful, the value is GSTRING itself or a newly |
| 4299 | created glyph-string. Otherwise, the value is nil. */) | 4299 | created glyph-string. Otherwise, the value is nil. |
| 4300 | |||
| 4301 | See the documentation of `composition-get-gstring' for the format of | ||
| 4302 | GSTRING. */) | ||
| 4300 | (Lisp_Object gstring) | 4303 | (Lisp_Object gstring) |
| 4301 | { | 4304 | { |
| 4302 | struct font *font; | 4305 | struct font *font; |
| @@ -4327,44 +4330,45 @@ created glyph-string. Otherwise, the value is nil. */) | |||
| 4327 | if (XINT (n) < LGSTRING_GLYPH_LEN (gstring)) | 4330 | if (XINT (n) < LGSTRING_GLYPH_LEN (gstring)) |
| 4328 | LGSTRING_SET_GLYPH (gstring, XINT (n), Qnil); | 4331 | LGSTRING_SET_GLYPH (gstring, XINT (n), Qnil); |
| 4329 | 4332 | ||
| 4333 | /* Check FROM_IDX and TO_IDX of each GLYPH in GSTRING to assure that | ||
| 4334 | GLYPHS covers all characters in GSTRING. More formally, provided | ||
| 4335 | that NCHARS is the number of characters in GSTRING, N is the | ||
| 4336 | number of glyphs, and GLYPHS[i] is the ith glyph, FROM_IDX and | ||
| 4337 | TO_IDX of each glyph must satisfy these conditions: | ||
| 4338 | |||
| 4339 | GLYPHS[0].FROM_IDX == 0 | ||
| 4340 | GLYPHS[i].FROM_IDX <= GLYPHS[i].TO_IDX | ||
| 4341 | if (GLYPHS[i].FROM_IDX == GLYPHS[i-1].FROM_IDX) | ||
| 4342 | ;; GLYPHS[i] and GLYPHS[i-1] belongs to the same grapheme cluster | ||
| 4343 | GLYPHS[i].TO_IDX == GLYPHS[i-1].TO_IDX | ||
| 4344 | else | ||
| 4345 | ;; Be sure to cover all characters. | ||
| 4346 | GLYPHS[i].FROM_IDX == GLYPHS[i-1].TO_IDX + 1 | ||
| 4347 | GLYPHS[N-1].TO_IDX == NCHARS - 1 */ | ||
| 4330 | glyph = LGSTRING_GLYPH (gstring, 0); | 4348 | glyph = LGSTRING_GLYPH (gstring, 0); |
| 4331 | from = LGLYPH_FROM (glyph); | 4349 | from = LGLYPH_FROM (glyph); |
| 4332 | to = LGLYPH_TO (glyph); | 4350 | to = LGLYPH_TO (glyph); |
| 4333 | for (i = 1, j = 0; i < LGSTRING_GLYPH_LEN (gstring); i++) | 4351 | if (from != 0 || to < from) |
| 4352 | goto shaper_error; | ||
| 4353 | for (i = 1; i < LGSTRING_GLYPH_LEN (gstring); i++) | ||
| 4334 | { | 4354 | { |
| 4335 | Lisp_Object this = LGSTRING_GLYPH (gstring, i); | 4355 | glyph = LGSTRING_GLYPH (gstring, i); |
| 4336 | 4356 | if (NILP (glyph)) | |
| 4337 | if (NILP (this)) | ||
| 4338 | break; | 4357 | break; |
| 4339 | if (NILP (LGLYPH_ADJUSTMENT (this))) | 4358 | if (! (LGLYPH_FROM (glyph) <= LGLYPH_TO (glyph) |
| 4340 | { | 4359 | && (LGLYPH_FROM (glyph) == from |
| 4341 | if (j < i - 1) | 4360 | ? LGLYPH_TO (glyph) == to |
| 4342 | for (; j < i; j++) | 4361 | : LGLYPH_FROM (glyph) == to + 1))) |
| 4343 | { | 4362 | goto shaper_error; |
| 4344 | glyph = LGSTRING_GLYPH (gstring, j); | 4363 | from = LGLYPH_FROM (glyph); |
| 4345 | LGLYPH_SET_FROM (glyph, from); | 4364 | to = LGLYPH_TO (glyph); |
| 4346 | LGLYPH_SET_TO (glyph, to); | 4365 | } |
| 4347 | } | 4366 | if (to != LGSTRING_CHAR_LEN (gstring) - 1) |
| 4348 | from = LGLYPH_FROM (this); | 4367 | goto shaper_error; |
| 4349 | to = LGLYPH_TO (this); | ||
| 4350 | j = i; | ||
| 4351 | } | ||
| 4352 | else | ||
| 4353 | { | ||
| 4354 | if (from > LGLYPH_FROM (this)) | ||
| 4355 | from = LGLYPH_FROM (this); | ||
| 4356 | if (to < LGLYPH_TO (this)) | ||
| 4357 | to = LGLYPH_TO (this); | ||
| 4358 | } | ||
| 4359 | } | ||
| 4360 | if (j < i - 1) | ||
| 4361 | for (; j < i; j++) | ||
| 4362 | { | ||
| 4363 | glyph = LGSTRING_GLYPH (gstring, j); | ||
| 4364 | LGLYPH_SET_FROM (glyph, from); | ||
| 4365 | LGLYPH_SET_TO (glyph, to); | ||
| 4366 | } | ||
| 4367 | return composition_gstring_put_cache (gstring, XINT (n)); | 4368 | return composition_gstring_put_cache (gstring, XINT (n)); |
| 4369 | |||
| 4370 | shaper_error: | ||
| 4371 | return Qnil; | ||
| 4368 | } | 4372 | } |
| 4369 | 4373 | ||
| 4370 | DEFUN ("font-variation-glyphs", Ffont_variation_glyphs, Sfont_variation_glyphs, | 4374 | DEFUN ("font-variation-glyphs", Ffont_variation_glyphs, Sfont_variation_glyphs, |