1 /****************************************************************************
2 *
3 * cffobjs.c
4 *
5 * OpenType objects manager (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
21 #include FT_INTERNAL_DEBUG_H
22 #include FT_INTERNAL_CALC_H
23 #include FT_INTERNAL_STREAM_H
24 #include FT_ERRORS_H
25 #include FT_TRUETYPE_IDS_H
26 #include FT_TRUETYPE_TAGS_H
27 #include FT_INTERNAL_SFNT_H
1001 char *weight = cff_index_get_sid_string( cff,
1002 dict->weight );
1003
1004
1005 if ( weight )
1006 if ( !ft_strcmp( weight, "Bold" ) ||
1007 !ft_strcmp( weight, "Black" ) )
1008 flags |= FT_STYLE_FLAG_BOLD;
1009 }
1010
1011 /* double check */
1012 if ( !(flags & FT_STYLE_FLAG_BOLD) && cffface->style_name )
1013 if ( !ft_strncmp( cffface->style_name, "Bold", 4 ) ||
1014 !ft_strncmp( cffface->style_name, "Black", 5 ) )
1015 flags |= FT_STYLE_FLAG_BOLD;
1016
1017 cffface->style_flags = flags;
1018 }
1019
1020 #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
1021 /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */
1022 /* has unset this flag because of the 3.0 `post' table. */
1023 if ( dict->cid_registry == 0xFFFFU )
1024 cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
1025 #endif
1026
1027 if ( dict->cid_registry != 0xFFFFU && pure_cff )
1028 cffface->face_flags |= FT_FACE_FLAG_CID_KEYED;
1029
1030 /********************************************************************
1031 *
1032 * Compute char maps.
1033 */
1034
1035 /* Try to synthesize a Unicode charmap if there is none available */
1036 /* already. If an OpenType font contains a Unicode "cmap", we */
1037 /* will use it, whatever be in the CFF part of the file. */
1038 {
1039 FT_CharMapRec cmaprec;
1040 FT_CharMap cmap;
1041 FT_UInt nn;
1042 CFF_Encoding encoding = &cff->encoding;
1043
|
1 /****************************************************************************
2 *
3 * cffobjs.c
4 *
5 * OpenType objects manager (body).
6 *
7 * Copyright (C) 1996-2020 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
21 #include FT_INTERNAL_DEBUG_H
22 #include FT_INTERNAL_CALC_H
23 #include FT_INTERNAL_STREAM_H
24 #include FT_ERRORS_H
25 #include FT_TRUETYPE_IDS_H
26 #include FT_TRUETYPE_TAGS_H
27 #include FT_INTERNAL_SFNT_H
1001 char *weight = cff_index_get_sid_string( cff,
1002 dict->weight );
1003
1004
1005 if ( weight )
1006 if ( !ft_strcmp( weight, "Bold" ) ||
1007 !ft_strcmp( weight, "Black" ) )
1008 flags |= FT_STYLE_FLAG_BOLD;
1009 }
1010
1011 /* double check */
1012 if ( !(flags & FT_STYLE_FLAG_BOLD) && cffface->style_name )
1013 if ( !ft_strncmp( cffface->style_name, "Bold", 4 ) ||
1014 !ft_strncmp( cffface->style_name, "Black", 5 ) )
1015 flags |= FT_STYLE_FLAG_BOLD;
1016
1017 cffface->style_flags = flags;
1018 }
1019
1020 #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
1021 /* CID-keyed CFF or CFF2 fonts don't have glyph names -- the SFNT */
1022 /* loader has unset this flag because of the 3.0 `post' table. */
1023 if ( dict->cid_registry == 0xFFFFU && !cff2 )
1024 cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
1025 #endif
1026
1027 if ( dict->cid_registry != 0xFFFFU && pure_cff )
1028 cffface->face_flags |= FT_FACE_FLAG_CID_KEYED;
1029
1030 /********************************************************************
1031 *
1032 * Compute char maps.
1033 */
1034
1035 /* Try to synthesize a Unicode charmap if there is none available */
1036 /* already. If an OpenType font contains a Unicode "cmap", we */
1037 /* will use it, whatever be in the CFF part of the file. */
1038 {
1039 FT_CharMapRec cmaprec;
1040 FT_CharMap cmap;
1041 FT_UInt nn;
1042 CFF_Encoding encoding = &cff->encoding;
1043
|