mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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>
This commit is contained in:
parent
77ee2851de
commit
e1da541749
1 changed files with 8 additions and 5 deletions
|
@ -111,6 +111,7 @@ int trim_dp = 0; /* trim descent percent */
|
||||||
int trim_da = 0; /* trim descnet actual */
|
int trim_da = 0; /* trim descnet actual */
|
||||||
int trim_ap = 0; /* trim ascent precent */
|
int trim_ap = 0; /* trim ascent precent */
|
||||||
int trim_aa = 0; /* trim ascent actual */
|
int trim_aa = 0; /* trim ascent actual */
|
||||||
|
int ft_load_opts = FT_LOAD_RENDER | FT_LOAD_NO_BITMAP;
|
||||||
|
|
||||||
struct font_header_struct {
|
struct font_header_struct {
|
||||||
char header[4]; /* magic number and version bytes */
|
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"
|
" -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"
|
" -ta Convert all fonts in ttc (ignores outfile option)\n"
|
||||||
" -w Don't try to make digits (0-9) equally wide\n"
|
" -w Don't try to make digits (0-9) equally wide\n"
|
||||||
|
" -L Use lighter hinting algorithm\n"
|
||||||
};
|
};
|
||||||
fprintf(stderr, "%s", help);
|
fprintf(stderr, "%s", help);
|
||||||
exit( 1 );
|
exit( 1 );
|
||||||
|
@ -543,7 +545,7 @@ FT_Long check_digit_width( FT_Face face )
|
||||||
{
|
{
|
||||||
FT_Glyph_Metrics* metrics;
|
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;
|
metrics = &face->glyph->metrics;
|
||||||
|
|
||||||
if ((last_advance != -1 && last_advance != metrics->horiAdvance) ||
|
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);
|
charindex = getcharindex( face, code);
|
||||||
if ( !(charindex) ) continue;
|
if ( !(charindex) ) continue;
|
||||||
err = FT_Load_Glyph( face, charindex,
|
err = FT_Load_Glyph(face, charindex, ft_load_opts);
|
||||||
(FT_LOAD_RENDER | FT_LOAD_NO_BITMAP) );
|
|
||||||
if ( err ) continue;
|
if ( err ) continue;
|
||||||
|
|
||||||
w = glyph_width( face, code, digit_width );
|
w = glyph_width( face, code, digit_width );
|
||||||
|
@ -770,8 +771,7 @@ void convttf(char* path, char* destfile, FT_Long face_index)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = FT_Load_Glyph( face, charindex ,
|
err = FT_Load_Glyph(face, charindex, ft_load_opts);
|
||||||
(FT_LOAD_RENDER | FT_LOAD_NO_BITMAP) );
|
|
||||||
if ( err ) {
|
if ( err ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1254,6 +1254,9 @@ void getopts(int *pac, char ***pav)
|
||||||
while (*p && *p != ' ')
|
while (*p && *p != ' ')
|
||||||
p++;
|
p++;
|
||||||
break;
|
break;
|
||||||
|
case 'L': /* Light rendering algorithm */
|
||||||
|
ft_load_opts |= FT_LOAD_TARGET_LIGHT;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unknown option ignored: %s\n", p-1);
|
fprintf(stderr, "Unknown option ignored: %s\n", p-1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue