【问题标题】:Custom Underline Using Prawn使用虾的自定义下划线
【发布时间】:2013-10-30 15:00:22
【问题描述】:

在 CSS 中,您可以对背景图像进行自定义下划线。此处解释了此技术:

http://alistapart.com/article/customunderlines

使用这种技术,我可以做这样的事情:

对于 Prawn,我所知道的唯一下划线是使用内联格式:

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

我对某些人有些细微的差别,但作为平面设计师,这一切都不同。

有谁知道是否有任何技术可以让我使用 Prawn 进行自定义下划线?

【问题讨论】:

    标签: ruby-on-rails ruby prawn underline


    【解决方案1】:

    我最终使用了 formatted_text_box 的 :callback 选项。

    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
    

    【讨论】:

      【解决方案2】:

      试试这个:

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

      有设置border-colorwidth等选项。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-12-01
        • 1970-01-01
        • 2015-06-29
        • 1970-01-01
        • 2013-07-07
        • 1970-01-01
        相关资源
        最近更新 更多