- if (inst->fonts[fontid] == NULL) {
- /*
- * The font for this contingency does not exist. So we
- * display nothing at all; such is life.
- */
- } else if (inst->fontinfo[fontid].is_wide) {
- /*
- * At least one version of gdk_draw_text_wc() has a
- * weird bug whereby it reads `len' elements of the
- * input string, but only draws `len/2'. Hence I'm
- * going to make its input array twice as long as it
- * theoretically needs to be, and pass in twice the
- * actual number of characters. If a fixed gdk actually
- * takes the doubled length seriously, then (a) the
- * array will stand scrutiny up to the full length, (b)
- * the spare elements of the array are full of zeroes
- * which will probably be an empty glyph in the font,
- * and (c) the clip rectangle should prevent it causing
- * trouble anyway.
- */
- gwcs = snewn(len*2+1, GdkWChar);
- memset(gwcs, 0, sizeof(GdkWChar) * (len*2+1));
- /*
- * FIXME: when we have a wide-char equivalent of
- * from_unicode, use it instead of this.
- */
- for (combining = 0; combining < ncombining; combining++) {
- for (i = 0; i <= len; i++)
- gwcs[i] = wcs[i + combining];
- gdk_draw_text_wc(inst->pixmap, inst->fonts[fontid], gc,
- x*inst->font_width+inst->cfg.window_border,
- y*inst->font_height+inst->cfg.window_border+inst->fonts[0]->ascent,
- gwcs, len*2);
- if (shadow)
- gdk_draw_text_wc(inst->pixmap, inst->fonts[fontid], gc,
- x*inst->font_width+inst->cfg.window_border+inst->cfg.shadowboldoffset,
- y*inst->font_height+inst->cfg.window_border+inst->fonts[0]->ascent,
- gwcs, len*2);
- }
- sfree(gwcs);
- } else {
- gcs = snewn(len+1, gchar);
- for (combining = 0; combining < ncombining; combining++) {
- wc_to_mb(inst->fontinfo[fontid].charset, 0,
- wcs + combining, len, gcs, len, ".", NULL, NULL);
- gdk_draw_text(inst->pixmap, inst->fonts[fontid], gc,
- x*inst->font_width+inst->cfg.window_border,
- y*inst->font_height+inst->cfg.window_border+inst->fonts[0]->ascent,
- gcs, len);
- if (shadow)
- gdk_draw_text(inst->pixmap, inst->fonts[fontid], gc,
- x*inst->font_width+inst->cfg.window_border+inst->cfg.shadowboldoffset,
- y*inst->font_height+inst->cfg.window_border+inst->fonts[0]->ascent,
- gcs, len);
- }
- sfree(gcs);
- }
- sfree(wcs);