如何在 prawn / ruby​​ 中勾画字体字符 (pdf)

发布于 2024-09-30 09:45:56 字数 111 浏览 0 评论 0原文

我想绘制一个字符(TTF)作为矢量,并想知道如何绘制字符的轮廓。字符似乎被“填充”了颜色,暗示了勾画轮廓的可能性。我尝试了中风颜色但无济于事。我正在使用 ruby​​ 和 prawn 来渲染 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情定在深秋 2024-10-07 09:45:56

我自己也一直需要这个功能,所以就给虾加了它。需要注意的是,在其他开发人员审核功能后,API 可能会略有变化,其工作原理如下:

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

有关模式的有效值列表,请检查 text_rendering_mode 方法的代码文档。

如果您想挑选更改,添加支持的具体提交位于此处

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文