[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: |
Wed, 17 Dec 2003 18:02:12 +0900 (JST) |
> I've added language field to the private data structure.
>
> typedef struct TT_CMapRec_
> {
> FT_CMapRec cmap;
> FT_Byte* data; /* pointer to in-memory cmap table */
> FT_ULong language; /* Used in Mac platform */
>
> } TT_CMapRec, *TT_CMap;
>
> We can do the same thing with language field(`data' field holds the language
> data).
^^^^
=> without
> I should provide a function which extracts language field from data instead of
> providing language field which is set by TT_CMap initialize phase. Give me
> comments.
After thinking twice, I should not provide language field. Instead I should add
a function to retrieve language id from `data' to TT_CMapClass:
typedef struct TT_CMap_ClassRec_
{
FT_CMap_ClassRec clazz;
FT_UInt format;
TT_CMap_ValidateFunc validate;
TT_CMap_Info_GetFunc get_cmap_info;
} TT_CMap_ClassRec;
2003-12-17 Masatake YAMATO <address@hidden>
* src/sfnt/sfdriver.c: include ttcmap0.h.
(sfnt_services::tt_service_get_cap_info): New service
implementation.
* src/sfnt/ttcmap0.c (tt_cmap*_get_info): New functions.
(tt_cmap*_class_rec): tt_cmap*_get_info is installed.
(tt_get_cmap_info): New function implementation.
* src/sfnt/ttcmap0.h (TT_CMap_ClassRec_::get_cmap_info): New
field.
(tt_get_cmap_info): New declaration.
* src/base/ftobjs.c (FT_Get_CMap_Language_ID): Nwe function
implementation. include FT_SERVICE_TT_CMAP_H.
* include/freetype/tttables.h (FT_Get_CMap_Language_ID):
New function declaration.
* include/freetype/internal/services/svttcmap.h: New file.
* include/freetype/internal/ftserv.h (FT_SERVICE_TT_CMAP_H): added
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/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-17 17:35:30.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 ****
(FT_PsName_GetFunc)sfnt_get_ps_name
};
!
/*
* SERVICE LIST
--- 261,274 ----
(FT_PsName_GetFunc)sfnt_get_ps_name
};
! /*
! * TT CMAP INFO
! *
! */
! 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 }
};
--- 282,288 ----
#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-17 17:36:36.000000000 +0900
***************
*** 143,148 ****
--- 143,155 ----
return gindex;
}
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap0_get_info (TT_CMap cmap, TT_CMapInfo *cmap_info )
+ {
+ FT_Byte* p = cmap->data + 4;
+ cmap_info->language = (FT_ULong)TT_PEEK_USHORT(p);
+ return FT_Err_Ok;
+ }
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap0_class_rec =
***************
*** 156,162 ****
(FT_CMap_CharNextFunc) tt_cmap0_char_next
},
0,
! (TT_CMap_ValidateFunc) tt_cmap0_validate
};
#endif /* TT_CONFIG_CMAP_FORMAT_0 */
--- 163,170 ----
(FT_CMap_CharNextFunc) tt_cmap0_char_next
},
0,
! (TT_CMap_ValidateFunc) tt_cmap0_validate,
! (TT_CMap_Info_GetFunc) tt_cmap0_get_info
};
#endif /* TT_CONFIG_CMAP_FORMAT_0 */
***************
*** 496,501 ****
--- 504,516 ----
return gindex;
}
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap2_get_info (TT_CMap cmap, TT_CMapInfo *cmap_info )
+ {
+ FT_Byte* p = cmap->data + 4;
+ cmap_info->language = (FT_ULong)TT_PEEK_USHORT(p);
+ return FT_Err_Ok;
+ }
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap2_class_rec =
***************
*** 509,515 ****
(FT_CMap_CharNextFunc) tt_cmap2_char_next
},
2,
! (TT_CMap_ValidateFunc) tt_cmap2_validate
};
#endif /* TT_CONFIG_CMAP_FORMAT_2 */
--- 524,531 ----
(FT_CMap_CharNextFunc) tt_cmap2_char_next
},
2,
! (TT_CMap_ValidateFunc) tt_cmap2_validate,
! (TT_CMap_Info_GetFunc) tt_cmap2_get_info
};
#endif /* TT_CONFIG_CMAP_FORMAT_2 */
***************
*** 1057,1062 ****
--- 1073,1085 ----
return gindex;
}
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap4_get_info (TT_CMap cmap, TT_CMapInfo *cmap_info )
+ {
+ FT_Byte* p = cmap->data + 4;
+ cmap_info->language = (FT_ULong)TT_PEEK_USHORT(p);
+ return FT_Err_Ok;
+ }
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap4_class_rec =
***************
*** 1070,1076 ****
(FT_CMap_CharNextFunc) tt_cmap4_char_next
},
4,
! (TT_CMap_ValidateFunc) tt_cmap4_validate
};
#endif /* TT_CONFIG_CMAP_FORMAT_4 */
--- 1093,1100 ----
(FT_CMap_CharNextFunc) tt_cmap4_char_next
},
4,
! (TT_CMap_ValidateFunc) tt_cmap4_validate,
! (TT_CMap_Info_GetFunc) tt_cmap4_get_info
};
#endif /* TT_CONFIG_CMAP_FORMAT_4 */
***************
*** 1201,1206 ****
--- 1225,1237 ----
return gindex;
}
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap6_get_info (TT_CMap cmap, TT_CMapInfo *cmap_info )
+ {
+ FT_Byte* p = cmap->data + 4;
+ cmap_info->language = (FT_ULong)TT_PEEK_USHORT(p);
+ return FT_Err_Ok;
+ }
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap6_class_rec =
***************
*** 1214,1220 ****
(FT_CMap_CharNextFunc) tt_cmap6_char_next
},
6,
! (TT_CMap_ValidateFunc) tt_cmap6_validate
};
#endif /* TT_CONFIG_CMAP_FORMAT_6 */
--- 1245,1252 ----
(FT_CMap_CharNextFunc) tt_cmap6_char_next
},
6,
! (TT_CMap_ValidateFunc) tt_cmap6_validate,
! (TT_CMap_Info_GetFunc) tt_cmap6_get_info
};
#endif /* TT_CONFIG_CMAP_FORMAT_6 */
***************
*** 1438,1443 ****
--- 1470,1482 ----
return gindex;
}
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap8_get_info (TT_CMap cmap, TT_CMapInfo *cmap_info )
+ {
+ FT_Byte* p = cmap->data + 8;
+ cmap_info->language = (FT_ULong)TT_PEEK_ULONG(p);
+ return FT_Err_Ok;
+ }
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap8_class_rec =
***************
*** 1451,1457 ****
(FT_CMap_CharNextFunc) tt_cmap8_char_next
},
8,
! (TT_CMap_ValidateFunc) tt_cmap8_validate
};
#endif /* TT_CONFIG_CMAP_FORMAT_8 */
--- 1490,1497 ----
(FT_CMap_CharNextFunc) tt_cmap8_char_next
},
8,
! (TT_CMap_ValidateFunc) tt_cmap8_validate,
! (TT_CMap_Info_GetFunc) tt_cmap8_get_info
};
#endif /* TT_CONFIG_CMAP_FORMAT_8 */
***************
*** 1571,1576 ****
--- 1611,1624 ----
}
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap10_get_info (TT_CMap cmap, TT_CMapInfo *cmap_info )
+ {
+ FT_Byte* p = cmap->data + 8;
+ cmap_info->language = (FT_ULong)TT_PEEK_ULONG(p);
+ return FT_Err_Ok;
+ }
+
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap10_class_rec =
{
***************
*** 1583,1589 ****
(FT_CMap_CharNextFunc) tt_cmap10_char_next
},
10,
! (TT_CMap_ValidateFunc) tt_cmap10_validate
};
#endif /* TT_CONFIG_CMAP_FORMAT_10 */
--- 1631,1638 ----
(FT_CMap_CharNextFunc) tt_cmap10_char_next
},
10,
! (TT_CMap_ValidateFunc) tt_cmap10_validate,
! (TT_CMap_Info_GetFunc) tt_cmap10_get_info
};
#endif /* TT_CONFIG_CMAP_FORMAT_10 */
***************
*** 1740,1745 ****
--- 1789,1801 ----
return gindex;
}
+ FT_CALLBACK_DEF( FT_Error )
+ tt_cmap12_get_info (TT_CMap cmap, TT_CMapInfo *cmap_info )
+ {
+ FT_Byte* p = cmap->data + 8;
+ cmap_info->language = (FT_ULong)TT_PEEK_ULONG(p);
+ return FT_Err_Ok;
+ }
FT_CALLBACK_TABLE_DEF
const TT_CMap_ClassRec tt_cmap12_class_rec =
***************
*** 1753,1759 ****
(FT_CMap_CharNextFunc) tt_cmap12_char_next
},
12,
! (TT_CMap_ValidateFunc) tt_cmap12_validate
};
--- 1809,1816 ----
(FT_CMap_CharNextFunc) tt_cmap12_char_next
},
12,
! (TT_CMap_ValidateFunc) tt_cmap12_validate,
! (TT_CMap_Info_GetFunc) tt_cmap12_get_info
};
***************
*** 1874,1878 ****
--- 1931,1943 ----
return 0;
}
+ FT_LOCAL( FT_Error )
+ tt_get_cmap_info( FT_CharMap charmap, TT_CMapInfo *cmap_info )
+ {
+ FT_CMap cmap = (FT_CMap)charmap;
+ TT_CMap_Class clazz = (TT_CMap_Class)cmap->clazz;
+ return clazz->get_cmap_info ( charmap, cmap_info );
+ }
+
/* 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/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-17 17:39:46.000000000 +0900
***************
*** 23,29 ****
#include <ft2build.h>
#include FT_INTERNAL_TRUETYPE_TYPES_H
#include FT_INTERNAL_OBJECTS_H
!
FT_BEGIN_HEADER
--- 23,29 ----
#include <ft2build.h>
#include FT_INTERNAL_TRUETYPE_TYPES_H
#include FT_INTERNAL_OBJECTS_H
! #include FT_SERVICE_TT_CMAP_H
FT_BEGIN_HEADER
***************
*** 46,52 ****
FT_CMap_ClassRec clazz;
FT_UInt format;
TT_CMap_ValidateFunc validate;
!
} TT_CMap_ClassRec;
--- 46,52 ----
FT_CMap_ClassRec clazz;
FT_UInt format;
TT_CMap_ValidateFunc validate;
! TT_CMap_Info_GetFunc get_cmap_info;
} TT_CMap_ClassRec;
***************
*** 65,70 ****
--- 65,74 ----
FT_LOCAL( FT_Error )
tt_face_build_cmaps( TT_Face face );
+ /* used in TTCMaps service */
+ FT_LOCAL( FT_Error )
+ tt_get_cmap_info( FT_CharMap charmap, TT_CMapInfo *cmap_info );
+
FT_END_HEADER
RE: [Devel] Mac language ID, Turner David, 2003/12/16
RE: [Devel] Mac language ID, Turner David, 2003/12/16