Ruby 对虾:有没有一种方法可以垂直对齐一个盒子中的所有内容?

Ruby 对虾:有没有一种方法可以垂直对齐一个盒子中的所有内容?,ruby,alignment,prawn,bounding-box,valign,Ruby,Alignment,Prawn,Bounding Box,Valign,我试图将一些内容垂直放置在边界框的中心位置。对于单个文本,这没有问题: bounding_box([0, bounds.top], :width => pdf.bounds.right, :height => pdf.bounds.top) do text "vertically aligned in the surrounding box", :valign => :center end 但是,如果边界框中有多个元素,我该怎么办: bounding_box([0, bo

我试图将一些内容垂直放置在边界框的中心位置。对于单个文本,这没有问题:

bounding_box([0, bounds.top], :width => pdf.bounds.right, :height => pdf.bounds.top) do
  text "vertically aligned in the surrounding box", :valign => :center
end
但是,如果边界框中有多个元素,我该怎么办:

bounding_box([0, bounds.top], :width => pdf.bounds.right, :height => pdf.bounds.top) do
  text "vertically aligned in the surrounding box", :valign => :center
  text "vertically aligned in the surrounding box", :valign => :center
end
那不行,当你尝试这个时,文本被覆盖了

我正在寻找一种方法,将边界框的整个内容分组,然后垂直对齐整个组。有没有办法用虾来做这个

非常感谢你的帮助!
Chris

如果您只有文本行,您仍然可以在文本中使用
格式化的\u text
\n

formatted_text [
    { text: "#{line1}\n" },
    { text: "#{line2}" }
  ],
  valign: :center,
  leading: 6
我仍在试图弄清楚如何处理图片/图例组,因为即使是表格似乎也不起作用