Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rubygem-pdf-reader for 
openSUSE:Factory checked in at 2021-06-25 15:01:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-pdf-reader (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-pdf-reader.new.2625 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-pdf-reader"

Fri Jun 25 15:01:24 2021 rev:3 rq:902201 version:2.5.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-pdf-reader/rubygem-pdf-reader.changes    
2021-01-28 21:29:19.392275691 +0100
+++ 
/work/SRC/openSUSE:Factory/.rubygem-pdf-reader.new.2625/rubygem-pdf-reader.changes
  2021-06-25 15:02:07.172208781 +0200
@@ -1,0 +2,14 @@
+Thu Jun 24 17:45:41 UTC 2021 - Stephan Kulow <[email protected]>
+
+updated to version 2.5.0
+ see installed CHANGELOG
+
+  v2.5.0 (6th June 2021)
+  - bump minimum ruby version to 2.0
+  - Correctly handle trascoding to UTF-8 from some fonts that use a difference 
table [#344](https://github.com/yob/pdf-reader/pull/344/) 
+  - Fix some character spacing issues with the TJ operator 
[#343](https://github.com/yob/pdf-reader/pull/343)
+  - Fix crash with some encrypted PDFs 
[#348](https://github.com/yob/pdf-reader/pull/348/)
+  - Fix positions of text on some PDFs with pages rotated 90?? 
[#350](https://github.com/yob/pdf-reader/pull/350/)
+  
+
+-------------------------------------------------------------------

Old:
----
  pdf-reader-2.4.2.gem

New:
----
  pdf-reader-2.5.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-pdf-reader.spec ++++++
--- /var/tmp/diff_new_pack.Dc5DW6/_old  2021-06-25 15:02:07.628209337 +0200
+++ /var/tmp/diff_new_pack.Dc5DW6/_new  2021-06-25 15:02:07.628209337 +0200
@@ -24,12 +24,12 @@
 #
 
 Name:           rubygem-pdf-reader
-Version:        2.4.2
+Version:        2.5.0
 Release:        0
 %define mod_name pdf-reader
 %define mod_full_name %{mod_name}-%{version}
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-BuildRequires:  %{ruby >= 1.9.3}
+BuildRequires:  %{ruby >= 2.0}
 BuildRequires:  %{rubygem gem2rpm}
 BuildRequires:  %{rubygem rdoc > 3.10}
 BuildRequires:  ruby-macros >= 5

++++++ pdf-reader-2.4.2.gem -> pdf-reader-2.5.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG new/CHANGELOG
--- old/CHANGELOG       2021-01-28 12:43:08.000000000 +0100
+++ new/CHANGELOG       2021-06-06 02:15:10.000000000 +0200
@@ -1,3 +1,10 @@
+v2.5.0 (6th June 2021)
+- bump minimum ruby version to 2.0
+- Correctly handle trascoding to UTF-8 from some fonts that use a difference 
table [#344](https://github.com/yob/pdf-reader/pull/344/) 
+- Fix some character spacing issues with the TJ operator 
[#343](https://github.com/yob/pdf-reader/pull/343)
+- Fix crash with some encrypted PDFs 
[#348](https://github.com/yob/pdf-reader/pull/348/)
+- Fix positions of text on some PDFs with pages rotated 90?? 
[#350](https://github.com/yob/pdf-reader/pull/350/)
+
 v2.4.2 (28th January 2021)
 - relax ASCII85 dependency to allow 1.x
 - improved support for decompressing objects with slightly malformed zlib data
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/pdf/reader/filter/flate.rb 
new/lib/pdf/reader/filter/flate.rb
--- old/lib/pdf/reader/filter/flate.rb  2021-01-28 12:43:08.000000000 +0100
+++ new/lib/pdf/reader/filter/flate.rb  2021-06-06 02:15:10.000000000 +0200
@@ -32,7 +32,7 @@
       def zlib_inflate(data)
         begin
           return Zlib::Inflate.new(ZLIB_AUTO_DETECT_ZLIB_OR_GZIP).inflate(data)
-        rescue Zlib::DataError => e
+        rescue Zlib::DataError
           # by default, Ruby's Zlib assumes the data it's inflating
           # is RFC1951 deflated data, wrapped in a RFC1950 zlib container. If 
that
           # fails, swallow the exception and attempt to inflate the data as a 
raw
@@ -41,7 +41,7 @@
 
         begin
           return Zlib::Inflate.new(ZLIB_RAW_DEFLATE).inflate(data)
-        rescue StandardError => e
+        rescue StandardError
           # swallow this one too, so we can try some other fallback options
         end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/pdf/reader/object_hash.rb 
new/lib/pdf/reader/object_hash.rb
--- old/lib/pdf/reader/object_hash.rb   2021-01-28 12:43:08.000000000 +0100
+++ new/lib/pdf/reader/object_hash.rb   2021-06-06 02:15:10.000000000 +0200
@@ -331,7 +331,9 @@
     def decrypt(ref, obj)
       case obj
       when PDF::Reader::Stream then
-        obj.data = sec_handler.decrypt(obj.data, ref)
+        # PDF 32000-1:2008 7.5.8.2: "The cross-reference stream shall not be 
encrypted [...]."
+        # Therefore we shouldn't try to decrypt it.
+        obj.data = sec_handler.decrypt(obj.data, ref) unless obj.hash[:Type] 
== :XRef
         obj
       when Hash                then
         arr = obj.map { |key,val| [key, decrypt(ref, val)] }.flatten(1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/pdf/reader/page_layout.rb 
new/lib/pdf/reader/page_layout.rb
--- old/lib/pdf/reader/page_layout.rb   2021-01-28 12:43:08.000000000 +0100
+++ new/lib/pdf/reader/page_layout.rb   2021-06-06 02:15:10.000000000 +0200
@@ -30,6 +30,7 @@
 
     def to_s
       return "" if @runs.empty?
+      return "" if row_count == 0
 
       page = row_count.times.map { |i| " " * col_count }
       @runs.each do |run|
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/pdf/reader/page_state.rb 
new/lib/pdf/reader/page_state.rb
--- old/lib/pdf/reader/page_state.rb    2021-01-28 12:43:08.000000000 +0100
+++ new/lib/pdf/reader/page_state.rb    2021-06-06 02:15:10.000000000 +0200
@@ -30,15 +30,7 @@
         @xobject_stack = [page.xobjects]
         @cs_stack      = [page.color_spaces]
         @stack         = [DEFAULT_GRAPHICS_STATE.dup]
-        if page.rotate == 0
-          state[:ctm]  = identity_matrix
-        else
-          rotate_cos = Math.cos(page.rotate * (Math::PI/180.0)).round(2)
-          rotate_sin = Math.sin(page.rotate * (Math::PI/180.0)).round(2)
-          state[:ctm] = TransformationMatrix.new(rotate_cos, rotate_sin,
-                                                 rotate_sin * -1, rotate_cos,
-                                                 0, 0)
-        end
+        state[:ctm]  = identity_matrix
       end
 
       #####################################################
@@ -330,11 +322,13 @@
         th = state[:h_scaling]
         # optimise the common path to reduce Float allocations
         if th == 1 && tj == 0 && tc == 0 && tw == 0
-          glyph_width = w0 * fs
-          tx = glyph_width
+          tx = w0 * fs
+        elsif tj != 0
+          # don't apply spacing to TJ displacement
+          tx = (w0 - (tj/1000.0)) * fs * th
         else
-          glyph_width = ((w0 - (tj/1000.0)) * fs) * th
-          tx = glyph_width + ((tc + tw) * th)
+          # apply horizontal scaling to spacing values but not font size
+          tx = ((w0 * fs) + tc + tw) * th
         end
 
         # TODO: I'm pretty sure that tx shouldn't need to be divided by
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/pdf/reader/page_text_receiver.rb 
new/lib/pdf/reader/page_text_receiver.rb
--- old/lib/pdf/reader/page_text_receiver.rb    2021-01-28 12:43:08.000000000 
+0100
+++ new/lib/pdf/reader/page_text_receiver.rb    2021-06-06 02:15:10.000000000 
+0200
@@ -41,6 +41,7 @@
       # starting a new page
       def page=(page)
         @state = PageState.new(page)
+        @page = page
         @content = []
         @characters = []
         @mediabox = page.objects.deref(page.attributes[:MediaBox])
@@ -104,6 +105,8 @@
         glyphs.each_with_index do |glyph_code, index|
           # paint the current glyph
           newx, newy = @state.trm_transform(0,0)
+          newx, newy = apply_rotation(newx, newy)
+
           utf8_chars = @state.current_font.to_utf8(glyph_code)
 
           # apply to glyph displacment for the current glyph so the next
@@ -118,6 +121,21 @@
         end
       end
 
+      def apply_rotation(x, y)
+        if @page.rotate == 90
+          tmp = x
+          x = y
+          y = tmp * -1
+        elsif @page.rotate == 180
+          y *= -1
+        elsif @page.rotate == 270
+          tmp = x
+          x = y * -1
+          y = tmp * -1
+        end
+        return x, y
+      end
+
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/pdf/reader/width_calculator/built_in.rb 
new/lib/pdf/reader/width_calculator/built_in.rb
--- old/lib/pdf/reader/width_calculator/built_in.rb     2021-01-28 
12:43:08.000000000 +0100
+++ new/lib/pdf/reader/width_calculator/built_in.rb     2021-06-06 
02:15:10.000000000 +0200
@@ -37,23 +37,15 @@
       def glyph_width(code_point)
         return 0 if code_point.nil? || code_point < 0
 
-        m = @metrics.char_metrics_by_code[code_point]
-        if m.nil?
-          names = @font.encoding.int_to_name(code_point)
+        names = @font.encoding.int_to_name(code_point)
+        metrics = names.map { |name|
+          @metrics.char_metrics[name.to_s]
+        }.compact.first
 
-          m = names.map { |name|
-            @metrics.char_metrics[name.to_s]
-          }.compact.first
-        end
-
-        if m
-          m[:wx]
-        elsif @font.widths[code_point - 1]
-          @font.widths[code_point - 1]
-        elsif control_character?(code_point)
-          0
+        if metrics
+          metrics[:wx]
         else
-          0
+          @font.widths[code_point - 1] || 0
         end
       end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2021-01-28 12:43:08.000000000 +0100
+++ new/metadata        2021-06-06 02:15:10.000000000 +0200
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: pdf-reader
 version: !ruby/object:Gem::Version
-  version: 2.4.2
+  version: 2.5.0
 platform: ruby
 authors:
 - James Healy
 autorequire:
 bindir: bin
 cert_chain: []
-date: 2021-01-28 00:00:00.000000000 Z
+date: 2021-06-06 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: rake
@@ -277,9 +277,9 @@
 - MIT
 metadata:
   bug_tracker_uri: https://github.com/yob/pdf-reader/issues
-  changelog_uri: https://github.com/yob/pdf-reader/blob/v2.4.2/CHANGELOG
-  documentation_uri: https://www.rubydoc.info/gems/pdf-reader/2.4.2
-  source_code_uri: https://github.com/yob/pdf-reader/tree/v2.4.2
+  changelog_uri: https://github.com/yob/pdf-reader/blob/v2.5.0/CHANGELOG
+  documentation_uri: https://www.rubydoc.info/gems/pdf-reader/2.5.0
+  source_code_uri: https://github.com/yob/pdf-reader/tree/v2.5.0
 post_install_message:
 rdoc_options:
 - "--title"
@@ -293,7 +293,7 @@
   requirements:
   - - ">="
     - !ruby/object:Gem::Version
-      version: 1.9.3
+      version: '2.0'
 required_rubygems_version: !ruby/object:Gem::Requirement
   requirements:
   - - ">="

Reply via email to