Вопрос

In CSS, you can do custom underline with background images. This technique is explained here:

http://alistapart.com/article/customunderlines

Using this technique, I can do something like this:

enter image description here

With Prawn, the only underline I know of is using inline formatting:

text "<u>Ugly Underline</u>", size: 60, inline_format: TRUE

enter image description here

I subtle difference to some, but as a graphic designer this makes all the difference.

Does anyone know if any techniques that would allow me to do a custom underline using Prawn?

Это было полезно?

Решение

I ended up using the :callback option for formatted_text_box.

class CustomUnderlineCallback

  def initialize(options)
    @document = options[:document]
  end

  def render_in_front(fragment)
    @document.stroke_color COLOR_WHITE
    @document.stroke_polygon fragment.bottom_left, fragment.bottom_right
    @document.stroke_color COLOR_BLACK
  end

end

Другие советы

Try this:

table([["Does this work?"]] , :cell_style => {:borders => [:bottom]})

There are options to set border-color width etc.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top