Add framework for CFF properties. * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC7): New macro. * src/cff/cffdrivr.c: Include FT_SERVICE_PROPERTIES_H. (cff_property_set, cff_property_get): New function, still empty. Define `cff_service_properties' service. Update `cff_services'. * src/cff/cffpic.h: Include FT_SERVICE_PROPERTIES_H. (CFF_SERVICE_PROPERTIES_GET): New macro. CffModulePIC: Add `cff_service_properties'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
diff --git a/ChangeLog b/ChangeLog
index e09a22f..fafca23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2013-04-12 Werner Lemberg <wl@gnu.org>
+
+ Add framework for CFF properties.
+
+ * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC7):
+ New macro.
+
+ * src/cff/cffdrivr.c: Include FT_SERVICE_PROPERTIES_H.
+ (cff_property_set, cff_property_get): New function, still empty.
+ Define `cff_service_properties' service.
+ Update `cff_services'.
+
+ * src/cff/cffpic.h: Include FT_SERVICE_PROPERTIES_H.
+ (CFF_SERVICE_PROPERTIES_GET): New macro.
+ CffModulePIC: Add `cff_service_properties'.
+
2013-04-03 Werner Lemberg <wl@gnu.org>
Fix Savannah bug #38589.
diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h
index 1d4ded5..5ee1ce1 100644
--- a/include/freetype/internal/ftserv.h
+++ b/include/freetype/internal/ftserv.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType services (specification only). */
/* */
-/* Copyright 2003-2007, 2009, 2012 by */
+/* Copyright 2003-2007, 2009, 2012, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -174,6 +174,7 @@ FT_BEGIN_HEADER
/* FT_DEFINE_SERVICEDESCREC4 */
/* FT_DEFINE_SERVICEDESCREC5 */
/* FT_DEFINE_SERVICEDESCREC6 */
+ /* FT_DEFINE_SERVICEDESCREC7 */
/* */
/* <Description> */
/* Used to initialize an array of FT_ServiceDescRec structures. */
@@ -270,6 +271,26 @@ FT_BEGIN_HEADER
{ NULL, NULL } \
};
+#define FT_DEFINE_SERVICEDESCREC7( class_, \
+ serv_id_1, serv_data_1, \
+ serv_id_2, serv_data_2, \
+ serv_id_3, serv_data_3, \
+ serv_id_4, serv_data_4, \
+ serv_id_5, serv_data_5, \
+ serv_id_6, serv_data_6, \
+ serv_id_7, serv_data_7 ) \
+ static const FT_ServiceDescRec class_[] = \
+ { \
+ { serv_id_1, serv_data_1 }, \
+ { serv_id_2, serv_data_2 }, \
+ { serv_id_3, serv_data_3 }, \
+ { serv_id_4, serv_data_4 }, \
+ { serv_id_5, serv_data_5 }, \
+ { serv_id_6, serv_data_6 }, \
+ { serv_id_7, serv_data_7 }, \
+ { NULL, NULL } \
+ };
+
#else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICEDESCREC1( class_, \
@@ -527,6 +548,59 @@ FT_BEGIN_HEADER
return FT_Err_Ok; \
}
+#define FT_DEFINE_SERVICEDESCREC7( class_, \
+ serv_id_1, serv_data_1, \
+ serv_id_2, serv_data_2, \
+ serv_id_3, serv_data_3, \
+ serv_id_4, serv_data_4, \
+ serv_id_5, serv_data_5, \
+ serv_id_6, serv_data_6, \
+ serv_id_7, serv_data_7 ) \
+ void \
+ FT_Destroy_Class_ ## class_( FT_Library library, \
+ FT_ServiceDescRec* clazz ) \
+ { \
+ FT_Memory memory = library->memory; \
+ \
+ \
+ if ( clazz ) \
+ FT_FREE( clazz ); \
+ } \
+ \
+ FT_Error \
+ FT_Create_Class_ ## class_( FT_Library library, \
+ FT_ServiceDescRec** output_class) \
+ { \
+ FT_ServiceDescRec* clazz = NULL; \
+ FT_Error error; \
+ FT_Memory memory = library->memory; \
+ \
+ \
+ if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 8 ) ) \
+ return error; \
+ \
+ clazz[0].serv_id = serv_id_1; \
+ clazz[0].serv_data = serv_data_1; \
+ clazz[1].serv_id = serv_id_2; \
+ clazz[1].serv_data = serv_data_2; \
+ clazz[2].serv_id = serv_id_3; \
+ clazz[2].serv_data = serv_data_3; \
+ clazz[3].serv_id = serv_id_4; \
+ clazz[3].serv_data = serv_data_4; \
+ clazz[4].serv_id = serv_id_5; \
+ clazz[4].serv_data = serv_data_5; \
+ clazz[5].serv_id = serv_id_6; \
+ clazz[5].serv_data = serv_data_6; \
+ clazz[6].serv_id = serv_id_7; \
+ clazz[6].serv_data = serv_data_7; \
+ clazz[7].serv_id = NULL; \
+ clazz[7].serv_data = NULL; \
+ \
+ *output_class = clazz; \
+ \
+ return FT_Err_Ok; \
+ }
+
#endif /* FT_CONFIG_OPTION_PIC */
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index da20dc4..ce41ee0 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -37,6 +37,7 @@
#include FT_SERVICE_XFREE86_NAME_H
#include FT_SERVICE_GLYPH_DICT_H
+#include FT_SERVICE_PROPERTIES_H
/*************************************************************************/
@@ -298,7 +299,8 @@
}
- FT_DEFINE_SERVICE_GLYPHDICTREC(cff_service_glyph_dict,
+ FT_DEFINE_SERVICE_GLYPHDICTREC(
+ cff_service_glyph_dict,
(FT_GlyphDict_GetNameFunc) cff_get_glyph_name,
(FT_GlyphDict_NameIndexFunc)cff_get_name_index
)
@@ -360,7 +362,8 @@
}
- FT_DEFINE_SERVICE_PSINFOREC(cff_service_ps_info,
+ FT_DEFINE_SERVICE_PSINFOREC(
+ cff_service_ps_info,
(PS_GetFontInfoFunc) cff_ps_get_font_info,
(PS_GetFontExtraFunc) NULL,
(PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
@@ -384,7 +387,8 @@
}
- FT_DEFINE_SERVICE_PSFONTNAMEREC(cff_service_ps_name,
+ FT_DEFINE_SERVICE_PSFONTNAMEREC(
+ cff_service_ps_name,
(FT_PsName_GetFunc)cff_get_ps_name
)
@@ -430,7 +434,8 @@
}
- FT_DEFINE_SERVICE_TTCMAPSREC(cff_service_get_cmap_info,
+ FT_DEFINE_SERVICE_TTCMAPSREC(
+ cff_service_get_cmap_info,
(TT_CMap_Info_GetFunc)cff_get_cmap_info
)
@@ -559,13 +564,42 @@
}
- FT_DEFINE_SERVICE_CIDREC(cff_service_cid_info,
+ FT_DEFINE_SERVICE_CIDREC(
+ cff_service_cid_info,
(FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros,
(FT_CID_GetIsInternallyCIDKeyedFunc) cff_get_is_cid,
(FT_CID_GetCIDFromGlyphIndexFunc) cff_get_cid_from_glyph_index
)
+ /*
+ * PROPERTY SERVICE
+ *
+ */
+ static FT_Error
+ cff_property_set( FT_Module ft_module,
+ const char* property_name,
+ const void* value )
+ {
+ return FT_Err_Ok;
+ }
+
+
+ static FT_Error
+ cff_property_get( FT_Module ft_module,
+ const char* property_name,
+ const void* value )
+ {
+ return FT_Err_Ok;
+ }
+
+
+ FT_DEFINE_SERVICE_PROPERTIESREC(
+ cff_service_properties,
+ (FT_Properties_SetFunc)cff_property_set,
+ (FT_Properties_GetFunc)cff_property_get )
+
+
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@@ -577,25 +611,31 @@
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
+
#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
- FT_DEFINE_SERVICEDESCREC6(cff_services,
+ FT_DEFINE_SERVICEDESCREC7(
+ cff_services,
FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF,
FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET,
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
- FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET
+ FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
+ FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
)
#else
- FT_DEFINE_SERVICEDESCREC5(cff_services,
+ FT_DEFINE_SERVICEDESCREC6(
+ cff_services,
FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF,
FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
- FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET
+ FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
+ FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
)
#endif
+
FT_CALLBACK_DEF( FT_Module_Interface )
cff_get_interface( FT_Module driver, /* CFF_Driver */
const char* module_interface )
@@ -642,7 +682,8 @@
#define CFF_SIZE_SELECT 0
#endif
- FT_DEFINE_DRIVER( cff_driver_class,
+ FT_DEFINE_DRIVER(
+ cff_driver_class,
FT_MODULE_FONT_DRIVER |
FT_MODULE_DRIVER_SCALABLE |
diff --git a/src/cff/cffpic.h b/src/cff/cffpic.h
index cfb27c7..50bab4c 100644
--- a/src/cff/cffpic.h
+++ b/src/cff/cffpic.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for cff module. */
/* */
-/* Copyright 2009, 2012 by */
+/* Copyright 2009, 2012, 2013 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -32,6 +32,7 @@ FT_BEGIN_HEADER
#define CFF_SERVICE_PS_NAME_GET cff_service_ps_name
#define CFF_SERVICE_GET_CMAP_INFO_GET cff_service_get_cmap_info
#define CFF_SERVICE_CID_INFO_GET cff_service_cid_info
+#define CFF_SERVICE_PROPERTIES_GET cff_service_properties
#define CFF_SERVICES_GET cff_services
#define CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec
#define CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec
@@ -45,6 +46,7 @@ FT_BEGIN_HEADER
#include FT_SERVICE_POSTSCRIPT_NAME_H
#include FT_SERVICE_TT_CMAP_H
#include FT_SERVICE_CID_H
+#include FT_SERVICE_PROPERTIES_H
typedef struct CffModulePIC_
@@ -56,6 +58,7 @@ FT_BEGIN_HEADER
FT_Service_PsFontNameRec cff_service_ps_name;
FT_Service_TTCMapsRec cff_service_get_cmap_info;
FT_Service_CIDRec cff_service_cid_info;
+ FT_Service_PropertiesRec cff_service_properties;
FT_CMap_ClassRec cff_cmap_encoding_class_rec;
FT_CMap_ClassRec cff_cmap_unicode_class_rec;
@@ -75,6 +78,8 @@ FT_BEGIN_HEADER
( GET_PIC( library )->cff_service_get_cmap_info )
#define CFF_SERVICE_CID_INFO_GET \
( GET_PIC( library )->cff_service_cid_info )
+#define CFF_SERVICE_PROPERTIES_GET \
+ ( GET_PIC( library )->cff_service_properties )
#define CFF_SERVICES_GET \
( GET_PIC( library )->cff_services )
#define CFF_CMAP_ENCODING_CLASS_REC_GET \