diff options
Diffstat (limited to 'apps/plugins/puzzles')
-rw-r--r-- | apps/plugins/puzzles/rockbox.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c index de89c42eed..a10bf7dd5c 100644 --- a/apps/plugins/puzzles/rockbox.c +++ b/apps/plugins/puzzles/rockbox.c | |||
@@ -1421,11 +1421,41 @@ static void draw_mouse(void) | |||
1421 | } | 1421 | } |
1422 | } | 1422 | } |
1423 | 1423 | ||
1424 | /* doesn't work, disabled (can't find a good mechanism to check if a | ||
1425 | * glyph exists in a font) */ | ||
1426 | #if 0 | ||
1427 | /* See: https://www.chiark.greenend.org.uk/~sgtatham/puzzles/devel/drawing.html#drawing-text-fallback */ | ||
1424 | static char *rb_text_fallback(void *handle, const char *const *strings, | 1428 | static char *rb_text_fallback(void *handle, const char *const *strings, |
1425 | int nstrings) | 1429 | int nstrings) |
1426 | { | 1430 | { |
1427 | return dupstr(strings[0]); | 1431 | struct font *pf = rb->font_get(cur_font); |
1432 | |||
1433 | for(int i = 0; i < nstrings; i++) | ||
1434 | { | ||
1435 | LOGF("checking alternative \"%s\"", strings[i]); | ||
1436 | const unsigned char *ptr = strings[i]; | ||
1437 | unsigned short code; | ||
1438 | bool valid = true; | ||
1439 | |||
1440 | while(*ptr) | ||
1441 | { | ||
1442 | ptr = rb->utf8decode(ptr, &code); | ||
1443 | |||
1444 | if(!rb->font_get_bits(pf, code)) | ||
1445 | { | ||
1446 | valid = false; | ||
1447 | break; | ||
1448 | } | ||
1449 | } | ||
1450 | |||
1451 | if(valid) | ||
1452 | return dupstr(strings[i]); | ||
1453 | } | ||
1454 | |||
1455 | /* shouldn't get here */ | ||
1456 | return dupstr(strings[nstrings - 1]); | ||
1428 | } | 1457 | } |
1458 | #endif | ||
1429 | 1459 | ||
1430 | const drawing_api rb_drawing = { | 1460 | const drawing_api rb_drawing = { |
1431 | rb_draw_text, | 1461 | rb_draw_text, |
@@ -1443,9 +1473,10 @@ const drawing_api rb_drawing = { | |||
1443 | rb_blitter_free, | 1473 | rb_blitter_free, |
1444 | rb_blitter_save, | 1474 | rb_blitter_save, |
1445 | rb_blitter_load, | 1475 | rb_blitter_load, |
1476 | /* printing functions */ | ||
1446 | NULL, NULL, NULL, NULL, NULL, NULL, /* {begin,end}_{doc,page,puzzle} */ | 1477 | NULL, NULL, NULL, NULL, NULL, NULL, /* {begin,end}_{doc,page,puzzle} */ |
1447 | NULL, NULL, /* line_width, line_dotted */ | 1478 | NULL, NULL, /* line_width, line_dotted */ |
1448 | rb_text_fallback, | 1479 | NULL, /* fall back to ASCII */ |
1449 | NULL, | 1480 | NULL, |
1450 | }; | 1481 | }; |
1451 | 1482 | ||