Method: PDF::Core::Text#text_direction
- Defined in:
- lib/pdf/core/text.rb
#text_direction(direction = nil) ⇒ Object Also known as: text_direction=
Call with no argument to retrieve the current text direction.
Call with a symbol to set the document-wide text direction. This can be overridden using the :direction text option when drawing text or a text box.
pdf.text_direction = :rtl
pdf.text("hello world") # prints "dlrow olleh"
pdf.text("hello world", :direction => :ltr) # prints "hello world"
Valid directions are:
-
:ltr - left-to-right (default)
-
:rtl - right-to-left
Side effects:
-
When printing left-to-right, the default text alignment is :left
-
When printing right-to-left, the default text alignment is :right
112 113 114 115 116 117 118 |
# File 'lib/pdf/core/text.rb', line 112 def text_direction(direction=nil) if direction.nil? defined?(@text_direction) && @text_direction || :ltr else @text_direction = direction end end |