Home | Directory | Search | 12 unapplied patches, 13 total | 7 programs
Haberdasher
demiurgo.org

Patch #7 (by zoso)

Other Unapplied Patches for 'PDF::Writer'

Some fake patch, subversion diff (for 6.5)
Some fake patch, context diff (for 5.5)

Applied Patches for 'PDF::Writer'

None

Basic Info

PDF::Writer
Fix font embedding issues
external
Fix font embedding issues

Patch History

0.0.3 1.9 KB 05 Sep, 2006 (17:14)
Initial version

Patch Text

diff -u -r origlib/pdf/writer/object/font.rb dest/pdf/writer/object/font.rb
--- origlib/pdf/writer/object/font.rb	2006-07-26 12:26:37.000000000 +0100
+++ dest/pdf/writer/object/font.rb	2006-09-03 01:29:07.000000000 +0100
@@ -35,14 +35,14 @@
     @fontdescriptor = nil
   end
 
-  attr_reader :font_id
+  attr_accessor :font_id
     # The type of the font: Type1 and TrueType are the only values supported
     # by 
-  attr_reader :subtype
+  attr_accessor :subtype
     # Valid values: WinAnsiEncoding, MacRomanEncoding, MacExpertEncoding,
     # none, +nil+, or an instance of PDF::Writer::Object::FontEncoding.
-  attr_reader :encoding
-  attr_reader :basefont
+  attr_accessor :encoding
+  attr_accessor :basefont
   def basefont #:nodoc:
     @name
   end
diff -u -r origlib/pdf/writer.rb dest/pdf/writer.rb
--- origlib/pdf/writer.rb	2006-07-26 12:26:37.000000000 +0100
+++ dest/pdf/writer.rb	2006-09-03 02:45:07.000000000 +0100
@@ -835,7 +835,7 @@
       end
     end
 
-    if font =~ /afm/o and fontfile
+    if fontfile
         # Find the array of font widths, and put that into an object.
       first_char  = -1
       last_char   = 0
@@ -857,7 +857,7 @@
         encoding_diff.each do |cnum, cname|
           (cnum - last_char).times { widths << 0 } if cnum > last_char
           last_char = cnum
-          widths[cnum - firstchar] = fonts.c[cname]['WX'] if metrics.c[cname]
+          widths[cnum - first_char] = metrics.c[cname]['WX'] if metrics.c[cname]
         end
       end
 
@@ -875,7 +875,8 @@
         # Load the pfb file, and put that into an object too. Note that PDF
         # supports only binary format Type1 font files and TrueType font
         # files. There is a simple utility to convert Type1 from pfa to pfb.
-      data = File.open(fbfile, "rb") { |ff| ff.read }
+      data = File.open(fontfile, "rb") { |ff| ff.read }
+      fbtype = fontfile
 
         # Check to see if the font licence allows embedding.
       if fbtype =~ /\.ttf$/o