freetype下载和配置

来源:互联网 发布:windows使用linux命令 编辑:程序博客网 时间:2024/05/22 12:15

一 下载编译freetype库


1 下载

地址:http://www.freetype.org/
得到压缩文件:freetype-2.5.3.tar.gz


2 解压:

直接解压,得到目录freetype-2.5.3


3 编译:

用vs2010打开:(路径)\freetype-2.5.3\builds\windows\vc2010\freetype.sln




二 将freetype库添加到工程

1 添加包含目录

依次点击:Project->properties->VC++directories->Include Directories
添加:(路径)\freetype-2.5.3\include


2 添加库目录

依次点击:Project->properties->VC++directories->Library Directories
添加:(路径)\freetype-2.5.3\objs\win32\vc2010


3 添加附加依赖项

依次点击:Project->properties->Linker->Input->Additional Dependencies
添加:(路径)\freetype253.lib;freetype253_D.lib


三 测试

运行以下代码:


#include <ft2build.h>#include FT_FREETYPE_H#include <iostream>using namespace std;int main(){FT_Library library;FT_Init_FreeType(&library);FT_Face face;FT_New_Face(library, "msyh.ttf", 0, &face);cout<<"num_glyphs:"<<face->num_glyphs<<endl;cout<<"num_faces:"<<face->num_faces<<endl;system("Pause");return 0;}




能编译运行,就一切ok了
1 0
原创粉丝点击