windows ImageMagick:粗体和斜体字体?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7183420/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ImageMagick: Bold and Italic Fonts?
提问by David Veeneman
When using ImageMagick from the command line, how do I specify a bold or italic font?
从命令行使用 ImageMagick 时,如何指定粗体或斜体字体?
I have tried the -weight Bold
and -style Italic
arguments, but they have no effect, at least not on my Windows 7 system. I have tried calling typefaces by name (e.g., -font "Arial Bold Italic"
) but I get the base font (e.g., "Arial"). I'm using -annotate to overlay a string on a picture.
我已经尝试过-weight Bold
和-style Italic
参数,但它们没有效果,至少在我的 Windows 7 系统上没有。我曾尝试按名称调用字体(例如,-font "Arial Bold Italic"
),但我得到了基本字体(例如,“Arial”)。我正在使用 -annotate 在图片上覆盖一个字符串。
Thanks in advance for your help.
在此先感谢您的帮助。
回答by moropus
Try font name with hyphens: -font "Arial-Bold-Italic"
- it worked on my Windows 7 (like you, I couldn't make -style
option working). Order of styles (Bold-Italic) is important here.
试试带连字符的字体名称:-font "Arial-Bold-Italic"
- 它在我的 Windows 7 上工作(像你一样,我无法让-style
选项工作)。样式顺序(粗斜体)在这里很重要。
To see all the fonts available to ImageMagick, use convert -list font
(and additionally maybe >C:\fonts.txt
, because the list is usually very long).
要查看 ImageMagick 可用的所有字体,请使用convert -list font
(另外可能是>C:\fonts.txt
,因为列表通常很长)。
回答by Norbert S
I had the same problem: -font "Arial-Italic"
did not produce italic and -style
resulted in an error. However, -font "Times-Italic"
works. For whatever reason, many of the italic fonts listed with convert -list font
are not functional. Times-Italic is the only one I found that actually produces italic text. I use GraphicsMagick 1.3.28 on Ubuntu 18.04.3 LTS.
我有同样的问题:-font "Arial-Italic"
没有产生斜体并-style
导致错误。但是,-font "Times-Italic"
有效。无论出于何种原因,列出的许多斜体字体convert -list font
都不起作用。Times-Italic 是我发现的唯一一种实际生成斜体文本的字体。我在 Ubuntu 18.04.3 LTS 上使用 GraphicsMagick 1.3.28。