how to outline a font character in prawn / ruby (pdf)
I would like to draw a character (TTF) as vector and wondering how to perhaps draw the outline of the character. It appears that characters are "filled" with color suggesting the possibility to outline. I've tried stroke_color to no avail. I am using ruby and prawn开发者_高级运维 to render in pdf. Thanks.
I've been needing this feature myself, so I just added it to prawn. With the caveat that the API may change slightly after feature review from the other devs, here's how it works:
Prawn::Document.generate "rendering_mode.pdf" do |pdf|
pdf.fill_color "00ff00"
pdf.stroke_color "0000ff"
pdf.text("Inline mode", :mode => 1, :size => 40)
end
For a list of valid values to mode, check the code docs for the text_rendering_mode method.
If you want to cherry pick the changes, the specific commit that adds support is at here.
精彩评论