Widget raw_label, raw_image, seq_label, seq_image;
unsigned long foreground, background;
-#define MAX_FEATURE_COUNT 16
+typedef struct
+{
+ OTF_Tag tag;
+ int on;
+ Widget w;
+} FeatureElement;
typedef struct
{
char *label;
OTF_GSUB_GPOS *gsub_gpos;
OTF_LangSys *langsys;
- struct {
- OTF_Tag tag;
- int on;
- Widget w;
- } features[MAX_FEATURE_COUNT];
+ int num_features;
+ FeatureElement *features;
+ Widget parent;
} FeatureRec;
FeatureRec gsub, gpos;
int xoff = 0, yoff = 0;
int prev_width;
int advance = bmp->advance;
+ int j;
if (! bmp->pixmap)
{
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);
break;
}
+ if (! rec->features)
+ {
+ rec->num_features = rec->langsys->FeatureCount;
+ rec->features = malloc ((sizeof (FeatureElement)) * rec->num_features);
+ memset (rec->features, 0, (sizeof (FeatureElement)) * rec->num_features);
+ }
+ else if (rec->num_features < rec->langsys->FeatureCount)
+ {
+ rec->features = realloc (rec->features,
+ (sizeof (FeatureElement))
+ * rec->langsys->FeatureCount);
+ memset (rec->features + rec->num_features, 0,
+ (sizeof (FeatureElement))
+ * (rec->langsys->FeatureCount - rec->num_features));
+ rec->num_features = rec->langsys->FeatureCount;
+ }
+
if (! rec->langsys)
i = 0;
else
XtSetArg (arg[2], XtNinternalWidth, 4);
XtSetArg (arg[3], XtNborderColor, foreground);
XtSetArg (arg[4], XtNsensitive, True);
- for (i = 0; i < rec->langsys->FeatureCount && i < MAX_FEATURE_COUNT; i++)
+ for (i = 0; i < rec->langsys->FeatureCount; i++)
{
OTF_Feature *feature = rec->gsub_gpos->FeatureList.Feature;
int index = rec->langsys->FeatureIndex[i];
char label[5];
+ if (! rec->features[i].w)
+ {
+ Widget w = XtCreateManagedWidget ("", commandWidgetClass,
+ rec->parent, arg, 0);
+ XtAddCallback (w, XtNcallback, FeatureProc, (XtPointer) rec);
+ rec->features[i].w = w;
+ }
+
rec->features[i].tag = feature[index].FeatureTag;
rec->features[i].on = 0;
OTF_tag_name (rec->features[i].tag, label);
XtSetArg (arg[0], XtNborderColor, background);
XtSetArg (arg[1], XtNsensitive, False);
XtSetArg (arg[2], XtNlabel, " ");
- for (; i < MAX_FEATURE_COUNT; i++)
- XtSetValues (rec->features[i].w, arg, 3);
+ for (; i < rec->langsys->FeatureCount; i++)
+ {
+ if (! rec->features[i].w)
+ {
+ Widget w = XtCreateManagedWidget ("", commandWidgetClass,
+ rec->parent, arg, 0);
+ XtAddCallback (w, XtNcallback, FeatureProc, (XtPointer) rec);
+ rec->features[i].w = w;
+ }
+ XtSetValues (rec->features[i].w, arg, 3);
+ }
}
void
w = XtCreateManagedWidget ("none", commandWidgetClass, prev, arg, 3);
XtAddCallback (w, XtNcallback, FeatureProc, (XtPointer) rec);
- for (i = 0; i < MAX_FEATURE_COUNT; i++)
- {
- w = XtCreateManagedWidget ("", commandWidgetClass, prev, arg, 0);
- XtAddCallback (w, XtNcallback, FeatureProc, (XtPointer) rec);
- rec->features[i].w = w;
- }
-
+ rec->parent = prev;
setup_feature_rec (rec);
return prev;
}