freetype
[Top][All Lists]
Advanced

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

[ft] FT_Outline_Render not calling my span function.


From: Adrian May
Subject: [ft] FT_Outline_Render not calling my span function.
Date: Thu, 26 Feb 2009 17:59:26 +0800

Hi folks,

The samples say something like "... load vectorial glyph in ‘outline’
..." before calling FT_Outline_Render. But how? I'm doing the
following and it ain't working. All the FT_ calls return success but
my span function never gets called. Any clues greatly appreciated...

void MySpanFunc(int y, int count, const FT_Span* spans, void* user )
{
        cout << "MySpanFunc\n";//this never happens
}
                                
void freetypeplay()
{
        DrawRect(0, 0, 240, 320, RGB(0,0,64));
        FT_Error err=0;
        FT_Library library;
        FT_Face face;
        FT_GlyphSlot slot = face->glyph;
        FT_Raster_Params  rps;
        rps.flags      = FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT;
        rps.gray_spans = &MySpanFunc;
        rps.user       = 0;
        
        //Program says "FT all OK 0" so no errors returned by these calls...
        cout << (       
                (err=   FT_Init_FreeType( &library )                            
                )       ? "FT_Init_FreeType error " :
                (err=   FT_New_Face( library, "/mnt/stick/jabil/unifont.ttf", 
0, &face
)       )       ? "FT_New_Face error " :
                (err=   FT_Set_Char_Size(face, 0, 30*64, 100, 100)              
        )       ?
"FT_Set_Char_Size error " :
                (err=   FT_Load_Glyph( face, 65, FT_LOAD_DEFAULT )              
        )       ?
"FT_Load_Char error " :
                (err=   FT_Outline_Render( library, &slot->outline, &rps )      
)       ?
"FT_Outline_Render error " :
                "FT all OK " ) << err << endl;
}
                                
Thanks in advance,
Adrian.




reply via email to

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