Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for japanese characters #73

Merged
merged 2 commits into from
Mar 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions cmatrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,11 @@ void c_die(char *msg, ...) {
}

void usage(void) {
printf(" Usage: cmatrix -[abBfhlsmVx] [-u delay] [-C color]\n");
printf(" Usage: cmatrix -[abBcfhlsmVx] [-u delay] [-C color]\n");
printf(" -a: Asynchronous scroll\n");
printf(" -b: Bold characters on\n");
printf(" -B: All bold characters (overrides -b)\n");
printf(" -c: Use Japanese characters as seen in the original matrix. Requires appropriate fonts\n");
printf(" -f: Force the linux $TERM type to be on\n");
printf(" -l: Linux mode (uses matrix console font)\n");
printf(" -L: Lock mode (can be closed from another terminal)\n");
Expand Down Expand Up @@ -285,13 +286,14 @@ int main(int argc, char *argv[]) {
int randnum = 0;
int randmin = 0;
int pause = 0;
int classic = 0;

srand((unsigned) time(NULL));
setlocale(LC_ALL, "");

/* Many thanks to morph- ([email protected]) for this getopt patch */
opterr = 0;
while ((optchr = getopt(argc, argv, "abBfhlLnrosmxVu:C:")) != EOF) {
while ((optchr = getopt(argc, argv, "abBcfhlLnrosmxVu:C:")) != EOF) {
switch (optchr) {
case 's':
screensaver = 1;
Expand Down Expand Up @@ -330,6 +332,9 @@ int main(int argc, char *argv[]) {
"white, yellow, cyan, magenta " "and black.\n");
}
break;
case 'c':
classic = 1;
break;
case 'f':
force = 1;
break;
Expand Down Expand Up @@ -430,15 +435,18 @@ if (console) {
}

/* Set up values for random number generation */
if (console || xwindow) {
randnum = 51;
if(classic) {
/* Japanese character unicode range [they are seen in the original cmatrix] */
randmin = 12288;
highnum = 12351;
} else if (console || xwindow) {
randmin = 166;
highnum = 217;
} else {
randnum = 93;
randmin = 33;
highnum = 123;
}
randnum = highnum - randmin;

var_init();

Expand Down