fortplot_ascii_utils Module

ASCII terminal plotting backend - Utility Functions

This module contains utility functions used by the ASCII plotting backend, including character manipulation, text rendering, and output formatting.

Author: fortplot contributors



Variables

Type Visibility Attributes Name Initial
character(len=*), public, parameter :: ASCII_CHARS = ' .:-=+*#%@'

Derived Types

type, public ::  text_element_t

Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: text
integer, public :: x
integer, public :: y
real(kind=wp), public :: color_r
real(kind=wp), public :: color_g
real(kind=wp), public :: color_b

Functions

public function get_char_density(char)

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in) :: char

Return Value integer

public function get_blend_char(char1, char2)

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in) :: char1
character(len=1), intent(in) :: char2

Return Value character(len=1)

public pure function is_legend_entry_text(text) result(is_entry)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: text

Return Value logical

public pure function is_registered_legend_label(legend_entry_labels, legend_entry_count, text) result(found)

Arguments

Type IntentOptional Attributes Name
character(len=64), intent(in) :: legend_entry_labels(:)
integer, intent(in) :: legend_entry_count
character(len=*), intent(in) :: text

Return Value logical

public pure function is_autopct_text(text) result(is_percent)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: text

Return Value logical

public pure function ascii_marker_char(marker_style) result(marker_char)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: marker_style

Return Value character(len=1)


Subroutines

public subroutine render_text_elements_to_canvas(canvas, text_elements, num_text_elements, plot_width, plot_height)

Render stored text elements onto the ASCII canvas with Unicode-to-ASCII conversion

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
integer, intent(in) :: plot_width
integer, intent(in) :: plot_height

public subroutine print_centered_title(title, width)

Print centered title to terminal with Unicode-to-ASCII conversion

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: title
integer, intent(in) :: width

public subroutine write_centered_title(unit, title, width)

Write centered title to file with Unicode-to-ASCII conversion

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: unit
character(len=*), intent(in) :: title
integer, intent(in) :: width