发布于 2015-11-22 11:27:44 | 589 次阅读 | 评论: 0 | 来源: PHPERZ
FreeType 字体工具
FreeType 2被设计为一种占用空间小的、高效的、高度可定制的、并且可以产生可移植的高品质输出(符号图像)。可以被用在诸如图像库、展出服务器、字体转换工具、图像文字产生工具等多种其它产品上。
地址:http://www.freetype.org/
得到压缩文件:freetype-2.5.3.tar.gz
直接解压,得到目录freetype-2.5.3
用vs2010打开:(路径)\freetype-2.5.3\builds\windows\vc2010\freetype.sln
依次点击:Project->properties->VC++directories->Include Directories
添加:(路径)\freetype-2.5.3\include
依次点击:Project->properties->VC++directories->Library Directories
添加:(路径)\freetype-2.5.3\objs\win32\vc2010
依次点击: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了