ruby prawn 如何在对齐的右图像周围环绕文本? [英] ruby prawn how to wrap text around an aligned right image?

查看:71
本文介绍了ruby prawn 如何在对齐的右图像周围环绕文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 float:right 属性将图像向右对齐并像在 html 和 css 中一样在图像周围环绕文本?

s it posible to align an image to the right and wrap text around the image like it is in html and css using the float:right property ?

如果是这样,你怎么做?

If so how do you do this ?

我可以对齐图像,但不知道如何在其周围环绕文本.文本是动态文本,因此长度变化很大.

I can align an image but dont't know how to wrap the text around it. The text is dynamic text therefore varies alot in length.

非常感谢瑞克

推荐答案

一个建议是尝试嵌套边界框.主边界框将在其中包含文本.在某些时候图像的另一个边界框.

One suggestion is to try nested bounding boxes. The main bounding box would have the text inside it. with at some point another bounding box for the image. Something along the lines of

bounding_box([x,y], :width => bounds.width, :height => 400) do
    text "blah"
    text "blah"
    # image
    bounding_box([bounds.right - image_width, 0], :width => image_width) do
          image("path_to_file", :at => [0,0], :width =>  bounds)
    text "more blah"


end

您可以简单地使用没有边界框的图像,但边界框会确保文本围绕它流动.

You may be able to simply use the image without the bounding box, but the bounding box would ensure that the text flows around it.

这篇关于ruby prawn 如何在对齐的右图像周围环绕文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