1
0
mirror of https://github.com/rricharz/Tek4010.git synced 2026-04-16 00:21:39 +00:00

variable character size added

This commit is contained in:
¨Rene Richarz
2019-04-12 15:57:54 +02:00
parent 42919cc015
commit bda22ae3a8
6 changed files with 41 additions and 27 deletions

5
ards.c
View File

@@ -64,9 +64,8 @@ void ards_draw(cairo_t *cr, cairo_t *cr2, int first)
eoffx = 0;
refresh_interval = 30;
}
hDotsPerChar = actualWidth / 74;
vDotsPerChar = windowHeight / 35;
windowWidth = actualWidth;
tube_changeCharacterSize(cr, cr2, 74, 35, (int) (18.0 * efactor));
// printf("Scaling: %0.2f\n", efactor);
// printf("Offset: %d\n",eoffx);
// printf("Refresh interval: %d\n",refresh_interval);
@@ -85,7 +84,7 @@ void ards_draw(cairo_t *cr, cairo_t *cr2, int first)
tube_clearPersistent(cr,cr2);
}
tube_setupPainting(cr, cr2, "Monospace", (int)(efactor * 18));
tube_setupPainting(cr, cr2, "Monospace");
do {
ch = tube_getInputChar();

BIN
tek4010

Binary file not shown.

View File

@@ -103,6 +103,7 @@ void tek4010_escapeCodeHandler(cairo_t *cr, cairo_t *cr2, int ch)
break;
case 12:
if (DEBUG) printf("Form feed, clear screen\n");
tube_changeCharacterSize(cr, cr2, 74, 35, (int) (18.0 * efactor));
tube_clearPersistent(cr,cr2);
mode = 0;
break;
@@ -127,7 +128,6 @@ void tek4010_escapeCodeHandler(cairo_t *cr, cairo_t *cr2, int ch)
plotPointMode = 0;
break;
// start of ignoring ANSI escape sequencies, could be improved (but the Tek4010 couldn't do this either!)
case '0':
case '1':
case '2':
@@ -135,15 +135,14 @@ void tek4010_escapeCodeHandler(cairo_t *cr, cairo_t *cr2, int ch)
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': break;
case ';': mode = 31; break;
case ']': break;
case 'm': mode = 0; break;
case '7': printf("esc %c\n", ch); mode = 31; break;
case '8': tube_changeCharacterSize(cr, cr2, 74, 35, (int)(efactor * 18)); break;
case '9': tube_changeCharacterSize(cr, cr2, 81, 38, (int)(efactor * 16)); break;
case ':': tube_changeCharacterSize(cr, cr2, 121, 58, (int)(efactor * 11)); break;
case ';': tube_changeCharacterSize(cr, cr2, 133, 64, (int)(efactor * 10)); break;
case ']': printf("esc %c\n", ch); break;
case 'm': mode = 0; break;
// end of ignoring ANSI escape sequencies
case '`': ltype = SOLID; writeThroughMode = 0; mode = 0; break;
case 'a': ltype = DOTTED; writeThroughMode = 0; mode = 0; break;
case 'b': ltype = DOTDASH; writeThroughMode = 0; mode = 0; break;
@@ -208,9 +207,8 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int first)
eoffx = 0;
refresh_interval = 30;
}
hDotsPerChar = actualWidth / 74;
vDotsPerChar = windowHeight / 35;
windowWidth = actualWidth;
tube_changeCharacterSize(cr, cr2, 74, 35, (int) (18.0 * efactor));
// printf("Scaling: %0.2f\n", efactor);
// printf("Offset: %d\n",eoffx);
// printf("Refresh interval: %d\n",refresh_interval);
@@ -227,9 +225,10 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int first)
// clear persistent surface, if necessary
if (globaltube_clearPersistent) {
tube_clearPersistent(cr,cr2);
tube_changeCharacterSize(cr, cr2, 74, 35, (int) (18.0 * efactor));
}
tube_setupPainting(cr, cr2, "Monospace", (int)(efactor * 18));
tube_setupPainting(cr, cr2, "Monospace");
if (plotPointMode)
todo = 16 * TODO;

25
tube.c
View File

@@ -88,6 +88,7 @@ long refreshCount = 0; // variables for baud rate and refresh rate mea
static long charCount = 0;
static long charResetCount = 0;
static long characterInterval = 0;
static int currentFontSize = 18;
long startPaintTime;
@@ -462,7 +463,10 @@ void tube_drawCharacter(cairo_t *cr, cairo_t *cr2, char ch)
{
char s[2];
s[0] = ch;
s[1] = 0;
s[1] = 0;
cairo_set_font_size(cr, currentFontSize);
cairo_set_font_size(cr2,currentFontSize);
if (writeThroughMode) { // draw the write-through character
cairo_set_source_rgb(cr2, 0, WRITE_TROUGH_INTENSITY, 0);
@@ -568,15 +572,20 @@ void tube_drawVector(cairo_t *cr, cairo_t *cr2)
isBrightSpot = 1; // also to be set if writeThroughMode
}
void tube_setupPainting(cairo_t *cr, cairo_t *cr2, char *fontName, int fontSize)
void tube_setupPainting(cairo_t *cr, cairo_t *cr2, char *fontName)
{
cairo_set_antialias(cr, CAIRO_ANTIALIAS_BEST);
cairo_set_line_width (cr, 1);
cairo_set_source_rgb(cr, 0, NORMAL_INTENSITY, 0);
cairo_set_source_rgb(cr, 0, NORMAL_INTENSITY, 0);
cairo_select_font_face(cr, fontName, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face(cr2, fontName, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size(cr, fontSize);
cairo_set_font_size(cr2,fontSize);
cairo_select_font_face(cr2, fontName, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
}
void tube_changeCharacterSize(cairo_t *cr, cairo_t *cr2,int charsPerLine, int charsPerPage, int fontSize)
{
int fontsize;
hDotsPerChar = windowWidth / charsPerLine;
vDotsPerChar = windowHeight / charsPerPage;
leftmargin = 0;
currentFontSize = fontSize;
}

9
tube.h
View File

@@ -37,7 +37,8 @@ extern void tube_clearPersistent(cairo_t *cr, cairo_t *cr2);
extern int tube_isInput();
extern int tube_getInputChar();
extern void tube_emulateDeflectionTime();
void tube_drawVector(cairo_t *cr, cairo_t *cr2);
void tube_drawCharacter(cairo_t *cr, cairo_t *cr2, char ch);
void tube_drawPoint(cairo_t *cr, cairo_t *cr2);
void tube_setupPainting(cairo_t *cr, cairo_t *cr2, char *fontName, int fontSize);
extern void tube_drawVector(cairo_t *cr, cairo_t *cr2);
extern void tube_drawCharacter(cairo_t *cr, cairo_t *cr2, char ch);
extern void tube_drawPoint(cairo_t *cr, cairo_t *cr2);
extern void tube_setupPainting(cairo_t *cr, cairo_t *cr2, char *fontName);
extern void tube_changeCharacterSize(cairo_t *cr, cairo_t *cr2, int charsPerLine, int charsPerPage, int fontSize);

View File

@@ -1,3 +1,9 @@
Next version t.b.b
==================
New features
- variable character size, set with ESC sequencies, reset if screen is cleared
Version 1.1 April 12, 2019
==========================
Phase: Fist offical release