Module: Prawn::Measurements

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

Stable API collapse

Instance Method Details

#cm2mm(cm) ⇒ Object

metric conversions



13
14
15
# File 'lib/prawn/measurements.rb', line 13

def cm2mm(cm)
  return cm*10
end

#cm2pt(cm) ⇒ Object



61
62
63
# File 'lib/prawn/measurements.rb', line 61

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

#dm2mm(dm) ⇒ Object



17
18
19
# File 'lib/prawn/measurements.rb', line 17

def dm2mm(dm)
  return dm*100
end

#dm2pt(dm) ⇒ Object



65
66
67
# File 'lib/prawn/measurements.rb', line 65

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

#ft2in(ft) ⇒ Object

imperial conversions from en.wikipedia.org/wiki/Imperial_units



29
30
31
# File 'lib/prawn/measurements.rb', line 29

def ft2in(ft)
  return ft * 12
end

#ft2pt(ft) ⇒ Object



49
50
51
# File 'lib/prawn/measurements.rb', line 49

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

#in2pt(inch) ⇒ Object



45
46
47
# File 'lib/prawn/measurements.rb', line 45

def in2pt(inch)
  return inch * 72
end

#m2mm(m) ⇒ Object



21
22
23
# File 'lib/prawn/measurements.rb', line 21

def m2mm(m)
  return m*1000
end

#m2pt(m) ⇒ Object



69
70
71
# File 'lib/prawn/measurements.rb', line 69

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

#mm2pt(mm) ⇒ Object



57
58
59
# File 'lib/prawn/measurements.rb', line 57

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

#pt2mm(pt) ⇒ Object



73
74
75
# File 'lib/prawn/measurements.rb', line 73

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

#pt2pt(pt) ⇒ Object

PostscriptPoint-converisons



41
42
43
# File 'lib/prawn/measurements.rb', line 41

def pt2pt(pt)
  return pt
end

#yd2in(yd) ⇒ Object



33
34
35
# File 'lib/prawn/measurements.rb', line 33

def yd2in(yd)
  return yd*36
end

#yd2pt(yd) ⇒ Object



53
54
55
# File 'lib/prawn/measurements.rb', line 53

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