Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTF_GetFontHinting returns wrong values #19

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

TTF_GetFontHinting returns wrong values #19

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: 2.0.10
Reported for operating system, platform: All, All

Comments on the original bug report:

On 2010-03-21 04:41:17 +0000, Tobias Leich wrote:

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

On 2010-03-25 02:03:14 +0000, Sam Lantinga wrote:

This is fixed in source control, thanks!
http://hg.libsdl.org/SDL_ttf/rev/346309f53e45
http://hg.libsdl.org/SDL_ttf/rev/25ec85256dca

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant