From d594a7012b21c332a5880c866639bbc9824531f5 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 19 Jun 2002 15:57:55 +0000 Subject: [PATCH] * src/psaux/t1cmap.c (t1_cmap_custom_char_index, t1_cmap_custom_char_next): Fix index computation -- indices start with 0 and not with cmap->first. Provide default charmaps. * src/bdf/bdfdrivr.c (BDF_Face_Init), src/pcf/pcfdriver.c (PCF_Face_Init), src/pfr/pfrobjs.c (pfr_face_init), src/type1/t1objs (T1_Face_Init), src/winfonts/winfnt.c (FNT_Face_Init): Implement it. --- ChangeLog | 15 ++++++++++++++- src/bdf/bdfdrivr.c | 12 ++++++++++-- src/pcf/pcfdriver.c | 4 ++++ src/pfr/pfrobjs.c | 4 ++++ src/psaux/t1cmap.c | 13 +++++-------- src/type1/t1objs.c | 4 ++++ src/winfonts/winfnt.c | 7 ++++++- 7 files changed, 47 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5cd786b8c..9443aaf78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2002-06-18 Detlef Würkner + + * src/psaux/t1cmap.c (t1_cmap_custom_char_index, + t1_cmap_custom_char_next): Fix index computation -- indices start + with 0 and not with cmap->first. + + Provide default charmaps. + + * src/bdf/bdfdrivr.c (BDF_Face_Init), src/pcf/pcfdriver.c + (PCF_Face_Init), src/pfr/pfrobjs.c (pfr_face_init), + src/type1/t1objs (T1_Face_Init), src/winfonts/winfnt.c + (FNT_Face_Init): Implement it. + 2002-06-17 Sven Neumann * src/pfr/pfrobjs.c (pfr_face_init): Fix typo. @@ -43,7 +56,7 @@ 2002-06-14 Detlef Würkner - Add new cmap support to BDF driver + Add new cmap support to BDF driver. * src/bdf/bdfdrivr.c (BDF_CMapRec) [FT_CONFIG_OPTION_USE_CMAPS]: New structure. diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index 4a97e3d6a..e0e894b18 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -448,6 +448,10 @@ THE SOFTWARE. } error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL ); + + /* Select default charmap */ + if (root->num_charmaps) + root->charmap = root->charmaps[0]; } #else /* !FT_CONFIG_OPTION_USE_CMAPS */ @@ -481,11 +485,15 @@ THE SOFTWARE. charmap.face = FT_FACE( face ); - charmap.encoding = ft_encoding_none; - charmap.platform_id = 0; + charmap.encoding = ft_encoding_adobe_standard; + charmap.platform_id = 7; charmap.encoding_id = 0; error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL ); + + /* Select default charmap */ + if (root->num_charmaps) + root->charmap = root->charmaps[0]; } #else /* !FT_CONFIG_OPTION_USE_CMAPS */ diff --git a/src/pcf/pcfdriver.c b/src/pcf/pcfdriver.c index c9e3972bf..c86bbfb8c 100644 --- a/src/pcf/pcfdriver.c +++ b/src/pcf/pcfdriver.c @@ -340,6 +340,10 @@ THE SOFTWARE. } error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL ); + + /* Select default charmap */ + if (face->root.num_charmaps) + face->root.charmap = face->root.charmaps[0]; } #else /* !FT_CONFIG_OPTION_USE_CMAPS */ diff --git a/src/pfr/pfrobjs.c b/src/pfr/pfrobjs.c index 76a35d541..61e9afc00 100644 --- a/src/pfr/pfrobjs.c +++ b/src/pfr/pfrobjs.c @@ -175,6 +175,10 @@ charmap.encoding = ft_encoding_unicode; FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL ); + + /* Select default charmap */ + if (root->num_charmaps) + root->charmap = root->charmaps[0]; } } diff --git a/src/psaux/t1cmap.c b/src/psaux/t1cmap.c index db3b968d8..0ddd3f5da 100644 --- a/src/psaux/t1cmap.c +++ b/src/psaux/t1cmap.c @@ -197,12 +197,11 @@ FT_UInt32 char_code ) { FT_UInt result = 0; - FT_UInt32 idx; - idx = (FT_UInt32)( char_code - cmap->first ); - if ( idx < cmap->count ) - result = cmap->indices[idx]; + if ( ( char_code >= cmap->first ) && + ( char_code < ( cmap->first + cmap->count ) ) ) + result = cmap->indices[char_code]; return result; } @@ -214,7 +213,6 @@ { FT_UInt result = 0; FT_UInt32 char_code = *pchar_code; - FT_UInt32 idx; ++char_code; @@ -222,10 +220,9 @@ if ( char_code < cmap->first ) char_code = cmap->first; - idx = (FT_UInt32)( char_code - cmap->first ); - for ( ; idx < cmap->count; idx++, char_code++ ) + for ( ; char_code < ( cmap->first + cmap->count ); char_code++ ) { - result = cmap->indices[idx]; + result = cmap->indices[char_code]; if ( result != 0 ) goto Exit; } diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 2755f254a..5a6008d29 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -485,6 +485,10 @@ if ( clazz ) FT_CMap_New( clazz, NULL, &charmap, NULL ); + + /* Select default charmap */ + if (root->num_charmaps) + root->charmap = root->charmaps[0]; } } diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index b2b44a65f..5344c684f 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -548,7 +548,12 @@ NULL, &charmap, NULL ); - if (error) goto Fail; + if ( error ) + goto Fail; + + /* Select default charmap */ + if ( root->num_charmaps ) + root->charmap = root->charmaps[0]; } #else /* !FT_CONFIG_OPTION_USE_CMAPS */