Use defined macros to set {platform,encoding}_id.

* src/bdf/bdfdrivr.c: Include ttnameid.h and use macros to
set charmap.{platfom,encoding}_id.
* src/pcf/pcfdrivr.c: Ditto.
* src/winfonts/winfnt.c: Ditto.
* src/type1/t1objs.c: Ditto.
* src/type42/t42objs.c: Ditto.
* src/cff/cffobjs.c: Ditto.
* src/pfr/pfrobjs.c: Ditto.
This commit is contained in:
suzuki toshiya 2010-07-09 12:26:33 +09:00
parent 1e2a446d55
commit 840f208df4
8 changed files with 54 additions and 32 deletions

View File

@ -1,3 +1,16 @@
2010-07-09 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Use defined macros to set {platform,encoding}_id.
* src/bdf/bdfdrivr.c: Include ttnameid.h and use macros to
set charmap.{platfom,encoding}_id.
* src/pcf/pcfdrivr.c: Ditto.
* src/winfonts/winfnt.c: Ditto.
* src/type1/t1objs.c: Ditto.
* src/type42/t42objs.c: Ditto.
* src/cff/cffobjs.c: Ditto.
* src/pfr/pfrobjs.c: Ditto.
2010-07-09 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> 2010-07-09 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Fix Savannah bug #30373. Fix Savannah bug #30373.

View File

@ -30,6 +30,7 @@ THE SOFTWARE.
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include FT_BDF_H #include FT_BDF_H
#include FT_TRUETYPE_IDS_H
#include FT_SERVICE_BDF_H #include FT_SERVICE_BDF_H
#include FT_SERVICE_XFREE86_NAME_H #include FT_SERVICE_XFREE86_NAME_H
@ -540,14 +541,15 @@ THE SOFTWARE.
charmap.face = FT_FACE( face ); charmap.face = FT_FACE( face );
charmap.encoding = FT_ENCODING_NONE; charmap.encoding = FT_ENCODING_NONE;
charmap.platform_id = 0; /* initial platform/encoding should indicate unset status? */
charmap.encoding_id = 0; charmap.platform_id = TT_PLATFORM_APPLE_UNICODE;
charmap.encoding_id = TT_APPLE_ID_DEFAULT;
if ( unicode_charmap ) if ( unicode_charmap )
{ {
charmap.encoding = FT_ENCODING_UNICODE; charmap.encoding = FT_ENCODING_UNICODE;
charmap.platform_id = 3; charmap.platform_id = TT_PLATFORM_MICROSOFT;
charmap.encoding_id = 1; charmap.encoding_id = TT_MS_ID_UNICODE_CS;
} }
error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL ); error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL );
@ -571,8 +573,8 @@ THE SOFTWARE.
charmap.face = FT_FACE( face ); charmap.face = FT_FACE( face );
charmap.encoding = FT_ENCODING_ADOBE_STANDARD; charmap.encoding = FT_ENCODING_ADOBE_STANDARD;
charmap.platform_id = 7; charmap.platform_id = TT_PLATFORM_ADOBE;
charmap.encoding_id = 0; charmap.encoding_id = TT_ADOBE_ID_STANDARD;
error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL ); error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL );

View File

