Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: Translations and players
From: Magnus Holmgren (lear_at_algonet.se)
Date: 2002-09-22


Kjell Ericson wrote:

> > Given the possibility to translate Rockbox, a shortcoming of the new
> > player is more noticable: the lack of national characters.
> > I've just hacked Rockbox so that it includes "å", "ä" and "ö". Is this
> > something that is of general interest? I.e., should I submit a patch for
> > it, and make it easy to adapt to other languages?
>
> Yes, please!

OK, here you go. I put it in lcd.c. Enable it by placing
"-DHAVE_SWEDISH_CHARS" in EXTRA_DEFINES.

-- 
Magnus Holmgren

Index: firmware/drivers/lcd.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/drivers/lcd.c,v
retrieving revision 1.99
diff -u -r1.99 lcd.c
--- firmware/drivers/lcd.c 20 Sep 2002 08:07:50 -0000 1.99
+++ firmware/drivers/lcd.c 22 Sep 2002 18:37:52 -0000
@@ -326,7 +326,7 @@
 
 #ifdef HAVE_NEW_CHARCELL_LCD
 
-static const unsigned char lcd_ascii[] = {
+static unsigned char lcd_ascii[] = {
    0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
    0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
    0x10,0x11,0x05,0x13,0x14,0x15,0x16,0x17,
@@ -361,7 +361,59 @@
    0x20,0x75,0x75,0x75,0x75,0x79,0x20,0x79
 };
 
-#else
+#define CHAR_HEIGHT 8
+
+#if defined(HAVE_SWEDISH_CHARS)
+/* ----- ----- ----- ----- ----- -----
+ * X X X X X X X X X X
+ * X X X X
+ * XXX XXX XXX XXX XXX XXX
+ * X X X X X X X X X X
+ * XXXX XXXX X X XXXXX XXXXX X X
+ * X X X X X X X X X X X X
+ * XXXX XXXX XXX X X X X XXX
+ *
+ * ----- ----- ----- ----- ----- -----
+ */
+
+#define NUM_CHARS 6
+
+static char extra_chars[NUM_CHARS][CHAR_HEIGHT] =
+{
+ { 0x04, 0x0a, 0x0e, 0x01, 0x0f, 0x11, 0x0f, 0x00 },
+ { 0x0a, 0x00, 0x0e, 0x01, 0x0f, 0x11, 0x0f, 0x00 },
+ { 0x0a, 0x00, 0x0e, 0x11, 0x11, 0x11, 0x0e, 0x00 },
+ { 0x04, 0x0a, 0x0e, 0x11, 0x1f, 0x11, 0x11, 0x00 },
+ { 0x0a, 0x00, 0x0e, 0x11, 0x1f, 0x11, 0x11, 0x00 },
+ { 0x0a, 0x00, 0x0e, 0x11, 0x11, 0x11, 0x0e, 0x00 }
+};
+
+static const unsigned char extra_chars_mapping[NUM_CHARS] =
+{
+ 0xe5, 0xe4, 0xf6, 0xc5, 0xc4, 0xd6
+};
+
+#else /* HAVE_*_CHARS */
+
+#define NUM_CHARS 0
+
+static char extra_chars[NUM_CHARS][CHAR_HEIGHT] = {};
+static const unsigned char extra_chars_mapping[NUM_CHARS] = {};
+
+#endif /* HAVE_*_CHARS */
+
+void init_extra_chars(void)
+{
+ int i;
+
+ for (i = 0; i < NUM_CHARS; i++)
+ {
+ lcd_define_pattern((i + 2) * CHAR_HEIGHT, extra_chars[i], CHAR_HEIGHT);
+ lcd_ascii[extra_chars_mapping[i]] = i + 2;
+ }
+}
+
+#else /* HAVE_NEW_CHARCELL_LCD */
 
 static const unsigned char lcd_ascii[] = {
    0x00,0x01,0x02,0x03,0x00,0x84,0x85,0x89,
@@ -508,6 +560,10 @@
 {
     create_thread(scroll_thread, scroll_stack,
                   sizeof(scroll_stack), scroll_name);
+
+#ifdef HAVE_NEW_CHARCELL_LCD
+ init_extra_chars();
+#endif
 }
 #endif
 



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa