vwebp: fix file name display in windows unicode build
glutBitmapCharacter() isn't limited to 8-bit characters; add
PrintStringW() to iterate through the file name. This may not fix all
cases, non-existent characters in the font used have no effect.
@@ -292,6 +292,19 @@ static void PrintString(const char* const text) {
}
}
+static void PrintStringW(const char* const text) {
+#if defined(_WIN32) && defined(_UNICODE)
+ void* const font = GLUT_BITMAP_9_BY_15;
+ const W_CHAR* const wtext = (const W_CHAR*)text;
+ int i;
+ for (i = 0; wtext[i]; ++i) {
+ glutBitmapCharacter(font, wtext[i]);
+ }
+#else
+ PrintString(text);
+#endif
+}
+
static float GetColorf(uint32_t color, int shift) {
return ((color >> shift) & 0xff) / 255.f;
}
@@ -396,7 +409,7 @@ static void HandleDisplay(void) {
glColor4f(0.90f, 0.0f, 0.90f, 1.0f);
glRasterPos2f(-0.95f, 0.90f);
- PrintString(kParams.file_name);
+ PrintStringW(kParams.file_name);
snprintf(tmp, sizeof(tmp), "Dimension:%d x %d", pic->width, pic->height);
glColor4f(0.90f, 0.0f, 0.90f, 1.0f);
