summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-09 13:25:14 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-09 13:25:14 +0300
commita5407bb3026da0972be19dfc89bb59dac6d5ee0c (patch)
tree0d006e2af0c1d8da55a099cac3bfa21034dfb7c7
parent46a5d265ad180fc9f79c4d0adddfc21101009a93 (diff)
Windows: Fixed Unicode icons
-rw-r--r--src/gmdocument.c1
-rw-r--r--src/ui/documentwidget.c11
2 files changed, 5 insertions, 7 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 20874d8a..582af833 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -13,6 +13,7 @@
13#include <SDL_hints.h> 13#include <SDL_hints.h>
14#include <SDL_render.h> 14#include <SDL_render.h>
15#include <stb_image.h> 15#include <stb_image.h>
16#include <ctype.h>
16 17
17iDeclareType(GmLink) 18iDeclareType(GmLink)
18 19
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index c8daa2e2..9a97c39e 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -351,13 +351,10 @@ static void setSource_DocumentWidget_(iDocumentWidget *d, const iString *source)
351} 351}
352 352
353static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode code) { 353static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode code) {
354 iString *src = collectNew_String(); 354 iString *src = collectNewCStr_String("# ");
355 const iGmError *msg = get_GmError(code); 355 const iGmError *msg = get_GmError(code);
356 format_String(src, 356 appendChar_String(src, msg->icon ? msg->icon : 0x2327); /* X in a box */
357 "# %lc %s\n%s", 357 appendFormat_String(src, " %s\n%s", msg->title, msg->info);
358 msg->icon ? msg->icon : 0x2327, /* X in a box */
359 msg->title,
360 msg->info);
361 switch (code) { 358 switch (code) {
362 case failedToOpenFile_GmStatusCode: 359 case failedToOpenFile_GmStatusCode:
363 case certificateNotValid_GmStatusCode: 360 case certificateNotValid_GmStatusCode:
@@ -1179,7 +1176,7 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) {
1179 init_String(&bannerText); 1176 init_String(&bannerText);
1180 iInt2 bpos = add_I2(visPos, init_I2(0, lineHeight_Text(banner_FontId) / 2)); 1177 iInt2 bpos = add_I2(visPos, init_I2(0, lineHeight_Text(banner_FontId) / 2));
1181 if (icon) { 1178 if (icon) {
1182 format_String(&bannerText, "%lc", (int) icon); 1179 appendChar_String(&bannerText, icon);
1183 const iRect iconRect = visualBounds_Text(banner_FontId, range_String(&bannerText)); 1180 const iRect iconRect = visualBounds_Text(banner_FontId, range_String(&bannerText));
1184 drawRange_Text(run->font, 1181 drawRange_Text(run->font,
1185 addY_I2(bpos, -mid_Rect(iconRect).y + lineHeight_Text(run->font) / 2), 1182 addY_I2(bpos, -mid_Rect(iconRect).y + lineHeight_Text(run->font) / 2),