查看: 4568|回复: 14

关于如何编译freetype的问题

[复制链接]

该用户从未签到

发表于 2011-8-11 17:26:40 | 显示全部楼层 |阅读模式
这段时间一直在为OSG中的文字显示问题纠结,一是不能加载字体,二是不能显示汉字。关于这两个问题,我在网上寻找到的答案是,没有编译字体插件,即freetype库。
我在freetype官网上下载了一个压缩包,里面对应的文件如下图所示
QQ截图20110811172002.jpg

如果是直接运行文件夹里面的vms_make这个DOS程序,但是运行后很长时间也没什么反应。
如果要用CMake来编译,但是文件夹里面并没有CMakeLists文件

现在不知道该怎么弄了,OSG字体的问题,希望能得到帮助和解答,谢谢!

该用户从未签到

发表于 2011-8-11 18:19:37 | 显示全部楼层
你用cmake编译osg时,只要你关联了3Dparty这个第三方库,你编译出来的源码就会有FreeType,然后生成一下就可以用了

该用户从未签到

 楼主| 发表于 2011-8-11 19:26:47 | 显示全部楼层
回复 2# choosecrying


    我已经关联了,重新编译后相关输出信息如下:
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osganimationd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgfxd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgparticled.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgsimd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgtextd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgviewerd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgshadowd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgterraind.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgvolumed.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgwidgetd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgad.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_rotd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_scaled.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_transd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_normalsd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_ived.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_cfgd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_glsld.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_rgbd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_bmpd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_pnmd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_ddsd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_tgad.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_hdrd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_dotd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_vtfd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_jpegd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_gifd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_pngd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_tiffd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_3dcd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_gzd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_lwod.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_bvhd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_xd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_dwd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_dxfd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_openflightd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_geod.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_objd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_picd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_stld.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_3dsd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_acd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_logod.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_lwsd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_md2d.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgtgzd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_tgzd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_shpd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_txfd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_bspd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_mdld.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_plyd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_txpd.dll
1>-- Up-to-date: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_zipd.dll

还是没有发现freetype,运行文字显示的例子,依旧提示找不到插件
不知道是哪里有问题~

该用户从未签到

发表于 2011-8-12 08:39:27 | 显示全部楼层
因为您没有在cmake里面设置freetype相关的头文件路径和依赖库位置

该用户从未签到

 楼主| 发表于 2011-8-12 11:37:40 | 显示全部楼层
回复 4# array


    您好,谢谢!
我这次设置好了CMake中的相关的路径,如下:
QQ截图20110812112822.jpg
打开那个.sln文件,已经有了Plugins freetype这个编译项,但是编译不通过,输出以下信息:
1>正在链接...
1>FreeTypeFont3D.obj : error LNK2019: 无法解析的外部符号 _FT_Outline_Get_BBox,该符号在函数 "protected: void __thiscall FreeTypeFont3D::init(void)" (?init@FreeTypeFont3D@@IAEXXZ) 中被引用
1>D:\OSG\OpenSceneGraph-2.8.3\bin\Debug\..\osgPlugins-2.8.3\osgdb_freetyped.dll : fatal error LNK1120: 1 个无法解析的外部命令
1>生成日志保存在“file://d:\OSG\OpenSceneGraph-2.8.3\src\osgPlugins\freetype\osgdb_freetype.dir\Debug\BuildLog.htm”


是不是我的3rdParty文件有问题?还是我的路径设置不正确?或者还需要其它什么相关的文件呢?

该用户从未签到

发表于 2011-8-12 17:10:54 | 显示全部楼层
219这个版本太低了,请使用至少235以上的版本

该用户从未签到

 楼主| 发表于 2011-8-12 19:27:51 | 显示全部楼层
回复 6# array


    回复 5# array


    今天弄了一整天,终于整出字体来了

