Method: RBPDF#SetFontSize
- Defined in:
- lib/rbpdf.rb
#SetFontSize(size) ⇒ Object Also known as: set_font_size
Defines the size of the current font.
- @param float :size
-
The size (in points)
- @access public
- @since 1.0
- @see
-
SetFont()
2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 |
# File 'lib/rbpdf.rb', line 2908 def SetFontSize(size) #Set font size in points @font_size_pt = size; @font_size = size.to_f / @k; if !@current_font['desc'].nil? and !@current_font['desc']['Ascent'].nil? and (@current_font['desc']['Ascent'] > 0) @font_ascent = @current_font['desc']['Ascent'] * @font_size / 1000.0 else @font_ascent = 0.85 * @font_size end if !@current_font['desc'].nil? and !@current_font['desc']['Descent'].nil? and (@current_font['desc']['Descent'] <= 0) @font_descent = - @current_font['desc']['Descent'] * @font_size / 1000.0 else @font_descent = 0.15 * @font_size end if (@page > 0) and !@current_font['i'].nil? out(sprintf('BT /F%d %.2f Tf ET ', @current_font['i'], @font_size_pt)); end end |