Sha256: a3203c1aaad18d8efcb9617cdd81848e358bd6e5ac0e2142ba7db31e9892b010

Contents?: true

Size: 1.3 KB

Versions: 33

Compression:

Stored size: 1.3 KB

Contents

# encoding: utf-8
# measurements.rb: Conversions from other measurements to PDF points
#
# Copyright December 2008, Florian Witteler.  All Rights Reserved.
#
module Prawn  
  module Measurements
  
    # ============================================================================
    #metric conversions
    def cm2mm(cm)
      return cm*10
    end
  
    def dm2mm(dm)
      return dm*100  
    end
  
    def m2mm(m)
      return m*1000
    end
  
    # ============================================================================
    # imperial conversions    
    # from http://en.wikipedia.org/wiki/Imperial_units
  
    def ft2in(ft)
      return ft * 12
    end  

    def yd2in(yd)
      return yd*36
    end

  
    # ============================================================================
    # PostscriptPoint-converisons
  
    def in2pt(inch)
      return inch * 72    
    end
  
    def ft2pt(ft)
      return in2pt(ft2in(ft))
    end
  
    def yd2pt(yd)
      return in2pt(yd2in(yd))
    end
  
    def mm2pt(mm)
        return mm*(72 / 25.4)
    end
  
    def cm2pt(cm)
      return mm2pt(cm2mm(cm))
    end
  
    def dm2pt(dm)
      return mm2pt(dm2mm(dm))
    end
  
    def m2pt(m)
      return mm2pt(m2mm(m))
    end
  
    def pt2mm(pt)    
      return pt * 1 / mm2pt(1)# (25.4 / 72)
    end
  end
end

Version data entries

33 entries across 33 versions & 10 rubygems

Version Path
kavu-prawn-core-0.4.100 lib/prawn/measurements.rb
kavu-prawn-core-0.4.99 lib/prawn/measurements.rb
prawn-1.0.0.rc2 lib/prawn/measurements.rb
nurettin-prawn-1.0.0.rc1 lib/prawn/measurements.rb
prawn-1.0.0.rc1 lib/prawn/measurements.rb
prawn-0.12.0 lib/prawn/measurements.rb
prawn-0.11.1 lib/prawn/measurements.rb
davebenvenuti-prawn-0.11.1.pre lib/prawn/measurements.rb
piglop-prawn-0.10.2.3 lib/prawn/measurements.rb
piglop-prawn-0.10.2.2 lib/prawn/measurements.rb
piglop-prawn-0.10.2.1 lib/prawn/measurements.rb
prawn-0.11.1.pre lib/prawn/measurements.rb
goodwill-prawn-edge-0.10.0 lib/prawn/measurements.rb
alphasights-prawn-0.10.4 lib/prawn/measurements.rb
alphasights-prawn-0.10.3 lib/prawn/measurements.rb
alphasights-prawn-0.10.2 lib/prawn/measurements.rb
alphasights-prawn-0.10.1 lib/prawn/measurements.rb
alphasights-prawn-0.10.0 lib/prawn/measurements.rb
prawn-core-0.8.4 lib/prawn/measurements.rb
prawn-graph-0.0.2 vendor/prawn-core/lib/prawn/measurements.rb