Results 1 to 7 of 7

Thread: FreeType

  1. #1
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default FreeType

    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.

    Qt Code:
    1. const FT_Long DEFAULT_FACE_INDEX = 0;
    2. ftFace = new FT_Face;
    3.  
    4. err = new FT_New_Memory_Face( *BitmapLibrary::Instance( ).GetLibrary( ),
    5. (FT_Byte *)pBufferBytes,
    6. bufferSizeInBytes,
    7. DEFAULT_FACE_INDEX,
    8. ftFace );
    To copy to clipboard, switch view to plain text mode 

    Thanks in advance.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: FreeType

    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.

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: FreeType

    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

  4. #4
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: FreeType

    Quote Originally Posted by marcel View Post
    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:
    Qt Code:
    1. FT_EXPORT( FT_Error )
    2. FT_New_Memory_Face( FT_Library library,
    3. const FT_Byte* file_base,
    4. FT_Long file_size,
    5. FT_Long face_index,
    6. FT_Face *aface );
    To copy to clipboard, switch view to plain text mode 

    My source file has defined:
    Qt Code:
    1. #include <ft2build.h>
    2. #include FT_FREETYPE_H
    To copy to clipboard, switch view to plain text mode 
    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.

  5. #5
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: FreeType

    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:

    Qt Code:
    1. FT_Library library; /* handle to library */
    2. FT_Face face; /* handle to face object */
    3. error = FT_Init_FreeType( &library );
    To copy to clipboard, switch view to plain text mode 

    BTW: how did this worked on linux?

    Regards

  6. The following user says thank you to marcel for this useful post:

    Rayven (3rd May 2007)

  7. #6
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default [SOLVED] FreeType

    Holy carp!! That was it...Thanks OH so much Marcel!!
    Last edited by Rayven; 3rd May 2007 at 18:48. Reason: Change the Title to SOLVED

  8. #7
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: FreeType

    You're welcome.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.