Word spacing and hfill

228 views
Skip to first unread message

tareq

unread,
Jun 23, 2011, 11:28:08 AM6/23/11
to Prawn
Hi,

I am new to prawn. I was trying to write a simple name using

pdf.text "Mr. #{@user.name}".

But there seems to be no space between two words in the name. Is there
some specific condition I need to turn on or I am testing it wrong?

Also, How do I generate the latex-like horizontal fill feature in
prawn?

{some text}{\hfill}{some text}

Thanks in advance.

Daniel Nelson

unread,
Jun 23, 2011, 12:46:00 PM6/23/11
to prawn...@googlegroups.com
> But there seems to be no space between two words in the name. Is there
> some specific condition I need to turn on or I am testing it wrong?

Are you viewing in Chrome on Ubuntu? Missing spaces is a known problem
with that combination (with any PDF, not just Prawn generated PDFs).
Other readers display the spaces fine.

> Also, How do I generate the latex-like horizontal fill feature in
> prawn?

Brad implemented a Knuth text algorithm, but it may not work with the
current implementation of text.

There is an :align => :justify option in Prawn text, but it is just a
simple approach that expands the width of spaces as needed.

There are also character spacing and word spacing methods. Check out
the manual and the api.

-Daniel

Reply all
Reply to author
Forward
0 new messages