samples/autoscale_font/_autoscale_font.rb
def autoscale(str_array)
  str_array.map do | str |
    case str.length
    when 0..15
      10.66
    when 16..20
      6
    else
      4
    end
  end
end
# Here's an example of being able to scale a font
# based on the length of individual string.
# Handy for making minor font scales to fill text boxes.
Here's an example of being able to scale a font
based on the length of individual string.
Handy for making minor font scales to fill text boxes.
Here ' s an example of being able to scale a font based on the length of individual string . Handy for making minor font scales to fill text boxes .
def autoscale(str_array)
  str_array.map do | str |
    case str.length
    when 0..15
      10.66
    when 16..20
      6
    else
      4
    end
  end
end
def autoscale ( str_array ) str_array . map do | str | case str . length when 0 .. 15 10.66 when 16 .. 20 6 else 4 end end end
Here's an example of being able to scale a font
based on the length of individual string.
Here ' s an example of being able to scale a font based on the length of individual string .
str_array