• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <minikin/Emoji.h>
18 
19 namespace minikin {
20 
isEmoji(uint32_t c)21 bool isEmoji(uint32_t c) {
22   return u_hasBinaryProperty(c, UCHAR_EMOJI);
23 }
24 
isEmojiModifier(uint32_t c)25 bool isEmojiModifier(uint32_t c) {
26   return u_hasBinaryProperty(c, UCHAR_EMOJI_MODIFIER);
27 }
28 
isEmojiBase(uint32_t c)29 bool isEmojiBase(uint32_t c) {
30   // These two characters were removed from Emoji_Modifier_Base in Emoji 4.0,
31   // but we need to keep them as emoji modifier bases since there are fonts and
32   // user-generated text out there that treats these as potential emoji bases.
33   if (c == 0x1F91D || c == 0x1F93C) {
34     return true;
35   }
36   return u_hasBinaryProperty(c, UCHAR_EMOJI_MODIFIER_BASE);
37 }
38 
emojiBidiOverride(const void *,UChar32 c)39 UCharDirection emojiBidiOverride(const void* /* context */, UChar32 c) {
40   return u_charDirection(c);
41 }
42 
43 }  // namespace minikin
44