Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/sfnt/ttbdf.c

Issue 89753003: Update freetype to latest version of ASOP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src/third_party/freetype.git@master
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/sfnt/sfobjs.c ('k') | src/sfnt/ttcmap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /***************************************************************************/ 1 /***************************************************************************/
2 /* */ 2 /* */
3 /* ttbdf.c */ 3 /* ttbdf.c */
4 /* */ 4 /* */
5 /* TrueType and OpenType embedded BDF properties (body). */ 5 /* TrueType and OpenType embedded BDF properties (body). */
6 /* */ 6 /* */
7 /* Copyright 2005, 2006, 2010 by */ 7 /* Copyright 2005, 2006, 2010, 2013 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 FT_Error error; 67 FT_Error error;
68 68
69 69
70 FT_ZERO( bdf ); 70 FT_ZERO( bdf );
71 71
72 error = tt_face_goto_table( face, TTAG_BDF, stream, &length ); 72 error = tt_face_goto_table( face, TTAG_BDF, stream, &length );
73 if ( error || 73 if ( error ||
74 length < 8 || 74 length < 8 ||
75 FT_FRAME_EXTRACT( length, bdf->table ) ) 75 FT_FRAME_EXTRACT( length, bdf->table ) )
76 { 76 {
77 error = SFNT_Err_Invalid_Table; 77 error = FT_THROW( Invalid_Table );
78 goto Exit; 78 goto Exit;
79 } 79 }
80 80
81 bdf->table_end = bdf->table + length; 81 bdf->table_end = bdf->table + length;
82 82
83 { 83 {
84 FT_Byte* p = bdf->table; 84 FT_Byte* p = bdf->table;
85 FT_UInt version = FT_NEXT_USHORT( p ); 85 FT_UInt version = FT_NEXT_USHORT( p );
86 FT_UInt num_strikes = FT_NEXT_USHORT( p ); 86 FT_UInt num_strikes = FT_NEXT_USHORT( p );
87 FT_ULong strings = FT_NEXT_ULONG ( p ); 87 FT_ULong strings = FT_NEXT_ULONG ( p );
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 125
126 bdf->loaded = 1; 126 bdf->loaded = 1;
127 127
128 Exit: 128 Exit:
129 return error; 129 return error;
130 130
131 BadTable: 131 BadTable:
132 FT_FRAME_RELEASE( bdf->table ); 132 FT_FRAME_RELEASE( bdf->table );
133 FT_ZERO( bdf ); 133 FT_ZERO( bdf );
134 error = SFNT_Err_Invalid_Table; 134 error = FT_THROW( Invalid_Table );
135 goto Exit; 135 goto Exit;
136 } 136 }
137 137
138 138
139 FT_LOCAL_DEF( FT_Error ) 139 FT_LOCAL_DEF( FT_Error )
140 tt_face_find_bdf_prop( TT_Face face, 140 tt_face_find_bdf_prop( TT_Face face,
141 const char* property_name, 141 const char* property_name,
142 BDF_PropertyRec *aprop ) 142 BDF_PropertyRec *aprop )
143 { 143 {
144 TT_BDF bdf = &face->bdf; 144 TT_BDF bdf = &face->bdf;
145 FT_Size size = FT_FACE(face)->size; 145 FT_Size size = FT_FACE(face)->size;
146 FT_Error error = SFNT_Err_Ok; 146 FT_Error error = FT_Err_Ok;
147 FT_Byte* p; 147 FT_Byte* p;
148 FT_UInt count; 148 FT_UInt count;
149 FT_Byte* strike; 149 FT_Byte* strike;
150 FT_Offset property_len; 150 FT_Offset property_len;
151 151
152 152
153 aprop->type = BDF_PROPERTY_TYPE_NONE; 153 aprop->type = BDF_PROPERTY_TYPE_NONE;
154 154
155 if ( bdf->loaded == 0 ) 155 if ( bdf->loaded == 0 )
156 { 156 {
157 error = tt_face_load_bdf_props( face, FT_FACE( face )->stream ); 157 error = tt_face_load_bdf_props( face, FT_FACE( face )->stream );
158 if ( error ) 158 if ( error )
159 goto Exit; 159 goto Exit;
160 } 160 }
161 161
162 count = bdf->num_strikes; 162 count = bdf->num_strikes;
163 p = bdf->table + 8; 163 p = bdf->table + 8;
164 strike = p + 4 * count; 164 strike = p + 4 * count;
165 165
166 error = SFNT_Err_Invalid_Argument; 166 error = FT_ERR( Invalid_Argument );
167 167
168 if ( size == NULL || property_name == NULL ) 168 if ( size == NULL || property_name == NULL )
169 goto Exit; 169 goto Exit;
170 170
171 property_len = ft_strlen( property_name ); 171 property_len = ft_strlen( property_name );
172 if ( property_len == 0 ) 172 if ( property_len == 0 )
173 goto Exit; 173 goto Exit;
174 174
175 for ( ; count > 0; count-- ) 175 for ( ; count > 0; count-- )
176 { 176 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 switch ( type & 0x0F ) 208 switch ( type & 0x0F )
209 { 209 {
210 case 0x00: /* string */ 210 case 0x00: /* string */
211 case 0x01: /* atoms */ 211 case 0x01: /* atoms */
212 /* check that the content is really 0-terminated */ 212 /* check that the content is really 0-terminated */
213 if ( value < bdf->strings_size && 213 if ( value < bdf->strings_size &&
214 ft_memchr( bdf->strings + value, 0, bdf->strings_size ) ) 214 ft_memchr( bdf->strings + value, 0, bdf->strings_size ) )
215 { 215 {
216 aprop->type = BDF_PROPERTY_TYPE_ATOM; 216 aprop->type = BDF_PROPERTY_TYPE_ATOM;
217 aprop->u.atom = (const char*)bdf->strings + value; 217 aprop->u.atom = (const char*)bdf->strings + value;
218 error = SFNT_Err_Ok; 218 error = FT_Err_Ok;
219 goto Exit; 219 goto Exit;
220 } 220 }
221 break; 221 break;
222 222
223 case 0x02: 223 case 0x02:
224 aprop->type = BDF_PROPERTY_TYPE_INTEGER; 224 aprop->type = BDF_PROPERTY_TYPE_INTEGER;
225 aprop->u.integer = (FT_Int32)value; 225 aprop->u.integer = (FT_Int32)value;
226 error = SFNT_Err_Ok; 226 error = FT_Err_Ok;
227 goto Exit; 227 goto Exit;
228 228
229 case 0x03: 229 case 0x03:
230 aprop->type = BDF_PROPERTY_TYPE_CARDINAL; 230 aprop->type = BDF_PROPERTY_TYPE_CARDINAL;
231 aprop->u.cardinal = value; 231 aprop->u.cardinal = value;
232 error = SFNT_Err_Ok; 232 error = FT_Err_Ok;
233 goto Exit; 233 goto Exit;
234 234
235 default: 235 default:
236 ; 236 ;
237 } 237 }
238 } 238 }
239 } 239 }
240 p += 10; 240 p += 10;
241 } 241 }
242 242
243 Exit: 243 Exit:
244 return error; 244 return error;
245 } 245 }
246 246
247 #endif /* TT_CONFIG_OPTION_BDF */ 247 #endif /* TT_CONFIG_OPTION_BDF */
248 248
249 249
250 /* END */ 250 /* END */
OLDNEW
« no previous file with comments | « src/sfnt/sfobjs.c ('k') | src/sfnt/ttcmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698