PDA

View Full Version : FreeType



Rayven
3rd May 2007, 17:33
I am compiling an application using the FreeType libraries that are included with Qt. I am using VisualStudios 2005 and 2003 with Qt4.1.0. Both environments give the same error when compiling:

1>.\src\BitmapFace.cpp(33) : error C2061: syntax error : identifier 'FT_New_Memory_Face'

I have all the include and library paths for FreeType correct and no other error messages are given. This same source code compiles just fine under Solaris and Linux.



const FT_Long DEFAULT_FACE_INDEX = 0;
ftFace = new FT_Face;

err = new FT_New_Memory_Face( *BitmapLibrary::Instance( ).GetLibrary( ),
(FT_Byte *)pBufferBytes,
bufferSizeInBytes,
DEFAULT_FACE_INDEX,
ftFace );


Thanks in advance.

marcel
3rd May 2007, 18:09
Could you look where FT_New_MemoRy_Face is implemented? Maybe it is conditionally defined...And you need to add that preprocessor definition.

Or on Win, you have to include something that on Linux gets included automatically. These things often hapen.

marcel
3rd May 2007, 18:33
Disregard my last post :)

I believe this is the solution ( it's from the freetype2 tutorial ):



Include the main FreeType 2 API header file.
You should do that using the macro FT_FREETYPE_H, like in the following example:

#include <ft2build.h>
#include FT_FREETYPE_H

FT_FREETYPE_H is a special macro defined in the file ftheader.h. It contains some installation-specific macros to name other public header files of the FreeType 2 API.

Regards

Rayven
3rd May 2007, 18:36
Could you look where FT_New_MemoRy_Face is implemented? Maybe it is conditionally defined...And you need to add that preprocessor definition.

Or on Win, you have to include something that on Linux gets included automatically. These things often hapen.

FT_New_Memory_Face is defined in freetype.h as:

FT_EXPORT( FT_Error )
FT_New_Memory_Face( FT_Library library,
const FT_Byte* file_base,
FT_Long file_size,
FT_Long face_index,
FT_Face *aface );

My source file has defined:


#include <ft2build.h>
#include FT_FREETYPE_H

which the freetype.h file says needs to be included. I am really unsure what else would need to be included under windows since all the documentation only says to include these two things.

marcel
3rd May 2007, 18:43
You made a mistake in your code:

You said:

err = new FT_New_Memory_Face( ... ).


FT_New_Memory_Face is not an object, therefore you can't instantiate it with new.
Please correct this and see if it works.

This is an example from the tutorial:



FT_Library library; /* handle to library */
FT_Face face; /* handle to face object */
error = FT_Init_FreeType( &library );


BTW: how did this worked on linux?

Regards

Rayven
3rd May 2007, 18:47
:rolleyes: Holy carp!! That was it...Thanks OH so much Marcel!!

marcel
3rd May 2007, 18:49
You're welcome.http://www.qtcentre.org/forum/images/icons/icon12.png