1 /***************************************************************************/ |
1 /**************************************************************************** |
2 /* */ |
2 * |
3 /* cffgload.c */ |
3 * cffgload.c |
4 /* */ |
4 * |
5 /* OpenType Glyph Loader (body). */ |
5 * OpenType Glyph Loader (body). |
6 /* */ |
6 * |
7 /* Copyright 1996-2018 by */ |
7 * Copyright (C) 1996-2019 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 |
18 |
18 |
19 #include <ft2build.h> |
19 #include <ft2build.h> |
20 #include FT_INTERNAL_DEBUG_H |
20 #include FT_INTERNAL_DEBUG_H |
21 #include FT_INTERNAL_STREAM_H |
21 #include FT_INTERNAL_STREAM_H |
29 #include "cffgload.h" |
29 #include "cffgload.h" |
30 |
30 |
31 #include "cfferrs.h" |
31 #include "cfferrs.h" |
32 |
32 |
33 |
33 |
34 /*************************************************************************/ |
34 /************************************************************************** |
35 /* */ |
35 * |
36 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ |
36 * The macro FT_COMPONENT is used in trace mode. It is an implicit |
37 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ |
37 * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log |
38 /* messages during execution. */ |
38 * messages during execution. |
39 /* */ |
39 */ |
40 #undef FT_COMPONENT |
40 #undef FT_COMPONENT |
41 #define FT_COMPONENT trace_cffgload |
41 #define FT_COMPONENT cffgload |
42 |
42 |
43 |
43 |
44 FT_LOCAL_DEF( FT_Error ) |
44 FT_LOCAL_DEF( FT_Error ) |
45 cff_get_glyph_data( TT_Face face, |
45 cff_get_glyph_data( TT_Face face, |
46 FT_UInt glyph_index, |
46 FT_UInt glyph_index, |
278 |
278 |
279 |
279 |
280 glyph->root.outline.n_points = 0; |
280 glyph->root.outline.n_points = 0; |
281 glyph->root.outline.n_contours = 0; |
281 glyph->root.outline.n_contours = 0; |
282 |
282 |
283 glyph->root.metrics.width = (FT_Pos)metrics.width << 6; |
283 glyph->root.metrics.width = (FT_Pos)metrics.width * 64; |
284 glyph->root.metrics.height = (FT_Pos)metrics.height << 6; |
284 glyph->root.metrics.height = (FT_Pos)metrics.height * 64; |
285 |
285 |
286 glyph->root.metrics.horiBearingX = (FT_Pos)metrics.horiBearingX << 6; |
286 glyph->root.metrics.horiBearingX = (FT_Pos)metrics.horiBearingX * 64; |
287 glyph->root.metrics.horiBearingY = (FT_Pos)metrics.horiBearingY << 6; |
287 glyph->root.metrics.horiBearingY = (FT_Pos)metrics.horiBearingY * 64; |
288 glyph->root.metrics.horiAdvance = (FT_Pos)metrics.horiAdvance << 6; |
288 glyph->root.metrics.horiAdvance = (FT_Pos)metrics.horiAdvance * 64; |
289 |
289 |
290 glyph->root.metrics.vertBearingX = (FT_Pos)metrics.vertBearingX << 6; |
290 glyph->root.metrics.vertBearingX = (FT_Pos)metrics.vertBearingX * 64; |
291 glyph->root.metrics.vertBearingY = (FT_Pos)metrics.vertBearingY << 6; |
291 glyph->root.metrics.vertBearingY = (FT_Pos)metrics.vertBearingY * 64; |
292 glyph->root.metrics.vertAdvance = (FT_Pos)metrics.vertAdvance << 6; |
292 glyph->root.metrics.vertAdvance = (FT_Pos)metrics.vertAdvance * 64; |
293 |
293 |
294 glyph->root.format = FT_GLYPH_FORMAT_BITMAP; |
294 glyph->root.format = FT_GLYPH_FORMAT_BITMAP; |
295 |
295 |
296 if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) |
296 if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) |
297 { |
297 { |
412 /* this is for pure CFFs */ |
412 /* this is for pure CFFs */ |
413 if ( load_flags & FT_LOAD_ADVANCE_ONLY ) |
413 if ( load_flags & FT_LOAD_ADVANCE_ONLY ) |
414 decoder.width_only = TRUE; |
414 decoder.width_only = TRUE; |
415 |
415 |
416 decoder.builder.no_recurse = |
416 decoder.builder.no_recurse = |
417 (FT_Bool)( load_flags & FT_LOAD_NO_RECURSE ); |
417 FT_BOOL( load_flags & FT_LOAD_NO_RECURSE ); |
418 |
418 |
419 /* now load the unscaled outline */ |
419 /* now load the unscaled outline */ |
420 error = cff_get_glyph_data( face, glyph_index, |
420 error = cff_get_glyph_data( face, glyph_index, |
421 &charstring, &charstring_len ); |
421 &charstring, &charstring_len ); |
422 if ( error ) |
422 if ( error ) |