15c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod/*
22409d5f8d7dd8b535ce5ea29e933f7db27d33793Behdad Esfahbod * Copyright © 2009  Red Hat, Inc.
36af9cff5e17e82100b435c8d21aed0765296d58dBehdad Esfahbod * Copyright © 2011  Codethink Limited
46adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod * Copyright © 2010,2011,2012  Google, Inc.
55c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod *
6c755cb3e3ac55156d0d2ec05adea7a650b97cc41Behdad Esfahbod *  This is part of HarfBuzz, a text shaping library.
75c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod *
85c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * Permission is hereby granted, without written agreement and without
95c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this
105c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * software and its documentation for any purpose, provided that the
115c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * above copyright notice and the following two paragraphs appear in
125c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * all copies of this software.
135c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod *
145c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
155c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
165c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
175c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
185c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * DAMAGE.
195c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod *
205c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
215c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
225c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
235c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
245c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
255c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod *
265c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * Red Hat Author(s): Behdad Esfahbod
272fd0c577e322ccbf762927bc4600b3ea31db4c80Ryan Lortie * Codethink Author(s): Ryan Lortie
28fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod * Google Author(s): Behdad Esfahbod
295c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod */
305c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
31fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod#ifndef HB_UNICODE_PRIVATE_HH
32fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod#define HB_UNICODE_PRIVATE_HH
335c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
34c57d454accff66e5f2c58006e8fb40bc020b6182Behdad Esfahbod#include "hb-private.hh"
35fca368c4682624346a0aaee690e1ad6ed4c0b337Behdad Esfahbod#include "hb-object-private.hh"
365c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
375c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
386adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbodextern HB_INTERNAL const uint8_t _hb_modified_combining_class[256];
39acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbod
405c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod/*
415c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * hb_unicode_funcs_t
425c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod */
435c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
444b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod#define HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS \
45891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod  HB_UNICODE_FUNC_IMPLEMENT (combining_class) \
46891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod  HB_UNICODE_FUNC_IMPLEMENT (eastasian_width) \
47891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod  HB_UNICODE_FUNC_IMPLEMENT (general_category) \
48891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod  HB_UNICODE_FUNC_IMPLEMENT (mirroring) \
49891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod  HB_UNICODE_FUNC_IMPLEMENT (script) \
50c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod  HB_UNICODE_FUNC_IMPLEMENT (compose) \
51c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod  HB_UNICODE_FUNC_IMPLEMENT (decompose) \
52378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod  HB_UNICODE_FUNC_IMPLEMENT (decompose_compatibility) \
534b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  /* ^--- Add new callbacks here */
544b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod
55891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod/* Simple callbacks are those taking a hb_codepoint_t and returning a hb_codepoint_t */
56891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod#define HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE \
5721fdcee00125b6e1c09f0bed3064d16ccd3a7a5dBehdad Esfahbod  HB_UNICODE_FUNC_IMPLEMENT (hb_unicode_combining_class_t, combining_class) \
58891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod  HB_UNICODE_FUNC_IMPLEMENT (unsigned int, eastasian_width) \
59891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod  HB_UNICODE_FUNC_IMPLEMENT (hb_unicode_general_category_t, general_category) \
60891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod  HB_UNICODE_FUNC_IMPLEMENT (hb_codepoint_t, mirroring) \
61891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod  HB_UNICODE_FUNC_IMPLEMENT (hb_script_t, script) \
62891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod  /* ^--- Add new simple callbacks here */
63891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod
641bc1cb3603167f5da309336f7018c8b0608ac104Behdad Esfahbodstruct hb_unicode_funcs_t {
65fca368c4682624346a0aaee690e1ad6ed4c0b337Behdad Esfahbod  hb_object_header_t header;
666220e5fc0dad728e67a92e838d3ac275d032f2c7Behdad Esfahbod  ASSERT_POD ();
67fca368c4682624346a0aaee690e1ad6ed4c0b337Behdad Esfahbod
682fd0c577e322ccbf762927bc4600b3ea31db4c80Ryan Lortie  hb_unicode_funcs_t *parent;
695c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
70fca368c4682624346a0aaee690e1ad6ed4c0b337Behdad Esfahbod  bool immutable;
71eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbod
727470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name) \
737470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  inline return_type name (hb_codepoint_t unicode) { return func.name (this, unicode, user_data.name); }
747470315a3e782aa6192bbe64f7a3944266fb1521Behdad EsfahbodHB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
757470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod#undef HB_UNICODE_FUNC_IMPLEMENT
767470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod
777470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  inline hb_bool_t compose (hb_codepoint_t a, hb_codepoint_t b,
787470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod			    hb_codepoint_t *ab)
797470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  {
807470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod    *ab = 0;
81d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod    if (unlikely (!a || !b)) return false;
820f8881d6bbf6cd59938315eeff9b71cfc736aa4eBehdad Esfahbod    return func.compose (this, a, b, ab, user_data.compose);
837470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  }
847470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod
857470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  inline hb_bool_t decompose (hb_codepoint_t ab,
867470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod			      hb_codepoint_t *a, hb_codepoint_t *b)
877470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  {
88d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod    *a = ab; *b = 0;
897470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod    return func.decompose (this, ab, a, b, user_data.decompose);
907470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  }
917470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod
927470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  inline unsigned int decompose_compatibility (hb_codepoint_t  u,
937470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod					       hb_codepoint_t *decomposed)
947470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  {
957470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod    unsigned int ret = func.decompose_compatibility (this, u, decomposed, user_data.decompose_compatibility);
967470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod    if (ret == 1 && u == decomposed[0]) {
977470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod      decomposed[0] = 0;
987470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod      return 0;
997470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod    }
1007470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod    decomposed[ret] = 0;
1017470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod    return ret;
1027470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  }
1037470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod
104fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod
105878a25375b2fdf64cf0cc30c23fca9fcd58548e8Behdad Esfahbod  inline unsigned int
1066adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  modified_combining_class (hb_codepoint_t unicode)
1076adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  {
1081c8654ead41ca746d577549c92d2a41c594ab639Behdad Esfahbod    /* XXX This hack belongs to the Myanmar shaper. */
1097627100f428ac0ec8509d961d368d2d25d8f0b6eBehdad Esfahbod    if (unlikely (unicode == 0x1037u)) unicode = 0x103Au;
11015f67048e45853ad4069fd4334e132bc3db4d2c4Behdad Esfahbod
111a252ad61f077c3b7bbfd8335e1b105a57beb58ceBehdad Esfahbod    /* XXX This hack belongs to the USE shaper (for Tai Tham):
11215f67048e45853ad4069fd4334e132bc3db4d2c4Behdad Esfahbod     * Reorder SAKOT to ensure it comes after any tone marks. */
1137627100f428ac0ec8509d961d368d2d25d8f0b6eBehdad Esfahbod    if (unlikely (unicode == 0x1A60u)) return 254;
1141c8654ead41ca746d577549c92d2a41c594ab639Behdad Esfahbod
1159c9411839bb89d0a1a83120af0982c60e0e393d9Behdad Esfahbod    /* XXX This hack belongs to the Tibetan shaper:
1169c9411839bb89d0a1a83120af0982c60e0e393d9Behdad Esfahbod     * Reorder PADMA to ensure it comes after any vowel marks. */
1177627100f428ac0ec8509d961d368d2d25d8f0b6eBehdad Esfahbod    if (unlikely (unicode == 0x0FC6u)) return 254;
1182f560ee44b7b08683e8e6955fe3b95187e8bda32Behdad Esfahbod    /* Reorder TSA -PHRU to reorder before U+0F74 */
1192f560ee44b7b08683e8e6955fe3b95187e8bda32Behdad Esfahbod    if (unlikely (unicode == 0x0F39u)) return 127;
1209c9411839bb89d0a1a83120af0982c60e0e393d9Behdad Esfahbod
1216adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod    return _hb_modified_combining_class[combining_class (unicode)];
1226adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  }
123208f70f0553d73d2908b21b9552298029482a8b9Behdad Esfahbod
124878a25375b2fdf64cf0cc30c23fca9fcd58548e8Behdad Esfahbod  static inline hb_bool_t
125208f70f0553d73d2908b21b9552298029482a8b9Behdad Esfahbod  is_variation_selector (hb_codepoint_t unicode)
126208f70f0553d73d2908b21b9552298029482a8b9Behdad Esfahbod  {
127164c13d73f67fdddba28e6409d76b4903e8ffab3Behdad Esfahbod    /* U+180B..180D MONGOLIAN FREE VARIATION SELECTORs are handled in the
128164c13d73f67fdddba28e6409d76b4903e8ffab3Behdad Esfahbod     * Arabic shaper.  No need to match them here. */
1293b0e47ca006b8fe6a24ace72dd931e3649bb8e6fEbrahim Byagowi    return unlikely (hb_in_ranges<hb_codepoint_t> (unicode,
1307627100f428ac0ec8509d961d368d2d25d8f0b6eBehdad Esfahbod				   0xFE00u, 0xFE0Fu, /* VARIATION SELECTOR-1..16 */
1317627100f428ac0ec8509d961d368d2d25d8f0b6eBehdad Esfahbod				   0xE0100u, 0xE01EFu));  /* VARIATION SELECTOR-17..256 */
132208f70f0553d73d2908b21b9552298029482a8b9Behdad Esfahbod  }
133208f70f0553d73d2908b21b9552298029482a8b9Behdad Esfahbod
134cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod  /* Default_Ignorable codepoints:
135208f70f0553d73d2908b21b9552298029482a8b9Behdad Esfahbod   *
136391934db0a171aeb2057ebcd4a38ed81621e7393Jonathan Kew   * Note: While U+115F, U+1160, U+3164 and U+FFA0 are Default_Ignorable,
137391934db0a171aeb2057ebcd4a38ed81621e7393Jonathan Kew   * we do NOT want to hide them, as the way Uniscribe has implemented them
138391934db0a171aeb2057ebcd4a38ed81621e7393Jonathan Kew   * is with regular spacing glyphs, and that's the way fonts are made to work.
139391934db0a171aeb2057ebcd4a38ed81621e7393Jonathan Kew   * As such, we make exceptions for those four.
1407c6937e7c7b62602fef10ac4b2e164d0c67c932bebraminio   * Also ignoring U+1BCA0..1BCA3. https://github.com/harfbuzz/harfbuzz/issues/503
141cc50bf5b13bfe88137fa7a42782872c40fb9aefbBehdad Esfahbod   *
142577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * Unicode 7.0:
143577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * $ grep '; Default_Ignorable_Code_Point ' DerivedCoreProperties.txt | sed 's/;.*#/#/'
144577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 00AD          # Cf       SOFT HYPHEN
145577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 034F          # Mn       COMBINING GRAPHEME JOINER
146577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 061C          # Cf       ARABIC LETTER MARK
147577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 115F..1160    # Lo   [2] HANGUL CHOSEONG FILLER..HANGUL JUNGSEONG FILLER
148577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 17B4..17B5    # Mn   [2] KHMER VOWEL INHERENT AQ..KHMER VOWEL INHERENT AA
149577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 180B..180D    # Mn   [3] MONGOLIAN FREE VARIATION SELECTOR ONE..MONGOLIAN FREE VARIATION SELECTOR THREE
150577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 180E          # Cf       MONGOLIAN VOWEL SEPARATOR
151577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 200B..200F    # Cf   [5] ZERO WIDTH SPACE..RIGHT-TO-LEFT MARK
152577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 202A..202E    # Cf   [5] LEFT-TO-RIGHT EMBEDDING..RIGHT-TO-LEFT OVERRIDE
153577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 2060..2064    # Cf   [5] WORD JOINER..INVISIBLE PLUS
154577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 2065          # Cn       <reserved-2065>
155577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 2066..206F    # Cf  [10] LEFT-TO-RIGHT ISOLATE..NOMINAL DIGIT SHAPES
156577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 3164          # Lo       HANGUL FILLER
157577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * FE00..FE0F    # Mn  [16] VARIATION SELECTOR-1..VARIATION SELECTOR-16
158577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * FEFF          # Cf       ZERO WIDTH NO-BREAK SPACE
159577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * FFA0          # Lo       HALFWIDTH HANGUL FILLER
160577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * FFF0..FFF8    # Cn   [9] <reserved-FFF0>..<reserved-FFF8>
161577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 1BCA0..1BCA3  # Cf   [4] SHORTHAND FORMAT LETTER OVERLAP..SHORTHAND FORMAT UP STEP
162577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * 1D173..1D17A  # Cf   [8] MUSICAL SYMBOL BEGIN BEAM..MUSICAL SYMBOL END PHRASE
163577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * E0000         # Cn       <reserved-E0000>
164577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * E0001         # Cf       LANGUAGE TAG
165577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * E0002..E001F  # Cn  [30] <reserved-E0002>..<reserved-E001F>
166577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * E0020..E007F  # Cf  [96] TAG SPACE..CANCEL TAG
167577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * E0080..E00FF  # Cn [128] <reserved-E0080>..<reserved-E00FF>
168577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * E0100..E01EF  # Mn [240] VARIATION SELECTOR-17..VARIATION SELECTOR-256
169577ca4814314c374824cac736996b9cdd4f9d11fBehdad Esfahbod   * E01F0..E0FFF  # Cn [3600] <reserved-E01F0>..<reserved-E0FFF>
170208f70f0553d73d2908b21b9552298029482a8b9Behdad Esfahbod   */
171878a25375b2fdf64cf0cc30c23fca9fcd58548e8Behdad Esfahbod  static inline hb_bool_t
172cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod  is_default_ignorable (hb_codepoint_t ch)
173208f70f0553d73d2908b21b9552298029482a8b9Behdad Esfahbod  {
174cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod    hb_codepoint_t plane = ch >> 16;
175cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod    if (likely (plane == 0))
176cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod    {
177cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod      /* BMP */
178cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod      hb_codepoint_t page = ch >> 8;
179cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod      switch (page) {
1807627100f428ac0ec8509d961d368d2d25d8f0b6eBehdad Esfahbod	case 0x00: return unlikely (ch == 0x00ADu);
1817627100f428ac0ec8509d961d368d2d25d8f0b6eBehdad Esfahbod	case 0x03: return unlikely (ch == 0x034Fu);
1827627100f428ac0ec8509d961d368d2d25d8f0b6eBehdad Esfahbod	case 0x06: return unlikely (ch == 0x061Cu);
1833b0e47ca006b8fe6a24ace72dd931e3649bb8e6fEbrahim Byagowi	case 0x17: return hb_in_range<hb_codepoint_t> (ch, 0x17B4u, 0x17B5u);
1843b0e47ca006b8fe6a24ace72dd931e3649bb8e6fEbrahim Byagowi	case 0x18: return hb_in_range<hb_codepoint_t> (ch, 0x180Bu, 0x180Eu);
1853b0e47ca006b8fe6a24ace72dd931e3649bb8e6fEbrahim Byagowi	case 0x20: return hb_in_ranges<hb_codepoint_t> (ch, 0x200Bu, 0x200Fu,
186f80c34eb556d12c45c961d6742c289baef58899dBehdad Esfahbod					    0x202Au, 0x202Eu,
187f80c34eb556d12c45c961d6742c289baef58899dBehdad Esfahbod					    0x2060u, 0x206Fu);
1883b0e47ca006b8fe6a24ace72dd931e3649bb8e6fEbrahim Byagowi	case 0xFE: return hb_in_range<hb_codepoint_t> (ch, 0xFE00u, 0xFE0Fu) || ch == 0xFEFFu;
1893b0e47ca006b8fe6a24ace72dd931e3649bb8e6fEbrahim Byagowi	case 0xFF: return hb_in_range<hb_codepoint_t> (ch, 0xFFF0u, 0xFFF8u);
190cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod	default: return false;
191cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod      }
192cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod    }
193cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod    else
194cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod    {
195cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod      /* Other planes */
196cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod      switch (plane) {
197d695cacbf4dd5f77b5e7134cf60553775c515ef1Behdad Esfahbod	case 0x01: return hb_in_range<hb_codepoint_t> (ch, 0x1D173u, 0x1D17Au);
1983b0e47ca006b8fe6a24ace72dd931e3649bb8e6fEbrahim Byagowi	case 0x0E: return hb_in_range<hb_codepoint_t> (ch, 0xE0000u, 0xE0FFFu);
199cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod	default: return false;
200cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod      }
201cf3afd8979b1db76d437f428cbd51cb363e0d18eBehdad Esfahbod    }
202208f70f0553d73d2908b21b9552298029482a8b9Behdad Esfahbod  }
203208f70f0553d73d2908b21b9552298029482a8b9Behdad Esfahbod
20449ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod  /* Space estimates based on:
20549ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod   * http://www.unicode.org/charts/PDF/U2000.pdf
20649ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod   * https://www.microsoft.com/typography/developers/fdsspec/spaces.aspx
20749ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod   */
2087793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod  enum space_t {
2097793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod    NOT_SPACE = 0,
21049ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod    SPACE_EM   = 1,
21149ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod    SPACE_EM_2 = 2,
21249ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod    SPACE_EM_3 = 3,
21349ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod    SPACE_EM_4 = 4,
21449ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod    SPACE_EM_5 = 5,
21549ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod    SPACE_EM_6 = 6,
21649ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod    SPACE_EM_16 = 16,
21749ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod    SPACE_4_EM_18,	/* 4/18th of an EM! */
21849ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod    SPACE,
2197793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod    SPACE_FIGURE,
2207793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod    SPACE_PUNCTUATION,
2217793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod    SPACE_NARROW,
2227793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod  };
2237793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod  static inline space_t
2247793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod  space_fallback_type (hb_codepoint_t u)
2257793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod  {
2267793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod    switch (u)
2277793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod    {
2287793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod      /* All GC=Zs chars that can use a fallback. */
2293e10460a1dd41de32752e308771aa30d23565cc0Behdad Esfahbod      default:	    return NOT_SPACE;	/* U+1680 OGHAM SPACE MARK */
23049ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x0020u: return SPACE;	/* U+0020 SPACE */
23149ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x00A0u: return SPACE;	/* U+00A0 NO-BREAK SPACE */
23249ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x2000u: return SPACE_EM_2;	/* U+2000 EN QUAD */
23349ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x2001u: return SPACE_EM;	/* U+2001 EM QUAD */
23449ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x2002u: return SPACE_EM_2;	/* U+2002 EN SPACE */
23549ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x2003u: return SPACE_EM;	/* U+2003 EM SPACE */
23649ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x2004u: return SPACE_EM_3;	/* U+2004 THREE-PER-EM SPACE */
23749ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x2005u: return SPACE_EM_4;	/* U+2005 FOUR-PER-EM SPACE */
23849ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x2006u: return SPACE_EM_6;	/* U+2006 SIX-PER-EM SPACE */
23949ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x2007u: return SPACE_FIGURE;	/* U+2007 FIGURE SPACE */
24049ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x2008u: return SPACE_PUNCTUATION;	/* U+2008 PUNCTUATION SPACE */
24149ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x2009u: return SPACE_EM_5;		/* U+2009 THIN SPACE */
24249ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x200Au: return SPACE_EM_16;		/* U+200A HAIR SPACE */
24349ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x202Fu: return SPACE_NARROW;	/* U+202F NARROW NO-BREAK SPACE */
24449ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x205Fu: return SPACE_4_EM_18;	/* U+205F MEDIUM MATHEMATICAL SPACE */
24549ef630936325b2e56a870fcef9aa8473a8f8526Behdad Esfahbod      case 0x3000u: return SPACE_EM;		/* U+3000 IDEOGRAPHIC SPACE */
2467793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod    }
2477793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod  }
248208f70f0553d73d2908b21b9552298029482a8b9Behdad Esfahbod
249fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod  struct {
250c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_func_t name;
2514b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
2524b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod#undef HB_UNICODE_FUNC_IMPLEMENT
253c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod  } func;
254fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod
255fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod  struct {
256891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod#define HB_UNICODE_FUNC_IMPLEMENT(name) void *name;
2574b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
2584b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod#undef HB_UNICODE_FUNC_IMPLEMENT
259fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod  } user_data;
260fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod
261bf36a1074ab23abeab0a7a6c47db26770dc1ab0aBehdad Esfahbod  struct {
262891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_destroy_func_t name;
2634b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
2644b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod#undef HB_UNICODE_FUNC_IMPLEMENT
265fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod  } destroy;
2665c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod};
2675c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
268d4bee9f813bb299b1c4aab7c33d588be2a7d354bBehdad Esfahbod
2699a5b421a64db1bb23d5c6ebbc3bf3f3a5513dc36Behdad Esfahbodextern HB_INTERNAL const hb_unicode_funcs_t _hb_unicode_funcs_nil;
270d4bee9f813bb299b1c4aab7c33d588be2a7d354bBehdad Esfahbod
271af9e104028b7cdc1fbba0eb1d86cfa4d5258657fBehdad Esfahbod
27221756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod/* Modified combining marks */
27321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod
27421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod/* Hebrew
27521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod *
27621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod * We permute the "fixed-position" classes 10-26 into the order
27721756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod * described in the SBL Hebrew manual:
27821756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod *
27921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod * http://www.sbl-site.org/Fonts/SBLHebrewUserManual1.5x.pdf
28021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod *
28121756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod * (as recommended by:
28221756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod *  http://forum.fontlab.com/archive-old-microsoft-volt-group/vista-and-diacritic-ordering-t6751.0.html)
28321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod *
28421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod * More details here:
28521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod * https://bugzilla.mozilla.org/show_bug.cgi?id=662055
28621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod */
28721756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC10 22 /* sheva */
28821756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC11 15 /* hataf segol */
28921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC12 16 /* hataf patah */
29021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC13 17 /* hataf qamats */
29121756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC14 23 /* hiriq */
29221756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC15 18 /* tsere */
29321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC16 19 /* segol */
29421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC17 20 /* patah */
29521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC18 21 /* qamats */
29621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC19 14 /* holam */
29721756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC20 24 /* qubuts */
29821756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC21 12 /* dagesh */
29921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC22 25 /* meteg */
30021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC23 13 /* rafe */
30121756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC24 10 /* shin dot */
30221756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC25 11 /* sin dot */
30321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC26 26 /* point varika */
30421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod
30521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod/*
30621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod * Arabic
30721756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod *
30821756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod * Modify to move Shadda (ccc=33) before other marks.  See:
30921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod * http://unicode.org/faq/normalization.html#8
31021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod * http://unicode.org/faq/normalization.html#9
31121756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod */
31221756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC27 28 /* fathatan */
31321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC28 29 /* dammatan */
31421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC29 30 /* kasratan */
31521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC30 31 /* fatha */
31621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC31 32 /* damma */
31721756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC32 33 /* kasra */
31821756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC33 27 /* shadda */
31921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC34 34 /* sukun */
32021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC35 35 /* superscript alef */
32121756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod
32221756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod/* Syriac */
32321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC36 36 /* superscript alaph */
32421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod
32521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod/* Telugu
32621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod *
32721756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod * Modify Telugu length marks (ccc=84, ccc=91).
32821756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod * These are the only matras in the main Indic scripts range that have
32921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod * a non-zero ccc.  That makes them reorder with the Halant that is
33021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod * ccc=9.  Just zero them, we don't need them in our Indic shaper.
33121756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod */
33221756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC84 0 /* length mark */
33321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC91 0 /* ai length mark */
33421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod
33521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod/* Thai
33621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod *
33756c9e7c004e802ddcb8c704346026f1d7a812f9fBehdad Esfahbod * Modify U+0E38 and U+0E39 (ccc=103) to be reordered before U+0E3A (ccc=9).
33856c9e7c004e802ddcb8c704346026f1d7a812f9fBehdad Esfahbod * Assign 3, which is unassigned otherwise.
33956c9e7c004e802ddcb8c704346026f1d7a812f9fBehdad Esfahbod * Uniscribe does this reordering too.
34021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod */
34121756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC103 3 /* sara u / sara uu */
34221756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC107 107 /* mai * */
34321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod
34421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod/* Lao */
34521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC118 118 /* sign u / sign uu */
34621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC122 122 /* mai * */
34721756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod
3482f560ee44b7b08683e8e6955fe3b95187e8bda32Behdad Esfahbod/* Tibetan
3494e21ec546932c2a982aa52fce718c1a0d90a71d6Dominik Schlösser *
3504e21ec546932c2a982aa52fce718c1a0d90a71d6Dominik Schlösser * In case of multiple vowel-signs, use u first (but after achung)
3514e21ec546932c2a982aa52fce718c1a0d90a71d6Dominik Schlösser * this allows Dzongkha multi-vowel shortcuts to render correctly
3522f560ee44b7b08683e8e6955fe3b95187e8bda32Behdad Esfahbod */
35321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod#define HB_MODIFIED_COMBINING_CLASS_CCC129 129 /* sign aa */
3544e21ec546932c2a982aa52fce718c1a0d90a71d6Dominik Schlösser#define HB_MODIFIED_COMBINING_CLASS_CCC130 132 /* sign i */
3554e21ec546932c2a982aa52fce718c1a0d90a71d6Dominik Schlösser#define HB_MODIFIED_COMBINING_CLASS_CCC132 131 /* sign u */
35621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod
357028a1706f898bfcee0d14acfba47ebe1de09f0c4Behdad Esfahbod/* Misc */
358028a1706f898bfcee0d14acfba47ebe1de09f0c4Behdad Esfahbod
359028a1706f898bfcee0d14acfba47ebe1de09f0c4Behdad Esfahbod#define HB_UNICODE_GENERAL_CATEGORY_IS_MARK(gen_cat) \
3606058f98825e8f134893a1bbfb402e45d85b56ff0Behdad Esfahbod	(FLAG_UNSAFE (gen_cat) & \
361028a1706f898bfcee0d14acfba47ebe1de09f0c4Behdad Esfahbod	 (FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) | \
362028a1706f898bfcee0d14acfba47ebe1de09f0c4Behdad Esfahbod	  FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) | \
363028a1706f898bfcee0d14acfba47ebe1de09f0c4Behdad Esfahbod	  FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)))
364028a1706f898bfcee0d14acfba47ebe1de09f0c4Behdad Esfahbod
365aae2847099cbf05bf0668fbe526fc58736837c1bBehdad Esfahbod#define HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL(gen_cat) \
3666058f98825e8f134893a1bbfb402e45d85b56ff0Behdad Esfahbod	(FLAG_UNSAFE (gen_cat) & \
36790d75f93bb85aeb627c4e6bb9e4cbd75895c99f7Behdad Esfahbod	 (FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) | \
368aae2847099cbf05bf0668fbe526fc58736837c1bBehdad Esfahbod	  FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) | \
369aae2847099cbf05bf0668fbe526fc58736837c1bBehdad Esfahbod	  FLAG (HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL)))
37090d75f93bb85aeb627c4e6bb9e4cbd75895c99f7Behdad Esfahbod
371fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod#endif /* HB_UNICODE_PRIVATE_HH */
372