[groff] 01/01: [gropdf] I left a line of debug code
deri pushed a commit to branch master in repository groff. commit 5a68413f9458f0b27522019915ed8f0b7ec1b09e Author: Deri James AuthorDate: Sat Jun 22 18:40:39 2024 +0100 [gropdf] I left a line of debug code * src/devices/gropdf/gropdf.pl: Remove it. --- src/devices/gropdf/gropdf.pl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 85a3a5e0f..5a88bc65a 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -3958,7 +3958,6 @@ sub do_D $endang+=$rad360 if $endang < $startang; my $pieces=int(($endang-$startang) / $rad90)+1; my $totang=($endang-$startang)/$pieces; # do it in pieces - print STDERR "Pieces=$pieces, P=",join(',',@p),"\n"; # Now 1 piece ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Fix invalid pdf when using certain sizes of dashed ellipse in pic.
deri pushed a commit to branch master in repository groff. commit dd63af83c106a6a44dbb15ab36d5f3e211515ca5 Author: Deri James AuthorDate: Sat Jun 22 18:33:49 2024 +0100 Fix invalid pdf when using certain sizes of dashed ellipse in pic. * src/devices/gropdf/gropdf.pl: For short dashes on flat part of ellipse some v. small numbers written in form n.nnnE-n which is invalid for pdfs. Also rather than split each arc always into 4 pieces, split into number of quadrants described between start and end angle. If arc describes a straight line, use line segment rather than bezier curve. (grops does this as well) Fixes https://savannah.gnu.org/bugs/index.php?65901 Thanks to Morten Bo Johansen for reporting this issue. --- ChangeLog| 16 src/devices/gropdf/gropdf.pl | 60 2 files changed, 55 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index cec91f58e..e9c4c568f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2024-06-22 Deri James + + [gropdf] Fix invalid pdf when using certain sizes of + dashed ellipse in pic. + + * src/devices/gropdf/gropdf.pl: For short dashes on flat part + of ellipse some v. small numbers written in form n.nnnE-n which + is invalid for pdfs. Also rather than split each arc always into + 4 pieces, split into number of quadrants described between start + and end angle. If arc describes a straight line, use line segment + rather than bezier curve. (grops does this as well) + + Fixes https://savannah.gnu.org/bugs/index.php?65901 + + Thanks to Morten Bo Johansen for reporting this issue. + 2024-06-21 G. Branden Robinson * src/roff/troff/env.cpp (environment::possibly_break_line): diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index df645c4e0..85a3a5e0f 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -3922,7 +3922,7 @@ sub do_D } elsif ($Dcmd eq 'a') { - # Arc + # Arc : h1 v1 h2 v2 $par=substr($par,1); my (@p)=split(' ',$par); my $rad180=3.14159; @@ -3941,25 +3941,43 @@ sub do_D my ($startang,$r)=RtoP(-$centre->[0],$centre->[1]); my ($endang,$r2)=RtoP(($p[0]+$p[2])-$centre->[0],-($p[1]+$p[3]-$centre->[1])); - $endang+=$rad360 if $endang < $startang; - my $totang=($endang-$startang)/4; # do it in 4 pieces - # Now 1 piece - - my $x0=cos($totang/2); - my $y0=sin($totang/2); - my $x3=$x0; - my $y3=-$y0; - my $x1=(4-$x0)/3; - my $y1=((1-$x0)*(3-$x0))/(3*$y0); - my $x2=$x1; - my $y2=-$y1; - - # Rotate to start position and draw 4 pieces - - foreach my $j (0..3) + if (abs($endang-$startang) < 0.004) + { + if ($frot) + { + $stream.="q $ypos ".GraphY($xpos)." m ".($ypos+$p[1]+$p[3])." ".GraphY($xpos+$p[0]+$p[2])." l S Q\n"; + } + else + { + $stream.="q $xpos ".GraphY($ypos)." m ".($xpos+$p[0]+$p[2])." ".GraphY($ypos+$p[1]+$p[3])." l S Q\n"; + } + } + else { - PlotArcSegment($totang/2+$startang+$j*$totang,$r,$xpos+$centre->[0],GraphY($ypos+$centre->[1]),$x0,$y0,$x1,$y1,$x2,$y2,$x3,$y3); + $endang+=$rad360 if $endang < $startang; + my $pieces=int(($endang-$startang) / $rad90)+1; + my $totang=($endang-$startang)/$pieces; # do it in pieces + print STDERR "Pieces=$pieces, P=",join(',',@p),"\n"; + + # Now 1 piece + + my $x0=cos($totang/2); + my $y0=sin($totang/2); + return if !$y0; + my $x3=$x0; + my $y3=-$y0; + my $x1=(4-$x0)/3; + my $y1=((1-$x0)*(3-$x0))/(3*$y0); + my $x2=$x1; + my $y2=-$y1; + + # Rotate to start position and draw pieces + + foreach my $j (0..$pieces-1) + { + PlotArcSegment($totang/2+$startang+$j*$totang,$r,d3($xpos+$centre->[0]),d3(GraphY($ypos+$centre->[1])),d3($x0),d3($y0),d3($x1),d3($y1),d3($x2),d3($y2),d3($x3),d3($y3)); + } } $xpos+=$p[0]+$p[2]; @@ -4001,7 +4019,7 @@ sub adjust_arc_centre } else { - return(undef); + return([0,0]); } } @@ -4009,8 +4027,8 @@ sub adjust_arc_centre sub PlotArcSegment { my ($ang,$r,$transx,$transy,$x0,$y0,$x1,$y1,$x2,$y2,$x3,$y3)=@_; -my $cos=cos($ang); -my $sin=sin($ang); +my $cos=sprintf("%0.5f",cos($ang)); +my $sin=sprintf("%0.5f",sin($ang)); my @mat=($cos,$sin,-$sin,$cos,0,0); my $lw=$lwidth/$r; ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [gropdf] Deal better with invalid destination names.
deri pushed a commit to branch master in repository groff. commit b8038971a3cc51cd3981af49092dbdb493f76c06 Author: Deri James AuthorDate: Sat May 25 13:40:21 2024 +0100 [gropdf] Deal better with invalid destination names. Bookmark destinations (supplied by -T to .pdfbookmark) are "Name Objects" in pdf terms, as such they are limited to characters in the range 33 (!) to 126 (~). Characters outside this range must be coded as a # followed by the 2 digit hex number. So a space character should be '#20'. Gropdf produces pdfs which conform to this rule, but the pdf parser (used to import pdfs for pdfpic) expects only valid syntax. To convert pdfmark input to a pdf object gropdf used this inbuilt parser. The .TH macro in an.tmac passes its first parameter as a bookmark destination. Normally this is fine, since the convention is that this will be the name of the program the man page is documenting. The problem in this case is the line:- .TH "Pamaltsat User Manual" 0 "14 September 2018" "netpbm documentation" The first parameter contains spaces, which yields invalid syntax when parsed as "/Dest /Pamaltsat User Manual(0)". * src/devices/gropdf/gropdf: Don't use internal parser on "user" supplied input, be a bit more careful. Fixes: https://savannah.gnu.org/bugs/?65788 Thanks to Bjarni for the report. --- ChangeLog| 36 src/devices/gropdf/gropdf.pl | 15 --- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e978a25dd..2d68c60e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,39 @@ +2024-05-25 Deri James + + [gropdf] Deal better with invalid destination names. + + Bookmark destinations (supplied by -T to .pdfbookmark) + are "Name Objects" in pdf terms, as such they are limited + to characters in the range 33 (!) to 126 (~). Characters + outside this range must be coded as a # followed by the + 2 digit hex number. So a space character should be '#20'. + + Gropdf produces pdfs which conform to this rule, but the + pdf parser (used to import pdfs for pdfpic) expects only + valid syntax. To convert pdfmark input to a pdf object + gropdf used this inbuilt parser. + + The .TH macro in an.tmac passes its first parameter as a + bookmark destination. Normally this is fine, since the + convention is that this will be the name of the program + the man page is documenting. The problem in this case + is the line:- + + .TH "Pamaltsat User Manual" 0 "14 September 2018" + "netpbm documentation" + + The first parameter contains spaces, which yields invalid + syntax when parsed as "/Dest /Pamaltsat User Manual(0)". + + * src/devices/gropdf/gropdf: Don't use internal parser + on "user" supplied input, be a bit more careful. + + Fixes:- + + https://savannah.gnu.org/bugs/?65788 + + Thanks to Bjarni for the report. + 2024-05-14 Deri James [gropdf] Problem if mixed fonts have different lenIV. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 30a8de868..df645c4e0 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -1465,11 +1465,12 @@ sub do_x $cat->{$k}=$docview->{$k} if !exists($cat->{$k}); } } - elsif ($pdfmark=~m/(.+) \/DEST\s*$/) + elsif ($pdfmark=~m/\/Dest (\/.+?)( \/View .+) \/DEST\s*$/) { - my @xwds=split(' ',"<< $1 >>"); + my (@d)=($1,$2); + my @xwds=split(' ',"<< $d[1] >>"); my $dest=ParsePDFValue(\@xwds); - $dest->{Dest}=UTFName($dest->{Dest}); + $dest->{Dest}=UTFName($d[0]); $dest->{View}->[1]=GraphY($dest->{View}->[1]*-1); unshift(@{$dest->{View}},"$cpageno 0 R"); @@ -1504,14 +1505,14 @@ sub do_x my $t=$1; $t=~s/\\\) /\) /g; $t=~s/\\e//g; - $t=~m/(^.*\/Title \()(.*)(\).*)/; - my ($pre,$title,$post)=($1,$2,$3); + $t=~m/^\/Dest (.+?) \/Title \((.*)(\).*)/; + my ($d,$title,$post)=($1,$2,$3); $title=utf16($title); $title="\\134" if $title eq "\\"; - my @xwds=split(' ',"<< $pre$title$post >>"); + my @xwds=split(' ',"<< \/Title ($title$post >
[groff] 01/01: [gropdf] Problem if mixed fonts have different lenIV.
deri pushed a commit to branch master in repository groff. commit 4c62e07f364957be83fe9fe46151a9edb544a34c Author: Deri James AuthorDate: Fri May 17 17:48:55 2024 +0100 [gropdf] Problem if mixed fonts have different lenIV. * src/devices/gropdf/gropdf: Restore default value (4) for each font in case custom value used by previous font. Slight change to pattern matches. --- ChangeLog| 8 src/devices/gropdf/gropdf.pl | 9 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64ffb4231..e978a25dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-05-14 Deri James + + [gropdf] Problem if mixed fonts have different lenIV. + + * src/devices/gropdf/gropdf: Restore default value (4) for + each font in case custom value used by previous font. Slight + change to pattern matches. + 2024-05-14 Deri James [gropdf] \X'pdf: xrev' has issues. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 74d32a5d7..30a8de868 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -747,6 +747,7 @@ foreach my $fontno (sort keys %fontlst) ($head,$body,$tail)=GetType1($fnt->{fontfile}); $head=~s/\/Encoding \d.*?readonly def\b/\/Encoding StandardEncoding def/s; + $lenIV=4; if ($options & SUBSET) { @@ -4617,15 +4618,15 @@ sub map_subrs $RDre=qr/\Q$RD\E/; $NDre=qr/\Q$ND\E/; } - elsif ($lin=~m/^\/(.+?)\s+\{string currentfile exch readstring pop\}\s*executeonly def/) + elsif ($lin=~m/^\/(.+?)\s*\{string currentfile exch readstring pop\}\s*executeonly def/) { $RD=$1; } - elsif ($lin=~m/^\/(.+?)\s+\{noaccess def\}\s*executeonly def/) + elsif ($lin=~m/^\/(.+?)\s*\{noaccess def\}\s*executeonly def/) { $ND=$1; } - elsif ($lin=~m/^\/(.+?)\s+\{noaccess put\}\s*executeonly def/) + elsif ($lin=~m/^\/(.+?)\s*\{noaccess put\}\s*executeonly def/) { $NP=$1; } @@ -4873,7 +4874,7 @@ sub MarkSub } else { - Log(1,"Missing Subrs '$k'"); + Warn("Missing Subrs '$k'"); } } ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/03: [gropdf] Passing just "\" as a bookmark problem.
deri pushed a commit to branch master in repository groff. commit 2cf8f41d3f9985da0670ddd2cbc07837d5433299 Author: Deri James AuthorDate: Wed May 8 18:39:30 2024 +0100 [gropdf] Passing just "\" as a bookmark problem. * src/devices/gropdf/gropdf: it ends up as a pdf string "(\)", which is treated as an escaped bracket and the string is not terminated! Solution is to embed the "\" in octal notation, i.e. (\134). --- src/devices/gropdf/gropdf.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 31a35db4a..800af64c3 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -1507,6 +1507,7 @@ sub do_x my ($pre,$title,$post)=($1,$2,$3); $title=utf16($title); + $title="\\134" if $title eq "\\"; my @xwds=split(' ',"<< $pre$title$post >>"); my $out=ParsePDFValue(\@xwds); $out->{Dest}=UTFName($out->{Dest}); ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 03/03: Forgot to push last two fixes.
deri pushed a commit to branch master in repository groff. commit d998339bef8af990cca00b2b0a9939cc9fc2e7cf Author: Deri James AuthorDate: Tue May 14 15:43:44 2024 +0100 Forgot to push last two fixes. --- ChangeLog | 19 +++ 1 file changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index aa8814703..64ffb4231 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2024-05-14 Deri James + + [gropdf] \X'pdf: xrev' has issues. + + * src/devices/gropdf/gropdf: Fails if point size not = 10, in + a number of ways. + + * src/devices/gropdf/gropdf.1.man: Clarify exact operation of + 'xrev'. + +2024-05-14 Deri James + + [gropdf] Passing just "\" as a bookmark problem. + + * src/devices/gropdf/gropdf: it ends up as a pdf string "(\)", + which is treated as an escaped bracket and the string is not + terminated! Solution is to embed the "\" in octal notation, + i.e. (\134). + 2024-05-13 G. Branden Robinson * tmac/an.tmac (EE): Define macro with `de1` request, not `de`. ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 02/03: [gropdf] \X'pdf: xrev' has issues.
deri pushed a commit to branch master in repository groff. commit 4886b57816841de32c51b88ccffc9580b07bb535 Author: Deri James AuthorDate: Wed May 8 22:23:28 2024 +0100 [gropdf] \X'pdf: xrev' has issues. * src/devices/gropdf/gropdf: Fails if point size not = 10, in a number of ways. * src/devices/gropdf/gropdf.1.man: Clarify exact operation of 'xrev'. --- src/devices/gropdf/gropdf.1.man | 6 ++ src/devices/gropdf/gropdf.pl| 12 +++- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/devices/gropdf/gropdf.1.man b/src/devices/gropdf/gropdf.1.man index cc1971858..04e5799a5 100644 --- a/src/devices/gropdf/gropdf.1.man +++ b/src/devices/gropdf/gropdf.1.man @@ -977,10 +977,8 @@ height. .B \[rs]X\[aq]pdf: xrev\[aq] Toggle the reversal of glyph direction. . -This feature works \[lq]letter by letter\[rq], -that is, -each letter in a word is reversed left-to-right, -not the entire word. +This feature works by reversing all following text. +Each separate letter is also mirrored. . One application is the reversal of glyphs in the Zapf Dingbats font. . diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 800af64c3..74d32a5d7 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -4088,11 +4088,11 @@ sub PutLine my $len=0; my $rev=0; -if (($lin[0]->[CHR]||0) < 0) +if ($xrev) { - $len=($lin[$#lin]->[XPOS]-$lin[0]->[XPOS]+$lin[$#lin]->[HWID])*100; - $s.=d3($len).' '; -$rev=1; + $len=($lin[$#lin]->[XPOS]-$lin[0]->[XPOS]+$lin[$#lin]->[HWID])*1000/$cftsz; + $s.=d3($len).' ' if $len; + $rev=1; } $stream.="%! wht0sz=".d3($whtsz/$unitwidth).", wt=".((defined($wt))?d3($wt/$unitwidth):'--')."\n" if $debug; @@ -4157,7 +4157,7 @@ sub PutLine if ($rev) { $s.=') ' if !$n; - $s.=d3(($c->[CWID]-$c->[HWID])*100).' ('; + $s.=d3(($c->[CWID]-$c->[HWID])*1000/$cftsz).' ('; $n=0; } @@ -4331,11 +4331,13 @@ sub PutGlyph { MakeMatrix(1); $inxrev=1; + $#lin=-1; } elsif ($inxrev and $cn > 0) { MakeMatrix(0); $inxrev=0; + $#lin=-1; } if ($matrixchg or $poschg) ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [gropdf] Re-arrange pattern matches.
deri pushed a commit to branch master in repository groff. commit a951b44fd9d2acf060067b24c994604351a27888 Author: Deri James AuthorDate: Tue Apr 30 15:25:49 2024 +0100 [gropdf] Re-arrange pattern matches. * src/devices/gropdf/gropdf.pl: Correct order of pattern match. Fixes https://savannah.gnu.org/bugs/?65585 (again!) --- ChangeLog| 9 + src/devices/gropdf/gropdf.pl | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bb8fc9fb1..c947229d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2024-04-24 Deri James + + [gropdf] Re-arrange pattern matches. + + * src/devices/gropdf/gropdf.pl: Correct order of pattern + match. + + Fixes https://savannah.gnu.org/bugs/?65585 (again!) + 2024-04-30 Christof Meerwald * src/devices/gropdf/gropdf.pl: Call PDFDate with the output of diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 1656db821..31a35db4a 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -1983,6 +1983,7 @@ sub Clean my $p=shift; $p=~s/\\c?$//g; +$p=~s/\\[eE]/\\/g; $p=~s/\\[ 0~t]/ /g; $p=~s/\\[,!"#\$%&’.0:?{}ˆ_‘|^prud]//g; $p=~s/\\'/\\[aa]/g; @@ -1992,8 +1993,8 @@ sub Clean $p=~s/\\[Oz].//g; $p=~s/\\[ABbDHlLoRSvwXZ]$parcln//g; -$p=~s/\\[hs][-+]?$parclntyp//g; $p=~s/\\[FfgkMmnVY]$parclntyp//g; +$p=~s/\\[hs][-+]?$parclntyp//g; $p=~s/\\\((\w\w)/\\\[$1\]/g; # convert \(xx to \[xx] ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [gropdf] ignore 'Cspace' as input
deri pushed a commit to branch master in repository groff. commit 1ab868c5c84a02f32ab2c385066215d2aa7d650b Author: Deri James AuthorDate: Sun Apr 28 18:03:59 2024 +0100 [gropdf] ignore 'Cspace' as input * src/devices/gropdf/gropdf.pl: As grops does. --- ChangeLog| 6 ++ src/devices/gropdf/gropdf.pl | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f88d241a4..d8d48e2b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-04-24 Deri James + + [gropdf] ignore 'Cspace' as input + + * src/devices/gropdf/gropdf.pl: As grops does. + 2024-04-24 Deri James [gropdf] use nospace mode if font does not contain diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index df61903e4..acf86389f 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -4455,7 +4455,7 @@ sub do_C my $par=shift; my $fnt=$fontlst{$cft}->{FNT}; -PutGlyph($fnt,$par,1); +PutGlyph($fnt,$par,1) if $par ne 'space'; } sub do_c @@ -4479,7 +4479,7 @@ sub do_N } my $chnm=$fnt->{NO}->[$par]; -PutGlyph($fnt,$chnm,1); +PutGlyph($fnt,$chnm,1) if $chnm ne 'space'; } sub do_n ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [gropdf] use nospace mode if font does not contain /space glyph.
deri pushed a commit to branch master in repository groff. commit 9e0a3316c7b1f33f22d3b314456b2415cc9856eb Author: Deri James AuthorDate: Sun Apr 28 14:59:05 2024 +0100 [gropdf] use nospace mode if font does not contain /space glyph. Gropdf always had two modes, depending on whether the font defined /space or not (using space could make the pdf slightly more compact). Some fonts which don't have /space do have a glyph named /u0020 and the code used that as a space, however I'm not convinced of the robustness of this so, now, if a font has no /space then nospace mode is used. * src/devices/gropdf/gropdf.pl: Always use nospace mode if font has no /space glyph. --- ChangeLog| 15 +++ src/devices/gropdf/gropdf.pl | 12 +--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba4f786e8..f88d241a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2024-04-24 Deri James + + [gropdf] use nospace mode if font does not contain + /space glyph. + + Gropdf always had two modes, depending on whether the font + defined /space or not (using space could make the pdf + slightly more compact). Some fonts which don't have /space + do have a glyph named /u0020 and the code used that as a + space, however I'm not convinced of the robustness of this + so, now, if a font has no /space then nospace mode is used. + + * src/devices/gropdf/gropdf.pl: Always use nospace mode if + font has no /space glyph. + 2024-04-24 Deri James [gropdf] Can't handle DecodeParams in Deflate filter. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 7bb1610c2..df61903e4 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -729,7 +729,7 @@ foreach my $fontno (sort keys %fontlst) my @fontdesc=(); my $chars=$fnt->{TRFCHAR}; my $glyphs='/.notdef'; -$glyphs.='/space' if defined($fnt->{NO}->[32]) and $fnt->{NO}->[32] eq 'u0020'; +$glyphs.='/space' if defined($fnt->{NO}->[32]) and $fnt->{NO}->[32] eq 'space'; my $fobj; @glyphused=@subrused=%seac=(); push(@subrused,'#0','#1','#2','#3','#4'); @@ -783,7 +783,7 @@ foreach my $fontno (sort keys %fontlst) my @widths; my $miss=-1; my $CharSet=join('',@{$fnt->{CHARSET}->[$j]}); - push(@{$chars->[$j]},'u0020') if $j==0 and $fnt->{NAM}->{u0020}->[PSNAME]; + push(@{$chars->[$j]},'space') if $j==0 and $fnt->{NAM}->{space}->[PSNAME]; foreach my $og (sort { $nam->{$a}->[MINOR] <=> $nam->{$b}->[MINOR] } (@{$chars->[$j]})) { @@ -3232,8 +3232,6 @@ sub LoadFont } $r[3]=oct($r[3]) if substr($r[3],0,1) eq '0'; - $r[0]='u0020' if $r[3] == 32; - $r[0]="u00".hex($r[3]) if $r[0] eq '---'; $r[4]=$r[0] if !defined($r[4]); $fnt{NAM}->{$r[0]}=[$p[0],$r[3],'/'.$r[4],undef,undef,$r[6]]; $fnt{NO}->[$r[3]]=$r[0]; @@ -3253,8 +3251,8 @@ sub LoadFont close($f); -$fnt{NAM}->{u0020}->[MINOR]=32; -$fnt{NAM}->{u0020}->[MAJOR]=0; +$fnt{NAM}->{space}->[MINOR]=32; +$fnt{NAM}->{space}->[MAJOR]=0; my $fno=0; my $slant=0; $fnt{DIFF}=[]; @@ -3266,7 +3264,7 @@ sub LoadFont $fnt{NAM}->{''}=[0,-1,'/.notdef',-1,0]; $slant=-$fnt{'slant'} if exists($fnt{'slant'}); $fnt{slant}=$slant; -$fnt{nospace}=(!defined($fnt{NAM}->{u0020}->[PSNAME]) or $fnt{NAM}->{u0020}->[PSNAME] ne '/space' or !exists($fnt{'spacewidth'}))?1:0; +$fnt{nospace}=(!defined($fnt{NAM}->{space}->[PSNAME]) or $fnt{NAM}->{space}->[PSNAME] ne '/space' or !exists($fnt{'spacewidth'}))?1:0; $fnt{'spacewidth'}=270 if !exists($fnt{'spacewidth'}); Notice("Using nospace mode for font '$ofontnm'") if $fnt{nospace} == 1 and $options & USESPACE; ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [gropdf] Can't handle DecodeParams in Deflate filter.
deri pushed a commit to branch master in repository groff. commit 14563f831454bd879f465ac4738624c5e3f380ed Author: Deri James AuthorDate: Sun Apr 28 13:36:31 2024 +0100 [gropdf] Can't handle DecodeParams in Deflate filter. If gropdf called with -d (debug) the pdf is produced with objects uncompressed, if object does not use default deflate parameters Zlib does not decompress properly, so the decompressed object is invalid. This affects when using a pdf imported with 'pdfpic' which contains a png image. This only affects imported pdfs when using the -d flag, because otherwise it is just passed through with no decompress. * src/devices/gropdf/gropdf.pl: Don't decompress if object has a DecodeParams dictionary. --- ChangeLog| 17 + src/devices/gropdf/gropdf.pl | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e1483c5ed..ba4f786e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2024-04-24 Deri James + + [gropdf] Can't handle DecodeParams in Deflate filter. + + If gropdf called with -d (debug) the pdf is produced with + objects uncompressed, if object does not use default deflate + parameters Zlib does not decompress properly, so the + decompressed object is invalid. This affects when using a + pdf imported with 'pdfpic' which contains a png image. + + This only affects imported pdfs when using the -d flag, + because otherwise it is just passed through with no + decompress. + + * src/devices/gropdf/gropdf.pl: Don't decompress if object has + a DecodeParams dictionary. + 2024-04-20 G. Branden Robinson * tmac/tmac.am ($(M4CHECK)): Ensure directory exists to house diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 59434a8ec..7bb1610c2 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -2577,7 +2577,7 @@ sub LoadStream Warn("failed to read all of the stream") if $l != sysread(PD,$o->{STREAM},$l); -if ($gotzlib and exists($o->{OBJ}->{'Filter'}) and $o->{OBJ}->{'Filter'} eq '/FlateDecode') +if ($gotzlib and exists($o->{OBJ}->{'Filter'}) and $o->{OBJ}->{'Filter'} eq '/FlateDecode' and !exists($o->{OBJ}->{'DecodeParms'})) { $o->{STREAM}=Compress::Zlib::uncompress($o->{STREAM}); delete($o->{OBJ }->{'Filter'}); ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [gropdf] Handle both types in one document.
deri pushed a commit to branch master in repository groff. commit 0f96f3a281d82bb0c1a59e5e819d2a22bede6c5d Author: Deri James AuthorDate: Thu Apr 18 01:17:22 2024 +0100 [gropdf] Handle both types in one document. The different format of font described in previous commit fails if document contains fonts of both formats. The reason is because the regexes included the /o flag (compile once) for speed, but if the format changed (from RD to -|) in a different font, parsing failed. Now the regexes are compiled once for each font. * src/devices/gropdf/gropdf.pl: Use qr// to compile regexes once per font. --- ChangeLog| 14 ++ src/devices/gropdf/gropdf.pl | 9 ++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1cce0827d..a88d52c5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2024-04-17 Deri James + + [gropdf] Handle both types in one document. + + The different format of font described in previous commit fails if + document contains fonts of both formats. The reason is because the + regexes included the /o flag (compile once) for speed, but if the + format changed (from RD to -|) in a different font, parsing failed. + + Now the regexes are compiled once for each font. + + * src/devices/gropdf/gropdf.pl: Use qr// to compile regexes once + per font. + 2024-04-17 Deri James [gropdf] Improve font parsing. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 240f1025c..59434a8ec 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -4601,6 +4601,7 @@ sub map_subrs my $stage=0; my $lin=$lines->[0]; my $i=0; +my ($RDre,$NDre); for (my $j=0; $j<=$#{$lines}; $lin=$lines->[++$j] ) { @@ -4612,6 +4613,8 @@ sub map_subrs { $sec{'#Subrs'}=$j; $stage=1; + $RDre=qr/\Q$RD\E/; + $NDre=qr/\Q$ND\E/; } elsif ($lin=~m/^\/(.+?)\s+\{string currentfile exch readstring pop\}\s*executeonly def/) { @@ -4638,7 +4641,7 @@ sub map_subrs $stage=2; $i=0; } - elsif ($lin=~m/^\s*dup\s+(\d+)\s+(\d+)\s+\Q$RD\E (.*)/os) + elsif ($lin=~m/^\s*dup\s+(\d+)\s+(\d+)\s+$RDre (.*)/s) { my $n=$1; my $l=$2; @@ -4666,7 +4669,7 @@ sub map_subrs # subs_call($s,"#$n"); $lines->[$i]=["#$n",$l,$s,$NP]; } - elsif ($lin=~m/^\Q$ND\E/o) + elsif ($lin=~m/^$NDre/) {} else { @@ -4680,7 +4683,7 @@ sub map_subrs $sec{'#Pad'}=$j; $stage=3; } - elsif ($lin=~m/^\s*\/([-.\w]*)\s+(\d+)\s+\Q$RD\E (.*)/os) + elsif ($lin=~m/^\s*\/([-.\w]*)\s+(\d+)\s+$RDre (.*)/s) { my $n=$1; my $l=$2; ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Improve font parsing.
deri pushed a commit to branch master in repository groff. commit 5589bcd18776c6d236c53226a0ee30506180e6b6 Author: Deri James AuthorDate: Wed Apr 17 19:25:03 2024 +0100 Improve font parsing. The usual (for fontforge converted ttf fonts) is to use the RD, ND and NP operators within charstring definitions, however these are just named in the private subrs dictionary so could be assigned any name. A debian .pfb version of a google .ttf font (which has not passed through fontforge) used -| |- and | as the 3 equivalent. In addition it used a different lenIV value for the eexec encryption (4) and the charstring encryption (0) (didn't know you could do that). * src/devices/gropdf/gropdf.pl: Make RD, ND and NP variables set from parsing the private subrs. Honour lenIV=0 when encrypting charstrings. --- ChangeLog| 18 ++ src/devices/gropdf/gropdf.pl | 39 +-- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index e56b92eb1..1cce0827d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2024-04-17 Deri James + + [gropdf] Improve font parsing. + + The usual (for fontforge converted ttf fonts) is to use the RD, ND + and NP operators within charstring definitions, however these are + just named in the private subrs dictionary so could be assigned + any name. + + A debian .pfb version of a google .ttf font (which has not passed + through fontforge) used -| |- and | as the 3 equivalent. In + addition it used a different lenIV value for the eexec encryption (4) + and the charstring encryption (0) (didn't know you could do that). + + * src/devices/gropdf/gropdf.pl: Make RD, ND and NP variables set + from parsing the private subrs. Honour lenIV=0 when encrypting + charstrings. + 2024-04-16 Deri James [gropdf] Problem with '(' and '\' (\[rs]) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 5543b0f1f..240f1025c 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -361,6 +361,9 @@ my $textenccmap=''; # CMap for groff text.enc encoding my @XOstream=(); my @PageAnnots={}; my $noslide=0; +my $ND='ND'; +my $NP='NP'; +my $RD='RD'; my $transition={PAGE => {Type => '/Trans', S => '', D => 1, Dm => '/H', M => '/I', Di => 0, SS => 1.0, B => 0}, BLOCK => {Type => '/Trans', S => '', D => 1, Dm => '/H', M => '/I', Di => 0, SS => 1.0, B => 0}}; my $firstpause=0; @@ -4577,7 +4580,7 @@ sub encrypt_exec sub encrypt_char { my $la=shift; -unshift(@{$la},0x44,0x65,0x72,0x69); +unshift(@{$la},0x44,0x65,0x72,0x69) if $lenIV; my $res; my $cypher; my $cr=C_DEF; @@ -4610,6 +4613,22 @@ sub map_subrs $sec{'#Subrs'}=$j; $stage=1; } + elsif ($lin=~m/^\/(.+?)\s+\{string currentfile exch readstring pop\}\s*executeonly def/) + { + $RD=$1; + } + elsif ($lin=~m/^\/(.+?)\s+\{noaccess def\}\s*executeonly def/) + { + $ND=$1; + } + elsif ($lin=~m/^\/(.+?)\s+\{noaccess put\}\s*executeonly def/) + { + $NP=$1; + } + elsif ($lin=~m'^/lenIV\s+(\d+)') + { + $lenIV=$1; + } } elsif ($stage == 1) { @@ -4619,7 +4638,7 @@ sub map_subrs $stage=2; $i=0; } - elsif ($lin=~m/^\s*dup\s+(\d+)\s+(\d+)\s+RD (.*)/s) + elsif ($lin=~m/^\s*dup\s+(\d+)\s+(\d+)\s+\Q$RD\E (.*)/os) { my $n=$1; my $l=$2; @@ -4645,9 +4664,9 @@ sub map_subrs # $s=decrypt_char($s); # subs_call($s,"#$n"); - $lines->[$i]=["#$n",$l,$s,'NP']; + $lines->[$i]=["#$n",$l,$s,$NP]; } - elsif ($lin=~m/^ND/) + elsif ($lin=~m/^\Q$ND\E/o) {} else { @@ -4661,7 +4680,7 @@ sub map_subrs $sec{'#Pad'}=$j; $stage=3; } - elsif ($lin=~m/^\s*\/([-.\w]*)\s+(\d+)\s+RD (.*)/s) + elsif ($lin=~m/^\s*\/([-.\w]*)\s+(\d+)\s+\Q$RD\E (.*)/os) { my $n=$1; my $l=$2; @@ -4690,7 +4709,7 @@ sub map_subrs } else { - $lines->[$i]=["/$n",$l,$s,'ND']; + $lines->[$i]=["/$n",$l,$s,$ND]; } $i=0; @@ -4886,7 +4905,7 @@ sub encrypt next if !defined($lin); - if (ref($lin) eq 'ARRAY' and $lin->[TYPE] eq 'NP') + if (ref($lin) eq 'ARRAY' and
[groff] 02/03: Problem with '(' and '\' (\[rs])
deri pushed a commit to branch master in repository groff. commit f336f8244b09191b16722984c33fc5addcc4a284 Author: Deri James AuthorDate: Tue Apr 16 17:34:59 2024 +0100 Problem with '(' and '\' (\[rs]) Bpth these tokens have meaning for roff AND pdf strings. In pdfs unbalanced parentheses have to be escaped (with '\') and a single '\' has to be similarly escaped, '\\'. It is gropdf's responsibility to ensure pdf strings are valid, no matter what the input. If '\(ul' is passed then the UTF-16 character becomes '_'. If '\[rs](ul' is passed (i.e. '\(ul' is intended to become the UTF-16 string) \[rs] becomes '\' leaving '\(ul', which if becomes '_', not what is intended. If the unbalanced '(' is eascaped first, '\[rs]\(ul' which could become '\\_' when the '\' is escaped, yielding '\_'. The code which escpes parenthesis checks it is not already preceded by '\' since adding another would give you '\\(' which is not what you want. The correct output should be '\\\(ul' to achieve the correct pdf string. This fixes the above issue (I hope). * src/devices/gropdf/gropdf.pl: Change pattern matches --- src/devices/gropdf/gropdf.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 3ca187f69..5543b0f1f 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -1981,7 +1981,6 @@ sub Clean my $p=shift; $p=~s/\\c?$//g; -$p=~s/\\[eE]/\\/g; $p=~s/\\[ 0~t]/ /g; $p=~s/\\[,!"#\$%&’.0:?{}ˆ_‘|^prud]//g; $p=~s/\\'/\\[aa]/g; @@ -2004,6 +2003,7 @@ sub utf16 my $p=Clean(shift); my $label=shift; +$p=~s/\\\(rs|\\\[rs\]/\\E/g; $p=~s/\\\[(.*?)\]/FindChr($1,0)/eg; $p=~s/\\C($parcln)/FindChr($1,1)/eg; #$p=~s/\\\((..)/FindChr($1)/eg; @@ -2019,6 +2019,7 @@ sub utf16 $p=~s/(?https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/03: Another font with UTF-16 added to comment
deri pushed a commit to branch master in repository groff. commit 3cb502448b1de76036af7c143230ac11f7410bee Author: Deri James AuthorDate: Tue Apr 16 15:28:41 2024 +0100 Another font with UTF-16 added to comment * font/devps/S --- font/devps/S | 316 +-- 1 file changed, 158 insertions(+), 158 deletions(-) diff --git a/font/devps/S b/font/devps/S index ae8b3a902..e76b7bae2 100644 --- a/font/devps/S +++ b/font/devps/S @@ -19,189 +19,189 @@ spacewidth 250 charset space 250 0 32 space -! 333,672,17 3 33 exclam -fa 713,705 3 34 universal -# 500,673,16 3 35 numbersign +! 333,672,17 3 33 exclam -- 0021 +fa 713,705 3 34 universal -- 2200 +# 500,673,16 3 35 numbersign -- 0023 sh " -te 549,707 3 36 existential -% 833,655,36 3 37 percent -& 778,661,18 3 38 ampersand -st 439,500,17 3 39 suchthat -( 333,673,191 3 40 parenleft -) 333,673,191 3 41 parenright -** 500,551 3 42 asteriskmath -+ 549,533 3 43 plus +te 549,707 3 36 existential -- 2203 +% 833,655,36 3 37 percent -- 0025 +& 778,661,18 3 38 ampersand -- 0026 +st 439,500,17 3 39 suchthat-- 220B +( 333,673,191 3 40 parenleft -- 0028 +) 333,673,191 3 41 parenright -- 0029 +** 500,551 3 42 asteriskmath-- 2217 ++ 549,533 3 43 plus-- 002B pl " -, 250,104,152 3 44 comma -\- 549,288 3 45 minus +, 250,104,152 3 44 comma -- 002C +\- 549,288 3 45 minus -- 2212 mi " -. 250,95,17 3 46 period -/ 278,646,18 3 47 slash +. 250,95,17 3 46 period -- 002E +/ 278,646,18 3 47 slash -- 002F sl " -0 500,685,14 3 48 zero -1 500,673 3 49 one -2 500,685 3 50 two -3 500,685,14 3 51 three -4 500,685 3 52 four -5 500,690,14 3 53 five -6 500,685,14 3 54 six -7 500,673,16 3 55 seven -8 500,685,14 3 56 eight -9 500,685,18 3 57 nine -: 278,460,17 3 58 colon -; 278,460,152 3 59 semicolon -< 549,522 3 60 less -= 549,390 3 61 equal +0 500,685,14 3 48 zero-- 0030 +1 500,673 3 49 one -- 0031 +2 500,685 3 50 two -- 0032 +3 500,685,14 3 51 three -- 0033 +4 500,685 3 52 four-- 0034 +5 500,690,14 3 53 five-- 0035 +6 500,685,14 3 54 six -- 0036 +7 500,673,16 3 55 seven -- 0037 +8 500,685,14 3 56 eight -- 0038 +9 500,685,18 3 57 nine-- 0039 +: 278,460,17 3 58 colon -- 003A +; 278,460,152 3 59 semicolon -- 003B +< 549,522 3 60 less-- 003C += 549,390 3 61 equal -- 003D eq " -> 549,522 3 62 greater -? 444,686,17 3 63 question -=~ 549,475 3 64 congruent -*A 722,673 3 65 Alpha -*B 667,673 3 66 Beta -*X 722,673,0,0,9 3 67 Chi -*D 612,688 3 68 Delta -*E 611,673,0,6 3 69 Epsilon -*F 763,673 3 70 Phi -*G 603,673,0,6 3 71 Gamma -*Y 722,673,0,7 3 72 Eta -*I 333,673 3 73 Iota -+h 631,689,18 3 74 theta1 -*K 722,673 3 75 Kappa -*L 686,688 3 76 Lambda -*M 889,673 3 77 Mu -*N 722,673,8 3 78 Nu -*O 722,685,17 3 79 Omicron -*P 768,673 3 80 Pi -*H 741,685,17 3 81 Theta -*R 556,673,0,7 3 82 Rho -*S 592,673 3 83 Sigma -*T 611,673 3 84 Tau -ts 439,500,233 3 86 sigma1 -*W 768,688 3 87 Omega -*C 645,673 3 88 Xi -*Q 795,684 3 89 Psi -*Z 611,673,0,253 90 Zeta -[ 333,674,155 3 91 bracketleft +> 549,522 3 62 greater -- 003E +?
[groff] 03/03: ... and the ChangeLog
deri pushed a commit to branch master in repository groff. commit 1cd6ed080ff026f0df1e213f4f93523120d54e94 Author: Deri James AuthorDate: Tue Apr 16 17:46:15 2024 +0100 ... and the ChangeLog --- ChangeLog | 24 1 file changed, 24 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4ec2ff55a..fd58b607d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2024-04-16 Deri James + + [gropdf] Problem with '(' and '\' (\[rs]) + + Bpth these tokens have meaning for roff AND pdf strings. In + pdfs unbalanced parentheses have to be escaped (with '\') and + a single '\' has to be similarly escaped, '\\'. It is gropdf's + responsibility to ensure pdf strings are valid, no matter what + the input. + + If '\(ul' is passed then the UTF-16 character becomes '_'. + If '\[rs](ul' is passed (i.e. '\(ul' is intended to become the + UTF-16 string) \[rs] becomes '\' leaving '\(ul', which + becomes '_', not what is intended. If the unbalanced '(' is + eascaped first, '\[rs]\(ul' which could become '\\_' when the + '\' is escaped, yielding '\_'. The code which escapes parenthesis + checks it is not already preceded by '\' since adding another + would give you '\\(' which is not what you want. The correct + output should be '\\\(ul' to achieve the correct pdf string. + + This fixes the above issue (I hope). + + * src/devices/gropdf/gropdf.pl: Change pattern matches + 2024-04-15 G. Branden Robinson * tmac/an-ext.tmac : Trivially refactor. Rename string ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: 4 missing fonts from commit 98b0c1db476
deri pushed a commit to branch master in repository groff. commit cbe5a7802df5ff3a9f84a42e277cf3925a1eb303 Author: Deri James AuthorDate: Fri Apr 12 23:48:10 2024 +0100 4 missing fonts from commit 98b0c1db476 * font/devps: Include CR, CI, CB and CBI with UTF-16 code in the comment field. --- font/devps/CB | 456 - font/devps/CBI | 456 - font/devps/CI | 456 - font/devps/CR | 456 - 4 files changed, 912 insertions(+), 912 deletions(-) diff --git a/font/devps/CB b/font/devps/CB index c5b1d9896..22ace6cb5 100644 --- a/font/devps/CB +++ b/font/devps/CB @@ -18,249 +18,249 @@ spacewidth 600 encoding text.enc charset -ha 600,750 2 0 asciicircum -ti 600,311 0 1 asciitilde -vS 600,811,13 2 2 Scaron -vZ 600,811 2 3 Zcaron -vs 600,679,12 2 4 scaron -vz 600,679 2 5 zcaron -:Y 600,789 2 6 Ydieresis -tm 600,678 2 7 trademark -aq 600,572 2 8 quotesingle -Eu 600,612,12 2 9 Euro +ha 600,750 2 0 asciicircum -- 005E +ti 600,311 0 1 asciitilde -- 007E +vS 600,811,13 2 2 Scaron -- 0160 +vZ 600,811 2 3 Zcaron -- 017D +vs 600,679,12 2 4 scaron -- 0161 +vz 600,679 2 5 zcaron -- 017E +:Y 600,789 2 6 Ydieresis -- 0178 +tm 600,678 2 7 trademark -- 2122 +aq 600,572 2 8 quotesingle -- 0027 +Eu 600,612,12 2 9 Euro-- 20AC space 600 0 32 space -! 600,572,12 2 33 exclam -" 600,572 2 34 quotedbl +! 600,572,12 2 33 exclam -- 0021 +" 600,572 2 34 quotedbl-- 0022 dq " -# 600,649,52 2 35 numbersign +# 600,649,52 2 35 numbersign -- 0023 sh " -$ 600,646,124 2 36 dollar +$ 600,646,124 2 36 dollar -- 0024 Do " -% 600,617,33 2 37 percent -& 600,539,12 0 38 ampersand -' 600,572 2 39 quoteright +% 600,617,33 2 37 percent -- 0025 +& 600,539,12 0 38 ampersand -- 0026 +' 600,572 2 39 quoteright -- 2019 cq " -( 600,643,86 2 40 parenleft -) 600,643,86 2 41 parenright -* 600,570 2 42 asterisk -+ 600,438 0 43 plus -, 600,163,100 0 44 comma -- 600,282 0 45 hyphen +( 600,643,86 2 40 parenleft -- 0028 +) 600,643,86 2 41 parenright -- 0029 +* 600,570 2 42 asterisk-- 002A ++ 600,438 0 43 plus-- 002B +, 600,163,100 0 44 comma -- 002C +- 600,282 0 45 hyphen -- 002D hy " -. 600,153,12 0 46 period -/ 600,696,133 2 47 slash +. 600,153,12 0 46 period -- 002E +/ 600,696,133 2 47 slash -- 002F sl " -0 600,612,12 2 48 zero -1 600,615 2 49 one -2 600,613 2 50 two -3 600,612,12 2 51 three -4 600,613 2 52 four -5 600,601,12 2 53 five -6 600,612,12 2 54 six -7 600,601 2 55 seven -8 600,613,11 2 56 eight -9 600,612,14 2 57 nine -: 600,403,12 0 58 colon -; 600,403,100 0 59 semicolon -< 600,446,8 0 60 less -= 600,339 0 61 equal -> 600,446,8 0 62 greater -? 600,582,13 2 63 question -@ 600,579,18 2 64 at +0 600,612,12 2 48 zero-- 0030 +1 600,615 2 49 one -- 0031 +2 600,613 2 50 two -- 0032 +3 600,612,12 2 51 three -- 0033 +4 600,613 2 52 four-- 0034 +5 600,601,12 2 53 five-- 0035 +6 600,612,12 2 54 six -- 0036 +7 600,601 2 55 seven -- 0037 +8 600,613,11 2 56 eight -- 0038 +9 600,612,14 2 57 nine-- 0039 +:
[groff] 02/02: Correct linear search introduced in commit cd9fde325f
deri pushed a commit to branch master in repository groff. commit 2387949ffc11b753dd91480dcb85be6c22819790 Author: Deri James AuthorDate: Fri Apr 12 17:10:49 2024 +0100 Correct linear search introduced in commit cd9fde325f * tmac/pdf.tmac: Various problems have been rectified, speed improvements to the linear search, Keith protection against illegal characters being used in string identifiers. * contrib/mom/om.tmac: Switch to using Branden's linear search so that we don't have to maintain two different methods. Fixes <https://savannah.gnu.org/bugs/?65585> --- ChangeLog | 31 ++ contrib/mom/om.tmac | 5 ++-- tmac/pdf.tmac | 76 +++-- 3 files changed, 67 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f29eecea..e036b25c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +2024-04-12 Deri James + + Correct and improve linear search introduced in commit + cd9fde325f, 4th March. + + * tmac/pdf.tmac: Various problems have been rectified, speed + improvements to the linear search, Keith protection against + illegal characters being used in string identifiers. + + * contrib/mom/om.tmac: Switch to using Branden's linear search + so that we don't have to maintain two different methods. + + Fixes <https://savannah.gnu.org/bugs/?65585> + +2024-04-12 Deri James + + Support UTF-16 Bookmarks. + + * src/devices/grops: Add comment field to the font files + which specifies the UTF-16 code for the character. + + * utils/afmtodit/afmtodit.pl: Add comment field holding the + UTF-16 code. + + * man/groff_font.5.man: Document use of comment field to hold + UTF-16 code. + + * src/devices/gropdf/gropdf.pl: Extract UTF-16 code from font + comment field (rather than a new field). And tweak to pdf + parser. + 2024-03-26 G. Branden Robinson * src/utils/grog/grog.pl (do_line): Recognize new requests in diff --git a/contrib/mom/om.tmac b/contrib/mom/om.tmac index 299cbc949..c7d20272e 100644 --- a/contrib/mom/om.tmac +++ b/contrib/mom/om.tmac @@ -23631,8 +23631,9 @@ No room to start \\*[MN-pos] margin note #\\n[MN-curr] on page \\n[#P]. .if '\\*[PDF_AST]'*' \{\ .chop PDF_TXT .ie '\\*[.T]'pdf' \{\ -. ie d pdf:look(\\*[PDF_NM]) \ -. as PDF_TXT \&\\*[PDF_AST_Q]\\*[pdf:look(\\*[PDF_NM])]\\*[PDF_AST_Q] +. pdf:lookup \\*[PDF_NM] +. ie !'\\*[pdf:lookup-result]'' \ +. as PDF_TXT \&\\*[PDF_AST_Q]\\*[pdf:lookup-value]\\*[PDF_AST_Q] . el \{\ . as PDF_TXT Unknown . if !rPDF_UNKNOWN .tm \ diff --git a/tmac/pdf.tmac b/tmac/pdf.tmac index 1b2415270..745d4ee37 100644 --- a/tmac/pdf.tmac +++ b/tmac/pdf.tmac @@ -68,6 +68,7 @@ am solely responsible for any bugs I may have introduced into this file. .pdf:SS \[*z] .char \[lh] \X'pdf: xrev'\[rh]\X'pdf: xrev' .nr pdf:bm.nl 1 +.nr pdf:bm.nk 0 .de pdfmark . nop \!x X ps:exec [\\$* pdfmark .. @@ -156,7 +157,8 @@ am solely responsible for any bugs I may have introduced into this file. .\" .\" Parse any specified (recognisable) PDFNOTE options .\" -. while dpdf:note\\$1 \{\ +. while \A'\\$1' \{\ +. if !dpdf:note\\$1 .break . pdf:note\\$1 \\$@ . shift \\n[pdf:note.argc] . \} @@ -201,9 +203,11 @@ am solely responsible for any bugs I may have introduced into this file. .de pdf:lookup .nr pdf:index 0 1 .ds pdf:lookup-result \" empty +.ds pdf:lookup-value \" empty .while d pdf:bm\\n+[pdf:index].tag \{\ . if '\\$1'\\*[pdf:bm\\n[pdf:index].tag]' \{\ . ds pdf:lookup-result \\*[pdf:bm\\n[pdf:index].tag]\" +. ds pdf:lookup-value \\*[pdf:bm\\n[pdf:index].val]\" . break . \} . \} @@ -230,8 +234,10 @@ am solely responsible for any bugs I may have introduced into this file. . \" Make the bookmark name "untagged" by default, . \" then parse any specified options, to set a "tag", if required . \" +. nr pdf:bm.nr +1 . ds pdf:href-T -. while dpdf:href.opt\\$1 \{\ +. while \A'\\$1' \{\ +. if !dpdf:href.opt\\$1 .break . pdf:href.opt\\$1 \\$@ . shift \\n[pdf:href.argc] . \} @@ -267,38 +273,26 @@ am solely responsible for any bugs I may have introduced into this file. . \" in order to generate a uniquely serialised bookmark name, . \" ( which we return in the string "PDFBOOKMARK.NAME" ), . \" -. nr pdf:bm.nr +1 . ie '\\*[pdf:href-T]'' .ds PDFBOOKMARK.NAME pdf:bm\\n[pdf:bm.nr] . el .ds PDFBOOKMARK.NAME \\*[pdf:href-T] . pdf:href.sety . ds pdf:cleaned \\$* -. ev pdfcln -. tr \[em]- -. nf -. box pdf:clean -. no
[groff] 05/05: Update ChangeLog
deri pushed a commit to branch master in repository groff. commit 3fe0a227e1533f8cc6ff56b890e70c79712a73de Author: Deri James AuthorDate: Tue Jan 30 18:16:11 2024 + Update ChangeLog --- ChangeLog | 37 + 1 file changed, 37 insertions(+) diff --git a/ChangeLog b/ChangeLog index b2fa75e5e..47f02fb8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,40 @@ +2024-01-26 Deri James + +Changes to satisfy Savannah #65231. + +Alter build of groff-man-pages.pdf to use the new pdfmom, +so that all forward references (i.e. reference to groff_font(5) +in addftinfo(1) page) are handled properly. Also pass bookmark +names as text strings. + +* doc/doc.am: Use pdfmom. +* tmac/an.tmac: Pass parameters to .pdfbookmark as a string. + +New pdfmom, can now be used with all macros. + +Previously only useful for producing documents with +mom. + +* src/devices/gropdf/pdfmom.pl: New --roff flag allows +other macros (e.g. -ms) to be given on the command line. + +* src/devices/gropdf/pdfmom.1.man: Document the new facility. + +Front Cover for groff-man-pages.pdf + +Feel free to alter "artwork" at will (perhaps add maintainer +information. + +* doc/GMPfront.t: Only used during build, not required as part +of installation. + +Remove artifacts from using stringhex. + +Introduced in commit #e62b188aacb, betraying its origin +from my deri-gropdf-ng branch which uses .stringhex. + +* src/devices/gropdf/gropdf.pl: minor fixes + 2024-01-29 G. Branden Robinson [tbl]: Fix Savannah #65225. ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/05: Front Cover for groff-man-pages.pdf
deri pushed a commit to branch master in repository groff. commit f619fee72005fba6fc10e5dc22b3df4ffb1372de Author: Deri James AuthorDate: Tue Jan 30 16:55:43 2024 + Front Cover for groff-man-pages.pdf Feel free to alter "artwork" at will (perhaps add maintainer information. * doc/GMPfront.t: Only used during build, not required as part of installation. --- doc/GMPfront.t | 70 ++ 1 file changed, 70 insertions(+) diff --git a/doc/GMPfront.t b/doc/GMPfront.t new file mode 100644 index 0..5011266b9 --- /dev/null +++ b/doc/GMPfront.t @@ -0,0 +1,70 @@ +.ig + front.t +.. +.nr PDFOUTLINE.FOLDLEVEL 1 +.defcolor pdf:href.colour rgb 0.00 0.25 0.75 +.pdfinfo /Title "The Groff Manpage Book" +.de an*cln +. ds \\$1 +. als an*cln:res \\$1 +. shift +. ds an*cln:res \\$*\" +. ds an*cln:chr \\$* +. substring an*cln:chr 0 0 +. if '\%'\\*[an*cln:chr]' \{\ +.substring an*cln:res 1 +. \} +.. +. +.de END +.. +. +.am reload-man END +.de an*bookmark +. if '*[.T]'pdf' \{\ +.ie ($1=1) \{\ +. an*cln an*page-ref-nm $2\" +. pdfbookmark -T "*[an*page-ref-nm]" $1 $2 +.\} +.el .pdfbookmark $1 $2 +. \} +.. +. +.de1 MR +. if ((n[.$] < 2) : (n[.$] > 3)) \ +.an-style-warn .$0 expects 2 or 3 arguments, got n[.$] +. if '*[.T]'pdf' \{\ +.ie n(.$=1 \ +. I $1 +.el \{\ +. an*cln an*page-ref-nm $1($2) +. ie d pdf:look(*[an*page-ref-nm]) .pdfhref L -D *[an*page-ref-nm] -A "$3" -- \fI$1\fP($2) +. el .IR $1 ($2)$3 +.\} +. \} +. hy n[an*hyphenation-mode] +.. +.END +. +.de Hl +.br +\l'\\n[.l]u-\\n[.i]u\&\\$1' +.br +.. +\Z@\D't 8p'@ +.pdfbookmark 1 Cover +.pdfpagenumbering +.sp 2i +.Hl +.sp .6i +.ad r +.ps 52 +\m[maroon]Groff\m[] +.sp 18p +.ps 16 +\f[BMB]THE MAN PAGES BOOK\fP +.sp .2i +.Hl +.pn 1 +.bp +.pdfpagenumbering D . 1 ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 04/05: Remove artifacts from using stringhex.
deri pushed a commit to branch master in repository groff. commit 9b8b3e2a508d7df0b661c9042b5f5d5e7a0688da Author: Deri James AuthorDate: Tue Jan 30 18:02:13 2024 + Remove artifacts from using stringhex. Introduced in commit #e62b188aacb, betraying its origin from my deri-gropdf-ng branch which uses .stringhex. * src/devices/gropdf/gropdf.pl: minor fixes --- src/devices/gropdf/gropdf.pl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index f0b04909a..f7fc229cd 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -2063,10 +2063,9 @@ sub UTFName $s=substr($s,1); my $s1=$s; -$s1=~s/([[:xdigit:]]{2})/chr(hex($1))/eg; my $s2=utf16($s1,1); #return "/".MakeLabel((substr($s2,0,1) eq '/')?$s:$s2); -my $s3='/'.join '', map { MakeLabel($_) } unpack('C*',(substr($s2,0,1) eq '\\')?$s:$s2); +my $s3='/'.join '', map { MakeLabel($_) } unpack('C*',$s2); return $s3; } @@ -2854,7 +2853,7 @@ sub ParsePDFValue return(ParsePDFArray($pdfwds)); } -if ($wd=~m/(.*?)(\(.*)$/) +if ($wd=~m/(.*?)(\(.*)$/ and substr($wd,0,1) ne '/') { if (defined($1) and length($1)) { ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 02/05: New pdfmom, can now be used with all macros.
deri pushed a commit to branch master in repository groff. commit df1d447c99b984f9fd82f46cfc2becb2475b6d6e Author: Deri James AuthorDate: Tue Jan 30 17:05:00 2024 + New pdfmom, can now be used with all macros. Previously only useful for producing documents with mom. * src/devices/gropdf/pdfmom.pl: New --roff flag allows other macros (e.g. -ms) to be given on the command line. * src/devices/gropdf/pdfmom.1.man: Document the new facility. --- src/devices/gropdf/pdfmom.1.man | 27 +++- src/devices/gropdf/pdfmom.pl| 56 + 2 files changed, 72 insertions(+), 11 deletions(-) diff --git a/src/devices/gropdf/pdfmom.1.man b/src/devices/gropdf/pdfmom.1.man index 8d60047ba..77397fded 100644 --- a/src/devices/gropdf/pdfmom.1.man +++ b/src/devices/gropdf/pdfmom.1.man @@ -10,7 +10,7 @@ macro package for .\" Legal Terms .\" .\" -.\" Copyright (C) 2012-2020 Free Software Foundation, Inc. +.\" Copyright (C) 2012-2023 Free Software Foundation, Inc. .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are @@ -53,6 +53,7 @@ macro package for .\" . .SY pdfmom +.RB [ \-\-roff ] .RB [ \-Tpdf ] .RI [ groff-options ] .RI [ file\~ .\|.\|.] @@ -60,6 +61,7 @@ macro package for . . .SY pdfmom +.RB [ \-\-roff ] .B \-Tps .RI [ pdfroff-options ] .RI [ groff-options ] @@ -89,6 +91,25 @@ macros. . . .P +If the +.B \-\-roff +option is used, +the wrapper can be used with macro packages other than +.MR groff_mom @MAN7EXT@ . +. +This is also true if the wrapper is renamed or linked as a +pseudonym; +for example, +creating a +.I pdfms +link pointing to the +.I pdfmom +executable makes a wrapper for producing PDFs with the +.I ms +package. +. +. +.P .I pdfmom prints to the standard output, so output must usually be redirected to a destination file. @@ -173,6 +194,10 @@ options, .I pdfmom displays its version information and exits. . +Using the +.B \-\-help +option displays a usage message and exits. +. . .\" .SH Authors diff --git a/src/devices/gropdf/pdfmom.pl b/src/devices/gropdf/pdfmom.pl index 89977d496..1c24d85b9 100644 --- a/src/devices/gropdf/pdfmom.pl +++ b/src/devices/gropdf/pdfmom.pl @@ -1,6 +1,6 @@ #!@PERL@ # -# pdfmom : Frontend to run groff -mom to produce PDFs +# pdfmom : Frontend to run groff to produce PDFs # Deri James : Friday 16 Mar 2012 # @@ -29,6 +29,20 @@ my @cmd; my $dev='pdf'; my $preconv=''; my $readstdin=1; +my $mom='-mom'; +my $zflg=''; +if ($0=~m/pdf(\w+)$/) +{ +my $m=$1; +if ($m=~m/^(mom|mm|ms|me|man|mandoc)$/) +{ +$mom="-".$m; +} +else +{ +$mom=''; +} +} my $RT_SEP='@RT_SEP@'; $ENV{PATH}=$ENV{GROFF_BIN_PATH}.$RT_SEP.$ENV{PATH} if exists($ENV{GROFF_BIN_PATH}); @@ -68,11 +82,30 @@ while (my $c=shift) $preconv=$c; next; } -elsif ($c eq '-z' or $c eq '-Z') +elsif ($c eq '-Z') { - $dev=$c; + $zflg=$c; next; } +elsif ($c eq '-z') +{ + $zflg="$c -dPDF.EXPORT=1"; + next; +} +elsif ($c eq '--roff') +{ +$mom=''; +} +elsif ($c eq '--help') +{ + print "usage: pdfmom [--roff] [-Tpdf] [groff-option ...] [file ...]\n"; + print "usage: pdfmom [--roff] -Tps [pdfroff-option ...] [groff-option ...] [file ...]\n"; + print "usage: pdfmom {-v | --version}\n"; + print "usage: pdfmom --help\n"; + print "\nHandle forward references in PDF documents.\n" . + "See the pdfmom(1) manual page.\n"; + exit; +} elsif ($c eq '-v' or $c eq '--version') { print "GNU pdfmom (groff) version @VERSION@\n"; @@ -123,19 +156,22 @@ if ($readstdin) if ($dev eq 'pdf') { -system("groff -Tpdf -dLABEL.REFS=1 -mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf -dPDF.EXPORT=1 -dLABEL.REFS=1 -mom -z - $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf -mom $preconv - $cmdstring"); +if ($mom) +{ +system("groff -Tpdf -dLABEL.REFS=1 $mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf -dPDF.EXPORT=1 -dLABEL.REFS=1 $mom -z - $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf $mom $preconv - $cmdstring $zflg"); +} +else +{ +system("groff -Tpdf -dPDF.EXPORT=1 -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf $preconv - $cmdstring $zflg"); +} } elsif ($dev eq 'p
[groff] 03/05: Changes to satisfy bug #65231.
deri pushed a commit to branch master in repository groff. commit 3e5f09d1b3a9df072cd2a67b648925049a655e82 Author: Deri James AuthorDate: Tue Jan 30 17:14:08 2024 + Changes to satisfy bug #65231. Alter build of groff-man-pages.pdf to use the new pdfmom, so that all forward references (i.e. reference to groff_font(5) in addftinfo(1) page) are handled properly. Also pass bookmark names as text strings. * doc/doc.am: Use pdfmom. * tmac/an.tmac: Pass parameters to .pdfbookmark as a string. --- doc/doc.am | 8 +++- tmac/an.tmac | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/doc.am b/doc/doc.am index 76efe43b0..e9cac80cc 100644 --- a/doc/doc.am +++ b/doc/doc.am @@ -38,6 +38,11 @@ DOC_GROFF = \ GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \ $(GROFFBIN) -M $(doc_srcdir) $(MFLAG) $(FFLAG) -ww -b +DOC_PDFMOM = \ + GROFF_COMMAND_PREFIX= \ + GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \ + $(GROFF_BIN_PATH)/pdfmom -M $(doc_srcdir) $(MFLAG) $(FFLAG) -ww -b --roff + # This image file is used by several documents in the groff source tree. DOC_GNU_EPS = doc/gnu.eps @@ -263,8 +268,9 @@ man-clean: # feature of gropdf. doc/groff-man-pages.pdf: $(GROFF_MAN_PAGES_ALL) eqn pic tbl \ $(TMAC_PACKAGE_MAN) $(TMAC_PACKAGE_MDOC) font/devps/freeeuro.pfa - $(GROFF_V)$(DOC_GROFF) -pet -mandoc -dHF=HB -rC1 \ + $(GROFF_V)$(DOC_PDFMOM) -pet -mandoc -dHF=HB -rC1 \ -rCHECKSTYLE=3 -Tpdf -P-e \ + $(top_srcdir)/doc/GMPfront.t \ $(GROFF_MAN_PAGES1) \ $(tmac_srcdir)/sv.tmac $(GROFF_MAN_PAGES2) \ $(tmac_srcdir)/en.tmac $(GROFF_MAN_PAGES3) > $@ diff --git a/tmac/an.tmac b/tmac/an.tmac index dceed923b..20d96ff70 100644 --- a/tmac/an.tmac +++ b/tmac/an.tmac @@ -437,7 +437,7 @@ . ie \\n[cR] .pl +1v . el .sp (.5i - .5m) . if !\\n[an*was-TH-bookmark-emitted] \{\ -.an*bookmark 1 \E*[an*page-ref-string] +.an*bookmark 1 "\\*[an*page-ref-string]" .nr an*was-TH-bookmark-emitted 1 . \} . tl '\\*[an-pageref]'\\*[an-extra3]'\\*[an-pageref]' @@ -716,7 +716,7 @@ contains unsupported escape sequence . if \\n[.$] \{\ .ds an-section-heading \\$*\" .if \\n[CS] .stringup an-section-heading -.an*bookmark 2 \E*[an-section-heading] +.an*bookmark 2 "\\*[an-section-heading]" .nop \&\\*[an-section-heading] . \} . if \\n[an-remap-I-style-in-headings] .ftr I I @@ -742,7 +742,7 @@ contains unsupported escape sequence . if \\n[an-remap-I-style-in-headings] .ftr I \\*[an-heading-family]BI . if \\n[.$] \{\ .ds an*subsection-heading \\$*\" -.an*bookmark 3 \E*[an*subsection-heading] +.an*bookmark 3 "\\*[an*subsection-heading]" .nop \&\\$* . \} . if \\n[an-remap-I-style-in-headings] .ftr I I ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: .MT/.ME and .UR/.UE hyperlinking for pdf output
deri pushed a commit to branch master in repository groff. commit d71f9264f8c187aee1161f27cda7d42c4ad7065e Author: Deri James AuthorDate: Fri Jan 26 15:47:28 2024 + .MT/.ME and .UR/.UE hyperlinking for pdf output Our documentation groff_man.7 documents that these requests are for hyperlinks. The .pdfhref W command expects the hotspot text to be passed as a parameter, but these pairs of requests enclose the required text. To solve this conundrum if the given hyperlink text to the .pdfhref request is the single pipe character "|" then mark all following text sent for output as the hotspot, terminate the hotspot on receipt of \X'pdf: markend' escape. This new facility is only available using -T pdf, not using -T ps and the pdfmark macros. Note the advice in the gropdf man page to use \X'pdf: marksuspend' and \X'pdf: markrestart' to protect any headers and footers becoming part of the hotspot in case the hyperlinked text crosses a page boundary. * tmac/an.tmac: add code to use .pdfhref W for these hyperlinks and protect against crossing page boundaries. * tmac/pdf.tmac: if the given text for a hyperlink consists of a single pipe character "|", start the hotspot and only terminate when \X'pdf: markend' is received. --- ChangeLog | 23 +++ tmac/an.tmac | 12 +--- tmac/pdf.tmac | 9 ++--- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7c42add2e..19d9b6a80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2024-01-26 Deri James + + Our documentation groff_man.7 documents that these requests are + for hyperlinks. The .pdfhref W command expects the hotspot text + to be passed as a parameter, but these pairs of requests enclose + the required text. To solve this conundrum if the given + hyperlink text to the .pdfhref request is the single pipe + character "|" then mark all following text sent for output as + the hotspot, terminate the hotspot on receipt of \X'pdf: + markend' escape. This new facility is only available using -T + pdf, not using -T ps and the pdfmark macros. Note the advice in + the gropdf man page to use \X'pdf: marksuspend' and \X'pdf: + markrestart' to protect any headers and footers becoming part of + the hotspot in case the hyperlinked text crosses a page + boundary. + + * tmac/an.tmac: add code to use .pdfhref W for these hyperlinks + and protect against crossing page boundaries. + + * tmac/pdf.tmac: if the given text for a hyperlink consists of + a single pipe character "|", start the hotspot and only + terminate when \X'pdf: markend' is received. + 2024-01-25 G. Branden Robinson [troff]: Trivially refactor (trap Booleans). diff --git a/tmac/an.tmac b/tmac/an.tmac index a60eb888f..cfedbe28b 100644 --- a/tmac/an.tmac +++ b/tmac/an.tmac @@ -587,6 +587,7 @@ contains unsupported escape sequence . PT . ev . ns +. if '\\*[.T]'pdf' .pdfmarkrestart .. . .\" Schedule a page break when the next output line is written (not @@ -598,6 +599,7 @@ contains unsupported escape sequence .\" Prepare the footer for a page of the document. .de1 an-footer . if \\n[an-suppress-header-and-footer] .return +. if '\\*[.T]'pdf' .pdfmarksuspend . ev an*env-header-and-footer . ie \\n[cR] \ .ds an*ofoot "\\*[an-pageref]\" @@ -1106,6 +1108,7 @@ contains unsupported escape sequence . if (\\n[an*is-in-link-text-diversion] & \\n[an*do-hyperlink]) \{\ .\" Start diversion in a new environment. .ev an*link-text-env +.if \\n[an*is-output-pdf] \&\m[\\*[PDFHREF.TEXT.COLOUR]]\c .di an*link-text-div .ll (\\n[an*saved-line-length]u - \\n[an*saved-indentation]u) . \} @@ -1129,9 +1132,9 @@ contains unsupported escape sequence .ie \\n[dn] \{\ . if \\n[an*is-output-html] \ .nop \X^html:^\c -. if \\n[an*is-output-pdf] \ -.pdfhref W -D \\*[an*prefix]\\*[an*hyperlink] -- \ -\\*[an*hyperlink]\c +. if \\n[an*is-output-pdf] \{\ +.pdfhref W -D \\*[an*prefix]\\*[an*hyperlink] -- "|" +. \} . if \\n[an*is-output-terminal] \ .nop \X^tty: link \\*[an*prefix]\\*[an*hyperlink]^\c . \" Strip off the final newline of the diversion and emit it. @@ -1142,6 +1145,8 @@ contains unsupported escape sequence .nop \X^html:^\c . if \\n[an*is-output-terminal] \ .nop \X^tty: link^\c +. if \\n[an*is-output-pdf] \ +.nop \X'pdf: markend'\m[\\*[pdf:curcol]]\c .\} .\" If there was no link text, format URI as its own link text. We .\" don't add angle brackets here. @@ -1336,6 +1341,7 @@ contains unsupported escape sequence . .nr an*can-hyperlink 0 .if ( \n[an*is-output-html] \ + : \n[an*is
[groff] 01/01: Retain plain ascii labels when possible.
deri pushed a commit to branch master in repository groff. commit e62b188aacb0669bf45628796dd543992e440047 Author: Deri James AuthorDate: Sun Jan 14 13:57:30 2024 + Retain plain ascii labels when possible. * src/devices/gropdf/gropdf.pl: Do not use hexed label unless necessary. Restores the ability for some pdf viewers to accept "#label" as suffix to filename. --- src/devices/gropdf/gropdf.pl | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 870eca5e8..f0b04909a 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -2002,6 +2002,7 @@ sub Clean sub utf16 { my $p=Clean(shift); +my $label=shift; $p=~s/\\\[(.*?)\]/FindChr($1,0)/eg; $p=~s/\\C($parcln)/FindChr($1,1)/eg; @@ -2014,6 +2015,8 @@ sub utf16 unpack "C*", encode('utf16', $p); } +return($p) if $label; + $p=~s/(?https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 02/02: Misplaced TOC in mom.
deri pushed a commit to branch master in repository groff. commit d27c4644a098855051322a073a313fda165d4eaf Author: Deri James AuthorDate: Sun Jan 7 20:14:34 2024 + Misplaced TOC in mom. See https://lists.gnu.org/archive/html/groff/2024-01/msg00015.html * src/devices/gropdf/gropdf.pl: Remove incorrect line. --- src/devices/gropdf/gropdf.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 14b7b3312..79dde070a 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -1802,7 +1802,7 @@ sub do_x else { ($curoutlev,$curoutlevno,$thislev)=(@{$outlines[$pginsert]}); - $curoutlevno--; +# $curoutlevno--; } } } ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/02: Fix for including pdf v1.7 files.
deri pushed a commit to branch master in repository groff. commit 7c0358816253817a3594be6402c4b9b7e68db01d Author: Deri James AuthorDate: Sun Jan 7 19:51:35 2024 + Fix for including pdf v1.7 files. PDF 1.5 introduced object type ObjStm which can contain a bunch of objects in its own compressed stream, but there is a restriction that if an object has its own stream it cannot be included into the ObjStm (i.e. no stream within stream). Gropdf has supported this for some years, but it has come to light that some pdfs have a "skeleton" object which contains the stream and the rest of the object is held in the ObjStm stream. Also fix incorrect application of patch in bug #65112. * src/devices/gropdf/gropdf.pl: If a skeleton object exists at the top-level and in an ObjStm stream, the two objects should be merged. --- src/devices/gropdf/gropdf.pl | 57 +--- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 3f70a4263..14b7b3312 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -2413,6 +2413,7 @@ sub LoadPDF my (@pdfwds)=split(' ',$pdftxt); my $wd; my $root; +my @ObjStm; while ($wd=nextwd(\@pdfwds),length($wd)) { @@ -2424,24 +2425,7 @@ sub LoadPDF $pdf->[$curobj]->{OBJ}=ParsePDFObj(\@pdfwds); my $o=$pdf->[$curobj]; - if (ref($o->{OBJ}) eq 'HASH' and exists($o->{OBJ}->{Type}) and $o->{OBJ}->{Type} eq '/ObjStm') - { - LoadStream($o,$pdf); - my $pos=$o->{OBJ}->{First}; - my $s=$o->{STREAM}; - my @o=split(' ',substr($s,0,$pos)); - substr($s,0,$pos)=''; - push(@o,-1,length($s)); - - for (my $j=0; $j<=$#o-2; $j+=2) - { - my @w=split(' ',substr($s,$o[$j+1],$o[$j+3]-$o[$j+1])); - $pdf->[$o[$j]]->{OBJ}=ParsePDFObj(\@w); - } - - $pdf->[$curobj]=undef; - } - +push(@ObjStm,$curobj) if (ref($o->{OBJ}) eq 'HASH' and exists($o->{OBJ}->{Type}) and $o->{OBJ}->{Type} eq '/ObjStm'); $root=$curobj if ref($pdf->[$curobj]->{OBJ}) eq 'HASH' and exists($pdf->[$curobj]->{OBJ}->{Type}) and $pdf->[$curobj]->{OBJ}->{Type} eq '/XRef'; } elsif ($wd eq 'trailer' and !exists($pdf->[0]->{OBJ})) @@ -2454,6 +2438,25 @@ sub LoadPDF } } +foreach my $ObjStm (@ObjStm) +{ +LoadStream($pdf->[$ObjStm],$pdf); +my $pos=$pdf->[$ObjStm]->{OBJ}->{First}; +my $s=$pdf->[$ObjStm]->{STREAM}; +$s=~s/\%.*?$//m; +my @o=split(' ',substr($s,0,$pos)); +substr($s,0,$pos)=''; +push(@o,-1,length($s)); + +for (my $j=0; $j<=$#o-2; $j+=2) +{ +my @w=split(' ',substr($s,$o[$j+1],$o[$j+3]-$o[$j+1])); + $pdf->[$o[$j]]->{OBJ}=ObjMerge($pdf->[$o[$j]]->{OBJ},ParsePDFObj(\@w)); +} + +$pdf->[$ObjStm]=undef; +} + $pdf->[0]=$pdf->[$root] if !defined($pdf->[0]); my $catalog=${$pdf->[0]->{OBJ}->{Root}}; my $page=FindPage(1,$pdf); @@ -2530,6 +2533,22 @@ sub LoadPDF return([$xonm,$BBox] ); } +sub ObjMerge +{ +my $o1=shift; +my $o2=shift; + +return $o1 if !defined($o2); +return $o2 if !defined($o1); + +foreach my $k (keys %{$o2}) +{ +$o1->{$k}=$o2->{$k}; +} + +return $o1; +} + sub LoadStream { my $o=shift; @@ -4736,7 +4755,7 @@ sub subs_call { $c[$#c-4]->[0]=MarkSub("#$c[$#c-4]->[0]") if ($c[$#c-4]->[1]); } - elsif ($n2==16) # seac + elsif ($n2==6) # seac { my $ch=$StdEnc{$c[$#c-2]->[0]}; my $chf; ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Bug #65092 rounded corners in hdtbl's color_boxes
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 2e6d61716710aaca2fff9bf37747a455afff22a5 Author: Deri James AuthorDate: Fri Dec 29 23:28:11 2023 + Bug #65092 rounded corners in hdtbl's color_boxes The \X'ps: exec ...' for setlinejoin and setlinecap (which hdtbl.tmac emits as one command) is documented as separate commands in gropdf.1. * src/devices/gropdf/gropdf.pl: Allow both setlinecap and setlinejoin to be combined in 1 command. Thanks to Bjarni Ingi Gislason for the report. --- src/devices/gropdf/gropdf.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index e96a2059e..e26bc6b43 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -1382,13 +1382,13 @@ sub do_x $stream.="Q\n"; $InPicRotate=0; } -elsif ($par=~m/exec (\d) setlinejoin/) +elsif ($par=~m/exec.*? (\d) setlinejoin/) { IsGraphic(); $linejoin=$1; $stream.="$linejoin j\n"; } -elsif ($par=~m/exec (\d) setlinecap/) +if ($par=~m/exec.*? (\d) setlinecap/) { IsGraphic(); $linecap=$1; ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/03: pdfmarksuspend & pdfmarkresume only if -Tpdf
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 7ac813810503f0a012767b38db0b769adeab03a0 Author: Deri James AuthorDate: Thu Nov 23 00:04:54 2023 + pdfmarksuspend & pdfmarkresume only if -Tpdf tmac/an.tmac: Fix for non pdf man use!! --- tmac/an.tmac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tmac/an.tmac b/tmac/an.tmac index d66294873..e8655c0b5 100644 --- a/tmac/an.tmac +++ b/tmac/an.tmac @@ -602,7 +602,7 @@ contains unsupported escape sequence . PT . ev . ns -. pdfmarkrestart +. if '\\*[.T]'pdf' .pdfmarkrestart .. . .\" Schedule a page break when the next output line is written (not @@ -614,7 +614,7 @@ contains unsupported escape sequence .\" Prepare the footer for a page of the document. .de1 an-footer . if \\n[an-suppress-header-and-footer] .return -. pdfmarksuspend +. if '\\*[.T]'pdf' .pdfmarksuspend . ev an*env-header-and-footer . ie \\n[cR] \ .ds an*ofoot "\\*[an-pageref]\" ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 02/03: Problem processing concatenated dit files (-Z)
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit aa1e2c70eba3fe7adb6cbddbf74764abc21578d1 Author: Deri James AuthorDate: Fri Nov 24 16:02:00 2023 + Problem processing concatenated dit files (-Z) Normally it is safe to pass concatenated dit files to gropdf, typically this would be a separate source file which produces a custom cover and a different source for the body (different macro set?). Problem occurs if one of the dits uses the same fontno for a different font. Normally troff allocates TR to #5, but if one of the dits has been run with the flag "U-T" then U-TR is allocated to #5. * src/devices/gropdf/gropdf.pl: Check if "x font # name" has the same number AND name as a previously registered font, otherwise reload the font. --- src/devices/gropdf/gropdf.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 27a0964f0..45e35d931 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -3140,7 +3140,7 @@ sub LoadFont my $fontnm=shift; my $ofontnm=$fontnm; -return $fontlst{$fontno}->{OBJ} if (exists($fontlst{$fontno})); +return $fontlst{$fontno}->{OBJ} if (exists($fontlst{$fontno}) and $fontnm eq $fontlst{$fontno}->{FNT}->{name}) ; my $f; OpenFile(\$f,$fontdir,"$fontnm"); ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 03/03: Fix arc drawing when flag -l used.
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 5989eda83e6cc399988756ba163ad4c2ad1fc9d9 Author: Deri James AuthorDate: Sun Dec 10 20:05:43 2023 + Fix arc drawing when flag -l used. * src/devices/gropdf/gropdf.pl: When landscape flag (-l) is given coordinates for arcs need rotation. --- src/devices/gropdf/gropdf.pl | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 45e35d931..e96a2059e 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -3980,7 +3980,14 @@ sub PlotArcSegment my @mat=($cos,$sin,-$sin,$cos,0,0); my $lw=$lwidth/$r; -$stream.="q $r 0 0 $r $transx $transy cm ".join(' ',@mat)." cm $lw w $x0 $y0 m $x1 $y1 $x2 $y2 $x3 $y3 c S Q\n"; +if ($frot) +{ + $stream.="q $r 0 0 $r $transy $transx cm ".join(' ',@mat)." cm $lw w $y0 $x0 m $y1 $x1 $y2 $x2 $y3 $x3 c S Q\n"; +} +else +{ + $stream.="q $r 0 0 $r $transx $transy cm ".join(' ',@mat)." cm $lw w $x0 $y0 m $x1 $y1 $x2 $y2 $x3 $y3 c S Q\n"; +} } sub DrawCircle ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 04/05: Enable more hyperlinks in groff-man-pages.pdf
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit a2e72beef12ccc05a933493cfc3a9d6d9dde61c2 Author: Deri James AuthorDate: Wed Sep 6 22:44:57 2023 +0100 Enable more hyperlinks in groff-man-pages.pdf --- doc/doc.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/doc.am b/doc/doc.am index f6e40bff3..c139452c1 100644 --- a/doc/doc.am +++ b/doc/doc.am @@ -262,7 +262,7 @@ man-clean: doc/groff-man-pages.pdf: $(GROFF_MAN_PAGES_ALL) eqn pic tbl \ $(TMAC_PACKAGE_MAN) $(TMAC_PACKAGE_MDOC) font/devps/freeeuro.pfa $(GROFF_V)$(DOC_PDFMOM) -pet -mandoc -manmark -dHF=HB -rC1 \ - -rCHECKSTYLE=3 -rIN=7.2n -Tpdf -P-e \ + -rCHECKSTYLE=3 -rU=1 -rIN=7.2n -Tpdf -P-e \ $(top_srcdir)/doc/GMPfront.t \ $(GROFF_MAN_PAGES1) \ $(tmac_srcdir)/sv.tmac $(GROFF_MAN_PAGES2) \ ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/05: Add missing 'tmac' flag
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 2b3f346ce6ff2e195903cbfb00df66307c65f35a Author: Deri James AuthorDate: Fri Sep 1 12:03:52 2023 +0100 Add missing 'tmac' flag Allows gropdf to know this papersize change came from -dpaper= --- tmac/papersize.tmac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmac/papersize.tmac b/tmac/papersize.tmac index 57d763a9f..ffba019f1 100644 --- a/tmac/papersize.tmac +++ b/tmac/papersize.tmac @@ -144,7 +144,7 @@ . ie '\*[paper-l]'' \{\ .pl \*[paper-\*[paper-p]-length] .ll (\*[paper-\*[paper-p]-width] - 2i) -.if '\*[.T]'pdf' .device papersize=\*[paper-\*[paper-p]-width],\*[paper-\*[paper-p]-length] +.if '\*[.T]'pdf' .device papersize=\*[paper-\*[paper-p]-width],\*[paper-\*[paper-p]-length] tmac . \} . el \ .nr paper-w 1 ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 02/05: Fixes for .pdfpagenumbering and .pdfswitchtopage
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit f685c65f2639219103e2c6d15b5f1e4d93344507 Author: Deri James AuthorDate: Fri Sep 1 12:07:23 2023 +0100 Fixes for .pdfpagenumbering and .pdfswitchtopage --- src/devices/gropdf/gropdf.pl | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 52e0953d4..2d7b6feda 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -348,7 +348,7 @@ my $mark=undef; my $suspendmark=undef; my $boxmax=0; my %missing;# fonts in download files which are not found/readable - +my @PageLabel; # PageLabels my $n_flg=1; @@ -862,11 +862,9 @@ foreach my $j (0..$#{$pages->{Kids}}) { my $pg=GetObj($pages->{Kids}->[$j]); -if (exists($pg->{PageLabel})) +if (defined($PageLabel[$j])) { - -push(@{$cat->{PageLabels}->{Nums}},$j,$pg->{PageLabel}); -delete($pg->{PageLabel}); +push(@{$cat->{PageLabels}->{Nums}},$j,$PageLabel[$j]); } } @@ -1808,6 +1806,7 @@ sub do_x else { ($curoutlev,$curoutlevno,$thislev)=(@{$outlines[$pginsert]}); +$curoutlevno--; } } } @@ -1925,14 +1924,14 @@ sub do_x { $S=substr($xprm[2],0,1) if $xprm[2]; $P=$xprm[3]; -$St=$xprm[4] if $xprm[4]; +$St=$xprm[4] if length($xprm[4]); -if (!defined($S) and !defined($P)) +if (!defined($S) and !length($P)) { $P=' '; } -if ($St and $St!~m/^\d+$/) +if ($St and $St!~m/^-?\d+$/) { Warn("Page numbering start '$St' must be numeric"); return; @@ -1942,10 +1941,11 @@ sub do_x my $label={}; $label->{S} = "/$S" if $S; -$label->{P} = "($P)" if $P; -$label->{St} = $St if $St; +$label->{P} = "($P)" if length($P); +$label->{St} = $St if length($St); -$cpage->{PageLabel}=$label; +$#PageLabel=$pginsert if $pginsert > $#PageLabel; +splice(@PageLabel,$pginsert,0,$label); } } @@ -3413,11 +3413,11 @@ sub do_p { my $trans='BLOCK'; -$trans='PAGE' if $firstpause; -NewPage($trans); -@XOstream=(); -@PageAnnots=(); -$firstpause=1; +$trans='PAGE' if $firstpause; +NewPage($trans); +@XOstream=(); +@PageAnnots=(); +$firstpause=1; } sub FixTrans ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 03/05: Add pdf support for man UR/UE MT/ME
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 766d4f280f501e8f01d64837f050bd3dfa2af900 Author: Deri James AuthorDate: Wed Sep 6 22:35:23 2023 +0100 Add pdf support for man UR/UE MT/ME G Branden request in bug #64576 --- tmac/an.tmac | 11 +++ tmac/pdf.tmac | 6 -- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tmac/an.tmac b/tmac/an.tmac index 6c6ed6de1..d66294873 100644 --- a/tmac/an.tmac +++ b/tmac/an.tmac @@ -602,6 +602,7 @@ contains unsupported escape sequence . PT . ev . ns +. pdfmarkrestart .. . .\" Schedule a page break when the next output line is written (not @@ -613,6 +614,7 @@ contains unsupported escape sequence .\" Prepare the footer for a page of the document. .de1 an-footer . if \\n[an-suppress-header-and-footer] .return +. pdfmarksuspend . ev an*env-header-and-footer . ie \\n[cR] \ .ds an*ofoot "\\*[an-pageref]\" @@ -1084,6 +1086,7 @@ contains unsupported escape sequence . if (\\n[an*is-in-link-text-diversion] & \\n[an*do-hyperlink]) \{\ .\" Start diversion in a new environment. .ev an*link-text-env +.if \\n[an*is-output-pdf] \&\m[\\*[PDFHREF.TEXT.COLOUR]]\c .di an*link-text-div .ll (\\n[an*saved-line-length]u - \\n[an*saved-indentation]u) . \} @@ -1107,6 +1110,9 @@ contains unsupported escape sequence .ie \\n[dn] \{\ . if \\n[an*is-output-html] \ .nop \X^html:^\c +. if \\n[an*is-output-pdf] \{\ +.pdfhref W -D \\*[an*prefix]\\*[an*hyperlink] -- "|" +. \} . if \\n[an*is-output-terminal] \ .nop \X^tty: link \\*[an*prefix]\\*[an*hyperlink]^\c . \" Strip off the final newline of the diversion and emit it. @@ -1117,6 +1123,8 @@ contains unsupported escape sequence .nop \X^html:^\c . if \\n[an*is-output-terminal] \ .nop \X^tty: link^\c +. if \\n[an*is-output-pdf] \ +.nop \X'pdf: markend'\m[\\*[pdf:curcol]]\c .\} .\" If there was no link text, format URI as its own link text. We .\" don't add angle brackets here. @@ -1124,6 +1132,9 @@ contains unsupported escape sequence . if \\n[an*is-output-html] \ .nop \X^html:\ \\*[an*hyperlink]^\c +. if \\n[an*is-output-pdf] \ +.pdfhref W -D \\*[an*prefix]\\*[an*hyperlink] -- \ +\\*[an*hyperlink] . if \\n[an*is-output-terminal] \ .nop \X^tty: link \\*[an*prefix]\\*[an*hyperlink]^\ \\*[an*hyperlink]\X^tty: link^\c diff --git a/tmac/pdf.tmac b/tmac/pdf.tmac index 1c4c8866a..f300d612d 100644 --- a/tmac/pdf.tmac +++ b/tmac/pdf.tmac @@ -716,6 +716,7 @@ am solely responsible for any bugs I may have introduced into this file. .\" And now, we have no further use for "pdf*href.link". .\" .rm pdf*href.link +.nr pdf:href.pipe 0 .\" .\" If the user specified any "link prefix" text, (using the "-P text" .\" option), then emit it BEFORE processing the "link text" itself. @@ -751,9 +752,10 @@ am solely responsible for any bugs I may have introduced into this file. \#. if dPDFHREF.COLOUR .defcolor pdf:href.colour rgb \\*[PDFHREF.COLOUR] . ds pdf:curcol \\n[.m] . nr pdf:bm.width \\w'\\*[PDFHREF.DESC]' +. if '\\*[PDFHREF.DESC]'|' .nr pdf:href.pipe 1 . nop \&\m[\\*[PDFHREF.TEXT.COLOUR]]\c . device pdf: markstart \\n[rst] \\n[rsb] \\n[PDFHREF.LEADING] \\*[pdf:href.link] -. nop \&\\*[PDFHREF.DESC]\X'pdf: markend'\m[\\*[pdf:curcol]]\c +. if !\\n[pdf:href.pipe] .nop \&\\*[PDFHREF.DESC]\X'pdf: markend'\m[\\*[pdf:curcol]]\c . \" . \" Clean up the temporary registers and strings, used to . \" compute the "hot-spot" bounds, and format the reference, @@ -770,7 +772,7 @@ am solely responsible for any bugs I may have introduced into this file. .\" And then, if the user specified any affixed text, (using the .\" "-A text" option), we tack it on at the end. .\" -.nop \&\\*[pdf:href-A] +.if !\\n[pdf:href.pipe] .nop \&\\*[pdf:href-A] .. .\" Macro "pdf*href-I" is used for one time initialisation of special .\" "pdfhref" features; (currently, only the above page trap hook is ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 05/05: Fixup and start on text decorations.
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit a2b5541142a1571e9f9f5a8321c1e21c721469aa Author: Deri James AuthorDate: Wed Sep 6 22:48:27 2023 +0100 Fixup and start on text decorations. --- src/devices/gropdf/gropdf.1.man | 7 --- src/devices/gropdf/gropdf.pl| 6 -- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/devices/gropdf/gropdf.1.man b/src/devices/gropdf/gropdf.1.man index 23a9dd7dd..cc80367bc 100644 --- a/src/devices/gropdf/gropdf.1.man +++ b/src/devices/gropdf/gropdf.1.man @@ -393,8 +393,9 @@ is the foundry name or blank for the default foundry. is the PostScript name of the font, and .I filename -is the name of the file containing the font; -lines beginning with +is the name of the file containing the font. +It can also contain a pathname to the font. +Any lines beginning with .B # and blank lines are ignored; fields must be separated by tabs @@ -405,7 +406,7 @@ allowed); is searched for using the same mechanism that is used for .I groff -font metric files. +font metric files, unless a path is also present. . The .I download diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 2d7b6feda..27a0964f0 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -35,6 +35,8 @@ use constant MINOR => 3, MAJOR => 4, UNICODE => 5, +RST => 6, +RSB => 7, CHR => 0, XPOS=> 1, @@ -3204,7 +3206,7 @@ sub LoadFont $r[0]='u0020' if $r[3] == 32; $r[0]="u00".hex($r[3]) if $r[0] eq '---'; $r[4]=$r[0] if !defined($r[4]); -$fnt{NAM}->{$r[0]}=[$p[0],$r[3],'/'.$r[4],undef,undef,$r[5]]; + $fnt{NAM}->{$r[0]}=[$p[0],$r[3],'/'.$r[4],undef,undef,$r[5],$p[1]||0,$p[2]||0]; $fnt{NO}->[$r[3]]=$r[0]; $lastnm=$r[0]; $lastchr=$r[3] if $r[3] > $lastchr; @@ -3232,7 +3234,7 @@ sub LoadFont $fnt{ascent}=$ascent; $fnt{capheight}=$capheight; $fnt{lastchr}=$lastchr; -$fnt{NAM}->{''}=[0,-1,'/.notdef',-1,0]; +$fnt{NAM}->{''}=[0,-1,'/.notdef',-1,0,0,0]; $slant=-$fnt{'slant'} if exists($fnt{'slant'}); $fnt{slant}=$slant; $fnt{nospace}=(!defined($fnt{NAM}->{u0020}->[PSNAME]) or $fnt{NAM}->{u0020}->[PSNAME] ne '/space' or !exists($fnt{'spacewidth'}))?1:0; ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 04/05: Improve usefulness of -z in pdfmom.
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit e478a7be9d24389267ede70df5d522c54acadaa0 Author: Deri James AuthorDate: Mon Aug 28 15:38:51 2023 +0100 Improve usefulness of -z in pdfmom. Now shows output of PDF.EXPORT=1 as well. --- src/devices/gropdf/pdfmom.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/gropdf/pdfmom.pl b/src/devices/gropdf/pdfmom.pl index 689f8da55..1c24d85b9 100644 --- a/src/devices/gropdf/pdfmom.pl +++ b/src/devices/gropdf/pdfmom.pl @@ -89,7 +89,7 @@ while (my $c=shift) } elsif ($c eq '-z') { - $dev=$c; + $zflg="$c -dPDF.EXPORT=1"; next; } elsif ($c eq '--roff') ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 02/05: Start of coping with groff nodes in -D and -N
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 579e9464256c4b62e060cc7f110e1212bbffb8ea Author: Deri James AuthorDate: Mon Aug 28 15:05:02 2023 +0100 Start of coping with groff nodes in -D and -N --- contrib/mom/om.tmac | 12 +++--- tmac/pdf.tmac | 115 +++- 2 files changed, 85 insertions(+), 42 deletions(-) diff --git a/contrib/mom/om.tmac b/contrib/mom/om.tmac index adb7508ce..f5c6637ef 100644 --- a/contrib/mom/om.tmac +++ b/contrib/mom/om.tmac @@ -4918,7 +4918,7 @@ y\R'#DESCENDER \\n[.cdp]' .ds $AUTHOR \\*[$AUTHOR_1] .substring $AUTHORS 0 -2 .ds PDF_AUTHORS \\*[$AUTHORS] -.pdfmomclean PDF_AUTHORS +.if '\\*[.T]'ps' .pdfmomclean PDF_AUTHORS .nop \!x X ps:exec [/Author (\\*[PDF_AUTHORS]) /DOCINFO pdfmark .END . @@ -23452,13 +23452,13 @@ No room to start \\*[MN-pos] margin note #\\n[MN-curr] on page \\n[#P]. . el .nr LEVEL_REQ \\n[CURRENT_LEVEL] . \} . ds PDF_TX \\$* -. pdfmomclean PDF_TX . nr PDF_LEV (\\n[LEVEL_REQ]*\\n[#PDF_BOOKMARKS_OPEN]) . ie '\\*[.T]'ps' \{\ . if !'\\*[PDF_NM]'' \{\ . pdfhref M -N \\*[PDF_NM2] -- \\*[PDF_TX] . if !dpdf:href.map .tm gropdf-info:href \\*[PDF_NM2] \\*[PDF_TX] . \} +. pdfmomclean PDF_TX . pdfbookmark \\n[PDF_LEV] \\*[PDF_TX] . \} . el .pdfbookmark \\*[PDF_NM] \\n[PDF_LEV] \\$* @@ -23479,7 +23479,7 @@ No room to start \\*[MN-pos] margin note #\\n[MN-curr] on page \\n[#P]. \# .MAC PDF_TITLE END .ds pdftitle \\$* -.pdfmomclean pdftitle +.if '\\*[.T]'ps' .pdfmomclean pdftitle .nop \!x X ps:exec [/Title (\\*[pdftitle]) /DOCINFO pdfmark .END \# @@ -23552,8 +23552,10 @@ No room to start \\*[MN-pos] margin note #\\n[MN-curr] on page \\n[#P]. .if '\\*[PDF_AST]'*' \{\ .chop PDF_TXT .ie '\\*[.T]'pdf' \{\ -. ie d pdf:look(\\*[PDF_NM]) \ -. as PDF_TXT \&\\*[PDF_AST_Q]\\*[pdf:look(\\*[PDF_NM])]\\*[PDF_AST_Q] +. ds PDF_NM_HEX \\*[PDF_NM] +. stringhex PDF_NM_HEX +. ie d pdf:look(\\*[PDF_NM_HEX]) \ +. as PDF_TXT \&\\*[PDF_AST_Q]\\*[pdf:look(\\*[PDF_NM_HEX])]\\*[PDF_AST_Q] . el \{\ . as PDF_TXT Unknown . if !rPDF_UNKNOWN .tm \ diff --git a/tmac/pdf.tmac b/tmac/pdf.tmac index 90c6b191e..ddfa5d4eb 100644 --- a/tmac/pdf.tmac +++ b/tmac/pdf.tmac @@ -37,6 +37,7 @@ am solely responsible for any bugs I may have introduced into this file. . .char \[lh] \X'pdf: xrev'\[rh]\X'pdf: xrev' .nr pdf:bm.nl 1 +.gcolor black \" Until bug #64592 is addressed .de pdfmark . nop \!x X ps:exec [\\$* pdfmark .. @@ -182,6 +183,7 @@ am solely responsible for any bugs I may have introduced into this file. . \" then parse any specified options, to set a "tag", if required . \" . ds pdf:href-T +. ds pdf:hrefhex-T . while dpdf:href.opt\\$1 \{\ . pdf:href.opt\\$1 \\$@ . shift \\n[pdf:href.argc] @@ -214,28 +216,35 @@ am solely responsible for any bugs I may have introduced into this file. . \" ( which we return in the string "PDFBOOKMARK.NAME" ), . \" . nr pdf:bm.nr +1 -. ie '\\*[pdf:href-T]'' .ds PDFBOOKMARK.NAME pdf:bm\\n[pdf:bm.nr] -. el .ds PDFBOOKMARK.NAME \\*[pdf:href-T] +. ie '\\*[pdf:hrefhex-T]'' \{\ +. ds PDFBOOKMARK.NAME pdf:bm\\n[pdf:bm.nr] +. ds PDFBOOKMARK.NAME.HEX \\*[PDFBOOKMARK.NAME] +. stringhex PDFBOOKMARK.NAME.HEX +. \} +. el \{\ +. ds PDFBOOKMARK.NAME \\*[pdf:href-T] +. ds PDFBOOKMARK.NAME.HEX \\*[pdf:hrefhex-T] +. \} . pdf:href.sety -. ds pdf:cleaned \\$* -. ev pdfcln -. tr \[em]- -. nf -. box pdf:clean -. nop \\$* -. fl -. box -. chop pdf:clean -. asciify pdf:clean -. length pdf:clean:len \\*[pdf:clean] -. ds pdf:cleaned \\*[pdf:clean] -. rm pdf:clean -. ev -. tr \[em]\[em] -. ds pdf:look(\\*[PDFBOOKMARK.NAME]) \\*[pdf:cleaned] -. if dPDF.EXPORT .tm .ds pdf:look(\\*[PDFBOOKMARK.NAME]) \\*[pdf:cleaned] -. pdfmark /Dest /\\*[PDFBOOKMARK.NAME] /View [\\*[PDFBOOKMARK.VIEW]] /DEST -. nop \!x X ps:exec [/Dest /\\*[PDFBOOKMARK.NAME] /Title (\\$*) /Level \\n[pdf:bm.lev] /OUT pdfmark +.\" . ds pdf:cleaned \\$* +.\" . ev pdfcln +.\" . tr \[em]- +.\" . nf +.\" . box pdf:clean +.\" . nop \\$* +.\" . fl +.\" . box +.\" . chop pdf:clean +.\" . asciify pdf:clean +.\" . length pdf:clean:len \\*[pdf:clean] +.\" . ds pdf:cleaned \\*[pdf:clean] +.\" . rm pdf:clean +.\" . ev +.\" . tr
[groff] 05/05: Hardening of pdf:href.opt\\$1 processing
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit ec75f38cecd673c7959092d2c97bc4721ea0f4fa Author: Deri James AuthorDate: Mon Aug 28 18:25:08 2023 +0100 Hardening of pdf:href.opt\\$1 processing an.tmac sync changes to pdf.tmac --- tmac/an.tmac | 4 +++- tmac/pdf.tmac | 45 - 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/tmac/an.tmac b/tmac/an.tmac index 897b8bc27..6c6ed6de1 100644 --- a/tmac/an.tmac +++ b/tmac/an.tmac @@ -1192,7 +1192,9 @@ contains unsupported escape sequence . I \\$1 .el \{\ . an*cln an*page-ref-nm \\$1_\\$2 -. ie d pdf:look(\\*[an*page-ref-nm]) .pdfhref L -D \\*[an*page-ref-nm] -A "\\$3" -- \fI\\$1\fP(\\$2) +. ds an*page-ref-nm-hex \\*[an*page-ref-nm] +. stringhex an*page-ref-nm-hex +. ie d pdf:look(\\*[an*page-ref-nm-hex]) .pdfhref L -D \\*[an*page-ref-nm] -A "\\$3" -- \fI\\$1\fP(\\$2) . el .IR \\$1 (\\$2)\\$3 .\} . \} diff --git a/tmac/pdf.tmac b/tmac/pdf.tmac index ddfa5d4eb..1c4c8866a 100644 --- a/tmac/pdf.tmac +++ b/tmac/pdf.tmac @@ -184,10 +184,22 @@ am solely responsible for any bugs I may have introduced into this file. . \" . ds pdf:href-T . ds pdf:hrefhex-T -. while dpdf:href.opt\\$1 \{\ -. pdf:href.opt\\$1 \\$@ -. shift \\n[pdf:href.argc] +. length pdf:l \\$1 +. ds pdf:char1 \\$1 +. substring pdf:char1 0 0 +. if !'\\*[pdf:char1]'-' .nr pdf:l 99 +. while (\\n[pdf:l]<4) \{\ +. ie dpdf:href.opt\\$1 \{\ +.pdf:href.opt\\$1 \\$@ +.shift \\n[pdf:href.argc] +.length pdf:l \\$1 +.if '\\$1'--' .break +.ds pdf:char1 \\$1 +.substring pdf:char1 0 0 +.if !'\\*[pdf:char1]'-' .nr pdf:l 99 . \} +. el .break +. \} . rr pdf:href.argc . \" . \" If we found "--" to mark the end of the options, discard it @@ -558,12 +570,18 @@ am solely responsible for any bugs I may have introduced into this file. .\" the "descriptive text" component of the argument list). .\" .length pdf:l \\$1 +.ds pdf:char1 \\$1 +.substring pdf:char1 0 0 +.if !'\\*[pdf:char1]'-' .nr pdf:l 99 .while (\\n[pdf:l]<4) \{\ . ie dpdf:href.opt\\$1 \{\ . pdf:href.opt\\$1 \\$@ . shift \\n[pdf:href.argc] . length pdf:l \\$1 . if '\\$1'--' .break +. ds pdf:char1 \\$1 +. substring pdf:char1 0 0 +. if !'\\*[pdf:char1]'-' .nr pdf:l 99 . \} . el .break .\} @@ -656,13 +674,22 @@ am solely responsible for any bugs I may have introduced into this file. .\" options -- anything which is not recognised is assumed to start .\" the "link text" component of the argument list). .\" -.length l \\$1 -.if \\n[l]<3 \{\ -.while dpdf:href.opt\\$1 \{\ -. pdf:href.opt\\$1 \\$@ -. shift \\n[pdf:href.argc] +.length pdf:l \\$1 +.ds pdf:char1 \\$1 +.substring pdf:char1 0 0 +.if !'\\*[pdf:char1]'-' .nr pdf:l 99 +.while (\\n[pdf:l]<4) \{\ +. ie dpdf:href.opt\\$1 \{\ +. pdf:href.opt\\$1 \\$@ +. shift \\n[pdf:href.argc] +. length pdf:l \\$1 +. if '\\.$1'--' .break +. ds pdf:char1 \\$1 +. substring pdf:char1 0 0 +. if !'\\*[pdf:char1]'-' .nr pdf:l 99 . \} -\} +. el .break +.\} .\" .\" If we found "--", to mark the end of the options, then we should .\" discard it. ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 03/05: Allow utf8 in web links, allows IDN links.
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit fddc79906cc8f9eba71fc17ff985a90275bdca90 Author: Deri James AuthorDate: Mon Aug 28 15:17:53 2023 +0100 Allow utf8 in web links, allows IDN links. Fix for 'pdfhref-whack.groff' in #64576 --- src/devices/gropdf/gropdf.pl | 41 ++--- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 37f13d20d..52e0953d4 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -1499,6 +1499,7 @@ sub do_x FixRect($annot->{DATA}->{Rect}); # Y origin to ll FixPDFColour($annot->{DATA}); $annot->{DATA}->{Dest}=UTFName($annot->{DATA}->{Dest}) if exists($annot->{DATA}->{Dest}); + $annot->{DATA}->{A}->{URI}=URIName($annot->{DATA}->{A}->{URI}) if exists($annot->{DATA}->{A}->{URI}); push(@PageAnnots,$annotno); } elsif ($pdfmark=~m/(.+) \/OUT\s*$/) @@ -1966,7 +1967,20 @@ sub do_x } } -sub utf16 +sub URIName +{ +my $s=shift; + +$s=Clean($s); +$s=~s/\\\[u((?i)D[89AB]\p{AHex}{2})\] # High surrogate in range 0xD800–0xDBFF + \\\[u((?i)D[CDEF]\p{AHex}{2})\] # Low surrogate in range 0xDC00–0xDFFF + /chr( ((hex($1) - 0xD800) * 0x400) + (hex($2) - 0xDC00) + 0x1 )/xge; +$s=~s/\\\[u(\p{AHex}{4})]/chr hex $1/ge; + +return(join '', map {(m/[-\w.~_]/)?chr($_):'%'.sprintf("%02X", $_)} unpack "C*", encode('utf8',$s)); +} + +sub Clean { my $p=shift; @@ -1986,6 +2000,13 @@ sub utf16 $p=~s/\\\((\w\w)/\\\[$1\]/g;# convert \(xx to \[xx] +return $p; +} + +sub utf16 +{ +my $p=Clean(shift); + $p=~s/\\\[(.*?)\]/FindChr($1,0)/eg; $p=~s/\\C($parcln)/FindChr($1,1)/eg; # $p=~s/\\\((..)/FindChr($1)/eg; @@ -2111,6 +2132,7 @@ sub PutHotSpot FixPDFColour($annot->{DATA}); FixRect($annot->{DATA}->{Rect}); # Y origin to ll $annot->{DATA}->{Dest}=UTFName($annot->{DATA}->{Dest}) if exists($annot->{DATA}->{Dest}); +$annot->{DATA}->{A}->{URI}=URIName($annot->{DATA}->{A}->{URI}) if exists($annot->{DATA}->{A}); push(@PageAnnots,$annotno); } @@ -2696,16 +2718,21 @@ sub nextwd if ($wd=~m/^(.*?)(<<|>>|(?:(?https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/02: Display time from SOURCE_DATE_EPOCH in UTC.
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 0dabf3779a36d37872386feb0ad10d38418488f1 Author: Colin Watson AuthorDate: Sun Jul 9 02:04:58 2023 +0100 Display time from SOURCE_DATE_EPOCH in UTC. The semantics imposed in 1.23.0 are unsuitable for use with reproducible-builds harnesses, since those specifically want to vary the TZ environment variable to shake out other problems in build systems. However, my patch that Debian has been carrying for a while is unsuitable for general use, since most people expect the time displayed in output to use local time. A viable compromise seems to be to force UTC _only_ when SOURCE_DATE_EPOCH is set. That will keep reproducible-builds harnesses working with no extra effort, while also preserving the expected behaviour for typical users of groff that don't go out of their way to set that environment variable. As a bonus, this corrects the behaviour of gropdf when the local offset from UTC is not a whole number of hours. * src/include/curtime.h (current_time): Return a `struct tm *`. Document behaviour. * src/libs/libgroff/curtime.cpp (current_time): If SOURCE_DATE_EPOCH is set, return the overridden time after passing it through `gmtime`. Otherwise, pass the current time through `localtime`. * src/devices/grohtml/post-html.cpp (html_printer::do_file_components, html_printer::~html_printer): * src/devices/grops/ps.cpp (ps_printer::~ps_printer): * src/roff/troff/input.cpp (init_registers): Adjust to new `current_time` signature. * src/devices/gropdf/gropdf.pl: If SOURCE_DATE_EPOCH is set, return the overridden time after passing it through `gmtime`. Otherwise, pass the current time through `localtime`. (PDFDate): Fix output in the case where the local offset from UTC is not a whole number of hours. (Previously, the minutes offset field was always set to zero.) * src/devices/grohtml/grohtml.1.man (Environment): * src/devices/gropdf/gropdf.1.man (Environment): * src/devices/grops/grops.1.man (Environment): * src/roff/groff/groff.1.man (Environment): * src/roff/troff/troff.1.man (Environment): Update. * NEWS: Document this. Signed-off-by: Deri James --- NEWS | 17 + src/devices/grohtml/grohtml.1.man | 12 +++- src/devices/grohtml/post-html.cpp | 16 src/devices/gropdf/gropdf.1.man | 10 +- src/devices/gropdf/gropdf.pl | 16 ++-- src/devices/grops/grops.1.man | 12 +++- src/devices/grops/ps.cpp | 9 ++--- src/include/curtime.h | 19 +++ src/libs/libgroff/curtime.cpp | 23 +-- src/roff/groff/groff.1.man| 12 +++- src/roff/troff/input.cpp | 24 +--- src/roff/troff/troff.1.man| 12 +++- 12 files changed, 103 insertions(+), 79 deletions(-) diff --git a/NEWS b/NEWS index 85b034be3..6b8e0cd36 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,23 @@ This file describes recent user-visible changes in groff. Bug fixes are not described. There are more details in the man and info pages. +VERSION 1.23.1 +== + +Miscellaneous +- + +o If groff programs have their current time overridden by the SOURCE_DATE_EPOCH + environment variable, then that time is always displayed in UTC. That + environment variable is normally only set when specifically requesting build + systems to produce reproducible output, and it is useful for reproducibility + test harnesses to vary the TZ environment variable and ensure that it does + not affect the output of the build; those harnesses have no way to set TZ=UTC + only for groff programs. People setting SOURCE_DATE_EPOCH are likely to be + more in the "system programmer" camp as described in the release notes for + 1.23.0, so it is easier to defend time-zone-invariant output to them. In all + other cases, the current time remains displayed in local time. + VERSION 1.23.0 == diff --git a/src/devices/grohtml/grohtml.1.man b/src/devices/grohtml/grohtml.1.man index 2243b474c..8a55c93dd 100644 --- a/src/devices/grohtml/grohtml.1.man +++ b/src/devices/grohtml/grohtml.1.man @@ -616,18 +616,20 @@ A timestamp to use as the output creation timestamp in place of the current time. . The time is converted to human-readable form using -.MR ctime 3 +.MR gmtime 3 +and +.MR asctime 3 , and recorded in an HTML comment. . . .TP .I TZ -The time zone to use when converting the current time -(or value of -.IR SOURCE_DATE_EPOCH ) -to human-readable form; +The time zone to use when converting the current time to human-readable form; see .MR tzset 3 . +If +.I SOURCE_DATE_EPOCH +is used, it is always converted to human-readable form
[groff] 02/02: Add reference to pdfmom(1) in --help.
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit a53f539ad6fb12077f819b3f141047762e039cfb Author: Deri James AuthorDate: Wed Jul 12 18:09:39 2023 +0100 Add reference to pdfmom(1) in --help. --- src/devices/gropdf/pdfmom.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/devices/gropdf/pdfmom.pl b/src/devices/gropdf/pdfmom.pl index a8ad2ea24..689f8da55 100644 --- a/src/devices/gropdf/pdfmom.pl +++ b/src/devices/gropdf/pdfmom.pl @@ -102,6 +102,8 @@ while (my $c=shift) print "usage: pdfmom [--roff] -Tps [pdfroff-option ...] [groff-option ...] [file ...]\n"; print "usage: pdfmom {-v | --version}\n"; print "usage: pdfmom --help\n"; + print "\nHandle forward references in PDF documents.\n" . + "See the pdfmom(1) manual page.\n"; exit; } elsif ($c eq '-v' or $c eq '--version') ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 05/14: Make pdfmom more useful.
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 626e2d6802b759af40b91d03ce2e0b8791fecc81 Author: Deri James AuthorDate: Tue Apr 25 17:05:13 2023 +0100 Make pdfmom more useful. --- src/devices/gropdf/pdfmom.1.man | 33 src/devices/gropdf/pdfmom.pl| 42 - 2 files changed, 66 insertions(+), 9 deletions(-) diff --git a/src/devices/gropdf/pdfmom.1.man b/src/devices/gropdf/pdfmom.1.man index 08d789c54..cea77b557 100644 --- a/src/devices/gropdf/pdfmom.1.man +++ b/src/devices/gropdf/pdfmom.1.man @@ -10,7 +10,7 @@ macro package for .\" Legal Terms .\" .\" -.\" Copyright (C) 2012-2020 Free Software Foundation, Inc. +.\" Copyright (C) 2012-2023 Free Software Foundation, Inc. .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are @@ -53,16 +53,18 @@ macro package for .\" . .SY pdfmom +.RB [ \-\-roff ] .RB [ \-Tpdf ] -.RI [ groff-options ] +.RI [ groff-option\~ .\|.\|.\&] .RI [ file\~ .\|.\|.] .YS . . .SY pdfmom +.RB [ \-\-roff ] .B \-Tps -.RI [ pdfroff-options ] -.RI [ groff-options ] +.RI [ pdfroff-option\~ .\|.\|.\&] +.RI [ groff-option\~ .\|.\|.\&] .RI [ file\~ .\|.\|.] .YS . @@ -89,6 +91,25 @@ macros. . . .P +If the +.B \-\-roff +option is used, +the wrapper can be used with macro packages other than +.MR groff_mom @MAN7EXT@ . +. +This is also true if the wrapper is renamed or linked as a +pseudonym; +for example, +creating a +.I pdfms +link pointing to the +.I pdfmom +executable makes a wrapper for producing PDFs with the +.I ms +package. +. +. +.P .I pdfmom prints to the standard output, so output must usually be redirected to a destination file. @@ -173,6 +194,10 @@ options, .I pdfmom displays its version information and exits. . +Using the +.B \-\-help +option displays a usage message and exits. +. . .\" .SH Authors diff --git a/src/devices/gropdf/pdfmom.pl b/src/devices/gropdf/pdfmom.pl index 89977d496..74591e2bb 100644 --- a/src/devices/gropdf/pdfmom.pl +++ b/src/devices/gropdf/pdfmom.pl @@ -1,6 +1,6 @@ #!@PERL@ # -# pdfmom : Frontend to run groff -mom to produce PDFs +# pdfmom : Frontend to run groff to produce PDFs # Deri James : Friday 16 Mar 2012 # @@ -29,6 +29,19 @@ my @cmd; my $dev='pdf'; my $preconv=''; my $readstdin=1; +my $mom='-mom'; +if ($0=~m/pdf(\w+)$/) +{ +my $m=$1; +if ($m=~m/^(mom|mm|ms|me|man|mandoc)$/) +{ +$mom="-".$m; +} +else +{ +$mom=''; +} +} my $RT_SEP='@RT_SEP@'; $ENV{PATH}=$ENV{GROFF_BIN_PATH}.$RT_SEP.$ENV{PATH} if exists($ENV{GROFF_BIN_PATH}); @@ -73,6 +86,18 @@ while (my $c=shift) $dev=$c; next; } +elsif ($c eq '--roff') +{ +$mom=''; +} +elsif ($c eq '--help') +{ + print "usage: pdfmom [--roff] [-Tpdf] [groff-option ...] [file ...]\n"; + print "usage: pdfmom [--roff] -Tps [pdfroff-option ...] [groff-option ...] [file ...]\n"; + print "usage: pdfmom {-v | --version}\n"; + print "usage: pdfmom --help\n"; + exit; +} elsif ($c eq '-v' or $c eq '--version') { print "GNU pdfmom (groff) version @VERSION@\n"; @@ -123,19 +148,26 @@ if ($readstdin) if ($dev eq 'pdf') { -system("groff -Tpdf -dLABEL.REFS=1 -mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf -dPDF.EXPORT=1 -dLABEL.REFS=1 -mom -z - $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf -mom $preconv - $cmdstring"); +if ($mom) +{ +system("groff -Tpdf -dLABEL.REFS=1 $mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf -dPDF.EXPORT=1 -dLABEL.REFS=1 $mom -z - $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf $mom $preconv - $cmdstring"); +} +else +{ +system("groff -Tpdf -dPDF.EXPORT=1 -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf $preconv - $cmdstring"); +} } elsif ($dev eq 'ps') { -system("groff -Tpdf -dLABEL.REFS=1 -mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | pdfroff -mpdfmark -mom --no-toc - $preconv $cmdstring"); +system("groff -Tpdf -dLABEL.REFS=1 $mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | pdfroff -mpdfmark $mom --no-toc - $preconv $cmdstring"); } elsif ($dev eq '-z') # pseudo dev - just compile for warnings { -system("groff -Tpdf -mom -z $cmdstring"); +system("groff -Tpdf $mom -z $cmdstring"); } elsif ($dev eq '-Z')
[groff] 11/14: New gropdf is PDF1.7 compatible.
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit bbf5b0009ad1610e1da390ee6b17c22da373f4c7 Author: Deri James AuthorDate: Mon May 29 16:20:05 2023 +0100 New gropdf is PDF1.7 compatible. --- src/devices/gropdf/gropdf.pl | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index e3078f8f1..b2eee2b4d 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -452,7 +452,7 @@ my $version=0; my $stats=0; my $unicodemap; my $options=7; -my $PDFver=1.5; +my $PDFver=1.7; my @idirs; my $alloc=-1; @@ -507,10 +507,10 @@ if (defined($unicodemap)) } } -if ($PDFver != 1.4 and $PDFver != 1.5) +if ($PDFver != 1.4 and $PDFver != 1.7) { -Warn("Only pdf versions 1.4 or 1.5 are supported, not '$PDFver'"); -$PDFver=1.5; +Warn("Only pdf versions 1.4 or 1.7 are supported, not '$PDFver'"); +$PDFver=1.7; } $PDFver=int($PDFver*10)-10; @@ -881,7 +881,7 @@ foreach my $o (3..$objct) { if (!exists($obj[$o]->{XREF})) { - if ($PDFver==5 and !exists($obj[$o]->{STREAM}) and ref($obj[$o]->{DATA}) eq 'HASH') + if ($PDFver!=4 and !exists($obj[$o]->{STREAM}) and ref($obj[$o]->{DATA}) eq 'HASH') { # This can be put into an ObjStm my $maj=int(++$objidx/128); ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 07/14: Pass paper dimensions to output drivers (pdf, dvi)
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 4a2cc772df5bc9af9d2eff72ab1d56910531c8a7 Author: Deri James AuthorDate: Wed May 10 16:10:07 2023 +0100 Pass paper dimensions to output drivers (pdf, dvi) pdf only, and can be oerridden by -p and -l on cmdline Comment out change for dvi device --- tmac/papersize.tmac | 14 ++ 1 file changed, 14 insertions(+) diff --git a/tmac/papersize.tmac b/tmac/papersize.tmac index 6d5ad14c2..57d763a9f 100644 --- a/tmac/papersize.tmac +++ b/tmac/papersize.tmac @@ -123,14 +123,28 @@ . nr paper-w 0 . . ie d paper-\*[paper-p]-length \{\ +.\" .if '\*[.T]'dvi' \{\ +.\" . ds paper-last \*[paper-\*[paper-p]-width] +.\" . substring paper-last -1 +.\" . ie '\*[paper-last]'c' \{\ +.\" . as paper-\*[paper-p]-width m +.\" . as paper-\*[paper-p]-length m +.\" . \} +.\" . el \{\ +.\" . as paper-\*[paper-p]-width n +.\" . as paper-\*[paper-p]-length n +.\" . \} +.\" .\} .ie '\*[paper-l]'l' \{\ . pl \*[paper-\*[paper-p]-width] . ll (\*[paper-\*[paper-p]-length] - 2i) +. if '\*[.T]'pdf' .device papersize=\*[paper-\*[paper-p]-length],\*[paper-\*[paper-p]-width] tmac .\} .el \{\ . ie '\*[paper-l]'' \{\ .pl \*[paper-\*[paper-p]-length] .ll (\*[paper-\*[paper-p]-width] - 2i) +.if '\*[.T]'pdf' .device papersize=\*[paper-\*[paper-p]-width],\*[paper-\*[paper-p]-length] . \} . el \ .nr paper-w 1 ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 09/14: The -Z flag to pdfmom now produce .Z file with forward references.
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 3e5d5ef7c7dafceebbfd1d8107636c53bf1f Author: Deri James AuthorDate: Mon May 29 16:04:56 2023 +0100 The -Z flag to pdfmom now produce .Z file with forward references. --- src/devices/gropdf/pdfmom.pl | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/devices/gropdf/pdfmom.pl b/src/devices/gropdf/pdfmom.pl index 74591e2bb..a8ad2ea24 100644 --- a/src/devices/gropdf/pdfmom.pl +++ b/src/devices/gropdf/pdfmom.pl @@ -30,6 +30,7 @@ my $dev='pdf'; my $preconv=''; my $readstdin=1; my $mom='-mom'; +my $zflg=''; if ($0=~m/pdf(\w+)$/) { my $m=$1; @@ -81,7 +82,12 @@ while (my $c=shift) $preconv=$c; next; } -elsif ($c eq '-z' or $c eq '-Z') +elsif ($c eq '-Z') +{ + $zflg=$c; + next; +} +elsif ($c eq '-z') { $dev=$c; next; @@ -150,11 +156,11 @@ if ($dev eq 'pdf') { if ($mom) { -system("groff -Tpdf -dLABEL.REFS=1 $mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf -dPDF.EXPORT=1 -dLABEL.REFS=1 $mom -z - $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf $mom $preconv - $cmdstring"); +system("groff -Tpdf -dLABEL.REFS=1 $mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf -dPDF.EXPORT=1 -dLABEL.REFS=1 $mom -z - $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf $mom $preconv - $cmdstring $zflg"); } else { -system("groff -Tpdf -dPDF.EXPORT=1 -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf $preconv - $cmdstring"); +system("groff -Tpdf -dPDF.EXPORT=1 -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf $preconv - $cmdstring $zflg"); } } elsif ($dev eq 'ps') @@ -165,10 +171,6 @@ elsif ($dev eq '-z') # pseudo dev - just compile for warnings { system("groff -Tpdf $mom -z $cmdstring"); } -elsif ($dev eq '-Z') # pseudo dev - produce troff output -{ -system("groff -Tpdf $mom -Z $cmdstring"); -} else { print STDERR "Not compatible with device '-T $dev'\n"; ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 12/14: Replace pseudo slanted characters
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 5a143514e2f361e87f6187c834a61dd73df7012a Author: Deri James AuthorDate: Mon Jul 3 15:44:29 2023 +0100 Replace pseudo slanted characters * font/devpdf/DESC.in: * font/devpdf/SS: * font/devpdf/StandardSymSL.pfb: * tmac/pdf.tmac: Preparation for replacing the pseudo slanted lowercase greek characters (used in equations) with real glyphs, i.e. provide a Symbol-Slanted pfb font for gropdf. At the moment it requires the following intervention to make it work with test-groff:- Copy files SS and StandardSymSL.pfb to the build directory. Add the following line to the download file:- Symbol-Slanted ./StandardSymSL.pfb. This needs to be added to the devpdf.am makefile so that it happens during make, and ensure the two new files are copied to the install directory and are cleaned and uninstalled appropriately. The macro pdf:tmac which created the pseudo slanted glyphs previously has been removed. Without the intervention, it may appear that all is working when test-groff is run (looking a pdf of groff_char(7) the lower greek characters may be slanted, but if you look at the fonts used you will see that the slanted symbol font has been substituted by some italic font from the system), and also there will be problems when groff is run from its install directory. So don't cherry-pick this commit until the makefile has been suitably amended. --- font/devpdf/DESC.in | 2 +- font/devpdf/SS| 50 ++ font/devpdf/StandardSymSL.pfb | Bin 0 -> 14534 bytes tmac/pdf.tmac | 31 -- 4 files changed, 51 insertions(+), 32 deletions(-) diff --git a/font/devpdf/DESC.in b/font/devpdf/DESC.in index 5cb254f37..ba90d26ee 100644 --- a/font/devpdf/DESC.in +++ b/font/devpdf/DESC.in @@ -6,6 +6,6 @@ unitwidth 1000 sizes 1000-1000 0 styles R I B BI family T -fonts 8 0 0 0 0 0 0 S ZD +fonts 8 0 0 0 0 0 SS S ZD tcommand postpro gropdf diff --git a/font/devpdf/SS b/font/devpdf/SS new file mode 100644 index 0..a61fa8b7a --- /dev/null +++ b/font/devpdf/SS @@ -0,0 +1,50 @@ +# This file has been generated with GNU afmtodit (groff) version 1.20.1 +# +# FullName Symbol Slanted +# Version 001.008 +# FamilyName Symbol +# +# The original AFM file contains the following comments: +# +# Notice Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All rights reserved. +# Comment Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All rights reserved. +# Comment Creation Date: Thu May 1 15:12:25 1997 +# Comment UniqueID 43064 +# Comment VMusage 30820 39997 + +name SS +internalname Symbol-Slanted +special +slant 15.5 +spacewidth 223 + +charset +space 223 0 32 space ++h 562,614,16,133,-58,99 3 74 theta1 +ts 391,445,208,151,-28,99 3 86 sigma1 +*a 562,445,16,145,-34,99 3 97 alpha +*b 489,659,198,139,58,99 3 98 beta +*x 489,445,206,134,98,99 3 99 chi +*d 440,658,17,181,-32,99 3 100 delta +*e 391,447,17,127,1,99 3 101 epsilon +*f 464,599,199,106,-28,99 3 102 phi +*g 366,444,200,252,-42,99 3 103 gamma +*y 537,457,180,68,-50,68 3 104 eta +*i 293,448,15,53,-47,533 105 iota ++f 537,444,199,117,-42,99 3 106 phi1 +*k 489,446,0,182,-56,993 107 kappa +*l 489,658,15,91,29,91 3 108 lambda +*m 513,445,198,70,68,703 109 mu +*n 464,451,14,134,-69,99 3 110 nu +*o 489,444,17,86,-36,863 111 omicron +*p 489,433,17,161,-8,993 112 pi +*h 464,614,15,140,-53,99 3 113 theta +*r 489,444,205,82,69,823 114 rho +*s 537,445,19,175,-37,99 3 115 sigma +*t 391,445,17,170,-45,99 3 116 tau +*u 513,451,16,95,-55,953 117 upsilon ++p 635,519,16,173,-28,99 3 118 omega1 +*w 611,445,15,126,-35,99 3 119 omega +*c 439,681,200,126,-20,99 3 120 xi +*q 611,445,203,198,-91,99 3 121 psi +*z 440,673,200,190,-50,99 3 122 zeta diff --git a/font/devpdf/StandardSymSL.pfb b/font/devpdf/StandardSymSL.pfb new file mode 100644 index 0..94efbab40 Binary files /dev/null and b/font/devpdf/StandardSymSL.pfb differ diff --git a/tmac/pdf.tmac b/tmac/pdf.tmac index f30c76f3e..90c6b191e 100644 --- a/tmac/pdf.tmac +++ b/tmac/pdf.tmac @@ -35,37 +35,6 @@ am solely responsible for any bugs I may have introduced into this file. . .mso ps.tmac . -.de pdf:SS -. fchar \\$1 \\S'16'\\$1\\S'0' -.. -.pdf:SS \[+h] -.pdf:SS \[ts] -.pdf:SS \[*a] -.pdf
[groff] 03/14: Add and document new macro .pdfpagenumbering
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 004f6fca2d437320270a9a93d9fe9af319f63ca4 Author: Deri James AuthorDate: Sun Apr 16 13:12:17 2023 +0100 Add and document new macro .pdfpagenumbering Allows control of the presentation of page number in the outline panel, i.e. Decimal/Roman/roman/Alpha/alpha plus an optional string prefix. --- src/devices/gropdf/gropdf.1.man | 62 +++-- tmac/pdf.tmac | 7 + 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/src/devices/gropdf/gropdf.1.man b/src/devices/gropdf/gropdf.1.man index d1d39bbe0..d28f87863 100644 --- a/src/devices/gropdf/gropdf.1.man +++ b/src/devices/gropdf/gropdf.1.man @@ -352,9 +352,7 @@ in the PostScript font. .LP Note that .I gropdf -is currently only able to display the first 256 glyphs in any font. -This restriction will be lifted in a later version. -. +Can now access all the glyphs available in a font. . .\" .LP .\" Note that @@ -1339,6 +1337,64 @@ see .MR groff_tmac @MAN5EXT@ . .RE . +.TP +.BI "\[rs]X\[aq]pdf: pagenumbering\~" "type prefix start" \[aq] +This is used to control the page numbering shown in the pdf reader\[aq]s +outline pane which contains your bookmarks. Normally the page numbers +shown against the bookmark is the physical page number in the file, But +this may not match the different page number styles within the document. +.RS +.LP +In a single document there may be a cover sheet (which has no page +number), a TOC (which uses lower case roman numbers), and the main body +of the document (which has decimal page numbers). Use this command +somewhere on the page where the numbering system changes, once changed +the numbers will automatically increment until the number system changes +again, so don\[aq]t call for every page, just when you want to change +the numbering. +.LP +The parameters are:- +.TP +.I type +This specifies the type of numbering to use for this page onward. It +should be one of +.RB \[lq] "Decimal | Roman | roman | Alpha | alpha" \[rq]. +Only the initial letter is relevant. The alphabetic number systems use +A-Z (then AA-AZ ... ZA-ZZ). +The +.I type +may also be +.RB \[lq] . \[rq] +which means no numbering system is chosen, but you may still provide a +.I prefix +to have a custom name (such as "Cover"); +.TP +.I prefix +Provides a string to insert before the number. +If the document has an Appendix with page numbers in the form +.RI A- n , +the +.I prefix +would be set to \[lq]A-\[rq] and the +.I type +would be +.BR Decimal . +. +. +.TP +.I start +Gives the start number for the incrementing page numbers in the outline +pane. If no value is given for +.I start +it will default to 1, which is usually correct. +.LP +The convenience macro for this command is \[lq] +.BI ".pdfpagenumbering " "type prefix start" +\[rq] using '.' for preceding missing values, or just \[lq] +.BR .pdfpagenumbering \[rq] +on its own to have no page numbers shown in the outline pane. +.RE +. . .\" .SS Macros diff --git a/tmac/pdf.tmac b/tmac/pdf.tmac index 6a2fa7bba..68d5557e0 100644 --- a/tmac/pdf.tmac +++ b/tmac/pdf.tmac @@ -824,6 +824,13 @@ am solely responsible for any bugs I may have introduced into this file. .device pdf: background \\$* .. . +.de pdfpagenumbering +.\" 1=type of [D=decimal,R=Roman,r=roman,A=Uppercase,a=lowercase] +.\" 2=prefix label +.\" 3=start number +.device pdf: pagenumbering \\$* +.. +. .cp \n[*groff_pdf_tmac_C] .do rr *groff_pdf_tmac_C . ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 10/14: Adjust page numbering and margins of groff-man-pages.pdf
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 496ccd2f1f6016b694a779b3fb8b99ee63f657cf Author: Deri James AuthorDate: Mon May 29 16:11:13 2023 +0100 Adjust page numbering and margins of groff-man-pages.pdf --- doc/GMPfront.t | 3 ++- doc/doc.am | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/GMPfront.t b/doc/GMPfront.t index 13d6e334b..fd14511a5 100644 --- a/doc/GMPfront.t +++ b/doc/GMPfront.t @@ -20,5 +20,6 @@ \f[BMB]THE MAN PAGES BOOK\fP .sp .2i .Hl +.pn 1 .bp -.pdfpagenumbering D . 2 +.pdfpagenumbering D . 1 diff --git a/doc/doc.am b/doc/doc.am index 736fdeb0c..f6e40bff3 100644 --- a/doc/doc.am +++ b/doc/doc.am @@ -262,7 +262,7 @@ man-clean: doc/groff-man-pages.pdf: $(GROFF_MAN_PAGES_ALL) eqn pic tbl \ $(TMAC_PACKAGE_MAN) $(TMAC_PACKAGE_MDOC) font/devps/freeeuro.pfa $(GROFF_V)$(DOC_PDFMOM) -pet -mandoc -manmark -dHF=HB -rC1 \ - -rCHECKSTYLE=3 -Tpdf -P-e \ + -rCHECKSTYLE=3 -rIN=7.2n -Tpdf -P-e \ $(top_srcdir)/doc/GMPfront.t \ $(GROFF_MAN_PAGES1) \ $(tmac_srcdir)/sv.tmac $(GROFF_MAN_PAGES2) \ ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 02/14: Add slim spaces between text '[]'
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit ad718db0c730a2885d6ed3927848ec677a718d59 Author: Deri James AuthorDate: Sun Apr 16 13:03:50 2023 +0100 Add slim spaces between text '[]' * contrib/sboxes/msboxes.ms.in: In pdf '[]' looks like a single character. --- contrib/sboxes/msboxes.ms.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/sboxes/msboxes.ms.in b/contrib/sboxes/msboxes.ms.in index a1700dfbf..8b509572c 100644 --- a/contrib/sboxes/msboxes.ms.in +++ b/contrib/sboxes/msboxes.ms.in @@ -81,12 +81,12 @@ Including .Qq fill in the command will paint the rectangle with the current fill colour (as with -.Lt \[rs]M[] ) +.Lt \[rs]M[\|] ) and including .Qq box will give the rectangle a border in the current stroke colour (as with -.Lt \[rs]m[] ). +.Lt \[rs]m[\|] ). .sp \n[PD]u .I cmd may also be ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 13/14: Final cleanup of the new gropdf.
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 122a761833b8a957a911a9890fdcb87e0ff14e3d Author: Deri James AuthorDate: Mon Jul 3 16:01:15 2023 +0100 Final cleanup of the new gropdf. * src/devices/devpdf/gropdf.pl: Deal with problem if fontforge adds two glyphs with the same postscript name (use the first), this is allowed in ttf fonts, which are keyed on glyph index, but not in type 1 fonts which are keyed on the glyph name. --- src/devices/gropdf/gropdf.pl | 49 +--- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index b2eee2b4d..db682525f 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -238,12 +238,12 @@ else . " this PDF"); } -# mkdir $ENV{HOME}."/_Inline" if exists($ENV{HOME}) and !-e $ENV{HOME}."/_Inline"; +mkdir $ENV{HOME}.'/_Inline' if !-e $ENV{HOME}.'/_Inline' and !exists($ENV{PERL_INLINE_DIRECTORY}) and exists($ENV{HOME}); $rc = eval { require Inline; -Inline->import (C => Config => DIRECTORY => $ENV{HOME}.'/_Inline'); +Inline->import (C => Config => DIRECTORY => $ENV{HOME}.'/_Inline') if !exists($ENV{PERL_INLINE_DIRECTORY}) and exists($ENV{HOME}); Inline->import (C =><<'EOC'); static const uint32_t MAGIC1 = 52845; @@ -1433,7 +1433,7 @@ sub do_x { my $pdfmark=$1; $pdfmark=~s((\d{4,6}) u)(sprintf("%.1f",$1/$desc{sizescale}))eg; -# $pdfmark=~s(\\\[u00(..)\])(chr(hex($1)))eg; +$pdfmark=~s(\\\[u00(..)\])(chr(hex($1)))eg; $pdfmark=~s/\\n/\n/g; if ($pdfmark=~m/(.+) \/DOCINFO\s*$/s) @@ -1460,6 +1460,7 @@ sub do_x { my @xwds=split(' ',"<< $1 >>"); my $dest=ParsePDFValue(\@xwds); + $dest->{Dest}=UTFName($dest->{Dest}); $dest->{View}->[1]=GraphY($dest->{View}->[1]*-1); unshift(@{$dest->{View}},"$cpageno 0 R"); @@ -1485,6 +1486,7 @@ sub do_x $annot->{DATA}->{Type}='/Annot'; FixRect($annot->{DATA}->{Rect}); # Y origin to ll FixPDFColour($annot->{DATA}); + $annot->{DATA}->{Dest}=UTFName($annot->{DATA}->{Dest}) if exists($annot->{DATA}->{Dest}); push(@PageAnnots,$annotno); } elsif ($pdfmark=~m/(.+) \/OUT\s*$/) @@ -1498,6 +1500,7 @@ sub do_x my @xwds=split(' ',"<< $pre$title$post >>"); my $out=ParsePDFValue(\@xwds); + $out->{Dest}=UTFName($out->{Dest}); my $this=[$out,[]]; @@ -1979,7 +1982,7 @@ sub utf16 if ($p =~ /[^[:ascii:]]/) { $p = join '', map sprintf("\\%o", $_), -unpack "C*", encode("utf16", $p); +unpack "C*", encode('utf16', $p); } $p=~s/(?{DATA}->{Rect}=[$mark->{xpos},$mark->{ypos}-$mark->{rsb},$endx+$mark->{lead},$mark->{ypos}-$mark->{rst}]; FixPDFColour($annot->{DATA}); FixRect($annot->{DATA}->{Rect}); # Y origin to ll +$annot->{DATA}->{Dest}=UTFName($annot->{DATA}->{Dest}) if exists($annot->{DATA}->{Dest}); push(@PageAnnots,$annotno); } @@ -2737,7 +2758,7 @@ sub ParsePDFHash $wd=$w[0]; unshift(@{$pdfwds},"<$w[1]") if defined($w[1]); -$rtn->{$wd}=ParsePDFValue($pdfwds); +$rtn->{$wd}=(substr($pdfwds->[0],0,1) eq '/')?nextwd($pdfwds,1):ParsePDFValue($pdfwds); } } @@ -4522,6 +4543,7 @@ sub map_subrs { $sec{'#CharStrings'}=$j; $stage=2; + $i=0; } elsif ($lin=~m/^\s*dup\s+(\d+)\s+(\d+)\s+RD (.*)/s) { @@ -4571,7 +4593,7 @@ sub map_subrs my $l=$2; my $s=$3; -$sec{"/$n"}=[$j,{}],$i=$j if !exists($sec{"/$n"}); +$sec{"/$n"}=[$j,{}] if !exists($sec{"/$n"}); if (length($s) > $l) { @@ -4581,10 +4603,23 @@ sub map_subrs { $lin.=$term.$lines->[++$j]; $lines->[$j]=undef; + $i--; redo; } -$lines->[$i]=["/$n",$l,$s,'ND']; +$i+=$j; + +if ($sec{"/$n"}->[0] != $i) + { + # duplicate glyph name !!! discard ??? +
[groff] 14/14: Speculative additional request .stringhex.
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit a2b2d5526dca59e93d46019fa8625e6f4c5484d5 Author: Deri James AuthorDate: Mon Jul 3 16:37:17 2023 +0100 Speculative additional request .stringhex. * src/roff/troff/input.cpp: Based on .stringup/down converts the contents of named string register to a hex string, two hex characters for each byte. In some situations you want to protect a string from being interpreted for its special characters (i.e. unicode), this achieves that. --- src/roff/troff/input.cpp | 39 +++ 1 file changed, 39 insertions(+) diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index 292ee7389..0c90a7451 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -4752,8 +4752,46 @@ void chop_macro() } enum case_xform_mode { STRING_UPCASE, STRING_DOWNCASE }; +const char * hex = "0123456789ABCDEF"; // Case-transform each byte of the string argument's contents. +void stringhex_request() +{ + symbol s = get_name(true /* required */); + if (s.is_null()) { +skip_line(); +return; + } + request_or_macro *p = lookup_request(s); + macro *m = p->to_macro(); + if (!m) { +error("cannot apply stringhex to a request ('%1')", + s.contents()); +skip_line(); +return; + } + string_iterator iter1(*m); + macro *mac = new macro; + int len = m->macro::length(); + for (int l = 0; l < len; l++) { +int nc, c = iter1.get(0); +if (c == PUSH_GROFF_MODE + || c == PUSH_COMP_MODE + || c == POP_GROFFCOMP_MODE) + mac->append(c); +else if (c == EOF) + break; +else { + nc = (int)hex[(c >> 4) & 0x0f]; + mac->append(nc); + nc = (int)hex[c & 0x0f]; + mac->append(nc); +} + } + request_dictionary.define(s, mac); + tok.next(); +} + void do_string_case_transform(case_xform_mode mode) { assert((mode == STRING_DOWNCASE) || (mode == STRING_UPCASE)); @@ -8435,6 +8473,7 @@ void init_input_requests() init_request("soquiet", source_quietly); init_request("spreadwarn", spreadwarn_request); init_request("stringdown", stringdown_request); + init_request("stringhex", stringhex_request); init_request("stringup", stringup_request); init_request("substring", substring_request); init_request("sy", system_request); ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 06/14: Fully linked groff-man-pages.pdf
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 0c0aea4503eb692c5c0dc64c163cb260ae24fe9a Author: Deri James AuthorDate: Wed May 3 17:06:01 2023 +0100 Fully linked groff-man-pages.pdf --- doc/GMPfront.t | 24 doc/doc.am | 8 +++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/doc/GMPfront.t b/doc/GMPfront.t new file mode 100644 index 0..13d6e334b --- /dev/null +++ b/doc/GMPfront.t @@ -0,0 +1,24 @@ +.ig + front.t +.. +.de Hl +.br +\l'\\n[.l]u-\\n[.i]u\&\\$1' +.br +.. +\Z@\D't 8p'@ +.pdfbookmark 1 Cover +.pdfpagenumbering +.sp 2i +.Hl +.sp .6i +.ad r +.ps 52 +\m[maroon]Groff\m[] +.sp 18p +.ps 16 +\f[BMB]THE MAN PAGES BOOK\fP +.sp .2i +.Hl +.bp +.pdfpagenumbering D . 2 diff --git a/doc/doc.am b/doc/doc.am index cddc51907..736fdeb0c 100644 --- a/doc/doc.am +++ b/doc/doc.am @@ -38,6 +38,11 @@ DOC_GROFF = \ GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \ $(GROFFBIN) -M $(doc_srcdir) $(MFLAG) $(FFLAG) -ww -b +DOC_PDFMOM = \ + GROFF_COMMAND_PREFIX= \ + GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \ + $(GROFF_BIN_PATH)/pdfmom -M $(doc_srcdir) $(MFLAG) $(FFLAG) -ww -b --roff + # This image file is used by several documents in the groff source tree. DOC_GNU_EPS = doc/gnu.eps @@ -256,8 +261,9 @@ man-clean: # feature of gropdf. doc/groff-man-pages.pdf: $(GROFF_MAN_PAGES_ALL) eqn pic tbl \ $(TMAC_PACKAGE_MAN) $(TMAC_PACKAGE_MDOC) font/devps/freeeuro.pfa - $(GROFF_V)$(DOC_GROFF) -pet -mandoc -dHF=HB -rC1 \ + $(GROFF_V)$(DOC_PDFMOM) -pet -mandoc -manmark -dHF=HB -rC1 \ -rCHECKSTYLE=3 -Tpdf -P-e \ + $(top_srcdir)/doc/GMPfront.t \ $(GROFF_MAN_PAGES1) \ $(tmac_srcdir)/sv.tmac $(GROFF_MAN_PAGES2) \ $(tmac_srcdir)/en.tmac $(GROFF_MAN_PAGES3) > $@ ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/14: Changes for groff-man-pages creation.
deri pushed a commit to branch deri-gropdf-ng in repository groff. commit 87f597262635ee274a77d3b22e6de8ea024df8ce Author: Deri James AuthorDate: Fri Apr 14 00:07:47 2023 +0100 Changes for groff-man-pages creation. --- tmac/an.tmac | 71 ++-- tmac/anmark.tmac | 3 +++ 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/tmac/an.tmac b/tmac/an.tmac index 9e38ba569..33c5ab156 100644 --- a/tmac/an.tmac +++ b/tmac/an.tmac @@ -203,9 +203,25 @@ . ds an*section9 Kernel Developer's Manual\" .. . +.de an*cln +. ds \\$1 +. als an*cln:res \\$1 +. shift +. ds an*cln:res \\$*\" +. ds an*cln:chr \\$* +. substring an*cln:chr 0 0 +. if '\\*[an*cln:chr]'\%' \{\ +.substring an*cln:res 1 +. \} +.. +. .\" Write a bookmark/anchor/link target $2 at hierarchical depth $1. .de an*bookmark -. if \\n[an*is-output-pdf] .pdfbookmark \\$1 \\$2 +. if \\n[an*is-output-pdf] \{\ +.if (\\n[.$]>2) .an*cln an*page-ref-nm \\$3\" +.ie (\\$1=1) .pdfbookmark -T "\\*[an*page-ref-nm]" \\$1 \\$2 +.el .pdfbookmark \\$1 \\$2 +. \} .. . .\" Begin man page. @@ -420,7 +436,7 @@ . ie \\n[cR] .pl +1v . el .sp .5i . if !\\n[an*was-TH-bookmark-emitted] \{\ -.an*bookmark 1 \E*[an*page-ref-string] +.an*bookmark 1 \\*[an*page-ref-string] \\*[an*topic]_\\*[an*section] .nr an*was-TH-bookmark-emitted 1 . \} . tl '\\*[an-pageref]'\\*[an-extra3]'\\*[an-pageref]' @@ -1171,28 +1187,39 @@ contains unsupported escape sequence .de1 MR . if ((\\n[.$] < 2) : (\\n[.$] > 3)) \ .an-style-warn .\\$0 expects 2 or 3 arguments, got \\n[.$] -. ds an*url man:\\$1(\\$2)\" used everywhere but macOS -. if (\\n[an*MR-URL-format] = 2) \ -.ds an*url x-man-page://\\$2/\\$1\" macOS/Mac OS X since 10.3 -. if (\\n[an*MR-URL-format] = 3) \ -.ds an*url man:\\$1.\\$2\" Bwana (Mac OS X) -. if (\\n[an*MR-URL-format] = 4) \ -.ds an*url x-man-doc://\\$2/\\$1\" ManOpen (Mac OS X pre-2005) -. nh -. if \\n[an*do-hyperlink] \{\ -.if \\n[an*is-output-html] \ -. nop \X^html:^\c -.if \\n[an*is-output-terminal] \ -. nop \X^tty: link \\*[an*url]^\c +. ie \\n[an*is-output-pdf] \{\ +.ie \\n(.$=1 \ +. I \\$1 +.el \{\ +. an*cln an*page-ref-nm \\$1_\\$2 +. ie d pdf:look(\\*[an*page-ref-nm]) .pdfhref L -D \\*[an*page-ref-nm] -A "\\$3" -- \fI\\$1\fP(\\$2) +. el .IR \\$1 (\\$2)\\$3 +.\} . \} -. nop \&\\*[an-lic]\f[\\*[MF]]\\$1\\*[an-ic]\f[R](\\$2)\c -. if \\n[an*do-hyperlink] \{\ -.if \\n[an*is-output-html] \ -. nop \X^html:^\c -.if \\n[an*is-output-terminal] \ -. nop \X^tty: link^\c +. el \{\ +.ds an*url man:\\$1(\\$2)\" used everywhere but macOS +.if (\\n[an*MR-URL-format] = 2) \ +. ds an*url x-man-page://\\$2/\\$1\" macOS/Mac OS X since 10.3 +.if (\\n[an*MR-URL-format] = 3) \ +. ds an*url man:\\$1.\\$2\" Bwana (Mac OS X) +.if (\\n[an*MR-URL-format] = 4) \ +. ds an*url x-man-doc://\\$2/\\$1\" ManOpen (Mac OS X pre-2005) +.nh +.if \\n[an*do-hyperlink] \{\ +. if \\n[an*is-output-html] \ +.nop \X^html:^\c +. if \\n[an*is-output-terminal] \ +.nop \X^tty: link \\*[an*url]^\c +.\} +.nop \&\\*[an-lic]\f[\\*[MF]]\\$1\\*[an-ic]\f[R](\\$2)\c +.if \\n[an*do-hyperlink] \{\ +. if \\n[an*is-output-html] \ +.nop \X^html:^\c +. if \\n[an*is-output-terminal] \ +.nop \X^tty: link^\c +.\} +.nop \&\\$3 . \} -. nop \&\\$3 . hy \\n[an*hyphenation-mode] .. . diff --git a/tmac/anmark.tmac b/tmac/anmark.tmac new file mode 100644 index 0..f991ae954 --- /dev/null +++ b/tmac/anmark.tmac @@ -0,0 +1,3 @@ +.nr PDFOUTLINE.FOLDLEVEL 1 +.defcolor pdf:href.colour rgb 0.00 0.25 0.75 +.pdfinfo /Title "The Groff Manpage Book" ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Make pdfmom more versatile.
deri pushed a commit to branch master in repository groff. commit 0290924f05f823039c546f5b14422af7eef70644 Author: Deri James AuthorDate: Thu Mar 9 17:39:07 2023 + Make pdfmom more versatile. * src/devices/gropdf/pdfmom.pl: Add flag -roff which severs hardcoded link to the mom macros. * src/devices/gropdf/pdfmom.pl: Document changes. --- ChangeLog | 8 src/devices/gropdf/pdfmom.1.man | 16 src/devices/gropdf/pdfmom.pl| 34 +- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36c7200a3..d2f91425b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2023-02-11 Deri James + +Make pdfmom more versatile. + +* src/devices/gropdf/pdfmom.pl: Add flag -roff which severs +hardcoded link to the mom macros. +* src/devices/gropdf/pdfmom.pl: Document changes. + 2023-03-06 G. Branden Robinson Use a better type for symbol hashes. diff --git a/src/devices/gropdf/pdfmom.1.man b/src/devices/gropdf/pdfmom.1.man index 1b3dc014a..64176cd03 100644 --- a/src/devices/gropdf/pdfmom.1.man +++ b/src/devices/gropdf/pdfmom.1.man @@ -54,6 +54,7 @@ macro package for . .SY pdfmom .RB [ \-Tpdf ] +.RB [ \-roff ] .RI [ groff-options ] .RI [ file\~ .\|.\|.] .YS @@ -89,6 +90,21 @@ macros. . . .P +If the +.B \-roff +option is used the link to +.I mom +is severed and the wrapper can be used with other macro sets. +This is also true if the wrapper is renamed or linked as a +pseudonym, so creating a link called +.I pdfms +which targets pdfmom will create a wrapper for creating pdfs +with the +.I ms +macro. +. +. +.P .I pdfmom prints to the standard output, so output must usually be redirected to a destination file. diff --git a/src/devices/gropdf/pdfmom.pl b/src/devices/gropdf/pdfmom.pl index 89977d496..3a410d8ad 100644 --- a/src/devices/gropdf/pdfmom.pl +++ b/src/devices/gropdf/pdfmom.pl @@ -1,6 +1,6 @@ #!@PERL@ # -# pdfmom : Frontend to run groff -mom to produce PDFs +# pdfmom : Frontend to run groff to produce PDFs # Deri James : Friday 16 Mar 2012 # @@ -29,6 +29,19 @@ my @cmd; my $dev='pdf'; my $preconv=''; my $readstdin=1; +my $mom='-mom'; +if ($0=~m/pdf(\w+)$/) +{ +my $m=$1; +if ($m=~m/^(mom|mm|ms|me|man|mandoc)$/) +{ +$mom="-".$m; +} +else +{ +$mom=''; +} +} my $RT_SEP='@RT_SEP@'; $ENV{PATH}=$ENV{GROFF_BIN_PATH}.$RT_SEP.$ENV{PATH} if exists($ENV{GROFF_BIN_PATH}); @@ -73,6 +86,10 @@ while (my $c=shift) $dev=$c; next; } +elsif ($c eq '-roff' or $c eq '--roff') +{ +$mom=''; +} elsif ($c eq '-v' or $c eq '--version') { print "GNU pdfmom (groff) version @VERSION@\n"; @@ -123,19 +140,26 @@ if ($readstdin) if ($dev eq 'pdf') { -system("groff -Tpdf -dLABEL.REFS=1 -mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf -dPDF.EXPORT=1 -dLABEL.REFS=1 -mom -z - $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf -mom $preconv - $cmdstring"); +if ($mom) +{ +system("groff -Tpdf -dLABEL.REFS=1 $mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf -dPDF.EXPORT=1 -dLABEL.REFS=1 $mom -z - $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf $mom $preconv - $cmdstring"); +} +else +{ +system("groff -Tpdf -dPDF.EXPORT=1 -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf $preconv - $cmdstring"); +} } elsif ($dev eq 'ps') { -system("groff -Tpdf -dLABEL.REFS=1 -mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | pdfroff -mpdfmark -mom --no-toc - $preconv $cmdstring"); +system("groff -Tpdf -dLABEL.REFS=1 $mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | pdfroff -mpdfmark $mom --no-toc - $preconv $cmdstring"); } elsif ($dev eq '-z') # pseudo dev - just compile for warnings { -system("groff -Tpdf -mom -z $cmdstring"); +system("groff -Tpdf $mom -z $cmdstring"); } elsif ($dev eq '-Z') # pseudo dev - produce troff output { -system("groff -Tpdf -mom -Z $cmdstring"); +system("groff -Tpdf $mom -Z $cmdstring"); } else { ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [BuildFoundries]: Fails if neither ghostcript nor URW fonts are installed.
deri pushed a commit to branch master in repository groff. commit 398ab1c7722724586f97e3a7ca20714e1d465452 Author: Deri James AuthorDate: Sat Feb 11 13:01:34 2023 + [BuildFoundries]: Fails if neither ghostcript nor URW fonts are installed. * font/devpdf/util/BuildFoundries.pl: When the change to hold paths in an array, rather than a delimited string (see commit 4ae4aeb6555f4f16c28fcb03eb1f56577826054c), the FindGSpath subroutine should return a pointer to an empty array when the call to ghostscript fails, rather than return an empty string, as was done previously. See <https://lists.gnu.org/archive/html/groff/2023-02/msg00042.html> thanks to Bruno Haible for the report. --- ChangeLog | 15 +++ font/devpdf/util/BuildFoundries.pl | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 81dc74049..c48799f7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2023-02-11 Deri James + + [BuildFoundries]: Fails if neither ghostcript nor URW fonts + are installed. + + * font/devpdf/util/BuildFoundries.pl: When the change to hold paths + in an array, rather than a delimited string (see commit + 4ae4aeb6555f4f16c28fcb03eb1f56577826054c), the FindGSpath + subroutine should return a pointer to an empty array when the + call to ghostscript fails, rather than return an empty string, + as was done previously. + + See <https://lists.gnu.org/archive/html/groff/2023-02/msg00042.html> + thanks to Bruno Haible for the report. + 2023-02-09 G. Branden Robinson Switch to using system's assert.h header file. It is futile to diff --git a/font/devpdf/util/BuildFoundries.pl b/font/devpdf/util/BuildFoundries.pl index 1e7c416cb..b22925a89 100644 --- a/font/devpdf/util/BuildFoundries.pl +++ b/font/devpdf/util/BuildFoundries.pl @@ -332,7 +332,7 @@ sub LocateFile sub FindGSpath { my (@res)=`@GROFF_GHOSTSCRIPT_INTERPRETERS@ -h 2>/dev/null`; -return '' if $?; +return [] if $?; my $buildpath=[]; my $stg=1; ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Fixes
deri pushed a commit to branch master in repository groff. commit 7fb6e3ffd06c0ad8058e5de2325eef55f178ef67 Author: Deri James AuthorDate: Thu Feb 9 15:27:56 2023 + Fixes <https://savannah.gnu.org/bugs/?63757> * src/devices/gropdf/gropdf.pl: Parse papersize string for possible multiple (space separated) entries. First valid entry wins. [gropdf] Parse multiple entries in 'papersize' as specified in the groff_font man page. Reported by Ben Wong and fix based on his patch, thanks. --- ChangeLog| 12 +++ src/devices/gropdf/gropdf.pl | 75 ++-- 2 files changed, 57 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index e3836b18e..b5c347fb5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2023-02-09 Deri James + + [gropdf] Parse multiple entries in 'papersize' as specified in + the groff_font man page. Reported by Ben Wong and fix based on + his patch, thanks. + + * src/devices/gropdf/gropdf.pl: Parse papersize string for + possible multiple (space separated) entries. First valid entry + wins. + + Fixes https://savannah.gnu.org/bugs/?63757 + 2023-02-04 G. Branden Robinson Correct numerous typos and solecisms throughout the source tree. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index f24889219..c65a1051f 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -286,46 +286,61 @@ LoadDownload(); LoadDesc(); my $unitwidth=$desc{unitwidth}; -my $papersz=$desc{papersize}; -$papersz=lc($fpsz) if $fpsz; $env{FontHT}=0; $env{FontSlant}=0; MakeMatrix(); -if (substr($papersz,0,1) eq '/' and -r $papersz) +my $possiblesizes = $desc{papersize}; +$possiblesizes = $fpsz if $fpsz; +my $papersz; +for $papersz ( split(" ", lc($possiblesizes).' #duff#') ) { -if (open(P,"<$papersz")) +# No valid papersize found? +if ($papersz eq '#duff#') { - while () - { - chomp; - s/# .*//; - next if $_ eq ''; - $papersz=$_; - last - } + Warn("ignoring unrecognized paper format(s) '$possiblesizes'"); + last; +} - close(P); +# Check for "/etc/papersize" +elsif (substr($papersz,0,1) eq '/' and -r $papersz) +{ +if (open(P,"<$papersz")) +{ +while () +{ +chomp; +s/# .*//; +next if $_ eq ''; +$papersz=lc($_); +last; +} +close(P); +} } -} -if ($papersz=~m/([\d.]+)([cipP]),([\d.]+)([cipP])/) -{ -@defaultmb=@mediabox=(0,0,ToPoints($3,$4),ToPoints($1,$2)); -} -elsif (exists($ppsz{$papersz})) -{ -@defaultmb=@mediabox=(0,0,$ppsz{$papersz}->[0],$ppsz{$papersz}->[1]); -} -elsif (substr($papersz,-1) eq 'l' and exists($ppsz{substr($papersz,0,-1)})) -{ -# Note 'legal' ends in 'l' but will be caught above - @defaultmb=@mediabox=(0,0,$ppsz{substr($papersz,0,-1)}->[1],$ppsz{substr($papersz,0,-1)}->[0]); -} -else -{ -Warn("ignoring unrecognized paper format '$papersz'"); +# Allow height,width specified directly in centimeters, inches, or points. +if ($papersz=~m/([\d.]+)([cipP]),([\d.]+)([cipP])/) +{ +@defaultmb=@mediabox=(0,0,ToPoints($3,$4),ToPoints($1,$2)); +last; +} +# Look $papersz up as a name such as "a4" or "letter". +elsif (exists($ppsz{$papersz})) +{ +@defaultmb=@mediabox=(0,0,$ppsz{$papersz}->[0],$ppsz{$papersz}->[1]); +last; +} +# Check for a landscape version +elsif (substr($papersz,-1) eq 'l' and exists($ppsz{substr($papersz,0,-1)})) +{ + # Note 'legal' ends in 'l' but will be caught above + @defaultmb=@mediabox=(0,0,$ppsz{substr($papersz,0,-1)}->[1],$ppsz{substr($papersz,0,-1)}->[0]); + last; +} + +# If we get here, $papersz was invalid, so try the next one. } my (@dt)=localtime($ENV{SOURCE_DATE_EPOCH} || time); ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [gropdf]: Cater for invalid entries in download file.
deri pushed a commit to branch master in repository groff. commit 7e5d433ba5ddc2389986a5c02f91eb57fc1de47d Author: Deri James AuthorDate: Tue Nov 8 21:03:49 2022 + [gropdf]: Cater for invalid entries in download file. * src/devices/gropdf/gropdf.pl: Test if path in the download file points to a readable file. Also change order so that the first valid entry is used as the font to embed. This replaces previous order where last found entry is used. This change is discussed in <https://savannah.gnu.org/bugs/?62950>. --- ChangeLog| 11 +++ src/devices/gropdf/gropdf.pl | 22 -- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51772ba24..d1ddb34b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2022-11-08 Deri James + +[gropdf]: Cater for invalid entries in download file. + +* src/devices/gropdf/gropdf.pl: Test if path in the download +file points to a readable file. Also change order so that the +first valid entry is used as the font to embed. This replaces +previous order where last found entry is used. + +This change is discussed in <https://savannah.gnu.org/bugs/?62950>. + 2022-11-05 G. Branden Robinson [mdoc]: Set page topic in roman in "Name" section. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index c8700f255..594a1463c 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -126,6 +126,7 @@ my $thislev=1; my $mark=undef; my $suspendmark=undef; my $boxmax=0; +my %missing;# fonts in download files which are not found/readable @@ -667,7 +668,16 @@ sub LoadDownload $file=substr($file,1); } - $download{"$foundry $name"}=$file; +my $pth=$file; +$pth=$dir."/$devnm/$file" if substr($file,0,1) ne '/'; + +if (!-r $pth) +{ +$missing{"$foundry $name"}="$dir/$devnm"; +next; +} + +$download{"$foundry $name"}=$file if !exists($download{"$foundry $name"}); } close($f); @@ -2538,9 +2548,17 @@ sub LoadFont } else { -Warn("unable to embed font file for '$fnt{internalname}'" +if (exists($missing{$fontkey})) +{ +Warn("The download file in '$missing{$fontkey}' " +. " has erroneous entry for '$fnt{internalname} ($ofontnm)'"); +} +else +{ +Warn("unable to embed font file for '$fnt{internalname}'" . " ($ofontnm) (missing entry in 'download' file?)") if $embedall; +} $fno=++$objct; $fontlst{$fontno}->{OBJ}=BuildObj($objct, {'Type' => '/Font', ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Bug #62934 - after glyph remapped mark it as used
deri pushed a commit to branch master in repository groff. commit f275b477e0f49d180224a77271c1b68e913b71b5 Author: Deri James AuthorDate: Mon Aug 22 23:30:40 2022 +0100 Bug #62934 - after glyph remapped mark it as used When many glyphs are remapped from code points above 255 such as writing documents in cyrillic with the U-TR fonts, gropdf starts reusing code points in the range 128-255. If subsequently one of those code points is actually required, such as \(em (code 138), and it has been replaced by a cyrillic, then it needs to be mapped to another free code. To determine if a particular code point is free each glyph has a USED flag. The bug was caused because after remapping \(em to the next free glyph the USED flag was not set. So the next new cyrillic character to be entered was given the same code point as had been allocated to \(em. * src/devices/gropdf/gropdf.pl: Set the USED flag on remapped glyphs. Fixes <https://savannah.gnu.org/bugs/?62934>. Thanks to Nikita Ivanov for spotting the problem and testing the fix. --- ChangeLog| 25 + src/devices/gropdf/gropdf.pl | 87 ++-- 2 files changed, 69 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index 643abd9b9..80a97ae94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2022-08-22 Deri James + + Bug #62934 - after glyph remapped mark it as used + + When many glyphs are remapped from code points above 255 + such as writing documents in cyrillic with the U-TR fonts, + gropdf starts reusing code points in the range 128-255. + If subsequently one of those code points is actually required, + such as \(em (code 138), and it has been replaced by a + cyrillic, then it needs to be mapped to another free code. + + To determine if a particular code point is free each glyph + has a USED flag. The bug was caused because after remapping + \(em to the next free glyph the USED flag was not set. So the + next new cyrillic character to be entered was given the same + code point as had been allocated to \(em. + + * src/devices/gropdf/gropdf.pl: Set the USED flag on remapped + glyphs. + + Fixes <https://savannah.gnu.org/bugs/?62934>. + + Thanks to Nikita Ivanov for spotting the problem and testing + the fix. + 2022-08-20 Deri James Bug #62923 - problem using aliased glyphs diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index b5fe98d87..4b6b1c009 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -112,13 +112,13 @@ my $w_flg=0; my $nomove=0; my $pendmv=0; my $gotT=0; -my $suppress=0;# Suppress processing? -my %incfil;# Included Files -my @outlev=([0,undef,0,0]);# Structure pdfmark /OUT entries +my $suppress=0; # Suppress processing? +my %incfil; # Included Files +my @outlev=([0,undef,0,0]); # Structure pdfmark /OUT entries my $curoutlev=\@outlev; -my $curoutlevno=0; # Growth point for @curoutlev +my $curoutlevno=0; # Growth point for @curoutlev my $Foundry=''; -my $xrev=0;# Reverse x direction of font +my $xrev=0; # Reverse x direction of font my $matrixchg=0; my $wt=-1; my $thislev=1; @@ -478,13 +478,13 @@ sub MakeMatrix $slant*=$env{FontHT}/$cftsz if $env{FontHT} != 0; my $ang=rad($slant); - $mat[2]=sprintf('%.3f',sin($ang)/cos($ang)); - } +$mat[2]=sprintf('%.3f',sin($ang)/cos($ang)); +} - if ($fontxrev) - { - $mat[0]=-$mat[0]; - } +if ($fontxrev) +{ +$mat[0]=-$mat[0]; +} } $matrix=join(' ',@mat); @@ -1142,12 +1142,12 @@ sub do_x } } elsif (lc($xprm[1]) eq 'xrev') - { - $xrev=!$xrev; - } - elsif (lc($xprm[1]) eq 'markstart') - { - $mark={'rst' => ($xprm[2]+$xprm[4])/$unitwidth, 'rsb' => ($xprm[3]-$xprm[4])/$unitwidth, 'xpos' => $xpos-($xprm[4]/$unitwidth), +{ +$xrev=!$xrev; +} +elsif (lc($xprm[1]) eq 'markstart') +{ +$mark={'rst' => ($xprm[2]+$xprm[4])/$unitwidth, 'rsb' => ($xprm[3]-$xprm[4])/$unitwidth, 'xpos' => $xpos-($xprm[4]/$unitwidth), 'ypos' => $ypos, 'lead' => $xprm[4]/$unitwidth, 'pdfmark' => join(' ',@xprm[5..$#xprm])}; } elsif (lc($xprm[1]) eq 'markend') @@ -2411,21 +2411,21 @@ sub LoadFont my (@r)=split; my (@p)=split(',',$r[1]); -if ($r[1] eq '"') -{ -$fnt{NAM}->{$r[0]}=[@{$fnt{NAM}->{$lastnm}}]; -next; -} + if ($r
[groff] 01/01: Bug #62923 - problem using aliased glyphs
deri pushed a commit to branch master in repository groff. commit 26523d0bb2d2c0cca6b3b0759888069d6846fb1f Author: Deri James AuthorDate: Sat Aug 20 01:29:12 2022 +0100 Bug #62923 - problem using aliased glyphs With a large font if 2 characters above the 255 code point limit are aliased, the aliased glyph has incorrect meta data. * src/devices/gropdf/gropdf.pl: Instead of duplicating a pointer to the font metadata, duplicate the data itself. Then, if the glyph is remapped to a code point under 256, the metadata is preserved. Fixes <https://savannah.gnu.org/bugs/?62923>. --- ChangeLog| 15 +++ src/devices/gropdf/gropdf.pl | 22 +++--- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 89ff8ce87..643abd9b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2022-08-20 Deri James + + Bug #62923 - problem using aliased glyphs + + With a large font if 2 characters above the 255 code + point limit are aliased, the aliased glyph has incorrect meta + data. + + * src/devices/gropdf/gropdf.pl: Instead of duplicating a pointer + to the font metadata, duplicate the data itself. Then, if the + glyph is remapped to a code point under 256, the metadata is + preserved. + + Fixes <https://savannah.gnu.org/bugs/?62923>. + 2022-08-18 Deri James [gropdf]: Improve parsing of troff font files. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index e936b734b..b5fe98d87 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -2411,20 +2411,20 @@ sub LoadFont my (@r)=split; my (@p)=split(',',$r[1]); - if ($r[1] eq '"') - { - $fnt{NAM}->{$r[0]}=$fnt{NAM}->{$lastnm}; +if ($r[1] eq '"') +{ +$fnt{NAM}->{$r[0]}=[@{$fnt{NAM}->{$lastnm}}]; next; } -$r[3]=oct($r[3]) if substr($r[3],0,1) eq '0'; -$r[0]='u0020' if $r[3] == 32; -$r[0]="u00".hex($r[3]) if $r[0] eq '---'; -# next if $r[3] >255; -$r[4]=$r[0] if !defined($r[4]); -$fnt{NAM}->{$r[0]}=[$p[0],$r[3],'/'.$r[4],$r[3],0]; -$fnt{NO}->[$r[3]]=[$r[0],$r[0]]; -$lastnm=$r[0]; + $r[3]=oct($r[3]) if substr($r[3],0,1) eq '0'; + $r[0]='u0020' if $r[3] == 32; + $r[0]="u00".hex($r[3]) if $r[0] eq '---'; +# next if $r[3] >255; + $r[4]=$r[0] if !defined($r[4]); + $fnt{NAM}->{$r[0]}=[$p[0],$r[3],'/'.$r[4],$r[3],0]; + $fnt{NO}->[$r[3]]=[$r[0],$r[0]]; + $lastnm=$r[0]; $lastchr=$r[3] if $r[3] > $lastchr; $fixwid=$p[0] if $fixwid == -1; $fixwid=-2 if $fixwid > 0 and $p[0] != $fixwid; ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [gropdf]: Improve parsing of troff font files.
deri pushed a commit to branch master in repository groff. commit 0a4c256f3bce926e3d0829bf95447dd60b5fb5d7 Author: Deri James AuthorDate: Thu Aug 18 14:38:05 2022 +0100 [gropdf]: Improve parsing of troff font files. * src/devices/gropdf/gropdf.pl: Allow the glyph code number to be octal or hex as well as a decimal number. If entity_name is missing use name instead. --- ChangeLog| 8 src/devices/gropdf/gropdf.pl | 32 +--- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8615277ce..89ff8ce87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2022-08-18 Deri James + + [gropdf]: Improve parsing of troff font files. + + * src/devices/gropdf/gropdf.pl: Allow the glyph code number + to be octal or hex as well as a decimal number. If entity_name + is missing use name instead. + 2022-08-15 G. Branden Robinson [ms]: Support pic(1) "flyback" feature. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 158880002..e936b734b 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -922,7 +922,7 @@ sub do_x } } elsif ($pdfmark=~m/(.+) \/DEST\s*$/) -{ + { my @xwds=split(' ',"<< $1 >>"); my $dest=ParsePDFValue(\@xwds); $dest->{View}->[1]=GraphY($dest->{View}->[1]*-1); @@ -2414,15 +2414,17 @@ sub LoadFont if ($r[1] eq '"') { $fnt{NAM}->{$r[0]}=$fnt{NAM}->{$lastnm}; - next; - } +next; +} - $r[0]='u0020' if $r[3] == 32; - $r[0]="u00".hex($r[3]) if $r[0] eq '---'; -# next if $r[3] >255; - $fnt{NAM}->{$r[0]}=[$p[0],$r[3],'/'.$r[4],$r[3],0]; - $fnt{NO}->[$r[3]]=[$r[0],$r[0]]; - $lastnm=$r[0]; +$r[3]=oct($r[3]) if substr($r[3],0,1) eq '0'; +$r[0]='u0020' if $r[3] == 32; +$r[0]="u00".hex($r[3]) if $r[0] eq '---'; +# next if $r[3] >255; +$r[4]=$r[0] if !defined($r[4]); +$fnt{NAM}->{$r[0]}=[$p[0],$r[3],'/'.$r[4],$r[3],0]; +$fnt{NO}->[$r[3]]=[$r[0],$r[0]]; +$lastnm=$r[0]; $lastchr=$r[3] if $r[3] > $lastchr; $fixwid=$p[0] if $fixwid == -1; $fixwid=-2 if $fixwid > 0 and $p[0] != $fixwid; @@ -2506,12 +2508,12 @@ sub LoadFont } else { - Warn("unable to embed font file for '$fnt{internalname}'" - . " ($ofontnm) (missing entry in 'download' file?)") - if $embedall; - $fno=++$objct; - $fontlst{$fontno}->{OBJ}=BuildObj($objct, - {'Type' => '/Font', +Warn("unable to embed font file for '$fnt{internalname}'" +. " ($ofontnm) (missing entry in 'download' file?)") +if $embedall; +$fno=++$objct; +$fontlst{$fontno}->{OBJ}=BuildObj($objct, +{'Type' => '/Font', 'Subtype' => '/Type1', 'BaseFont' => '/'.$fnt{internalname}, 'Widths' => $fnt{WIDTH}, ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [man]: Correct information for gropdf.
deri pushed a commit to branch master in repository groff. commit 5b357550d90f59f4d37ae9f2ce3a562d97b78a01 Author: Deri James AuthorDate: Tue Aug 9 19:11:49 2022 +0100 [man]: Correct information for gropdf. * src/devices/gropdf/gropdf.1.man: gropdf reads multiple download files rather than just the first found. --- src/devices/gropdf/gropdf.1.man | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/devices/gropdf/gropdf.1.man b/src/devices/gropdf/gropdf.1.man index 49d31364c..c8e512418 100644 --- a/src/devices/gropdf/gropdf.1.man +++ b/src/devices/gropdf/gropdf.1.man @@ -387,9 +387,7 @@ font metric files. . The .I download -file itself is also sought using this mechanism; -currently, -only the first file found in the font search path is read. +file itself is also sought using this mechanism. . Foundry names are usually a single character (such as \[oq]U\[cq] for the URW foundry) ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [gropdf]: slanting lowercase greek characters.
deri pushed a commit to branch master in repository groff. commit d58625a25f2c1732b863d64a259d04a4e61c829d Author: Deri James AuthorDate: Thu Jul 28 13:48:53 2022 +0100 [gropdf]: slanting lowercase greek characters. * tmac/pdf.tmac: to prevent gropdf from slanting all lowercase greek characters only slant if the glyph is sourced from a special font, not if the regular font contains greek glyphs. --- ChangeLog | 9 + tmac/pdf.tmac | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7b8a5095..cc545ea5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2022-07-28 Deri James + + [gropdf]: slanting lowercase greek characters. See + https://lists.gnu.org/archive/html/groff/2022-07/msg00210.html + + * tmac/pdf.tmac: to prevent gropdf from slanting all lowercase + greek characters only slant if the glyp is sourced from a + special font, not if the regular font contains greek glyphs. + 2022-07-23 G. Branden Robinson * m4/groff.m4 (GROFF_PAGE): Use 'grep -q' instead of redirecting diff --git a/tmac/pdf.tmac b/tmac/pdf.tmac index ea58bf42..2f78676a 100644 --- a/tmac/pdf.tmac +++ b/tmac/pdf.tmac @@ -34,7 +34,7 @@ am solely responsible for any bugs I may have introduced into this file. .mso ps.tmac . .de pdf:SS -. char \\$1 \\S'16'\\$1\\S'0' +. fchar \\$1 \\S'16'\\$1\\S'0' .. .pdf:SS \[+h] .pdf:SS \[ts] ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [devpdf]: Restore original path
deri pushed a commit to branch master in repository groff. commit 272aaadb23f3ed44873c6acaaf42f41cdd9a11ba Author: Deri James AuthorDate: Fri Jul 8 14:16:55 2022 +0100 [devpdf]: Restore original path * font/devpdf/util/BuildFoundries.pl: Some systems store .afm files in a parallel directory to the Type 1 files, restore original path after checking for parallel directory. --- ChangeLog | 6 ++ font/devpdf/util/BuildFoundries.pl | 8 +--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7714fb36..abde32bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2022-07-08 Deri James + +* font/devpdf/util/BuildFoundries.pl: Some systems store .afm +files in a parallel directory to the Type 1 files, restore +original path after checking for parallel directory. + 2022-07-07 G. Branden Robinson * font/devpdf/devpdf.am (font/devpdf/download): Call diff --git a/font/devpdf/util/BuildFoundries.pl b/font/devpdf/util/BuildFoundries.pl index a0e498e6..2ba5a7de 100644 --- a/font/devpdf/util/BuildFoundries.pl +++ b/font/devpdf/util/BuildFoundries.pl @@ -306,11 +306,13 @@ sub LocateFile return("$p/$file"); } -if ($tryafm and $p=~s'type1/'afm/'i) +my $ap=$p; + +if ($tryafm and $ap=~s'type1/'afm/'i) { -if (-r "$p/$file") +if (-r "$ap/$file") { -return("$p/$file"); +return("$ap/$file"); } } } ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [gropdf]: Add more search paths to Foundry file.
deri pushed a commit to branch master in repository groff. commit d55157d39ab4d01bccea276122a2f3a5b1e30452 Author: Deri James AuthorDate: Wed Jun 22 00:24:04 2022 +0100 [gropdf]: Add more search paths to Foundry file. * font/devpdf/Foundry.in: Use the directory specified with the config flag --with-urw-fonts-dir to populate the default foundry as well as the U foundry. Important to populate the download file with font files to embed the fonts not part of the base pdf fonts or if user wants all fonts embedded. --- ChangeLog | 14 -- font/devpdf/Foundry.in | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 59db0d13..2443e1b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2022-06-21 Deri James + + [gropdf]: Add more search paths to the Foundry file. + + * font/devpdf/Foundry.in: Use the directory specified with the + config flag --with-urw-fonts-dir to populate the default foundry + as well as the U foundry. Important to populate the download + file with font files to embed the fonts not part of the base + pdf fonts or if user wants all fonts embedded. + 2022-06-21 G. Branden Robinson * tmac/an-ext.tmac (UR, MT): Fix problem with hyphenation @@ -148,14 +158,14 @@ * src/roff/groff/groff.cpp (help): Revise usage message for expressiveness and clarity. -2022-06-10 Deri James +2022-06-21 Deri James [gropdf]: Correct display of pathnames used. * font/devpdf/util/BuildFoundries.pl: Convert array to string of pathnames. -2022-06-10 Deri James +2022-06-21 Deri James [gropdf]: Fix to gropdf. diff --git a/font/devpdf/Foundry.in b/font/devpdf/Foundry.in index 4aa52303..3971ad96 100644 --- a/font/devpdf/Foundry.in +++ b/font/devpdf/Foundry.in @@ -20,7 +20,7 @@ #=== #Foundry|Name|Search path -foundry||(gs) +foundry||@urwfontsdir@:(gs):/usr/share/fonts/type1/gsfonts:/usr/share/fonts/default/Type1:/usr/share/fonts/default/Type1/adobestd35:/usr/share/fonts/type1/urw-base35:/opt/local/share/fonts/urw-fonts:/usr/local/share/fonts/ghostscript # Enable the font description files for grops (generated from Adobe # foundry font files) to be used with gropdf. afmtodit must not be @@ -72,7 +72,7 @@ EURO|N*../devps/freeeuro.pfa # URW fonts are typically shipped with Ghostscript, but can be replaced. #Foundry|Name|Search path -foundry|U|@urwfontsdir@:/usr/share/fonts/type1/gsfonts:/usr/share/fonts/default/Type1:/usr/share/fonts/default/Type1/adobestd35:/usr/share/fonts/type1/urw-base35:/opt/local/share/fonts/urw-fonts:(gs) +foundry|U|@urwfontsdir@:/usr/share/fonts/type1/gsfonts:/usr/share/fonts/default/Type1:/usr/share/fonts/default/Type1/adobestd35:/usr/share/fonts/type1/urw-base35:/opt/local/share/fonts/urw-fonts:/usr/local/share/fonts/ghostscript:(gs) # Define flags for afmtodit. ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [gropdf]: Correct display of pathnames used.
deri pushed a commit to branch master in repository groff. commit ced9cd5984814f9701fd681b6c949d0708c2687c Author: Deri James AuthorDate: Tue Jun 21 16:38:39 2022 +0100 [gropdf]: Correct display of pathnames used. * font/devpdf/util/BuildFoundries.pl: Convert array to string of pathnames. --- ChangeLog | 7 +++ font/devpdf/util/BuildFoundries.pl | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 59721ade..22415226 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2022-06-10 Deri James + + [gropdf]: Correct display of pathnames used. + + * font/devpdf/util/BuildFoundries.pl: Convert array to + string of pathnames. + 2022-06-10 Deri James [gropdf]: Fix to gropdf. diff --git a/font/devpdf/util/BuildFoundries.pl b/font/devpdf/util/BuildFoundries.pl index 9bf6fb0e..76c1bef8 100644 --- a/font/devpdf/util/BuildFoundries.pl +++ b/font/devpdf/util/BuildFoundries.pl @@ -86,7 +86,7 @@ sub LoadFoundry if (lc($r[0]) eq 'foundry') { - Warn("\nThe path(s) used for searching:\n".join(':',$foundrypath)."\n") if $notFoundFont; + Warn("\nThe path(s) used for searching:\n".join(':',@{$foundrypath})."\n") if $notFoundFont; $foundry=uc($r[1]); $foundrypath=[]; push(@{$foundrypath},$dirURW) if $dirURW; @@ -166,7 +166,7 @@ sub LoadFoundry } close(F); -Warn("\nThe path(s) used for searching:\n".join(':',$foundrypath)."\n") if $notFoundFont; +Warn("\nThe path(s) used for searching:\n".join(':',@{$foundrypath})."\n") if $notFoundFont; } sub RunAfmtodit ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: [gropdf]: Fix to gropdf.
deri pushed a commit to branch master in repository groff. commit 52f725f019ba87575ba3affbae8e6733b2e6ff13 Author: Deri James AuthorDate: Tue Jun 21 10:54:05 2022 +0100 [gropdf]: Fix to gropdf. * src/devices/gropdf/gropdf.pl: If pdfbookmark was called within 5p of top of page (e.g. straight after a .bp when \n[nl] was zero) the click destination would be off by a page. --- ChangeLog| 9 ++ src/devices/gropdf/gropdf.pl | 241 +-- 2 files changed, 128 insertions(+), 122 deletions(-) diff --git a/ChangeLog b/ChangeLog index 01fe0fcb..59721ade 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2022-06-10 Deri James + + [gropdf]: Fix to gropdf. + + * src/devices/gropdf/gropdf.pl: If pdfbookmark was called + within 5p of top of page (e.g. straight after a .bp when + \n[nl] was zero) the click destination would be off by a + page. + 2022-06-19 Ingo Schwarze * font/devpdf/devpdf.am: Always build PDF font description files. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index a8c3edc0..581f1fde 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -1,6 +1,6 @@ #!@PERL@ -w # -# gropdf : PDF post processor for groff +# gropdf : PDF post processor for groff # # Copyright (C) 2011-2020 Free Software Foundation, Inc. # Written by Deri James @@ -29,7 +29,7 @@ use constant CHRCODE=> 1, PSNAME => 2, ASSIGNED => 3, -USED => 4, +USED=> 4, }; (my $progname=$0) =~s @.*/@@; @@ -38,19 +38,19 @@ my $gotzlib=0; my $rc = eval { -require Compress::Zlib; -Compress::Zlib->import(); -1; + require Compress::Zlib; + Compress::Zlib->import(); + 1; }; if($rc) { -$gotzlib=1; + $gotzlib=1; } else { Warn("Perl module 'Compress::Zlib' not available; cannot compress" -. " this PDF"); + . " this PDF"); } my %cfg; @@ -60,7 +60,7 @@ $cfg{GROFF_FONT_PATH}='@GROFF_FONT_DIR@'; $cfg{RT_SEP}='@RT_SEP@'; binmode(STDOUT); -my @obj; # Array of PDF objects +my @obj;# Array of PDF objects my $objct=0; # Count of Objects my $fct=0; # Output count my %fnt; # Used fonts @@ -230,14 +230,14 @@ if (defined($unicodemap)) } elsif (-r $unicodemap) { - local $/; - open(F,"<$unicodemap") or Die("failed to open '$unicodemap'"); - ($ucmap)=(); - close(F); +local $/; +open(F,"<$unicodemap") or Die("failed to open '$unicodemap'"); +($ucmap)=(); +close(F); } else { - Warn("failed to find '$unicodemap'; ignoring"); +Warn("failed to find '$unicodemap'; ignoring"); } } @@ -607,7 +607,7 @@ sub ToPoints } else { - Die("invalid scaling unit '$unit'"); +Die("invalid scaling unit '$unit'"); } } @@ -640,7 +640,7 @@ sub LoadDownload $download{"$foundry $name"}=$file; } - close($f); +close($f); } Die("failed to open 'download' file") if !$found; @@ -671,7 +671,7 @@ sub LoadDesc OpenFile(\$f,$fontdir,"DESC"); Die("failed to open device description file 'DESC'") - if !defined($f); +if !defined($f); while (<$f>) { @@ -686,35 +686,35 @@ sub LoadDesc foreach my $directive ('unitwidth', 'res', 'sizescale') { - Die("device description file 'DESC' missing mandatory directive" - . " '$directive'") if !exists($desc{$directive}); +Die("device description file 'DESC' missing mandatory directive" +. " '$directive'") if !exists($desc{$directive}); } foreach my $directive ('unitwidth', 'res', 'sizescale') { - my $val=$desc{$directive}; - Die("device description file 'DESC' directive '$directive'" - . " value must be positive; got '$val'") - if ($val !~ m/^\d+$/ or $val <= 0); +my $val=$desc{$directive}; +Die("device description file 'DESC' directive '$directive'" +. " value must be positive; got '$val'") +if ($val !~ m/^\d+$/ or $val <= 0); } if (exists($desc{'hor'})) { - my $hor=$desc{'hor'}; - Die("device horizontal motion quantum must be 1, got '$hor'") - if ($hor != 1); +my $hor=$desc{'hor'}; +Die("device horizontal motion quantum must be 1, got '$hor'") +if ($hor != 1); } if (exists($desc{'vert'})) { - my $vert=$desc{'vert'}; - Die("dev
[groff] 01/01: [gropdf]: Changes to BuildFoundries.
deri pushed a commit to branch master in repository groff. commit 4ae4aeb6555f4f16c28fcb03eb1f56577826054c Author: Deri James AuthorDate: Fri Jun 10 21:13:24 2022 +0100 [gropdf]: Changes to BuildFoundries. * font/devpdf/util/BuildFoundries.pl: Collect search paths into an array rather than a colon delimited string, this allows the @PATH_SEPARATOR@ character (':' or ';') to be used to delimit paths yielded by the command 'gs -h' but still use ':' to delimit paths in the Foundry file. This means the same Foundry file can be used on all systems. * font/devpdf/Foundry.in: Add more likely paths to find the URW fonts. --- ChangeLog | 14 font/devpdf/Foundry.in | 2 +- font/devpdf/util/BuildFoundries.pl | 153 - 3 files changed, 98 insertions(+), 71 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce454eb9..0cc3bfb4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2022-06-10 Deri James + + [gropdf]: Changes to BuildFoundries. + + * font/devpdf/util/BuildFoundries.pl: Collect search paths into + an array rather than a colon delimited string, this allows + the @PATH_SEPARATOR@ character (':' or ';') to be used to + delimit paths yielded by the command 'gs -h' but still use ':' + to delimit paths in the Foundry file. This means the same + Foundry file can be used on all systems. + + * font/devpdf/Foundry.in: Add more likely paths to find the URW + fonts. + 2022-06-09 G. Branden Robinson [build]: Weaken dependency on TeX, instead using it (to generate diff --git a/font/devpdf/Foundry.in b/font/devpdf/Foundry.in index beab4221..4aa52303 100644 --- a/font/devpdf/Foundry.in +++ b/font/devpdf/Foundry.in @@ -72,7 +72,7 @@ EURO|N*../devps/freeeuro.pfa # URW fonts are typically shipped with Ghostscript, but can be replaced. #Foundry|Name|Search path -foundry|U|(gs):@urwfontsdir@:/usr/share/fonts/type1/gsfonts:/opt/local/share/fonts/urw-fonts +foundry|U|@urwfontsdir@:/usr/share/fonts/type1/gsfonts:/usr/share/fonts/default/Type1:/usr/share/fonts/default/Type1/adobestd35:/usr/share/fonts/type1/urw-base35:/opt/local/share/fonts/urw-fonts:(gs) # Define flags for afmtodit. diff --git a/font/devpdf/util/BuildFoundries.pl b/font/devpdf/util/BuildFoundries.pl index 33ec7add..9bf6fb0e 100644 --- a/font/devpdf/util/BuildFoundries.pl +++ b/font/devpdf/util/BuildFoundries.pl @@ -33,7 +33,8 @@ GetOptions("check" => \$check, "dirURW=s" => \$dirURW); (my $progname = $0) =~s @.*/@@; my $where=shift||''; -my $devps=shift||'../devps'; +my @d=(split(':',shift||'../devps')); +my $devps=\@d; chdir $where if $where ne ''; my (%flg,@downloadpreamble,%download); my $GSpath=FindGSpath(); @@ -59,7 +60,7 @@ exit 0; sub LoadFoundry { my $fn=shift; -my $foundrypath=''; +my $foundrypath; $notFoundFont=0; open(F,"<$fn") or Die("file '$fn' not found or not readable"); @@ -85,12 +86,18 @@ sub LoadFoundry if (lc($r[0]) eq 'foundry') { - Warn("\nThe path(s) used for searching:\n$foundrypath\n") if $notFoundFont; + Warn("\nThe path(s) used for searching:\n".join(':',$foundrypath)."\n") if $notFoundFont; $foundry=uc($r[1]); - $foundrypath=''; - $foundrypath.="$dirURW:" if $dirURW; - $foundrypath.=$r[2].':'.$devps; - $foundrypath=~s/\(gs\)/$GSpath/; + $foundrypath=[]; + push(@{$foundrypath},$dirURW) if $dirURW; + push(@{$foundrypath},(split(':',$r[2])),@{$devps}); + foreach my $j (0..$#{$foundrypath}) + { + if ($foundrypath->[$j]=~m'\s*\(gs\)') + { + splice(@{$foundrypath},$j,1,@{$GSpath}); + } + } $notFoundFont=0; } else @@ -159,7 +166,7 @@ sub LoadFoundry } close(F); -Warn("\nThe path(s) used for searching:\n$foundrypath\n") if $notFoundFont; +Warn("\nThe path(s) used for searching:\n".join(':',$foundrypath)."\n") if $notFoundFont; } sub RunAfmtodit @@ -238,68 +245,66 @@ sub LocateFile my $tryafm=shift; return(substr($files,1)) if substr($files,0,1) eq '*'; -foreach my $file (split('!',$files)) +foreach my $p (@{$path}) { -if ($tryafm) +next if !defined($p) or $p eq ';' or $p eq ':'; +$p=~s/^\s+//; +$p=~s/\s+$//; + +next if $p=~m/^\%rom\%/; # exclude %rom% paths (from (gs)) + +foreach my $file (reverse(split('!',$files))) { -if (!($file=~s/\..+$/.afm/)) +if ($tryafm) { -# no extenaion -$file.='.afm'; +
[groff] 01/01: [gropdf]: fails to deal with 255th glyph in font.
deri pushed a commit to branch master in repository groff. commit 17b5fff1eece9161036e50017dc6ef387e8fad1b Author: Deri James AuthorDate: Mon Apr 11 23:32:50 2022 +0100 [gropdf]: fails to deal with 255th glyph in font. Savannah bug #62294 * src/devices/gropdf/gropdf.pl: a pdf font can only contain 255 glyphs. The array which holds the glyph names also holds the start position (zero) as first element, it is legal for it to contain 256 elements, so truncate to 256 (not 255). --- ChangeLog| 10 ++ src/devices/gropdf/gropdf.pl | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf5e5a42..01cc952c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2022-04-11 Deri James + + [gropdf] fails to deal with 255th glyph in font. + Savannah bug #62294 + + * src/devices/gropdf/gropdf.pl: a pdf font can only contain 255 + glyphs. The array which holds the glyph names also holds the + start position (zero) as first element, it is legal for it to + contain 256 elements, so truncate to 256 (not 255). + 2022-04-09 G. Branden Robinson [localization]: Define hyphenation mode registers for Japanese diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index e3a3a28e..4162608b 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -418,7 +418,7 @@ foreach my $fontno (sort keys %fontlst) push(@{$o->{DIFF}},$psname); push(@{$o->{WIDTH}},$wid); - last if $#{$o->{DIFF}} >= 255; + last if $#{$o->{DIFF}} >= 256; } unshift(@{$o->{DIFF}},0); my $p=GetObj($fontlst{$fontno}->{OBJ}); @@ -426,8 +426,8 @@ foreach my $fontno (sort keys %fontlst) if (exists($p->{LastChar}) and $p->{LastChar} > 255) { $p->{LastChar} = 255; - splice(@{$o->{DIFF}},256); - splice(@{$o->{WIDTH}},256); + splice(@{$o->{DIFF}},257); + splice(@{$o->{WIDTH}},257); } } ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Allow multiline text in .pdfinfo
deri pushed a commit to branch master in repository groff. commit 392f88f843c51c59f6dfe6c3bdc4731cd738ddd7 Author: Deri James AuthorDate: Wed Jan 26 00:17:47 2022 + Allow multiline text in .pdfinfo * src/devices/gropdf/gropdf.pl: Use either 'n' or '\[u000a]' as line separators in the string. --- ChangeLog| 7 +++ src/devices/gropdf/gropdf.pl | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 910c0d0f..f90bc512 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2022-01-26 Deri James + + [gropdf]: Allow multiline text in .pdfinfo + + * src/devices/gropdf/gropdf.pl: Use either 'n' or + '\[u000a]' as line separators in the string. + 2022-01-24 G. Branden Robinson [man pages]: Ship compilations in UTF-8 text and PDF. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 8c4b52a7..e3a3a28e 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -875,10 +875,11 @@ sub do_x my $pdfmark=$1; $pdfmark=~s((\d{4,6}) u)(sprintf("%.1f",$1/$desc{sizescale}))eg; $pdfmark=~s(\\\[u00(..)\])(chr(hex($1)))eg; +$pdfmark=~s/\\n/\n/g; - if ($pdfmark=~m/(.+) \/DOCINFO\s*$/) + if ($pdfmark=~m/(.+) \/DOCINFO\s*$/s) { - my @xwds=split(' ',"<< $1 >>"); + my @xwds=split(/ /,"<< $1 >>"); my $docinfo=ParsePDFValue(\@xwds); foreach my $k (sort keys %{$docinfo}) ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 02/02: [gropdf]: Fix Savannah #61908
deri pushed a commit to branch master in repository groff. commit 1307a645ca75217f1f287dffe3f9afb8f505a64d Author: Deri James AuthorDate: Mon Jan 24 14:39:55 2022 + [gropdf]: Fix Savannah #61908 * src/devices/gropdf/gropdf.pl: Adjust text position when given landscape media (i.e -P-l). Fixes <https://savannah.gnu.org/bugs/?61908>. Problem found and patch supplied by KUBO Koichi. --- ChangeLog| 16 src/devices/gropdf/gropdf.pl | 7 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e142662a..39e6a96b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2022-01-24 Deri James + + [gropdf]: Fix Savannah #61908 + + * src/devices/gropdf/gropdf.pl: Adjust text position when + given landscape media (i.e -P-l). + + Fixes <https://savannah.gnu.org/bugs/?61908>. + + Problem found and patch supplied by KUBO Koichi. + +2022-01-24 Deri James + + * src/devices/gropdf/gropdf.pl: A fix to importing pdf + versions > 1.4. + 2022-01-21 G. Branden Robinson [pdfpic]: Fix Savannah #58206. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index e3958bb1..8c4b52a7 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -797,7 +797,12 @@ sub do_x IsGraphic(); my ($curangle,$hyp)=RtoP($xpos,GraphY($ypos)); my ($x,$y)=PtoR($theta+$curangle,$hyp); - $stream.="q\n".sprintf("%.3f %.3f %.3f %.3f %.3f %.3f cm",cos($theta),sin($theta),-sin($theta),cos($theta),$xpos-$x,GraphY($ypos)-$y)."\n"; + my ($tx, $ty) = ($xpos - $x, GraphY($ypos) - $y); + if ($frot) { + ($tx, $ty) = ($tx * sin($theta) + $ty * -cos($theta), + $tx * -cos($theta) + $ty * -sin($theta)); + } + $stream.="q\n".sprintf("%.3f %.3f %.3f %.3f %.3f %.3f cm",cos($theta),sin($theta),-sin($theta),cos($theta),$tx,$ty)."\n"; $InPicRotate=1; } elsif ($par=~m/exec grestore/ and $InPicRotate) ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/02: gropdf.pl: A fix to importing pdf versions > 1.4.
deri pushed a commit to branch master in repository groff. commit c5e1a36b43dcd434452161952a9e80741b4f997c Author: Deri James AuthorDate: Mon Jan 24 14:03:12 2022 + gropdf.pl: A fix to importing pdf versions > 1.4. --- src/devices/gropdf/gropdf.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index d09a9376..e3958bb1 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -1692,7 +1692,7 @@ sub LoadPDF $pdf->[$curobj]=undef; } -$root=$curobj if ref($o->{OBJ}) eq 'HASH' and exists($o->{OBJ}->{Type}) and $o->{OBJ}->{Type} eq '/XRef'; +$root=$curobj if ref($pdf->[$curobj]->{OBJ}) eq 'HASH' and exists($pdf->[$curobj]->{OBJ}->{Type}) and $pdf->[$curobj]->{OBJ}->{Type} eq '/XRef'; } elsif ($wd eq 'trailer' and !exists($pdf->[0]->{OBJ})) { ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: * src/devices/gropdf/gropdf.pl: Fixes to importing pdf versions > 1.4.
deri pushed a commit to branch master in repository groff. commit 9064999adde2250851d8b66205f8eccad6c502b9 Author: Deri James AuthorDate: Tue Nov 16 11:53:07 2021 + * src/devices/gropdf/gropdf.pl: Fixes to importing pdf versions > 1.4. --- ChangeLog| 5 + src/devices/gropdf/gropdf.pl | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48a0429..e20bd70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2021-11-16 Deri James + + * src/devices/gropdf/gropdf.pl: Fixes to importing pdf versions + > 1.4. + 2021-11-13 G. Branden Robinson * src/preproc/tbl/table.cpp (table::do_vspan): Fix code style diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index ac333a8..d09a937 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -1652,6 +1652,7 @@ sub LoadPDF } } + s/%.*?$//; $pdftxt.=$_.' '; } @@ -1673,7 +1674,7 @@ sub LoadPDF $pdf->[$curobj]->{OBJ}=ParsePDFObj(\@pdfwds); my $o=$pdf->[$curobj]; -if (ref($o->{obj}) eq "HASH" and exists($o->{OBJ}->{Type}) and $o->{OBJ}->{Type} eq '/ObjStm') +if (ref($o->{OBJ}) eq 'HASH' and exists($o->{OBJ}->{Type}) and $o->{OBJ}->{Type} eq '/ObjStm') { LoadStream($o,$pdf); my $pos=$o->{OBJ}->{First}; @@ -1691,7 +1692,7 @@ sub LoadPDF $pdf->[$curobj]=undef; } -$root=$curobj if ref($o->{obj}) eq "HASH" and exists($pdf->[$curobj]->{OBJ}->{Type}) and $pdf->[$curobj]->{OBJ}->{Type} eq '/XRef'; +$root=$curobj if ref($o->{OBJ}) eq 'HASH' and exists($o->{OBJ}->{Type}) and $o->{OBJ}->{Type} eq '/XRef'; } elsif ($wd eq 'trailer' and !exists($pdf->[0]->{OBJ})) { ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Handle pdfs > v1.4 loaded by \X'pdf: pdfpic.
deri pushed a commit to branch master in repository groff. commit 7a5d3ee0974568265901edff398dc20466df2ab5 Author: Deri James AuthorDate: Sun Oct 10 19:34:32 2021 +0100 Handle pdfs > v1.4 loaded by \X'pdf: pdfpic. * src/devices/gropdf/gropdf.pl: Improve loading of pdfs above version 1.4, i.e. handle compressed nodes in /ObjStm. Also improve code in \X'pdf: import'. --- ChangeLog| 8 src/devices/gropdf/gropdf.pl | 94 ++-- 2 files changed, 73 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index f56cd1d..338d58a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2021-10-10 Deri James + Handle pdfs > v1.4 loaded by \X'pdf: pdfpic. + + * src/devices/gropdf/gropdf.pl: Improve loading of pdfs above + version 1.4, i.e. handle compressed nodes in /ObjStm. Also improve + code in \X'pdf: import'. + +2021-10-10 Deri James + Add new background boxes to gropdf. * src/devices/gropdf/gropdf.pl: New \X'pdf background' command. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 3374d07..ac333a8 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -1015,8 +1015,8 @@ sub do_x my $lly=$xprm[4]; my $urx=$xprm[5]; my $ury=$xprm[6]; - my $wid=$xprm[7]; - my $hgt=$xprm[8]||-1; + my $wid=GetPoints($xprm[7]); + my $hgt=GetPoints($xprm[8])||-1; my $mat=[1,0,0,1,0,0]; if (!exists($incfil{$fil})) @@ -1101,11 +1101,11 @@ sub do_x if ($flag eq '-C' and $ll > $wid) { - $xpos=int(($ll-$wid)/2); + $xpos+=int(($ll-$wid)/2); } elsif ($flag eq '-R' and $ll > $wid) { - $xpos=$ll-$wid; + $xpos+=$ll-$wid; } $ypos+=$hgt; @@ -1275,16 +1275,16 @@ sub do_x else { $bgstack[$sptr]->[5]=GraphY($ypos); -$bgbox=DrawBox(pop(@bgstack)).$bgbox; -} + $bgbox=DrawBox(pop(@bgstack)).$bgbox; } } + } elsif (lc($type) eq 'footnote') { my $t=GetPoints($xprm[0]); $boxmax=($t<0)?abs($t):GraphY($t); } -else + else { my $bgtype=0; @@ -1320,12 +1320,12 @@ sub do_x } else { - push(@bgstack,[$bgtype,$strkcol,$fillcol,$bg,GraphY($ypos),GraphY($bg[3]||0),$bgwt || 0.4]); -} + push(@bgstack,[$bgtype,$strkcol,$fillcol,$bg,GraphY($ypos),GraphY($bg[3]||0),$bgwt || 0.4]); } } } } + } elsif (lc(substr($xprm[0],0,9)) eq 'papersize') { my ($px,$py)=split(',',substr($xprm[0],10)); @@ -1661,6 +1661,7 @@ sub LoadPDF # $pdftxt=~s/\]/ \]/g; my (@pdfwds)=split(' ',$pdftxt); my $wd; +my $root; while ($wd=nextwd(\@pdfwds),length($wd)) { @@ -1670,6 +1671,27 @@ sub LoadPDF shift(@pdfwds); shift(@pdfwds); unshift(@pdfwds,$1) if defined($1) and length($1); $pdf->[$curobj]->{OBJ}=ParsePDFObj(\@pdfwds); +my $o=$pdf->[$curobj]; + +if (ref($o->{obj}) eq "HASH" and exists($o->{OBJ}->{Type}) and $o->{OBJ}->{Type} eq '/ObjStm') +{ +LoadStream($o,$pdf); +my $pos=$o->{OBJ}->{First}; +my $s=$o->{STREAM}; +my @o=split(' ',substr($s,0,$pos)); +substr($s,0,$pos)=''; +push(@o,-1,length($s)); + +for (my $j=0; $j<=$#o-2; $j+=2) +{ +my @w=split(' ',substr($s,$o[$j+1],$o[$j+3]-$o[$j+1])); +$pdf->[$o[$j]]->{OBJ}=ParsePDFObj(\@w); +} + +$pdf->[$curobj]=undef; +} + +$root=$curobj if ref($o->{obj}) eq "HASH" and exists($pdf->[$curobj]->{OBJ}->{Type}) and $pdf->[$curobj]->{OBJ}->{Type} eq '/XRef'; } elsif ($wd eq 'trailer' and !exists($pdf->[0]->{OBJ})) { @@ -1681,6 +1703,7 @@ sub LoadPDF } } +$pdf->[0]=$pdf->[$root] if !defined($pdf->[0]); my $catalog=${$pdf->[0]->{OBJ}->{Root}}; my $page=FindPage(1,$pdf);
[groff] 01/01: Add new background boxes to gropdf.
deri pushed a commit to branch master in repository groff. commit fedbf6ff9d3b84320b88c3a0ec8c951d6c07623a Author: Deri James AuthorDate: Sun Oct 10 14:39:24 2021 +0100 Add new background boxes to gropdf. * src/devices/gropdf/gropdf.pl: New \X'pdf background' command. * tmac/pdf.tmac: Covenience command .pdfbackground added. * contrib/sboxes/: Files which demonstrate use of background boxes using -ms macros. --- ChangeLog | 9 ++ Makefile.am | 1 + contrib/sboxes/msboxes.ms | 287 contrib/sboxes/sboxes.am| 39 ++ contrib/sboxes/sboxes.tmac | 116 src/devices/gropdf/gropdf.1.man | 50 +++ src/devices/gropdf/gropdf.pl| 142 +++- tmac/pdf.tmac | 9 ++ 8 files changed, 652 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 96ab4e7..f56cd1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2021-10-10 Deri James + + Add new background boxes to gropdf. + + * src/devices/gropdf/gropdf.pl: New \X'pdf background' command. + * tmac/pdf.tmac: Covenience command .pdfbackground added. + * contrib/sboxes/: Files which demonstrate use of background + boxes using -ms macros. + 2021-10-09 G. Branden Robinson [tests]: Fix portability problems in 2 tests. diff --git a/Makefile.am b/Makefile.am index e139081..e59b9ee 100644 --- a/Makefile.am +++ b/Makefile.am @@ -654,6 +654,7 @@ include $(top_srcdir)/contrib/mom/mom.am include $(top_srcdir)/contrib/pdfmark/pdfmark.am include $(top_srcdir)/contrib/pic2graph/pic2graph.am include $(top_srcdir)/contrib/rfc1345/rfc1345.am +include $(top_srcdir)/contrib/sboxes/sboxes.am include $(top_srcdir)/doc/doc.am include $(top_srcdir)/font/devX100/devX100.am include $(top_srcdir)/font/devX100-12/devX100-12.am diff --git a/contrib/sboxes/msboxes.ms b/contrib/sboxes/msboxes.ms new file mode 100644 index 000..e715c7e --- /dev/null +++ b/contrib/sboxes/msboxes.ms @@ -0,0 +1,287 @@ +.nr LL 17c +.nr LT \n[LL] +.nr PO 2c +.nr PS 11 +.nr VS 13 +.nr PI 3.5n +.nr HM 2c +.nr FM 2c +.nr QI 7n +.\" .nr PD 7p +.ll 17c +.po 2c +.\" .RP no +.ND March 2021 +.EH '%''March 2021' +.EF +.OH 'Using PDF boxes with the \f[I]ms\f[] macros''%' +.OF +.TL +Using PDF boxes with the \f[I]ms\f[] macros +.AU +Deri James +.AI +d...@chuzzlewit.myzen.co.uk +.\" .AB no +.ds FAM H +.LP +A recent extension to the Groff PDF driver allows coloured rectangles to be +created beneath any output created by groff. The extension is a new "\eX'pdf:'" +command (with a convenience command +.B pdfbackground +with the same parameters):- +.QS +.BoxStart SHADED cornsilk OUTLINED brown INDENT 2n WEIGHT 1p +\M[floralwhite]\c +.pdfbackground pagefill +\M[]\c +.B +\eX'pdf: background +.BI +cmd left top right bottom weight' +.br +.B .pdfbackground +.BI +cmd left top right bottom weight' +.LP +Where:- +.IP cmd 7n +Can be any of "page|fill|box" in combination. So "pagefill" would draw a +rectangle which covers whole current page size (in which case the rest of the +parameters can be omitted because the box dimensions are taken from the +current media size). "boxfill", on the other hand, requires the given +dimensions to place the box. Including "fill" in the command will make the +rectangle filled with the current background colour "\eM[colour]" and including +"box" will give the rectangle a border in the current stroke colour +"\em[colour]". +.sp \n[PD]u +The "cmd" may also be "off", on its own, which will terminate drawing the +current box. If you have specified a page colour +with +.B ".pdfbackground pagefill +it is always the first box in the stack, and if +you specify it again it will replace the first entry. Be aware that the +pagefill box renders the page opaque so tools which "watermark" pdf pages are +unlikely to be successful. To return the background to transparent do a +.B ".pdfbackground off +with no other boxes open +.sp \n[PD]u +Finally the command may be "footnote" followed by a new value for "bottom" +which will be used for all current boxes, just for the current page. This is +to allow room for footnotes which grow during the page.\m[red]\**\m[] +.FS +If the value is negative it is used as an offset from the bottom of the page. +.FE +.LP +.IP left +.IP top +.IP right +.IP bottom 7n +Are the coordinates of the box. The "top" and "bottom" coordinates are +the minimum and maximum for the box, since the actual start of the +box is the vertical position of groff when you issue the command and the bottom of +the box is the point where you turn the box "off". The top and bottom +coordinates are only used if the box drawing extends onto the next page, so, +ordinaril
[groff] 01/01: Changes to the ghostscript fontnames (9.53.3).
deri pushed a commit to branch master in repository groff. commit 56778b6dd3ba8d18105230dfe19fcfb6ae8fc5a3 Author: Deri James AuthorDate: Sat Mar 27 12:03:48 2021 + Changes to the ghostscript fontnames (9.53.3). * font/devpdf/Foundry.in: HI and HBI switch to using Italic rather than Oblique. --- ChangeLog | 7 +++ font/devpdf/Foundry.in | 12 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c992925..7957512 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2021-03-27 Deri James + + Changes to the ghostscript fontnames (9.53.3). + + * font/devpdf/Foundry.in: HI and HBI switch to using + Italic rather than Oblique. + 2021-03-24 G. Branden Robinson * doc/groff.texi (Manipulating Filling and Adjustment): diff --git a/font/devpdf/Foundry.in b/font/devpdf/Foundry.in index 3dce15b..916833e 100644 --- a/font/devpdf/Foundry.in +++ b/font/devpdf/Foundry.in @@ -38,8 +38,8 @@ CBI|YNimbusMonoPS-BoldItalic.t1!NimbusMonoPS-BoldItalic!NimbusMonL-BoldObli! CI|YNimbusMonoPS-Italic.t1!NimbusMonoPS-Italic!NimbusMonL-ReguObli!n022023l.pfb CR|YNimbusMonoPS-Regular.t1!NimbusMonoPS-Regular!NimbusMonL-Regu!n022003l.pfb HB|YNimbusSans-Bold.t1!NimbusSans-Bold!NimbusSanL-Bold!n019004l.pfb -HBI|YNimbusSans-BoldOblique.t1!NimbusSans-BoldOblique!NimbusSanL-BoldItal!n019024l.pfb -HI|YNimbusSans-Oblique.t1!NimbusSans-Oblique!NimbusSanL-ReguItal!n019023l.pfb +HBI|YNimbusSans-BoldItalic!NimbusSans-BoldOblique.t1!NimbusSans-BoldOblique!NimbusSanL-BoldItal!n019024l.pfb +HI|YNimbusSans-Italic!NimbusSans-Oblique.t1!NimbusSans-Oblique!NimbusSanL-ReguItal!n019023l.pfb HNB|NNimbusSansNarrow-Bold.t1!NimbusSansNarrow-Bold!NimbusSanL-BoldCond!n019044l.pfb HNBI|NNimbusSansNarrow-BoldOblique.t1!NimbusSansNarrow-BoldOblique!NimbusSansNarrow-BdOblique!NimbusSanL-BoldCondItal.t1!NimbusSanL-BoldCondItal!n019064l.pfb HNI|NNimbusSansNarrow-Oblique.t1!NimbusSansNarrow-Oblique!NimbusSanL-ReguCondItal!n019063l.pfb @@ -59,7 +59,7 @@ TBI|YNimbusRoman-BoldItalic.t1!NimbusRoman-BoldItalic!NimbusRomNo9L-MediItal TI|YNimbusRoman-Italic.t1!NimbusRoman-Italic!NimbusRomNo9L-ReguItal!n021023l.pfb TR|YNimbusRoman-Regular.t1!NimbusRoman-Regular!NimbusRomNo9L-Regu!n021003l.pfb ZCMI|NZ003-MediumItalic.t1!Z003-MediumItalic!URWChanceryL-MediItal!z003034l.pfb -ZD|YD05L.t1!Dingbats!d05l.pfb +ZD|YD05L!D05L.t1!Dingbats!d05l.pfb EURO|N*../devps/freeeuro.pfa #== @@ -87,8 +87,8 @@ CBI|N|ni|textmap|text.enc|NimbusMonoPS-BoldItalic.t1!NimbusMonoPS-BoldItalic!Nim CI|N|ni|textmap|text.enc|NimbusMonoPS-Italic.t1!NimbusMonoPS-Italic!NimbusMonL-ReguObli!n022023l.pfb CR|N|nr|textmap|text.enc|NimbusMonoPS-Regular.t1!NimbusMonoPS-Regular!NimbusMonL-Regu!n022003l.pfb HB|N|r|textmap|text.enc|NimbusSans-Bold.t1!NimbusSans-Bold!NimbusSanL-Bold!n019004l.pfb -HBI|N|i|textmap|text.enc|NimbusSans-BoldItalic.t1!NimbusSans-BoldOblique!NimbusSanL-BoldItal!n019024l.pfb -HI|N|i|textmap|text.enc|NimbusSans-Italic.t1!NimbusSans-Oblique!NimbusSanL-ReguItal!n019023l.pfb +HBI|N|i|textmap|text.enc|NimbusSans-BoldItalic!NimbusSans-BoldItalic.t1!NimbusSans-BoldOblique!NimbusSanL-BoldItal!n019024l.pfb +HI|N|i|textmap|text.enc|NimbusSans-Italic!NimbusSans-Italic.t1!NimbusSans-Oblique!NimbusSanL-ReguItal!n019023l.pfb HNB|N|r|textmap|text.enc|NimbusSansNarrow-Bold.t1!NimbusSansNarrow-Bold!NimbusSanL-BoldCond!n019044l.pfb HNBI|N|i|textmap|text.enc|NimbusSansNarrow-BoldOblique.t1!NimbusSansNarrow-BoldOblique!NimbusSansNarrow-BdOblique!NimbusSanL-BoldCondItal.t1!NimbusSanL-BoldCondItal!n019064l.pfb HNI|N|i|textmap|text.enc|NimbusSansNarrow-Oblique.t1!NimbusSansNarrow-Oblique!NimbusSanL-ReguCondItal!n019063l.pfb @@ -108,6 +108,6 @@ TBI|N|i|textmap|text.enc|NimbusRoman-BoldItalic.t1!NimbusRoman-BoldItalic!Nimbus TI|N|i|textmap|text.enc|NimbusRoman-Italic.t1!NimbusRoman-Italic!NimbusRomNo9L-ReguItal!n021023l.pfb TR|N|r|textmap|text.enc|NimbusRoman-Regular.t1!NimbusRoman-Regular!NimbusRomNo9L-Regu!n021003l.pfb ZCMI|N|i|textmap|text.enc|Z003-MediumItalic.t1!Z003-MediumItalic!URWChanceryL-MediItal!z003034l.pfb -ZD|N|sr|dingbats.map||D05L.t1!Dingbats!d05l.pfb +ZD|N|sr|dingbats.map||D05L!D05L.t1!Dingbats!d05l.pfb #== ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Certain pdfmark destination names caused gropdf to fail.
deri pushed a commit to branch master in repository groff. commit 800b0197ea8b2dcaee5b22e890f5dbea22b8d250 Author: Deri James Date: Mon Dec 30 17:37:48 2019 + Certain pdfmark destination names caused gropdf to fail. * src/devices/gropdf/gropdf.pl: Look for pdfmark types, (i.e. DEST, OUT, ANN), only preceding 'pdfmark' at end of line, not anywhere else. --- ChangeLog| 8 src/devices/gropdf/gropdf.pl | 10 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index baead25..b3946d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2019-12-30 Deri James + + Certain pdfmark destination names caused gropdf to fail. + + * src/devices/gropdf/gropdf.pl: Look for pdfmark types, (i.e. + DEST, OUT, ANN), only preceding 'pdfmark' at end of line, not + anywhere else. + 2019-12-30 Ingo Schwarze Correct output of sprintf("%%") in pic(1). diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index cfe5a93..6370ab5 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -842,7 +842,7 @@ sub do_x $pdfmark=~s((\d{4,6}) u)(sprintf("%.1f",$1/$desc{sizescale}))eg; $pdfmark=~s(\\\[u00(..)\])(chr(hex($1)))eg; - if ($pdfmark=~m/(.+) \/DOCINFO/) + if ($pdfmark=~m/(.+) \/DOCINFO\s*$/) { my @xwds=split(' ',"<< $1 >>"); my $docinfo=ParsePDFValue(\@xwds); @@ -852,7 +852,7 @@ sub do_x $info{$k}=$docinfo->{$k} if $k ne 'Producer'; } } - elsif ($pdfmark=~m/(.+) \/DOCVIEW/) + elsif ($pdfmark=~m/(.+) \/DOCVIEW\s*$/) { my @xwds=split(' ',"<< $1 >>"); my $docview=ParsePDFValue(\@xwds); @@ -862,7 +862,7 @@ sub do_x $cat->{$k}=$docview->{$k} if !exists($cat->{$k}); } } - elsif ($pdfmark=~m/(.+) \/DEST/) + elsif ($pdfmark=~m/(.+) \/DEST\s*$/) { my @xwds=split(' ',"<< $1 >>"); my $dest=ParsePDFValue(\@xwds); @@ -881,7 +881,7 @@ sub do_x my $k=substr($dest->{Dest},1); $dests->{$k}=$dest->{View}; } - elsif ($pdfmark=~m/(.+) \/ANN/) + elsif ($pdfmark=~m/(.+) \/ANN\s*$/) { my $l=$1; $l=~s/Color/C/; @@ -896,7 +896,7 @@ sub do_x FixPDFColour($annot->{DATA}); push(@PageAnnots,$annotno); } - elsif ($pdfmark=~m/(.+) \/OUT/) + elsif ($pdfmark=~m/(.+) \/OUT\s*$/) { my $t=$1; $t=~s/\\\) /\) /g; ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Update man page of gropdf to document \X calls.
deri pushed a commit to branch master in repository groff. commit 14c4fd87810427f1240a18c69ef63414087de028 Author: Deri James Date: Sun Dec 29 22:16:17 2019 + Update man page of gropdf to document \X calls. * src/devices/gropdf/gropdf.1.man: The calls 'pagname' and 'switchtopage' (used by mom to relocate TOC) are documented, together with their convenience commands '.pdfpagename' and '.pdfswitchtopage'. --- ChangeLog | 9 + src/devices/gropdf/gropdf.1.man | 31 +++ 2 files changed, 40 insertions(+) diff --git a/ChangeLog b/ChangeLog index 90792bd..e5c11e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2019-12-29 Deri James + + Update man page of gropdf to document \X calls. + + * src/devices/gropdf/gropdf.1.man: The calls 'pagname' and + 'switchtopage' (used by mom to relocate TOC) are documented, + together with their convenience commands '.pdfpagename' and + '.pdfswitchtopage'. + 2019-12-29 Ingo Schwarze Improve documentation of pic(1) regarding printf. diff --git a/src/devices/gropdf/gropdf.1.man b/src/devices/gropdf/gropdf.1.man index af64137..51dd312 100644 --- a/src/devices/gropdf/gropdf.1.man +++ b/src/devices/gropdf/gropdf.1.man @@ -881,6 +881,37 @@ respectively. These macros must only be used within page traps.) . .TP +.BI "\[rs]X'pdf: pagename " name +This gives the current page a +.IR name . +.IP +There are two default names for any document which do not need to +be declared +.IR \[oq]top\[cq] " and " \[oq]bottom\[cq] . +.IP +The convenience command for this is +.BR .pdfpagename . +. +.TP +.BI "\[rs]X'pdf: switchtopage " "when name" +Normally each new page is appended to the end of the document, this command +allows following pages to be inserted at a +.I \[oq]named\[cq] +position within the document (see pagename command above). +.I \[oq]when\[cq] +can be either +.IR \[oq]after\[cq] " or " \[oq]before\[cq] . +If it is ommitted it defaults to +.I \[oq]before\[cq]. +.IP +The convenience command for this is +.BR .pdfswitchtopage . +It should be used at the end of the page before you want the switch to happen. +.IP +This allows pages such as a TOC to be moved to elsewhere in the document, but +more esoteric uses are possible. +. +.TP .BR "\[rs]X'pdf: transition'" "feature mode duration dimension motion direction scale bool" where .IP ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 02/03: Add new ghostscript font names
deri pushed a commit to branch master in repository groff. commit ef16d931a451621c14ca5b7706f91bc87797cf50 Author: Deri James Date: Sat Sep 21 16:03:37 2019 +0100 Add new ghostscript font names * font/devpdf/Foundry.in: Add changed font names --- font/devpdf/Foundry.in | 142 - 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/font/devpdf/Foundry.in b/font/devpdf/Foundry.in index 93e9b66..70ff724 100644 --- a/font/devpdf/Foundry.in +++ b/font/devpdf/Foundry.in @@ -25,42 +25,42 @@ foundry||(gs) # These are just copies of the grops fonts so MUST not have any flags etc set #Font|IsBase14|Flags|Map|Encoding|File(!file...) -AB|NURWGothic-Demi!URWGothicL-Demi!a010015l.pfb -ABI|NURWGothic-DemiOblique!URWGothicL-DemiObli!a010035l.pfb -AI|NURWGothic-BookOblique!URWGothicL-BookObli!a010033l.pfb -AR|NURWGothic-Book!URWGothicL-Book!a010013l.pfb -BMB|NURWBookman-Demi!URWBookmanL-DemiBold!b018015l.pfb -BMBI|NURWBookman-DemiItalic!URWBookmanL-DemiBoldItal!b018035l.pfb -BMI|NURWBookman-Light!URWBookmanL-LighItal!b018032l.pfb -BMR|NURWBookman-LightItalic!URWBookmanL-Ligh!b018012l.pfb -CB|YNimbusMonoPS-Bold!NimbusMonL-Bold!n022004l.pfb -CBI|YNimbusMonoPS-BoldItalic!NimbusMonL-BoldObli!n022024l.pfb -CI|YNimbusMonoPS-Italic!NimbusMonL-ReguObli!n022023l.pfb -CR|YNimbusMonoPS-Regular!NimbusMonL-Regu!n022003l.pfb +AB|NURWGothic-Demi.t1!URWGothic-Demi!URWGothicL-Demi!a010015l.pfb +ABI|NURWGothic-DemiOblique.t1!URWGothic-DemiOblique!URWGothicL-DemiObli!a010035l.pfb +AI|NURWGothic-BookOblique.t1!URWGothic-BookOblique!URWGothicL-BookObli!a010033l.pfb +AR|NURWGothic-Book.t1!URWGothic-Book!URWGothicL-Book!a010013l.pfb +BMB|NURWBookman-Demi.t1!URWBookman-Demi!URWBookmanL-DemiBold!b018015l.pfb +BMBI|NURWBookman-DemiItalic.t1!URWBookman-DemiItalic!URWBookmanL-DemiBoldItal!b018035l.pfb +BMI|NURWBookman-Light.t1!URWBookman-Light!URWBookmanL-LighItal!b018032l.pfb +BMR|NURWBookman-LightItalic.t1!URWBookman-LightItalic!URWBookmanL-Ligh!b018012l.pfb +CB|YNimbusMonoPS-Bold.t1!NimbusMonoPS-Bold!NimbusMonL-Bold!n022004l.pfb +CBI|YNimbusMonoPS-BoldItalic.t1!NimbusMonoPS-BoldItalic!NimbusMonL-BoldObli!n022024l.pfb +CI|YNimbusMonoPS-Italic.t1!NimbusMonoPS-Italic!NimbusMonL-ReguObli!n022023l.pfb +CR|YNimbusMonoPS-Regular.t1!NimbusMonoPS-Regular!NimbusMonL-Regu!n022003l.pfb +HB|YNimbusSans-Bold.t1!NimbusSans-Bold!NimbusSanL-Bold!n019004l.pfb +HBI|YNimbusSans-BoldOblique.t1!NimbusSans-BoldOblique!NimbusSanL-BoldItal!n019024l.pfb +HI|YNimbusSans-Oblique.t1!NimbusSans-Oblique!NimbusSanL-ReguItal!n019023l.pfb +HNB|NNimbusSansNarrow-Bold.t1!NimbusSansNarrow-Bold!NimbusSanL-BoldCond!n019044l.pfb +HNBI|NNimbusSansNarrow-BoldOblique.t1!NimbusSansNarrow-BoldOblique!NimbusSansNarrow-BdOblique!NimbusSanL-BoldCondItal.t1!NimbusSanL-BoldCondItal!n019064l.pfb +HNI|NNimbusSansNarrow-Oblique.t1!NimbusSansNarrow-Oblique!NimbusSanL-ReguCondItal!n019063l.pfb +HNR|NNimbusSansNarrow-Regular.t1!NimbusSansNarrow-Regular!NimbusSanL-ReguCond!n019043l.pfb +HR|YNimbusSans-Regular.t1!NimbusSans-Regular!NimbusSans-Regular!NimbusSanL-Regu!n019003l.pfb +NB|NC059-Bold.t1!C059-Bold!CenturySchL-Bold!c059016l.pfb +NBI|NC059-BdIta.t1!C059-BdIta!CenturySchL-BoldItal!c059036l.pfb +NI|NC059-Italic.t1!C059-Italic!CenturySchL-Ital!c059033l.pfb +NR|NC059-Roman.t1!C059-Roman!CenturySchL-Roma!c059013l.pfb +PB|NP052-Bold.t1!P052-Bold!URWPalladioL-Bold!p052004l.pfb +PBI|NP052-BoldItalic.t1!P052-BoldItalic!URWPalladioL-BoldItal!p052024l.pfb +PI|NP052-Italic.t1!P052-Italic!URWPalladioL-Ital!p052023l.pfb +PR|NP052-Roman.t1!P052-Roman!URWPalladioL-Roma!p052003l.pfb +S|YStandardSymbolsPS.t1!StandardSymbolsPS!StandardSymL!s05l.pfb +TB|YNimbusRoman-Bold.t1!NimbusRoman-Bold!NimbusRomNo9L-Medi!n021004l.pfb +TBI|YNimbusRoman-BoldItalic.t1!NimbusRoman-BoldItalic!NimbusRomNo9L-MediItal!n021024l.pfb +TI|YNimbusRoman-Italic.t1!NimbusRoman-Italic!NimbusRomNo9L-ReguItal!n021023l.pfb +TR|YNimbusRoman-Regular.t1!NimbusRoman-Regular!NimbusRomNo9L-Regu!n021003l.pfb +ZCMI|NZ003-MediumItalic.t1!Z003-MediumItalic!URWChanceryL-MediItal!z003034l.pfb +ZD|YD05L.t1!Dingbats!d05l.pfb EURO|N*../devps/freeeuro.pfa -HB|YNimbusSans-Bold!NimbusSanL-Bold!n019004l.pfb -HBI|YNimbusSans-BoldOblique!NimbusSanL-BoldItal!n019024l.pfb -HI|YNimbusSans-Oblique!NimbusSanL-ReguItal!n019023l.pfb -HNB|NNimbusSansNarrow-Bold!NimbusSanL-BoldCond!n019044l.pfb -HNBI|NNimbusSansNarrow-BoldOblique!NimbusSansNarrow-BdOblique!NimbusSanL-BoldCondItal!n019064l.pfb -HNI|NNimbusSansNarrow-Oblique!NimbusSanL-ReguCondItal!n019063l.pfb -HNR|NNimbusSansNarrow-Regular!NimbusSanL-ReguCond!n019043l.pfb -HR|YNimbusSans-Regular!NimbusSans-Regular!NimbusSanL-Regu!n019003l.pfb -NB|NC059-Bold!CenturySchL-Bold!c059016l.pfb -NBI|NC059-BdIta
[groff] 03/03: Changes to allow configure to check for URW fonts
deri pushed a commit to branch master in repository groff. commit f61c6ca5b84b488cbd324f2d23285fff1d807f04 Author: Deri James Date: Sat Sep 21 16:27:05 2019 +0100 Changes to allow configure to check for URW fonts * font/devpdf/util/BuildFoundries.pl: Call the program with --dirURW with path provided to ./configure, and --check to do a dry-run just checking if the fonts are available. (bug #56748) --- ChangeLog | 20 +++ font/devpdf/util/BuildFoundries.pl | 117 - 2 files changed, 123 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index e8f377c..857264a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2019-09-21 Deri James + + Changes to allow configure to check for URW fonts + + * font/devpdf/util/BuildFoundries.pl: Call the program with + --dirURW with path provided to ./configure, and --check to do + a dry-run just checking if the fonts are available. (bug #56748) + +2019-09-21 Deri James + + Add new ghostscript font names (bug #56748) + + * font/devpdf/Foundry.in: Add changed font names + +2019-09-21 Deri James + + Prevent gropdf executing arbitrary commands + + * src/devices/gropdf/gropdf.pl: See bug #7 + 2019-09-15 G. Branden Robinson * tmac/an-old.tmac: Move test for definitions of CS and CT diff --git a/font/devpdf/util/BuildFoundries.pl b/font/devpdf/util/BuildFoundries.pl index f8af826..e4b657d 100644 --- a/font/devpdf/util/BuildFoundries.pl +++ b/font/devpdf/util/BuildFoundries.pl @@ -22,6 +22,12 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. use strict; +use Getopt::Long; + +my $check=0; +my $dirURW=''; + +GetOptions("check" => \$check, "dirURW=s" => \$dirURW); (my $progname = $0) =~s @.*/@@; my $where=shift||''; @@ -32,11 +38,19 @@ my $GSpath=FindGSpath(); my $warn=0; my $lct=0; my $foundry='';# the default foundry +my $notFoundFont=0; -LoadDownload("download"); -LoadFoundry("Foundry"); -WriteDownload("download"); - +if ($check) +{ +CheckFoundry("Foundry.in"); +exit $notFoundFont; +} +else +{ +LoadDownload("download"); +LoadFoundry("Foundry"); +WriteDownload("download"); +} exit 0; @@ -45,7 +59,7 @@ sub LoadFoundry { my $fn=shift; my $foundrypath=''; -my $notFoundFont=0; +$notFoundFont=0; open(F,"<$fn") or Die("No $fn file found"); @@ -72,7 +86,9 @@ sub LoadFoundry { Warn("\nThe path(s) used for searching:\n$foundrypath\n") if $notFoundFont; $foundry=uc($r[1]); - $foundrypath=$r[2].' : '.$devps; +$foundrypath=''; +$foundrypath.="$dirURW : " if $dirURW; + $foundrypath.=$r[2].' : '.$devps; $foundrypath=~s/\(gs\)/$GSpath /; $notFoundFont=0; } @@ -84,13 +100,6 @@ sub LoadFoundry # 3=map file # 4=encoding file # 5=font file - # 6=afm file - - if (!defined($r[6]) or $r[6] eq '') - { - # if no afm file, have a guess! - $r[6]=substr($r[5],0,-3)."afm"; - } my $gfont=($foundry eq '')?$r[0]:"$foundry-$r[0]"; @@ -126,7 +135,7 @@ sub LoadFoundry else { # We need to run afmtodit to create this groff font - my $psfont=RunAfmtodit($gfont,LocateAF($foundrypath,$r[6]),$r[2],$r[3],$r[4]); + my $psfont=RunAfmtodit($gfont,LocateAF($foundrypath,$r[5]),$r[2],$r[3],$r[4]); if ($psfont) { @@ -230,6 +239,15 @@ sub LocateFile foreach my $file (split('!',$files)) { +if ($tryafm) +{ +if (!($file=~s/\..+$/.afm/)) +{ +# no extenaion +$file.='.afm'; +} +} + if ($file=~m'/') { # path given with file name so no need to search the paths @@ -458,3 +476,74 @@ sub Msg { my $msg=shift; print STDERR "$progname: $msg\n"; } + +sub CheckFoundry +{ +my $fn=shift; +my $foundrypath=''; +$notFoundFont=0; + +open(F,"<$fn") or Die("No $fn file found"); + +while () +{ + chomp; + s/\r$//;# in case edited in windows + + s/\s*#.*?$//; # remove comments + + next if $_ eq ''; + + if (m/^[A-Za-z]=/) + { + next; + } + + my (@r)=split('\|'); + + if (lc($r[0]) eq 'foundry') + { + $foundry=uc($r[1]); +$foundrypath=''; +$foundrypath.="$dirURW : " if $dirURW; + $foundrypath.=$r[2].' : '.$devps; + $foundrypath=~s/\(gs\)/$GSpath /; + } +
[groff] 01/03: Prevent gropdf executing arbitrary commands
deri pushed a commit to branch master in repository groff. commit 2fc912f0751320a1fba0094dded38e2df46d1dbe Author: Deri James Date: Sat Sep 21 15:52:54 2019 +0100 Prevent gropdf executing arbitrary commands * src/devices/gropdf/gropdf.pl: See bug #7 --- src/devices/gropdf/gropdf.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 2ec52d0..cfe5a93 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -287,6 +287,7 @@ my %info=('Creator' => "(groff version $cfg{GROFF_VERSION})", 'Producer' => "(gropdf version $cfg{GROFF_VERSION})", 'ModDate' => "($dt)", 'CreationDate' => "($dt)"); +map { $_="< ".$_."\0" } @ARGV; while (<>) { ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Problem running gropdf on big endian (Sparc)
deri pushed a commit to branch master in repository groff. commit 92f40b186aa2adda8039fff09c1246bdd30dbd3d Author: Deri James Date: Sun Dec 9 12:45:45 2018 + Problem running gropdf on big endian (Sparc) * src/devices/gropdf/gropdf.pl: Prior to perl v5.9 the 'L<' template for 'unpack' was unavailable. Solaris 10 uses v5.8.4 so safer to use the template 'V' rather than 'L<'. --- ChangeLog| 9 + src/devices/gropdf/gropdf.pl | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1322f6a..5db9a12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-12-08 Deri James + + Problem running gropdf on big endian (Sparc) + + * src/devices/gropdf/gropdf.pl: Prior to perl v5.9 the 'L<' + template for 'unpack' was unavailable. Solaris 10 uses v5.8.4 + so safer to use the template 'V' rather than 'L<'. + 2018-12-08 Bertrand Garrigues Use gnulib's 'hypot' module. @@ -5,6 +13,7 @@ In 'configure.ac', the macro call 'GROFF_NEED_DECLARATION([hypot])' checks whether the function 'hypot' is correctly declared in 'math.h', but the test is buggy + and may yields false results. * bootsrap.conf: add 'hypot' module. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 6ba05c0..2ec52d0 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -2425,7 +2425,7 @@ sub GetChunk Msg(1,"Failed to read binary segment length"), return if $ct != 4; - my $sl=unpack('L<',$hdr); + my $sl=unpack('V',$hdr); my $data; my $chk=read($F,$data,$sl); ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Problem running gropdf on big endian (Sparc)
deri pushed a commit to branch master in repository groff. commit 2dfd47edd74321fbccd74e9ae4dc70a99d1efb40 Author: Deri James Date: Fri Dec 7 13:24:17 2018 + Problem running gropdf on big endian (Sparc) * src/devices/gropdf/gropdf.pl: When loading a binary (.pfb) font for embedding always use little endian to unpack chunk headers. --- ChangeLog| 8 src/devices/gropdf/gropdf.pl | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ff44953..fc192ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-12-07 Deri James + + Problem running gropdf on big endian (Sparc) + + * src/devices/gropdf/gropdf.pl: When loading a binary (.pfb) + font for embedding always use little endian to unpack chunk + headers. + 2018-12-05 Bertrand Garrigues Skip hdtbl and mom tests if needed config is missing. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index d83568d..6ba05c0 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -2425,7 +2425,7 @@ sub GetChunk Msg(1,"Failed to read binary segment length"), return if $ct != 4; - my $sl=unpack('L',$hdr); + my $sl=unpack('L<',$hdr); my $data; my $chk=read($F,$data,$sl); ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Savannah bug # 54812
deri pushed a commit to branch master in repository groff. commit d03f7e74fe7deeb0a6408f8027d5789ad75c555b Author: Deri James Date: Wed Oct 17 16:18:56 2018 +0100 Savannah bug # 54812 * font/devpdf/util/BuildFoundries.pl: If a font is not found report list of paths searched. Fix https://savannah.gnu.org/bugs/?54812 --- ChangeLog | 9 + font/devpdf/util/BuildFoundries.pl | 8 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2f93f70..487b564 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2018-10-04 Deri James + + Savannah bug # 54812 + + * font/devpdf/util/BuildFoundries.pl: If a font is not found + report list of paths searched. + + Fix https://savannah.gnu.org/bugs/?54812 + 2018-10-10 Bertrand Garrigues Update 'gnulib' submodule. diff --git a/font/devpdf/util/BuildFoundries.pl b/font/devpdf/util/BuildFoundries.pl index fa1a32c..f8af826 100644 --- a/font/devpdf/util/BuildFoundries.pl +++ b/font/devpdf/util/BuildFoundries.pl @@ -45,6 +45,7 @@ sub LoadFoundry { my $fn=shift; my $foundrypath=''; +my $notFoundFont=0; open(F,"<$fn") or Die("No $fn file found"); @@ -69,9 +70,11 @@ sub LoadFoundry if (lc($r[0]) eq 'foundry') { + Warn("\nThe path(s) used for searching:\n$foundrypath\n") if $notFoundFont; $foundry=uc($r[1]); $foundrypath=$r[2].' : '.$devps; $foundrypath=~s/\(gs\)/$GSpath /; + $notFoundFont=0; } else { @@ -107,7 +110,8 @@ sub LoadFoundry { $gotf=0; my $fns=join(',',split('!',$r[5])); - Warn("Unable to locate font(s) $fns on the given path(s)"); + Warn("Unable to locate font(s) $fns"); + $notFoundFont=1; unlink $gfont; # Unable to find the postscript file for the font just created by afmtodit } } @@ -138,12 +142,14 @@ sub LoadFoundry else { Warn("Failed to create groff font '$gfont' by running afmtodit"); + $notFoundFont=1; } } } } close(); +Warn("\nThe path(s) used for searching:\n$foundrypath\n") if $notFoundFont; } sub RunAfmtodit ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Savannah bug # 54779
deri pushed a commit to branch master in repository groff. commit 8f80fd6e9ef0bdc4180cedab8929b1fb34a913be Author: Deri James Date: Thu Oct 4 23:39:51 2018 +0100 Savannah bug # 54779 * font/devpdf/Foundry.in: Recent ghostscript changed name used for embedding groff font HNBI Fix https://savannah.gnu.org/bugs/?54779 --- ChangeLog | 9 + font/devpdf/Foundry.in | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fbbf7d2..3460b91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +02018-10-04 Deri James + + Savannah bug # 54779 + + * font/devpdf/Foundry.in: Recent ghostscript changed name + used for embedding groff font HNBI + + Fix https://savannah.gnu.org/bugs/?54779 + 2018-08-27 Ingo Schwarze * tmac/groff_www.7.man: Do not use .URL, .MTO, .FTP. diff --git a/font/devpdf/Foundry.in b/font/devpdf/Foundry.in index 03eb8de..93e9b66 100644 --- a/font/devpdf/Foundry.in +++ b/font/devpdf/Foundry.in @@ -42,7 +42,7 @@ HB|YNimbusSans-Bold!NimbusSanL-Bold!n019004l.pfb HBI|YNimbusSans-BoldOblique!NimbusSanL-BoldItal!n019024l.pfb HI|YNimbusSans-Oblique!NimbusSanL-ReguItal!n019023l.pfb HNB|NNimbusSansNarrow-Bold!NimbusSanL-BoldCond!n019044l.pfb -HNBI|NNimbusSansNarrow-BdOblique!NimbusSanL-BoldCondItal!n019064l.pfb +HNBI|NNimbusSansNarrow-BoldOblique!NimbusSansNarrow-BdOblique!NimbusSanL-BoldCondItal!n019064l.pfb HNI|NNimbusSansNarrow-Oblique!NimbusSanL-ReguCondItal!n019063l.pfb HNR|NNimbusSansNarrow-Regular!NimbusSanL-ReguCond!n019043l.pfb HR|YNimbusSans-Regular!NimbusSans-Regular!NimbusSanL-Regu!n019003l.pfb ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Fixes to gropdf
deri pushed a commit to branch master in repository groff. commit 7b3fa85e0f2da11f9475d2a36bb1a9608a6a999f Author: Deri James Date: Tue Jul 31 17:44:54 2018 +0100 Fixes to gropdf * src/devices/gropdf/gropdf.pl: Make default line width 0.4pt to match grops. Use 'S' operator (stroke) rather than 's' (close and stroke) when Dl command received. Improve switching between text and graphic modes. --- ChangeLog| 9 + src/devices/gropdf/gropdf.pl | 8 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index df3950d..15c0147 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2018-06-19 Deri James + + Fixes to gropdf + + * src/devices/gropdf/gropdf.pl: Make default line width 0.4pt + to match grops. Use 'S' operator (stroke) rather than 's' (close + and stroke) when Dl command received. Improve switching between + text and graphic modes. + 2018-07-01 Bertrand Garrigues [me] paragraph with umlaut incorrectly rendered diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index a498229..d83568d 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -2562,7 +2562,7 @@ sub NewPage $objct+=1; $cpage=$obj[$cpageno]->{DATA}; $pages->{'Count'}++; -$stream="q 1 0 0 1 0 0 cm\n$linejoin J\n$linecap j\n"; +$stream="q 1 0 0 1 0 0 cm\n$linejoin J\n$linecap j\n0.4 w\n"; $stream.=$strkcol."\n", $curstrk=$strkcol if $strkcol ne ''; $mode='g'; $curfill=''; @@ -2943,7 +2943,7 @@ sub do_D $ypos+=$p[1]; $stream.=PutXY($xpos,$ypos)." l\n"; - $stream.="s\n"; + $stream.="S\n"; $poschg=1; } elsif ($Dcmd eq 't') @@ -3292,7 +3292,7 @@ sub do_v { my $par=shift; -PutLine(); +PutLine() if $mode eq 't'; $ypos+=$par/$unitwidth; @@ -3587,7 +3587,7 @@ sub do_N sub do_n { $gotT=0; -PutLine(); +PutLine(0); $pendmv=$nomove=0; $n_flg=1; @lin=(); ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Add gropdf new features to NEWS file.
deri pushed a commit to branch master in repository groff. commit a3c62d4396f7ac468d41185e03c0d6cbd20fb3db Author: Deri James Date: Tue Jun 19 12:10:09 2018 +0100 Add gropdf new features to NEWS file. * NEWS: new features. --- ChangeLog | 8 +++- NEWS | 15 +++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7903040..fa85365 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2018-06-19 Deri James + + Add gropdf new features to NEWS file. + + * NEWS: new features. + 2018-05-29 Werner LEMBERG [dvi] Fix glyph map for `cmitt10'. @@ -96,7 +102,7 @@ 2018-04-24 Deri James - Restrict scaling factors to 3dp and better handle CR/LF in imoport. + Restrict scaling factors to 3dp and better handle CR/LF in import. * src/devices/gropdf/gropdf.pl: Restrict scaling factors to 3dp rounded. If pdf imported with pdfpic uses CR/LF line termination diff --git a/NEWS b/NEWS index 9cd1750..71af08a 100644 --- a/NEWS +++ b/NEWS @@ -46,6 +46,20 @@ o PDFPIC has now been corrected, so the behaviour is the same whether you postscript driver, only if you used it with the pdf driver. +Gropdf +-- + + o Type 1 font loading fixed to handle newer ghostscript versions. + + o Handling of glyphs above position 255 improved to allow many more glyphs +to be used. + + o New macros .pdftransition and .pdfpause introduced to allow creation of +presentation slides. Partially backward compatible with present.tmac, +specifically the PAUSE, BLOCKS and BLOCKE commands. Supports all the +transition types introduced in PDF v1.5. (See gropdf man page) + + Miscellaneous - @@ -66,6 +80,7 @@ o eqn2graph no longer supports the "-unsafe" option. It did nothing. o groffer now supports the output of XHTML. Use the "--xhtml" or "--mode=xhtml" command-line options to generate it. + VERSION 1.22.3 == ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Restrict scaling factors to 3dp and better handle CR/LF in import.
deri pushed a commit to branch master in repository groff. commit 1041a8139d9b872ba0576a4c5dc36fd789c4ed91 Author: Deri James <d...@chuzzlewit.myzen.co.uk> Date: Tue Apr 24 17:29:40 2018 +0100 Restrict scaling factors to 3dp and better handle CR/LF in import. * src/devices/gropdf/gropdf.pl: Restrict scaling factors to 3dp rounded. If pdf imported with pdfpic uses CR/LF line termination ibclude XObject Image, length of stream out by 1. --- ChangeLog| 8 src/devices/gropdf/gropdf.pl | 22 ++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07cdac2..94aef28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-04-24 Deri James <d...@chuzzlewit.myzen.co.uk> + + Restrict scaling factors to 3dp and better handle CR/LF in imoport. + + * src/devices/gropdf/gropdf.pl: Restrict scaling factors to 3dp + rounded. If pdf imported with pdfpic uses CR/LF line termination + ibclude XObject Image, length of stream out by 1. + 2018-04-23 G. Branden Robinson <g.branden.robin...@gmail.com> man pages: Shorten version footer. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 74f2b3b..f055839 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -1027,8 +1027,11 @@ sub do_x if ($fil=~m/\.pdf$/) { my $bbox=$incfil{$fil}->[1]; - my $xscale=$wid/($bbox->[2]-$bbox->[0]+1); - my $yscale=($hgt<=0)?$xscale:($hgt/($bbox->[3]-$bbox->[1]+1)); + my $xscale=d3($wid/($bbox->[2]-$bbox->[0]+1)); + my $yscale=d3(($hgt<=0)?$xscale:($hgt/($bbox->[3]-$bbox->[1]+1))); + $wid=($bbox->[2]-$bbox->[0])*$xscale; + $hgt=($bbox->[3]-$bbox->[1])*$yscale; + $ypos+=$hgt; $stream.="q $xscale 0 0 $yscale ".PutXY($xpos,$ypos)." cm"; $stream.=" 0 1 -1 0 0 0 cm" if $rot; $stream.=" /$incfil{$fil}->[0] Do Q\n"; @@ -1058,8 +1061,8 @@ sub do_x IsGraphic(); my $bbox=$incfil{$fil}->[1]; $wid=($bbox->[2]-$bbox->[0]) if $wid <= 0; - my $xscale=$wid/($bbox->[2]-$bbox->[0]); - my $yscale=($hgt<=0)?$xscale:($hgt/($bbox->[3]-$bbox->[1])); + my $xscale=d3($wid/($bbox->[2]-$bbox->[0])); + my $yscale=d3(($hgt<=0)?$xscale:($hgt/($bbox->[3]-$bbox->[1]))); $xscale=($wid<=0)?$yscale:$xscale; $xscale=$yscale if $yscale < $xscale; $yscale=$xscale if $xscale < $yscale; @@ -1488,6 +1491,8 @@ sub LoadPDF my $curobj=-1; my $instream=0; my $cont; +my $adj=0; +my $keepsep=$/; my ($PD,$PDnm)=OpenInc($pdfnm); @@ -1499,7 +1504,7 @@ sub LoadPDF my $hdr=<$PD>; -$/="\r" if (length($hdr) > 10); +$/="\r",$adj=1 if (length($hdr) > 10); while (<$PD>) { @@ -1538,7 +1543,7 @@ sub LoadPDF { if ($curobj > -1) { - $pdf->[$curobj]->{STREAMPOS}=[tell($PD),$strmlen]; + $pdf->[$curobj]->{STREAMPOS}=[tell($PD)+$adj,$strmlen]; seek($PD,$strmlen,1); $instream=1; } @@ -1622,8 +1627,8 @@ sub LoadPDF $BBox=[0,0,595,842] if !defined($BBox); $wid=($BBox->[2]-$BBox->[0]+1) if $wid==0; -my $xscale=abs($wid)/($BBox->[2]-$BBox->[0]+1); -my $yscale=($hgt<=0)?$xscale:(abs($hgt)/($BBox->[3]-$BBox->[1]+1)); +my $xscale=d3(abs($wid)/($BBox->[2]-$BBox->[0]+1)); +my $yscale=d3(($hgt<=0)?$xscale:(abs($hgt)/($BBox->[3]-$BBox->[1]+1))); $hgt=($BBox->[3]-$BBox->[1]+1)*$yscale; if ($type eq "import") @@ -1657,6 +1662,7 @@ sub LoadPDF BuildStream($xobj,$pdf,$pdf->[$page]->{OBJ}->{Contents}); +$/=$keepsep; return([$xonm,$BBox] ); } ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Make PDFPIC behave the same whether -Tps or -Tpdf used.
deri pushed a commit to branch master in repository groff. commit 82630588fc32a5d2e00f257bc79cac7493e7e809 Author: Deri James <d...@chuzzlewit.myzen.co.uk> Date: Thu Apr 12 19:23:25 2018 +0100 Make PDFPIC behave the same whether -Tps or -Tpdf used. Previously the -Tpdf version did not cause a break nor position to the line beneath the imported picture, whilst the -Tps version did. * tmac/pdfpic.tmac: Corrected behavior. * NEWS: Explain the change of behaviour and how to reinstate the previous behaviour using register PDFPIC_NOSPACE or the environment variable GROFF_PDFPIC_NOSPACE. --- ChangeLog| 14 ++ NEWS | 27 +++ tmac/pdfpic.tmac | 10 ++ 3 files changed, 51 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8553fbf..5ea92e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2018-04-12 Deri James <d...@chuzzlewit.myzen.co.uk> + + Make PDFPIC behave the same whether -Tps or -Tpdf used. + + Previously the -Tpdf version did not cause a break nor position + to the line beneath the imported picture, whilst the -Tps + version did. + + * tmac/pdfpic.tmac: Corrected behavior. + + * NEWS: Explain the change of behaviour and how to reinstate + the previous behaviour using register PDFPIC_NOSPACE or the + environment variable GROFF_PDFPIC_NOSPACE. + 2018-03-27 Bertrand Garrigues <bertrand.garrig...@laposte.net> Define a short version for data installation dir name. diff --git a/NEWS b/NEWS index b6a016b..fea449c 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,33 @@ o The `hy' request has been extended. Value 16 enables hyphenation before character. +PDFPIC +-- + +o PDFPIC has now been corrected, so the behaviour is the same whether you + use the postscript or pdf drivers. However, this means that any documents + which were written using the old behaviour will not be rendered correctly + if using the pdf driver with the new version. + + The change would mean that documents which relied on the previous behaviour + are likely to have a gap underneath the image which was not there before. + If you see this effect there are three ways you can restore the previous + 0behaviour:- + + Add the line ".nr PDFPIC_NOSPACE 1" to the document before the first call + to .PDFPIC. + + If it is just a single document which exhibits this behaviour you can run + groff adding "- rPDFPIC_NOSPACE=1" to the command-line. + + If you have many documents which rely on the previous behaviour you can + set an environment variable "export GROFF_PDFPIC_NOSPACE=1" which will + restore the previous behaviour for all runs. + + Note that this change has no effect it you were using .PDFPIC with the + postscript driver, only if you used it with the pdf driver. + + Miscellaneous - diff --git a/tmac/pdfpic.tmac b/tmac/pdfpic.tmac index 3267ea6..c3859bf 100644 --- a/tmac/pdfpic.tmac +++ b/tmac/pdfpic.tmac @@ -132,6 +132,16 @@ sed -e 's/Page *size: *\\([[:digit:].]*\\) *x *\\([[:digit:].]*\\).*$/\ . \h'\\n[pdf-offset]u'\ \X'pdf: pdfpic \\$1 -L \\n[pdf-deswid]z \\n[pdf-desht]z' +. if !r PDFPIC_NOSPACE \{\ +.sy echo ".nr PDFPIC_NOSPACE 0$GROFF_PDFPIC_NOSPACE" > /tmp/x\n[$$] +.so /tmp/x\n[$$] +.sy rm /tmp/x\n[$$] +. \} +. if \\n[PDFPIC_NOSPACE]==0 \{\ +.br +.sp \\n[pdf-desht]u +. \} +.. .. . .cp \n[_C] ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: PDF must not open in presentation mode.
deri pushed a commit to branch master in repository groff. commit 7e956851571c06c58770de50b4c6aeffedc629fc Author: Deri James <d...@chuzzlewit.myzen.co.uk> Date: Fri Mar 9 23:02:14 2018 + PDF must not open in presentation mode. * src/devices/gropdf/gropdf.pl: When GROPDF_NOSLIDE=1 passed do not set pdf to presentation mode. --- ChangeLog| 7 +++ src/devices/gropdf/gropdf.pl | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4699a22..b0a7a38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2018-03-09 Deri James <d...@chuzzlewit.myzen.co.uk> + PDF must not open in presentation mode. + + * src/devices/gropdf/gropdf.pl: When GROPDF_NOSLIDE=1 + passed do not set pdf to presentation mode. + +2018-03-09 Deri James <d...@chuzzlewit.myzen.co.uk> + Allow a "." to signify a missing parameter in .pdftransition * src/devices/gropdf/gropdf.1.man: Explain the .pdftransition diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index a111fd9..74f2b3b 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -1197,7 +1197,7 @@ sub do_x } } } - elsif (lc($xprm[1]) eq 'transition') + elsif (lc($xprm[1]) eq 'transition' and !$noslide) { if (uc($xprm[2]) eq 'PAGE' or uc($xprm[2] eq 'SLIDE')) { ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Dot signifies missing parameter in .pdftransition
deri pushed a commit to branch master in repository groff. commit 24d84d7413ee13a9e92ca7142bf9e3e1602d8e8f Author: Deri James <d...@chuzzlewit.myzen.co.uk> Date: Fri Mar 9 15:14:07 2018 + Dot signifies missing parameter in .pdftransition * src/devices/gropdf/gropdf.1.man: Explain the .pdftransition macro (and underlying '\X' command) accepts a "." to specify a parameter retains its current value. --- ChangeLog | 8 src/devices/gropdf/gropdf.1.man | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 94eaebc..4699a22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-03-09 Deri James <d...@chuzzlewit.myzen.co.uk> + + Allow a "." to signify a missing parameter in .pdftransition + + * src/devices/gropdf/gropdf.1.man: Explain the .pdftransition + macro (and underlying '\X' command) accepts a "." to specify + a parameter retains its current value. + 2018-03-09 Colin Watson <cjwat...@debian.org> man pages: fix incorrect cross-referenced section diff --git a/src/devices/gropdf/gropdf.1.man b/src/devices/gropdf/gropdf.1.man index e07946d..466049f 100644 --- a/src/devices/gropdf/gropdf.1.man +++ b/src/devices/gropdf/gropdf.1.man @@ -1047,7 +1047,9 @@ in is rectangular and opaque. .IP This command can be used by calling the macro .B .pdftransition -using the parameters described above. +using the parameters described above. Any of the parameters may be +replaced with a "." which signifies the parameter retains its +previous value, also any trailing missing parameters are ignored. .LP .IP .B Note: ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Place pdf in presentation mode if new commands used.
deri pushed a commit to branch master in repository groff. commit ea2251991d7a80b271b284d5599ec8b06456863e Author: Deri James <d...@chuzzlewit.myzen.co.uk> Date: Tue Mar 6 11:31:45 2018 + Place pdf in presentation mode if new commands used. * src/devices/gropdf/gropdf: The new commands which control page transitions should result in the pdf being opened in presentation mode. --- ChangeLog| 8 src/devices/gropdf/gropdf.pl | 8 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 25b6629..4dd7a6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-03-01 Deri James <d...@chuzzlewit.myzen.co.uk> + + Place pdf in presentation mode if new commands used. + + * src/devices/gropdf/gropdf: The new commands which + control page transitions should result in the pdf being + opened in presentation mode. + 2018-03-02 Werner LEMBERG <w...@gnu.org> Hyphenation exceptions in pattern files now obey `.hy' (#53196). diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 8a4b4b6..a111fd9 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -136,6 +136,7 @@ my $noslide=0; my $transition={PAGE => {Type => '/Trans', S => '', D => 1, Dm => '/H', M => '/I', Di => 0, SS => 1.0, B => 0}, BLOCK => {Type => '/Trans', S => '', D => 1, Dm => '/H', M => '/I', Di => 0, SS => 1.0, B => 0}}; my $firstpause=0; +my $present=0; $noslide=1 if exists($ENV{GROPDF_NOSLIDE}) and $ENV{GROPDF_NOSLIDE}; @@ -366,6 +367,7 @@ if ($cpageno > 0) OutStream($cpageno+1); } +$cat->{PageMode}='/FullScreen' if $present; PutOutlines(\@outlev); @@ -797,7 +799,7 @@ sub do_x } MakeXO(); NewPage($trans); - $cat->{PageMode}='/FullScreen'; + $present=1; } elsif ($par=~m/exec BEGINONCE/) { @@ -816,7 +818,7 @@ sub do_x } MakeXO(); NewPage($trans); - $cat->{PageMode}='/FullScreen'; + $present=1; } } elsif ($par=~m/exec ENDONCE/) @@ -1219,6 +1221,8 @@ sub do_x $transition->{BLOCK}->{SS}=$xprm[8] if $xprm[8] and $xprm[8] ne '.'; $transition->{BLOCK}->{B}=$xprm[9] if $xprm[9] and $xprm[9] ne '.'; } + + $present=1; } } elsif (lc(substr($xprm[0],0,9)) eq 'papersize') ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Add page transitions to pdfs created with gropdf.
deri pushed a commit to branch master in repository groff. commit f2a92911c552c3995c010f8beb9b89de3612e95a Author: Deri James <d...@chuzzlewit.myzen.co.uk> Date: Thu Mar 1 15:16:11 2018 + Add page transitions to pdfs created with gropdf. * src/devices/gropdf.pl: Handle new '\X' commands to support page transitions in presentation mode pdfs. These commands are a subset of the commands used in present.tmac allowing slideshows to be directly produced from -Tpdf without using postscript -> gpresent.pl -> ghostscript. * tmac/pdf.tmac: New macros '.pdfpause' and '.pdftransition' to support page transitions. * src/devices/gropdf.1.man: Document the '\X' commands supported. --- ChangeLog | 15 +++ src/devices/gropdf/gropdf.1.man | 240 src/devices/gropdf/gropdf.pl| 211 ++- tmac/pdf.tmac | 8 +- 4 files changed, 447 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 337bf08..1506e57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2018-03-01 Deri James <d...@chuzzlewit.myzen.co.uk> + + Add page transitions to pdfs created with gropdf. + + * src/devices/gropdf.pl: Handle new '\X' commands to support page + transitions in presentation mode pdfs. These commands are a subset + of the commands used in present.tmac allowing slideshows to be + directly produced from -Tpdf without using postscript -> gpresent.pl + -> ghostscript. + + * tmac/pdf.tmac: New macros '.pdfpause' and '.pdftransition' to + support page transitions. + + * src/devices/gropdf.1.man: Document the '\X' commands supported. + 2018-03-01 Werner LEMBERG <w...@gnu.org> Use $(AM_V_GEN) and $(AM_V_P) to silence even more file generation. diff --git a/src/devices/gropdf/gropdf.1.man b/src/devices/gropdf/gropdf.1.man index 0ff132e..e07946d 100644 --- a/src/devices/gropdf/gropdf.1.man +++ b/src/devices/gropdf/gropdf.1.man @@ -695,8 +695,54 @@ A subset of these macros are installed automatically when you use so you should not need to use \[oq]\-m pdfmark\[cq] for using most of the PDF functionality. . +.LP +.B gropdf +also supports a subset of the commands introduced in present.tmac. +Specifically it supports:- +.IP +PAUSE +.br +BLOCKS +.br +BLOCKE . .LP +Which allows you to create presentation type PDFs. Many of the other +commands are already available in other macro packages. +.LP +These commands are implemented with +.B groff +X commands:- +.LP +.TP +.BI "\[rs]X'ps: exec PAUSE" +The section before this is treated as a block and is introduced using the +current BLOCK transition setting (see \[oq]pdf: transition\[cq] below). This command +can be introduced using the macro +.BR .pdfpause . +.TP +.B "\[rs]X'ps: exec BEGINONCE" +Any text following this command (up to ENDONCE) is shown only once, +the next PAUSE will remove it. If producing a non presentation pdf, i.e. +ignoring the pauses, see GROPDF_NOSLIDE below, this text is ignored. +.LP +.TP +.B "\[rs]X'ps: exec ENDONCE" +This terminates the block defined by BEGINONCE. This pair of commands +is what implements the .BLOCKS Once/.BLOCKE commands in present.tmac. +.LP +The +.B mom +macro set already has integration with these extensions so you can build +slides with +.BR mom . +.LP +If you use present.tmac with +.B gropdf +there is no need to run the program +.BR presentps (@MAN1EXT@) +since the output will already be a presentation pdf. +.LP All other .B ps: tags are silently ignored. @@ -820,6 +866,193 @@ respectively. . These macros must only be used within page traps.) . +.TP +.BR "\[rs]X'pdf: transition'" "feature mode duration dimension motion direction scale bool" +where +.IP +.I feature +can be either SLIDE or BLOCK. When it is SLIDE the transition is used +when a new slide is introduced to the screen, if BLOCK then this transition +is used for the individual blocks which make up the slide. +.br +.I mode +is the transition type between slides:- +.RS +.IP +.B Split +- Two lines sweep across the screen, revealing the new page. The lines +may be either horizontal or vertical and may move inward from the +edges of the page or outward from the center, as specified by the +.I dimension +and +.I motion +entries, respectively. +.br +.B Blinds +- Multiple lines, evenly spaced across the screen, synchronously +sweep in the same direction to reveal the new page. The lines may be +either horizontal or vertical, as specified by the +.I dimension + entry. Horizontal +lines move downward; vertical lines move to the right. +.br +.B Box +- A rectangular box sweeps inward from the edges of the page or +outward from the center, as specified by the +.I motion +entry, revealing the new page. +.br +.B Wipe +- A single line
[groff] 01/01: Better handle glyphs in font positions > 255
deri pushed a commit to branch master in repository groff. commit 6df65ebdf5f50f3b6619581209adff32e3774831 Author: Deri James <d...@chuzzlewit.myzen.co.uk> Date: Sun Nov 12 19:48:47 2017 + Better handle glyphs in font positions > 255 * src/devices/gropdf/gropdf.pl: Improve handling when glyphs above 255 are used. --- ChangeLog| 7 ++ src/devices/gropdf/gropdf.pl | 188 ++- 2 files changed, 137 insertions(+), 58 deletions(-) diff --git a/ChangeLog b/ChangeLog index 996da7b..87e6eea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2017-11-12 Deri James <d...@chuzzlewit.myzen.co.uk> + Better handle glyphs in font positions > 255 + + * src/devices/gropdf/gropdf.pl: Improve handling + when glyphs above 255 are used. + +2017-11-12 Deri James <d...@chuzzlewit.myzen.co.uk> + gropdf should load ALL 'download' files * src/devices/gropdf/gropdf.pl: only the first 'download' file diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index ad644e4..053c9ba 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -23,6 +23,15 @@ use strict; use Getopt::Long qw(:config bundling); +use constant +{ +WIDTH => 0, +CHRCODE=> 1, +PSNAME => 2, +ASSIGNED => 3, +USED => 4, +}; + my $gotzlib=0; my $rc = eval @@ -184,7 +193,7 @@ my @idirs; #Load_Config(); -GetOptions("F=s" => \$fd, 'I=s' => \@idirs, 'l' => \$frot, 'p=s' => \$fpsz, 'd!' => \$debug, 'v' => \$version, 'e' => \$embedall, 'y=s' => \$Foundry, 's' => \$stats, 'u:s' => \$unicodemap); +GetOptions("F=s" => \$fd, 'I=s' => \@idirs, 'l' => \$frot, 'p=s' => \$fpsz, 'd!' => \$debug, 'v' => \$version, 'version' => \$version, 'e' => \$embedall, 'y=s' => \$Foundry, 's' => \$stats, 'u:s' => \$unicodemap); unshift(@idirs,'.'); @@ -339,13 +348,24 @@ PutObj($objct); foreach my $fontno (keys %fontlst) { my $o=$fontlst{$fontno}->{FNT}; + +foreach my $ch (@{$o->{NO}}) +{ + my $psname=$o->{NAM}->{$ch->[1]}->[PSNAME] || '/.notdef'; + my $wid=$o->{NAM}->{$ch->[1]}->[WIDTH] || 0; + + push(@{$o->{DIFF}},$psname); + push(@{$o->{WIDTH}},$wid); + last if $#{$o->{DIFF}} >= 255; +} +unshift(@{$o->{DIFF}},0); my $p=GetObj($fontlst{$fontno}->{OBJ}); if (exists($p->{LastChar}) and $p->{LastChar} > 255) { $p->{LastChar} = 255; - splice(@{$o->{GNO}},256); - splice(@{$o->{WID}},256); + splice(@{$o->{DIFF}},256); + splice(@{$o->{WIDTH}},256); } } @@ -2053,6 +2073,7 @@ sub LoadFont my @fntbbox=(0,0,0,0); my $capheight=0; my $lastchr=0; +my $lastnm; my $t1flags=0; my $fixwid=-1; my $ascent=0; @@ -2081,7 +2102,7 @@ sub LoadFont $stg=3,next if lc($_) eq 'charset'; my ($ch1,$ch2,$k)=split; - $fnt{KERN}->{$ch1}->{$ch2}=$k; +# $fnt{KERN}->{$ch1}->{$ch2}=$k; } else { @@ -2090,15 +2111,16 @@ sub LoadFont if ($r[1] eq '"') { - $fnt{GNM}->{$r[0]}=$lastchr; + $fnt{NAM}->{$r[0]}=$fnt{NAM}->{$lastnm}; next; } $r[0]='u0020' if $r[3] == 32; + $r[0]="u00".hex($r[3]) if $r[0] eq '---'; # next if $r[3] >255; - $fnt{GNM}->{$r[0]}=$r[3]; - $fnt{GNO}->[$r[3]]='/'.$r[4]; - $fnt{WID}->[$r[3]]=$p[0]; + $fnt{NAM}->{$r[0]}=[$p[0],$r[3],'/'.$r[4],$r[3],0]; + $fnt{NO}->[$r[3]]=[$r[0],$r[0]]; + $lastnm=$r[0]; $lastchr=$r[3] if $r[3] > $lastchr; $fixwid=$p[0] if $fixwid == -1; $fixwid=-2 if $fixwid > 0 and $p[0] != $fixwid; @@ -2114,20 +2136,16 @@ sub LoadFont close($f); -unshift(@{$fnt{GNO}},0); - -foreach my $glyph (@{$fnt{GNO}}) -{ - $glyph='/.notdef' if !defined($glyph); -} - -foreach my $w (@{$fnt{WID}}) +foreach my $j (0..$lastchr) { - $w=0 if !defined($w); + $fnt{NO}->[$j]=['',''] if !defined($fnt{NO}->[$j]); } my $fno=0; my $slant=0; +$fnt{DIFF}=[]; +$fnt{WIDTH}=[]; +$fnt{NAM}->{''}=[0,-1,'/.notdef',-1,0]; $slant=-$fnt{'slant'} if exists($fnt{'slant'}); $fnt{'spacewidth'}=700 if !exists($fnt{'spacewidth'}); @@ -2146,12 +2164,12 @@ sub LoadFont {'Type' => '/Font', 'Subtype' => '/Type1', 'BaseFont' => '/'.$fnt{internalname}, - 'Wid
[groff] 01/01: gropdf should load ALL 'download' files
deri pushed a commit to branch master in repository groff. commit 6b2942c79f5dd34883f450a2947f611a11b085d3 Author: Deri James <d...@chuzzlewit.myzen.co.uk> Date: Sun Nov 12 17:44:37 2017 + gropdf should load ALL 'download' files * src/devices/gropdf/gropdf.pl: only the first 'download' file found was loaded, it should load all found. --- ChangeLog| 7 +++ src/devices/gropdf/gropdf.pl | 42 ++ 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6fe7f77..996da7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-11-12 Deri James <d...@chuzzlewit.myzen.co.uk> + + gropdf should load ALL 'download' files + + * src/devices/gropdf/gropdf.pl: only the first 'download' file + found was loaded, it should load all found. + 2017-11-12 G. Branden Robinson <g.branden.robin...@gmail.com> * src/libs/libxutil/DviChar.c: Initialize "buckets" field of diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 4d21580..ad644e4 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -18,7 +18,7 @@ # for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <http://www.gnu.org/licenses/>. use strict; use Getopt::Long qw(:config bundling); @@ -542,26 +542,36 @@ sub Load_Config sub LoadDownload { my $f; +my $found=0; -OpenFile(\$f,$fontdir,"download"); -Msg(1,"Failed to open 'download'") if !defined($f); +my (@dirs)=split($cfg{RT_SEP},$fontdir); -while (<$f>) +foreach my $dir (@dirs) { - chomp; - s/#.*$//; - next if $_ eq ''; - my ($foundry,$name,$file)=split(/\t+/); - if (substr($file,0,1) eq '*') + $f=undef; + OpenFile(\$f,$dir,"download"); + next if !defined($f); + $found++; + + while (<$f>) { - next if !$embedall; - $file=substr($file,1); + chomp; + s/#.*$//; + next if $_ eq ''; + my ($foundry,$name,$file)=split(/\t+/); + if (substr($file,0,1) eq '*') + { + next if !$embedall; + $file=substr($file,1); + } + + $download{"$foundry $name"}=$file; } - $download{"$foundry $name"}=$file; + close($f); } -close($f); +Msg(1,"Failed to open 'download'") if !$found; } sub OpenFile @@ -3281,7 +3291,7 @@ sub RemapChr } if (--$unused <= 255) -{ + { $fnt->{GNM}->{$chnm}=$unused++; $fnt->{GNO}->[$unused]=$fnt->{GNO}->[$ch+1]; $fnt->{WID}->[$unused]=$fnt->{WID}->[$ch]; @@ -3312,11 +3322,11 @@ sub do_N if ($par > 255) { - my $fnt=$fontlst{$cft}->{FNT}; +my $fnt=$fontlst{$cft}->{FNT}; my $chnm=''; foreach my $c (keys %{$fnt->{GNM}}) - { +{ $chnm=$c,last if $fnt->{GNM}->{$c} == $par; } ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Make gropdf reallocate unused character codes
deri pushed a commit to branch gropdfmultiglyph in repository groff. commit 919396ef40ca277b79b0c791e71d73b45d079167 Author: Deri James <d...@chuzzlewit.myzen.co.uk> Date: Tue Oct 17 14:05:07 2017 +0100 Make gropdf reallocate unused character codes * src/devices/gropdf/gropdf.pl: Allow gropdf to reallocate character codes which are unused to point to glyphs in positions above 255 which are used. --- src/devices/gropdf/gropdf.pl | 190 +-- 1 file changed, 131 insertions(+), 59 deletions(-) diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index de357c0..4ce4a38 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -23,6 +23,15 @@ use strict; use Getopt::Long qw(:config bundling); +use constant +{ +WIDTH => 0, +CHRCODE=> 1, +PSNAME => 2, +ASSIGNED => 3, +USED => 4, +}; + my $gotzlib=0; my $rc = eval @@ -184,7 +193,7 @@ my @idirs; #Load_Config(); -GetOptions("F=s" => \$fd, 'I=s' => \@idirs, 'l' => \$frot, 'p=s' => \$fpsz, 'd!' => \$debug, 'v' => \$version, 'e' => \$embedall, 'y=s' => \$Foundry, 's' => \$stats, 'u:s' => \$unicodemap); +GetOptions("F=s" => \$fd, 'I=s' => \@idirs, 'l' => \$frot, 'p=s' => \$fpsz, 'd!' => \$debug, 'v' => \$version, 'version' => \$version, 'e' => \$embedall, 'y=s' => \$Foundry, 's' => \$stats, 'u:s' => \$unicodemap); unshift(@idirs,'.'); @@ -339,13 +348,24 @@ PutObj($objct); foreach my $fontno (keys %fontlst) { my $o=$fontlst{$fontno}->{FNT}; + +foreach my $ch (@{$o->{NO}}) +{ + my $psname=$o->{NAM}->{$ch->[1]}->[PSNAME] || '/.notdef'; + my $wid=$o->{NAM}->{$ch->[1]}->[WIDTH] || 0; + + push(@{$o->{DIFF}},$psname); + push(@{$o->{WIDTH}},$wid); + last if $#{$o->{DIFF}} >= 255; +} +unshift(@{$o->{DIFF}},0); my $p=GetObj($fontlst{$fontno}->{OBJ}); if (exists($p->{LastChar}) and $p->{LastChar} > 255) { $p->{LastChar} = 255; - splice(@{$o->{GNO}},256); - splice(@{$o->{WID}},256); + splice(@{$o->{DIFF}},256); + splice(@{$o->{WIDTH}},256); } } @@ -2043,6 +2063,7 @@ sub LoadFont my @fntbbox=(0,0,0,0); my $capheight=0; my $lastchr=0; +my $lastnm; my $t1flags=0; my $fixwid=-1; my $ascent=0; @@ -2071,7 +2092,7 @@ sub LoadFont $stg=3,next if lc($_) eq 'charset'; my ($ch1,$ch2,$k)=split; - $fnt{KERN}->{$ch1}->{$ch2}=$k; +# $fnt{KERN}->{$ch1}->{$ch2}=$k; } else { @@ -2080,15 +2101,16 @@ sub LoadFont if ($r[1] eq '"') { - $fnt{GNM}->{$r[0]}=$lastchr; + $fnt{NAM}->{$r[0]}=$fnt{NAM}->{$lastnm}; next; } $r[0]='u0020' if $r[3] == 32; + $r[0]="u00".hex($r[3]) if $r[0] eq '---'; # next if $r[3] >255; - $fnt{GNM}->{$r[0]}=$r[3]; - $fnt{GNO}->[$r[3]]='/'.$r[4]; - $fnt{WID}->[$r[3]]=$p[0]; + $fnt{NAM}->{$r[0]}=[$p[0],$r[3],'/'.$r[4],$r[3],0]; + $fnt{NO}->[$r[3]]=[$r[0],$r[0]]; + $lastnm=$r[0]; $lastchr=$r[3] if $r[3] > $lastchr; $fixwid=$p[0] if $fixwid == -1; $fixwid=-2 if $fixwid > 0 and $p[0] != $fixwid; @@ -2104,20 +2126,16 @@ sub LoadFont close($f); -unshift(@{$fnt{GNO}},0); - -foreach my $glyph (@{$fnt{GNO}}) -{ - $glyph='/.notdef' if !defined($glyph); -} - -foreach my $w (@{$fnt{WID}}) +foreach my $j (0..$lastchr) { - $w=0 if !defined($w); + $fnt{NO}->[$j]=['',''] if !defined($fnt{NO}->[$j]); } my $fno=0; my $slant=0; +$fnt{DIFF}=[]; +$fnt{WIDTH}=[]; +$fnt{NAM}->{''}=[0,-1,'/.notdef',-1,0]; $slant=-$fnt{'slant'} if exists($fnt{'slant'}); $fnt{'spacewidth'}=700 if !exists($fnt{'spacewidth'}); @@ -2136,12 +2154,12 @@ sub LoadFont {'Type' => '/Font', 'Subtype' => '/Type1', 'BaseFont' => '/'.$fnt{internalname}, - 'Widths' => $fnt{WID}, + 'Widths' => $fnt{WIDTH}, 'FirstChar' => 0, 'LastChar' => $lastchr, 'Encoding' => BuildObj($objct+1, {'Type' => '/Encoding', - 'Differences' => $fnt{GNO} + 'Differences' => $fnt{DIFF} } ),
[groff] 01/01: 'gropdf' does not correctly load new ghostscript fonts
deri pushed a commit to branch master in repository groff. commit fe51e3b63753f9c4b139b609329e211b1e7ca6e2 Author: Deri James <d...@chuzzlewit.myzen.co.uk> Date: Mon Aug 21 15:14:54 2017 +0100 'gropdf' does not correctly load new ghostscript fonts See bug at: https://savannah.gnu.org/bugs/?50989. Since ghostscript 9.21 the fonts supplied have changed from .pfb to .pfa type (with a raw binary section). These failed to be properly loaded. * src/devices/gropdf/gropdf: Changes to handle raw binary section in a .pfa type font. --- ChangeLog| 11 +++ src/devices/gropdf/gropdf.pl | 162 +++ 2 files changed, 81 insertions(+), 92 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8bf97ce..c2f8369 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-08-21 Deri James <d...@chuzzlewit.myzen.co.uk> + + 'gropdf' does not correctly load new ghostscript fonts + + See bug at: https://savannah.gnu.org/bugs/?50989. Since ghostscript + 9.21 the fonts supplied have changed from .pfb to .pfa type (with a + raw binary section). These failed to be properly loaded. + + * src/devices/gropdf/gropdf: Changes to handle raw binary section in + a .pfa type font. + 2017-08-18 Bertrand Garrigues <bertrand.garrig...@laposte.net> `pdfmom' man page incorrectly displayed. diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 6fec8bd..de357c0 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -2,7 +2,7 @@ # # gropdf : PDF post processor for groff # -# Copyright (C) 2011-2015 Free Software Foundation, Inc. +# Copyright (C) 2011-2017 Free Software Foundation, Inc. # Written by Deri James <d...@chuzzlewit.myzen.co.uk> # # This file is part of groff. @@ -2236,130 +2236,108 @@ sub GetType1 OpenFile(\$f,$fontdir,"$file"); Msg(1,"Failed to open '$file'") if !defined($f); -binmode($f); -my $l=<$f>; +$head=GetChunk($f,1,"currentfile eexec"); +$body=GetChunk($f,2,"") if !eof($f); +$tail=GetChunk($f,3,"cleartomark") if !eof($f); -if (substr($l,0,1) eq "\x80") +$l1=length($head); +$l2=length($body); +$l3=length($tail); + +return($l1,$l2,$l3,"$head$body$tail"); +} + +sub GetChunk +{ +my $F=shift; +my $segno=shift; +my $ascterm=shift; +my ($type,$hdr,$chunk,@msg); +binmode($F); +my $enc="ascii"; + +while (1) { - # PFB file - sysseek($f,0,0); - my $hdr=''; - $l1=$l2=$l3=0; - my $typ=0; - my $data=''; - my $sl=0; + # There may be multiple chunks of the same type + + my $ct=read($F,$hdr,2); - while ($typ != 3) + if ($ct==2) + { + if (substr($hdr,0,1) eq "\x80") { - my $chk=sysread($f,$hdr,6); + # binary chunk - if ($chk < 2) + my $chunktype=ord(substr($hdr,1,1)); + $enc="binary"; + + if (defined($type) and $type != $chunktype) { - # eof($f) uses buffered i/o (since file was open not sysopen) - # which screws up next sysread. So this will terminate loop if font - # has no terminating section type 3. - last if $l3; - return(5,$l2,$l3,undef); + seek($F,-2,1); + last; } - $typ=ord(substr($hdr,1,1)); + $type=$chunktype; + return if $chunktype == 3; - if ($chk == 6) - { - $sl=unpack('L',substr($hdr,2,4)); - $chk=sysread($f,$data,$sl); - return(1,$l2,$l3,undef) if $chk != $sl; - } + $ct=read($F,$hdr,4); - if ($typ == 1) - { - if ($l2 == 0) - { - # First text bit(s) must be head - $head.=$data; - $l1+=$sl; + Msg(1,"Failed to read binary segment length"), return if $ct != 4; + + my $sl=unpack('L',$hdr); + my $data; + my $chk=read($F,$data,$sl); + + Msg(1 ,"Failed to read binary segment"), return if $chk != $sl; + + $chunk.=$data; } else { - # A text bit after the binary sections must be tail - $tail.=$data; - $l3+=$sl; - } - } - elsif ($typ == 2) - { - return(2,$l2,$
[groff] 01/01: See bug at: https://savannah.gnu.org/bugs/?51568
deri pushed a commit to branch master in repository groff. commit 6a241192be60d0cc1a2ab5464281e297b2c0243d Author: Deri James <d...@chuzzlewit.myzen.co.uk> 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 <d...@chuzzlewit.myzen.co.uk> + + 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 <d...@chuzzlewit.myzen.co.uk> 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 { ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: If input text contained string which could be interpreted as escaped octal (\ddd) a pdf viewer would interpret as an octal character. See bug at: https://savannah.gnu.org/bugs/?51568
deri pushed a commit to branch master in repository groff. commit 67c3d46d452ce05082839920a8058091a8797583 Author: Deri James <d...@chuzzlewit.myzen.co.uk> Date: Tue Jul 25 16:43:54 2017 +0100 If input text contained string which could be interpreted as escaped octal (\ddd) a pdf viewer would interpret as an octal character. See bug at: https://savannah.gnu.org/bugs/?51568 * src/devices/gropdf/gropdf: protect text which resembles \ddd by escaping with extra '\'. --- ChangeLog| 9 + src/devices/gropdf/gropdf.pl | 17 +++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 44645b9..caa5498 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-07-25 Deri James <d...@chuzzlewit.myzen.co.uk> + + If input text contained string which could be interpreted as + escaped octal (\ddd) a pdf viewer would interpret as an octal + character. See bug at: https://savannah.gnu.org/bugs/?51568 + + * src/devices/gropdf/gropdf: protect text which resembles \ddd + by escaping with extra '\'. + 2017-07-12 Bertrand Garrigues <bertrand.garrig...@laposte.net> Use uchardet library in `preconv' to detect input file encoding diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index a3bba58..8f0a320 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -2946,6 +2946,7 @@ 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.="($lin[0]->[0]) Tj\n"; } else @@ -2954,7 +2955,12 @@ sub PutLine foreach my $wd (@lin) { - $stream.="($wd->[0]) " if defined($wd->[0]); + if (defined($wd->[0])) + { + $wd->[0]=~s/\\\d{1,3}/\\${&}/g; + $stream.="($wd->[0]) "; + } + $stream.="$wd->[1] " if defined($wd->[1]) and $wd->[1] != 0; } @@ -2965,6 +2971,7 @@ 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 @@ -2975,7 +2982,12 @@ sub PutLine foreach my $wd (@lin) { - $stream.="($wd->[0]) " if defined($wd->[0]); + if (defined($wd->[0])) + { + $wd->[0]=~s/\\\d{1,3}/\\${&}/g; + $stream.="($wd->[0]) "; + } + $stream.="$wd->[1] " if defined($wd->[1]) and $wd->[1] != 0; } @@ -3014,6 +3026,7 @@ sub PutLine foreach my $wd (@lin) { my $wwt=$wd->[1]||0; + $wd->[0]=~s/\\\d{1,3}/\\${&}/g; while ($wwt <= $wt+.1) { ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit
[groff] 01/01: Fixes for gropdf
deri pushed a commit to branch master in repository groff. commit 5d052395efcfd260ce0a42481fbf87c810184ee3 Author: Deri James <d...@chuzzlewit.myzen.co.uk> Date: Thu May 4 22:45:31 2017 +0100 Fixes for gropdf * src/devices/gropdf/gropdf.pl: Escape '(' and ')' if used in a bookmark, and ignore relative move 'h' if followed by absolute move 'H' in groff intermediate output. --- ChangeLog| 8 src/devices/gropdf/gropdf.pl | 8 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba059c8..1341518 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-05-04 Deri James <d...@chuzzlewit.myzen.co.uk> + + Fixes for gropdf + + * src/devices/gropdf/gropdf.pl: Escape '(' and ')' if + used in a bookmark, and ignore relative move 'h' if + followed by absolute move 'H' in groff intermediate output. + 2017-04-29 Ingo Schwarze <schwa...@usta.de> groff_char(7): improve description of ASCII characters diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index cbfe329..a3bba58 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -791,7 +791,11 @@ sub do_x my $t=$1; $t=~s/\\\) /\) /g; $t=~s/\\e//g; - my @xwds=split(' ',"<< $t >>"); + $t=~m/(^.*\/Title \()(.*)(\).*)/; + my ($pre,$title,$post)=($1,$2,$3); + $title=~s/(?>"); my $out=ParsePDFValue(\@xwds); my $this=[$out,[]]; @@ -3077,11 +3081,11 @@ sub do_V { $xpos=substr($ahead[0],1)/$unitwidth; + $nomove=$pendmv=0; @ahead=(); } -#$nomove=$pendmv=0; $poschg=1; } ___ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit