fortplot_ascii_rendering Module

ASCII terminal plotting backend - Core Rendering Logic

This module contains the core rendering functionality for ASCII plotting, including canvas output, file writing, and terminal display.

Author: fortplot contributors



Functions

public function ascii_get_output(canvas, width, height) result(output)

Get the complete ASCII canvas as a string

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in) :: canvas(:,:)
integer, intent(in) :: width
integer, intent(in) :: height

Return Value character(len=:), allocatable


Subroutines

public subroutine ascii_finalize(canvas, text_elements, num_text_elements, arrow_elements, num_arrow_elements, plot_width, plot_height, title_text, xlabel_text, ylabel_text, legend_lines, num_legend_lines, filename, text_charset, color_mode, canvas_color)

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(inout) :: canvas(:,:)
type(text_element_t), intent(inout) :: text_elements(:)
integer, intent(in) :: num_text_elements
type(text_element_t), intent(inout) :: arrow_elements(:)
integer, intent(in) :: num_arrow_elements
integer, intent(in) :: plot_width
integer, intent(in) :: plot_height
character(len=:), intent(in), allocatable :: title_text
character(len=:), intent(in), allocatable :: xlabel_text
character(len=:), intent(in), allocatable :: ylabel_text
character(len=*), intent(in) :: legend_lines(:)
integer, intent(in) :: num_legend_lines
character(len=*), intent(in) :: filename
character(len=*), intent(in), optional :: text_charset

Raw color mode ('never'..'auto'); resolved per destination here so file saves stay reproducible and terminal output honors 'auto'.

character(len=*), intent(in), optional :: color_mode
integer, intent(inout), optional :: canvas_color(:,:)

public subroutine output_to_terminal(canvas, text_elements, num_text_elements, arrow_elements, num_arrow_elements, plot_width, plot_height, title_text, xlabel_text, ylabel_text, legend_lines, num_legend_lines, text_charset, color_mode, canvas_color)

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(inout) :: canvas(:,:)
type(text_element_t), intent(in) :: text_elements(:)
integer, intent(in) :: num_text_elements
type(text_element_t), intent(in) :: arrow_elements(:)
integer, intent(in) :: num_arrow_elements
integer, intent(in) :: plot_width
integer, intent(in) :: plot_height
character(len=:), intent(in), allocatable :: title_text
character(len=:), intent(in), allocatable :: xlabel_text
character(len=:), intent(in), allocatable :: ylabel_text
character(len=*), intent(in) :: legend_lines(:)
integer, intent(in) :: num_legend_lines
character(len=*), intent(in), optional :: text_charset

Resolved color mode ('never' disables all escapes) and the per-cell packed-RGB buffer used to wrap colored data glyphs in SGR spans.

character(len=*), intent(in), optional :: color_mode
integer, intent(inout), optional :: canvas_color(:,:)

public subroutine output_to_file(canvas, text_elements, num_text_elements, arrow_elements, num_arrow_elements, plot_width, plot_height, title_text, xlabel_text, ylabel_text, legend_lines, num_legend_lines, unit, text_charset, color_mode, canvas_color)

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(inout) :: canvas(:,:)
type(text_element_t), intent(in) :: text_elements(:)
integer, intent(in) :: num_text_elements
type(text_element_t), intent(in) :: arrow_elements(:)
integer, intent(in) :: num_arrow_elements
integer, intent(in) :: plot_width
integer, intent(in) :: plot_height
character(len=:), intent(in), allocatable :: title_text
character(len=:), intent(in), allocatable :: xlabel_text
character(len=:), intent(in), allocatable :: ylabel_text
character(len=*), intent(in) :: legend_lines(:)
integer, intent(in) :: num_legend_lines
integer, intent(in) :: unit
character(len=*), intent(in), optional :: text_charset

Resolved color mode ('never' disables all escapes) and the per-cell packed-RGB buffer used to wrap colored data glyphs in SGR spans.

character(len=*), intent(in), optional :: color_mode
integer, intent(inout), optional :: canvas_color(:,:)

public subroutine braille_finalize(canvas, mask, text_elements, num_text_elements, arrow_elements, num_arrow_elements, plot_width, plot_height, title_text, xlabel_text, ylabel_text, legend_lines, num_legend_lines, filename)

Braille counterpart of ascii_finalize: writes the composited braille canvas to a file, falling back to terminal output on error.

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(inout) :: canvas(:,:)
integer, intent(in) :: mask(:,:)
type(text_element_t), intent(inout) :: text_elements(:)
integer, intent(in) :: num_text_elements
type(text_element_t), intent(inout) :: arrow_elements(:)
integer, intent(in) :: num_arrow_elements
integer, intent(in) :: plot_width
integer, intent(in) :: plot_height
character(len=:), intent(in), allocatable :: title_text
character(len=:), intent(in), allocatable :: xlabel_text
character(len=:), intent(in), allocatable :: ylabel_text
character(len=*), intent(in) :: legend_lines(:)
integer, intent(in) :: num_legend_lines
character(len=*), intent(in) :: filename

public subroutine braille_output_to_file(canvas, mask, text_elements, num_text_elements, arrow_elements, num_arrow_elements, plot_width, plot_height, title_text, xlabel_text, ylabel_text, legend_lines, num_legend_lines, unit)

Compose the ASCII text canvas and the braille subpixel mask into UTF-8 rows: cells with a set braille mask emit the braille glyph, all other cells keep their ASCII character (frame, axes, ticks, labels).

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(inout) :: canvas(:,:)
integer, intent(in) :: mask(:,:)
type(text_element_t), intent(in) :: text_elements(:)
integer, intent(in) :: num_text_elements
type(text_element_t), intent(in) :: arrow_elements(:)
integer, intent(in) :: num_arrow_elements
integer, intent(in) :: plot_width
integer, intent(in) :: plot_height
character(len=:), intent(in), allocatable :: title_text
character(len=:), intent(in), allocatable :: xlabel_text
character(len=:), intent(in), allocatable :: ylabel_text
character(len=*), intent(in) :: legend_lines(:)
integer, intent(in) :: num_legend_lines
integer, intent(in) :: unit