diff options
author | Danny Milosavljevic <dannym@friendly-machines.com> | 2024-12-17 21:40:47 +0100 |
---|---|---|
committer | Danny Milosavljevic <dannym@friendly-machines.com> | 2024-12-17 23:01:59 +0100 |
commit | e5a1284289a797b5f8f7ce3e01bfda415c173df3 (patch) | |
tree | d5e4dfd4a14885dea0857d2066dcc336551e73d8 /gnu/packages | |
parent | 7167aa686ce4894770038a17589a52626d284d6f (diff) | |
download | guix-e5a1284289a797b5f8f7ce3e01bfda415c173df3.tar.gz guix-e5a1284289a797b5f8f7ce3e01bfda415c173df3.zip |
gnu: perl-pdl: Make printing text work with glut backend, too.
* gnu/packages/patches/pdl-2.019-glut-bitmap-fonts.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/perl-maths.scm (perl-pdl)[source]: Use it.
Change-Id: I0331b1192d75a69831168d2fd634cadaa6260cd4
Diffstat (limited to 'gnu/packages')
-rw-r--r-- | gnu/packages/patches/pdl-2.019-glut-bitmap-fonts.patch | 43 | ||||
-rw-r--r-- | gnu/packages/perl-maths.scm | 5 |
2 files changed, 47 insertions, 1 deletions
diff --git a/gnu/packages/patches/pdl-2.019-glut-bitmap-fonts.patch b/gnu/packages/patches/pdl-2.019-glut-bitmap-fonts.patch new file mode 100644 index 0000000000..a374aae96b --- /dev/null +++ b/gnu/packages/patches/pdl-2.019-glut-bitmap-fonts.patch @@ -0,0 +1,43 @@ +Author: Danny Milosavljevic <dannym@friendly-machines.com> +Date: 2024-12-17 21:00:00 CET +Subject: Make bitmap fonts work even in glut +License: Same as Perl. + +--- orig/PDL-2.019/Graphics/TriD/POGL/OpenGL.pm 2018-05-05 19:56:29.000000000 +0200 ++++ PDL-2.019/Graphics/TriD/POGL/OpenGL.pm 2024-12-17 22:56:30.043984134 +0100 +@@ -358,9 +358,34 @@ + + =cut + ++use OpenGL qw(GL_COMPILE GLUT_BITMAP_9_BY_15 GLUT_BITMAP_8_BY_13); ++use constant GLUT_FONTS => { ++ '9x15' => GLUT_BITMAP_9_BY_15, ++ '8x13' => GLUT_BITMAP_8_BY_13, ++}; ++ + sub glpRasterFont{ + my($this,@args) = @_; +- OpenGL::glpRasterFont($args[0],$args[1],$args[2],$this->{Display}); ++ # see also OpenGL::glpPrintString($::lb,$header); ++ if ( $this->{window_type} eq 'glut' ) { ++ my $font_name = $args[0] || '8x13'; ++ my $font = GLUT_FONTS->{$font_name} || GLUT_FONTS->{'8x13'}; ++ my $start_char = $args[1] || 0; ++ my $num_chars = $args[2] || 128; ++ my $cache_key = "${font_name};${start_char};${num_chars}"; ++ unless (exists $this->{font_cache}{$cache_key}) { ++ my $base = OpenGL::glGenLists($num_chars); ++ for my $i (0..($num_chars - 1)) { ++ OpenGL::glNewList($base + $i, GL_COMPILE); ++ OpenGL::glutBitmapCharacter($font, $start_char + $i); ++ OpenGL::glEndList(); ++ } ++ $this->{font_cache}{$cache_key} = $base; ++ } ++ return $this->{font_cache}{$cache_key}; ++ } else { ++ OpenGL::glpRasterFont($args[0],$args[1],$args[2],$this->{Display}); ++ } + } + + diff --git a/gnu/packages/perl-maths.scm b/gnu/packages/perl-maths.scm index 91164d1f27..53e0a03361 100644 --- a/gnu/packages/perl-maths.scm +++ b/gnu/packages/perl-maths.scm @@ -21,6 +21,7 @@ #:use-module (guix packages) #:use-module (guix download) #:use-module (guix build-system perl) + #:use-module (gnu packages) #:use-module (gnu packages gcc) #:use-module (gnu packages gd) #:use-module (gnu packages gl) @@ -85,7 +86,9 @@ It implements the data type \"matrix of real numbers\" (and consequently also (uri (string-append "https://www.cpan.org/modules/by-module/PDL/PDL-" version ".tar.gz")) (sha256 - (base32 "1zkp5pm351qjr6sb3xivpxy5vjfl72ns0hb4dx5vpm8xvgp7p92i")))) + (base32 "1zkp5pm351qjr6sb3xivpxy5vjfl72ns0hb4dx5vpm8xvgp7p92i")) + (patches + (search-patches "pdl-2.019-glut-bitmap-fonts.patch")))) (build-system perl-build-system) (arguments `(#:phases |