groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 01/01: [gropdf] use nospace mode if font does not contain /space


From: Deri James
Subject: [groff] 01/01: [gropdf] use nospace mode if font does not contain /space glyph.
Date: Sun, 28 Apr 2024 10:00:44 -0400 (EDT)

deri pushed a commit to branch master
in repository groff.

commit 9e0a3316c7b1f33f22d3b314456b2415cc9856eb
Author: Deri James <deri@chuzzlewit.myzen.co.uk>
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  <deri@chuzzlewit.myzen.co.uk>
+
+       [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  <deri@chuzzlewit.myzen.co.uk>
 
        [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;
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]