diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-18 22:20:25 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-18 22:20:25 -0700 |
commit | 0a9d06e2b5cf75c3d6ba958026bfdf4745f576d6 (patch) | |
tree | bda73f0de3896a97ff4231e4600fccd89a3f9118 /src/truetype/ttdriver.c | |
parent | 049d6fea481044fcc000e7782e5bc7046fc70844 (diff) | |
download | android_external_freetype-0a9d06e2b5cf75c3d6ba958026bfdf4745f576d6.tar.gz android_external_freetype-0a9d06e2b5cf75c3d6ba958026bfdf4745f576d6.tar.bz2 android_external_freetype-0a9d06e2b5cf75c3d6ba958026bfdf4745f576d6.zip |
auto import //branches/master/...@140412
Diffstat (limited to 'src/truetype/ttdriver.c')
-rw-r--r-- | src/truetype/ttdriver.c | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 2647cf5..42feb05 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -4,7 +4,7 @@ /* */ /* TrueType font driver implementation (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -129,38 +129,43 @@ tt_get_advances( FT_Face ttface, FT_UInt start, FT_UInt count, - FT_UInt flags, + FT_Int32 flags, FT_Fixed *advances ) { FT_UInt nn; TT_Face face = (TT_Face) ttface; - FT_Bool check = FT_BOOL(!(flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)); + FT_Bool check = FT_BOOL( + !( flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) ); + /* XXX: TODO: check for sbits */ - if (flags & FT_LOAD_VERTICAL_LAYOUT) + if ( flags & FT_LOAD_VERTICAL_LAYOUT ) { - for (nn = 0; nn < count; nn++) + for ( nn = 0; nn < count; nn++ ) { FT_Short tsb; FT_UShort ah; + TT_Get_VMetrics( face, start + nn, check, &tsb, &ah ); advances[nn] = ah; } } else { - for (nn = 0; nn < count; nn++) + for ( nn = 0; nn < count; nn++ ) { FT_Short lsb; FT_UShort aw; + TT_Get_HMetrics( face, start + nn, check, &lsb, &aw ); advances[nn] = aw; } } - return 0; + + return TT_Err_Ok; } /*************************************************************************/ @@ -267,7 +272,7 @@ /* glyph_index :: The index of the glyph in the font file. */ /* */ /* load_flags :: A flag indicating what to load for this glyph. The */ - /* FTLOAD_??? constants can be used to control the */ + /* FT_LOAD_XXX constants can be used to control the */ /* glyph loading process (e.g., whether the outline */ /* should be scaled, whether to load bitmaps or not, */ /* whether to hint the outline, etc). */ @@ -296,11 +301,24 @@ if ( !face || glyph_index >= (FT_UInt)face->num_glyphs ) return TT_Err_Invalid_Argument; + if ( load_flags & FT_LOAD_NO_HINTING ) + { + /* both FT_LOAD_NO_HINTING and FT_LOAD_NO_AUTOHINT */ + /* are necessary to disable hinting for tricky fonts */ + + if ( FT_IS_TRICKY( face ) ) + load_flags &= ~FT_LOAD_NO_HINTING; + + if ( load_flags & FT_LOAD_NO_AUTOHINT ) + load_flags |= FT_LOAD_NO_HINTING; + } + if ( load_flags & ( FT_LOAD_NO_RECURSE | FT_LOAD_NO_SCALE ) ) { - load_flags |= FT_LOAD_NO_HINTING | - FT_LOAD_NO_BITMAP | - FT_LOAD_NO_SCALE; + load_flags |= FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE; + + if ( !FT_IS_TRICKY( face ) ) + load_flags |= FT_LOAD_NO_HINTING; } /* now load the glyph outline if necessary */ |