diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-05-02 21:44:04 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-05-02 21:44:04 +0000 |
commit | 93ff94949c465f6c41b8f0701240c90f2ae917a4 (patch) | |
tree | 22a6da60277605a2ebdb4afc3efa7aa77d71f6f1 | |
parent | 982d995ae9c53ca1732add8a2e383fa527a57a3a (diff) |
Player: Credits plugin correctly working with UTF-8. Patch by Marcoen Hirschberg.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9862 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugin.c | 1 | ||||
-rw-r--r-- | apps/plugin.h | 3 | ||||
-rw-r--r-- | apps/plugins/credits.c | 9 |
3 files changed, 8 insertions, 5 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 0b09d07ad6..4f56e2d5da 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -438,6 +438,7 @@ static const struct plugin_api rockbox_api = { #ifdef HAVE_LCD_BITMAP lcd_setmargins, #endif + utf8seek, }; int plugin_load(const char* plugin, void* parameter) diff --git a/apps/plugin.h b/apps/plugin.h index 52732c5ff7..8d451d8f6f 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -103,7 +103,7 @@ #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 19 +#define PLUGIN_API_VERSION 20 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any @@ -514,6 +514,7 @@ struct plugin_api { #ifdef HAVE_LCD_BITMAP void (*lcd_setmargins)(int x, int y); #endif + int (*utf8seek)(const unsigned char* utf8, int offset); }; /* plugin header */ diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c index 12bfa60a8f..b726771edc 100644 --- a/apps/plugins/credits.c +++ b/apps/plugins/credits.c @@ -58,7 +58,7 @@ void roll_credits(void) { int numnames = sizeof(credits)/sizeof(char*); int curr_name = 0; - int curr_len = rb->strlen(credits[0]); + int curr_len = rb->utf8length(credits[0]); int curr_index = 0; int curr_line = 0; int name, len, new_len, line, x; @@ -77,19 +77,20 @@ void roll_credits(void) int x2; if (x < 0) - rb->lcd_puts(0, line, credits[name] - x); + rb->lcd_puts(0, line, credits[name] + rb->utf8seek(credits[name], -x)); else rb->lcd_puts(x, line, credits[name]); if (++name >= numnames) break; + line ^= 1; x2 = x + len/2; if ((unsigned)x2 < 11) rb->lcd_putc(x2, line, '*'); - new_len = rb->strlen(credits[name]); + new_len = rb->utf8length(credits[name]); x += MAX(len/2 + 2, len - new_len/2 + 1); len = new_len; } @@ -101,7 +102,7 @@ void roll_credits(void) { if (++curr_name >= numnames) break; - new_len = rb->strlen(credits[curr_name]); + new_len = rb->utf8length(credits[curr_name]); curr_index -= MAX(curr_len/2 + 2, curr_len - new_len/2 + 1); curr_len = new_len; curr_line ^= 1; |