summaryrefslogtreecommitdiffstats
path: root/tools/convttf.c
diff options
context:
space:
mode:
authorNick Peskett <rockbox@peskett.co.uk>2013-03-03 02:39:27 +0000
committerThomas Martitz <kugel@rockbox.org>2014-01-26 16:11:05 +0100
commite1da541749c8fce7ed7a1ae62993e021c56dbc71 (patch)
treed337a66e528588c6ad87ce9c3c680cae9aeee2a4 /tools/convttf.c
parent77ee2851def905c8be09fc3d7d2d3c5cd4f204a6 (diff)
downloadrockbox-e1da541749c8fce7ed7a1ae62993e021c56dbc71.tar.gz
rockbox-e1da541749c8fce7ed7a1ae62993e021c56dbc71.tar.bz2
rockbox-e1da541749c8fce7ed7a1ae62993e021c56dbc71.zip
Option to use the lighter hinting algorithm (FT_LOAD_TARGET_LIGHT).
I've found this algorithm produces clearer results when rendering some fonts at small point sizes. Change-Id: If87d82731ad324405195b25baad78fe54e92c142 Reviewed-on: http://gerrit.rockbox.org/412 Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com> Tested: Purling Nayuki <cyq.yzfl@gmail.com> Reviewed-by: Thomas Martitz <kugel@rockbox.org>
Diffstat (limited to 'tools/convttf.c')
-rw-r--r--tools/convttf.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/convttf.c b/tools/convttf.c
index 66f0ad2176..f91d0d5b5f 100644
--- a/tools/convttf.c
+++ b/tools/convttf.c
@@ -111,6 +111,7 @@ int trim_dp = 0; /* trim descent percent */
int trim_da = 0; /* trim descnet actual */
int trim_ap = 0; /* trim ascent precent */
int trim_aa = 0; /* trim ascent actual */
+int ft_load_opts = FT_LOAD_RENDER | FT_LOAD_NO_BITMAP;
struct font_header_struct {
char header[4]; /* magic number and version bytes */
@@ -207,6 +208,7 @@ void usage(void)
" -t N Index of true type collection. It must be start from 0.(default N=0).\n"
" -ta Convert all fonts in ttc (ignores outfile option)\n"
" -w Don't try to make digits (0-9) equally wide\n"
+ " -L Use lighter hinting algorithm\n"
};
fprintf(stderr, "%s", help);
exit( 1 );
@@ -543,7 +545,7 @@ FT_Long check_digit_width( FT_Face face )
{
FT_Glyph_Metrics* metrics;
- FT_Load_Char(face, code, FT_LOAD_RENDER | FT_LOAD_NO_BITMAP);
+ FT_Load_Char(face, code, ft_load_opts);
metrics = &face->glyph->metrics;
if ((last_advance != -1 && last_advance != metrics->horiAdvance) ||
@@ -687,8 +689,7 @@ void convttf(char* path, char* destfile, FT_Long face_index)
{
charindex = getcharindex( face, code);
if ( !(charindex) ) continue;
- err = FT_Load_Glyph( face, charindex,
- (FT_LOAD_RENDER | FT_LOAD_NO_BITMAP) );
+ err = FT_Load_Glyph(face, charindex, ft_load_opts);
if ( err ) continue;
w = glyph_width( face, code, digit_width );
@@ -770,8 +771,7 @@ void convttf(char* path, char* destfile, FT_Long face_index)
continue;
}
- err = FT_Load_Glyph( face, charindex ,
- (FT_LOAD_RENDER | FT_LOAD_NO_BITMAP) );
+ err = FT_Load_Glyph(face, charindex, ft_load_opts);
if ( err ) {
continue;
}
@@ -1254,6 +1254,9 @@ void getopts(int *pac, char ***pav)
while (*p && *p != ' ')
p++;
break;
+ case 'L': /* Light rendering algorithm */
+ ft_load_opts |= FT_LOAD_TARGET_LIGHT;
+ break;
default:
fprintf(stderr, "Unknown option ignored: %s\n", p-1);