From fa77c87f64978546fd4c55866d21d7cbdbae1b02 Mon Sep 17 00:00:00 2001 From: David Turner Date: Fri, 22 Mar 2002 15:56:12 +0000 Subject: [PATCH] polishing FT_CMaps support for Type 1 format --- src/type1/t1objs.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index b1515bd3d..26a7a1263 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -428,6 +428,67 @@ root->internal->max_contours = 0; } +#ifdef FT_CONFIG_OPTION_USE_CMAPS + + { + FT_Face root = &face->root; + + if ( psnames && psaux ) + { + FT_CharMapRec charmap; + FT_CMap_Classes cmap_classes = psaux->cmap_classes; + FT_CMap_Class clazz; + + charmap.face = root; + + /* first of all, try to synthetize a Unicode charmap */ + charmap.platform_id = 3; + charmap.encoding_id = 1; + charmap.encoding = ft_encoding_unicode; + + FT_CMap_New( root, cmap_classes->unicode, &charmap, NULL ); + + /* now, generate an Adobe Standard encoding when appropriate */ + charmap.platform_id = 7; + clazz = NULL; + + switch ( face->type1.encoding_type ) + { + case T1_ENCODING_TYPE_STANDARD: + charmap.encoding = ft_encoding_adobe_standard; + charmap.encoding_id = 0; + clazz = cmap_classes->standard; + break; + + case T1_ENCODING_TYPE_EXPORT: + charmap.encoding = ft_encoding_adobe_expert; + charmap.encoding_id = 1; + clazz = cmap_classes->expert; + break; + + case T1_ENCODING_TYPE_ARRAY: + charmap.encoding = ft_encoding_adobe_custom; + charmap.encoding_id = 2; + clazz = cmap_classes->custom; + break; + + case T1_ENCODING_TYPE_ISOLATIN1: + charmap.encoding = ft_encoding_adobe_latin_1; + charmap.encoding_id = 3; + clazz = cmap_classes->latin_1; + break; + + default: + ; + } + + if ( clazz ) + FT_CMap_New( root, clazz, &charmap, NULL ); + } + } + +#else /* !FT_CONFIG_OPTION_USE_CMAPS */ + /* charmap support -- synthetize unicode charmap if possible */ { FT_Face root = &face->root; @@ -499,6 +560,8 @@ face->charmaps[1] = &face->charmaprecs[1]; } +#endif /* !FT_CONFIG_OPTION_USE_CMAPS */ + Exit: return error; }