rghost icon indicating copy to clipboard operation
rghost copied to clipboard

text_align: :center in text area doesn't produce accurate word wrapping

Open nkarki opened this issue 9 years ago • 4 comments

The word wrapping in text area worked awesome when using text_align left or right. But with text_align center it goes up to twice the width going outside the text area

The code snippet that I am using

doc = RGhost::Document.new
doc.define_tags do
  tag :font1, name: 'Helvetica', size: 14, color: '#0000FF'
end

doc.frame x: 6, y: 1, width: 1, height: 2, content: { fill: '#AAFA49'}
doc.text_area '<font1>test test test test hello awesome test yohohoho!!!'\ 
                      'abracadabra suntali testing word wrap</font1>', x: 6, y:3,
                      width: 1, row_height: 0.25, text_align: :center

left align output is as follows left_align

center align output is as follows center_align

nkarki avatar Sep 08 '15 07:09 nkarki

Can remove <font1> tag out of the string and share the result?

shairontoledo avatar Sep 09 '15 13:09 shairontoledo

Same results without the <font> tag. Left align works but not center align

left align left align no font

center align center align no font

nkarki avatar Sep 10 '15 08:09 nkarki

Hey Man,

Any chance that you had time to spend on this?

Thanks!

nkarki avatar Sep 16 '15 10:09 nkarki

Thank you for your earlier response.

I was able to add <br/> tags to the text_val with the help of rmagick gem which then rendered word wrap just the way I wanted.

nkarki avatar Sep 23 '15 06:09 nkarki