Skip to content

Commit

Permalink
memoize the normalized-height calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
jamis committed Jan 11, 2009
1 parent b2acc8f commit 5a3c748
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/prawn/font.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ def size(points=nil)
end

def height_at(size)
(@ascender - @descender + @line_gap) / 1000.0 * size
@normalized_height ||= (@ascender - @descender + @line_gap) / 1000.0
@normalized_height * size
end

# Gets height of current font in PDF points at current font size
Expand Down

0 comments on commit 5a3c748

Please sign in to comment.