mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-25 07:39:02 +00:00
svg_loader: fix the inifite loop bug when size has 'em' unit.
svg may have 'em' unit for fonts, strtof() must handle this case to not drop in the infinite loop. Yet thorvg doesn't support font feature in svg, it must multiply values with font size if those values have 'em' size. @Issue: https://github.com/Samsung/thorvg/issues/488
This commit is contained in:
parent
38fa5107bf
commit
6a79d2c06e
1 changed files with 9 additions and 3 deletions
|
@ -26,7 +26,6 @@
|
|||
#include <errno.h>
|
||||
#include "tvgSvgUtil.h"
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* Internal Class Implementation */
|
||||
/************************************************************************/
|
||||
|
@ -163,14 +162,21 @@ float svgUtilStrtof(const char *nPtr, char **endPtr)
|
|||
unsigned int expo_part;
|
||||
int minus_e;
|
||||
|
||||
iter++;
|
||||
++iter;
|
||||
|
||||
//Exception: svg may have 'em' unit for fonts. ex) 5em, 10.5em
|
||||
if ((*iter == 'm') || (*iter == 'M')) {
|
||||
//TODO: We don't support font em unit now, but has to multiply val * font size later...
|
||||
a = iter + 1;
|
||||
goto on_success;
|
||||
}
|
||||
|
||||
//signed or not
|
||||
minus_e = 1;
|
||||
if (*iter == '-')
|
||||
{
|
||||
minus_e = -1;
|
||||
iter++;
|
||||
++iter;
|
||||
}
|
||||
else if (*iter == '+') iter++;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue