From: handa Date: Tue, 9 Nov 2004 00:33:50 +0000 (+0000) Subject: (alt_subst, do_alternate_subst): New X-Git-Tag: REL-0-9-5~92 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=ca42e93774d6695734f515b4b57d8fc7529cde21;p=m17n%2Flibotf.git (alt_subst, do_alternate_subst): New variables. (update_seq_area): If do_alternate_subst, call OTF_drive_gsub_alternate. Correctly set advance. Don't check g->alternate_set. (AltSubstProc): New function. (create_widgets): Create AltSubst widget. --- diff --git a/example/otfview.c b/example/otfview.c index af87d38..6d2baf8 100644 --- a/example/otfview.c +++ b/example/otfview.c @@ -73,7 +73,7 @@ XtAppContext context; | | idxl[0] ... idxl[15] | | | +--------------------------------------+ | | +--- render_area (form) ---------------+ | - | | clear del bidi | | + | | clear del bidi alt_subst | | | | +--- raw (box) --------------------+ | | | | | raw_label raw_image | | | | | +----------------------------------+ | | @@ -88,7 +88,7 @@ Widget shell, frame; Widget command_area, quit, dump, *charmap; Widget navi_area, FIRST, PREV, prev, range, next, NEXT, LAST; Widget glyph_area, glyph[128], index_label[8]; -Widget render_area, clear, del, bidi, raw, seq; +Widget render_area, clear, del, bidi, alt_subst, raw, seq; Widget raw_label, raw_image, seq_label, seq_image; unsigned long foreground, background; @@ -142,6 +142,7 @@ struct { int charmap_index; int reversed; +int do_alternate_subst; unsigned glyph_width, glyph_height; int glyph_x, glyph_y; int glyph_index; @@ -321,7 +322,10 @@ update_seq_area () str = get_features (&otf->gsub->FeatureList, &gsub); if (str) { - OTF_drive_gsub (otf, &gstring, NULL, NULL, str); + if (do_alternate_subst) + OTF_drive_gsub_alternate (otf, &gstring, NULL, NULL, str); + else + OTF_drive_gsub (otf, &gstring, NULL, NULL, str); free (str); } } @@ -372,6 +376,7 @@ update_seq_area () create_pixmap (gstring.glyphs[i].glyph_id); if (! bmp->pixmap) continue; + advance = bmp->advance; } switch (g->positioning_type) { @@ -440,21 +445,6 @@ update_seq_area () mark = g; else base = g, base_width = advance; - - if (g->alternate_set) - for (j = 0; j < g->alternate_set->GlyphCount; j++) - { - bmp = bitmap + g->alternate_set->Alternate[j]; - if (! bmp->pixmap) - create_pixmap (g->alternate_set->Alternate[j]); - if (! bmp->pixmap) - continue; - 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 += bmp->advance; - } } free (gstring.glyphs); @@ -712,6 +702,13 @@ BidiProc (Widget w, XtPointer client_data, XtPointer call_data) } void +AltSubstProc (Widget w, XtPointer client_data, XtPointer call_data) +{ + do_alternate_subst = ! do_alternate_subst; + update_seq_area (); +} + +void FeatureProc (Widget w, XtPointer client_data, XtPointer call_data) { FeatureRec *rec = (FeatureRec *) client_data; @@ -1159,6 +1156,8 @@ create_widgets () XtAddCallback (del, XtNcallback, RenderProc, (XtPointer) -2); bidi = XtCreateManagedWidget ("L->R", toggleWidgetClass, w, arg, 0); XtAddCallback (bidi, XtNcallback, BidiProc, NULL); + alt_subst = XtCreateManagedWidget ("AltSubst", toggleWidgetClass, w, arg, 0); + XtAddCallback (alt_subst, XtNcallback, AltSubstProc, NULL); XtSetArg (arg[4], XtNorientation, XtorientHorizontal); XtSetArg (arg[5], XtNborderWidth, 0);