Getting stroke info from DrawablePath created by .svg


I am trying to retrieve stroke info from a .svg created DrawablePath (the element I am looking at is a simple svg <rect>):

if (const auto frame= dynamic_cast<juce::DrawableShape*>(layout->findChildWithID("frame")))
	std::clog<<__FUNCTION__<<" "<<layout->getComponentID()<<
		": fill:"<<std::hex<<frame->getFill().fill.colour.getARGB()<<
		" stroke:"<<frame->getStrokeFill().fill.colour.getARGB()<<
		" border:"<<std::dec<<frame->getStrokeType().getStrokeThickness()<<

While frame->getFill().fill.colour.getARGB() seems to return something usefull frame->getStrokeFill() doesn’t. (thickness is always 0; color is always ff000000).
How can I retrieve the stroke color and thickness (for a simple stroke).


I’m not sure what’s going wrong there. If I do

    String svgData = R"|(
        <svg width="400" height="200" xmlns="">
        <rect id="frame" fill="#6D97AB" stroke="#6DAA16" stroke-width="10" x="62" y="51" width="289" height="100"/>
    ScopedPointer<XmlElement> svgXml (XmlDocument::parse (svgData));
    layout = Drawable::createFromSVG (*svgXml);

then your code prints

TestComponent : fill:ff6d97ab stroke:ff6daa16 border:10

so it’s working for me.


Thanks, t0m,
for verifying!
I am not an English native speaker, so I am really untapped here: But it seems the issue I encountered is because JUCE is British, isn’t it?:
JUCE’ .svg parser understands stroke=“grey” while it doesn’t stroke=“gray” though the .svg spec allows both… I am fine going with “grey” from now on… :slight_smile: The consequence was that also the stroke-width wasn’t set as it was with stroke=“none”.