efl
61 строка · 1.7 Кб
1/*
2* Emoji-related routine and data.
3*
4* Copyright (C) 2018 Andreas Röver <roever at users dot sf dot net>
5*
6* This software is provided 'as-is', without any express or implied
7* warranty. In no event will the author be held liable for any damages
8* arising from the use of this software.
9*
10* Permission is granted to anyone to use this software for any purpose,
11* including commercial applications, and to alter it and redistribute
12* it freely, subject to the following restrictions:
13*
14* 1. The origin of this software must not be misrepresented; you must
15* not claim that you wrote the original software. If you use this
16* software in a product, an acknowledgement in the product
17* documentation would be appreciated but is not required.
18* 2. Altered source versions must be plainly marked as such, and must
19* not be misrepresented as being the original software.
20* 3. This notice may not be removed or altered from any source
21* distribution.
22*/
23
24/**
25* @file emojidef.c
26*
27* Emoji-related routine and data that are used internally.
28*
29* @author Andreas Röver
30*/
31
32#include "emojidef.h"33#include "emojidata.c"34
35/**
36* Finds out if a codepoint is extended pictographic.
37*
38* @param[in] ch character to check
39* @return \c true if the codepoint is extended pictographic;
40* \c false otherwise
41*/
42bool ub_is_extended_pictographic(utf32_t ch)43{
44int min = 0;45int max = ARRAY_LEN(ep_prop) - 1;46int mid;47
48do49{50mid = (min + max) / 2;51
52if (ch < ep_prop[mid].start)53max = mid - 1;54else if (ch > ep_prop[mid].end)55min = mid + 1;56else57return true;58} while (min <= max);59
60return false;61}
62