libansilove

Library for converting ANSI, ASCII, and other formats to PNG
Log | Files | Refs | README | LICENSE

commit 822faedb5d40e3b9f18184863e1a812a82a72dce
parent c1e10d3c6a2f9342d2bedc028e036deb8a3555a2
Author: Frederic Cambus <fred@statdns.com>
Date:   Fri, 25 Sep 2020 22:50:23 +0200

Remove systematic filtering of Form Feed characters in Amiga mode.

Diffstat:
Msrc/loaders/ansi.c | 54++++++++++++++++++++++++++----------------------------
1 file changed, 26 insertions(+), 28 deletions(-)

diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c @@ -157,39 +157,37 @@ ansilove_ansi(struct ansilove_ctx *ctx, struct ansilove_options *options) rowMax = row; /* write current character in ansiChar structure */ - if (!fontData.isAmigaFont || (current_character != 12)) { - /* reallocate structure array memory */ - if (structIndex == ansi_buffer_size) { - ansi_buffer_size += ANSI_BUFFER_SIZE; - - ptr = realloc(ansi_buffer, ansi_buffer_size * sizeof(struct ansiChar)); - - if (ptr == NULL) { - ctx->error = ANSILOVE_MEMORY_ERROR; - free(ansi_buffer); - return -1; - } else { - ansi_buffer = ptr; - } - } + /* reallocate structure array memory */ + if (structIndex == ansi_buffer_size) { + ansi_buffer_size += ANSI_BUFFER_SIZE; - if (invert) { - ansi_buffer[structIndex].background = foreground % 8; - ansi_buffer[structIndex].foreground = background + (foreground & 8); - } else { - ansi_buffer[structIndex].background = - background24 ? background24 : background; + ptr = realloc(ansi_buffer, ansi_buffer_size * sizeof(struct ansiChar)); - ansi_buffer[structIndex].foreground = - foreground24 ? foreground24 : foreground; + if (ptr == NULL) { + ctx->error = ANSILOVE_MEMORY_ERROR; + free(ansi_buffer); + return -1; + } else { + ansi_buffer = ptr; } - ansi_buffer[structIndex].character = current_character; - ansi_buffer[structIndex].column = column; - ansi_buffer[structIndex].row = row; + } + + if (invert) { + ansi_buffer[structIndex].background = foreground % 8; + ansi_buffer[structIndex].foreground = background + (foreground & 8); + } else { + ansi_buffer[structIndex].background = + background24 ? background24 : background; - structIndex++; - column++; + ansi_buffer[structIndex].foreground = + foreground24 ? foreground24 : foreground; } + ansi_buffer[structIndex].character = current_character; + ansi_buffer[structIndex].column = column; + ansi_buffer[structIndex].row = row; + + structIndex++; + column++; } break; case STATE_SEQUENCE: