Sha256: 315e096dcbdf178edf718defe82886b6032ce9e3f04b50bb7b0684ce1f1294ee

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

module PDF
  class Inspector
    class Text < Inspector                    
      attr_accessor :font_settings, :size, :strings
      attr_accessor :character_spacing, :word_spacing
      attr_accessor :kerned, :text_rendering_mode

      def initialize     
        @font_settings = []
        @fonts = {}
        @strings = []
        @character_spacing = []
        @word_spacing = []
        @kerned = []
        @text_rendering_mode = []
      end

      def resource_font(*params)
        @fonts[params[0]] = params[1].basefont
      end

      def set_text_font_and_size(*params)     
        @font_settings << { :name => @fonts[params[0]], :size => params[1] }
      end     

      def show_text(*params)
        @kerned << false
        @strings << params[0]
      end

      def show_text_with_positioning(*params)      
        @kerned << true
        # ignore kerning information
        @strings << params[0].reject { |e| Numeric === e }.join
      end

      def set_text_rendering_mode(*params)
        @text_rendering_mode << params[0]
      end

      def set_character_spacing(*params)
        @character_spacing << params[0]
      end

      def set_word_spacing(*params)
        @word_spacing << params[0]
      end
      
    end                                       
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
pdf-inspector-1.0.2 lib/pdf/inspector/text.rb
pdf-inspector-1.0.1 lib/pdf/inspector/text.rb
pdf-inspector-1.0.0 lib/pdf/inspector/text.rb
yellowlab-pdf-inspector-1.0.0 lib/pdf/inspector/text.rb