X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fglx%2Fstarwars.c;h=60f766a72514e576e63a11aa105901f098e0dc79;hp=55c6198226a309bc1b2d0b77571b4d5b7cb4b05e;hb=ffd8c0873576a9e3065696a624dce6b766b77062;hpb=e4fa2ac140f7bc56571373a7b7eb585fa4500e38 diff --git a/hacks/glx/starwars.c b/hacks/glx/starwars.c index 55c61982..60f766a7 100644 --- a/hacks/glx/starwars.c +++ b/hacks/glx/starwars.c @@ -141,24 +141,24 @@ static char *alignment_str; static int alignment; static XrmOptionDescRec opts[] = { - {"-program", ".starwars.program", XrmoptionSepArg, (caddr_t) 0 }, - {"-lines", ".starwars.lines", XrmoptionSepArg, (caddr_t) 0 }, - {"-steps", ".starwars.steps", XrmoptionSepArg, (caddr_t) 0 }, - {"-spin", ".starwars.spin", XrmoptionSepArg, (caddr_t) 0 }, - {"-size", ".starwars.fontSize", XrmoptionSepArg, (caddr_t) 0 }, - {"-columns", ".starwars.columns", XrmoptionSepArg, (caddr_t) 0 }, - {"-smooth", ".starwars.smooth", XrmoptionNoArg, (caddr_t) "True" }, - {"-no-smooth", ".starwars.smooth", XrmoptionNoArg, (caddr_t) "False" }, - {"-thick", ".starwars.thick", XrmoptionNoArg, (caddr_t) "True" }, - {"-no-thick", ".starwars.thick", XrmoptionNoArg, (caddr_t) "False" }, - {"-fade", ".starwars.fade", XrmoptionNoArg, (caddr_t) "True" }, - {"-no-fade", ".starwars.fade", XrmoptionNoArg, (caddr_t) "False" }, - {"-wrap", ".starwars.lineWrap", XrmoptionNoArg, (caddr_t) "True" }, - {"-no-wrap", ".starwars.lineWrap", XrmoptionNoArg, (caddr_t) "False" }, - {"-nowrap", ".starwars.lineWrap", XrmoptionNoArg, (caddr_t) "False" }, - {"-left", ".starwars.alignment",XrmoptionNoArg, (caddr_t) "Left" }, - {"-right", ".starwars.alignment",XrmoptionNoArg, (caddr_t) "Right" }, - {"-center", ".starwars.alignment",XrmoptionNoArg, (caddr_t) "Center" }, + {"-program", ".starwars.program", XrmoptionSepArg, 0 }, + {"-lines", ".starwars.lines", XrmoptionSepArg, 0 }, + {"-steps", ".starwars.steps", XrmoptionSepArg, 0 }, + {"-spin", ".starwars.spin", XrmoptionSepArg, 0 }, + {"-size", ".starwars.fontSize", XrmoptionSepArg, 0 }, + {"-columns", ".starwars.columns", XrmoptionSepArg, 0 }, + {"-smooth", ".starwars.smooth", XrmoptionNoArg, "True" }, + {"-no-smooth", ".starwars.smooth", XrmoptionNoArg, "False" }, + {"-thick", ".starwars.thick", XrmoptionNoArg, "True" }, + {"-no-thick", ".starwars.thick", XrmoptionNoArg, "False" }, + {"-fade", ".starwars.fade", XrmoptionNoArg, "True" }, + {"-no-fade", ".starwars.fade", XrmoptionNoArg, "False" }, + {"-wrap", ".starwars.lineWrap", XrmoptionNoArg, "True" }, + {"-no-wrap", ".starwars.lineWrap", XrmoptionNoArg, "False" }, + {"-nowrap", ".starwars.lineWrap", XrmoptionNoArg, "False" }, + {"-left", ".starwars.alignment",XrmoptionNoArg, "Left" }, + {"-right", ".starwars.alignment",XrmoptionNoArg, "Right" }, + {"-center", ".starwars.alignment",XrmoptionNoArg, "Center" }, }; static argtype vars[] = { @@ -240,6 +240,31 @@ strip (char *s, Bool leading, Bool trailing) } +/* The GLUT font only has ASCII characters in them, so do what we can to + convert Latin1 characters to the nearest ASCII equivalent... + */ +static void +latin1_to_ascii (char *s) +{ + unsigned char *us = (unsigned char *) s; + const unsigned char ascii[95] = { + '!', 'C', '#', '#', 'Y', '|', 'S', '_', 'C', '?', '<', '=', '-', 'R', '_', + '?', '?', '2', '3', '\'','u', 'P', '.', ',', '1', 'o', '>', '?', '?', '?', + '?', 'A', 'A', 'A', 'A', 'A', 'A', 'E', 'C', 'E', 'E', 'E', 'E', 'I', 'I', + 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'x', '0', 'U', 'U', 'U', 'U', + 'Y', 'p', 'S', 'a', 'a', 'a', 'a', 'a', 'a', 'e', 'c', 'e', 'e', 'e', 'e', + 'i', 'i', 'i', 'i', 'o', 'n', 'o', 'o', 'o', 'o', 'o', '/', 'o', 'u', 'u', + 'u', 'u', 'y', 'p', 'y' }; + while (*us) + { + if (*us >= 161) + *us = ascii[*us - 161]; + else if (*us > 127) + *us = '?'; + us++; + } +} + /* Subprocess. (This bit mostly cribbed from phosphor.c) @@ -428,6 +453,7 @@ get_more_lines (sws_configuration *sc) sc->lines[sc->total_lines] = (char *) malloc (L+1); memcpy (sc->lines[sc->total_lines], sc->buf, L); sc->lines[sc->total_lines][L] = 0; + latin1_to_ascii (sc->lines[sc->total_lines]); { char *t = sc->lines[sc->total_lines];