commit 18b9d1802c44f9a212445d917d05d96265619bf4
parent 0f657ec2e0b2e3de09035d77dc545e811d08611f
Author: Frederic Cambus <fred@statdns.com>
Date: Sat, 16 Jan 2016 17:51:18 +0100
Moving 'alSelectFont' function and font structure to 'albinfonts' files
Diffstat:
4 files changed, 154 insertions(+), 151 deletions(-)
diff --git a/src/albinfonts.c b/src/albinfonts.c
@@ -11,6 +11,150 @@
#include "albinfonts.h"
+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;
+ }
+ else if (strcmp(font, "80x50") == 0) {
+ fontData->font_data = font_pc_80x50;
+ fontData->font_size_x = 9;
+ fontData->font_size_y = 8;
+ }
+ else if (strcmp(font, "terminus") == 0) {
+ fontData->font_data = font_pc_terminus;
+ fontData->font_size_x = 9;
+ fontData->font_size_y = 16;
+ }
+ else if (strcmp(font, "baltic") == 0) {
+ fontData->font_data = font_pc_baltic;
+ fontData->font_size_x = 9;
+ fontData->font_size_y = 16;
+ }
+ else if (strcmp(font, "cyrillic") == 0) {
+ fontData->font_data = font_pc_cyrillic;
+ fontData->font_size_x = 9;
+ fontData->font_size_y = 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;
+ }
+ else if (strcmp(font, "greek") == 0) {
+ fontData->font_data = font_pc_greek;
+ fontData->font_size_x = 9;
+ fontData->font_size_y = 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;
+ }
+ else if (strcmp(font, "hebrew") == 0) {
+ fontData->font_data = font_pc_hebrew;
+ fontData->font_size_x = 9;
+ fontData->font_size_y = 16;
+ }
+ else if (strcmp(font, "icelandic") == 0) {
+ fontData->font_data = font_pc_icelandic;
+ fontData->font_size_x = 9;
+ fontData->font_size_y = 16;
+ }
+ else if (strcmp(font, "latin1") == 0) {
+ fontData->font_data = font_pc_latin1;
+ fontData->font_size_x = 9;
+ fontData->font_size_y = 16;
+ }
+ else if (strcmp(font, "latin2") == 0) {
+ fontData->font_data = font_pc_latin2;
+ fontData->font_size_x = 9;
+ fontData->font_size_y = 16;
+ }
+ else if (strcmp(font, "nordic") == 0) {
+ fontData->font_data = font_pc_nordic;
+ fontData->font_size_x = 9;
+ fontData->font_size_y = 16;
+ }
+ else if (strcmp(font, "portuguese") == 0) {
+ fontData->font_data = font_pc_portuguese;
+ fontData->font_size_x = 9;
+ fontData->font_size_y = 16;
+ }
+ else if (strcmp(font, "russian") == 0) {
+ fontData->font_data = font_pc_russian;
+ fontData->font_size_x = 9;
+ fontData->font_size_y = 16;
+ }
+ else if (strcmp(font, "turkish") == 0) {
+ fontData->font_data = font_pc_turkish;
+ fontData->font_size_x = 9;
+ fontData->font_size_y = 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;
+ }
+ 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;
+ }
+ 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;
+ }
+ 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;
+ }
+ 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;
+ }
+ 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;
+ }
+ 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;
+ }
+ 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;
+ }
+ 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;
+ }
+ 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;
+ }
+}
+
unsigned char font_pc_80x25[4096] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00,
diff --git a/src/albinfonts.h b/src/albinfonts.h
@@ -10,12 +10,22 @@
//
#include <stdio.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#ifndef albinfonts_h
#define albinfonts_h
+struct fontStruct {
+ unsigned char *font_data;
+ int32_t font_size_x;
+ int32_t font_size_y;
+ bool isAmigaFont;
+};
+
+void alSelectFont(struct fontStruct* fontData, char *font);
+
// Binary font and image data.
unsigned char font_pc_80x25[4096];
diff --git a/src/ansilove.c b/src/ansilove.c
@@ -37,150 +37,6 @@ void alDrawChar(gdImagePtr im, const unsigned char *font_data, int32_t int_bits,
}
}
-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;
- }
- else if (strcmp(font, "80x50") == 0) {
- fontData->font_data = font_pc_80x50;
- fontData->font_size_x = 9;
- fontData->font_size_y = 8;
- }
- else if (strcmp(font, "terminus") == 0) {
- fontData->font_data = font_pc_terminus;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
- }
- else if (strcmp(font, "baltic") == 0) {
- fontData->font_data = font_pc_baltic;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
- }
- else if (strcmp(font, "cyrillic") == 0) {
- fontData->font_data = font_pc_cyrillic;
- fontData->font_size_x = 9;
- fontData->font_size_y = 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;
- }
- else if (strcmp(font, "greek") == 0) {
- fontData->font_data = font_pc_greek;
- fontData->font_size_x = 9;
- fontData->font_size_y = 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;
- }
- else if (strcmp(font, "hebrew") == 0) {
- fontData->font_data = font_pc_hebrew;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
- }
- else if (strcmp(font, "icelandic") == 0) {
- fontData->font_data = font_pc_icelandic;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
- }
- else if (strcmp(font, "latin1") == 0) {
- fontData->font_data = font_pc_latin1;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
- }
- else if (strcmp(font, "latin2") == 0) {
- fontData->font_data = font_pc_latin2;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
- }
- else if (strcmp(font, "nordic") == 0) {
- fontData->font_data = font_pc_nordic;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
- }
- else if (strcmp(font, "portuguese") == 0) {
- fontData->font_data = font_pc_portuguese;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
- }
- else if (strcmp(font, "russian") == 0) {
- fontData->font_data = font_pc_russian;
- fontData->font_size_x = 9;
- fontData->font_size_y = 16;
- }
- else if (strcmp(font, "turkish") == 0) {
- fontData->font_data = font_pc_turkish;
- fontData->font_size_x = 9;
- fontData->font_size_y = 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;
- }
- 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;
- }
- 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;
- }
- 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;
- }
- 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;
- }
- 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;
- }
- 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;
- }
- 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;
- }
- 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;
- }
- 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;
- }
-}
-
// ANSi
void alAnsiLoader(char *input, char *output, char *retinaout, char *font, int32_t int_bits, char *mode, bool icecolors, char *fext, bool createRetinaRep)
{
diff --git a/src/ansilove.h b/src/ansilove.h
@@ -63,11 +63,4 @@ struct ansiChar {
bool underline;
};
-struct fontStruct {
- unsigned char *font_data;
- int32_t font_size_x;
- int32_t font_size_y;
- bool isAmigaFont;
-};
-
#endif