deri pushed a commit to branch master
in repository groff.

commit a7f9ab4748e6bf57aba772a3bfdeb86625fae860
Author: Deri James <d...@chuzzlewit.myzen.co.uk>
AuthorDate: Thu Mar 13 21:38:27 2025 +0000

    [gropdf]: \X'pdf: pdfpic ...' scales incorrectly
    
    When no width is given (<=0), scaling should use height. If
    both are missing or <=0, don't scale.
    
    * src/devices/gropdf/gropdf.pl: No scaling if BOTH width and
    height are not given.
---
 ChangeLog                    | 10 ++++++++++
 src/devices/gropdf/gropdf.pl |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 58cc300cc..88f7946bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2025-03-13  Deri James  <d...@chuzzlewit.myzen.co.uk>
+
+       [gropdf]: \X'pdf: pdfpic ...' scales incorrectly
+
+       When no width is given (<=0), scaling should use height. If
+       both are missing or <=0, don't scale.
+
+       * src/devices/gropdf/gropdf.pl: No scaling if BOTH width and
+       height are not given.
+
 2025-03-05  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        [troff]: Add unit tests for `devicem` request and `\Y` escape
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 0d2af6c60..409f15284 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -1756,7 +1756,7 @@ sub do_x
                    my $bbox=$incfil{$fil}->[1];
                    $imgtype=$incfil{$fil}->[2];
                    Warn("Failed to extract width x height for '$FDnm'"),return 
if !defined($bbox->[2]) or !defined($bbox->[3]);
-                   $wid=($bbox->[2]-$bbox->[0]) if $wid <= 0;
+                   $wid=($bbox->[2]-$bbox->[0]) if $wid <= 0 and $hgt <= 0;
                    my $xscale=d3($wid/($bbox->[2]-$bbox->[0]));
                    my 
$yscale=d3(($hgt<=0)?$xscale:($hgt/($bbox->[3]-$bbox->[1])));
                    $xscale=($wid<=0)?$yscale:$xscale;

_______________________________________________
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to