Method: RBPDF#GetStringWidth
- Defined in:
- lib/rbpdf.rb
#GetStringWidth(s, fontname = '', fontstyle = '', fontsize = 0, getarray = false) ⇒ Object Also known as: get_string_width
Returns the length of a string in user unit. A font must be selected.
- @param string :s
-
The string whose length is to be computed
- @param string :fontname
-
Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained.
- @param string :fontstyle
-
Font style. Possible values are (case insensitive):
-
empty string: regular
-
B: bold
-
I: italic
-
U: underline
-
D: line trough
-
O: overline
or any combination. The default value is regular.
-
- @param float :fontsize
-
Font size in points. The default value is the current size.
- @param boolean :getarray
-
if true returns an array of characters widths, if false returns the total length.
- @return mixed int
-
total string length or array of characted widths
- @author
-
Nicola Asuni
- @access public
- @since 1.2
2503 2504 2505 |
# File 'lib/rbpdf.rb', line 2503 def GetStringWidth(s, fontname='', fontstyle='', fontsize=0, getarray=false) return GetArrStringWidth(utf8Bidi(UTF8StringToArray(s), s, rtl_text_dir), fontname, fontstyle, fontsize, getarray) end |