{
char buf[4096];
va_list ap;
+ static int debugging = -1;
- va_start(ap, fmt);
- _vsnprintf(buf, 4095, fmt, ap);
- dputs(buf);
- va_end(ap);
+ if (debugging == -1)
+ debugging = getenv("DEBUG_PUZZLES") ? 1 : 0;
+
+ if (debugging) {
+ va_start(ap, fmt);
+ _vsnprintf(buf, 4095, fmt, ap);
+ dputs(buf);
+ va_end(ap);
+ }
}
#endif
sfree(fe->brushes);
sfree(fe->pens);
sfree(fe->presets);
+ sfree(fe->fonts);
sfree(fe);
}
HFONT oldfont;
TEXTMETRIC tm;
SIZE size;
-#ifdef _WIN32_WCE
TCHAR wText[256];
- MultiByteToWideChar (CP_ACP, 0, text, -1, wText, 256);
-#endif
+ MultiByteToWideChar (CP_UTF8, 0, text, -1, wText, 256);
oldfont = SelectObject(fe->hdc, fe->fonts[i].font);
if (GetTextMetrics(fe->hdc, &tm)) {
else
xy.y -= tm.tmAscent;
}
-#ifndef _WIN32_WCE
- if (GetTextExtentPoint32(fe->hdc, text, strlen(text), &size))
-#else
- if (GetTextExtentPoint32(fe->hdc, wText, wcslen(wText), &size))
-#endif
+ if (GetTextExtentPoint32W(fe->hdc, wText, wcslen(wText), &size))
{
if (align & ALIGN_HCENTRE)
xy.x -= size.cx / 2;
}
SetBkMode(fe->hdc, TRANSPARENT);
win_text_colour(fe, colour);
-#ifndef _WIN32_WCE
- TextOut(fe->hdc, xy.x, xy.y, text, strlen(text));
-#else
- ExtTextOut(fe->hdc, xy.x, xy.y, 0, NULL, wText, wcslen(wText), NULL);
-#endif
+ ExtTextOutW(fe->hdc, xy.x, xy.y, 0, NULL, wText, wcslen(wText), NULL);
SelectObject(fe->hdc, oldfont);
}
}
}
}
+char *win_text_fallback(void *handle, const char *const *strings, int nstrings)
+{
+ /*
+ * We assume Windows can cope with any UTF-8 likely to be
+ * emitted by a puzzle.
+ */
+ return dupstr(strings[0]);
+}
+
const struct drawing_api win_drawing = {
win_draw_text,
win_draw_rect,
win_end_doc,
win_line_width,
win_line_dotted,
+ win_text_fallback,
};
void print(frontend *fe)
DispatchMessage(&msg);
}
+ DestroyWindow(fe->hwnd);
cleanup_help();
return msg.wParam;