1. Download and compile the FreeType Library
1 download: http://www.freetype.org/
Get compressed file: freetype-2.5.3.tar.gz
2 unzip: extract directly, get the directory freetype-2.5.3
3 compile: open with vs2010 :( path) \ freetype-2.5.3 \ builds \ windows \ vc2010 \ FreeType. sln
2. Add the FreeType library to project 1 and add the include directory. Click project> Properties> VC ++ directories> include directories.
Add: (PATH) \ freetype-2.5.3 \ include
2. Add the library directory and click Project> Properties> VC ++ directories> library directories.
Add (PATH) \ freetype-2.5.3 \ objs \ Win32 \ vc2010
3. Click "project"> "properties"> "linker"> "input"> "additional dependencies" to add additional dependencies.
Add: (PATH) \ freetype253.lib; freetype253_d.lib
3. Run the following code:
#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;}
It's okay to compile and run it.
FreeType download and Configuration