From 069bed5d471b231d0e7b5fc104f17fbe203875dd Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Fri, 21 Jun 2024 16:30:27 -0400 Subject: [PATCH] LibUnicode+LibGfx: Remove superfluous emoji metadata For SerenityOS, we parse emoji metadata from the UCD to learn emoji groups, subgroups, names, etc. We used this information only in the emoji picker dialog. It is entirely unused within Ladybird. This removes our dependence on the UCD emoji file, as we no longer need any of its information. All we need to know is the file path to our custom emoji, which we get from Meta/emoji-file-list.txt. --- Base/home/anon/Documents/emoji-serenity.txt | 275 --------------- Meta/CMake/unicode_data.cmake | 10 +- .../LibUnicode/GenerateEmojiData.cpp | 327 +++--------------- Userland/Libraries/LibGfx/Font/Emoji.cpp | 15 +- Userland/Libraries/LibUnicode/Emoji.cpp | 4 +- Userland/Libraries/LibUnicode/Emoji.h | 98 +----- Userland/Libraries/LibUnicode/Forward.h | 1 - 7 files changed, 70 insertions(+), 660 deletions(-) delete mode 100644 Base/home/anon/Documents/emoji-serenity.txt diff --git a/Base/home/anon/Documents/emoji-serenity.txt b/Base/home/anon/Documents/emoji-serenity.txt deleted file mode 100644 index 8cfab1eeb9f..00000000000 --- a/Base/home/anon/Documents/emoji-serenity.txt +++ /dev/null @@ -1,275 +0,0 @@ -ZWJ Sequence Emoji (limited cross-platform support) ---------- - -๐Ÿฑโ€๐Ÿถ - U+1F431 U+200D U+1F436 CATDOG FACE - -Yak Emoji (limited cross-platform support) ---------- - -๔Œด€ - U+10CD00 HAIRYAK -๔Œด - U+10CD01 IMMINENTYAKSHAVE -๔Œด‚ - U+10CD02 SHAVEDYAK -๔Œดƒ - U+10CD03 YAKPLUS -๔Œด„ - U+10CD04 YAKPING -๔Œด… - U+10CD05 YAKMINUS -๔Œด† - U+10CD06 YAKTANGLE -๔Œด‡ - U+10CD07 YAKBAIT -๔Œดˆ - U+10CD08 REYAKTED -๔Œด‰ - U+10CD09 SLEEPYAK -๔ŒดŠ - U+10CD0A YAKBRAIN -๔Œด‹ - U+10CD0B GOLDYAK -๔ŒดŒ - U+10CD0C YAKKING -๔Œด - U+10CD0D YAKMAIL -๔ŒดŽ - U+10CD0E YAKMAGNET -๔Œด - U+10CD0F YAKFIRE -๔Œด - U+10CD10 YAKSPLODE -๔Œด‘ - U+10CD11 YAKSHED -๔Œด’ - U+10CD12 YAKFUSED -๔Œด“ - U+10CD13 8BITYAK -๔Œด” - U+10CD14 SKELEYAK -๔Œด• - U+10CD15 NEOYAK -๔Œด– - U+10CD16 YAKEA -๔Œด— - U+10CD17 YAKID2 -๔Œด˜ - U+10CD18 YAKSLICE -๔Œด™ - U+10CD19 YAKSTICKER -๔Œดš - U+10CD1A YAKKIE -๔Œด› - U+10CD1B ANGELYAK -๔Œดœ - U+10CD1C YAK -๔Œด - U+10CD1D YAKGONE -๔Œดž - U+10CD1E YAKMEASURE -๔ŒดŸ - U+10CD1F YAKCOWBOY -๔Œด  - U+10CD20 YAKSPEED -๔Œดก - U+10CD21 YAKMANDO -๔Œดข - U+10CD22 NINJYAK -๔Œดฃ - U+10CD23 YOWL -๔Œดค - U+10CD24 YAKSLOW -๔Œดฅ - U+10CD25 BUFFYAK -๔Œดฆ - U+10CD26 YAKTRAP -๔Œต  - U+10CD60 PARTYAK -๔Œตก - U+10CD61 YAKKISS -๔Œตข - U+10CD62 THOUSANDYAKSTARE -๔Œตฃ - U+10CD63 YAKBLUSH -๔Œตค - U+10CD64 YAKSHRUG -๔Œตฅ - U+10CD65 YAKTHONK -๔Œตฆ - U+10CD66 YAKSAD -๔Œตง - U+10CD67 BABYAK -๔Œตจ - U+10CD68 YAKKETYSAX -๔Œตฉ - U+10CD69 YAKBANE -๔Œตช - U+10CD6A YAKTHINK -๔Œตซ - U+10CD6B HYPERYAKKIE -๔Œถ - U+10CD90 YAKSTACK -๔Œถ‘ - U+10CD91 YAKCHAIN -๔Œถ’ - U+10CD92 YAKRING -๔Œถ“ - U+10CD93 YAKOVERFLOW -๔Œถฐ - U+10CDB0 XMASYAK -๔Œถฑ - U+10CDB1 YAKTOBERFEST -๔Œท - U+10CDD0 YAKSTEPS -๔Œท  - U+10CDE0 YAKRAGE-FRAME-1 -๔Œทก - U+10CDE1 YAKRAGE-FRAME-2 -๔Œทข - U+10CDE2 YAKRAGE-FRAME-3 -๔Œทฃ - U+10CDE3 YAKRAGE-FRAME-4 -๔Œทค - U+10CDE4 YAKRAGE-FRAME-5 -๔Œทฅ - U+10CDE5 YAKRAGE-FRAME-6 - -ZWJ Sequence Flags (limited cross-platform support) ------------------- - -๐Ÿณ๏ธโ€๐Ÿž - U+1F3F3 U+200D U+1F41E SerenityOS flag -๐Ÿณ๏ธโ€๏ฃฟ - U+1F3F3 U+200D U+F8FF Klingon flag -๐Ÿณ๏ธโ€๐Ÿ–– - U+1F3F3 U+200D U+1F596 Vulcan flag - -Emoji Tag Sequence Flags (limited cross-platform support) ------------------------- - -๐Ÿด๓ ข๓ ฑ๓ ข๓ ฏ๓ ฟ - U+1F3F4 U+E0062 U+E0071 U+E0062 U+E006F U+E007F BQ-BO Bonaire -๐Ÿด๓ ข๓ ฑ๓ ณ๓ ก๓ ฟ - U+1F3F4 U+E0062 U+E0071 U+E0073 U+E0061 U+E007F BQ-SA Saba -๐Ÿด๓ ข๓ ฑ๓ ณ๓ ฅ๓ ฟ - U+1F3F4 U+E0062 U+E0071 U+E0073 U+E0065 U+E007F BQ-SE Sint Eustatius -๐Ÿด๓ ฃ๓ ก๓ ฑ๓ ฃ๓ ฟ - U+1F3F4 U+E0063 U+E0061 U+E0071 U+E0063 U+E007F CA-QC Quebec -๐Ÿด๓ ค๓ ฅ๓ ข๓ ข๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E0062 U+E0062 U+E007F DE-BB Brandenburg -๐Ÿด๓ ค๓ ฅ๓ ข๓ ฅ๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E0062 U+E0065 U+E007F DE-BE Berlin -๐Ÿด๓ ค๓ ฅ๓ ข๓ ท๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E0062 U+E0077 U+E007F DE-BW Baden-Wรผrttemberg -๐Ÿด๓ ค๓ ฅ๓ ข๓ น๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E0062 U+E0079 U+E007F DE-BY Bavaria -๐Ÿด๓ ค๓ ฅ๓ จ๓ ข๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E0068 U+E0062 U+E007F DE-HB Bremen -๐Ÿด๓ ค๓ ฅ๓ จ๓ ฅ๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E0068 U+E0065 U+E007F DE-HE Hesse -๐Ÿด๓ ค๓ ฅ๓ จ๓ จ๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E0068 U+E0068 U+E007F DE-HH Hamburg -๐Ÿด๓ ค๓ ฅ๓ ญ๓ ถ๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E006D U+E0076 U+E007F DE-MV Mecklenburg-Vorpommern -๐Ÿด๓ ค๓ ฅ๓ ฎ๓ ฉ๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E006E U+E0069 U+E007F DE-NI Lower Saxony -๐Ÿด๓ ค๓ ฅ๓ ฎ๓ ท๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E006E U+E0077 U+E007F DE-NW North Rhine-Westphalia -๐Ÿด๓ ค๓ ฅ๓ ฒ๓ ฐ๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E0072 U+E0070 U+E007F DE-RP Rhineland-Palatinate -๐Ÿด๓ ค๓ ฅ๓ ณ๓ จ๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E0073 U+E0068 U+E007F DE-SH Schleswig-Holstein -๐Ÿด๓ ค๓ ฅ๓ ณ๓ ฌ๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E0073 U+E006C U+E007F DE-SL Saarland -๐Ÿด๓ ค๓ ฅ๓ ณ๓ ฎ๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E0073 U+E006E U+E007F DE-SN Saxony -๐Ÿด๓ ค๓ ฅ๓ ณ๓ ด๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E0073 U+E0074 U+E007F DE-ST Saxony-Anhalt -๐Ÿด๓ ค๓ ฅ๓ ด๓ จ๓ ฟ - U+1F3F4 U+E0064 U+E0065 U+E0074 U+E0068 U+E007F DE-TH Thuringia -๐Ÿด๓ ฅ๓ ณ๓ ฃ๓ ด๓ ฟ - U+1F3F4 U+E0065 U+E0073 U+E0063 U+E0074 U+E007F ES-CT Catalonia -๐Ÿด๓ ฅ๓ ณ๓ ฐ๓ ถ๓ ฟ - U+1F3F4 U+E0065 U+E0073 U+E0070 U+E0076 U+E007F ES-PV Basque Country -๐Ÿด๓ ฆ๓ ฉ๓ €ฐ๓ €ณ๓ ฟ - U+1F3F4 U+E0066 U+E0069 U+E0030 U+E0033 U+E007F FI-03 South Ostrobothnia -๐Ÿด๓ ฆ๓ ฉ๓ €ฐ๓ €ด๓ ฟ - U+1F3F4 U+E0066 U+E0069 U+E0030 U+E0034 U+E007F FI-04 South Savonia -๐Ÿด๓ ฆ๓ ฉ๓ €ฐ๓ €ต๓ ฟ - U+1F3F4 U+E0066 U+E0069 U+E0030 U+E0035 U+E007F FI-05 Kainuu -๐Ÿด๓ ฆ๓ ฉ๓ €ฐ๓ €ถ๓ ฟ - U+1F3F4 U+E0066 U+E0069 U+E0030 U+E0036 U+E007F FI-06 Kanta-Hรคme (Tavastia Proper) -๐Ÿด๓ ฆ๓ ฉ๓ €ฐ๓ €ท๓ ฟ - U+1F3F4 U+E0066 U+E0069 U+E0030 U+E0037 U+E007F FI-07 Central Ostrobothnia -๐Ÿด๓ ฆ๓ ฉ๓ €ฐ๓ €ธ๓ ฟ - U+1F3F4 U+E0066 U+E0069 U+E0030 U+E0038 U+E007F FI-08 Central Finland -๐Ÿด๓ ฆ๓ ฉ๓ €ฑ๓ €ณ๓ ฟ - U+1F3F4 U+E0066 U+E0069 U+E0031 U+E0033 U+E007F FI-13 North Karelia -๐Ÿด๓ ฆ๓ ฉ๓ €ฑ๓ €ต๓ ฟ - U+1F3F4 U+E0066 U+E0069 U+E0031 U+E0035 U+E007F FI-15 Northern Savonia -๐Ÿด๓ ฆ๓ ฉ๓ €ฑ๓ €ถ๓ ฟ - U+1F3F4 U+E0066 U+E0069 U+E0031 U+E0036 U+E007F FI-16 Pรคijรคnne Tavastia -๐Ÿด๓ ฆ๓ ฉ๓ €ฑ๓ €ท๓ ฟ - U+1F3F4 U+E0066 U+E0069 U+E0031 U+E0037 U+E007F FI-17 Satakunta -๐Ÿด๓ ฆ๓ ฉ๓ €ฑ๓ €ธ๓ ฟ - U+1F3F4 U+E0066 U+E0069 U+E0031 U+E0038 U+E007F FI-18 Uusimaa -๐Ÿด๓ ฆ๓ ฒ๓ ก๓ ฒ๓ ก๓ ฟ - U+1F3F4 U+E0066 U+E0072 U+E0061 U+E0072 U+E0061 U+E007F FR-ARA Auvergne-Rhรดne-Alpes -๐Ÿด๓ ฆ๓ ฒ๓ ข๓ ฆ๓ ฃ๓ ฟ - U+1F3F4 U+E0066 U+E0072 U+E0062 U+E0066 U+E0063 U+E007F FR-BFC Bourgogne-Franche-Comtรฉ -๐Ÿด๓ ฆ๓ ฒ๓ ข๓ ฒ๓ ฅ๓ ฟ - U+1F3F4 U+E0066 U+E0072 U+E0062 U+E0072 U+E0065 U+E007F FR-BRE Bretagne -๐Ÿด๓ ฆ๓ ฒ๓ ฃ๓ ฏ๓ ฒ๓ ฟ - U+1F3F4 U+E0066 U+E0072 U+E0063 U+E006F U+E0072 U+E007F FR-COR Corse -๐Ÿด๓ ฆ๓ ฒ๓ ฃ๓ ถ๓ ฌ๓ ฟ - U+1F3F4 U+E0066 U+E0072 U+E0063 U+E0076 U+E006C U+E007F FR-CVL Centre-Val de Loire -๐Ÿด๓ ฆ๓ ฒ๓ ฏ๓ ฃ๓ ฃ๓ ฟ - U+1F3F4 U+E0066 U+E0072 U+E006F U+E0063 U+E0063 U+E007F FR-OCC Occitanie -๐Ÿด๓ ฆ๓ ฒ๓ ฎ๓ ก๓ ฑ๓ ฟ - U+1F3F4 U+E0066 U+E0072 U+E006E U+E0061 U+E0071 U+E007F FR-NAQ Nouvelle-Aquitaine -๐Ÿด๓ ฆ๓ ฒ๓ ฎ๓ ฏ๓ ฒ๓ ฟ - U+1F3F4 U+E0066 U+E0072 U+E006E U+E006F U+E0072 U+E007F FR-NOR Normandie -๐Ÿด๓ ฆ๓ ฒ๓ ฐ๓ ก๓ ฃ๓ ฟ - U+1F3F4 U+E0066 U+E0072 U+E0070 U+E0061 U+E0063 U+E007F FR-PAC Provence-Alpes-Cรดte-dโ€™Azur -๐Ÿด๓ ฆ๓ ฒ๓ ฐ๓ ค๓ ฌ๓ ฟ - U+1F3F4 U+E0066 U+E0072 U+E0070 U+E0064 U+E006C U+E007F FR-PDL Pays-de-la-Loire -๐Ÿด๓ ฉ๓ ฅ๓ ฌ๓ ฟ - U+1F3F4 U+E0069 U+E0065 U+E006C U+E007F IE-L Leinster -๐Ÿด๓ ฉ๓ ฅ๓ ญ๓ ฟ - U+1F3F4 U+E0069 U+E0065 U+E006D U+E007F IE-M Munster -๐Ÿด๓ ฉ๓ ฅ๓ ต๓ ฟ - U+1F3F4 U+E0069 U+E0065 U+E0075 U+E007F IE-U Ulster -๐Ÿด๓ ซ๓ ฒ๓ €ฑ๓ €ฑ๓ ฟ - U+1F3F4 U+E006B U+E0072 U+E0031 U+E0031 U+E007F KR-11 Seoul -๐Ÿด๓ ซ๓ ฒ๓ €ฒ๓ €น๓ ฟ - U+1F3F4 U+E006B U+E0072 U+E0032 U+E0039 U+E007F KR-29 Gwangju City -๐Ÿด๓ ซ๓ ฒ๓ €ณ๓ €ฐ๓ ฟ - U+1F3F4 U+E006B U+E0072 U+E0033 U+E0030 U+E007F KR-30 Daejeon -๐Ÿด๓ ซ๓ ฒ๓ €ด๓ €ฑ๓ ฟ - U+1F3F4 U+E006B U+E0072 U+E0034 U+E0031 U+E007F KR-41 Gyeonggi -๐Ÿด๓ ซ๓ ฒ๓ €ด๓ €ด๓ ฟ - U+1F3F4 U+E006B U+E0072 U+E0034 U+E0034 U+E007F KR-44 South Chungcheong -๐Ÿด๓ ซ๓ ฒ๓ €ด๓ €ถ๓ ฟ - U+1F3F4 U+E006B U+E0072 U+E0034 U+E0036 U+E007F KR-46 South Jeolla -๐Ÿด๓ ซ๓ ฒ๓ €ด๓ €ธ๓ ฟ - U+1F3F4 U+E006B U+E0072 U+E0034 U+E0038 U+E007F KR-48 South Gyeongsang -๐Ÿด๓ ซ๓ ฒ๓ €ด๓ €น๓ ฟ - U+1F3F4 U+E006B U+E0072 U+E0034 U+E0039 U+E007F KR-49 Jeju -๐Ÿด๓ ฌ๓ ฒ๓ ข๓ ญ๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E0062 U+E006D U+E007F LR-BM Bomi -๐Ÿด๓ ฌ๓ ฒ๓ ข๓ ง๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E0062 U+E0067 U+E007F LR-BG Bong -๐Ÿด๓ ฌ๓ ฒ๓ ง๓ ฐ๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E0067 U+E0070 U+E007F LR-GP Gbarpolu -๐Ÿด๓ ฌ๓ ฒ๓ ง๓ ข๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E0067 U+E0062 U+E007F LR-GB Grand Bassa -๐Ÿด๓ ฌ๓ ฒ๓ ฃ๓ ญ๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E0063 U+E006D U+E007F LR-CM Grand Cape Mount -๐Ÿด๓ ฌ๓ ฒ๓ ง๓ ง๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E0067 U+E0067 U+E007F LR-GG Grand Gedeh -๐Ÿด๓ ฌ๓ ฒ๓ ง๓ ซ๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E0067 U+E006B U+E007F LR-GK Grand Kru -๐Ÿด๓ ฌ๓ ฒ๓ ฌ๓ ฏ๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E006C U+E006F U+E007F LR-LO Lofa -๐Ÿด๓ ฌ๓ ฒ๓ ญ๓ ง๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E006D U+E0067 U+E007F LR-MG Margibi -๐Ÿด๓ ฌ๓ ฒ๓ ญ๓ ฏ๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E006D U+E006F U+E007F LR-MO Montserrado -๐Ÿด๓ ฌ๓ ฒ๓ ญ๓ น๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E006D U+E0079 U+E007F LR-MY Maryland -๐Ÿด๓ ฌ๓ ฒ๓ ฎ๓ ฉ๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E006E U+E0069 U+E007F LR-NI Nimba -๐Ÿด๓ ฌ๓ ฒ๓ ฒ๓ ฉ๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E0072 U+E0069 U+E007F LR-RI Rivercess -๐Ÿด๓ ฌ๓ ฒ๓ ฒ๓ ง๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E0072 U+E0067 U+E007F LR-RG River Gee -๐Ÿด๓ ฌ๓ ฒ๓ ณ๓ ฉ๓ ฟ - U+1F3F4 U+E006C U+E0072 U+E0073 U+E0069 U+E007F LR-SI Sinoe -๐Ÿด๓ ฎ๓ ฌ๓ ข๓ ฑ๓ €ฑ๓ ฟ - U+1F3F4 U+E006E U+E006C U+E0062 U+E0071 U+E0031 U+E007F NL-BQ1 Bonaire -๐Ÿด๓ ฎ๓ ฌ๓ ข๓ ฑ๓ €ฒ๓ ฟ - U+1F3F4 U+E006E U+E006C U+E0062 U+E0071 U+E0032 U+E007F NL-BQ2 Saba -๐Ÿด๓ ฎ๓ ฌ๓ ข๓ ฑ๓ €ณ๓ ฟ - U+1F3F4 U+E006E U+E006C U+E0062 U+E0071 U+E0033 U+E007F NL-BQ3 Sint Eustatius -๐Ÿด๓ ฎ๓ ฌ๓ ค๓ ฒ๓ ฟ - U+1F3F4 U+E006E U+E006C U+E0064 U+E0072 U+E007F NL-DR Drenthe -๐Ÿด๓ ฎ๓ ฌ๓ ฆ๓ ฌ๓ ฟ - U+1F3F4 U+E006E U+E006C U+E0066 U+E006C U+E007F NL-FL Flevoland -๐Ÿด๓ ฎ๓ ฌ๓ ฆ๓ ฒ๓ ฟ - U+1F3F4 U+E006E U+E006C U+E0066 U+E0072 U+E007F NL-FR Friesland -๐Ÿด๓ ฎ๓ ฌ๓ ง๓ ฅ๓ ฟ - U+1F3F4 U+E006E U+E006C U+E0067 U+E0065 U+E007F NL-GE Gelderland -๐Ÿด๓ ฎ๓ ฌ๓ ง๓ ฒ๓ ฟ - U+1F3F4 U+E006E U+E006C U+E0067 U+E0072 U+E007F NL-GR Groningen -๐Ÿด๓ ฎ๓ ฌ๓ ฌ๓ ฉ๓ ฟ - U+1F3F4 U+E006E U+E006C U+E006C U+E0069 U+E007F NL-LI Limburg -๐Ÿด๓ ฎ๓ ฌ๓ ฎ๓ ข๓ ฟ - U+1F3F4 U+E006E U+E006C U+E006E U+E0062 U+E007F NL-NB North Brabant -๐Ÿด๓ ฎ๓ ฌ๓ ฎ๓ จ๓ ฟ - U+1F3F4 U+E006E U+E006C U+E006E U+E0068 U+E007F NL-NH North Holland -๐Ÿด๓ ฎ๓ ฌ๓ ฏ๓ ถ๓ ฟ - U+1F3F4 U+E006E U+E006C U+E006F U+E0076 U+E007F NL-OV Overijssel -๐Ÿด๓ ฎ๓ ฌ๓ ต๓ ด๓ ฟ - U+1F3F4 U+E006E U+E006C U+E0075 U+E0074 U+E007F NL-UT Utrecht -๐Ÿด๓ ฎ๓ ฌ๓ บ๓ ฅ๓ ฟ - U+1F3F4 U+E006E U+E006C U+E007A U+E0065 U+E007F NL-ZE Zeeland -๐Ÿด๓ ฎ๓ ฌ๓ บ๓ จ๓ ฟ - U+1F3F4 U+E006E U+E006C U+E007A U+E0068 U+E007F NL-ZH South Holland -๐Ÿด๓ ฎ๓ ฏ๓ €ฐ๓ €ฑ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0030 U+E0031 U+E007F NO-01 ร˜stfold -๐Ÿด๓ ฎ๓ ฏ๓ €ฐ๓ €ฒ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0030 U+E0032 U+E007F NO-02 Akershus -๐Ÿด๓ ฎ๓ ฏ๓ €ฐ๓ €ณ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0030 U+E0033 U+E007F NO-03 Oslo -๐Ÿด๓ ฎ๓ ฏ๓ €ฐ๓ €ด๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0030 U+E0034 U+E007F NO-04 Hedmark -๐Ÿด๓ ฎ๓ ฏ๓ €ฐ๓ €ต๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0030 U+E0035 U+E007F NO-05 Oppland -๐Ÿด๓ ฎ๓ ฏ๓ €ฐ๓ €ถ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0030 U+E0036 U+E007F NO-06 Buskerud -๐Ÿด๓ ฎ๓ ฏ๓ €ฐ๓ €ท๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0030 U+E0037 U+E007F NO-07 Vestfold -๐Ÿด๓ ฎ๓ ฏ๓ €ฐ๓ €ธ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0030 U+E0038 U+E007F NO-08 Telemark -๐Ÿด๓ ฎ๓ ฏ๓ €ฐ๓ €น๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0030 U+E0039 U+E007F NO-09 Aust-Agder -๐Ÿด๓ ฎ๓ ฏ๓ €ฑ๓ €ฐ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0031 U+E0030 U+E007F NO-10 Vest-Agder -๐Ÿด๓ ฎ๓ ฏ๓ €ฑ๓ €ฑ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0031 U+E0031 U+E007F NO-11 Rogaland -๐Ÿด๓ ฎ๓ ฏ๓ €ฑ๓ €ฒ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0031 U+E0032 U+E007F NO-12 Hordaland -๐Ÿด๓ ฎ๓ ฏ๓ €ฑ๓ €ด๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0031 U+E0034 U+E007F NO-14 Fjordane -๐Ÿด๓ ฎ๓ ฏ๓ €ฑ๓ €ต๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0031 U+E0035 U+E007F NO-15 Mรธre og Romsdal -๐Ÿด๓ ฎ๓ ฏ๓ €ฑ๓ €ถ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0031 U+E0036 U+E007F NO-16 Sรธr-Trรธndelag -๐Ÿด๓ ฎ๓ ฏ๓ €ฑ๓ €ท๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0031 U+E0037 U+E007F NO-17 Nord-Trรธndelag -๐Ÿด๓ ฎ๓ ฏ๓ €ฑ๓ €ธ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0031 U+E0038 U+E007F NO-18 Nordland -๐Ÿด๓ ฎ๓ ฏ๓ €ฑ๓ €น๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0031 U+E0039 U+E007F NO-19 Troms -๐Ÿด๓ ฎ๓ ฏ๓ €ฒ๓ €ฐ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0032 U+E0030 U+E007F NO-20 Finnmark -๐Ÿด๓ ฎ๓ ฏ๓ €ฒ๓ €ฑ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0032 U+E0031 U+E007F NO-21 Svalbard -๐Ÿด๓ ฎ๓ ฏ๓ €ฒ๓ €ฒ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0032 U+E0032 U+E007F NO-22 Jan Mayen -๐Ÿด๓ ฎ๓ ฏ๓ €ฒ๓ €ณ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0032 U+E0033 U+E007F NO-23 Trรธndelag -๐Ÿด๓ ฎ๓ ฏ๓ €ณ๓ €ฐ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0033 U+E0030 U+E007F NO-30 Viken -๐Ÿด๓ ฎ๓ ฏ๓ €ณ๓ €ด๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0033 U+E0034 U+E007F NO-34 Innlandet -๐Ÿด๓ ฎ๓ ฏ๓ €ณ๓ €ธ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0033 U+E0038 U+E007F NO-38 Vestfold og Telemark -๐Ÿด๓ ฎ๓ ฏ๓ €ด๓ €ฒ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0034 U+E0032 U+E007F NO-42 Agder -๐Ÿด๓ ฎ๓ ฏ๓ €ด๓ €ถ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0034 U+E0036 U+E007F NO-46 Vestland -๐Ÿด๓ ฎ๓ ฏ๓ €ต๓ €ฐ๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0035 U+E0030 U+E007F NO-50 Trรธndelag -๐Ÿด๓ ฎ๓ ฏ๓ €ต๓ €ด๓ ฟ - U+1F3F4 U+E006E U+E006F U+E0035 U+E0034 U+E007F NO-54 Troms og Finnmark -๐Ÿด๓ ฎ๓ บ๓ ก๓ ต๓ ซ๓ ฟ - U+1F3F4 U+E006E U+E007A U+E0061 U+E0075 U+E006B U+E007F NZ-AUK Auckland -๐Ÿด๓ ฎ๓ บ๓ ฎ๓ ณ๓ ฎ๓ ฟ - U+1F3F4 U+E006E U+E007A U+E006E U+E0073 U+E006E U+E007F NZ-NSN Nelson -๐Ÿด๓ ฎ๓ บ๓ ฏ๓ ด๓ ก๓ ฟ - U+1F3F4 U+E006E U+E007A U+E006F U+E0074 U+E0061 U+E007F NZ-OTA Otago -๐Ÿด๓ ฎ๓ บ๓ ท๓ ง๓ ฎ๓ ฟ - U+1F3F4 U+E006E U+E007A U+E0077 U+E0067 U+E006E U+E007F NZ-WGN Wellington -๐Ÿด๓ ฐ๓ ก๓ €ฑ๓ ฟ - U+1F3F4 U+E0070 U+E0061 U+E0031 U+E007F PA-1 Bocas del Toro -๐Ÿด๓ ฐ๓ ก๓ €ฒ๓ ฟ - U+1F3F4 U+E0070 U+E0061 U+E0032 U+E007F PA-2 Coclรฉ -๐Ÿด๓ ฐ๓ ก๓ €ณ๓ ฟ - U+1F3F4 U+E0070 U+E0061 U+E0033 U+E007F PA-3 Colรณn -๐Ÿด๓ ฐ๓ ก๓ €ด๓ ฟ - U+1F3F4 U+E0070 U+E0061 U+E0034 U+E007F PA-4 Chiriquรญ -๐Ÿด๓ ฐ๓ ก๓ €ต๓ ฟ - U+1F3F4 U+E0070 U+E0061 U+E0035 U+E007F PA-5 Dariรฉn -๐Ÿด๓ ฐ๓ ก๓ €ถ๓ ฟ - U+1F3F4 U+E0070 U+E0061 U+E0036 U+E007F PA-6 Herrera -๐Ÿด๓ ฐ๓ ก๓ €ท๓ ฟ - U+1F3F4 U+E0070 U+E0061 U+E0037 U+E007F PA-7 Los Santos -๐Ÿด๓ ฐ๓ ก๓ €น๓ ฟ - U+1F3F4 U+E0070 U+E0061 U+E0039 U+E007F PA-9 Veraguas -๐Ÿด๓ ฐ๓ ก๓ €ฑ๓ €ฐ๓ ฟ - U+1F3F4 U+E0070 U+E0061 U+E0031 U+E0030 U+E007F PA-10 West Panamรก -๐Ÿด๓ ฐ๓ ก๓ ซ๓ น๓ ฟ - U+1F3F4 U+E0070 U+E0061 U+E006B U+E0079 U+E007F PA-KY Guna Yala -๐Ÿด๓ ฐ๓ ก๓ ฎ๓ ข๓ ฟ - U+1F3F4 U+E0070 U+E0061 U+E006E U+E0062 U+E007F PA-NB Ngรถbe-Buglรฉ -๐Ÿด๓ ณ๓ ฅ๓ ญ๓ ฟ - U+1F3F4 U+E0073 U+E0065 U+E006D U+E007F SE-M Skรฅne -๐Ÿด๓ ณ๓ ซ๓ ข๓ ฃ๓ ฟ - U+1F3F4 U+E0073 U+E006B U+E0062 U+E0063 U+E007F SK-BC Banskรก Bystrica -๐Ÿด๓ ณ๓ ซ๓ ข๓ ฌ๓ ฟ - U+1F3F4 U+E0073 U+E006B U+E0062 U+E006C U+E007F SK-BL Bratislava -๐Ÿด๓ ณ๓ ซ๓ ซ๓ ฉ๓ ฟ - U+1F3F4 U+E0073 U+E006B U+E006B U+E0069 U+E007F SK-KI Koลกice -๐Ÿด๓ ณ๓ ซ๓ ฎ๓ ฉ๓ ฟ - U+1F3F4 U+E0073 U+E006B U+E006E U+E0069 U+E007F SK-NI Nitra -๐Ÿด๓ ณ๓ ซ๓ ฐ๓ ถ๓ ฟ - U+1F3F4 U+E0073 U+E006B U+E0070 U+E0076 U+E007F SK-PV Preลกov -๐Ÿด๓ ณ๓ ซ๓ ด๓ ก๓ ฟ - U+1F3F4 U+E0073 U+E006B U+E0074 U+E0061 U+E007F SK-TA Trnava -๐Ÿด๓ ณ๓ ซ๓ ด๓ ฃ๓ ฟ - U+1F3F4 U+E0073 U+E006B U+E0074 U+E0063 U+E007F SK-TC Trenฤรญn -๐Ÿด๓ ณ๓ ซ๓ บ๓ ฉ๓ ฟ - U+1F3F4 U+E0073 U+E006B U+E007A U+E0069 U+E007F SK-ZI ลฝilina -๐Ÿด๓ ต๓ ก๓ €ฐ๓ €ต๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0030 U+E0035 U+E007F UA-05 Vinnychchyna -๐Ÿด๓ ต๓ ก๓ €ฐ๓ €ท๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0030 U+E0037 U+E007F UA-07 Volyn -๐Ÿด๓ ต๓ ก๓ €ฐ๓ €น๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0030 U+E0039 U+E007F UA-09 Luhanshchyna -๐Ÿด๓ ต๓ ก๓ €ฑ๓ €ฒ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0031 U+E0032 U+E007F UA-12 Dnipropetrovshchyna -๐Ÿด๓ ต๓ ก๓ €ฑ๓ €ด๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0031 U+E0034 U+E007F UA-14 Donechchyna -๐Ÿด๓ ต๓ ก๓ €ฑ๓ €ธ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0031 U+E0038 U+E007F UA-18 Zhytomyrshchyna -๐Ÿด๓ ต๓ ก๓ €ฒ๓ €ฑ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0032 U+E0031 U+E007F UA-21 Zakarpattia -๐Ÿด๓ ต๓ ก๓ €ฒ๓ €ณ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0032 U+E0033 U+E007F UA-23 Zaporizhzhya -๐Ÿด๓ ต๓ ก๓ €ฒ๓ €ถ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0032 U+E0036 U+E007F UA-26 Prykarpattia -๐Ÿด๓ ต๓ ก๓ €ณ๓ €ฐ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0033 U+E0030 U+E007F UA-30 Kiev -๐Ÿด๓ ต๓ ก๓ €ณ๓ €ฒ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0033 U+E0032 U+E007F UA-32 Kyivshchyna -๐Ÿด๓ ต๓ ก๓ €ณ๓ €ต๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0033 U+E0035 U+E007F UA-35 Kirovohradschyna -๐Ÿด๓ ต๓ ก๓ €ด๓ €ฐ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0034 U+E0030 U+E007F UA-40 Sevastopol -๐Ÿด๓ ต๓ ก๓ €ด๓ €ณ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0034 U+E0033 U+E007F UA-43 Crimea -๐Ÿด๓ ต๓ ก๓ €ด๓ €ถ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0034 U+E0036 U+E007F UA-46 Lvivshchyna -๐Ÿด๓ ต๓ ก๓ €ด๓ €ธ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0034 U+E0038 U+E007F UA-48 Mykolayivschyna -๐Ÿด๓ ต๓ ก๓ €ต๓ €ฑ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0035 U+E0031 U+E007F UA-51 Odeshchyna -๐Ÿด๓ ต๓ ก๓ €ต๓ €ณ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0035 U+E0033 U+E007F UA-53 Poltavshchyna -๐Ÿด๓ ต๓ ก๓ €ต๓ €ถ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0035 U+E0036 U+E007F UA-56 Rivnenshchyna -๐Ÿด๓ ต๓ ก๓ €ต๓ €น๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0035 U+E0039 U+E007F UA-59 Sumshchyna -๐Ÿด๓ ต๓ ก๓ €ถ๓ €ฑ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0036 U+E0031 U+E007F UA-61 Ternopilshchyna -๐Ÿด๓ ต๓ ก๓ €ถ๓ €ณ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0036 U+E0033 U+E007F UA-63 Kharkivshchyna -๐Ÿด๓ ต๓ ก๓ €ถ๓ €ต๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0036 U+E0035 U+E007F UA-65 Khersonshchyna -๐Ÿด๓ ต๓ ก๓ €ถ๓ €ธ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0036 U+E0038 U+E007F UA-68 Khmelnychchyna -๐Ÿด๓ ต๓ ก๓ €ท๓ €ฑ๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0037 U+E0031 U+E007F UA-71 Cherkashchyna -๐Ÿด๓ ต๓ ก๓ €ท๓ €ด๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0037 U+E0034 U+E007F UA-74 Chernihivshchyna -๐Ÿด๓ ต๓ ก๓ €ท๓ €ท๓ ฟ - U+1F3F4 U+E0075 U+E0061 U+E0037 U+E0037 U+E007F UA-77 Chernivtsi Oblast -๐Ÿด๓ ต๓ ณ๓ ก๓ ฌ๓ ฟ - U+1F3F4 U+E0075 U+E0073 U+E0061 U+E006C U+E007F US-AL Alabama -๐Ÿด๓ ต๓ ณ๓ ก๓ บ๓ ฟ - U+1F3F4 U+E0075 U+E0073 U+E0061 U+E007A U+E007F US-AZ Arizona -๐Ÿด๓ ต๓ ณ๓ ด๓ ธ๓ ฟ - U+1F3F4 U+E0075 U+E0073 U+E0074 U+E0078 U+E007F US-TX Texas -๐Ÿด๓ บ๓ ท๓ จ๓ ก๓ ฟ - U+1F3F4 U+E007A U+E0077 U+E0068 U+E0061 U+E007F ZW-HA Harare - -Emoji 15.1 ----------- -๐Ÿ”—โ€๐Ÿ’ฅ - U+1F517 U+200D U+1F4A5 BROKEN CHAIN -๐Ÿ„โ€๐ŸŸซ - U+1F344 U+200D U+1F7EB MUSHROOM (NON-POISONOUS) -๐Ÿ™‚โ€โ†• - U+1F642 U+200D U+2195 NODDING FACE -๐Ÿ™‚โ€โ†” - U+1F642 U+200D U+2194 SHAKING FACE -๐Ÿ‹โ€๐ŸŸฉ - U+1F34B U+200D U+1F7E9 LIME -๐Ÿฆโ€๐Ÿ”ฅ - U+1F426 U+200D U+1F525 PHOENIX -๐Ÿง‘โ€๐Ÿง’ - U+1F9D1 U+200D U+1F9D2 FAMILY: ADULT, CHILD -๐Ÿง‘โ€๐Ÿง‘โ€๐Ÿง’ - U+1F9D1 U+200D U+1F9D1 U+200D U+1F9D2 FAMILY: ADULT, ADULT, CHILD -๐Ÿง‘โ€๐Ÿง’โ€๐Ÿง’ - U+1F9D1 U+200D U+1F9D2 U+200D U+1F9D2 FAMILY: ADULT, CHILD, CHILD -๐Ÿง‘โ€๐Ÿง‘โ€๐Ÿง’โ€๐Ÿง’ - U+1F9D1 U+200D U+1F9D1 U+200D U+1F9D2 U+200D U+1F9D2 FAMILY: ADULT, ADULT, CHILD, CHILD - -Emoji 16 ----------- -๐Ÿซฉ - U+1FAE9 FACE WITH BAGS UNDER EYES -๐ŸซŸ - U+1FADF SPLATTER -๐Ÿช‰ - U+1FA89 HARP -๐Ÿซ† - U+1FAC6 FINGERPRINT -๐Ÿซœ - U+1FADC ROOT VEGETABLE -๐Ÿชพ - U+1FABE LEAFLESS TREE -๐Ÿช - U+1FA8F SHOVEL -๐Ÿ‡จ๐Ÿ‡ถ - U+1F1E8 U+1F1F6 CQ SARK diff --git a/Meta/CMake/unicode_data.cmake b/Meta/CMake/unicode_data.cmake index a076031dd18..3776856b004 100644 --- a/Meta/CMake/unicode_data.cmake +++ b/Meta/CMake/unicode_data.cmake @@ -14,9 +14,7 @@ string(REGEX REPLACE "([0-9]+\\.[0-9]+)\\.[0-9]+" "\\1" EMOJI_VERSION "${UCD_VER set(EMOJI_TEST_URL "https://www.unicode.org/Public/emoji/${EMOJI_VERSION}/emoji-test.txt") set(EMOJI_TEST_PATH "${UCD_PATH}/emoji-test.txt") set(EMOJI_RES_PATH "${SerenityOS_SOURCE_DIR}/Base/res/emoji") -set(EMOJI_SERENITY_PATH "${SerenityOS_SOURCE_DIR}/Base/home/anon/Documents/emoji-serenity.txt") set(EMOJI_FILE_LIST_PATH "${SerenityOS_SOURCE_DIR}/Meta/emoji-file-list.txt") -set(EMOJI_INSTALL_PATH "${CMAKE_BINARY_DIR}/Root/home/anon/Documents/emoji.txt") if (ENABLE_UNICODE_DATABASE_DOWNLOAD) remove_path_if_version_changed("${UCD_VERSION}" "${UCD_VERSION_FILE}" "${UCD_PATH}") @@ -32,23 +30,19 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD) set(EMOJI_DATA_HEADER EmojiData.h) set(EMOJI_DATA_IMPLEMENTATION EmojiData.cpp) - if (SERENITYOS) - set(EMOJI_INSTALL_ARG -i "${EMOJI_INSTALL_PATH}") - endif() - invoke_generator( "EmojiData" Lagom::GenerateEmojiData "${UCD_VERSION_FILE}" "${EMOJI_DATA_HEADER}" "${EMOJI_DATA_IMPLEMENTATION}" - arguments "${EMOJI_INSTALL_ARG}" -e "${EMOJI_TEST_PATH}" -s "${EMOJI_SERENITY_PATH}" -f "${EMOJI_FILE_LIST_PATH}" -r "${EMOJI_RES_PATH}" + arguments "${EMOJI_INSTALL_ARG}" -f "${EMOJI_FILE_LIST_PATH}" -r "${EMOJI_RES_PATH}" # This will make this command only run when the modified time of the directory changes, # which only happens if files within it are added or deleted, but not when a file is modified. # This is fine for this use-case, because the contents of a file changing should not affect # the generated emoji.txt file. - dependencies "${EMOJI_RES_PATH}" "${EMOJI_SERENITY_PATH}" "${EMOJI_FILE_LIST_PATH}" + dependencies "${EMOJI_RES_PATH}" "${EMOJI_FILE_LIST_PATH}" ) set(UNICODE_DATA_SOURCES diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp index 5e9ebc418ce..a609e84c312 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Tim Flynn + * Copyright (c) 2022-2024, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ @@ -17,161 +17,20 @@ #include struct Emoji { - size_t name { 0 }; - Optional image_path; - Unicode::EmojiGroup group; - ByteString subgroup; - u32 display_order { 0 }; + size_t image_path { 0 }; Vector code_points; - ByteString encoded_code_points; - ByteString status; size_t code_point_array_index { 0 }; }; struct EmojiData { UniqueStringStorage unique_strings; Vector emojis; - Vector emoji_file_list; + Vector emoji_file_list; }; -static void set_image_path_for_emoji(StringView emoji_resource_path, EmojiData& emoji_data, Emoji& emoji) -{ - StringBuilder builder; - - for (auto code_point : emoji.code_points) { - if (code_point == 0xfe0f) - continue; - if (!builder.is_empty()) - builder.append('_'); - builder.appendff("U+{:X}", code_point); - } - - auto file = ByteString::formatted("{}.png", builder.to_byte_string()); - auto path = ByteString::formatted("{}/{}", emoji_resource_path, file); - if (!FileSystem::exists(path)) - return; - - emoji.image_path = emoji_data.unique_strings.ensure(move(file)); -} - -static ErrorOr parse_emoji_test_data(Core::InputBufferedFile& file, EmojiData& emoji_data) -{ - static constexpr auto group_header = "# group: "sv; - static constexpr auto subgroup_header = "# subgroup: "sv; - - Array buffer; - - Unicode::EmojiGroup group; - ByteString subgroup; - u32 display_order { 0 }; - - while (TRY(file.can_read_line())) { - auto line = TRY(file.read_line(buffer)); - if (line.is_empty()) - continue; - - if (line.starts_with('#')) { - if (line.starts_with(group_header)) { - auto name = line.substring_view(group_header.length()); - group = Unicode::emoji_group_from_string(name); - } else if (line.starts_with(subgroup_header)) { - subgroup = line.substring_view(subgroup_header.length()); - } - - continue; - } - - auto status_index = line.find(';'); - VERIFY(status_index.has_value()); - - auto emoji_and_name_index = line.find('#', *status_index); - VERIFY(emoji_and_name_index.has_value()); - - Emoji emoji {}; - emoji.group = group; - emoji.subgroup = subgroup; - emoji.display_order = display_order++; - - auto code_points = line.substring_view(0, *status_index).split_view(' '); - TRY(emoji.code_points.try_ensure_capacity(code_points.size())); - - for (auto code_point : code_points) { - auto value = AK::StringUtils::convert_to_uint_from_hex(code_point); - VERIFY(value.has_value()); - - emoji.code_points.unchecked_append(*value); - } - - auto emoji_and_name = line.substring_view(*emoji_and_name_index + 1); - - auto emoji_and_name_spaces = emoji_and_name.find_all(" "sv); - VERIFY(emoji_and_name_spaces.size() > 2); - - auto name = emoji_and_name.substring_view(emoji_and_name_spaces[2]).trim_whitespace(); - emoji.name = emoji_data.unique_strings.ensure(name.to_titlecase_string()); - emoji.encoded_code_points = emoji_and_name.substring_view(0, emoji_and_name_spaces[1]).trim_whitespace(); - emoji.status = line.substring_view(*status_index + 1, *emoji_and_name_index - *status_index - 1).trim_whitespace(); - - TRY(emoji_data.emojis.try_append(move(emoji))); - } - - return {}; -} - -static ErrorOr parse_emoji_serenity_data(Core::InputBufferedFile& file, EmojiData& emoji_data) -{ - static constexpr auto code_point_header = "U+"sv; - - Array buffer; - - auto display_order = static_cast(emoji_data.emojis.size()) + 1u; - - while (TRY(file.can_read_line())) { - auto line = TRY(file.read_line(buffer)); - if (line.is_empty()) - continue; - - auto index = line.find(code_point_header); - if (!index.has_value()) - continue; - - line = line.substring_view(*index); - StringBuilder builder; - - Emoji emoji {}; - emoji.group = Unicode::EmojiGroup::SerenityOS; - emoji.display_order = display_order++; - - TRY(line.for_each_split_view(' ', SplitBehavior::Nothing, [&](auto segment) -> ErrorOr { - if (segment.starts_with(code_point_header)) { - segment = segment.substring_view(code_point_header.length()); - - auto code_point = AK::StringUtils::convert_to_uint_from_hex(segment); - VERIFY(code_point.has_value()); - - TRY(emoji.code_points.try_append(*code_point)); - } else { - if (!builder.is_empty()) - TRY(builder.try_append(' ')); - TRY(builder.try_append(segment)); - } - return {}; - })); - - auto name = builder.to_byte_string(); - if (!any_of(name, is_ascii_lower_alpha)) - name = name.to_titlecase(); - - emoji.name = emoji_data.unique_strings.ensure(move(name)); - TRY(emoji_data.emojis.try_append(move(emoji))); - } - - return {}; -} - static ErrorOr parse_emoji_file_list(Core::InputBufferedFile& file, EmojiData& emoji_data) { - HashTable seen_emojis; + HashTable seen_emojis; Array buffer; while (TRY(file.can_read_line())) { @@ -184,8 +43,28 @@ static ErrorOr parse_emoji_file_list(Core::InputBufferedFile& file, EmojiD return Error::from_errno(EEXIST); } - emoji_data.emoji_file_list.append(TRY(String::from_utf8(line))); - seen_emojis.set(emoji_data.emoji_file_list.last()); + ByteString emoji_file { line.trim_whitespace() }; + emoji_data.emoji_file_list.append(emoji_file); + seen_emojis.set(emoji_file); + + Emoji emoji; + emoji.image_path = emoji_data.unique_strings.ensure(emoji_file); + + auto emoji_basename = LexicalPath::basename(emoji_file, LexicalPath::StripExtension::Yes); + + emoji_basename.view().for_each_split_view('_', SplitBehavior::Nothing, [&](StringView code_point) { + static constexpr auto code_point_header = "U+"sv; + + VERIFY(code_point.starts_with(code_point_header)); + code_point = code_point.substring_view(code_point_header.length()); + + auto code_point_value = AK::StringUtils::convert_to_uint_from_hex(code_point); + VERIFY(code_point_value.has_value()); + + emoji.code_points.append(*code_point_value); + }); + + emoji_data.emojis.append(move(emoji)); } return {}; @@ -220,7 +99,7 @@ static ErrorOr validate_emoji(StringView emoji_resource_path, EmojiData& e return Error::from_errno(ENOENT); } - if (!emoji_data.emoji_file_list.contains_slow(lexical_path.string().view())) { + if (!emoji_data.emoji_file_list.contains_slow(lexical_path.string())) { warnln("\x1b[1;31mError!\x1b[0m Emoji entry for \x1b[35m{}\x1b[0m not found. Please check emoji-file-list.txt.", lexical_path); return Error::from_errno(ENOENT); } @@ -263,9 +142,8 @@ namespace Unicode { emoji_data.unique_strings.generate(generator); size_t total_code_point_count { 0 }; - for (auto const& emoji : emoji_data.emojis) { + for (auto const& emoji : emoji_data.emojis) total_code_point_count += emoji.code_points.size(); - } generator.set("total_code_point_count", ByteString::number(total_code_point_count)); generator.append(R"~~~( @@ -280,32 +158,16 @@ static constexpr Array s_emoji_code_points { {)~~ } } - generator.append(" } };"sv); + generator.append(" } };\n"sv); generator.append(R"~~~( struct EmojiData { - Emoji to_unicode_emoji() const - { - Emoji emoji {}; - emoji.name = decode_string(name); - if (image_path != 0) - emoji.image_path = decode_string(image_path); - emoji.group = static_cast(group); - emoji.display_order = display_order; - emoji.code_points = code_points(); - - return emoji; - } - constexpr ReadonlySpan code_points() const { return ReadonlySpan(s_emoji_code_points.data() + code_point_start, code_point_count); } - @string_index_type@ name { 0 }; @string_index_type@ image_path { 0 }; - u8 group { 0 }; - u32 display_order { 0 }; size_t code_point_start { 0 }; size_t code_point_count { 0 }; }; @@ -316,15 +178,12 @@ struct EmojiData { static constexpr Array s_emojis { {)~~~"); for (auto const& emoji : emoji_data.emojis) { - generator.set("name"sv, ByteString::number(emoji.name)); - generator.set("image_path"sv, ByteString::number(emoji.image_path.value_or(0))); - generator.set("group"sv, ByteString::number(to_underlying(emoji.group))); - generator.set("display_order"sv, ByteString::number(emoji.display_order)); + generator.set("image_path"sv, ByteString::number(emoji.image_path)); generator.set("code_point_start"sv, ByteString::number(emoji.code_point_array_index)); generator.set("code_point_count"sv, ByteString::number(emoji.code_points.size())); generator.append(R"~~~( - { @name@, @image_path@, @group@, @display_order@, @code_point_start@, @code_point_count@ },)~~~"); + { @image_path@, @code_point_start@, @code_point_count@ },)~~~"); } generator.append(R"~~~( @@ -347,10 +206,10 @@ struct EmojiCodePointComparator { } }; -Optional find_emoji_for_code_points(ReadonlySpan code_points) +Optional emoji_image_for_code_points(ReadonlySpan code_points) { if (auto const* emoji = binary_search(s_emojis, code_points, nullptr, EmojiCodePointComparator {})) - return emoji->to_unicode_emoji(); + return decode_string(emoji->image_path); return {}; } @@ -361,127 +220,55 @@ Optional find_emoji_for_code_points(ReadonlySpan code_points) return {}; } -static ErrorOr generate_emoji_installation(Core::InputBufferedFile& file, EmojiData const& emoji_data) -{ - StringBuilder builder; - SourceGenerator generator { builder }; - - auto current_group = Unicode::EmojiGroup::Unknown; - StringView current_subgroup; - - for (auto const& emoji : emoji_data.emojis) { - if (!emoji.image_path.has_value()) - continue; - if (emoji.group == Unicode::EmojiGroup::SerenityOS) - continue; // SerenityOS emojis are in emoji-serenity.txt - - if (current_group != emoji.group) { - if (!builder.is_empty()) - generator.append("\n"sv); - - generator.set("group"sv, Unicode::emoji_group_to_string(emoji.group)); - generator.append("# group: @group@\n"); - - current_group = emoji.group; - } - - if (current_subgroup != emoji.subgroup) { - generator.set("subgroup"sv, emoji.subgroup); - generator.append("\n# subgroup: @subgroup@\n"); - - current_subgroup = emoji.subgroup; - } - - generator.set("emoji"sv, emoji.encoded_code_points); - generator.set("name"sv, emoji_data.unique_strings.get(emoji.name)); - generator.set("status"sv, emoji.status); - - generator.append("@emoji@"sv); - generator.append(" - "sv); - generator.append(ByteString::join(" "sv, emoji.code_points, "U+{:X}"sv)); - generator.append(" @name@ (@status@)\n"sv); - } - - TRY(file.write_until_depleted(generator.as_string_view().bytes())); - return {}; -} - ErrorOr serenity_main(Main::Arguments arguments) { StringView generated_header_path; StringView generated_implementation_path; - StringView generated_installation_path; - StringView emoji_test_path; - StringView emoji_serenity_path; StringView emoji_file_list_path; StringView emoji_resource_path; Core::ArgsParser args_parser; args_parser.add_option(generated_header_path, "Path to the Unicode Data header file to generate", "generated-header-path", 'h', "generated-header-path"); args_parser.add_option(generated_implementation_path, "Path to the Unicode Data implementation file to generate", "generated-implementation-path", 'c', "generated-implementation-path"); - args_parser.add_option(generated_installation_path, "Path to the emoji.txt file to generate", "generated-installation-path", 'i', "generated-installation-path"); - args_parser.add_option(emoji_test_path, "Path to emoji-test.txt file", "emoji-test-path", 'e', "emoji-test-path"); - args_parser.add_option(emoji_serenity_path, "Path to emoji-serenity.txt file", "emoji-serenity-path", 's', "emoji-serenity-path"); args_parser.add_option(emoji_file_list_path, "Path to the emoji-file-list.txt file", "emoji-file-list-path", 'f', "emoji-file-list-path"); args_parser.add_option(emoji_resource_path, "Path to the /res/emoji directory", "emoji-resource-path", 'r', "emoji-resource-path"); args_parser.parse(arguments); VERIFY(!emoji_resource_path.is_empty() && FileSystem::exists(emoji_resource_path)); - - auto emoji_test_file = TRY(open_file(emoji_test_path, Core::File::OpenMode::Read)); + VERIFY(!emoji_file_list_path.is_empty() && FileSystem::exists(emoji_file_list_path)); EmojiData emoji_data {}; - TRY(parse_emoji_test_data(*emoji_test_file, emoji_data)); - if (!emoji_serenity_path.is_empty() && !emoji_file_list_path.is_empty()) { - auto emoji_serenity_file = TRY(open_file(emoji_serenity_path, Core::File::OpenMode::Read)); - TRY(parse_emoji_serenity_data(*emoji_serenity_file, emoji_data)); + auto emoji_file_list_file = TRY(open_file(emoji_file_list_path, Core::File::OpenMode::Read)); + TRY(parse_emoji_file_list(*emoji_file_list_file, emoji_data)); - auto emoji_file_list_file = TRY(open_file(emoji_file_list_path, Core::File::OpenMode::Read)); - TRY(parse_emoji_file_list(*emoji_file_list_file, emoji_data)); + TRY(validate_emoji(emoji_resource_path, emoji_data)); - TRY(validate_emoji(emoji_resource_path, emoji_data)); - } + auto generated_header_file = TRY(open_file(generated_header_path, Core::File::OpenMode::Write)); + TRY(generate_emoji_data_header(*generated_header_file, emoji_data)); - for (auto& emoji : emoji_data.emojis) - set_image_path_for_emoji(emoji_resource_path, emoji_data, emoji); + quick_sort(emoji_data.emojis, [](auto const& lhs, auto const& rhs) { + if (lhs.code_points.size() != rhs.code_points.size()) + return lhs.code_points.size() < rhs.code_points.size(); - if (!generated_installation_path.is_empty()) { - TRY(Core::Directory::create(LexicalPath { generated_installation_path }.parent(), Core::Directory::CreateDirectories::Yes)); - - auto generated_installation_file = TRY(open_file(generated_installation_path, Core::File::OpenMode::Write)); - TRY(generate_emoji_installation(*generated_installation_file, emoji_data)); - } - - if (!generated_header_path.is_empty()) { - auto generated_header_file = TRY(open_file(generated_header_path, Core::File::OpenMode::Write)); - TRY(generate_emoji_data_header(*generated_header_file, emoji_data)); - } - - if (!generated_implementation_path.is_empty()) { - quick_sort(emoji_data.emojis, [](auto const& lhs, auto const& rhs) { - if (lhs.code_points.size() != rhs.code_points.size()) - return lhs.code_points.size() < rhs.code_points.size(); - - for (size_t i = 0; i < lhs.code_points.size(); ++i) { - if (lhs.code_points[i] < rhs.code_points[i]) - return true; - if (lhs.code_points[i] > rhs.code_points[i]) - return false; - } - - return false; - }); - - size_t code_point_array_index { 0 }; - for (auto& emoji : emoji_data.emojis) { - emoji.code_point_array_index = code_point_array_index; - code_point_array_index += emoji.code_points.size(); + for (size_t i = 0; i < lhs.code_points.size(); ++i) { + if (lhs.code_points[i] < rhs.code_points[i]) + return true; + if (lhs.code_points[i] > rhs.code_points[i]) + return false; } - auto generated_implementation_file = TRY(open_file(generated_implementation_path, Core::File::OpenMode::Write)); - TRY(generate_emoji_data_implementation(*generated_implementation_file, emoji_data)); + return false; + }); + + size_t code_point_array_index { 0 }; + for (auto& emoji : emoji_data.emojis) { + emoji.code_point_array_index = code_point_array_index; + code_point_array_index += emoji.code_points.size(); } + auto generated_implementation_file = TRY(open_file(generated_implementation_path, Core::File::OpenMode::Write)); + TRY(generate_emoji_data_implementation(*generated_implementation_file, emoji_data)); + return 0; } diff --git a/Userland/Libraries/LibGfx/Font/Emoji.cpp b/Userland/Libraries/LibGfx/Font/Emoji.cpp index 8a9b75effa7..0da3b067bbf 100644 --- a/Userland/Libraries/LibGfx/Font/Emoji.cpp +++ b/Userland/Libraries/LibGfx/Font/Emoji.cpp @@ -43,25 +43,24 @@ Bitmap const* Emoji::emoji_for_code_point(u32 code_point) Bitmap const* Emoji::emoji_for_code_points(ReadonlySpan const& code_points) { - auto emoji = Unicode::find_emoji_for_code_points(code_points); - if (!emoji.has_value() || !emoji->image_path.has_value()) + auto emoji_file = Unicode::emoji_image_for_code_points(code_points); + if (!emoji_file.has_value()) return nullptr; - auto emoji_file = emoji->image_path.value(); - if (auto it = s_emojis.find(emoji_file); it != s_emojis.end()) + if (auto it = s_emojis.find(*emoji_file); it != s_emojis.end()) return it->value.ptr(); - auto emoji_path = LexicalPath::join(emoji_lookup_path(), emoji_file); + auto emoji_path = LexicalPath::join(emoji_lookup_path(), *emoji_file); auto bitmap_or_error = Bitmap::load_from_file(emoji_path.string()); if (bitmap_or_error.is_error()) { - dbgln_if(EMOJI_DEBUG, "Generated emoji data has file {}, but could not load image: {}", emoji_file, bitmap_or_error.error()); - s_emojis.set(emoji_file, nullptr); + dbgln_if(EMOJI_DEBUG, "Generated emoji data has file {}, but could not load image: {}", *emoji_file, bitmap_or_error.error()); + s_emojis.set(*emoji_file, nullptr); return nullptr; } auto bitmap = bitmap_or_error.release_value(); - s_emojis.set(emoji_file, bitmap); + s_emojis.set(*emoji_file, bitmap); return bitmap.ptr(); } diff --git a/Userland/Libraries/LibUnicode/Emoji.cpp b/Userland/Libraries/LibUnicode/Emoji.cpp index de3e18bb2ee..04cb51db8f7 100644 --- a/Userland/Libraries/LibUnicode/Emoji.cpp +++ b/Userland/Libraries/LibUnicode/Emoji.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023, Tim Flynn + * Copyright (c) 2022-2024, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ @@ -12,7 +12,7 @@ namespace Unicode { -Optional __attribute__((weak)) find_emoji_for_code_points(ReadonlySpan) { return {}; } +Optional __attribute__((weak)) emoji_image_for_code_points(ReadonlySpan) { return {}; } // https://unicode.org/reports/tr51/#def_emoji_core_sequence static bool could_be_start_of_emoji_core_sequence(u32 code_point, Optional const& next_code_point, SequenceType type) diff --git a/Userland/Libraries/LibUnicode/Emoji.h b/Userland/Libraries/LibUnicode/Emoji.h index 0104cee693a..e0ddb845b6d 100644 --- a/Userland/Libraries/LibUnicode/Emoji.h +++ b/Userland/Libraries/LibUnicode/Emoji.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023, Tim Flynn + * Copyright (c) 2022-2024, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ @@ -13,39 +13,7 @@ namespace Unicode { -enum class EmojiGroup : u8 { - Unknown, - - SmileysAndEmotion, - PeopleAndBody, - Component, - AnimalsAndNature, - FoodAndDrink, - TravelAndPlaces, - Activities, - Objects, - Symbols, - Flags, - - // Non-standard emoji added for SerenityOS: - SerenityOS, -}; - -struct Emoji { - StringView name; - Optional image_path; - EmojiGroup group { EmojiGroup::Unknown }; - u32 display_order { 0 }; - ReadonlySpan code_points; -}; - -Optional find_emoji_for_code_points(ReadonlySpan code_points); - -template -Optional find_emoji_for_code_points(u32 const (&code_points)[Size]) -{ - return find_emoji_for_code_points(ReadonlySpan { code_points }); -} +Optional emoji_image_for_code_points(ReadonlySpan code_points); enum class SequenceType { Any, @@ -55,66 +23,4 @@ enum class SequenceType { bool could_be_start_of_emoji_sequence(Utf8CodePointIterator const&, SequenceType = SequenceType::Any); bool could_be_start_of_emoji_sequence(Utf32CodePointIterator const&, SequenceType = SequenceType::Any); -constexpr StringView emoji_group_to_string(EmojiGroup group) -{ - switch (group) { - case EmojiGroup::Unknown: - return "Unknown"sv; - case EmojiGroup::SmileysAndEmotion: - return "Smileys & Emotion"sv; - case EmojiGroup::PeopleAndBody: - return "People & Body"sv; - case EmojiGroup::Component: - return "Component"sv; - case EmojiGroup::AnimalsAndNature: - return "Animals & Nature"sv; - case EmojiGroup::FoodAndDrink: - return "Food & Drink"sv; - case EmojiGroup::TravelAndPlaces: - return "Travel & Places"sv; - case EmojiGroup::Activities: - return "Activities"sv; - case EmojiGroup::Objects: - return "Objects"sv; - case EmojiGroup::Symbols: - return "Symbols"sv; - case EmojiGroup::Flags: - return "Flags"sv; - case EmojiGroup::SerenityOS: - return "SerenityOS"sv; - } - - VERIFY_NOT_REACHED(); -} - -constexpr EmojiGroup emoji_group_from_string(StringView group) -{ - if (group == "Unknown"sv) - return EmojiGroup::Unknown; - if (group == "Smileys & Emotion"sv) - return EmojiGroup::SmileysAndEmotion; - if (group == "People & Body"sv) - return EmojiGroup::PeopleAndBody; - if (group == "Component"sv) - return EmojiGroup::Component; - if (group == "Animals & Nature"sv) - return EmojiGroup::AnimalsAndNature; - if (group == "Food & Drink"sv) - return EmojiGroup::FoodAndDrink; - if (group == "Travel & Places"sv) - return EmojiGroup::TravelAndPlaces; - if (group == "Activities"sv) - return EmojiGroup::Activities; - if (group == "Objects"sv) - return EmojiGroup::Objects; - if (group == "Symbols"sv) - return EmojiGroup::Symbols; - if (group == "Flags"sv) - return EmojiGroup::Flags; - if (group == "SerenityOS"sv) - return EmojiGroup::SerenityOS; - - VERIFY_NOT_REACHED(); -} - } diff --git a/Userland/Libraries/LibUnicode/Forward.h b/Userland/Libraries/LibUnicode/Forward.h index 57f3d284f55..51e69a407e3 100644 --- a/Userland/Libraries/LibUnicode/Forward.h +++ b/Userland/Libraries/LibUnicode/Forward.h @@ -12,7 +12,6 @@ namespace Unicode { enum class BidiClass; -enum class EmojiGroup : u8; struct CurrencyCode; struct Emoji;