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 // Emoji modifier are not expected to change, so there's a small change we need to customize
27 // this.
28 return u_hasBinaryProperty(c, UCHAR_EMOJI_MODIFIER);
29 }
30
isEmojiBase(uint32_t c)31 bool isEmojiBase(uint32_t c) {
32 // These two characters were removed from Emoji_Modifier_Base in Emoji 4.0, but we need to keep
33 // them as emoji modifier bases since there are fonts and user-generated text out there that
34 // treats these as potential emoji bases.
35 if (c == 0x1F91D || c == 0x1F93C) {
36 return true;
37 }
38
39 return u_hasBinaryProperty(c, UCHAR_EMOJI_MODIFIER_BASE);
40 }
41
emojiBidiOverride(const void *,UChar32 c)42 UCharDirection emojiBidiOverride(const void* /* context */, UChar32 c) {
43 return u_charDirection(c);
44 }
45
46 } // namespace minikin
47