From e55989120ebf272f7ca6f6222ad729b15daf58ca Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Mon, 9 Oct 2023 05:51:36 +0300 Subject: [PATCH] NanoSVG: parse 'class' attribute before 'style'. (cherry picked from commit 64a64f5216a5e57b5803e095032afef02ea5e63b) --- thirdparty/nanosvg/nanosvg.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/thirdparty/nanosvg/nanosvg.cpp b/thirdparty/nanosvg/nanosvg.cpp index 708a79c423..af10cb7c4d 100644 --- a/thirdparty/nanosvg/nanosvg.cpp +++ b/thirdparty/nanosvg/nanosvg.cpp @@ -2667,18 +2667,30 @@ static void nsvg__parsePath( NSVGparser* p, const char** attr ) int i; char item[64]; + for( i = 0; attr[i]; i += 2 ) + { + if( strcmp( attr[i], "class" ) == 0 ) + { + tmp[0] = attr[i]; + tmp[1] = attr[i + 1]; + tmp[2] = 0; + tmp[3] = 0; + nsvg__parseAttribs( p, tmp ); + } + } + for( i = 0; attr[i]; i += 2 ) { if( strcmp( attr[i], "d" ) == 0 ) { s = attr[i + 1]; } - else + else if( strcmp( attr[i], "class" ) != 0 ) { - tmp[0] = attr[i]; - tmp[1] = attr[i + 1]; - tmp[2] = 0; - tmp[3] = 0; + tmp[0] = attr[i]; + tmp[1] = attr[i + 1]; + tmp[2] = 0; + tmp[3] = 0; nsvg__parseAttribs( p, tmp ); } }