- size_t text_len = strlen(text);
- if (text_len > 255) {
- /* The text is too long to draw it directly to X */
- i3String *str = i3string_from_utf8(text);
- draw_text(str, drawable, gc, x, y, max_width);
- i3string_free(str);
- } else {
- /* X11 coordinates for fonts start at the baseline */
- int pos_y = y + savedFont->info->font_ascent;
-
- xcb_image_text_8(conn, text_len, drawable, gc, x, pos_y, text);
+ switch (savedFont->type) {
+ case FONT_TYPE_NONE:
+ /* Nothing to do */
+ return;
+ case FONT_TYPE_XCB:
+ {
+ size_t text_len = strlen(text);
+ if (text_len > 255) {
+ /* The text is too long to draw it directly to X */
+ i3String *str = i3string_from_utf8(text);
+ draw_text(str, drawable, gc, x, y, max_width);
+ i3string_free(str);
+ } else {
+ /* X11 coordinates for fonts start at the baseline */
+ int pos_y = y + savedFont->specific.xcb.info->font_ascent;
+
+ xcb_image_text_8(conn, text_len, drawable, gc, x, pos_y, text);
+ }
+ break;
+ }
+ default:
+ assert(false);