< prev index next >

src/java.desktop/share/native/libfontmanager/harfbuzz/hb-unicode.cc

Print this page




 171   if (!parent)
 172     parent = hb_unicode_funcs_get_empty ();
 173 
 174   hb_unicode_funcs_make_immutable (parent);
 175   ufuncs->parent = hb_unicode_funcs_reference (parent);
 176 
 177   ufuncs->func = parent->func;
 178 
 179   /* We can safely copy user_data from parent since we hold a reference
 180    * onto it and it's immutable.  We should not copy the destroy notifiers
 181    * though. */
 182   ufuncs->user_data = parent->user_data;
 183 
 184   return ufuncs;
 185 }
 186 
 187 
 188 const hb_unicode_funcs_t _hb_unicode_funcs_nil = {
 189   HB_OBJECT_HEADER_STATIC,
 190 
 191   NULL, /* parent */
 192   true, /* immutable */
 193   {
 194 #define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_nil,
 195     HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
 196 #undef HB_UNICODE_FUNC_IMPLEMENT
 197   }
 198 };
 199 
 200 /**
 201  * hb_unicode_funcs_get_empty:
 202  *
 203  * 
 204  *
 205  * Return value: (transfer full):
 206  *
 207  * Since: 0.9.2
 208  **/
 209 hb_unicode_funcs_t *
 210 hb_unicode_funcs_get_empty (void)
 211 {


 348                                                                                 \
 349 void                                                                            \
 350 hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t             *ufuncs,     \
 351                                     hb_unicode_##name##_func_t      func,       \
 352                                     void                           *user_data,  \
 353                                     hb_destroy_func_t               destroy)    \
 354 {                                                                               \
 355   if (ufuncs->immutable)                                                        \
 356     return;                                                                     \
 357                                                                                 \
 358   if (ufuncs->destroy.name)                                                     \
 359     ufuncs->destroy.name (ufuncs->user_data.name);                              \
 360                                                                                 \
 361   if (func) {                                                                   \
 362     ufuncs->func.name = func;                                                   \
 363     ufuncs->user_data.name = user_data;                                         \
 364     ufuncs->destroy.name = destroy;                                             \
 365   } else {                                                                      \
 366     ufuncs->func.name = ufuncs->parent->func.name;                              \
 367     ufuncs->user_data.name = ufuncs->parent->user_data.name;                    \
 368     ufuncs->destroy.name = NULL;                                                \
 369   }                                                                             \
 370 }
 371 
 372 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
 373 #undef HB_UNICODE_FUNC_IMPLEMENT
 374 
 375 
 376 #define HB_UNICODE_FUNC_IMPLEMENT(return_type, name)                            \
 377                                                                                 \
 378 return_type                                                                     \
 379 hb_unicode_##name (hb_unicode_funcs_t *ufuncs,                                  \
 380                    hb_codepoint_t      unicode)                                 \
 381 {                                                                               \
 382   return ufuncs->name (unicode);                                                \
 383 }
 384 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
 385 #undef HB_UNICODE_FUNC_IMPLEMENT
 386 
 387 /**
 388  * hb_unicode_compose:




 171   if (!parent)
 172     parent = hb_unicode_funcs_get_empty ();
 173 
 174   hb_unicode_funcs_make_immutable (parent);
 175   ufuncs->parent = hb_unicode_funcs_reference (parent);
 176 
 177   ufuncs->func = parent->func;
 178 
 179   /* We can safely copy user_data from parent since we hold a reference
 180    * onto it and it's immutable.  We should not copy the destroy notifiers
 181    * though. */
 182   ufuncs->user_data = parent->user_data;
 183 
 184   return ufuncs;
 185 }
 186 
 187 
 188 const hb_unicode_funcs_t _hb_unicode_funcs_nil = {
 189   HB_OBJECT_HEADER_STATIC,
 190 
 191   nullptr, /* parent */
 192   true, /* immutable */
 193   {
 194 #define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_nil,
 195     HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
 196 #undef HB_UNICODE_FUNC_IMPLEMENT
 197   }
 198 };
 199 
 200 /**
 201  * hb_unicode_funcs_get_empty:
 202  *
 203  *
 204  *
 205  * Return value: (transfer full):
 206  *
 207  * Since: 0.9.2
 208  **/
 209 hb_unicode_funcs_t *
 210 hb_unicode_funcs_get_empty (void)
 211 {


 348                                                                                 \
 349 void                                                                            \
 350 hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t             *ufuncs,     \
 351                                     hb_unicode_##name##_func_t      func,       \
 352                                     void                           *user_data,  \
 353                                     hb_destroy_func_t               destroy)    \
 354 {                                                                               \
 355   if (ufuncs->immutable)                                                        \
 356     return;                                                                     \
 357                                                                                 \
 358   if (ufuncs->destroy.name)                                                     \
 359     ufuncs->destroy.name (ufuncs->user_data.name);                              \
 360                                                                                 \
 361   if (func) {                                                                   \
 362     ufuncs->func.name = func;                                                   \
 363     ufuncs->user_data.name = user_data;                                         \
 364     ufuncs->destroy.name = destroy;                                             \
 365   } else {                                                                      \
 366     ufuncs->func.name = ufuncs->parent->func.name;                              \
 367     ufuncs->user_data.name = ufuncs->parent->user_data.name;                    \
 368     ufuncs->destroy.name = nullptr;                                             \
 369   }                                                                             \
 370 }
 371 
 372 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
 373 #undef HB_UNICODE_FUNC_IMPLEMENT
 374 
 375 
 376 #define HB_UNICODE_FUNC_IMPLEMENT(return_type, name)                            \
 377                                                                                 \
 378 return_type                                                                     \
 379 hb_unicode_##name (hb_unicode_funcs_t *ufuncs,                                  \
 380                    hb_codepoint_t      unicode)                                 \
 381 {                                                                               \
 382   return ufuncs->name (unicode);                                                \
 383 }
 384 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
 385 #undef HB_UNICODE_FUNC_IMPLEMENT
 386 
 387 /**
 388  * hb_unicode_compose:


< prev index next >