大虾(Ruby) - 如何使用:inline_format<color rgb=""></color>,但仍保留文字笔划?

Prawn (Ruby) - How to use :inline_format <color rgb=""></color>, but still keep the text stroke?

我知道,查看 Prawn 手册可以将内联文本绘制为 "stroked",像这样(来自手册):

fill_color "00ff00"
stroke_color "0000ff"

font_size(40) do
  # normal rendering mode: fill
  text "This text is filled with green."
  move_down 20

  # inline rendering mode: stroke
  text "This text is stroked with blue", :mode => :stroke
  move_down 20

  # block rendering mode: fill and stroke
  text_rendering_mode(:fill_stroke) do
    text "This text is filled with green and stroked with blue"
  end

而且我还知道您对内嵌格式有一定的控制权,例如:

"aaaaaaaaaaaaaaa <color rgb="xxxxxx">UP</color> aaaaaaaa"

但现在 "UP" 没有按应有的方式概述。

如何勾勒文本并使用 inline_formatting?我可以吗?

这是我尝试过的示例:

require 'prawn'

class SomeDoc < Prawn::Document
    def initialize
        super({:margin => [5,5], :page_size => 'A4'})
    end

    def draw_text
        the_text = "the word <color rgb='74B743'>DOWN</color> should be a different color and be outlined"

        text_rendering_mode(:fill_stroke) do
            stroke_color "000000"
            fill_color "FFFFFF"
            text(the_text, :inline_format => true)
        end
    end
end

test = SomeDoc.new
test.draw_text
test.render_file('test.pdf')
pdf.text_rendering_mode(:fill_stroke) do
  pdf.stroke_color "431CEF"
  pdf.text("Outlined Text")
end

而不是 stroke_color 你必须做:

pdf.stroke_color