[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 01/01: All values should be 3 decimals
From: |
Deri James |
Subject: |
[groff] 01/01: All values should be 3 decimals |
Date: |
Wed, 17 Jan 2018 14:44:20 -0500 (EST) |
deri pushed a commit to branch master
in repository groff.
commit 18fd1fd0bf05eb9a5ba0d2be1a655a044662a8bf
Author: Deri James <address@hidden>
Date: Wed Jan 17 19:42:03 2018 +0000
All values should be 3 decimals
* src/devices/gropdf.pl: for values approaching zero values
in the for 0.nnnnnnE-nn could be written, not valid syntax for
PDF. Make all values rounded to 3 decimals, becomes 0.000.
Also changed stream Filter dictionary entry to an array.
---
ChangeLog | 10 ++++++++++
src/devices/gropdf/gropdf.pl | 24 +++++++++++++++---------
2 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a5c97e9..e4e5662 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2018-01-17 Deri James <address@hidden>
+
+ All values should be 3 decimals
+
+ * src/devices/gropdf.pl: for values approaching zero values
+ in the for 0.nnnnnnE-nn could be written, not valid syntax for
+ PDF. Make all values rounded to 3 decimals, becomes 0.000.
+
+ Also changed stream Filter dictionary entry to an array.
+
2018-01-14 Bertrand Garrigues <address@hidden>
Fix tarball generation ('make distcheck' failed)
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 053c9ba..5b8b08f 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -331,9 +331,9 @@ while (<>)
if ($cpageno > 0)
{
- $cpage->address@hidden if $custompaper;
- PutObj($cpageno);
- OutStream($cpageno+1);
+ $cpage->address@hidden if $custompaper;
+ PutObj($cpageno);
+ OutStream($cpageno+1);
}
@@ -1940,12 +1940,12 @@ sub PutXY
if ($frot)
{
- return("$y $x");
+ return(d3($y)." ".d3($x));
}
else
{
$y=$mediabox[3]-$y;
- return("$x $y");
+ return(d3($x)." ".d3($y));
}
}
@@ -2603,22 +2603,22 @@ sub set_col
if ($mcmd eq 'c')
{
# Text CMY
- return(($c[0]/65535).' '.($c[1]/65535).' '.($c[2]/65535)." 0 $oper[1]");
+ return(d3($c[0]/65535).' '.d3($c[1]/65535).' '.d3($c[2]/65535)." 0
$oper[1]");
}
elsif ($mcmd eq 'k')
{
# Text CMYK
- return(($c[0]/65535).' '.($c[1]/65535).' '.($c[2]/65535).'
'.($c[3]/65535)." $oper[1]");
+ return(d3($c[0]/65535).' '.d3($c[1]/65535).' '.d3($c[2]/65535).'
'.d3($c[3]/65535)." $oper[1]");
}
elsif ($mcmd eq 'g')
{
# Text Grey
- return(($c[0]/65535)." $oper[0]");
+ return(d3($c[0]/65535)." $oper[0]");
}
elsif ($mcmd eq 'r')
{
# Text RGB0
- return(($c[0]/65535).' '.($c[1]/65535).' '.($c[2]/65535)." $oper[2]");
+ return(d3($c[0]/65535).' '.d3($c[1]/65535).' '.d3($c[2]/65535)."
$oper[2]");
}
}
@@ -2964,6 +2964,7 @@ sub PutLine
$wd->[0]=~s/\(/\\(/g;
$wd->[0]=~s/\)/\\)/g;
$wd->[0]=~s/!\|!\|/\\/g;
+ $wd->[1]=d3($wd->[1]);
}
if (0)
@@ -3067,6 +3068,11 @@ sub PutLine
$wt=-1;
}
+sub d3
+{
+ return(sprintf("%.3f",shift || 0));
+}
+
sub LoadAhead
{
my $no=shift;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 01/01: All values should be 3 decimals,
Deri James <=