Skip to content

Commit ce552d9

Browse files
committed
add kiwi::isEmoji()
1 parent 0a05bad commit ce552d9

File tree

2 files changed

+187
-0
lines changed

2 files changed

+187
-0
lines changed

include/kiwi/ScriptType.h

+2
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,6 @@ namespace kiwi
240240
ScriptType chr2ScriptType(char32_t c);
241241

242242
const char* getScriptName(ScriptType type);
243+
244+
bool isEmoji(char32_t c0, char32_t c1 = 0);
243245
}

src/ScriptType.cpp

+185
Original file line numberDiff line numberDiff line change
@@ -566,4 +566,189 @@ namespace kiwi
566566
if (type == ScriptType::tags) return "Tags";
567567
return "unknown";
568568
}
569+
570+
bool isEmoji(char32_t c0, char32_t c1)
571+
{
572+
if (0x1f004 == c0) return true;
573+
if (0x1f0cf == c0) return true;
574+
if (0x1f18e == c0) return true;
575+
if (0x1f191 <= c0 && c0 <= 0x1f19a) return true;
576+
if (0x1f201 == c0) return true;
577+
if (0x1f21a == c0) return true;
578+
if (0x1f22f == c0) return true;
579+
if (0x1f232 <= c0 && c0 <= 0x1f236) return true;
580+
if (0x1f238 <= c0 && c0 <= 0x1f23a) return true;
581+
if (0x1f250 <= c0 && c0 <= 0x1f251) return true;
582+
if (0x1f300 <= c0 && c0 <= 0x1f320) return true;
583+
if (0x1f32d <= c0 && c0 <= 0x1f335) return true;
584+
if (0x1f337 <= c0 && c0 <= 0x1f37c) return true;
585+
if (0x1f37e <= c0 && c0 <= 0x1f393) return true;
586+
if (0x1f3a0 <= c0 && c0 <= 0x1f3ca) return true;
587+
if (0x1f3cf <= c0 && c0 <= 0x1f3d3) return true;
588+
if (0x1f3e0 <= c0 && c0 <= 0x1f3f0) return true;
589+
if (0x1f3f4 == c0) return true;
590+
if (0x1f3f8 <= c0 && c0 <= 0x1f43e) return true;
591+
if (0x1f440 == c0) return true;
592+
if (0x1f442 <= c0 && c0 <= 0x1f4fc) return true;
593+
if (0x1f4ff <= c0 && c0 <= 0x1f53d) return true;
594+
if (0x1f54b <= c0 && c0 <= 0x1f54e) return true;
595+
if (0x1f550 <= c0 && c0 <= 0x1f567) return true;
596+
if (0x1f57a == c0) return true;
597+
if (0x1f595 <= c0 && c0 <= 0x1f596) return true;
598+
if (0x1f5a4 == c0) return true;
599+
if (0x1f5fb <= c0 && c0 <= 0x1f64f) return true;
600+
if (0x1f680 <= c0 && c0 <= 0x1f6c5) return true;
601+
if (0x1f6cc == c0) return true;
602+
if (0x1f6d0 <= c0 && c0 <= 0x1f6d2) return true;
603+
if (0x1f6d5 <= c0 && c0 <= 0x1f6d7) return true;
604+
if (0x1f6dc <= c0 && c0 <= 0x1f6df) return true;
605+
if (0x1f6eb <= c0 && c0 <= 0x1f6ec) return true;
606+
if (0x1f6f4 <= c0 && c0 <= 0x1f6fc) return true;
607+
if (0x1f7e0 <= c0 && c0 <= 0x1f7eb) return true;
608+
if (0x1f7f0 == c0) return true;
609+
if (0x1f90c <= c0 && c0 <= 0x1f93a) return true;
610+
if (0x1f93c <= c0 && c0 <= 0x1f945) return true;
611+
if (0x1f947 <= c0 && c0 <= 0x1f9ff) return true;
612+
if (0x1fa70 <= c0 && c0 <= 0x1fa7c) return true;
613+
if (0x1fa80 <= c0 && c0 <= 0x1fa88) return true;
614+
if (0x1fa90 <= c0 && c0 <= 0x1fabd) return true;
615+
if (0x1fabf <= c0 && c0 <= 0x1fac5) return true;
616+
if (0x1face <= c0 && c0 <= 0x1fadb) return true;
617+
if (0x1fae0 <= c0 && c0 <= 0x1fae8) return true;
618+
if (0x1faf0 <= c0 && c0 <= 0x1faf8) return true;
619+
620+
if (c1 != 0xfe0f) return false;
621+
if (0xa9 == c0) return true;
622+
if (0xae == c0) return true;
623+
if (0x203c == c0) return true;
624+
if (0x2049 == c0) return true;
625+
if (0x2122 == c0) return true;
626+
if (0x2139 == c0) return true;
627+
if (0x2194 <= c0 && c0 <= 0x2199) return true;
628+
if (0x21a9 <= c0 && c0 <= 0x21aa) return true;
629+
if (0x231a <= c0 && c0 <= 0x231b) return true;
630+
if (0x2328 == c0) return true;
631+
if (0x23cf == c0) return true;
632+
if (0x23e9 <= c0 && c0 <= 0x23f3) return true;
633+
if (0x23f8 <= c0 && c0 <= 0x23fa) return true;
634+
if (0x24c2 == c0) return true;
635+
if (0x25aa <= c0 && c0 <= 0x25ab) return true;
636+
if (0x25b6 == c0) return true;
637+
if (0x25c0 == c0) return true;
638+
if (0x25fb <= c0 && c0 <= 0x25fe) return true;
639+
if (0x2600 <= c0 && c0 <= 0x2604) return true;
640+
if (0x260e == c0) return true;
641+
if (0x2611 == c0) return true;
642+
if (0x2614 <= c0 && c0 <= 0x2615) return true;
643+
if (0x2618 == c0) return true;
644+
if (0x261d == c0) return true;
645+
if (0x2620 == c0) return true;
646+
if (0x2622 <= c0 && c0 <= 0x2623) return true;
647+
if (0x2626 == c0) return true;
648+
if (0x262a == c0) return true;
649+
if (0x262e <= c0 && c0 <= 0x262f) return true;
650+
if (0x2638 <= c0 && c0 <= 0x263a) return true;
651+
if (0x2640 == c0) return true;
652+
if (0x2642 == c0) return true;
653+
if (0x2648 <= c0 && c0 <= 0x2653) return true;
654+
if (0x265f <= c0 && c0 <= 0x2660) return true;
655+
if (0x2663 == c0) return true;
656+
if (0x2665 <= c0 && c0 <= 0x2666) return true;
657+
if (0x2668 == c0) return true;
658+
if (0x267b == c0) return true;
659+
if (0x267e <= c0 && c0 <= 0x267f) return true;
660+
if (0x2692 <= c0 && c0 <= 0x2697) return true;
661+
if (0x2699 == c0) return true;
662+
if (0x269b <= c0 && c0 <= 0x269c) return true;
663+
if (0x26a0 <= c0 && c0 <= 0x26a1) return true;
664+
if (0x26a7 == c0) return true;
665+
if (0x26aa <= c0 && c0 <= 0x26ab) return true;
666+
if (0x26b0 <= c0 && c0 <= 0x26b1) return true;
667+
if (0x26bd <= c0 && c0 <= 0x26be) return true;
668+
if (0x26c4 <= c0 && c0 <= 0x26c5) return true;
669+
if (0x26c8 == c0) return true;
670+
if (0x26ce <= c0 && c0 <= 0x26cf) return true;
671+
if (0x26d1 == c0) return true;
672+
if (0x26d3 <= c0 && c0 <= 0x26d4) return true;
673+
if (0x26e9 <= c0 && c0 <= 0x26ea) return true;
674+
if (0x26f0 <= c0 && c0 <= 0x26f5) return true;
675+
if (0x26f7 <= c0 && c0 <= 0x26fa) return true;
676+
if (0x26fd == c0) return true;
677+
if (0x2702 == c0) return true;
678+
if (0x2705 == c0) return true;
679+
if (0x2708 <= c0 && c0 <= 0x270d) return true;
680+
if (0x270f == c0) return true;
681+
if (0x2712 == c0) return true;
682+
if (0x2714 == c0) return true;
683+
if (0x2716 == c0) return true;
684+
if (0x271d == c0) return true;
685+
if (0x2721 == c0) return true;
686+
if (0x2728 == c0) return true;
687+
if (0x2733 <= c0 && c0 <= 0x2734) return true;
688+
if (0x2744 == c0) return true;
689+
if (0x2747 == c0) return true;
690+
if (0x274c == c0) return true;
691+
if (0x274e == c0) return true;
692+
if (0x2753 <= c0 && c0 <= 0x2755) return true;
693+
if (0x2757 == c0) return true;
694+
if (0x2763 <= c0 && c0 <= 0x2764) return true;
695+
if (0x2795 <= c0 && c0 <= 0x2797) return true;
696+
if (0x27a1 == c0) return true;
697+
if (0x27b0 == c0) return true;
698+
if (0x27bf == c0) return true;
699+
if (0x2934 <= c0 && c0 <= 0x2935) return true;
700+
if (0x2b05 <= c0 && c0 <= 0x2b07) return true;
701+
if (0x2b1b <= c0 && c0 <= 0x2b1c) return true;
702+
if (0x2b50 == c0) return true;
703+
if (0x2b55 == c0) return true;
704+
if (0x3030 == c0) return true;
705+
if (0x303d == c0) return true;
706+
if (0x3297 == c0) return true;
707+
if (0x3299 == c0) return true;
708+
if (0x1f170 <= c0 && c0 <= 0x1f171) return true;
709+
if (0x1f17e <= c0 && c0 <= 0x1f17f) return true;
710+
if (0x1f202 == c0) return true;
711+
if (0x1f237 == c0) return true;
712+
if (0x1f321 == c0) return true;
713+
if (0x1f324 <= c0 && c0 <= 0x1f32c) return true;
714+
if (0x1f336 == c0) return true;
715+
if (0x1f37d == c0) return true;
716+
if (0x1f396 <= c0 && c0 <= 0x1f397) return true;
717+
if (0x1f399 <= c0 && c0 <= 0x1f39b) return true;
718+
if (0x1f39e <= c0 && c0 <= 0x1f39f) return true;
719+
if (0x1f3cb <= c0 && c0 <= 0x1f3ce) return true;
720+
if (0x1f3d4 <= c0 && c0 <= 0x1f3df) return true;
721+
if (0x1f3f3 == c0) return true;
722+
if (0x1f3f5 == c0) return true;
723+
if (0x1f3f7 == c0) return true;
724+
if (0x1f43f == c0) return true;
725+
if (0x1f441 == c0) return true;
726+
if (0x1f4fd == c0) return true;
727+
if (0x1f549 <= c0 && c0 <= 0x1f54a) return true;
728+
if (0x1f56f <= c0 && c0 <= 0x1f570) return true;
729+
if (0x1f573 <= c0 && c0 <= 0x1f579) return true;
730+
if (0x1f587 == c0) return true;
731+
if (0x1f58a <= c0 && c0 <= 0x1f58d) return true;
732+
if (0x1f590 == c0) return true;
733+
if (0x1f5a5 == c0) return true;
734+
if (0x1f5a8 == c0) return true;
735+
if (0x1f5b1 <= c0 && c0 <= 0x1f5b2) return true;
736+
if (0x1f5bc == c0) return true;
737+
if (0x1f5c2 <= c0 && c0 <= 0x1f5c4) return true;
738+
if (0x1f5d1 <= c0 && c0 <= 0x1f5d3) return true;
739+
if (0x1f5dc <= c0 && c0 <= 0x1f5de) return true;
740+
if (0x1f5e1 == c0) return true;
741+
if (0x1f5e3 == c0) return true;
742+
if (0x1f5e8 == c0) return true;
743+
if (0x1f5ef == c0) return true;
744+
if (0x1f5f3 == c0) return true;
745+
if (0x1f5fa == c0) return true;
746+
if (0x1f6cb == c0) return true;
747+
if (0x1f6cd <= c0 && c0 <= 0x1f6cf) return true;
748+
if (0x1f6e0 <= c0 && c0 <= 0x1f6e5) return true;
749+
if (0x1f6e9 == c0) return true;
750+
if (0x1f6f0 == c0) return true;
751+
if (0x1f6f3 == c0) return true;
752+
return false;
753+
}
569754
}

0 commit comments

Comments
 (0)