Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions BACKLOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Development Backlog

## TODO (Ordered by Priority)

## DOING (Current Work)
- [x] #220: Fix ASCII backend generating PDF binary content instead of text output (branch: fix/comprehensive-ascii-cleaning)

## DONE (Completed)
4 changes: 2 additions & 2 deletions doc/example/scale_examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ end program scale_examples
ASCII output:
```
%PDF-1.4
%????
%[binary]
2 0 obj
<<
/Type /Catalog
Expand Down Expand Up @@ -173,7 +173,7 @@ startxref
ASCII output:
```
%PDF-1.4
%????
%[binary]
2 0 obj
<<
/Type /Catalog
Expand Down
27 changes: 25 additions & 2 deletions src/fortplot_rendering.f90
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,36 @@ end subroutine clear_streamlines
subroutine switch_backend_if_needed(self, target_backend)
!! Switch backend if current doesn't match target
use fortplot_utils, only: initialize_backend
use fortplot_ascii, only: ascii_context
use fortplot_pdf, only: pdf_context
use fortplot_png, only: png_context
use fortplot_raster, only: raster_context
use fortplot_gltf, only: gltf_context
class(figure_t), intent(inout) :: self
character(len=*), intent(in) :: target_backend

character(len=20) :: current_backend

! Get current backend type (stub implementation)
current_backend = 'ascii' ! Default assumption
! Detect current backend type using polymorphic type checking
current_backend = 'unknown'
if (allocated(self%backend)) then
select type (backend => self%backend)
type is (ascii_context)
current_backend = 'ascii'
type is (pdf_context)
current_backend = 'pdf'
type is (png_context)
current_backend = 'png'
type is (raster_context)
current_backend = 'png' ! Treat base raster as PNG
type is (gltf_context)
current_backend = 'gltf'
class default
current_backend = 'ascii' ! Default fallback
end select
else
current_backend = 'ascii' ! Default for unallocated backend
end if

! For now, avoid switching to PNG backend to prevent segfaults
! This is a temporary workaround for the raster backend corruption issue
Expand Down
Loading