Module: Prawn::Measurements

Included in:
Numeric
Defined in:
lib/prawn/measurements.rb

Instance Method Summary collapse

Instance Method Details

#cm2mm(cm) ⇒ Object

metric conversions



11
12
13
# File 'lib/prawn/measurements.rb', line 11

def cm2mm(cm)
  return cm*10
end

#cm2pt(cm) ⇒ Object



55
56
57
# File 'lib/prawn/measurements.rb', line 55

def cm2pt(cm)
  return mm2pt(cm2mm(cm))
end

#dm2mm(dm) ⇒ Object



15
16
17
# File 'lib/prawn/measurements.rb', line 15

def dm2mm(dm)
  return dm*100  
end

#dm2pt(dm) ⇒ Object



59
60
61
# File 'lib/prawn/measurements.rb', line 59

def dm2pt(dm)
  return mm2pt(dm2mm(dm))
end

#ft2in(ft) ⇒ Object

imperial conversions

from en.wikipedia.org/wiki/Imperial_units



27
28
29
# File 'lib/prawn/measurements.rb', line 27

def ft2in(ft)
  return ft * 12
end

#ft2pt(ft) ⇒ Object



43
44
45
# File 'lib/prawn/measurements.rb', line 43

def ft2pt(ft)
  return in2pt(ft2in(ft))
end

#in2pt(inch) ⇒ Object

PostscriptPoint-converisons



39
40
41
# File 'lib/prawn/measurements.rb', line 39

def in2pt(inch)
  return inch * 72    
end

#m2mm(m) ⇒ Object



19
20
21
# File 'lib/prawn/measurements.rb', line 19

def m2mm(m)
  return m*1000
end

#m2pt(m) ⇒ Object



63
64
65
# File 'lib/prawn/measurements.rb', line 63

def m2pt(m)
  return mm2pt(m2mm(m))
end

#mm2pt(mm) ⇒ Object



51
52
53
# File 'lib/prawn/measurements.rb', line 51

def mm2pt(mm)
    return mm*(72 / 25.4)
end

#pt2mm(pt) ⇒ Object



67
68
69
# File 'lib/prawn/measurements.rb', line 67

def pt2mm(pt)    
  return pt * 1 / mm2pt(1)# (25.4 / 72)
end

#yd2in(yd) ⇒ Object



31
32
33
# File 'lib/prawn/measurements.rb', line 31

def yd2in(yd)
  return yd*36
end

#yd2pt(yd) ⇒ Object



47
48
49
# File 'lib/prawn/measurements.rb', line 47

def yd2pt(yd)
  return in2pt(yd2in(yd))
end