diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 1 | ||||
| -rw-r--r-- | src/w32uniscribe.c | 67 |
2 files changed, 19 insertions, 49 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f9bb5b9c3c8..6daa204cb14 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | ABC widths for individual metrics. Map glyph clusters back to | 5 | ABC widths for individual metrics. Map glyph clusters back to |
| 6 | characters using fClusterStart flag. Return number of glyphs | 6 | characters using fClusterStart flag. Return number of glyphs |
| 7 | produced, not chars processed. | 7 | produced, not chars processed. |
| 8 | (uniscribe_shape): Map char at FROM to current glyph. | ||
| 8 | 9 | ||
| 9 | 2008-04-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 10 | 2008-04-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| 10 | 11 | ||
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index 9f78e01082a..7ff0a180b6d 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c | |||
| @@ -307,12 +307,10 @@ uniscribe_shape (lgstring) | |||
| 307 | advances, offsets, &overall_metrics); | 307 | advances, offsets, &overall_metrics); |
| 308 | if (result == 0) /* Success. */ | 308 | if (result == 0) /* Success. */ |
| 309 | { | 309 | { |
| 310 | int j, nclusters, from = 0, to = 0; | 310 | int j, nclusters, from, to; |
| 311 | /* For tracking our mapping of characters to glyphs. | 311 | |
| 312 | Special value -1 means not yet initialized, -2 means | 312 | from = rtl > 0 ? 0 : nchars_in_run - 1; |
| 313 | we've run off the end. Anything else is an index | 313 | to = from; |
| 314 | into the chars and clusters arrays. */ | ||
| 315 | int my_char = -1; | ||
| 316 | 314 | ||
| 317 | for (j = 0; j < nglyphs; j++) | 315 | for (j = 0; j < nglyphs; j++) |
| 318 | { | 316 | { |
| @@ -330,62 +328,33 @@ uniscribe_shape (lgstring) | |||
| 330 | /* Detect clusters, for linking codes back to characters. */ | 328 | /* Detect clusters, for linking codes back to characters. */ |
| 331 | if (attributes[j].fClusterStart) | 329 | if (attributes[j].fClusterStart) |
| 332 | { | 330 | { |
| 333 | /* First time, set to appropriate end of run. */ | 331 | while (from >= 0 && from < nchars_in_run |
| 334 | if (my_char == -1) | 332 | && clusters[from] < j) |
| 335 | my_char = rtl > 0 ? 0 : nchars_in_run - 1; | 333 | from += rtl; |
| 336 | else if (my_char >= 0) | 334 | if (from < 0) |
| 337 | my_char += rtl; | 335 | from = to = 0; |
| 338 | while (my_char >= 0 && my_char < nchars_in_run | 336 | else if (from >= nchars_in_run) |
| 339 | && clusters[my_char] < j) | 337 | from = to = nchars_in_run - 1; |
| 340 | my_char += rtl; | ||
| 341 | |||
| 342 | if (my_char < 0 || my_char >= nchars_in_run) | ||
| 343 | my_char = -2; | ||
| 344 | |||
| 345 | /* FROM and TO as char indices. This produces | ||
| 346 | much better results at small font sizes than | ||
| 347 | earlier attempts at using glyph indices for | ||
| 348 | FROM and TO, but the output still isn't quite | ||
| 349 | right. For example, on the first South Asia | ||
| 350 | line of etc/HELLO, the third example | ||
| 351 | (Kannada) is missing the last glyph. This | ||
| 352 | seems to be caused by the fact that more | ||
| 353 | glyphs are produced than there are characters | ||
| 354 | in the output (other scripts on that line | ||
| 355 | result in the same or fewer glyphs). */ | ||
| 356 | if (my_char < 0) | ||
| 357 | from = to = rtl > 0 ? nchars_in_run - 1: 0; | ||
| 358 | else | 338 | else |
| 359 | { | 339 | { |
| 360 | int k; | 340 | int k; |
| 361 | from = my_char; | 341 | to = rtl > 0 ? nchars_in_run - 1 : 0; |
| 362 | to = rtl > 0 ? nchars_in_run : 0; | 342 | for (k = from + rtl; k >= 0 && k < nchars_in_run; |
| 363 | for (k = my_char + rtl; k >= 0 && k < nchars_in_run; | ||
| 364 | k += rtl) | 343 | k += rtl) |
| 365 | { | 344 | { |
| 366 | if (clusters[k] > j) | 345 | if (clusters[k] > j) |
| 367 | { | 346 | { |
| 368 | to = k; | 347 | to = k - 1; |
| 369 | break; | 348 | break; |
| 370 | } | 349 | } |
| 371 | } | 350 | } |
| 372 | } | 351 | } |
| 373 | } | 352 | } |
| 374 | 353 | ||
| 375 | if (my_char < 0 || clusters[my_char] > j) | 354 | LGLYPH_SET_CHAR (lglyph, chars[items[i].iCharPos |
| 376 | { | 355 | + from]); |
| 377 | /* No mapping. */ | 356 | LGLYPH_SET_FROM (lglyph, items[i].iCharPos + from); |
| 378 | LGLYPH_SET_CHAR (lglyph, 0); | 357 | LGLYPH_SET_TO (lglyph, items[i].iCharPos + to); |
| 379 | LGLYPH_SET_FROM (lglyph, items[i].iCharPos + from); | ||
| 380 | LGLYPH_SET_TO (lglyph, items[i].iCharPos + to); | ||
| 381 | } | ||
| 382 | else | ||
| 383 | { | ||
| 384 | LGLYPH_SET_CHAR (lglyph, chars[items[i].iCharPos | ||
| 385 | + my_char]); | ||
| 386 | LGLYPH_SET_FROM (lglyph, items[i].iCharPos + from); | ||
| 387 | LGLYPH_SET_TO (lglyph, items[i].iCharPos + to); | ||
| 388 | } | ||
| 389 | 358 | ||
| 390 | /* Metrics. */ | 359 | /* Metrics. */ |
| 391 | LGLYPH_SET_WIDTH (lglyph, advances[j]); | 360 | LGLYPH_SET_WIDTH (lglyph, advances[j]); |