def compute_carve(rule, range)
      w = rule[:box].width[@index]
      if w == :native
        file = rule[:file][@index].file
        case rule[:type]
        when :png
          Squib.cache_load_image(file).width.to_f / (range.size - 1)
        when :svg
          svg_data = rule[:svg_args].data[@index]
          unless file.to_s.empty? || svg_data.to_s.empty?
            Squib.logger.warn 'Both an SVG file and SVG data were specified'
          end
          return 0 if (file.nil? or file.eql? '') and svg_data.nil?
          svg_data = File.read(file) if svg_data.to_s.empty?
          RSVG::Handle.new_from_data(svg_data).width
        end
      else
        rule[:box].width[@index] * Pango::SCALE / (range.size - 1)
      end
    end
def compute_carve(rule, range)
      w = rule[:box].width[@index]
      if w == :native
        file = rule[:file][@index].file
        case rule[:type]
        when :png
          Squib.cache_load_image(file).width.to_f / (range.size - 1)
        when :svg
          svg_data = rule[:svg_args].data[@index]
          unless file.to_s.empty? || svg_data.to_s.empty?
            Squib.logger.warn 'Both an SVG file and SVG data were specified'
          end
          return 0 if (file.nil? or file.eql? '') and svg_data.nil?
          svg_data = File.read(file) if svg_data.to_s.empty?
          RSVG::Handle.new_from_data(svg_data).width
        end
      else
        rule[:box].width[@index] * Pango::SCALE / (range.size - 1)
      end
    end
Compute the width of the carve that we need