Fixed bug #973
Fixed bug #973

 Tobias Leich      2010-03-21 04:41:17 PDT

Hi, if I do:

TTF_SetFontHinting(font, TTF_HINTING_LIGHT); // TTF_HINTING_LIGHT == 1

then:

TTF_GetFontHinting(font):

returns 65536 instead of TTF_HINTING_LIGHT (1).

You do a translation is the Set~ function:

void TTF_SetFontHinting( TTF_Font* font, int hinting )
{
    if (hinting == TTF_HINTING_LIGHT)
        font->hinting = FT_LOAD_TARGET_LIGHT;
    else if (hinting == TTF_HINTING_MONO)
        font->hinting = FT_LOAD_TARGET_MONO;
    else if (hinting == TTF_HINTING_NONE)
        font->hinting = FT_LOAD_NO_HINTING;
    else
        font->hinting = 0;
    Flush_Cache( font );
}

But none in the Get~ function:

int TTF_GetFontHinting( const TTF_Font* font )
{
    return font->hinting;
}

The FT_~ constants are not 0..3 like the TTF_~ are (freetype/freetype.h):

#define FT_LOAD_TARGET_( x )   ( (FT_Int32)( (x) & 15 ) << 16 )

#define FT_LOAD_TARGET_NORMAL  FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
#define FT_LOAD_TARGET_LIGHT   FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT  )
#define FT_LOAD_TARGET_MONO    FT_LOAD_TARGET_( FT_RENDER_MODE_MONO   )
#define FT_LOAD_TARGET_LCD     FT_LOAD_TARGET_( FT_RENDER_MODE_LCD    )
#define FT_LOAD_TARGET_LCD_V   FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V  )

Cheers

elemel/sdl-ttf,elemel/sdl-ttf