当前位置: 代码网 > 科技>操作系统>Unix > FreeBSD下如何使GraphicsMagick支持中文字体?

FreeBSD下如何使GraphicsMagick支持中文字体?

2017年03月15日 Unix 我要评论
FreeBSD下如何使GraphicsMagick支持中文字体?最近一些朋友在问FreeBSD下如何使GraphicsMagick支持中文字体?今天小编为大家带来的是FreeBSD下使GraphicsMagick支持中文字体的方法!有需要的朋友一起去看看吧... 17-03-15

1、安装:

pkg install graphicsmagick

2、查看编译参数:

重点看红字部分,这部分决定了windows字体的存放路径,如果系统中没有这个路径,就mkdir一个。

注意:freebsd10.3更改了这个默认路径,以前在/usr/local/lib/x11下面,现在改到/usr/local/share里面,更为合理一些。

# gm -version
graphicsmagick 1.3.23 2015-11-07 q16 http://www.graphicsmagick.org/
copyright (c) 2002-2015 graphicsmagick group.
additional copyrights and licenses apply to this software.
see http://www.graphicsmagick.org/www/copyright.html for details.
feature support:
native thread safe yes
large files (> 32 bit) yes
large memory (> 32 bit) yes
bzip yes
dps no
flashpix no
freetype yes
ghostscript (library) no
jbig yes
jpeg-2000 yes
jpeg yes
little cms yes
loadable modules no
openmp yes (201107)
png yes
tiff yes
trio no
umem no
webp yes
wmf yes
x11 yes
xml yes
zlib yes
host type: amd64-portbld-freebsd10.1
configured using the command:
./configure '--enable-shared' '--enable-static' '--with-windows-font-dir=/usr/local/share/fonts/webfonts' '--without-perl' '--without-dps' '--without-fpx' '--with-threads' '--enable-onmp' '--disable-openmp-slow' '--with-quantum-depth=16' '--with-webp' '--with-wmf' '--with-x' '--with-xml' '--x-libraries=/usr/local/lib' '--x-includes=/usr/local/include' '--prefix=/usr/cal' '--localstatedir=/var' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=amd64-portbld-freebsd10.1' 'build_alias=amd64-portbld-freebsd10.1' 'cc=gcc48' 'cflags=-o2 -pip -isystem /usr/local/include -fstack-protector -wl,-rpath=/usr/local/lib/gcc48 -fno-strict-aliasing' 'ldflags= -l/usr/local/lib -fstack-protector -wl,-rpath=/usr/local/lib/gcc48 -l/usr/lal/lib/gcc48' 'libs=' 'cppflags=-isystem /usr/local/include' 'cpp=cpp48' 'cxx=c++' 'cxxflags=-o2 -pipe -isystem /usr/local/include -fstack-protector -wl,-rpath=/usr/local/lib/gcc48 -fno-rict-aliasing -isystem /usr/local/include -wl,-rpath=/usr/local/lib/gcc48'
final build parameters:
cc = gcc48 -std=gnu99
cflags = -fopenmp -o2 -pipe -isystem /usr/local/include -fstack-protector -wl,-rpath=/usr/local/lib/gcc48 -fno-strict-aliasing -wall -d_thread_safe
cppflags = -isystem /usr/local/include -i/usr/local/include -i/usr/local/include/freetype2 -i/usr/local/include/libxml2
cxx = c++
cxxflags = -o2 -pipe -isystem /usr/local/include -fstack-protector -wl,-rpath=/usr/local/lib/gcc48 -fno-strict-aliasing -isystem /usr/local/include -wl,-rpath=/usr/local/lib/gcc48 -d_tead_safe
ldflags = -l/usr/local/lib -fstack-protector -wl,-rpath=/usr/local/lib/gcc48 -l/usr/local/lib/gcc48 -l/usr/local/lib
libs = -ljbig -lwebp -llcms2 -ltiff -lfreetype -ljasper -ljpeg -lpng16 -lwmflite -lxext -lx11 -llzma -lbz2 -lxml2 -lz -lm -lgomp -lpthread

3、上传中文字体,直接在c:\windows\fonts目录里找就可以,至少上传两个,一个英文字体,一个中文字体,可以是arial.ttf和simsun.ttf等sim系列,当然你也可以上传多个。

4、编辑字体配置文件,在最后添加字体信息,arial等英文字体默认都在,只添加上传的中文字体即可,每个字体文件都需要添加一小节:

/usr/local/lib/graphicsmagick/config # vi type-windows.mgk

      name="simli"
      fullname="simli"
      family="simli"
      weight="400"
      style="normal"
      stretch="normal"
      glyphs="/usr/local/share/fonts/webfonts/simli.ttf"
      />
(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com