Merge pull request #116 from porglezomp-misc/master
Parse <svg> percentage width for automatic sizing
This commit is contained in:
commit
06c1f0f3bb
@ -2494,9 +2494,9 @@ static void nsvg__parseSVG(NSVGparser* p, const char** attr)
|
|||||||
for (i = 0; attr[i]; i += 2) {
|
for (i = 0; attr[i]; i += 2) {
|
||||||
if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) {
|
if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) {
|
||||||
if (strcmp(attr[i], "width") == 0) {
|
if (strcmp(attr[i], "width") == 0) {
|
||||||
p->image->width = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 1.0f);
|
p->image->width = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f);
|
||||||
} else if (strcmp(attr[i], "height") == 0) {
|
} else if (strcmp(attr[i], "height") == 0) {
|
||||||
p->image->height = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 1.0f);
|
p->image->height = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f);
|
||||||
} else if (strcmp(attr[i], "viewBox") == 0) {
|
} else if (strcmp(attr[i], "viewBox") == 0) {
|
||||||
sscanf(attr[i + 1], "%f%*[%%, \t]%f%*[%%, \t]%f%*[%%, \t]%f", &p->viewMinx, &p->viewMiny, &p->viewWidth, &p->viewHeight);
|
sscanf(attr[i + 1], "%f%*[%%, \t]%f%*[%%, \t]%f%*[%%, \t]%f", &p->viewMinx, &p->viewMiny, &p->viewWidth, &p->viewHeight);
|
||||||
} else if (strcmp(attr[i], "preserveAspectRatio") == 0) {
|
} else if (strcmp(attr[i], "preserveAspectRatio") == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user