[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 01/01: See bug at: https://savannah.gnu.org/bugs/?51568
From: |
Deri James |
Subject: |
[groff] 01/01: See bug at: https://savannah.gnu.org/bugs/?51568 |
Date: |
Mon, 31 Jul 2017 12:09:01 -0400 (EDT) |
deri pushed a commit to branch master
in repository groff.
commit 6a241192be60d0cc1a2ab5464281e297b2c0243d
Author: Deri James <address@hidden>
Date: Mon Jul 31 17:02:02 2017 +0100
See bug at: https://savannah.gnu.org/bugs/?51568
* src/devices/gropdf/gropdf: previous 'fix' was too narrow, all
'\' characters should be escaped. Also there was an unwanted
interaction with code in routine 'do_t'. Sometimes, do_C, when
the named glyph is mapped to a chr < 32, this is encoded as
octal \nnn, so in this case the '\' must not be escaped.
---
ChangeLog | 10 ++++++++++
src/devices/gropdf/gropdf.pl | 32 ++++++++++++--------------------
2 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index caa5498..bc6f07b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-07-31 Deri James <address@hidden>
+
+ See bug at: https://savannah.gnu.org/bugs/?51568
+
+ * src/devices/gropdf/gropdf: previous 'fix' was too narrow, all
+ '\' characters should be escaped. Also there was an unwanted
+ interaction with code in routine 'do_t'. Sometimes, do_C, when
+ the named glyph is mapped to a chr < 32, this is encoded as octal
+ \nnn, so in this case the '\' must not be escaped.
+
2017-07-25 Deri James <address@hidden>
If input text contained string which could be interpreted as
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 8f0a320..608864d 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -2942,11 +2942,18 @@ sub PutLine
$pendmv-=$nomove;
$lin[$#lin]->[1]=-$pendmv/$cftsz if ($pendmv != 0);
+ foreach my $wd (@lin)
+ {
+ next if $wd->[0]=~s/\\\|!\|/\\/g;
+ $wd->[0]=~s/\\/\\\\/g;
+ $wd->[0]=~s/\(/\\(/g;
+ $wd->[0]=~s/\)/\\)/g;
+ }
+
if (0)
{
if (scalar(@lin) == 1 and (!defined($lin[0]->[1]) or $lin[0]->[1] == 0))
{
- $lin[0]->[0]=~s/\\\d{1,3}/\\${&}/g;
$stream.="($lin[0]->[0]) Tj\n";
}
else
@@ -2955,12 +2962,7 @@ sub PutLine
foreach my $wd (@lin)
{
- if (defined($wd->[0]))
- {
- $wd->[0]=~s/\\\d{1,3}/\\${&}/g;
- $stream.="($wd->[0]) ";
- }
-
+ $stream.="($wd->[0]) " if defined($wd->[0]);
$stream.="$wd->[1] " if defined($wd->[1]) and $wd->[1] != 0;
}
@@ -2971,7 +2973,6 @@ sub PutLine
{
if (scalar(@lin) == 1 and (!defined($lin[0]->[1]) or $lin[0]->[1] == 0))
{
- $lin[0]->[0]=~s/\\\d{1,3}/\\${&}/g;
$stream.="0 Tw ($lin[0]->[0]) Tj\n";
}
else
@@ -2982,12 +2983,7 @@ sub PutLine
foreach my $wd (@lin)
{
- if (defined($wd->[0]))
- {
- $wd->[0]=~s/\\\d{1,3}/\\${&}/g;
- $stream.="($wd->[0]) ";
- }
-
+ $stream.="($wd->[0]) " if defined($wd->[0]);
$stream.="$wd->[1] " if defined($wd->[1]) and $wd->[1] != 0;
}
@@ -3026,7 +3022,6 @@ sub PutLine
foreach my $wd (@lin)
{
my $wwt=$wd->[1]||0;
- $wd->[0]=~s/\\\d{1,3}/\\${&}/g;
while ($wwt <= $wt+.1)
{
@@ -3118,7 +3113,7 @@ sub TextWid
my $txt=shift;
my $w=0;
my $ck=0;
- $txt=~s/^\\(\d\d\d)/chr($1)/e;
+ $txt=~s/^\\\|!\|(\d\d\d)/chr($1)/e;
foreach my $c (split('',$txt))
{
@@ -3159,9 +3154,6 @@ sub do_t
$xpos+=($pendmv-$nomove)/$unitwidth;
$stream.="% == '$par'=$wid 'xpos=$xpos\n" if $debug;
- $par=~s/\\(?!\d\d\d)/\\\\/g;
- $par=~s/\)/\\)/g;
- $par=~s/\(/\\(/g;
# $pendmv = 'h' move since last 't'
# $nomove = width of char(s) added by 'C', 'N' or 'c'
@@ -3289,7 +3281,7 @@ sub FindChar
my $ch=$fnt->{GNM}->{$chnm};
$ch=RemapChr($ch,$fnt,$chnm) if ($ch > 255);
-
return(($ch<32)?sprintf("\\%03o",$ch):chr($ch),$fnt->{WID}->[$ch]*$cftsz);
+
return(($ch<32)?sprintf("\\|!|%03o",$ch):chr($ch),$fnt->{WID}->[$ch]*$cftsz);
}
else
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 01/01: See bug at: https://savannah.gnu.org/bugs/?51568,
Deri James <=