#include <otf.h>
+#define CAST_FROM_XTPOINTER(TYPE, DATA, VAR) \
+ do { \
+ long TYPE temp = (long TYPE) (DATA); \
+ (VAR) = temp; \
+ } while (0)
+
+#define XtAddCallbackWithCast(TYPE, W, PROC, VAR) \
+ do { \
+ long TYPE temp = (long TYPE) (VAR); \
+ XtAddCallback (W, XtNcallback, PROC, (XtPointer) temp); \
+ } while (0)
+
+
#define DEFAULT_PIXEL_SIZE 30
int pixel_size;
GlyphProc (Widget w, XtPointer client_data, XtPointer call_data)
{
int old_glyph_index = glyph_index;
+ int data;
+
+ CAST_FROM_XTPOINTER (int, client_data, data);
- if ((int) client_data == -3 && glyph_index > 0)
+ if (data == -3 && glyph_index > 0)
glyph_index = 0;
- else if ((int) client_data == -2 && glyph_index > 0)
+ else if (data == -2 && glyph_index > 0)
glyph_index = (glyph_index - 1) & 0x1FF000;
- else if ((int) client_data == -1 && glyph_index > 0)
+ else if (data == -1 && glyph_index > 0)
glyph_index -= 0x80;
- else if ((int) client_data == 1 && glyph_index < 0x10FF80)
+ else if (data == 1 && glyph_index < 0x10FF80)
glyph_index += 0x80;
- else if ((int) client_data == 2 && glyph_index < 0x10F000)
+ else if (data == 2 && glyph_index < 0x10F000)
glyph_index = (glyph_index + 0x1000) & 0x1FF000;
- else if ((int) client_data == 3 && glyph_index < 0x10F000)
+ else if (data == 3 && glyph_index < 0x10F000)
glyph_index = 0x10FF80;
if (glyph_index != old_glyph_index)
update_glyph_area ();
void
CharmapProc (Widget w, XtPointer client_data, XtPointer call_data)
{
- if (charmap_index == (int) client_data)
+ int data;
+
+ CAST_FROM_XTPOINTER (int, client_data, data);
+
+ if (charmap_index == data)
return;
- charmap_index = (int) client_data;
+ charmap_index = data;
if (charmap_index >= 0)
FT_Set_Charmap (face, face->charmaps[charmap_index]);
update_glyph_area ();
void
UVSProc (Widget w, XtPointer client_data, XtPointer call_data)
{
- unsigned idx = (unsigned) client_data;
- int selector = uvs[idx].c;
+ unsigned idx;
+ int selector;
OTF_VariationSelectorRecord *record;
int i;
+ CAST_FROM_XTPOINTER (unsigned, client_data, idx);
+ selector = uvs[idx].c;
+
if (glyph_rec.n_glyphs >= 64)
return;
for (i = 0; i < sub14->nRecords; i++)
void
RenderProc (Widget w, XtPointer client_data, XtPointer call_data)
{
- if ((int) client_data < 0)
+ int data;
+
+ CAST_FROM_XTPOINTER (int, client_data, data);
+
+ if (data < 0)
{
if (glyph_rec.n_glyphs > 0)
{
- if ((int) client_data == -2)
+ if (data == -2)
glyph_rec.n_glyphs--;
else
glyph_rec.n_glyphs = 0;
}
else if (glyph_rec.n_glyphs < 64)
{
- int index = glyph_index + (int) client_data;
+ int index = glyph_index + data;
if (charmap_index >= 0)
index = FT_Get_Char_Index (face, (FT_ULong) index);
if (bitmap[index].pixmap)
{
- glyph_rec.codes[glyph_rec.n_glyphs] = glyph_index + (int) client_data;
+ glyph_rec.codes[glyph_rec.n_glyphs] = glyph_index + data;
glyph_rec.glyphs[glyph_rec.n_glyphs++] = index;
if (otf)
- update_uvs_area (glyph_index + (int) client_data);
+ update_uvs_area (glyph_index + data);
update_render_area ();
}
}
XtSetArg (arg2[0], XtNborderWidth, 1);
for (i = 0; i < sub14->nRecords; i++)
{
- OTF_VariationSelectorRecord *record = sub14->Records + i;;
+ OTF_VariationSelectorRecord *record = sub14->Records + i;
unsigned selector = record->varSelector;
unsigned idx;
char lbl[4];
XtSetArg (arg2[2], XtNsensitive, False);
uvs[idx].w = XtCreateManagedWidget ("lbl", commandWidgetClass,
uvs_area, arg2, 3);
- XtAddCallback (uvs[idx].w, XtNcallback, UVSProc, (XtPointer) idx);
+ XtAddCallbackWithCast (unsigned, uvs[idx].w, UVSProc, idx);
}
XtSetArg (arg[5], XtNfromVert, uvs_area);
}
charmap[i + 1] = XtCreateManagedWidget (charmap_rec[i + 1].name,
toggleWidgetClass,
command_area, arg, 1);
- XtAddCallback (charmap[i + 1], XtNcallback, CharmapProc, (XtPointer) i);
+ XtAddCallbackWithCast (int, charmap[i + 1], CharmapProc, i);
}
XtSetArg (arg[0], XtNlabel, " |< (f)");
XtSetArg (arg[n], XtNbitmap, none_pixmap), n++;
glyph[k] = XtCreateManagedWidget ("glyph", commandWidgetClass,
glyph_area, arg, n);
- XtAddCallback (glyph[k], XtNcallback, RenderProc, (XtPointer) k);
+ XtAddCallbackWithCast (int, glyph[k], RenderProc, k);
}
w = head;
}