Skip to content
Browse files

full font support for .bin and .pcb files

Binary and PCBoard files did render with Terminus and DOS font, this is
changed now. All documented / embedded fonts supported. Removed some
commented code, also did some typecasting that suppresses warnings when
compiling with latest Xcode under Mountain Lion. The codebase is now
pretty mature, complete and stable, so we decided to move 1.1.x branch.
  • Loading branch information...
1 parent 3dc24b4 commit c489d08de15981dcb1cdad73440fc76d807d723a @ByteProject ByteProject committed
Showing with 230 additions and 35 deletions.
  1. +1 −3 README.md
  2. +1 −1 ansilove.xcodeproj/project.pbxproj
  3. +1 −1 ansilove/alconfig.h
  4. +227 −30 ansilove/ansilove.c
View
4 README.md
@@ -1,6 +1,6 @@
# AnsiLove/C
-This is a complete rewrite of [AnsiLove/PHP](http://ansilove.sourceforge.net) in the C programming language. It converts ANSi and artscene related file formats into [PNG images](http://cl.ly/1D0o1M2t2Y190v33462F/o). Unlike the PHP variant, AnsiLove/C is intended as UNIX command line tool you install preferably to `/usr/bin`. The project is considered as completed and stable, current version is `1.0.248`.
+This is a complete rewrite of [AnsiLove/PHP](http://ansilove.sourceforge.net) in the C programming language. It converts ANSi and artscene related file formats into [PNG images](http://cl.ly/1D0o1M2t2Y190v33462F/o). Unlike the PHP variant, AnsiLove/C is intended as UNIX command line tool you install preferably to `/usr/bin`. The project is considered as completed and stable, current version is `1.1.0`.
# Specs
@@ -77,7 +77,6 @@ PC fonts can be (all case-sensitive):
- `80x25` (code page 437)
- `80x50` (code page 437, 80x50 mode)
-- `armenian`
- `baltic` (code page 775)
- `cyrillic` (code page 855)
- `french-canadian` (code page 863)
@@ -88,7 +87,6 @@ PC fonts can be (all case-sensitive):
- `latin1` (code page 850)
- `latin2` (code page 852)
- `nordic` (code page 865)
-- `persian` (Iran System encoding standard)
- `portuguese` (Code page 860)
- `russian` (code page 866)
- `terminus` (modern font, code page 437)
View
2 ansilove.xcodeproj/project.pbxproj
@@ -164,7 +164,7 @@
F8D6326E14A08C0F00C5352F /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0430;
+ LastUpgradeCheck = 0440;
};
buildConfigurationList = F8D6327114A08C0F00C5352F /* Build configuration list for PBXProject "ansilove" */;
compatibilityVersion = "Xcode 3.2";
View
2 ansilove/alconfig.h
@@ -14,7 +14,7 @@
#define alconfig_h
// configuration defines
-#define VERSION "1.0.248"
+#define VERSION "1.1.0"
#define PCBOARD_STRIP_CODES "@POFF@,@WAIT@"
View
257 ansilove/ansilove.c
@@ -74,11 +74,6 @@ void alAnsiLoader(char *input, char output[], char font[], char bits[], char ice
font_size_x = 9;
font_size_y = 16;
}
-/* else if (strcmp(font, "armenian") == 0) {
- font_file = "ansilove_font_pc_armenian.png";
- font_size_x = 9;
- font_size_y = 16;
- }*/
else if (strcmp(font, "baltic") == 0) {
font_data = font_pc_baltic;
font_size_x = 9;
@@ -129,11 +124,6 @@ void alAnsiLoader(char *input, char output[], char font[], char bits[], char ice
font_size_x = 9;
font_size_y = 16;
}
-/* else if (strcmp(font, "persian") == 0) {
- font_file = "ansilove_font_pc_persian.png";
- font_size_x = 9;
- font_size_y = 16;
- }*/
else if (strcmp(font, "portuguese") == 0) {
font_data = font_pc_portuguese;
font_size_x = 9;
@@ -155,18 +145,6 @@ void alAnsiLoader(char *input, char output[], char font[], char bits[], char ice
font_size_x = 8;
font_size_y = 16;
}
-/* else if (strcmp(font, "b-strict") == 0) {
- isAmigaFont = true;
- font_file = "ansilove_font_amiga_b-strict.png";
- font_size_x = 8;
- font_size_y = 8;
- }
- else if (strcmp(font, "b-struct") == 0) {
- isAmigaFont = true;
- font_file = "ansilove_font_amiga_b-struct.png";
- font_size_x = 8;
- font_size_y = 8;
- }*/
else if (strcmp(font, "microknight") == 0) {
isAmigaFont = true;
font_data = font_amiga_microknight;
@@ -290,7 +268,7 @@ void alAnsiLoader(char *input, char output[], char font[], char bits[], char ice
char *stripped_file_buffer;
stripped_file_buffer = str_replace((const char *)input_file_buffer, "\r\n", "");
input_file_buffer = (unsigned char *)stripped_file_buffer;
- input_file_size = strlen((const char *)input_file_buffer);
+ input_file_size = (int32_t)strlen((const char *)input_file_buffer);
}
// libgd image pointers
@@ -1029,23 +1007,133 @@ void alPcBoardLoader(char *input, char output[], char font[], char bits[])
// let's see what font we should use to render output
if (strcmp(font, "80x25") == 0) {
font_data = font_pc_80x25;
- font_size_x = 8;
+ font_size_x = 9;
font_size_y = 16;
}
else if (strcmp(font, "80x50") == 0) {
font_data = font_pc_80x50;
- font_size_x = 8;
+ font_size_x = 9;
font_size_y = 8;
}
else if (strcmp(font, "terminus") == 0) {
font_data = font_pc_terminus;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "baltic") == 0) {
+ font_data = font_pc_baltic;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "cyrillic") == 0) {
+ font_data = font_pc_cyrillic;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "french-canadian") == 0) {
+ font_data = font_pc_french_canadian;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "greek") == 0) {
+ font_data = font_pc_greek;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "greek-869") == 0) {
+ font_data = font_pc_greek_869;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "hebrew") == 0) {
+ font_data = font_pc_hebrew;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "icelandic") == 0) {
+ font_data = font_pc_icelandic;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "latin1") == 0) {
+ font_data = font_pc_latin1;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "latin2") == 0) {
+ font_data = font_pc_latin2;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "nordic") == 0) {
+ font_data = font_pc_nordic;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "portuguese") == 0) {
+ font_data = font_pc_portuguese;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "russian") == 0) {
+ font_data = font_pc_russian;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "turkish") == 0) {
+ font_data = font_pc_turkish;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "amiga") == 0) {
+ font_data = font_amiga_topaz_1200;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "microknight") == 0) {
+ font_data = font_amiga_microknight;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "microknight+") == 0) {
+ font_data = font_amiga_microknight_plus;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "mosoul") == 0) {
+ font_data = font_amiga_mosoul;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "pot-noodle") == 0) {
+ font_data = font_amiga_pot_noodle;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "topaz") == 0) {
+ font_data = font_amiga_topaz_1200;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "topaz+") == 0) {
+ font_data = font_amiga_topaz_1200_plus;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "topaz500") == 0) {
+ font_data = font_amiga_topaz_500;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "topaz500+") == 0) {
+ font_data = font_amiga_topaz_500_plus;
font_size_x = 8;
font_size_y = 16;
}
else {
// in all other cases use the standard DOS font
font_data = font_pc_80x25;
- font_size_x = 8;
+ font_size_x = 9;
font_size_y = 16;
}
@@ -1288,27 +1376,136 @@ void alBinaryLoader(char *input, char output[], char columns[], char font[], cha
int32_t font_size_y;
const unsigned char *font_data;
-
// let's see what font we should use to render output
if (strcmp(font, "80x25") == 0) {
font_data = font_pc_80x25;
- font_size_x = 8;
+ font_size_x = 9;
font_size_y = 16;
}
else if (strcmp(font, "80x50") == 0) {
font_data = font_pc_80x50;
- font_size_x = 8;
+ font_size_x = 9;
font_size_y = 8;
}
else if (strcmp(font, "terminus") == 0) {
font_data = font_pc_terminus;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "baltic") == 0) {
+ font_data = font_pc_baltic;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "cyrillic") == 0) {
+ font_data = font_pc_cyrillic;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "french-canadian") == 0) {
+ font_data = font_pc_french_canadian;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "greek") == 0) {
+ font_data = font_pc_greek;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "greek-869") == 0) {
+ font_data = font_pc_greek_869;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "hebrew") == 0) {
+ font_data = font_pc_hebrew;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "icelandic") == 0) {
+ font_data = font_pc_icelandic;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "latin1") == 0) {
+ font_data = font_pc_latin1;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "latin2") == 0) {
+ font_data = font_pc_latin2;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "nordic") == 0) {
+ font_data = font_pc_nordic;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "portuguese") == 0) {
+ font_data = font_pc_portuguese;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "russian") == 0) {
+ font_data = font_pc_russian;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "turkish") == 0) {
+ font_data = font_pc_turkish;
+ font_size_x = 9;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "amiga") == 0) {
+ font_data = font_amiga_topaz_1200;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "microknight") == 0) {
+ font_data = font_amiga_microknight;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "microknight+") == 0) {
+ font_data = font_amiga_microknight_plus;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "mosoul") == 0) {
+ font_data = font_amiga_mosoul;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "pot-noodle") == 0) {
+ font_data = font_amiga_pot_noodle;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "topaz") == 0) {
+ font_data = font_amiga_topaz_1200;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "topaz+") == 0) {
+ font_data = font_amiga_topaz_1200_plus;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "topaz500") == 0) {
+ font_data = font_amiga_topaz_500;
+ font_size_x = 8;
+ font_size_y = 16;
+ }
+ else if (strcmp(font, "topaz500+") == 0) {
+ font_data = font_amiga_topaz_500_plus;
font_size_x = 8;
font_size_y = 16;
}
else {
// in all other cases use the standard DOS font
font_data = font_pc_80x25;
- font_size_x = 8;
+ font_size_x = 9;
font_size_y = 16;
}

0 comments on commit c489d08

Please sign in to comment.
Something went wrong with that request. Please try again.