@ -865,12 +865,13 @@
{ {
cmap = cffface->charmaps[nn]; cmap = cffface->charmaps[nn];
/* Windows Unicode (3,1)? */ /* Windows Unicode? */
if ( cmap->platform_id == 3 && cmap->encoding_id == 1 ) if ( cmap->platform_id == TT_PLATFORM_MICROSOFT &&
cmap->encoding_id == TT_MS_ID_UNICODE_CS )
goto Skip_Unicode; goto Skip_Unicode;
/* Apple Unicode platform id? */ /* Apple Unicode platform id? */
if ( cmap->platform_id == 0 ) if ( cmap->platform_id == TT_PLATFORM_APPLE_UNICODE )
goto Skip_Unicode; /* Apple Unicode */ goto Skip_Unicode; /* Apple Unicode */
} }
@ -891,8 +892,8 @@
/* we didn't find a Unicode charmap -- synthesize one */ /* we didn't find a Unicode charmap -- synthesize one */
cmaprec.face = cffface; cmaprec.face = cffface;
cmaprec.platform_id = 3; cmaprec.platform_id = TT_PLATFORM_MICROSOFT;
cmaprec.encoding_id = 1; cmaprec.encoding_id = TT_MS_ID_UNICODE_CS;
cmaprec.encoding = FT_ENCODING_UNICODE; cmaprec.encoding = FT_ENCODING_UNICODE;
nn = (FT_UInt)cffface->num_charmaps; nn = (FT_UInt)cffface->num_charmaps;
@ -922,7 +923,7 @@
cmaprec.face = cffface; cmaprec.face = cffface;
cmaprec.platform_id = 7; /* Adobe platform id */ cmaprec.platform_id = TT_PLATFORM_ADOBE; /* Adobe platform id */
if ( encoding->offset == 0 ) if ( encoding->offset == 0 )
{ {

View File

@ -34,6 +34,7 @@ THE SOFTWARE.
#include FT_LZW_H #include FT_LZW_H
#include FT_ERRORS_H #include FT_ERRORS_H
#include FT_BDF_H #include FT_BDF_H
#include FT_TRUETYPE_IDS_H
#include "pcf.h" #include "pcf.h"
#include "pcfdrivr.h" #include "pcfdrivr.h"
@ -359,14 +360,15 @@ THE SOFTWARE.
charmap.face = FT_FACE( face ); charmap.face = FT_FACE( face );
charmap.encoding = FT_ENCODING_NONE; charmap.encoding = FT_ENCODING_NONE;
charmap.platform_id = 0; /* initial platform/encoding should indicate unset status? */
charmap.encoding_id = 0; charmap.platform_id = TT_PLATFORM_APPLE_UNICODE;
charmap.encoding_id = TT_APPLE_ID_DEFAULT;
if ( unicode_charmap ) if ( unicode_charmap )
{ {
charmap.encoding = FT_ENCODING_UNICODE; charmap.encoding = FT_ENCODING_UNICODE;
charmap.platform_id = 3; charmap.platform_id = TT_PLATFORM_MICROSOFT;
charmap.encoding_id = 1; charmap.encoding_id = TT_MS_ID_UNICODE_CS;
} }
error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL ); error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL );

View File

@ -23,6 +23,7 @@
#include "pfrsbit.h" #include "pfrsbit.h"
#include FT_OUTLINE_H #include FT_OUTLINE_H
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_TRUETYPE_IDS_H
#include "pfrerror.h" #include "pfrerror.h"
@ -252,8 +253,8 @@
charmap.face = pfrface; charmap.face = pfrface;
charmap.platform_id = 3; charmap.platform_id = TT_PLATFORM_MICROSOFT;
charmap.encoding_id = 1; charmap.encoding_id = TT_MS_ID_UNICODE_CS;
charmap.encoding = FT_ENCODING_UNICODE; charmap.encoding = FT_ENCODING_UNICODE;
error = FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL ); error = FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL );

View File

@ -494,8 +494,8 @@
charmap.face = root; charmap.face = root;
/* first of all, try to synthesize a Unicode charmap */ /* first of all, try to synthesize a Unicode charmap */
charmap.platform_id = 3; charmap.platform_id = TT_PLATFORM_MICROSOFT;
charmap.encoding_id = 1; charmap.encoding_id = TT_MS_ID_UNICODE_CS;
charmap.encoding = FT_ENCODING_UNICODE; charmap.encoding = FT_ENCODING_UNICODE;
error = FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL ); error = FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL );
@ -503,7 +503,7 @@
goto Exit; goto Exit;
/* now, generate an Adobe Standard encoding when appropriate */ /* now, generate an Adobe Standard encoding when appropriate */
charmap.platform_id = 7; charmap.platform_id = TT_PLATFORM_ADOBE;
clazz = NULL; clazz = NULL;
switch ( type1->encoding_type ) switch ( type1->encoding_type )

View File

@ -21,6 +21,7 @@
#include "t42error.h" #include "t42error.h"
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_LIST_H #include FT_LIST_H
#include FT_TRUETYPE_IDS_H
#undef FT_COMPONENT #undef FT_COMPONENT
@ -330,8 +331,8 @@
charmap.face = root; charmap.face = root;
/* first of all, try to synthesize a Unicode charmap */ /* first of all, try to synthesize a Unicode charmap */
charmap.platform_id = 3; charmap.platform_id = TT_PLATFORM_MICROSOFT;
charmap.encoding_id = 1; charmap.encoding_id = TT_MS_ID_UNICODE_CS;
charmap.encoding = FT_ENCODING_UNICODE; charmap.encoding = FT_ENCODING_UNICODE;
error = FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL ); error = FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL );
@ -339,32 +340,32 @@
goto Exit; goto Exit;
/* now, generate an Adobe Standard encoding when appropriate */ /* now, generate an Adobe Standard encoding when appropriate */
charmap.platform_id = 7; charmap.encoding_id = TT_ADOBE_ID_STANDARD;
clazz = NULL; clazz = NULL;
switch ( type1->encoding_type ) switch ( type1->encoding_type )
{ {
case T1_ENCODING_TYPE_STANDARD: case T1_ENCODING_TYPE_STANDARD:
charmap.encoding = FT_ENCODING_ADOBE_STANDARD; charmap.encoding = FT_ENCODING_ADOBE_STANDARD;
charmap.encoding_id = 0; charmap.encoding_id = TT_ADOBE_ID_STANDARD;
clazz = cmap_classes->standard; clazz = cmap_classes->standard;
break; break;
case T1_ENCODING_TYPE_EXPERT: case T1_ENCODING_TYPE_EXPERT:
charmap.encoding = FT_ENCODING_ADOBE_EXPERT; charmap.encoding = FT_ENCODING_ADOBE_EXPERT;
charmap.encoding_id = 1; charmap.encoding_id = TT_ADOBE_ID_EXPERT;
clazz = cmap_classes->expert; clazz = cmap_classes->expert;
break; break;
case T1_ENCODING_TYPE_ARRAY: case T1_ENCODING_TYPE_ARRAY:
charmap.encoding = FT_ENCODING_ADOBE_CUSTOM; charmap.encoding = FT_ENCODING_ADOBE_CUSTOM;
charmap.encoding_id = 2; charmap.encoding_id = TT_ADOBE_ID_CUSTOM;
clazz = cmap_classes->custom; clazz = cmap_classes->custom;
break; break;
case T1_ENCODING_TYPE_ISOLATIN1: case T1_ENCODING_TYPE_ISOLATIN1:
charmap.encoding = FT_ENCODING_ADOBE_LATIN_1; charmap.encoding = FT_ENCODING_ADOBE_LATIN_1;
charmap.encoding_id = 3; charmap.encoding_id = TT_ADOBE_ID_LATIN_1;
clazz = cmap_classes->unicode; clazz = cmap_classes->unicode;
break; break;

View File

@ -23,6 +23,7 @@
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include FT_TRUETYPE_IDS_H
#include "winfnt.h" #include "winfnt.h"
#include "fnterrs.h" #include "fnterrs.h"
@ -802,15 +803,16 @@
charmap.encoding = FT_ENCODING_NONE; charmap.encoding = FT_ENCODING_NONE;
charmap.platform_id = 0; /* initial platform/encoding should indicate unset status? */
charmap.encoding_id = 0; charmap.platform_id = TT_PLATFORM_APPLE_UNICODE;
charmap.encoding_id = TT_APPLE_ID_DEFAULT;
charmap.face = root; charmap.face = root;
if ( font->header.charset == FT_WinFNT_ID_MAC ) if ( font->header.charset == FT_WinFNT_ID_MAC )
{ {
charmap.encoding = FT_ENCODING_APPLE_ROMAN; charmap.encoding = FT_ENCODING_APPLE_ROMAN;
charmap.platform_id = 1; charmap.platform_id = TT_PLATFORM_MACINTOSH;
/* charmap.encoding_id = 0; */ /* charmap.encoding_id = TT_MAC_ID_ROMAN; */
} }
error = FT_CMap_New( fnt_cmap_class, error = FT_CMap_New( fnt_cmap_class,