From: Behdad Esfahbod Date: Thu, 21 Jul 2011 16:23:12 +0000 (-0400) Subject: Add prefer_decomposed() complex-shaper callback X-Git-Tag: 2.0_alpha~7^2~50 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=02cdf743c2ec345a44d4fcf865594b6ac13fccd0;p=apps%2Fcore%2Fpreloaded%2Fvideo-player.git Add prefer_decomposed() complex-shaper callback This allows the Indic shaper to request decomposed characters. This will handle split matra for free. Other shapers prefer precomposed characters. --- diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 53e7a9b..dc63db2 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -183,6 +183,12 @@ _hb_ot_shape_complex_collect_features_arabic (hb_ot_map_builder_t *map, const hb map->add_bool_feature (HB_TAG('c','s','w','h')); } +bool +_hb_ot_shape_complex_prefer_decomposed_arabic (void) +{ + return FALSE; +} + void _hb_ot_shape_complex_setup_masks_arabic (hb_ot_map_t *map, hb_buffer_t *buffer) { diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 03ea10f..cf5a049 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -309,6 +309,13 @@ _hb_ot_shape_complex_collect_features_indic (hb_ot_map_builder_t *map, const hb_ } +bool +_hb_ot_shape_complex_prefer_decomposed_indic (void) +{ + /* We want split matras decomposed by the common shaping logic. */ + return TRUE; +} + static void found_syllable (hb_ot_map_t *map, hb_buffer_t *buffer, unsigned int start, unsigned int end) diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc index 92dee49..b2de3ff 100644 --- a/src/hb-ot-shape-complex-misc.cc +++ b/src/hb-ot-shape-complex-misc.cc @@ -42,6 +42,12 @@ _hb_ot_shape_complex_collect_features_default (hb_ot_map_builder_t *map, const h { } +bool +_hb_ot_shape_complex_prefer_decomposed_default (void) +{ + return FALSE; +} + void _hb_ot_shape_complex_setup_masks_default (hb_ot_map_t *map, hb_buffer_t *buffer) { diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex-private.hh index c10fdf9..4bfd855 100644 --- a/src/hb-ot-shape-complex-private.hh +++ b/src/hb-ot-shape-complex-private.hh @@ -140,7 +140,34 @@ hb_ot_shape_complex_collect_features (hb_ot_complex_shaper_t shaper, switch (shaper) { default: #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \ - case hb_ot_complex_shaper_##name: _hb_ot_shape_complex_collect_features_##name (map, props); return; + case hb_ot_complex_shaper_##name: _hb_ot_shape_complex_collect_features_##name (map, props); return; + HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS +#undef HB_COMPLEX_SHAPER_IMPLEMENT + } +} + + +/* + * prefer_decomposed() + * + * Called during shape_execute(). + * + * Shapers should return TRUE if it prefers decomposed (NFD) input rather than precomposed (NFC). + */ + +typedef bool hb_ot_shape_complex_prefer_decomposed_func_t (void); +#define HB_COMPLEX_SHAPER_IMPLEMENT(name) \ + HB_INTERNAL hb_ot_shape_complex_prefer_decomposed_func_t _hb_ot_shape_complex_prefer_decomposed_##name; + HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS +#undef HB_COMPLEX_SHAPER_IMPLEMENT + +static inline bool +hb_ot_shape_complex_prefer_decomposed (hb_ot_complex_shaper_t shaper) +{ + switch (shaper) { + default: +#define HB_COMPLEX_SHAPER_IMPLEMENT(name) \ + case hb_ot_complex_shaper_##name: return _hb_ot_shape_complex_prefer_decomposed_##name (); HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS #undef HB_COMPLEX_SHAPER_IMPLEMENT } @@ -168,7 +195,7 @@ hb_ot_shape_complex_setup_masks (hb_ot_complex_shaper_t shaper, switch (shaper) { default: #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \ - case hb_ot_complex_shaper_##name: _hb_ot_shape_complex_setup_masks_##name (map, buffer); return; + case hb_ot_complex_shaper_##name: _hb_ot_shape_complex_setup_masks_##name (map, buffer); return; HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS #undef HB_COMPLEX_SHAPER_IMPLEMENT }