why cant I do a :at=> along with inline_formatting?

49 views
Skip to first unread message

rubes

unread,
Jun 5, 2012, 12:29:51 AM6/5/12
to Prawn
I've been waiting since 0.6.3 for an upgrade that really gives me what
I got from prawn-format. Thats almost 3 years now. I need :at=> to
work with :inline_format and have 10s of complicated documents I build
using prawn-format back in the day.

What is left is support inline formatting with anything that
supports :at=>. I tried with 1.0.0.rc1 and text_box
but :inline_format=>true doesn't seem to work. I spent many a night
switching to draw_text but I see I cant do inline_formatting there
either. :(

Bummed and waiting years...

Brad Ediger

unread,
Jun 5, 2012, 10:00:32 PM6/5/12
to prawn...@googlegroups.com
This works for me against master:

text_box "hello <b>world</b>!", at: [100, 100], inline_format: true

What problems are you seeing?

rubes

unread,
Jun 7, 2012, 1:01:03 AM6/7/12
to Prawn

Although your syntax is something I'm not familiar with (only been
working in 1.8.7 ruby), your example worked (once converted).

However, I use font sizing and coloring extensively within the text
(as a percentage) and it seems <font> is not supported in the
inline_format. This is again a deal killer for me as I dont have
months of my life coming up with an alternate solution just to
upgrade. Also doesn't seem like :inline_format supports a '&nbsp;'

I'm looking for :inline_format to support <font> and I need the text
writing to write :at=>

Is there any hope? I just want what I had 3 years ago.


On Jun 5, 9:00 pm, Brad Ediger <brad.edi...@madriska.com> wrote:
> On Mon, Jun 4, 2012 at 11:29 PM, rubes <rubes...@comcast.net> wrote:
> > I've been waiting since 0.6.3 for an upgrade that really gives me what
> > I got from prawn-format.   Thats almost 3 years now.   I need :at=> to
> > work with :inline_formatand have 10s of complicated documents I build
> > using prawn-format back in the day.
>
> > What is left is support inline formatting with anything that
> > supports :at=>.   I tried with 1.0.0.rc1 and text_box
> > but :inline_format=>true doesn't seem to work.   I spent many a night
> > switching to draw_text but I see I cant do inline_formatting there
> > either.  :(
>
> This works for me against master:
>
>     text_box "hello <b>world</b>!", at: [100, 100],inline_format: true

Brad Ediger

unread,
Jun 7, 2012, 12:46:51 PM6/7/12
to prawn...@googlegroups.com
On Thu, Jun 7, 2012 at 12:01 AM, rubes <rube...@comcast.net> wrote:
>
> Although your syntax is something I'm not familiar with (only been
> working in 1.8.7 ruby), your example worked (once converted).
>
> However, I use font sizing and coloring extensively within the text
> (as a percentage) and it seems <font> is not supported in the
> inline_format.  This is again a deal killer for me as I dont have
> months of my life coming up with an alternate solution just to
> upgrade.  Also doesn't seem like :inline_format supports a '&nbsp;'

The new syntax is:

<color rgb='ff0000'>blah</color>
<font size='9'>blah</font>

I don't think the parser has support for non-breaking space entities,
but the text rendering engine should support them if you embed them as
Unicode characters. We even have the constant ready for you to use:

pdf.text(my_text.gsub("&nbsp;", Prawn::Text::NBSP))

> Is there any hope?   I just want what I had 3 years ago.

There is hope! But you may have to read some documentation; Prawn's
API has changed quite a bit in the last 3 years. Please see Prawn's
manual for details:

http://prawn.majesticseacreature.com/manual.pdf

Hope this helps,
Brad
Reply all
Reply to author
Forward
0 new messages