1 /***************************************************************************/
2 /* */
3 /* cidgload.c */
4 /* */
5 /* CID-keyed Type1 Glyph Loader (body). */
6 /* */
7 /* Copyright 1996-2018 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
9 /* */
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 */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
15 /* */
16 /***************************************************************************/
17
18
19 #include <ft2build.h>
20 #include "cidload.h"
21 #include "cidgload.h"
22 #include FT_INTERNAL_DEBUG_H
23 #include FT_INTERNAL_STREAM_H
24 #include FT_OUTLINE_H
25 #include FT_INTERNAL_CALC_H
26
27 #include FT_INTERNAL_POSTSCRIPT_AUX_H
28 #include FT_INTERNAL_CFF_TYPES_H
29 #include FT_DRIVER_H
30
31 #include "ciderrs.h"
32
33
34 /*************************************************************************/
35 /* */
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 */
38 /* messages during execution. */
39 /* */
40 #undef FT_COMPONENT
41 #define FT_COMPONENT trace_cidgload
42
43
44 FT_CALLBACK_DEF( FT_Error )
45 cid_load_glyph( T1_Decoder decoder,
46 FT_UInt glyph_index )
47 {
48 CID_Face face = (CID_Face)decoder->builder.face;
49 CID_FaceInfo cid = &face->cid;
50 FT_Byte* p;
51 FT_ULong fd_select;
52 FT_Stream stream = face->cid_stream;
53 FT_Error error = FT_Err_Ok;
54 FT_Byte* charstring = NULL;
55 FT_Memory memory = face->root.memory;
56 FT_ULong glyph_length = 0;
57 PSAux_Service psaux = (PSAux_Service)face->psaux;
58
59 FT_Bool force_scaling = FALSE;
60
61 #ifdef FT_CONFIG_OPTION_INCREMENTAL
376 cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
377
378 error = psaux->t1_decoder_funcs->init( &decoder,
379 cidglyph->face,
380 cidsize,
381 cidglyph,
382 0, /* glyph names -- XXX */
383 0, /* blend == 0 */
384 hinting,
385 FT_LOAD_TARGET_MODE( load_flags ),
386 cid_load_glyph );
387 if ( error )
388 goto Exit;
389
390 /* TODO: initialize decoder.len_buildchar and decoder.buildchar */
391 /* if we ever support CID-keyed multiple master fonts */
392
393 must_finish_decoder = TRUE;
394
395 /* set up the decoder */
396 decoder.builder.no_recurse = FT_BOOL(
397 ( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ) );
398
399 error = cid_load_glyph( &decoder, glyph_index );
400 if ( error )
401 goto Exit;
402
403 /* copy flags back for forced scaling */
404 hinting = glyph->hint;
405 scaled = glyph->scaled;
406
407 font_matrix = decoder.font_matrix;
408 font_offset = decoder.font_offset;
409
410 /* save new glyph tables */
411 psaux->t1_decoder_funcs->done( &decoder );
412
413 must_finish_decoder = FALSE;
414
415 /* now set the metrics -- this is rather simple, as */
416 /* the left side bearing is the xMin, and the top side */
417 /* bearing the yMax */
|
1 /****************************************************************************
2 *
3 * cidgload.c
4 *
5 * CID-keyed Type1 Glyph Loader (body).
6 *
7 * Copyright (C) 1996-2019 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
9 *
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
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute
13 * this file you indicate that you have read the license and
14 * understand and accept it fully.
15 *
16 */
17
18
19 #include <ft2build.h>
20 #include "cidload.h"
21 #include "cidgload.h"
22 #include FT_INTERNAL_DEBUG_H
23 #include FT_INTERNAL_STREAM_H
24 #include FT_OUTLINE_H
25 #include FT_INTERNAL_CALC_H
26
27 #include FT_INTERNAL_POSTSCRIPT_AUX_H
28 #include FT_INTERNAL_CFF_TYPES_H
29 #include FT_DRIVER_H
30
31 #include "ciderrs.h"
32
33
34 /**************************************************************************
35 *
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
38 * messages during execution.
39 */
40 #undef FT_COMPONENT
41 #define FT_COMPONENT cidgload
42
43
44 FT_CALLBACK_DEF( FT_Error )
45 cid_load_glyph( T1_Decoder decoder,
46 FT_UInt glyph_index )
47 {
48 CID_Face face = (CID_Face)decoder->builder.face;
49 CID_FaceInfo cid = &face->cid;
50 FT_Byte* p;
51 FT_ULong fd_select;
52 FT_Stream stream = face->cid_stream;
53 FT_Error error = FT_Err_Ok;
54 FT_Byte* charstring = NULL;
55 FT_Memory memory = face->root.memory;
56 FT_ULong glyph_length = 0;
57 PSAux_Service psaux = (PSAux_Service)face->psaux;
58
59 FT_Bool force_scaling = FALSE;
60
61 #ifdef FT_CONFIG_OPTION_INCREMENTAL
376 cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
377
378 error = psaux->t1_decoder_funcs->init( &decoder,
379 cidglyph->face,
380 cidsize,
381 cidglyph,
382 0, /* glyph names -- XXX */
383 0, /* blend == 0 */
384 hinting,
385 FT_LOAD_TARGET_MODE( load_flags ),
386 cid_load_glyph );
387 if ( error )
388 goto Exit;
389
390 /* TODO: initialize decoder.len_buildchar and decoder.buildchar */
391 /* if we ever support CID-keyed multiple master fonts */
392
393 must_finish_decoder = TRUE;
394
395 /* set up the decoder */
396 decoder.builder.no_recurse = FT_BOOL( load_flags & FT_LOAD_NO_RECURSE );
397
398 error = cid_load_glyph( &decoder, glyph_index );
399 if ( error )
400 goto Exit;
401
402 /* copy flags back for forced scaling */
403 hinting = glyph->hint;
404 scaled = glyph->scaled;
405
406 font_matrix = decoder.font_matrix;
407 font_offset = decoder.font_offset;
408
409 /* save new glyph tables */
410 psaux->t1_decoder_funcs->done( &decoder );
411
412 must_finish_decoder = FALSE;
413
414 /* now set the metrics -- this is rather simple, as */
415 /* the left side bearing is the xMin, and the top side */
416 /* bearing the yMax */
|