freetype下载和配置

本文详细介绍了如何下载、编译freetype库,并将其集成到Visual Studio 2010项目中。此外,还提供了一个简单的测试代码示例来验证库是否正确安装。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一 下载编译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库加入到project

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了

转载于:https://www.cnblogs.com/jzssuanfa/p/7274453.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值