diff options
| author | Eli Zaretskii | 2012-09-01 16:54:27 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2012-09-01 16:54:27 +0300 |
| commit | 7e510e2844732d53563abd45ec60df7de2129246 (patch) | |
| tree | d4c746a7431158484f3c91bfc1d95c352594987d /src | |
| parent | f18cbb28c26c300dbe37de6950d4ef918de9c61b (diff) | |
| download | emacs-7e510e2844732d53563abd45ec60df7de2129246.tar.gz emacs-7e510e2844732d53563abd45ec60df7de2129246.zip | |
Further fix for bug #11860 with Arabic display on Windows.
src/w32uniscribe.c (uniscribe_shape): Handle correctly the case of
more than one grapheme cluster passed to the shaper: compute the
offset adjustment values separately for each cluster.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/w32uniscribe.c | 42 |
2 files changed, 30 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5b58d77e54a..e186b8af87f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2012-09-01 Eli Zaretskii <eliz@gnu.org> | 1 | 2012-09-01 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * w32uniscribe.c (uniscribe_shape): Handle correctly the case of | ||
| 4 | more than one grapheme cluster passed to the shaper: compute the | ||
| 5 | offset adjustment values separately for each cluster. (Bug#11860) | ||
| 6 | |||
| 3 | * image.c: Restore mistakenly removed inclusion of w32.h. Without | 7 | * image.c: Restore mistakenly removed inclusion of w32.h. Without |
| 4 | it, GCC doesn't see prototypes of w32_delayed_load, and complains | 8 | it, GCC doesn't see prototypes of w32_delayed_load, and complains |
| 5 | about implicit conversions from integer to pointer. | 9 | about implicit conversions from integer to pointer. |
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index 50532acaff3..bc45e2c648c 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c | |||
| @@ -322,22 +322,6 @@ uniscribe_shape (Lisp_Object lgstring) | |||
| 322 | { | 322 | { |
| 323 | int j, from, to, adj_offset = 0; | 323 | int j, from, to, adj_offset = 0; |
| 324 | 324 | ||
| 325 | /* For RTL text, the Uniscribe shaper prepares the | ||
| 326 | values in ADVANCES array for layout in reverse order, | ||
| 327 | whereby "advance width" is applied to move the pen in | ||
| 328 | reverse direction and _before_ drawing the glyph. | ||
| 329 | Since we draw glyphs in their normal left-to-right | ||
| 330 | order, we need to adjust the coordinates of each | ||
| 331 | non-base glyph in a grapheme cluster via X-OFF | ||
| 332 | component of the gstring's ADJUSTMENT sub-vector. | ||
| 333 | This loop computes the initial value of the | ||
| 334 | adjustment for the base character, which is then | ||
| 335 | updated for each successive glyph in the grapheme | ||
| 336 | cluster. */ | ||
| 337 | if (items[i].a.fRTL) | ||
| 338 | for (j = 1; j < nglyphs; j++) | ||
| 339 | adj_offset += advances[j]; | ||
| 340 | |||
| 341 | from = 0; | 325 | from = 0; |
| 342 | to = from; | 326 | to = from; |
| 343 | 327 | ||
| @@ -380,6 +364,32 @@ uniscribe_shape (Lisp_Object lgstring) | |||
| 380 | } | 364 | } |
| 381 | } | 365 | } |
| 382 | } | 366 | } |
| 367 | |||
| 368 | /* For RTL text, the Uniscribe shaper prepares | ||
| 369 | the values in ADVANCES array for layout in | ||
| 370 | reverse order, whereby "advance width" is | ||
| 371 | applied to move the pen in reverse direction | ||
| 372 | and _before_ drawing the glyph. Since we | ||
| 373 | draw glyphs in their normal left-to-right | ||
| 374 | order, we need to adjust the coordinates of | ||
| 375 | each non-base glyph in a grapheme cluster via | ||
| 376 | X-OFF component of the gstring's ADJUSTMENT | ||
| 377 | sub-vector. This loop computes, for each | ||
| 378 | grapheme cluster, the initial value of the | ||
| 379 | adjustment for the base character, which is | ||
| 380 | then updated for each successive glyph in the | ||
| 381 | grapheme cluster. */ | ||
| 382 | if (items[i].a.fRTL) | ||
| 383 | { | ||
| 384 | int j1 = j; | ||
| 385 | |||
| 386 | adj_offset = 0; | ||
| 387 | while (j1 < nglyphs && !attributes[j1].fClusterStart) | ||
| 388 | { | ||
| 389 | adj_offset += advances[j1]; | ||
| 390 | j1++; | ||
| 391 | } | ||
| 392 | } | ||
| 383 | } | 393 | } |
| 384 | 394 | ||
| 385 | LGLYPH_SET_CHAR (lglyph, chars[items[i].iCharPos | 395 | LGLYPH_SET_CHAR (lglyph, chars[items[i].iCharPos |