From: handa Date: Wed, 3 Dec 2008 00:42:50 +0000 (+0000) Subject: (update_seq_area): Call OTF_drive_gpos2 X-Git-Tag: REL-0-9-9~39 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=bccce84cf559f9992683d11fa7157987e1ab81e1;p=m17n%2Flibotf.git (update_seq_area): Call OTF_drive_gpos2 instead of OTF_drive_gpos. Handle the accumulated positioning. --- diff --git a/example/otfview.c b/example/otfview.c index f8d9eca..464037a 100644 --- a/example/otfview.c +++ b/example/otfview.c @@ -339,7 +339,7 @@ update_seq_area () str = get_features (&otf->gpos->FeatureList, &gpos); if (str) { - OTF_drive_gpos (otf, &gstring, NULL, NULL, str); + OTF_drive_gpos2 (otf, &gstring, NULL, NULL, str); free (str); } } @@ -375,69 +375,78 @@ update_seq_area () int prev_width; int advance = bmp->advance; - if (! bmp->pixmap) + if (gstring.glyphs[i].glyph_id && ! bmp->pixmap) { create_pixmap (gstring.glyphs[i].glyph_id); if (! bmp->pixmap) continue; advance = bmp->advance; } - switch (g->positioning_type) + if (g->positioning_type) { - case 0: - break; - - case 1: case 2: - { - int format = g->f.f1.format; - - if (format & OTF_XPlacement) - xoff = g->f.f1.value->XPlacement * pixel_size / unitsPerEm; - if (format & OTF_XPlaDevice) - xoff += DEVICE_DELTA (g->f.f1.value->XPlaDevice, pixel_size); - if (format & OTF_YPlacement) - yoff = g->f.f1.value->YPlacement * pixel_size / unitsPerEm; - if (format & OTF_YPlaDevice) - yoff += DEVICE_DELTA (g->f.f1.value->YPlaDevice, pixel_size); - if (format & OTF_XAdvance) - advance += g->f.f1.value->XAdvance * pixel_size / unitsPerEm; - if (format & OTF_XAdvDevice) - advance += DEVICE_DELTA (g->f.f1.value->XAdvDevice, pixel_size); - } - break; + while (1) + { + switch (g->positioning_type) + { + case 1: case 2: + { + int format = g->f.f1.format; + + if (format & OTF_XPlacement) + xoff = g->f.f1.value->XPlacement * pixel_size / unitsPerEm; + if (format & OTF_XPlaDevice) + xoff += DEVICE_DELTA (g->f.f1.value->XPlaDevice, pixel_size); + if (format & OTF_YPlacement) + yoff = g->f.f1.value->YPlacement * pixel_size / unitsPerEm; + if (format & OTF_YPlaDevice) + yoff += DEVICE_DELTA (g->f.f1.value->YPlaDevice, pixel_size); + if (format & OTF_XAdvance) + advance += g->f.f1.value->XAdvance * pixel_size / unitsPerEm; + if (format & OTF_XAdvDevice) + advance += DEVICE_DELTA (g->f.f1.value->XAdvDevice, + pixel_size); + } + break; - case 3: - /* Not yet supported. */ - break; - case 4: case 5: - if (! base) - break; - prev = base; - prev_width = base_width; - goto label_adjust_anchor; - default: /* i.e. case 6 */ - if (! mark) - break; - prev = mark; - prev_width = 0; - label_adjust_anchor: - { - int base_x, base_y, mark_x, mark_y; - - base_x = g->f.f4.base_anchor->XCoordinate * pixel_size / unitsPerEm; - base_y = g->f.f4.base_anchor->YCoordinate * pixel_size / unitsPerEm; - mark_x = g->f.f4.mark_anchor->XCoordinate * pixel_size / unitsPerEm; - mark_y = g->f.f4.mark_anchor->YCoordinate * pixel_size / unitsPerEm; - - if (g->f.f4.base_anchor->AnchorFormat != 1) - adjust_anchor (g->f.f4.base_anchor, face, prev, &base_x, &base_y); - if (g->f.f4.mark_anchor->AnchorFormat != 1) - adjust_anchor (g->f.f4.mark_anchor, face, g, &mark_x, &mark_y); - xoff = (base_x - prev_width) - mark_x; - yoff = base_y - mark_y; - } + case 3: + /* Not yet supported. */ + break; + case 4: case 5: + if (! base) + break; + prev = base; + prev_width = base_width; + goto label_adjust_anchor; + default: /* i.e. case 6 */ + if (! mark) + break; + prev = mark; + prev_width = 0; + label_adjust_anchor: + { + int base_x, base_y, mark_x, mark_y; + + base_x = g->f.f4.base_anchor->XCoordinate * pixel_size / unitsPerEm; + base_y = g->f.f4.base_anchor->YCoordinate * pixel_size / unitsPerEm; + mark_x = g->f.f4.mark_anchor->XCoordinate * pixel_size / unitsPerEm; + mark_y = g->f.f4.mark_anchor->YCoordinate * pixel_size / unitsPerEm; + + if (g->f.f4.base_anchor->AnchorFormat != 1) + adjust_anchor (g->f.f4.base_anchor, face, prev, &base_x, &base_y); + if (g->f.f4.mark_anchor->AnchorFormat != 1) + adjust_anchor (g->f.f4.mark_anchor, face, g, &mark_x, &mark_y); + xoff = (base_x - prev_width) - mark_x; + yoff = base_y - mark_y; + } + } + if (i + 1 == gstring.used + || gstring.glyphs[i + 1].glyph_id + || ! gstring.glyphs[i + 1].positioning_type) + break; + i++, g++; + } } - + XCopyArea (display, bmp->pixmap, seq_pixmap, gc_or, glyph_x + bmp->x, glyph_y + bmp->y, bmp->width, bmp->height, x + bmp->x + xoff, glyph_y + bmp->y - yoff);