Re: [Groff] gropdf track kerning issue

2012-10-16 Thread Deri James
On Tuesday 02 Oct 2012 13:45:40 Peter Schaffter wrote:
> Deri,
> 
> I've encountered a problem with gropdf and the .tkf request.  When
> I process this example with -Tpdf, the first block of type renders
> perfectly.  However, when I add track kerning, two anomalies creep
> in: extra space is being added between the "D" and the en-dash
> afterwards (in the \*[D-] string), and the letters "n" and "v" in
> "conversation" are overprinting (see attached .pdf).
> 
> 
> .ds smallcaps \f[B]\s[-.5]
> .ds normal\f[]\s[+.5]
> .ds D-\*[smallcaps]D\|\v'-1p'\[en]\v'1p'\*[normal]
> .ds JWS-  \*[smallcaps]JWS\|\v'-1p'\[en]\v'1p'\*[normal]
> .
> .ft TR
> .ps 12
> .vs 16
> .ll 29P
> .sp |1i
> .
> Following Day 40, the arrangement of the hieroglyphs began
> to look like dialogue.  First, there'd be a stanza headed \*[JWS-].
> Afterwards came two more blocks, the first one introduced by \*[D-].
> A con\%versation between minds?
> .sp
> .tkf \n[.f] 1 -.15 1 -.15
> Following Day 40, the arrangement of the hieroglyphs began
> to look like dialogue.  First, there'd be a stanza headed \*[JWS-].
> Afterwards came two more blocks, the first one introduced by \*[D-].
> A con\%versation between minds?
> 

Hi Peter,

A two pipe problem!

This patch fixes it. (Problem was that the "D" is not kerned in either 
paragraph, but gropdf calculated its width using the previous kern factor, so 
got the glyph positioning wrong (until groff emitted an absolute 'H' command - 
between "con" and "versation")).

Note: It applies against current CVS, it also contains the positioning fix 
when drawing lines, which you already have.

Werner, proper patch/changelog will be sent to you separately.

Cheers 

Deri
diff -ruNb a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
--- a/src/devices/gropdf/gropdf.pl	2012-09-20 08:48:28.0 +0100
+++ b/src/devices/gropdf/gropdf.pl	2012-10-16 18:02:37.0 +0100
@@ -2669,6 +2669,7 @@
 	$lwidth=$p[0];
 	$stream.="$p[0] w\n";
 	$poschg=1;
+	$xpos+=$lwidth;
 }
 elsif ($Dcmd eq 'a')
 {
@@ -3014,6 +3015,14 @@
 sub do_t
 {
 my $par=shift;
+
+if ($kernadjust != $curkern)
+{
+	PutLine();
+	$stream.="$kernadjust Tc\n";
+	$curkern=$kernadjust;
+}
+
 my $wid=TextWid($par);
 
 $par=reverse(split('',$par)) if $xrev;
@@ -3038,13 +3047,6 @@
 # $nomove = width of char(s) added by 'C', 'N' or 'c'
 # $w-flg  = 'w' seen since last t
 
-if ($kernadjust != $curkern)
-{
-	PutLine();
-	$stream.="$kernadjust Tc\n";
-	$curkern=$kernadjust;
-}
-
 if ($fontchg)
 {
 	PutLine();


Re: [Groff] gropdf track kerning issue

2012-10-16 Thread Peter Schaffter
Deri --

On Tue, Oct 16, 2012, Deri James wrote:
> On Tuesday 02 Oct 2012 13:45:40 Peter Schaffter wrote:
> > Deri,
> > 
> > I've encountered a problem with gropdf and the .tkf request.  When
> > I process this example with -Tpdf, the first block of type renders
> > perfectly.  However, when I add track kerning, two anomalies creep
> > in: extra space is being added between the "D" and the en-dash
> > afterwards (in the \*[D-] string), and the letters "n" and "v" in
> > "conversation" are overprinting (see attached .pdf).
> > 
> > 
> > .ds smallcaps \f[B]\s[-.5]
> > .ds normal\f[]\s[+.5]
> > .ds D-\*[smallcaps]D\|\v'-1p'\[en]\v'1p'\*[normal]
> > .ds JWS-  \*[smallcaps]JWS\|\v'-1p'\[en]\v'1p'\*[normal]
> > .
> > .ft TR
> > .ps 12
> > .vs 16
> > .ll 29P
> > .sp |1i
> > .
> > Following Day 40, the arrangement of the hieroglyphs began
> > to look like dialogue.  First, there'd be a stanza headed \*[JWS-].
> > Afterwards came two more blocks, the first one introduced by \*[D-].
> > A con\%versation between minds?
> > .sp
> > .tkf \n[.f] 1 -.15 1 -.15
> > Following Day 40, the arrangement of the hieroglyphs began
> > to look like dialogue.  First, there'd be a stanza headed \*[JWS-].
> > Afterwards came two more blocks, the first one introduced by \*[D-].
> > A con\%versation between minds?
> > 
> 
> Hi Peter,
> 
> A two pipe problem!
> 
> This patch fixes it. (Problem was that the "D" is not kerned
> in either paragraph, but gropdf calculated its width using
> the previous kern factor, so got the glyph positioning wrong
> (until groff emitted an absolute 'H' command -between "con" and
> "versation")).
> 
> Note: It applies against current CVS, it also contains the
> positioning fix when drawing lines, which you already have.

Patch applied.  Problem fixed.  One more bug bites the dust.  Or
hits the windshield.  Thanks.

-- 
Peter Schaffter

Author of The Binbrook Caucus
http://www.schaffter.ca