如何使用 png 终端通过 gnuplot 访问各种 true type 字体?
我正在尝试输出 arial 大小 14 字体的 png 图像。我使用 mac OS X 10.6 并且没有自己构建 GNUPLOT。我从一个名为 High Performance Computing for OS X 的网站上获得了 Octave 软件包中的程序。这是我在 gnuplot 中输入的内容:
G N U P L O T
Version 4.2 patchlevel 5
last modified Mar 2009
System: Darwin 10.0.0
Copyright (C) 1986 - 1993, 1998, 2004, 2007 - 2009
Thomas Williams, Colin Kelley and many others
Type `help` to access the on-line reference manual.
The gnuplot FAQ is available from http://www.gnuplot.info/faq/
Send bug reports and suggestions to <http://sourceforge.net/projects/gnuplot>
Terminal type set to 'x11'
gnuplot> set term png font "arial" 14
Terminal type set to 'png'
No TTF font support, using internal non-scalable font
^
invalid color spec, must be xRRGGBB
gnuplot>
任何帮助将不胜感激。谢谢!
I am trying to output a png image with an arial size 14 font. I use mac OS X 10.6 and did not build GNUPLOT myself. I got the program from a website called High Performance Computing for OS X in the package for Octave. Here is what I entered in gnuplot:
G N U P L O T
Version 4.2 patchlevel 5
last modified Mar 2009
System: Darwin 10.0.0
Copyright (C) 1986 - 1993, 1998, 2004, 2007 - 2009
Thomas Williams, Colin Kelley and many others
Type `help` to access the on-line reference manual.
The gnuplot FAQ is available from http://www.gnuplot.info/faq/
Send bug reports and suggestions to <http://sourceforge.net/projects/gnuplot>
Terminal type set to 'x11'
gnuplot> set term png font "arial" 14
Terminal type set to 'png'
No TTF font support, using internal non-scalable font
^
invalid color spec, must be xRRGGBB
gnuplot>
Any help would be greatly appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以下内容适用于通过 MacPorts 安装 gnuplot 的 Mac OS X 10.5:
该文档可通过
helpterminal png
获得(强调是我的):更新:我刚刚注意到您的 gnuplot 安装抱怨“没有 TTF 字体支持”,因此上述内容可能不适合您。为了让 true type 字体完全正常工作,您可能必须重新安装 gnuplot。
The following works on Mac OS X 10.5 with gnuplot installed via MacPorts:
The documentation is available via
help terminal png
(emphasis mine):Update: I just noticed that your gnuplot installation complains about "No TTF font support", so the above may not work for you. In order to get true type fonts to work at all, you probably have to re-install gnuplot.
谢谢! $GDFONTPATH 的信息对于 MacOS 确实很有帮助。
添加行:
到我的 /Users/username/.profile 解决了我的问题。不要忘记获取
.profile
文件。或者重新启动终端。这样变量就被加载了。Thanks! The info with $GDFONTPATH was really helpful for on MacOS.
Adding the line:
to my /Users/username/.profile solved the Problem for me. Don't forget to source the
.profile
file. Or to restart the Terminal. So that the variable gets loaded.这取决于终端类型
(X)Ubuntu LTS GNU/Linux,
默认情况下,gnuplot 似乎会在整个目录中查找字体。例如,以下行默认与
terminal png
一起使用:即使我没有设置环境变量,并且包管理器之前已在
/usr/share/texmf/fonts 中安装了此字体/opentype/public/tex-gyre
。好的!但是,如果我使用更高级的
terminal pngcairo
,则由其名称指定完全相同的字体;不是它的文件名。更好!另请注意指定字体大小的语法差异。
It depends on the terminal type
On (X)Ubuntu LTS GNU/Linux,
gnuplot
seems to look up fonts in a whole host of directories by default. For example, the following line worked by default with theterminal png
:Even though I had no environment variables set and the package manager had previously installed this font in
/usr/share/texmf/fonts/opentype/public/tex-gyre
. Nice!However, if I employ the more advanced
terminal pngcairo
, the very same font is specified by its name; not its filename. Even nicer!Please, also notice the syntactic difference in specifying the font size.