Skip to content

Commit

Permalink
Fixed bug #973
Browse files Browse the repository at this point in the history
 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
  • Loading branch information
slouken committed Mar 25, 2010
1 parent 5ee7f52 commit 2d74a36
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion SDL_ttf.c
Expand Up @@ -2064,12 +2064,19 @@ void TTF_SetFontHinting( TTF_Font* font, int hinting )
font->hinting = FT_LOAD_NO_HINTING;
else
font->hinting = 0;

Flush_Cache( font );
}

int TTF_GetFontHinting( const TTF_Font* font )
{
return font->hinting;
if (font->hinting = FT_LOAD_TARGET_LIGHT)
return TTF_HINTING_LIGHT;
else if (font->hinting = FT_LOAD_TARGET_MONO)
return TTF_HINTING_MONO;
else if (font->hinting = FT_LOAD_NO_HINTING)
return TTF_HINTING_NONE;
return 0;
}

void TTF_Quit( void )
Expand Down

0 comments on commit 2d74a36

Please sign in to comment.