mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
LibUnicode: Read emoji file title from LexicalPath directly
... rather than taking the whole file name, and then manually trimming the extension off.
This commit is contained in:
parent
2d45e1fca5
commit
8672b380f6
Notes:
sideshowbarker
2024-07-17 10:39:39 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/8672b380f6 Pull-request: https://github.com/SerenityOS/serenity/pull/17871 Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 4 additions and 6 deletions
|
@ -180,14 +180,12 @@ static ErrorOr<void> validate_emoji(StringView emoji_resource_path, EmojiData& e
|
|||
if (lexical_path.extension() != "png")
|
||||
continue;
|
||||
|
||||
auto basename = lexical_path.basename();
|
||||
if (!basename.starts_with("U+"sv))
|
||||
continue;
|
||||
|
||||
basename = basename.substring_view(0, basename.length() - lexical_path.extension().length() - 1);
|
||||
auto title = lexical_path.title();
|
||||
if (!title.starts_with("U+"sv))
|
||||
return IterationDecision::Continue;
|
||||
|
||||
Vector<u32> code_points;
|
||||
TRY(basename.for_each_split_view('_', SplitBehavior::Nothing, [&](auto segment) -> ErrorOr<void> {
|
||||
TRY(title.for_each_split_view('_', SplitBehavior::Nothing, [&](auto segment) -> ErrorOr<void> {
|
||||
auto code_point = AK::StringUtils::convert_to_uint_from_hex<u32>(segment.substring_view(2));
|
||||
VERIFY(code_point.has_value());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue