[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Devel] Mac language ID
From: |
Masatake YAMATO |
Subject: |
Re: [Devel] Mac language ID |
Date: |
Tue, 16 Dec 2003 20:24:39 +0900 (JST) |
> What about an API like the following instead::
>
> FT_Get_CMap_Language_ID( cmap ) => language_ID, 0 by default
>
> it would be simpler to use than through a TT_CMapInfo, since
> we cannot extend public structures that are used as output
> parameters unless we want to break binary compatibility.
I've changed a bit based on your suggestion.
In API for the FT2 application level, I'll provide
FT_Get_CMap_Language_ID. However, FT2 ( and TTCMap service )
internally, TT_CMapInfo is used yet.
Now TT_CMapInfo is not public, therefore we don't have
to be care about breaking binary compatibility in the future.
In other hand we don't have to add new methods to get another
tt/sfnt cmap information; we have to do just add new field to
TT_CMapInfo.
diff -c -r --exclude=config.log --exclude=cscope.files --exclude=cscope.out
--exclude=CVS --exclude=.cvsignore --exclude=stamp-vti --exclude=version.texi
--exclude='.#*' --exclude='*~' --exclude='*.orig' --exclude='automake.info*'
--exclude=aclocal --exclude=autom4te.cache --exclude=automake
--exclude=config.status --exclude=Makefile --exclude=samples
--exclude=amversion.m4 --exclude=automake-1.5e --new-file
freetype2/include/freetype/internal/ftserv.h
freetype2.new/include/freetype/internal/ftserv.h
*** freetype2/include/freetype/internal/ftserv.h 2003-11-01
23:36:19.000000000 +0900
--- freetype2.new/include/freetype/internal/ftserv.h 2003-12-16
19:59:46.000000000 +0900
***************
*** 248,253 ****
--- 248,254 ----
#define FT_SERVICE_SFNT_H <freetype/internal/services/svsfnt.h>
#define FT_SERVICE_PFR_H <freetype/internal/services/svpfr.h>
#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h>
+ #define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h>
/* */
diff -c -r --exclude=config.log --exclude=cscope.files --exclude=cscope.out
--exclude=CVS --exclude=.cvsignore --exclude=stamp-vti --exclude=version.texi
--exclude='.#*' --exclude='*~' --exclude='*.orig' --exclude='automake.info*'
--exclude=aclocal --exclude=autom4te.cache --exclude=automake
--exclude=config.status --exclude=Makefile --exclude=samples
--exclude=amversion.m4 --exclude=automake-1.5e --new-file
freetype2/include/freetype/internal/services/svttcmap.h
freetype2.new/include/freetype/internal/services/svttcmap.h
*** freetype2/include/freetype/internal/services/svttcmap.h 1970-01-01
09:00:00.000000000 +0900
--- freetype2.new/include/freetype/internal/services/svttcmap.h 2003-12-16
20:05:29.000000000 +0900
***************
*** 0 ****
--- 1,68 ----
+ /***************************************************************************/
+ /* */
+ /* svsttcmap.h */
+ /* */
+ /* The FreeType tt/sfnt cmap extra information service. */
+ /* */
+ /* Copyright 2003 by */
+ /* Masatake YAMATO, Redhat K.K. */
+ /* */
+ /* Copyright 2003 by */
+ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
+ /* */
+ /* This file is part of the FreeType project, and may only be used, */
+ /* modified, and distributed under the terms of the FreeType project */
+ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+ /* this file you indicate that you have read the license and */
+ /* understand and accept it fully. */
+ /* */
+ /***************************************************************************/
+
+ /* Development of this service is support of
+ Information-technology Promotion Agency, Japan. */
+
+ #ifndef __SVSTTCMAP_H__
+ #define __SVSTTCMAP_H__
+
+ #include FT_INTERNAL_SERVICE_H
+ #include FT_TRUETYPE_TABLES_H
+
+ FT_BEGIN_HEADER
+
+ #define FT_SERVICE_ID_TT_CMAP "tt-cmaps"
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_CMapInfo */
+ /* */
+ /* <Description> */
+ /* A structure used to store truetype/sfnt specific cmap information */
+ /* which is not covered by generic FT_CharMap structure. This */
+ /* structure can be accessed with FT_Get_TT_CMap_Info function. */
+ /* */
+ /* <Fields> */
+ /* language :: language ID used in Mac fonts. */
+ /* Definitions of values are in */
+ /* freetype/ttnameid.h. */
+ /* */
+ typedef struct TT_CMapInfo_
+ {
+ FT_ULong language;
+ } TT_CMapInfo;
+
+ typedef FT_Error
+ (*TT_CMap_Info_GetFunc) ( FT_CharMap charmap, TT_CMapInfo *cmap_info );
+
+ FT_DEFINE_SERVICE( TTCMaps )
+ {
+ TT_CMap_Info_GetFunc get_cmap_info;
+ };
+
+ /* */
+
+ FT_END_HEADER
+ #endif /* __SVSTTCMAP_H__ */
+
+ /* END */
diff -c -r --exclude=config.log --exclude=cscope.files --exclude=cscope.out
--exclude=CVS --exclude=.cvsignore --exclude=stamp-vti --exclude=version.texi
--exclude='.#*' --exclude='*~' --exclude='*.orig' --exclude='automake.info*'
--exclude=aclocal --exclude=autom4te.cache --exclude=automake
--exclude=config.status --exclude=Makefile --exclude=samples
--exclude=amversion.m4 --exclude=automake-1.5e --new-file
freetype2/include/freetype/tttables.h freetype2.new/include/freetype/tttables.h
*** freetype2/include/freetype/tttables.h 2003-11-04 16:44:19.000000000
+0900
--- freetype2.new/include/freetype/tttables.h 2003-12-16 20:08:53.000000000
+0900
***************
*** 663,668 ****
--- 663,688 ----
FT_Byte* buffer,
FT_ULong* length );
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Get_CMap_Language_ID */
+ /* */
+ /* <Description> */
+ /* Return truetype/sfnt specific cmap language ID. Definitions of */
+ /* languageID values are in freetype/ttnameid.h. */
+ /* */
+ /* <Input> */
+ /* charmap :: target charmap. */
+ /* */
+ /* <Return> */
+ /* languageID of charmap. If charmap doesn't belong to TT/SFNT face, */
+ /* just return 0 as the default value. */
+ /* */
+ FT_EXPORT( FT_ULong )
+ FT_Get_CMap_Language_ID( FT_CharMap charmap );
+
/* */
diff -c -r --exclude=config.log --exclude=cscope.files --exclude=cscope.out
--exclude=CVS --exclude=.cvsignore --exclude=stamp-vti --exclude=version.texi
--exclude='.#*' --exclude='*~' --exclude='*.orig' --exclude='automake.info*'
--exclude=aclocal --exclude=autom4te.cache --exclude=automake
--exclude=config.status --exclude=Makefile --exclude=samples
--exclude=amversion.m4 --exclude=automake-1.5e --new-file
freetype2/src/base/ftobjs.c freetype2.new/src/base/ftobjs.c
*** freetype2/src/base/ftobjs.c 2003-12-11 07:10:16.000000000 +0900
--- freetype2.new/src/base/ftobjs.c 2003-12-16 20:15:20.000000000 +0900
***************
*** 30,36 ****
#include FT_SERVICE_SFNT_H
#include FT_SERVICE_POSTSCRIPT_NAME_H
#include FT_SERVICE_GLYPH_DICT_H
!
FT_BASE_DEF( FT_Pointer )
ft_service_list_lookup( FT_ServiceDesc service_descriptors,
--- 30,36 ----
#include FT_SERVICE_SFNT_H
#include FT_SERVICE_POSTSCRIPT_NAME_H
#include FT_SERVICE_GLYPH_DICT_H
! #include FT_SERVICE_TT_CMAP_H
FT_BASE_DEF( FT_Pointer )
ft_service_list_lookup( FT_ServiceDesc service_descriptors,
***************
*** 2507,2512 ****
--- 2507,2530 ----
return service->load_table( face, tag, offset, buffer, length );
}
+ FT_EXPORT_DEF( FT_ULong )
+ FT_Get_CMap_Language_ID( FT_CharMap charmap )
+ {
+ FT_Service_TTCMaps service;
+ FT_Face face;
+ TT_CMapInfo cmap_info;
+
+ if ( !charmap || !charmap->face )
+ return 0;
+
+ face = charmap->face;
+ FT_FACE_FIND_SERVICE( face, service, TT_CMAP );
+ if ( service == NULL )
+ return 0;
+ if (( service->get_cmap_info( charmap, &cmap_info )))
+ return 0;
+ return cmap_info.language;
+ }
FT_EXPORT_DEF( FT_Error )
FT_Activate_Size( FT_Size size )
diff -c -r --exclude=config.log --exclude=cscope.files --exclude=cscope.out
--exclude=CVS --exclude=.cvsignore --exclude=stamp-vti --exclude=version.texi
--exclude='.#*' --exclude='*~' --exclude='*.orig' --exclude='automake.info*'
--exclude=aclocal --exclude=autom4te.cache --exclude=automake
--exclude=config.status --exclude=Makefile --exclude=samples
--exclude=amversion.m4 --exclude=automake-1.5e --new-file
freetype2/src/sfnt/sfdriver.c freetype2.new/src/sfnt/sfdriver.c
*** freetype2/src/sfnt/sfdriver.c 2003-12-16 15:42:11.000000000 +0900
--- freetype2.new/src/sfnt/sfdriver.c 2003-12-16 19:59:55.000000000 +0900
***************
*** 34,43 ****
#include "ttpost.h"
#endif
#include FT_SERVICE_GLYPH_DICT_H
#include FT_SERVICE_POSTSCRIPT_NAME_H
#include FT_SERVICE_SFNT_H
!
/*
* SFNT TABLE SERVICE
--- 34,45 ----
#include "ttpost.h"
#endif
+ #include "ttcmap0.h"
+
#include FT_SERVICE_GLYPH_DICT_H
#include FT_SERVICE_POSTSCRIPT_NAME_H
#include FT_SERVICE_SFNT_H
! #include FT_SERVICE_TT_CMAP_H
/*
* SFNT TABLE SERVICE
***************
*** 259,265 ****
--- 261,284 ----
(FT_PsName_GetFunc)sfnt_get_ps_name
};
+ /*
+ * TT CMAP INFO
+ *
+ */
+ static FT_Error
+ tt_get_cmap_info( FT_CharMap charmap,
+ TT_CMapInfo *cmap_info )
+ {
+ TT_CMap tt_cmap = (TT_CMap)charmap;
+ cmap_info->language = tt_cmap->language;
+ return FT_Err_Ok;
+ }
+
+ static const FT_Service_TTCMapsRec tt_service_get_cap_info =
+ {
+ (TT_CMap_Info_GetFunc) tt_get_cmap_info
+ };
/*
* SERVICE LIST
***************
*** 273,279 ****
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
{ FT_SERVICE_ID_GLYPH_DICT, &sfnt_service_glyph_dict },
#endif
!
{ NULL, NULL }
};
--- 292,298 ----
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
{ FT_SERVICE_ID_GLYPH_DICT, &sfnt_service_glyph_dict },
#endif
! { FT_SERVICE_ID_TT_CMAP, &tt_service_get_cap_info },
{ NULL, NULL }
};
diff -c -r --exclude=config.log --exclude=cscope.files --exclude=cscope.out
--exclude=CVS --exclude=.cvsignore --exclude=stamp-vti --exclude=version.texi
--exclude='.#*' --exclude='*~' --exclude='*.orig' --exclude='automake.info*'
--exclude=aclocal --exclude=autom4te.cache --exclude=automake
--exclude=config.status --exclude=Makefile --exclude=samples
--exclude=amversion.m4 --exclude=automake-1.5e --new-file
freetype2/src/sfnt/ttcmap0.c freetype2.new/src/sfnt/ttcmap0.c
*** freetype2/src/sfnt/ttcmap0.c 2003-06-23 00:33:53.000000000 +0900
--- freetype2.new/src/sfnt/ttcmap0.c 2003-12-16 19:59:55.000000000 +0900
***************
*** 143,148 ****
--- 143,156 ----
return gindex;
}
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap0_init( TT_CMap cmap,
+ FT_Byte* table )
+ {
+ FT_Byte* p = table + 4; /* Skip format and length */
+ cmap->language = (FT_ULong)TT_PEEK_USHORT( p );
+ return tt_cmap_init( cmap, table );
+ }
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap0_class_rec =
***************
*** 150,156 ****
{
sizeof( TT_CMapRec ),
! (FT_CMap_InitFunc) tt_cmap_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)tt_cmap0_char_index,
(FT_CMap_CharNextFunc) tt_cmap0_char_next
--- 158,164 ----
{
sizeof( TT_CMapRec ),
! (FT_CMap_InitFunc) tt_cmap0_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)tt_cmap0_char_index,
(FT_CMap_CharNextFunc) tt_cmap0_char_next
***************
*** 496,501 ****
--- 504,517 ----
return gindex;
}
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap2_init( TT_CMap cmap,
+ FT_Byte* table )
+ {
+ FT_Byte* p = table + 4; /* Skip format and length */
+ cmap->language = (FT_ULong)TT_PEEK_USHORT( p );
+ return tt_cmap_init( cmap, table );
+ }
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap2_class_rec =
***************
*** 503,509 ****
{
sizeof( TT_CMapRec ),
! (FT_CMap_InitFunc) tt_cmap_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)tt_cmap2_char_index,
(FT_CMap_CharNextFunc) tt_cmap2_char_next
--- 519,525 ----
{
sizeof( TT_CMapRec ),
! (FT_CMap_InitFunc) tt_cmap2_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)tt_cmap2_char_index,
(FT_CMap_CharNextFunc) tt_cmap2_char_next
***************
*** 1057,1062 ****
--- 1073,1086 ----
return gindex;
}
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap4_init( TT_CMap cmap,
+ FT_Byte* table )
+ {
+ FT_Byte* p = table + 4; /* Skip format and length */
+ cmap->language = (FT_ULong)TT_PEEK_USHORT( p );
+ return tt_cmap_init( cmap, table );
+ }
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap4_class_rec =
***************
*** 1064,1070 ****
{
sizeof ( TT_CMapRec ),
! (FT_CMap_InitFunc) tt_cmap_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)tt_cmap4_char_index,
(FT_CMap_CharNextFunc) tt_cmap4_char_next
--- 1088,1094 ----
{
sizeof ( TT_CMapRec ),
! (FT_CMap_InitFunc) tt_cmap4_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)tt_cmap4_char_index,
(FT_CMap_CharNextFunc) tt_cmap4_char_next
***************
*** 1201,1206 ****
--- 1225,1238 ----
return gindex;
}
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap6_init( TT_CMap cmap,
+ FT_Byte* table )
+ {
+ FT_Byte* p = table + 4; /* Skip format and length */
+ cmap->language = (FT_ULong)TT_PEEK_USHORT( p );
+ return tt_cmap_init( cmap, table );
+ }
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap6_class_rec =
***************
*** 1208,1214 ****
{
sizeof ( TT_CMapRec ),
! (FT_CMap_InitFunc) tt_cmap_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)tt_cmap6_char_index,
(FT_CMap_CharNextFunc) tt_cmap6_char_next
--- 1240,1246 ----
{
sizeof ( TT_CMapRec ),
! (FT_CMap_InitFunc) tt_cmap6_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)tt_cmap6_char_index,
(FT_CMap_CharNextFunc) tt_cmap6_char_next
***************
*** 1438,1443 ****
--- 1470,1483 ----
return gindex;
}
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap8_init( TT_CMap cmap,
+ FT_Byte* table )
+ {
+ FT_Byte* p = table + 8; /* Skip format, reserved and length */
+ cmap->language = TT_PEEK_ULONG( p );
+ return tt_cmap_init( cmap, table );
+ }
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap8_class_rec =
***************
*** 1445,1451 ****
{
sizeof ( TT_CMapRec ),
! (FT_CMap_InitFunc) tt_cmap_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)tt_cmap8_char_index,
(FT_CMap_CharNextFunc) tt_cmap8_char_next
--- 1485,1491 ----
{
sizeof ( TT_CMapRec ),
! (FT_CMap_InitFunc) tt_cmap8_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)tt_cmap8_char_index,
(FT_CMap_CharNextFunc) tt_cmap8_char_next
***************
*** 1570,1575 ****
--- 1610,1623 ----
return gindex;
}
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap10_init( TT_CMap cmap,
+ FT_Byte* table )
+ {
+ FT_Byte* p = table + 8; /* Skip format, reserved and length */
+ cmap->language = TT_PEEK_ULONG( p );
+ return tt_cmap_init( cmap, table );
+ }
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap10_class_rec =
***************
*** 1577,1583 ****
{
sizeof ( TT_CMapRec ),
! (FT_CMap_InitFunc) tt_cmap_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)tt_cmap10_char_index,
(FT_CMap_CharNextFunc) tt_cmap10_char_next
--- 1625,1631 ----
{
sizeof ( TT_CMapRec ),
! (FT_CMap_InitFunc) tt_cmap10_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)tt_cmap10_char_index,
(FT_CMap_CharNextFunc) tt_cmap10_char_next
***************
*** 1740,1745 ****
--- 1788,1801 ----
return gindex;
}
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap12_init( TT_CMap cmap,
+ FT_Byte* table )
+ {
+ FT_Byte* p = table + 8; /* Skip format, reserved and length */
+ cmap->language = TT_PEEK_ULONG( p );
+ return tt_cmap_init( cmap, table );
+ }
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap12_class_rec =
***************
*** 1747,1753 ****
{
sizeof ( TT_CMapRec ),
! (FT_CMap_InitFunc) tt_cmap_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)tt_cmap12_char_index,
(FT_CMap_CharNextFunc) tt_cmap12_char_next
--- 1803,1809 ----
{
sizeof ( TT_CMapRec ),
! (FT_CMap_InitFunc) tt_cmap12_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)tt_cmap12_char_index,
(FT_CMap_CharNextFunc) tt_cmap12_char_next
diff -c -r --exclude=config.log --exclude=cscope.files --exclude=cscope.out
--exclude=CVS --exclude=.cvsignore --exclude=stamp-vti --exclude=version.texi
--exclude='.#*' --exclude='*~' --exclude='*.orig' --exclude='automake.info*'
--exclude=aclocal --exclude=autom4te.cache --exclude=automake
--exclude=config.status --exclude=Makefile --exclude=samples
--exclude=amversion.m4 --exclude=automake-1.5e --new-file
freetype2/src/sfnt/ttcmap0.h freetype2.new/src/sfnt/ttcmap0.h
*** freetype2/src/sfnt/ttcmap0.h 2002-08-28 05:20:27.000000000 +0900
--- freetype2.new/src/sfnt/ttcmap0.h 2003-12-16 19:59:55.000000000 +0900
***************
*** 31,36 ****
--- 31,37 ----
{
FT_CMapRec cmap;
FT_Byte* data; /* pointer to in-memory cmap table */
+ FT_ULong language; /* Used in Mac platform */
} TT_CMapRec, *TT_CMap;
- Re: [Devel] Mac language ID, (continued)
RE: [Devel] Mac language ID, Turner David, 2003/12/16
RE: [Devel] Mac language ID, Turner David, 2003/12/16
RE: [Devel] Mac language ID, Turner David, 2003/12/16
- Re: [Devel] Mac language ID,
Masatake YAMATO <=