如何解决可以在mini magickImagemagick上设置粗体文本的格式
我在Ruby on Rails上有一个文凭生成器,可以在图像模板上绘制一些文本变量,现在我需要在一个语句中突出显示某些单词
例如(注意专业知识时要加粗):
已达到认证要求 并在群组名称中被确认为专业 完成小时的课程和 online_hours 的学习时间
我知道Imagemagick允许使用某些字体绘制文本,但是我看起来很相似,但只能应用于某些单词。
我的模板文字:
证明书合格证 是comcom:expertise zh:cohort_name cumpliendo:小时小时数y:online_hours时间空档
我的代码:
def formatted_text(text)
formatted_text = text
formatted_text = formatted_text.gsub(/:cohort_name/,cohort_name.to_s)
formatted_text = formatted_text.gsub(/:hours/,hours.to_s)
formatted_text = formatted_text.gsub(/:online_hours/,online_hours.to_s)
formatted_text = formatted_text.gsub(/:expertise/,expertise.to_s)
formatted_text
end
image_cert = MiniMagick::Image.open(cert.url)
image_cert.combine_options do |c|
if certification_type.footer_text
c.gravity "West"
c.draw "text 120,80 '#{formatted_footer}'"
end
end
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。