rectangle rounded

17 views
Skip to first unread message

Benjamín Cárdenas Salamandra

unread,
May 8, 2009, 8:43:54 PM5/8/09
to prawn groups
Hello,

i'm new user from prawn groups, i want shared with you this code that i
develop yesterday, i need this object in one project and was necesary to
do that:

i suggest insert this in graphics.rb in line 245

def rectangle_rounded(point,width,height,radius)
x,y = point
line [x+radius,y],[x+width-radius,y]
line [x+radius,y-height],[x+width-radius,y-height]
line [x,y-radius],[x,y-height+radius]
line [x+width,y-radius],[x+width,y-height+radius]
l1 = radius * KAPPA
y1 = y-radius+l1
x1 = x+radius-l1
x2 = x+width-radius+l1
y2 = y-height+radius-l1
curve [x,y-radius],[x+radius,y], :bounds => [[x,y1],[x1,y]]
curve [x+width-radius,y],[x+width,y-radius], :bounds =>
[[x2,y],[x+width,y1]]
curve [x+width,y-height+radius],[x+width-radius,y-height], :bounds
=> [[x+width,y2],[x2,y-height]]
curve [x+radius,y-height],[x,y-height+radius], :bounds =>
[[x1,y-height],[x,y2]]
end

sorry my english,

and one question. I develop in jruby and have problems with this code:
font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
or any other font, i read that only happend in jruby, somebody have the
solution?. This is the error:

C:\laborsoft\vendor\gems\prawn-0.4.1\examples\text/../../lib/prawn/font/ttf.rb:259:in
`embed': undefined method `code_map' for nil:NilClass (NoMethodError)

My developmen environment is windows xp sp 3 with jruby-1.2.0RC1 and
rails 2.2.2

thanks for your help,

Benjamín

Gregory Brown

unread,
May 8, 2009, 8:56:26 PM5/8/09
to prawn...@googlegroups.com
On Fri, May 8, 2009 at 8:43 PM, Benjamín Cárdenas Salamandra
<benc...@gmail.com> wrote:
>
> Hello,
>
> i'm new user from prawn groups, i want shared with you this code that i
> develop yesterday, i need this object in one project and was necesary to
> do that:
>
> i suggest insert this in graphics.rb in line 245
>
>    def rectangle_rounded(point,width,height,radius)

Interesting. While rounded rectangles would be nice to have, there
may be support for this directly at the PDF level.
If there isn't, I'll consider adding something like your code.

Can someone look into this and let me know?

> and one question. I develop in jruby and have problems with this code:
> font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
> or any other font, i read that only happend in jruby, somebody have the
> solution?. This is the error:

Last I heard this is unfortunately a JRuby bug with no workaround,
aside from not using TTF :-/

-greg

Reply all
Reply to author
Forward
0 new messages