units: support mm

Closes #161
This commit is contained in:
Andy Meneely
2016-06-27 11:10:39 -04:00
parent acd04b34a3
commit 4ea30c63e2
7 changed files with 77 additions and 2 deletions
+19
View File
@@ -0,0 +1,19 @@
mm
------
Given millimeters, returns the number of pixels according to the deck's DPI.
Parameters
^^^^^^^^^^
n
the number of mm
Examples
^^^^^^^^
.. code-block:: ruby
mm(1) # 11.811px (for default Deck::dpi of 300)
mm(2) + mm(1) # 35.433ox (for default Deck::dpi of 300)
+1 -1
View File
@@ -1,6 +1,6 @@
Unit Conversion
===============
By default, Squib thinks in pixels. This decision was made so that we can have pixel-perfect layouts without automatically scaling everything, even though working in units is sometimes easier. We provide some conversion methods, including looking for strings that end in "in" and "cm" and computing based on the current DPI. The dpi is set on `Squib::Deck.new` (not `config.yml`).
By default, Squib thinks in pixels. This decision was made so that we can have pixel-perfect layouts without automatically scaling everything, even though working in units is sometimes easier. We provide some conversion methods, including looking for strings that end in "in", "cm", or "mm" and computing based on the current DPI. The dpi is set on `Squib::Deck.new` (not `config.yml`).
Example is in `samples/units.rb` found [here](https://github.com/andymeneely/squib/tree/master/samples/units.rb)