From: handa Date: Thu, 5 Aug 2004 13:11:09 +0000 (+0000) Subject: (update_seq_area): Fix previous change. X-Git-Tag: REL-0-9-1~12 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=6ff6de6e0a1f8d759195d41cf9d394cece44a864;p=m17n%2Flibotf.git (update_seq_area): Fix previous change. --- diff --git a/example/otfview.c b/example/otfview.c index a85361a..8edc649 100644 --- a/example/otfview.c +++ b/example/otfview.c @@ -263,14 +263,14 @@ get_features (OTF_FeatureList *list, FeatureRec *rec) void adjust_anchor (OTF_Anchor *anchor, FT_Face ft_face, - OTF_Glyph *prev, int *x, int *y) + OTF_Glyph *g, int *x, int *y) { - if (anchor->AnchorFormat == 2 && prev) + if (anchor->AnchorFormat == 2) { FT_Outline *outline; int ap = anchor->f.f1.AnchorPoint; - FT_Load_Glyph (ft_face, (FT_UInt) prev->glyph_id, FT_LOAD_MONOCHROME); + FT_Load_Glyph (ft_face, (FT_UInt) g->glyph_id, FT_LOAD_MONOCHROME); outline = &ft_face->glyph->outline; if (ap < outline->n_points) { @@ -290,8 +290,8 @@ update_seq_area () { int i, x; OTF_GlyphString gstring; - OTF_Glyph *g, *prev; - int prev_width; + OTF_Glyph *g, *prev, *base, *mark; + int base_width; int len = glyph_rec.n_glyphs; Arg arg[1]; int unitsPerEm = face->units_per_EM; @@ -350,11 +350,13 @@ update_seq_area () } + mark = base = NULL; for (i = 0, x = glyph_x, prev = NULL, g = gstring.glyphs; i < gstring.used; i++, prev = g++) { BitmapRec *bmp = bitmap + gstring.glyphs[i].glyph_id; int xoff = 0, yoff = 0; + int prev_width; int advance = bmp->advance; if (! bmp->pixmap) @@ -391,6 +393,17 @@ update_seq_area () /* 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; @@ -402,21 +415,23 @@ update_seq_area () 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, prev, &mark_x, &mark_y); + 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; } - break; - - default: /* i.e case 6 */ - /* Not yet supported. */ - break; } 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); - x += prev_width = advance; + x += advance; + + if (g->GlyphClass == OTF_GlyphClass0) + base = mark = g, base_width = advance; + else if (g->GlyphClass == OTF_GlyphClassMark) + mark = g; + else + base = g, base_width = advance; } XtSetArg (arg[0], XtNbitmap, seq_pixmap); XtSetValues (seq_image, arg, 1);