ansilove

ANSI and ASCII art to PNG converter in C
Log | Files | Refs | README | LICENSE

commit 6007a77f0554daa16828208991a0f2f9bc5a1185
parent 1b9451f9a44937d546d4bf601d951bc732ff25fd
Author: Frederic Cambus <fred@statdns.com>
Date:   Tue,  7 Feb 2017 09:10:54 +0100

Whitespace fixes

Diffstat:
MChangeLog | 2--
MREADME.md | 10+++++-----
Msrc/fonts.c | 6+++---
Msrc/fonts.h | 2+-
Msrc/loaders/ansi.c | 2+-
Msrc/loaders/binary.c | 6+++---
Msrc/loaders/icedraw.c | 6+++---
Msrc/loaders/pcboard.c | 4++--
Msrc/loaders/xbin.c | 2+-
Msrc/main.c | 2+-
10 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -88,4 +88,3 @@ AnsiLove/C 2.2.1 (2015-06-28) - Adding 'AUTHORS', 'FILE_ID.DIZ', and 'THANKS' files - Fixing file extension detection (Close #2) - Fixing the PCB loader to use logical AND as it should - -\ No newline at end of file diff --git a/README.md b/README.md @@ -18,7 +18,7 @@ This is a complete rewrite of [AnsiLove/PHP](https://www.ansilove.org) in the C programming language. It converts ANSi and artscene related file formats into PNG images. The project is considered as stable, current version is `3.0.4`. -# Specs +# Specs AnsiLove/C is strictly using the `C99 standard` to achieve high portability to all major operating systems. Supported compilers are `GCC` and `Clang`, others may work but aren't tested. We use Linux, OpenBSD and Mac OS X for AnsiLove/C development. @@ -81,10 +81,10 @@ Rendering of all known ANSi / ASCII art file types: Files with custom suffix default to the ANSi renderer (e.g. ICE or CIA). -AnsiLove/C is capabable of processing: +AnsiLove/C is capabable of processing: - SAUCE records -- DOS and Amiga fonts (embedded binary dump) +- DOS and Amiga fonts (embedded binary dump) - iCE colors Even more: @@ -122,7 +122,7 @@ There are certain cases where you need to set options for proper rendering. Howe ## Fonts -We dumped many fonts as binary data right into AnsiLove/C, so the most popular typefaces for rendering ANSi / ASCII art are available at your fingertips. +We dumped many fonts as binary data right into AnsiLove/C, so the most popular typefaces for rendering ANSi / ASCII art are available at your fingertips. PC fonts can be (all case-sensitive): @@ -190,7 +190,7 @@ When an ANSi source was created using iCE colors, it was done with a special mod ## SAUCE records -It's fine to use AnsiLove/C as SAUCE reader without generating any output, just set option `-s` for this purpose. +It's fine to use AnsiLove/C as SAUCE reader without generating any output, just set option `-s` for this purpose. # Who pulls the strings diff --git a/src/fonts.c b/src/fonts.c @@ -76,7 +76,7 @@ void alSelectFont(struct fontStruct* fontData, char *font) { else if (strcmp(font, "nordic") == 0) { fontData->font_data = font_pc_nordic; fontData->font_size_x = 9; - fontData->font_size_y = 16; + fontData->font_size_y = 16; } else if (strcmp(font, "portuguese") == 0) { fontData->font_data = font_pc_portuguese; @@ -127,7 +127,7 @@ void alSelectFont(struct fontStruct* fontData, char *font) { fontData->isAmigaFont = true; fontData->font_data = font_amiga_topaz_1200; fontData->font_size_x = 8; - fontData->font_size_y = 16; + fontData->font_size_y = 16; } else if (strcmp(font, "topaz+") == 0) { fontData->isAmigaFont = true; @@ -542,7 +542,7 @@ unsigned char font_pc_80x50[2048] = { 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c, 0x1c, 0x6c, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x18, 0x30, 0x7c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; unsigned char font_pc_baltic[4096] = { diff --git a/src/fonts.h b/src/fonts.h @@ -9,7 +9,7 @@ // See the file LICENSE for details. // -#include <stdio.h> +#include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <stdint.h> diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c @@ -386,7 +386,7 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output, c position_y_max=position_y; } - // write current character in ansiChar structure + // write current character in ansiChar structure if (!fontData.isAmigaFont || (current_character != 12 && current_character != 13)) { // reallocate structure array memory diff --git a/src/loaders/binary.c b/src/loaders/binary.c @@ -23,7 +23,7 @@ void binary(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output, gdImagePtr im_Binary; // allocate buffer image memory - im_Binary = gdImageCreate(columns * bits, + im_Binary = gdImageCreate(columns * bits, ((inputFileSize / 2) / columns * fontData.font_size_y)); if (!im_Binary) { @@ -59,7 +59,7 @@ void binary(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output, while (loop < inputFileSize) { - if (position_x == columns) + if (position_x == columns) { position_x = 0; position_y++; @@ -76,7 +76,7 @@ void binary(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output, color_background -= 8; } - alDrawChar(im_Binary, fontData.font_data, bits, fontData.font_size_y, + alDrawChar(im_Binary, fontData.font_data, bits, fontData.font_size_y, position_x, position_y, colors[color_background], colors[color_foreground], character); position_x++; diff --git a/src/loaders/icedraw.c b/src/loaders/icedraw.c @@ -16,7 +16,7 @@ void icedraw(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output const unsigned char *font_data; unsigned char *font_data_idf; - // extract relevant part of the IDF header, 16-bit endian unsigned short + // extract relevant part of the IDF header, 16-bit endian unsigned short int32_t x2 = (inputFileBuffer[9] << 8) + inputFileBuffer[8]; // libgd image pointers @@ -45,7 +45,7 @@ void icedraw(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output int16_t idf_data, idf_data_length; - while (loop < inputFileSize - 4096 - 48) + while (loop < inputFileSize - 4096 - 48) { memcpy(&idf_data,inputFileBuffer+loop,2); @@ -56,7 +56,7 @@ void icedraw(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output idf_sequence_length = idf_data_length & 255; - for (idf_sequence_loop = 0; idf_sequence_loop < idf_sequence_length; idf_sequence_loop++) + for (idf_sequence_loop = 0; idf_sequence_loop < idf_sequence_length; idf_sequence_loop++) { // reallocate IDF buffer memory temp = realloc(idf_buffer, (i + 2) * sizeof(unsigned char)); diff --git a/src/loaders/pcboard.c b/src/loaders/pcboard.c @@ -25,8 +25,8 @@ void pcboard(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output gdImagePtr im_PCB; // process PCBoard - int32_t character, current_character, next_character; - int32_t color_background = 0, color_foreground = 7; + int32_t character, current_character, next_character; + int32_t color_background = 0, color_foreground = 7; int32_t position_x = 0, position_y = 0, position_x_max = 0, position_y_max = 0; // PCB buffer structure array definition diff --git a/src/loaders/xbin.c b/src/loaders/xbin.c @@ -94,7 +94,7 @@ void xbin(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output, c font_data = font_pc_80x25; } - int32_t position_x = 0, position_y = 0; + int32_t position_x = 0, position_y = 0; int32_t character, attribute, color_foreground, color_background; // read compressed xbin diff --git a/src/main.c b/src/main.c @@ -71,7 +71,7 @@ void showHelp(void) { } void listExamples(void) { - printf("\nEXAMPLES:\n"); + printf("\nEXAMPLES:\n"); printf(" ansilove file.ans (output path/name identical to input, no options)\n" " ansilove -i file.ans (enable iCE colors)\n" " ansilove -r file.ans (adds Retina @2x output file)\n"