fplot 1.7.1
A Fortran library providing a convenient interface for plotting with Gnuplot.
Loading...
Searching...
No Matches
fplot_latex_terminal.f90
1! fplot_latex_terminal.f90
2
3submodule(fplot_core) fplot_latex_terminal
4contains
5! ------------------------------------------------------------------------------
6 module function tex_get_term_string(this) result(x)
7 class(latex_terminal), intent(in) :: this
8 character(len = :), allocatable :: x
9 integer(int32) :: n
10 n = len_trim(this%m_id)
11 allocate(character(len = n) :: x)
12 x = this%m_id
13 end function
14
15! ------------------------------------------------------------------------------
16 module function tex_get_filename(this) result(txt)
17 class(latex_terminal), intent(in) :: this
18 character(len = :), allocatable :: txt
19 integer(int32) :: n
20 n = len_trim(this%m_fname)
21 allocate(character(len = n) :: txt)
22 txt = trim(this%m_fname)
23 end function
24
25! --------------------
26 module subroutine tex_set_filename(this, txt)
27 class(latex_terminal), intent(inout) :: this
28 character(len = *), intent(in) :: txt
29 integer(int32) :: n
30 n = min(len_trim(txt), gnuplot_max_path_length)
31 this%m_fname = ""
32 if (n /= 0) then
33 this%m_fname(1:n) = txt(1:n)
34 else
35 this%m_fname = "default.tex"
36 end if
37 end subroutine
38
39! ------------------------------------------------------------------------------
40 module function tex_get_command_string(this) result(x)
41 ! Arguments
42 class(latex_terminal), intent(in) :: this
43 character(len = :), allocatable :: x
44
45 ! Local Variables
46 type(string_builder) :: str
47
48 ! Process
49 call str%initialize()
50 call str%append("set term epslatex color ")
51 call str%append(" font ")
52 call str%append('"')
53 call str%append(this%get_font_name())
54 call str%append(',')
55 call str%append(to_string(this%get_font_size()))
56 call str%append('"')
57 call str%append(" size ")
58 call str%append(to_string(this%get_window_width()))
59 call str%append(",")
60 call str%append(to_string(this%get_window_height()))
61 call str%append(new_line('a'))
62 call str%append("set output ")
63 call str%append('"')
64 call str%append(this%get_filename())
65 call str%append('"')
66 x = char(str%to_string())
67 end function
68
69end submodule
fplot_core