| | idxl[0] ... idxl[15] | |
| +--------------------------------------+ |
| +--- render_area (form) ---------------+ |
- | | clear del | |
+ | | clear del bidi | |
| | +--- raw (box) --------------------+ | |
| | | raw_label raw_image | | |
| | +----------------------------------+ | |
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, raw, seq;
+Widget render_area, clear, del, bidi, raw, seq;
Widget raw_label, raw_image, seq_label, seq_image;
unsigned long foreground, background;
int charmap_index;
+int reversed;
unsigned glyph_width, glyph_height;
int glyph_x, glyph_y;
int glyph_index;
memset (gstring.glyphs, 0, sizeof (OTF_Glyph) * len);
for (i = 0; i < len; i++)
gstring.glyphs[i].c = gstring.glyphs[i].glyph_id = glyph_rec.glyphs[i];
+ OTF_drive_gdef (otf, &gstring);
XFillRectangle (display, seq_pixmap, gc, 0, 0, render_width, render_height);
if (otf)
}
prev = NULL;
+ if (reversed)
+ {
+ OTF_Glyph temp;
+
+ for (prev = gstring.glyphs, g = gstring.glyphs + gstring.used - 1;
+ prev < g; prev++, g--)
+ temp = *prev, *prev = *g, *g = temp;
+ for (g = gstring.glyphs; g < gstring.glyphs + gstring.used; g++)
+ if (g->GlyphClass == 3)
+ {
+ OTF_Glyph *g0;
+ prev = g++;
+ while (g < gstring.glyphs + gstring.used && g->GlyphClass == 3)
+ g++;
+ for (g0 = g; prev < g0; prev++, g0--)
+ temp = *prev, *prev = *g, *g = temp;
+ }
+ }
+
+
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 advance = bmp->advance;
+ if (! bmp->pixmap)
+ {
+ create_pixmap (gstring.glyphs[i].glyph_id);
+ if (! bmp->pixmap)
+ continue;
+ }
switch (g->positioning_type)
{
case 0:
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:
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 = bmp->advance;
+ x += prev_width = advance;
}
XtSetArg (arg[0], XtNbitmap, seq_pixmap);
XtSetValues (seq_image, arg, 1);
}
void
+BidiProc (Widget w, XtPointer client_data, XtPointer call_data)
+{
+ Arg arg[1];
+
+ reversed = ! reversed;
+ if (reversed)
+ XtSetArg (arg[0], XtNlabel, "L<-R");
+ else
+ XtSetArg (arg[0], XtNlabel, "L->R");
+ XtSetValues (w, arg, 1);
+ update_seq_area ();
+}
+
+void
FeatureProc (Widget w, XtPointer client_data, XtPointer call_data)
{
FeatureRec *rec = (FeatureRec *) client_data;
XtAddCallback (clear, XtNcallback, RenderProc, (XtPointer) -1);
del = XtCreateManagedWidget ("delete", commandWidgetClass, w, arg, 0);
XtAddCallback (del, XtNcallback, RenderProc, (XtPointer) -2);
+ bidi = XtCreateManagedWidget ("L->R", toggleWidgetClass, w, arg, 0);
+ XtAddCallback (bidi, XtNcallback, BidiProc, NULL);
XtSetArg (arg[4], XtNorientation, XtorientHorizontal);
XtSetArg (arg[5], XtNborderWidth, 0);