198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osganimationd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgfxd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgparticled.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgsimd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgtextd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgviewerd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgshadowd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgterraind.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgvolumed.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgwidgetd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgad.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_rotd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_scaled.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_transd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_normalsd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_ived.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_cfgd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_glsld.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_rgbd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_bmpd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_pnmd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_ddsd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_tgad.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_hdrd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_dotd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_vtfd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_jpegd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_gifd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_pngd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_tiffd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_gdald.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_ogrd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_3dcd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_gzd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_lwod.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_bvhd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_xd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_dwd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_dxfd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_openflightd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_geod.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_objd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_picd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_stld.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_3dsd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_acd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_logod.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_lwsd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_md2d.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_osgtgzd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_tgzd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_shpd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_txfd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_bspd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_mdld.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_plyd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_txpd.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_freetyped.dll
198>-- Installing: C:/Program Files/OpenSceneGraph/bin/osgPlugins-2.8.3/osgdb_zipd.dll


感谢array和论坛,感谢所有帮助我的人~

该用户从未签到

发表于 2012-10-23 13:39:15 | 显示全部楼层
顶下,刚按照这种方法解决了同样的问题

该用户从未签到

发表于 2012-10-24 10:07:41 | 显示全部楼层
我送你两个osg的freetype插件吧,osgdb_freetyped.dll是debug版本,osgdb_freetype.dll是Release版本,你把它们下载下来之后,对你的计算机上的osg插件目录下面的freetype插件进行替换就行了,这两个插件使用的freetype是2.4.8版本的,对freetype采用的是静态链接,使用的编译环境是Visual C++ 2005。如果插件在你的计算机上不能正常运行的话,请告诉我。

osgdb_freetype.dll

436 KB, 下载次数: 71, 下载积分: 威望 1

osg的freetype插件的Release版本

osgdb_freetyped.dll

1 MB, 下载次数: 91, 下载积分: 威望 1

osg的freetype插件的Debug版本

该用户从未签到

发表于 2012-11-28 09:45:55 | 显示全部楼层
the_mercury 发表于 2012-10-24 10:07
我送你两个osg的freetype插件吧,osgdb_freetyped.dll是debug版本,osgdb_freetype.dll是Release版本,你把 ...

请问这种插件在哪里可以下载吗?我的机子貌似缺了很多这种dll的插件

该用户从未签到

发表于 2013-5-11 21:35:32 | 显示全部楼层
出现了新错误
7>  FreeTypeFont.cpp
7>d:\osg\osg4\openscenegraph-3.0.0\src\osgplugins\freetype\FreeTypeFont.h(19): fatal error C1083: 无法打开包括文件:“ft2build.h”: No such file or directory
7>  FreeTypeLibrary.cpp
7>d:\osg\osg4\openscenegraph-3.0.0\src\osgplugins\freetype\FreeTypeFont.h(19): fatal error C1083: 无法打开包括文件:“ft2build.h”: No such file or directory
7>  ReaderWriterFreeType.cpp
7>d:\osg\osg4\openscenegraph-3.0.0\src\osgplugins\freetype\FreeTypeFont.h(19): fatal error C1083: 无法打开包括文件:“ft2build.h”: No such file or directory
7>  正在生成代码...
7>
7>生成失败。

该用户从未签到

发表于 2013-5-13 09:33:52 | 显示全部楼层
您没指定FreeType依赖库路径吧

该用户从未签到

发表于 2013-5-19 20:38:44 | 显示全部楼层
设置好了依赖库路径,原来是源文件里包涵头文件的路径设置有问题。
比如
QQ截图203712.png

该用户从未签到

发表于 2013-5-19 20:41:17 | 显示全部楼层
我的解决办法是把第三方库里的freetype文件夹整个复制出来,然后粘贴到freetype里作为它的子文件夹,这样编译时就能找的到路径了

该用户从未签到

发表于 2013-5-20 07:52:42 | 显示全部楼层
licheng 发表于 2013-5-19 20:41
我的解决办法是把第三方库里的freetype文件夹整个复制出来,然后粘贴到freetype里作为它的子文件夹,这样编 ...

CMake 配置正确就可以找到了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表