freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft] FT_Load_Glyph returns an error


From: YuGiOhJCJ Mailing-List
Subject: Re: [ft] FT_Load_Glyph returns an error
Date: Sat, 12 Nov 2016 11:57:55 +0100

On Sat, 12 Nov 2016 08:23:55 +1300
Lawrence D'Oliveiro <address@hidden> wrote:

> On Fri, 11 Nov 2016 14:27:43 +0100, YuGiOhJCJ Mailing-List wrote:
> 
> >     error = FT_Load_Glyph(face, glyph_index, 0);
> >     if(error != 0)
> >     {
> >             fprintf(stderr, "Unable to load the glyph image.\n");
> >             exit(EXIT_FAILURE);
> >     }
> > 
> > Unfortunately, when I try to call the "FT_Load_Glyph" function, the
> > returned value is not 0 (which means that there is a failure): ---
> 
> What is the error?
> 

The FreeType error code is "36".

Here is the new code:
---
#include <ft2build.h> /* for FT_Init_FreeType */
#include <stdlib.h> /* for exit */
#include FT_FREETYPE_H
int main()
{
        /* https://www.freetype.org/freetype2/docs/tutorial/step1.html */
        FT_Library library;
        FT_Face face;
        FT_UInt glyph_index;
        int error = FT_Init_FreeType(&library);
        if(error != 0)
        {
                fprintf(stderr, "Unable to initialize the library (error = 
\"%d\").\n", error);
                exit(EXIT_FAILURE);
        }
        error = FT_New_Face(library, "Arial.TTF", 0, &face);
        if(error != 0)
        {
                fprintf(stderr, "Unable to load the font face (error = 
\"%d\").\n", error);
                exit(EXIT_FAILURE);
        }
        glyph_index = FT_Get_Char_Index(face, 0x00041);
        error = FT_Load_Glyph(face, glyph_index, 0);
        if(error != 0)
        {
                fprintf(stderr, "Unable to load the glyph image (error = 
\"%d\").\n", error);
                exit(EXIT_FAILURE);
        }
        exit(EXIT_SUCCESS);
}
---

And here is what I get at runtime:
---
$ ./a.out 
Unable to load the glyph image (error = "36").
---

How to know the meaning of this FreeType error code please?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]