lottie: Fix invalid font match

When Lottie has similar font names, it incorrectly matches fonts due to a logic bug.

This error causes an infinite loop when searching for glyphs.
This commit is contained in:
Jinny You 2024-06-05 10:33:34 +09:00 committed by Hermet Park
parent 91187cd963
commit 97a1aa136a

View file

@ -1306,7 +1306,7 @@ static void _attachFont(LottieComposition* comp, LottieLayer* parent)
for (uint32_t i = 0; i < comp->fonts.count; ++i) {
auto font = comp->fonts[i];
auto len2 = strlen(font->name);
if (!strncmp(font->name, doc.name, len < len2 ? len : len2)) {
if (len == len2 && !strcmp(font->name, doc.name)) {
text->font = font;
break;
}