Skip to content

Instantly share code, notes, and snippets.

@dscataglini
Created December 14, 2010 20:39
Show Gist options
  • Save dscataglini/741063 to your computer and use it in GitHub Desktop.
Save dscataglini/741063 to your computer and use it in GitHub Desktop.
silly script to print out a matrix of font-sizes
def font_size_matrix(default = 16)
puts "px\t%\t\s\sem"
(10..26).each do |n|
val = (n * 100) / default.to_f
puts "#{n}px\t%0.1f%%\t\s\s%0.3fem" % [val, val/100]
end
end
font_size_matrix
# output for 13 is:
# px % em
# 10px 76.9% 0.769em
# 11px 84.6% 0.846em
# 12px 92.3% 0.923em
# 13px 100.0% 1.000em
# 14px 107.7% 1.077em
# 15px 115.4% 1.154em
# 16px 123.1% 1.231em
# 17px 130.8% 1.308em
# 18px 138.5% 1.385em
# 19px 146.2% 1.462em
# 20px 153.8% 1.538em
# 21px 161.5% 1.615em
# 22px 169.2% 1.692em
# 23px 176.9% 1.769em
# 24px 184.6% 1.846em
# 25px 192.3% 1.923em
# 26px 200.0% 2.000em
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment