summaryrefslogtreecommitdiff
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
parent77ee2851def905c8be09fc3d7d2d3c5cd4f204a6 (diff)
downloadrockbox-e1da541749c8fce7ed7a1ae62993e021c56dbc71.tar.gz
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>
-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 */
111int trim_da = 0; /* trim descnet actual */ 111int trim_da = 0; /* trim descnet actual */
112int trim_ap = 0; /* trim ascent precent */ 112int trim_ap = 0; /* trim ascent precent */
113int trim_aa = 0; /* trim ascent actual */ 113int trim_aa = 0; /* trim ascent actual */
114int ft_load_opts = FT_LOAD_RENDER | FT_LOAD_NO_BITMAP;
114 115
115struct font_header_struct { 116struct font_header_struct {
116 char header[4]; /* magic number and version bytes */ 117 char header[4]; /* magic number and version bytes */
@@ -207,6 +208,7 @@ void usage(void)
207 " -t N Index of true type collection. It must be start from 0.(default N=0).\n" 208 " -t N Index of true type collection. It must be start from 0.(default N=0).\n"
208 " -ta Convert all fonts in ttc (ignores outfile option)\n" 209 " -ta Convert all fonts in ttc (ignores outfile option)\n"
209 " -w Don't try to make digits (0-9) equally wide\n" 210 " -w Don't try to make digits (0-9) equally wide\n"
211 " -L Use lighter hinting algorithm\n"
210 }; 212 };
211 fprintf(stderr, "%s", help); 213 fprintf(stderr, "%s", help);
212 exit( 1 ); 214 exit( 1 );
@@ -543,7 +545,7 @@ FT_Long check_digit_width( FT_Face face )
543 { 545 {
544 FT_Glyph_Metrics* metrics; 546 FT_Glyph_Metrics* metrics;
545 547
546 FT_Load_Char(face, code, FT_LOAD_RENDER | FT_LOAD_NO_BITMAP); 548 FT_Load_Char(face, code, ft_load_opts);
547 metrics = &face->glyph->metrics; 549 metrics = &face->glyph->metrics;
548 550
549 if ((last_advance != -1 && last_advance != metrics->horiAdvance) || 551 if ((last_advance != -1 && last_advance != metrics->horiAdvance) ||
@@ -687,8 +689,7 @@ void convttf(char* path, char* destfile, FT_Long face_index)
687 { 689 {
688 charindex = getcharindex( face, code); 690 charindex = getcharindex( face, code);
689 if ( !(charindex) ) continue; 691 if ( !(charindex) ) continue;
690 err = FT_Load_Glyph( face, charindex, 692 err = FT_Load_Glyph(face, charindex, ft_load_opts);
691 (FT_LOAD_RENDER | FT_LOAD_NO_BITMAP) );
692 if ( err ) continue; 693 if ( err ) continue;
693 694
694 w = glyph_width( face, code, digit_width ); 695 w = glyph_width( face, code, digit_width );
@@ -770,8 +771,7 @@ void convttf(char* path, char* destfile, FT_Long face_index)
770 continue; 771 continue;
771 } 772 }
772 773
773 err = FT_Load_Glyph( face, charindex , 774 err = FT_Load_Glyph(face, charindex, ft_load_opts);
774 (FT_LOAD_RENDER | FT_LOAD_NO_BITMAP) );
775 if ( err ) { 775 if ( err ) {
776 continue; 776 continue;
777 } 777 }
@@ -1254,6 +1254,9 @@ void getopts(int *pac, char ***pav)
1254 while (*p && *p != ' ') 1254 while (*p && *p != ' ')
1255 p++; 1255 p++;
1256 break; 1256 break;
1257 case 'L': /* Light rendering algorithm */
1258 ft_load_opts |= FT_LOAD_TARGET_LIGHT;
1259 break;
1257 1260
1258 default: 1261 default:
1259 fprintf(stderr, "Unknown option ignored: %s\n", p-1); 1262 fprintf(stderr, "Unknown option ignored: %s\n", p-1);