commit c52f0b8dcdd50b7502e1258a357702de65034f7e
parent c09aa0592de8542e5d5eafe5c541083c908d8ec9
Author: Frederic Cambus <fred@statdns.com>
Date: Sun, 16 Apr 2017 22:44:42 +0200
Rename font_size_x and font_size_y variables to width and height
Diffstat:
8 files changed, 71 insertions(+), 71 deletions(-)
diff --git a/src/ansilove.c b/src/ansilove.c
@@ -13,23 +13,23 @@
// shared method for drawing characters
void alDrawChar(gdImagePtr im, const unsigned char *font_data, int32_t bits,
- int32_t font_size_y, int32_t position_x, int32_t position_y,
+ int32_t height, int32_t position_x, int32_t position_y,
int32_t background, int32_t foreground, unsigned char character)
{
int32_t column, line;
- gdImageFilledRectangle(im, position_x * bits, position_y*font_size_y, position_x * bits +
- bits - 1, position_y * font_size_y + font_size_y - 1, background);
+ gdImageFilledRectangle(im, position_x * bits, position_y*height, position_x * bits +
+ bits - 1, position_y * height + height - 1, background);
- for (line = 0; line < font_size_y; line++) {
+ for (line = 0; line < height; line++) {
for (column = 0; column < bits; column++) {
- if ((font_data[line+character*font_size_y] & (0x80 >> column)) != 0) {
- gdImageSetPixel(im, position_x * bits + column, position_y*font_size_y + line, foreground);
+ if ((font_data[line+character*height] & (0x80 >> column)) != 0) {
+ gdImageSetPixel(im, position_x * bits + column, position_y*height + line, foreground);
if (bits==9 && column==7 && character > 191 && character < 224)
{
- gdImageSetPixel(im, position_x * bits + 8, position_y * font_size_y + line, foreground);
+ gdImageSetPixel(im, position_x * bits + 8, position_y * height + line, foreground);
}
}
}
diff --git a/src/ansilove.h b/src/ansilove.h
@@ -31,7 +31,7 @@
// prototypes
void alDrawChar(gdImagePtr im, const unsigned char *font_data, int32_t bits,
- int32_t font_size_y, int32_t position_x, int32_t position_y,
+ int32_t height, int32_t position_x, int32_t position_y,
int32_t background, int32_t foreground, unsigned char character);
#endif
diff --git a/src/fonts.c b/src/fonts.c
@@ -15,143 +15,143 @@ void alSelectFont(struct fontStruct* fontData, char *font) {
// determine the font we use to render the output
if (strcmp(font, "80x25") == 0) {
fontData->font_data = font_pc_80x25;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "80x50") == 0) {
fontData->font_data = font_pc_80x50;
- fontData->font_size_x = 9;
- fontData->font_size_y = 8;
+ fontData->width = 9;
+ fontData->height = 8;
}
else if (strcmp(font, "terminus") == 0) {
fontData->font_data = font_pc_terminus;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "baltic") == 0) {
fontData->font_data = font_pc_baltic;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "cyrillic") == 0) {
fontData->font_data = font_pc_cyrillic;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "french-canadian") == 0) {
fontData->font_data = font_pc_french_canadian;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "greek") == 0) {
fontData->font_data = font_pc_greek;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "greek-869") == 0) {
fontData->font_data = font_pc_greek_869;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "hebrew") == 0) {
fontData->font_data = font_pc_hebrew;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "icelandic") == 0) {
fontData->font_data = font_pc_icelandic;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "latin1") == 0) {
fontData->font_data = font_pc_latin1;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "latin2") == 0) {
fontData->font_data = font_pc_latin2;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "nordic") == 0) {
fontData->font_data = font_pc_nordic;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "portuguese") == 0) {
fontData->font_data = font_pc_portuguese;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "russian") == 0) {
fontData->font_data = font_pc_russian;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "turkish") == 0) {
fontData->font_data = font_pc_turkish;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
else if (strcmp(font, "amiga") == 0) {
fontData->isAmigaFont = true;
fontData->font_data = font_amiga_topaz_1200;
- fontData->font_size_x = 8;
- fontData->font_size_y = 16;
+ fontData->width = 8;
+ fontData->height = 16;
}
else if (strcmp(font, "microknight") == 0) {
fontData->isAmigaFont = true;
fontData->font_data = font_amiga_microknight;
- fontData->font_size_x = 8;
- fontData->font_size_y = 16;
+ fontData->width = 8;
+ fontData->height = 16;
}
else if (strcmp(font, "microknight+") == 0) {
fontData->isAmigaFont = true;
fontData->font_data = font_amiga_microknight_plus;
- fontData->font_size_x = 8;
- fontData->font_size_y = 16;
+ fontData->width = 8;
+ fontData->height = 16;
}
else if (strcmp(font, "mosoul") == 0) {
fontData->isAmigaFont = true;
fontData->font_data = font_amiga_mosoul;
- fontData->font_size_x = 8;
- fontData->font_size_y = 16;
+ fontData->width = 8;
+ fontData->height = 16;
}
else if (strcmp(font, "pot-noodle") == 0) {
fontData->isAmigaFont = true;
fontData->font_data = font_amiga_pot_noodle;
- fontData->font_size_x = 8;
- fontData->font_size_y = 16;
+ fontData->width = 8;
+ fontData->height = 16;
}
else if (strcmp(font, "topaz") == 0) {
fontData->isAmigaFont = true;
fontData->font_data = font_amiga_topaz_1200;
- fontData->font_size_x = 8;
- fontData->font_size_y = 16;
+ fontData->width = 8;
+ fontData->height = 16;
}
else if (strcmp(font, "topaz+") == 0) {
fontData->isAmigaFont = true;
fontData->font_data = font_amiga_topaz_1200_plus;
- fontData->font_size_x = 8;
- fontData->font_size_y = 16;
+ fontData->width = 8;
+ fontData->height = 16;
}
else if (strcmp(font, "topaz500") == 0) {
fontData->isAmigaFont = true;
fontData->font_data = font_amiga_topaz_500;
- fontData->font_size_x = 8;
- fontData->font_size_y = 16;
+ fontData->width = 8;
+ fontData->height = 16;
}
else if (strcmp(font, "topaz500+") == 0) {
fontData->isAmigaFont = true;
fontData->font_data = font_amiga_topaz_500_plus;
- fontData->font_size_x = 8;
- fontData->font_size_y = 16;
+ fontData->width = 8;
+ fontData->height = 16;
}
else {
// in all other cases use the standard DOS font
fontData->font_data = font_pc_80x25;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
+ fontData->width = 9;
+ fontData->height = 16;
}
}
diff --git a/src/fonts.h b/src/fonts.h
@@ -20,8 +20,8 @@
struct fontStruct {
unsigned char *font_data;
- int32_t font_size_x;
- int32_t font_size_y;
+ int32_t width;
+ int32_t height;
bool isAmigaFont;
};
diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c
@@ -418,7 +418,7 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output, c
}
// create that damn thingy
- im_ANSi = gdImageCreate(columns * bits,(position_y_max)*fontData.font_size_y);
+ im_ANSi = gdImageCreate(columns * bits,(position_y_max)*fontData.height);
if (!im_ANSi) {
perror("Can't allocate ANSi buffer image memory");
@@ -496,10 +496,10 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output, c
position_y = ansi_buffer[loop].position_y;
if (ced) {
- alDrawChar(im_ANSi, fontData.font_data, bits, fontData.font_size_y,
+ alDrawChar(im_ANSi, fontData.font_data, bits, fontData.height,
position_x, position_y, ced_background, ced_foreground, character);
} else {
- alDrawChar(im_ANSi, fontData.font_data, bits, fontData.font_size_y,
+ alDrawChar(im_ANSi, fontData.font_data, bits, fontData.height,
position_x, position_y, colors[background], colors[foreground], character);
}
diff --git a/src/loaders/binary.c b/src/loaders/binary.c
@@ -24,7 +24,7 @@ void binary(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output,
// allocate buffer image memory
im_Binary = gdImageCreate(columns * bits,
- ((inputFileSize / 2) / columns * fontData.font_size_y));
+ ((inputFileSize / 2) / columns * fontData.height));
if (!im_Binary) {
perror("Error, can't allocate buffer image memory");
@@ -77,7 +77,7 @@ void binary(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output,
background -= 8;
}
- alDrawChar(im_Binary, fontData.font_data, bits, fontData.font_size_y,
+ alDrawChar(im_Binary, fontData.font_data, bits, fontData.height,
position_x, position_y, colors[background], colors[foreground], character);
position_x++;
diff --git a/src/loaders/pcboard.c b/src/loaders/pcboard.c
@@ -144,7 +144,7 @@ void pcboard(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output
position_y_max++;
// allocate buffer image memory
- im_PCB = gdImageCreate(columns * bits, (position_y_max)*fontData.font_size_y);
+ im_PCB = gdImageCreate(columns * bits, (position_y_max)*fontData.height);
// allocate black color and create background canvas
gdImageColorAllocate(im_PCB, 0, 0, 0);
@@ -183,7 +183,7 @@ void pcboard(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output
foreground = pcboard_buffer[loop].foreground;
character = pcboard_buffer[loop].current_character;
- alDrawChar(im_PCB, fontData.font_data, bits, fontData.font_size_y,
+ alDrawChar(im_PCB, fontData.font_data, bits, fontData.height,
position_x, position_y, colors[background], colors[foreground], character);
}
diff --git a/src/loaders/tundra.c b/src/loaders/tundra.c
@@ -95,7 +95,7 @@ void tundra(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output,
position_y++;
// allocate buffer image memory
- im_Tundra = gdImageCreateTrueColor(columns * bits , (position_y) * fontData.font_size_y);
+ im_Tundra = gdImageCreateTrueColor(columns * bits , (position_y) * fontData.height);
if (!im_Tundra) {
perror("Error, can't allocate buffer image memory");
@@ -169,7 +169,7 @@ void tundra(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output,
if (character !=1 && character !=2 && character !=4 && character !=6)
{
- alDrawChar(im_Tundra, fontData.font_data, bits, fontData.font_size_y,
+ alDrawChar(im_Tundra, fontData.font_data, bits, fontData.height,
position_x, position_y, background, foreground, character);
position_x++;