Mercurial > octave
annotate libinterp/corefcn/gl2ps-renderer.cc @ 21196:bd96c2efd4fe
move include statements for OpenGL headers to a single file
* oct-opengl.h: New file.
* libinterp/corefcn/module.mk: Update.
* Canvas.cc, gl-select.cc, gl-select.h, gl-render.cc, gl-render.h,
gl2ps-renderer.cc, __init_fltk__.cc, __osmesa_print__.cc:
Update include statements.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 04 Feb 2016 16:56:02 -0500 |
parents | a223cce1daa4 |
children | 9a5bb6996b16 |
rev | line source |
---|---|
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
1 /* |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
2 |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19693
diff
changeset
|
3 Copyright (C) 2009-2015 Shai Ayal |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
4 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
5 This file is part of Octave. |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
6 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or (at your |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
10 option) any later version. |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
11 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
15 for more details. |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
16 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
20 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
21 */ |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
22 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
23 #ifdef HAVE_CONFIG_H |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
24 #include <config.h> |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
25 #endif |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
26 |
19648
16f21db320b5
Fix compilation error when building without gl2ps
Mike Miller <mtmiller@ieee.org>
parents:
19639
diff
changeset
|
27 #include "error.h" |
16f21db320b5
Fix compilation error when building without gl2ps
Mike Miller <mtmiller@ieee.org>
parents:
19639
diff
changeset
|
28 #include "gl2ps-renderer.h" |
21196
bd96c2efd4fe
move include statements for OpenGL headers to a single file
John W. Eaton <jwe@octave.org>
parents:
21174
diff
changeset
|
29 #include "oct-opengl.h" |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
30 #include "txt-eng-ft.h" |
19648
16f21db320b5
Fix compilation error when building without gl2ps
Mike Miller <mtmiller@ieee.org>
parents:
19639
diff
changeset
|
31 |
17797
06a850f83dd4
build: Remove embedded gl2ps. Require gl2ps as external dependency.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
32 #ifdef HAVE_GL2PS_H |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
33 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
34 #include <cstdio> |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
35 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
36 #include "lo-mappers.h" |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
37 #include "oct-locbuf.h" |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
38 #include "unwind-prot.h" |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
39 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
40 #include "gl2ps.h" |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
41 #include "sysdep.h" |
21083
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
42 #include "unistd.h" |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
43 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
44 void |
21084
83ce7b8fb91c
maint: rename glps_renderer class to gl2ps_renderer to match filename.
Rik <rik@octave.org>
parents:
21083
diff
changeset
|
45 gl2ps_renderer::draw (const graphics_object& go, const std::string& print_cmd) |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
46 { |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
47 static bool in_draw = false; |
16732
3806afcf974a
Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents:
15195
diff
changeset
|
48 static std::string old_print_cmd; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
49 |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20831
diff
changeset
|
50 if (! in_draw) |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
51 { |
19889
00c3f2021cad
use unwind_protect to restore static variable value (bug #44406)
John W. Eaton <jwe@octave.org>
parents:
19872
diff
changeset
|
52 unwind_protect frame; |
00c3f2021cad
use unwind_protect to restore static variable value (bug #44406)
John W. Eaton <jwe@octave.org>
parents:
19872
diff
changeset
|
53 |
00c3f2021cad
use unwind_protect to restore static variable value (bug #44406)
John W. Eaton <jwe@octave.org>
parents:
19872
diff
changeset
|
54 frame.protect_var (in_draw); |
00c3f2021cad
use unwind_protect to restore static variable value (bug #44406)
John W. Eaton <jwe@octave.org>
parents:
19872
diff
changeset
|
55 |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
56 in_draw = true; |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
57 |
10857
2224236440c0
add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents:
10464
diff
changeset
|
58 GLint gl2ps_term; |
19890 | 59 if (term.find ("eps") != std::string::npos) |
60 gl2ps_term = GL2PS_EPS; | |
61 else if (term.find ("pdf") != std::string::npos) | |
62 gl2ps_term = GL2PS_PDF; | |
63 else if (term.find ("ps") != std::string::npos) | |
64 gl2ps_term = GL2PS_PS; | |
65 else if (term.find ("svg") != std::string::npos) | |
66 gl2ps_term = GL2PS_SVG; | |
67 else if (term.find ("pgf") != std::string::npos) | |
68 gl2ps_term = GL2PS_PGF; | |
69 else if (term.find ("tex") != std::string::npos) | |
70 gl2ps_term = GL2PS_TEX; | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
71 else |
21084
83ce7b8fb91c
maint: rename glps_renderer class to gl2ps_renderer to match filename.
Rik <rik@octave.org>
parents:
21083
diff
changeset
|
72 error ("gl2ps_renderer::draw: Unknown terminal %s", term.c_str ()); |
10857
2224236440c0
add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents:
10464
diff
changeset
|
73 |
2224236440c0
add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents:
10464
diff
changeset
|
74 GLint gl2ps_text = 0; |
19890 | 75 if (term.find ("notxt") != std::string::npos) |
76 gl2ps_text = GL2PS_NO_TEXT; | |
10857
2224236440c0
add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents:
10464
diff
changeset
|
77 |
14389
6b2448555bbd
Fix Z-order stacking of axis background for FLTK printing (bug #35559)
Rik <octave@nomad.inbox5.com>
parents:
14203
diff
changeset
|
78 // Default sort order optimizes for 3D plots |
6b2448555bbd
Fix Z-order stacking of axis background for FLTK printing (bug #35559)
Rik <octave@nomad.inbox5.com>
parents:
14203
diff
changeset
|
79 GLint gl2ps_sort = GL2PS_BSP_SORT; |
19890 | 80 |
18666
652d9ed6f88d
Fix printing of axis grid lines above/below line objects based on "layer".
Rik <rik@octave.org>
parents:
18100
diff
changeset
|
81 // For 2D plots we can use a simpler Z-depth sorting algorithm |
652d9ed6f88d
Fix printing of axis grid lines above/below line objects based on "layer".
Rik <rik@octave.org>
parents:
18100
diff
changeset
|
82 if (term.find ("is2D") != std::string::npos) |
652d9ed6f88d
Fix printing of axis grid lines above/below line objects based on "layer".
Rik <rik@octave.org>
parents:
18100
diff
changeset
|
83 gl2ps_sort = GL2PS_SIMPLE_SORT; |
14389
6b2448555bbd
Fix Z-order stacking of axis background for FLTK printing (bug #35559)
Rik <octave@nomad.inbox5.com>
parents:
14203
diff
changeset
|
84 |
21083
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
85 // Use a temporary file in case an overflow happens |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
86 FILE* tmpf = gnulib::tmpfile (); |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
87 |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
88 if (! tmpf) |
21084
83ce7b8fb91c
maint: rename glps_renderer class to gl2ps_renderer to match filename.
Rik <rik@octave.org>
parents:
21083
diff
changeset
|
89 error ("gl2ps_renderer::draw: couldn't open temporary file for printing"); |
19890 | 90 |
21083
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
91 GLint buffsize = 2*1024*1024; |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
92 buffer_overflow = true; |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
93 |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
94 while (buffer_overflow) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
95 { |
21083
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
96 buffer_overflow = false; |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
97 buffsize *= 2; |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
98 gnulib::fseek (tmpf, 0, SEEK_SET); |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
99 gnulib::ftruncate (fileno (tmpf), 0); |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
100 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
101 // For LaTeX output the fltk print process uses 2 drawnow() commands. |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
102 // The first one is for the pdf/ps/eps graph to be included. The |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
103 // print_cmd is saved as old_print_cmd. Then the second drawnow() |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
104 // outputs the tex-file and the graphic filename to be included is |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
105 // extracted from old_print_cmd. |
19890 | 106 |
16732
3806afcf974a
Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents:
15195
diff
changeset
|
107 std::string include_graph; |
19890 | 108 |
19872
d575cd1e0da7
Replace std::size_t with bare size_t for conformity to rest of code.
Rik <rik@octave.org>
parents:
19709
diff
changeset
|
109 size_t found_redirect = old_print_cmd.find (">"); |
19890 | 110 |
16732
3806afcf974a
Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents:
15195
diff
changeset
|
111 if (found_redirect != std::string::npos) |
3806afcf974a
Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents:
15195
diff
changeset
|
112 include_graph = old_print_cmd.substr (found_redirect + 1); |
3806afcf974a
Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents:
15195
diff
changeset
|
113 else |
3806afcf974a
Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents:
15195
diff
changeset
|
114 include_graph = old_print_cmd; |
19890 | 115 |
19872
d575cd1e0da7
Replace std::size_t with bare size_t for conformity to rest of code.
Rik <rik@octave.org>
parents:
19709
diff
changeset
|
116 size_t n_begin = include_graph.find_first_not_of (" "); |
19890 | 117 |
16732
3806afcf974a
Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents:
15195
diff
changeset
|
118 if (n_begin != std::string::npos) |
3806afcf974a
Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents:
15195
diff
changeset
|
119 { |
19872
d575cd1e0da7
Replace std::size_t with bare size_t for conformity to rest of code.
Rik <rik@octave.org>
parents:
19709
diff
changeset
|
120 size_t n_end = include_graph.find_last_not_of (" "); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
121 include_graph = include_graph.substr (n_begin, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
122 n_end - n_begin + 1); |
16732
3806afcf974a
Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents:
15195
diff
changeset
|
123 } |
3806afcf974a
Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents:
15195
diff
changeset
|
124 else |
3806afcf974a
Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents:
15195
diff
changeset
|
125 include_graph = "foobar-inc"; |
19890 | 126 |
18958
c9f960441513
Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18736
diff
changeset
|
127 // GL2PS_SILENT was removed to allow gl2ps printing errors on stderr |
21084
83ce7b8fb91c
maint: rename glps_renderer class to gl2ps_renderer to match filename.
Rik <rik@octave.org>
parents:
21083
diff
changeset
|
128 GLint ret = gl2psBeginPage ("gl2ps_renderer figure", "Octave", 0, |
18958
c9f960441513
Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18736
diff
changeset
|
129 gl2ps_term, gl2ps_sort, |
19890 | 130 (GL2PS_NO_BLENDING |
18958
c9f960441513
Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18736
diff
changeset
|
131 | GL2PS_OCCLUSION_CULL |
c9f960441513
Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18736
diff
changeset
|
132 | GL2PS_BEST_ROOT |
c9f960441513
Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18736
diff
changeset
|
133 | gl2ps_text |
19693
05b40890bbb2
gl2ps-renderer.cc: Add errors and warnings, replace glFlush with glFinish
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19648
diff
changeset
|
134 | GL2PS_NO_PS3_SHADING |
05b40890bbb2
gl2ps-renderer.cc: Add errors and warnings, replace glFlush with glFinish
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19648
diff
changeset
|
135 | GL2PS_USE_CURRENT_VIEWPORT), |
19890 | 136 GL_RGBA, 0, 0, 0, 0, 0, |
21083
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
137 buffsize, tmpf, include_graph.c_str ()); |
18958
c9f960441513
Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18736
diff
changeset
|
138 if (ret == GL2PS_ERROR) |
19693
05b40890bbb2
gl2ps-renderer.cc: Add errors and warnings, replace glFlush with glFinish
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19648
diff
changeset
|
139 { |
05b40890bbb2
gl2ps-renderer.cc: Add errors and warnings, replace glFlush with glFinish
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19648
diff
changeset
|
140 old_print_cmd.clear (); |
21084
83ce7b8fb91c
maint: rename glps_renderer class to gl2ps_renderer to match filename.
Rik <rik@octave.org>
parents:
21083
diff
changeset
|
141 error ("gl2ps_renderer::draw: gl2psBeginPage returned GL2PS_ERROR"); |
19693
05b40890bbb2
gl2ps-renderer.cc: Add errors and warnings, replace glFlush with glFinish
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19648
diff
changeset
|
142 } |
19890 | 143 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
144 opengl_renderer::draw (go); |
18958
c9f960441513
Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18736
diff
changeset
|
145 |
21083
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
146 if (! buffer_overflow) |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
147 old_print_cmd = print_cmd; |
18958
c9f960441513
Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18736
diff
changeset
|
148 |
21083
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
149 // Don't check return value of gl2psEndPage, it is not meaningful. |
21174
a223cce1daa4
strip trailing space from source files we maintain
John W. Eaton <jwe@octave.org>
parents:
21121
diff
changeset
|
150 // Errors and warnings are checked after gl2psEndViewport in |
21084
83ce7b8fb91c
maint: rename glps_renderer class to gl2ps_renderer to match filename.
Rik <rik@octave.org>
parents:
21083
diff
changeset
|
151 // gl2ps_renderer::draw_axes instead. |
21083
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
152 gl2psEndPage (); |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
153 } |
19693
05b40890bbb2
gl2ps-renderer.cc: Add errors and warnings, replace glFlush with glFinish
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19648
diff
changeset
|
154 |
21083
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
155 // Copy temporary file to pipe |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
156 gnulib::fseek (tmpf, 0, SEEK_SET); |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
157 char str[256]; |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
158 int nread = 1; |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
159 while (! feof (tmpf) && nread) |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
160 { |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
161 nread = gnulib::fread (str, 1, 256, tmpf); |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
162 if (nread) |
8c9755d29d2a
Fix overflowing feedback buffers (bug #46417).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20990
diff
changeset
|
163 gnulib::fwrite (str, 1, nread, fp); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
164 } |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
165 } |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
166 else |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
167 opengl_renderer::draw (go); |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
168 } |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
169 |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
170 int |
21084
83ce7b8fb91c
maint: rename glps_renderer class to gl2ps_renderer to match filename.
Rik <rik@octave.org>
parents:
21083
diff
changeset
|
171 gl2ps_renderer::alignment_to_mode (int ha, int va) const |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
172 { |
19890 | 173 int gl2psa = GL2PS_TEXT_BL; |
174 | |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
175 if (ha == 0) |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
176 { |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
177 if (va == 0 || va == 3) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
178 gl2psa=GL2PS_TEXT_BL; |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
179 else if (va == 2) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
180 gl2psa=GL2PS_TEXT_TL; |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
181 else if (va == 1) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
182 gl2psa=GL2PS_TEXT_CL; |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
183 } |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
184 else if (ha == 2) |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
185 { |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
186 if (va == 0 || va == 3) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
187 gl2psa=GL2PS_TEXT_BR; |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
188 else if (va == 2) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
189 gl2psa=GL2PS_TEXT_TR; |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
190 else if (va == 1) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
191 gl2psa=GL2PS_TEXT_CR; |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
192 } |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
193 else if (ha == 1) |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
194 { |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
195 if (va == 0 || va == 3) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
196 gl2psa=GL2PS_TEXT_B; |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
197 else if (va == 2) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
198 gl2psa=GL2PS_TEXT_T; |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
199 else if (va == 1) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
200 gl2psa=GL2PS_TEXT_C; |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
201 } |
19890 | 202 |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
203 return gl2psa; |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
204 } |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
205 |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
206 void |
21084
83ce7b8fb91c
maint: rename glps_renderer class to gl2ps_renderer to match filename.
Rik <rik@octave.org>
parents:
21083
diff
changeset
|
207 gl2ps_renderer::fix_strlist_position (double x, double y, double z, |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
208 Matrix box, double rotation, |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
209 std::list<ft_render::ft_string>& lst) |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
210 { |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
211 for (std::list<ft_render::ft_string>::iterator p = lst.begin (); |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
212 p != lst.end (); p++) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
213 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
214 // Get pixel coordinates |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
215 ColumnVector coord_pix = get_transform ().transform (x, y, z, false); |
19890 | 216 |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
217 // Translate and rotate |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
218 double rot = rotation * 4.0 * atan (1.0) / 180; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
219 coord_pix(0) += ((*p).get_x () + box(0))*cos (rot) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
220 - ((*p).get_y () + box(1))*sin (rot); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
221 coord_pix(1) -= ((*p).get_y () + box(1))*cos (rot) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
222 + ((*p).get_x () + box(0))*sin (rot);; |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
223 |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
224 // Turn coordinates back into current gl coordinates |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
225 ColumnVector coord = |
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
226 get_transform ().untransform (coord_pix(0), coord_pix(1), |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
227 coord_pix(2), false); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
228 (*p).set_x (coord(0)); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
229 (*p).set_y (coord(1)); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
230 (*p).set_z (coord(2)); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
231 } |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
232 } |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
233 |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
234 static std::string |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
235 code_to_symbol (uint32_t code) |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
236 { |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
237 std::string retval; |
9834
92d8f35ff217
compute bounding boxes for text in opengl graphics backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9798
diff
changeset
|
238 |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
239 uint32_t idx = code - 945; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
240 if (idx < 25) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
241 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
242 std::string characters("abgdezhqiklmnxoprVstufcyw"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
243 retval = characters[idx]; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
244 return retval; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
245 } |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
246 |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
247 idx = code - 913; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
248 if (idx < 25) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
249 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
250 std::string characters("ABGDEZHQIKLMNXOPRVSTUFCYW"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
251 retval = characters[idx]; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
252 } |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
253 else if (code == 978) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
254 retval = std::string ("U"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
255 else if (code == 215) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
256 retval = std::string ("\xb4"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
257 else if (code == 177) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
258 retval = std::string ("\xb1"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
259 else if (code == 8501) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
260 retval = std::string ("\xc0"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
261 else if (code == 8465) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
262 retval = std::string ("\xc1"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
263 else if (code == 8242) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
264 retval = std::string ("\xa2"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
265 else if (code == 8736) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
266 retval = std::string ("\xd0"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
267 else if (code == 172) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
268 retval = std::string ("\xd8"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
269 else if (code == 9829) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
270 retval = std::string ("\xa9"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
271 else if (code == 8472) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
272 retval = std::string ("\xc3"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
273 else if (code == 8706) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
274 retval = std::string ("\xb6"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
275 else if (code == 8704) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
276 retval = std::string ("\x22"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
277 else if (code == 9827) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
278 retval = std::string ("\xa7"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
279 else if (code == 9824) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
280 retval = std::string ("\xaa"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
281 else if (code == 8476) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
282 retval = std::string ("\xc2"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
283 else if (code == 8734) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
284 retval = std::string ("\xa5"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
285 else if (code == 8730) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
286 retval = std::string ("\xd6"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
287 else if (code == 8707) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
288 retval = std::string ("\x24"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
289 else if (code == 9830) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
290 retval = std::string ("\xa8"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
291 else if (code == 8747) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
292 retval = std::string ("\xf2"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
293 else if (code == 8727) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
294 retval = std::string ("\x2a"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
295 else if (code == 8744) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
296 retval = std::string ("\xda"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
297 else if (code == 8855) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
298 retval = std::string ("\xc4"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
299 else if (code == 8901) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
300 retval = std::string ("\xd7"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
301 else if (code == 8728) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
302 retval = std::string ("\xb0"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
303 else if (code == 8745) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
304 retval = std::string ("\xc7"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
305 else if (code == 8743) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
306 retval = std::string ("\xd9"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
307 else if (code == 8856) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
308 retval = std::string ("\xc6"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
309 else if (code == 8729) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
310 retval = std::string ("\xb7"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
311 else if (code == 8746) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
312 retval = std::string ("\xc8"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
313 else if (code == 8853) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
314 retval = std::string ("\xc5"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
315 else if (code == 8804) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
316 retval = std::string ("\xa3"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
317 else if (code == 8712) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
318 retval = std::string ("\xce"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
319 else if (code == 8839) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
320 retval = std::string ("\xca"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
321 else if (code == 8801) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
322 retval = std::string ("\xba"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
323 else if (code == 8773) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
324 retval = std::string ("\x40"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
325 else if (code == 8834) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
326 retval = std::string ("\xcc"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
327 else if (code == 8805) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
328 retval = std::string ("\xb3"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
329 else if (code == 8715) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
330 retval = std::string ("\x27"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
331 else if (code == 8764) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
332 retval = std::string ("\x7e"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
333 else if (code == 8733) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
334 retval = std::string ("\xb5"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
335 else if (code == 8838) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
336 retval = std::string ("\xcd"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
337 else if (code == 8835) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
338 retval = std::string ("\xc9"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
339 else if (code == 8739) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
340 retval = std::string ("\xbd"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
341 else if (code == 8776) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
342 retval = std::string ("\xbb"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
343 else if (code == 8869) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
344 retval = std::string ("\x5e"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
345 else if (code == 8656) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
346 retval = std::string ("\xdc"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
347 else if (code == 8592) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
348 retval = std::string ("\xac"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
349 else if (code == 8658) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
350 retval = std::string ("\xde"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
351 else if (code == 8594) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
352 retval = std::string ("\xae"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
353 else if (code == 8596) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
354 retval = std::string ("\xab"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
355 else if (code == 8593) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
356 retval = std::string ("\xad"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
357 else if (code == 8595) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
358 retval = std::string ("\xaf"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
359 else if (code == 8970) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
360 retval = std::string ("\xeb"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
361 else if (code == 8971) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
362 retval = std::string ("\xfb"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
363 else if (code == 10216) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
364 retval = std::string ("\xe1"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
365 else if (code == 10217) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
366 retval = std::string ("\xf1"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
367 else if (code == 8968) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
368 retval = std::string ("\xe9"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
369 else if (code == 8969) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
370 retval = std::string ("\xf9"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
371 else if (code == 8800) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
372 retval = std::string ("\xb9"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
373 else if (code == 8230) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
374 retval = std::string ("\xbc"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
375 else if (code == 176) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
376 retval = std::string ("\xb0"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
377 else if (code == 8709) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
378 retval = std::string ("\xc6"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
379 else if (code == 169) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
380 retval = std::string ("\xd3"); |
20020
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
381 |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
382 if (retval.empty ()) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
383 warning ("print: unhandled symbol %d", code); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
384 |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
385 return retval; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
386 } |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
387 |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
388 |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
389 static std::string |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
390 select_font (caseless_str fn, bool isbold, bool isitalic) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
391 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
392 std::transform (fn.begin (), fn.end (), fn.begin (), ::tolower); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
393 std::string fontname; |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
394 if (fn == "times" || fn == "times-roman") |
20020
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
395 { |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
396 if (isitalic && isbold) |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
397 fontname = "Times-BoldItalic"; |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
398 else if (isitalic) |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
399 fontname = "Times-Italic"; |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
400 else if (isbold) |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
401 fontname = "Times-Bold"; |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
402 else |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
403 fontname = "Times-Roman"; |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
404 } |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
405 else if (fn == "courier") |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
406 { |
20020
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
407 if (isitalic && isbold) |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
408 fontname = "Courier-BoldOblique"; |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
409 else if (isitalic) |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
410 fontname = "Courier-Oblique"; |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
411 else if (isbold) |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
412 fontname = "Courier-Bold"; |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
413 else |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
414 fontname = "Courier"; |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
415 } |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
416 else if (fn == "symbol") |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
417 fontname = "Symbol"; |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
418 else if (fn == "zapfdingbats") |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
419 fontname = "ZapfDingbats"; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
420 else |
20020
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
421 { |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
422 if (isitalic && isbold) |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
423 fontname = "Helvetica-BoldOblique"; |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
424 else if (isitalic) |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
425 fontname = "Helvetica-Oblique"; |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
426 else if (isbold) |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
427 fontname = "Helvetica-Bold"; |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
428 else |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
429 fontname = "Helvetica"; |
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
430 } |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
431 return fontname; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
432 } |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
433 |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
434 static void |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
435 escape_character (const std::string chr, std::string& str) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
436 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
437 std::size_t idx = str.find (chr); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
438 while (idx != std::string::npos) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
439 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
440 str.insert (idx, "\\"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
441 idx = str.find (chr, idx + 2); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
442 } |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
443 } |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
444 |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
445 Matrix |
21084
83ce7b8fb91c
maint: rename glps_renderer class to gl2ps_renderer to match filename.
Rik <rik@octave.org>
parents:
21083
diff
changeset
|
446 gl2ps_renderer::render_text (const std::string& txt, |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
447 double x, double y, double z, |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
448 int ha, int va, double rotation) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
449 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
450 std::string saved_font = fontname; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
451 |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
452 if (txt.empty ()) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
453 return Matrix (1, 4, 0.0); |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
454 |
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
455 // We have no way to get a bounding box from gl2ps, so we parse the raw |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
456 // string using freetype |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
457 Matrix bbox; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
458 std::string str = txt; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
459 std::list<ft_render::ft_string> lst; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
460 |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
461 text_to_strlist (str, lst, bbox, ha, va, rotation); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
462 |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
463 // When using "tex" or when the string has only one line and no |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
464 // special characters, use gl2ps for alignment |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
465 if (lst.empty () || term.find ("tex") != std::string::npos |
20792
d0991cbd6141
maint: Remove extra spaces in if () conditionals.
Rik <rik@octave.org>
parents:
20715
diff
changeset
|
466 || (lst.size () == 1 && ! lst.front ().get_code ())) |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
467 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
468 std::string name = fontname; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
469 int sz = fontsize; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
470 if (! lst.empty () && term.find ("tex") == std::string::npos) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
471 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
472 ft_render::ft_string s = lst.front (); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
473 name = select_font (s.get_name (), s.get_weight () == "bold", |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
474 s.get_angle () == "italic"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
475 set_color (s.get_color ()); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
476 str = s.get_string (); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
477 sz = s.get_size (); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
478 } |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
479 |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
480 glRasterPos3d (x, y, z); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
481 |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
482 // Escape parenthesis until gl2ps does it (see bug ##45301). |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
483 if (term.find ("svg") == std::string::npos |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
484 && term.find ("tex") == std::string::npos) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
485 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
486 escape_character ("(", str); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
487 escape_character (")", str); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
488 } |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
489 |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
490 gl2psTextOpt (str.c_str (), name.c_str (), sz, |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
491 alignment_to_mode (ha, va), rotation); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
492 return bbox; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
493 } |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
494 |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
495 // Translate and rotate coordinates in order to use bottom-left alignment |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
496 fix_strlist_position (x, y, z, bbox, rotation, lst); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
497 |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
498 for (std::list<ft_render::ft_string>::iterator p = lst.begin (); |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
499 p != lst.end (); p++) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
500 { |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
501 fontname = select_font ((*p).get_name (), |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
502 (*p).get_weight () == "bold", |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
503 (*p).get_angle () == "italic"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
504 if ((*p).get_code ()) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
505 { |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
506 // This is only one character represented by a uint32 (utf8) code. |
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
507 // We replace it by the corresponding character in the |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
508 // "Symbol" font except for svg which has built-in utf8 support. |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
509 if (term.find ("svg") == std::string::npos) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
510 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
511 fontname = "Symbol"; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
512 str = code_to_symbol ((*p).get_code ()); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
513 } |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
514 else |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
515 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
516 std::stringstream ss; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
517 ss << (*p).get_code (); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
518 str = "&#" + ss.str () + ";"; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
519 } |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
520 } |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
521 else |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
522 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
523 str = (*p).get_string (); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
524 // Escape parenthesis until gl2ps does it (see bug ##45301). |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
525 if (term.find ("svg") == std::string::npos) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
526 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
527 escape_character ("(", str); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
528 escape_character (")", str); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
529 } |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
530 } |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
531 |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
532 set_color ((*p).get_color ()); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
533 glRasterPos3d ((*p).get_x (), (*p).get_y (), (*p).get_z ()); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
534 gl2psTextOpt (str.c_str (), fontname.c_str (), (*p).get_size (), |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
535 GL2PS_TEXT_BL, rotation); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
536 } |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
537 |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
538 fontname = saved_font; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
539 return bbox; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
540 } |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
541 |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
542 void |
21084
83ce7b8fb91c
maint: rename glps_renderer class to gl2ps_renderer to match filename.
Rik <rik@octave.org>
parents:
21083
diff
changeset
|
543 gl2ps_renderer::set_font (const base_properties& props) |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
544 { |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
545 opengl_renderer::set_font (props); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
546 |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
547 // Set the interpreter so that text_to_pixels can parse strings properly |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
548 if (props.has_property ("interpreter")) |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
549 set_interpreter (props.get ("interpreter").string_value ()); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
550 |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
551 fontsize = props.get ("fontsize_points").double_value (); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
552 |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
553 caseless_str fn = props.get ("fontname").xtolower ().string_value (); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
554 bool isbold = |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
555 (props.get ("fontweight").xtolower ().string_value () == "bold"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
556 bool isitalic = |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
557 (props.get ("fontangle").xtolower ().string_value () == "italic"); |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
558 |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
559 fontname = select_font (fn, isbold, isitalic); |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
560 } |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
561 |
9950
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
562 template <typename T> |
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
563 static void |
18659
3277514f36da
Fix inverted colors when printing uint8/uint16 images (bug #42107).
Rik <rik@octave.org>
parents:
17861
diff
changeset
|
564 draw_pixels (GLsizei w, GLsizei h, GLenum format, const T *data, float maxval) |
9950
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
565 { |
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
566 OCTAVE_LOCAL_BUFFER (GLfloat, a, 3*w*h); |
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
567 |
18659
3277514f36da
Fix inverted colors when printing uint8/uint16 images (bug #42107).
Rik <rik@octave.org>
parents:
17861
diff
changeset
|
568 // Convert to GL_FLOAT as it is the only type gl2ps accepts. |
18680 | 569 for (int i = 0; i < 3*w*h; i++) |
18659
3277514f36da
Fix inverted colors when printing uint8/uint16 images (bug #42107).
Rik <rik@octave.org>
parents:
17861
diff
changeset
|
570 a[i] = data[i] / maxval; |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18659
diff
changeset
|
571 |
9950
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
572 gl2psDrawPixels (w, h, 0, 0, format, GL_FLOAT, a); |
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
573 } |
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
574 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
575 void |
21084
83ce7b8fb91c
maint: rename glps_renderer class to gl2ps_renderer to match filename.
Rik <rik@octave.org>
parents:
21083
diff
changeset
|
576 gl2ps_renderer::draw_pixels (GLsizei w, GLsizei h, GLenum format, |
9950
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
577 GLenum type, const GLvoid *data) |
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
578 { |
18659
3277514f36da
Fix inverted colors when printing uint8/uint16 images (bug #42107).
Rik <rik@octave.org>
parents:
17861
diff
changeset
|
579 // gl2psDrawPixels only supports the GL_FLOAT type. |
3277514f36da
Fix inverted colors when printing uint8/uint16 images (bug #42107).
Rik <rik@octave.org>
parents:
17861
diff
changeset
|
580 // Other formats, such as uint8, must be converted first. |
3277514f36da
Fix inverted colors when printing uint8/uint16 images (bug #42107).
Rik <rik@octave.org>
parents:
17861
diff
changeset
|
581 if (type == GL_UNSIGNED_BYTE) |
3277514f36da
Fix inverted colors when printing uint8/uint16 images (bug #42107).
Rik <rik@octave.org>
parents:
17861
diff
changeset
|
582 ::draw_pixels (w, h, format, static_cast<const GLubyte *> (data), 255.0f); |
3277514f36da
Fix inverted colors when printing uint8/uint16 images (bug #42107).
Rik <rik@octave.org>
parents:
17861
diff
changeset
|
583 else if (type == GL_UNSIGNED_SHORT) |
3277514f36da
Fix inverted colors when printing uint8/uint16 images (bug #42107).
Rik <rik@octave.org>
parents:
17861
diff
changeset
|
584 ::draw_pixels (w, h, format, static_cast<const GLushort *> (data), 65535.0f); |
9950
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
585 else |
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
586 gl2psDrawPixels (w, h, 0, 0, format, type, data); |
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
587 } |
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
588 |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
589 void |
21084
83ce7b8fb91c
maint: rename glps_renderer class to gl2ps_renderer to match filename.
Rik <rik@octave.org>
parents:
21083
diff
changeset
|
590 gl2ps_renderer::draw_text (const text::properties& props) |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
591 { |
12965
22bc9ec80c2c
allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents:
12322
diff
changeset
|
592 if (props.get_string ().is_empty ()) |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
593 return; |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
594 |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
595 // First set font properties: freetype will use them to compute |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
596 // coordinates and gl2ps will retrieve the color directly from the |
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
597 // feedback buffer |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
598 set_font (props); |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
599 set_color (props.get_color_rgb ()); |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
600 |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
601 std::string saved_font = fontname; |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
602 |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
603 // Alignment |
18100
6a71e5030df5
Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents:
17861
diff
changeset
|
604 int halign = 0; |
6a71e5030df5
Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents:
17861
diff
changeset
|
605 int valign = 0; |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
606 |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
607 if (props.horizontalalignment_is ("center")) |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
608 halign = 1; |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
609 else if (props.horizontalalignment_is ("right")) |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
610 halign = 2; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
611 |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
612 if (props.verticalalignment_is ("top")) |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
613 valign = 2; |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
614 else if (props.verticalalignment_is ("baseline")) |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
615 valign = 3; |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
616 else if (props.verticalalignment_is ("middle")) |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
617 valign = 1; |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
618 |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
619 // FIXME: handle margin and surrounding box |
21121 | 620 // Matrix bbox; |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
621 |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
622 const Matrix pos = get_transform ().scale (props.get_data_position ()); |
20990
fc9cca99b2de
Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents:
20962
diff
changeset
|
623 std::string str = props.get_string ().string_vector_value ().join ("\n"); |
12965
22bc9ec80c2c
allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents:
12322
diff
changeset
|
624 |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
625 render_text (str, pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0, |
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
626 halign, valign, props.get_rotation ()); |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
627 } |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
628 |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
629 static void |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
630 safe_pclose (FILE *f) |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
631 { |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
632 if (f) |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
633 octave_pclose (f); |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
634 } |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
635 |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
636 #endif |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
637 |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
638 void |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
639 gl2ps_print (const graphics_object& fig, const std::string& cmd, |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
640 const std::string& term) |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
641 { |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
642 #ifdef HAVE_GL2PS_H |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
643 |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
644 FILE *fp = octave_popen (cmd.c_str (), "w"); |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
645 |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
646 if (! fp) |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
647 error ("print: failed to open pipe for gl2ps renderer"); |
19709
5cfb3ccbf24a
style fixes for resource management
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
648 |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
649 unwind_protect frame; |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
650 |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
651 frame.add_fcn (safe_pclose, fp); |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
652 |
21084
83ce7b8fb91c
maint: rename glps_renderer class to gl2ps_renderer to match filename.
Rik <rik@octave.org>
parents:
21083
diff
changeset
|
653 gl2ps_renderer rend (fp, term); |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
654 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
655 rend.draw (fig, cmd); |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
656 |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
657 #else |
21109
bd1752782e56
Use err_disabled_feature, warn_disabled_feature throughout code base.
Rik <rik@octave.org>
parents:
21084
diff
changeset
|
658 err_disabled_feature ("gl2ps_print", "gl2ps"); |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
659 #endif |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
660 } |