| OLD | NEW |
| 1 /***************************************************************************/ | 1 /***************************************************************************/ |
| 2 /* */ | 2 /* */ |
| 3 /* ftadvanc.c */ | 3 /* ftadvanc.c */ |
| 4 /* */ | 4 /* */ |
| 5 /* Quick computation of advance widths (body). */ | 5 /* Quick computation of advance widths (body). */ |
| 6 /* */ | 6 /* */ |
| 7 /* Copyright 2008, 2009 by */ | 7 /* Copyright 2008, 2009, 2011 by */ |
| 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
| 9 /* */ | 9 /* */ |
| 10 /* This file is part of the FreeType project, and may only be used, */ | 10 /* This file is part of the FreeType project, and may only be used, */ |
| 11 /* modified, and distributed under the terms of the FreeType project */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
| 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
| 13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
| 14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
| 15 /* */ | 15 /* */ |
| 16 /***************************************************************************/ | 16 /***************************************************************************/ |
| 17 | 17 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 return FT_Err_Invalid_Glyph_Index; | 122 return FT_Err_Invalid_Glyph_Index; |
| 123 | 123 |
| 124 if ( count == 0 ) | 124 if ( count == 0 ) |
| 125 return FT_Err_Ok; | 125 return FT_Err_Ok; |
| 126 | 126 |
| 127 func = face->driver->clazz->get_advances; | 127 func = face->driver->clazz->get_advances; |
| 128 if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) ) | 128 if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) ) |
| 129 { | 129 { |
| 130 error = func( face, start, count, flags, padvances ); | 130 error = func( face, start, count, flags, padvances ); |
| 131 if ( !error ) | 131 if ( !error ) |
| 132 goto Exit; | 132 return _ft_face_scale_advances( face, padvances, count, flags ); |
| 133 | 133 |
| 134 if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) ) | 134 if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) ) |
| 135 return error; | 135 return error; |
| 136 } | 136 } |
| 137 | 137 |
| 138 error = FT_Err_Ok; | 138 error = FT_Err_Ok; |
| 139 | 139 |
| 140 if ( flags & FT_ADVANCE_FLAG_FAST_ONLY ) | 140 if ( flags & FT_ADVANCE_FLAG_FAST_ONLY ) |
| 141 return FT_Err_Unimplemented_Feature; | 141 return FT_Err_Unimplemented_Feature; |
| 142 | 142 |
| 143 flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY; | 143 flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY; |
| 144 for ( nn = 0; nn < count; nn++ ) | 144 for ( nn = 0; nn < count; nn++ ) |
| 145 { | 145 { |
| 146 error = FT_Load_Glyph( face, start + nn, flags ); | 146 error = FT_Load_Glyph( face, start + nn, flags ); |
| 147 if ( error ) | 147 if ( error ) |
| 148 break; | 148 break; |
| 149 | 149 |
| 150 /* scale from 26.6 to 16.16 */ |
| 150 padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT ) | 151 padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT ) |
| 151 ? face->glyph->advance.y | 152 ? face->glyph->advance.y << 10 |
| 152 : face->glyph->advance.x; | 153 : face->glyph->advance.x << 10; |
| 153 } | 154 } |
| 154 | 155 |
| 155 if ( error ) | 156 return error; |
| 156 return error; | |
| 157 | |
| 158 Exit: | |
| 159 return _ft_face_scale_advances( face, padvances, count, flags ); | |
| 160 } | 157 } |
| 161 | 158 |
| 162 | 159 |
| 163 /* END */ | 160 /* END */ |
| OLD | NEW |