Patch: Expose FreeType hinting preferences in SDL_TTF

This patch allows setting the hinting style of each TTF_Font. The
options are none, light, mono(chrome), and normal/default. This is
useful because it allows access to FreeType’s slight hinter, which IMO
looks much better for in-game interfaces.

Any chance this can be added to SVN?

Gregory

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: sdl-ttf-expose-hinting.patch
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20071104/6d9e8c19/attachment.asc

Gregory Smith wrote:

This patch allows setting the hinting style of each TTF_Font. The
options are none, light, mono(chrome), and normal/default. This is
useful because it allows access to FreeType’s slight hinter, which IMO
looks much better for in-game interfaces.

Any chance this can be added to SVN?

Gregory

I am not a SDL developer but the patch looks alright to me.

One more nitpick though, is that I would prefer if you
used enums instead of defines. This way you can avoid
namespace pollution if you include SDL_ttf headers from
a C++ program.

So instead

+/* Set and retrieve FreeType hinter settings */
+#define TTF_HINTING_NORMAL 0
+#define TTF_HINTING_LIGHT 1
+#define TTF_HINTING_MONO 2
+#define TTF_HINTING_NONE 3

it would be nice to use
typedef enum {
TTF_HINTING_NORMAL,
TTF_HINTING_LIGHT,
TTF_HINTING_MONO.
TTF_HINTING_NONE
} ttf_hinting;

or something like this…

.bill

I don’t how to manage to post with a ridiculous spam like subject but
I did it. I am reposting for archive clarity

Gregory Smith wrote:

This patch allows setting the hinting style of each TTF_Font. The
options are none, light, mono(chrome), and normal/default. This is
useful because it allows access to FreeType’s slight hinter, which IMO
looks much better for in-game interfaces.

Any chance this can be added to SVN?

I am not a SDL developer but the patch looks alright to me.

One more nitpick though, is that I would prefer if you
used enums instead of defines. This way you can avoid
namespace pollution if you include SDL_ttf headers from
a C++ program.

So instead

+/* Set and retrieve FreeType hinter settings */
+#define TTF_HINTING_NORMAL 0
+#define TTF_HINTING_LIGHT 1
+#define TTF_HINTING_MONO 2
+#define TTF_HINTING_NONE 3

it would be nice to use
typedef enum {
TTF_HINTING_NORMAL,
TTF_HINTING_LIGHT,
TTF_HINTING_MONO.
TTF_HINTING_NONE
} ttf_hinting;

or something like this…

.bill

Vassilis Virvilis wrote:

I am not a SDL developer but the patch looks alright to me.

One more nitpick though, is that I would prefer if you
used enums instead of defines. This way you can avoid
namespace pollution if you include SDL_ttf headers from
a C++ program.

So instead

+/* Set and retrieve FreeType hinter settings */
+#define TTF_HINTING_NORMAL 0
+#define TTF_HINTING_LIGHT 1
+#define TTF_HINTING_MONO 2
+#define TTF_HINTING_NONE 3

it would be nice to use
typedef enum {
TTF_HINTING_NORMAL,
TTF_HINTING_LIGHT,
TTF_HINTING_MONO.
TTF_HINTING_NONE
} ttf_hinting;

or something like this…

Generally when submitting patches I follow the style of whatever code
I’m modifying, and SDL_TTF uses #defines for other constants. No
argument here that enums are preferable.

Gregory