LCOV - app.info - gfx/harfbuzz/src/hb-ot-shape-complex-private.hh

LCOV - code coverage report
| Current view: | directory - gfx/harfbuzz/src - hb-ot-shape-complex-private.hh (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 14 | 0 | 0.0 %
| Date: | 2012-06-02 | Functions: | 4 | 0 | 0.0 %

           1                 : /*
           2                 :  * Copyright © 2010,2011  Google, Inc.
           3                 :  *
           4                 :  *  This is part of HarfBuzz, a text shaping library.
           5                 :  *
           6                 :  * Permission is hereby granted, without written agreement and without
           7                 :  * license or royalty fees, to use, copy, modify, and distribute this
           8                 :  * software and its documentation for any purpose, provided that the
           9                 :  * above copyright notice and the following two paragraphs appear in
          10                 :  * all copies of this software.
          11                 :  *
          12                 :  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
          13                 :  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
          14                 :  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
          15                 :  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
          16                 :  * DAMAGE.
          17                 :  *
          18                 :  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
          19                 :  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
          20                 :  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
          21                 :  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
          22                 :  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
          23                 :  *
          24                 :  * Google Author(s): Behdad Esfahbod
          25                 :  */
          26                 :
          27                 : #ifndef HB_OT_SHAPE_COMPLEX_PRIVATE_HH
          28                 : #define HB_OT_SHAPE_COMPLEX_PRIVATE_HH
          29                 :
          30                 : #include "hb-private.hh"
          31                 :
          32                 : #include "hb-ot-map-private.hh"
          33                 :
          34                 :
          35                 :
          36                 : /* buffer var allocations, used during the entire shaping process */
          37                 : #define general_category() var1.u8[0] /* unicode general_category (hb_unicode_general_category_t) */
          38                 : #define combining_class() var1.u8[1] /* unicode combining_class (uint8_t) */
          39                 :
          40                 : /* buffer var allocations, used by complex shapers */
          41                 : #define complex_var_persistent_u8_0()   var2.u8[0]
          42                 : #define complex_var_persistent_u8_1()   var2.u8[1]
          43                 : #define complex_var_persistent_u16()    var2.u16[0]
          44                 : #define complex_var_temporary_u8_0()    var2.u8[2]
          45                 : #define complex_var_temporary_u8_1()    var2.u8[3]
          46                 : #define complex_var_temporary_u16()     var2.u16[1]
          47                 :
          48                 :
          49                 : #define HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS \
          50                 :   HB_COMPLEX_SHAPER_IMPLEMENT (default) /* should be first */ \
          51                 :   HB_COMPLEX_SHAPER_IMPLEMENT (arabic) \
          52                 :   HB_COMPLEX_SHAPER_IMPLEMENT (indic) \
          53                 :   /* ^--- Add new shapers here */
          54                 :
          55                 : enum hb_ot_complex_shaper_t {
          56                 : #define HB_COMPLEX_SHAPER_IMPLEMENT(name) hb_ot_complex_shaper_##name,
          57                 :   HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
          58                 :   /* Just here to avoid enum trailing comma: */
          59                 :   hb_ot_complex_shaper_generic = hb_ot_complex_shaper_default
          60                 : #undef HB_COMPLEX_SHAPER_IMPLEMENT
          61                 : };
          62                 :
          63                 : static inline hb_ot_complex_shaper_t
          64               0 : hb_ot_shape_complex_categorize (const hb_segment_properties_t *props)
          65                 : {
          66               0 :   switch ((int) props->script)
          67                 :   {
          68                 :     default:
          69               0 :       return hb_ot_complex_shaper_default;
          70                 :
          71                 :     case HB_SCRIPT_ARABIC:
          72                 :     case HB_SCRIPT_MANDAIC:
          73                 :     case HB_SCRIPT_MONGOLIAN:
          74                 :     case HB_SCRIPT_NKO:
          75                 :     case HB_SCRIPT_SYRIAC:
          76               0 :       return hb_ot_complex_shaper_arabic;
          77                 :
          78                 : #if 0
          79                 :     /* Note:
          80                 :      *
          81                 :      * These disabled scripts are listed in ucd/IndicSyllabicCategory.txt, but according
          82                 :      * to Martin Hosken do not require complex shaping.
          83                 :      *
          84                 :      * TODO We currently keep data for these scripts in our indic table.  Need to fix the
          85                 :      * generator to not do that.
          86                 :      */
          87                 :
          88                 :     /* Simple? */
          89                 :     case HB_SCRIPT_BATAK:
          90                 :     case HB_SCRIPT_BRAHMI:
          91                 :     case HB_SCRIPT_HANUNOO:
          92                 :     case HB_SCRIPT_MEETEI_MAYEK:
          93                 :     case HB_SCRIPT_SAURASHTRA:
          94                 :
          95                 :     /* Simple */
          96                 :     case HB_SCRIPT_KAYAH_LI:
          97                 :     case HB_SCRIPT_LAO:
          98                 :     case HB_SCRIPT_LIMBU:
          99                 :     case HB_SCRIPT_PHAGS_PA:
         100                 :     case HB_SCRIPT_SYLOTI_NAGRI:
         101                 :     case HB_SCRIPT_TAGALOG:
         102                 :     case HB_SCRIPT_TAGBANWA:
         103                 :     case HB_SCRIPT_TAI_LE:
         104                 :     case HB_SCRIPT_TAI_VIET:
         105                 :     case HB_SCRIPT_THAI:
         106                 :     case HB_SCRIPT_TIBETAN:
         107                 :
         108                 :     /* May need Indic treatment in the future? */
         109                 :     case HB_SCRIPT_MYANMAR:
         110                 : #endif
         111                 :
         112                 :     case HB_SCRIPT_BALINESE:
         113                 :     case HB_SCRIPT_BENGALI:
         114                 :     case HB_SCRIPT_BUGINESE:
         115                 :     case HB_SCRIPT_BUHID:
         116                 :     case HB_SCRIPT_CHAM:
         117                 :     case HB_SCRIPT_DEVANAGARI:
         118                 :     case HB_SCRIPT_GUJARATI:
         119                 :     case HB_SCRIPT_GURMUKHI:
         120                 :     case HB_SCRIPT_JAVANESE:
         121                 :     case HB_SCRIPT_KAITHI:
         122                 :     case HB_SCRIPT_KANNADA:
         123                 :     case HB_SCRIPT_KHAROSHTHI:
         124                 :     case HB_SCRIPT_KHMER:
         125                 :     case HB_SCRIPT_LEPCHA:
         126                 :     case HB_SCRIPT_MALAYALAM:
         127                 :     case HB_SCRIPT_NEW_TAI_LUE:
         128                 :     case HB_SCRIPT_ORIYA:
         129                 :     case HB_SCRIPT_REJANG:
         130                 :     case HB_SCRIPT_SINHALA:
         131                 :     case HB_SCRIPT_SUNDANESE:
         132                 :     case HB_SCRIPT_TAI_THAM:
         133                 :     case HB_SCRIPT_TAMIL:
         134                 :     case HB_SCRIPT_TELUGU:
         135               0 :       return hb_ot_complex_shaper_indic;
         136                 :
         137                 :     /* ^--- Add new shapers here */
         138                 :   }
         139                 : }
         140                 :
         141                 :
         142                 :
         143                 : /*
         144                 :  * collect_features()
         145                 :  *
         146                 :  * Called during shape_plan().
         147                 :  *
         148                 :  * Shapers should use map to add their features and callbacks.
         149                 :  */
         150                 :
         151                 : typedef void hb_ot_shape_complex_collect_features_func_t (hb_ot_map_builder_t *map, const hb_segment_properties_t  *props);
         152                 : #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
         153                 :   HB_INTERNAL hb_ot_shape_complex_collect_features_func_t _hb_ot_shape_complex_collect_features_##name;
         154                 :   HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
         155                 : #undef HB_COMPLEX_SHAPER_IMPLEMENT
         156                 :
         157                 : static inline void
         158               0 : hb_ot_shape_complex_collect_features (hb_ot_complex_shaper_t shaper,
         159                 :                                       hb_ot_map_builder_t *map,
         160                 :                                       const hb_segment_properties_t  *props)
         161                 : {
         162               0 :   switch (shaper) {
         163                 :     default:
         164                 : #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
         165                 :     case hb_ot_complex_shaper_##name:   _hb_ot_shape_complex_collect_features_##name (map, props); return;
         166               0 :     HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
         167                 : #undef HB_COMPLEX_SHAPER_IMPLEMENT
         168                 :   }
         169                 : }
         170                 :
         171                 :
         172                 : /*
         173                 :  * prefer_decomposed()
         174                 :  *
         175                 :  * Called during shape_execute().
         176                 :  *
         177                 :  * Shapers should return TRUE if it prefers decomposed (NFD) input rather than precomposed (NFC).
         178                 :  */
         179                 :
         180                 : typedef bool hb_ot_shape_complex_prefer_decomposed_func_t (void);
         181                 : #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
         182                 :   HB_INTERNAL hb_ot_shape_complex_prefer_decomposed_func_t _hb_ot_shape_complex_prefer_decomposed_##name;
         183                 :   HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
         184                 : #undef HB_COMPLEX_SHAPER_IMPLEMENT
         185                 :
         186                 : static inline bool
         187               0 : hb_ot_shape_complex_prefer_decomposed (hb_ot_complex_shaper_t shaper)
         188                 : {
         189               0 :   switch (shaper) {
         190                 :     default:
         191                 : #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
         192                 :     case hb_ot_complex_shaper_##name:   return _hb_ot_shape_complex_prefer_decomposed_##name ();
         193               0 :     HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
         194                 : #undef HB_COMPLEX_SHAPER_IMPLEMENT
         195                 :   }
         196                 : }
         197                 :
         198                 :
         199                 : /* setup_masks()
         200                 :  *
         201                 :  * Called during shape_execute().
         202                 :  *
         203                 :  * Shapers should use map to get feature masks and set on buffer.
         204                 :  */
         205                 :
         206                 : typedef void hb_ot_shape_complex_setup_masks_func_t (hb_ot_map_t *map, hb_buffer_t *buffer);
         207                 : #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
         208                 :   HB_INTERNAL hb_ot_shape_complex_setup_masks_func_t _hb_ot_shape_complex_setup_masks_##name;
         209                 :   HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
         210                 : #undef HB_COMPLEX_SHAPER_IMPLEMENT
         211                 :
         212                 : static inline void
         213               0 : hb_ot_shape_complex_setup_masks (hb_ot_complex_shaper_t shaper,
         214                 :                                  hb_ot_map_t *map,
         215                 :                                  hb_buffer_t *buffer)
         216                 : {
         217               0 :   switch (shaper) {
         218                 :     default:
         219                 : #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
         220                 :     case hb_ot_complex_shaper_##name:   _hb_ot_shape_complex_setup_masks_##name (map, buffer); return;
         221               0 :     HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
         222                 : #undef HB_COMPLEX_SHAPER_IMPLEMENT
         223                 :   }
         224                 : }
         225                 :
         226                 :
         227                 :
         228                 : #endif /* HB_OT_SHAPE_COMPLEX_PRIVATE_HH */

Generated by: LCOV version 1.7