Skip to content

Commit

Permalink
SVG Parser: get 'stroke-width' attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Oct 2, 2024
1 parent 188aa78 commit be7d7cc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/svgimporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,18 @@ void BoxSvgAttributes::loadBoundingBoxAttributes(const QDomElement &element) {
const QString strokeOp = element.attribute("stroke-opacity");
if(!strokeOp.isEmpty()) mFillAttributes.setColorOpacity(toDouble(strokeOp));

const QString strokeWidth = element.attribute("stroke-width").simplified();
if (mStrokeAttributes.getPaintType() != NOPAINT) {
if (strokeWidth.isEmpty() || strokeWidth.contains("%")) {
if (mStrokeAttributes.getLineWidth() < 1.0) {
mStrokeAttributes.setLineWidth(1.0); // spec says 1 as default
}
// TODO: A percentage value is always computed as a percentage of the normalized viewBox diagonal length.
} else {
mStrokeAttributes.setLineWidth(stripPx(strokeWidth).simplified().toDouble());
}
}

const QString matrixStr = element.attribute("transform");
// const QString transCenterX = element.attribute("inkscape:transform-center-x");
// const QString transCenterY = element.attribute("inkscape:transform-center-y");
Expand Down

0 comments on commit be7d7cc

Please sign in to comment.