diff --git a/README.md b/README.md index d310ca9..f91c2af 100644 --- a/README.md +++ b/README.md @@ -265,6 +265,10 @@ directory, type cd apl sudo install_apl +You should see the following line displayed: + + /usr/share/fonts/truetype/apl385/Apl385.ttf: APL385 Unicode:style=Regular + While still being in the apl directory, you can test the APL character set using ../tek4010 -APL -noexit ./apltest diff --git a/apl/apltest b/apl/apltest index bf121ae..847c41a 100755 Binary files a/apl/apltest and b/apl/apltest differ diff --git a/apl/apltest.c b/apl/apltest.c index c11efab..0049a30 100644 --- a/apl/apltest.c +++ b/apl/apltest.c @@ -26,7 +26,7 @@ int main (int argc, char *argv[]) } printf("%c", ch); } - printf("\noverstrike test"); + printf("\n\noverstrike test"); putchar(62); putchar(32); putchar(79); putchar(8); putchar(63); putchar(32); putchar(76); putchar(8); putchar(43); diff --git a/apl/install_apl b/apl/install_apl index f0b7c1b..aa15bb2 100755 --- a/apl/install_apl +++ b/apl/install_apl @@ -3,4 +3,5 @@ mkdir /usr/share/fonts/truetype/apl385 cp Apl385.ttf /usr/share/fonts/truetype/apl385 -fc-cache /usr/share/fonts \ No newline at end of file +fc-cache /usr/share/fonts +fc-list 'APL385 Unicode' \ No newline at end of file diff --git a/main.c b/main.c index 0ca57f3..8877d92 100644 --- a/main.c +++ b/main.c @@ -181,12 +181,12 @@ static void on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer user_da } else if (argAPL && (event->keyval == 0x006E)) { // "n" switch to alternative character set aplMode = 1; - printf("Setting APL mode to 1 from keyboard\n"); + // printf("Setting APL mode to 1 from keyboard\n"); return; } else if (argAPL && (event->keyval == 0x006F)) { // "o" switch to normalcharacter set aplMode = 0; - printf("Setting APL mode to 0 from keyboard\n"); + // printf("Setting APL mode to 0 from keyboard\n"); return; } else @@ -207,7 +207,7 @@ static void on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer user_da } else if (putKeys) { - if (aplMode) printf("sending character %d to host\n", ch); + // if (aplMode) printf("sending character %d to host\n", ch); putc(ch,putKeys); // pipe key to child process, if stream open } } diff --git a/tek4010 b/tek4010 index 40f9249..22e82fe 100755 Binary files a/tek4010 and b/tek4010 differ diff --git a/tek4010.c b/tek4010.c index 7b4c7a5..750d69a 100755 --- a/tek4010.c +++ b/tek4010.c @@ -205,7 +205,7 @@ void tek4010_escapeCodeHandler(cairo_t *cr, cairo_t *cr2, int ch) case 14: // SO activate alternative char set if (argAPL) { // switch only of argAPL is set aplMode = 1; - printf("Setting APL mode to 1 from computer\n"); + // printf("Setting APL mode to 1 from computer\n"); } mode = 0; todo = 0; @@ -214,7 +214,7 @@ void tek4010_escapeCodeHandler(cairo_t *cr, cairo_t *cr2, int ch) aplMode = 0; mode = 0; todo = 0; - printf("Setting APL mode to 0 from computer\n"); + // printf("Setting APL mode to 0 from computer\n"); break; case 23: system("scrot --focussed"); mode= 0; break; @@ -358,7 +358,7 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int first) if (mode != 60) return; // no char available, need to allow for updates } - if (aplMode) printf("Receiving character %d from host\n", ch); + // if (aplMode) printf("Receiving character %d from host\n", ch); if (DEBUG) { printf("mode=%d, ch code %02X",mode,ch); diff --git a/tube.c b/tube.c index ef0440c..5afb8ff 100755 --- a/tube.c +++ b/tube.c @@ -177,13 +177,41 @@ int tube_getInputChar() return -1; } +void checkFont(char *fontName) +// check whether font has been installed +{ +#define MAXL 255 + FILE *f; + int i, ch; + char line[MAXL]; + sprintf(line,"fc-list \'%s\'", fontName); // prepare system call + f = popen(line, "r"); + if (f != NULL) { + i = 0; + line[0] = 0; + while (((ch=fgetc(f))!=EOF) && (i 0) { + pclose(f); + return; + } + } + pclose(f); + printf("Error: APL font \'%s\' not installed. This font is required for the APL mode.\n", fontName); + printf("See github.com/rricharz/tek4010 paragraph \'APL mode\'\n"); + exit(1); +} + void tube_init(int argc, char* argv[]) // put any code here to initialize the tek4010 { char *argv2[20]; size_t bufsize = 127; int firstArg = 1; - printf("tek4010 version 1.3.2\n"); + printf("tek4010 version 1.3.3\n"); windowName = "Tektronix 4010/4014 emulator"; if ((argc<2) || (argc>19)) { printf("Error:number of arguments\n"); @@ -220,6 +248,7 @@ void tube_init(int argc, char* argv[]) else if (strcmp(argv[firstArg],"-APL") == 0) { argAPL = 1; windowName = "Tektronix 4013/4015 emulator (APL)"; + checkFont(APL_FONT); } else if (strcmp(argv[firstArg],"-ARDS") == 0) { argARDS = 1; diff --git a/tube.h b/tube.h index 974e53b..cd72615 100644 --- a/tube.h +++ b/tube.h @@ -2,7 +2,7 @@ // fonts #define STANDARD_FONT "Monospace" -#define APL_FONT "APL385 Unicode" +#define APL_FONT "APL385 Unicode" enum LineType {SOLID,DOTTED,DOTDASH,SHORTDASH,LONGDASH}; extern enum LineType ltype; diff --git a/versions.txt b/versions.txt index 754aa58..02f32c2 100644 --- a/versions.txt +++ b/versions.txt @@ -1,3 +1,8 @@ +Version 1.3.3 May 12, 2019 +========================= +New features +- APL mode with APL character set added + Version 1.3.1 May 4, 2019 ========================= Bug fixes