xml - How to define SVG to render both fill and stroke? -
i have svg-file code provided below , has fill , stroke parameters. use svg in external app (mapnik) modify change number of parameters fill colour, stroke colour , stroke shape. unfortunately when view svg in simple viewer, either fill or stroke rendered, depending on defined first. tried reorder <g>
tags , place </g>
@ different places wasn't able achieve goal - render both fill , stroke @ same time. how should modify svg code desired result?
<?xml version="1.0" encoding="utf-8" standalone="no"?> <svg width="22.5778mm" height="22.5778mm" viewbox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.2" baseprofile="tiny"> <title>svg vector primitive</title> <desc>an svg drawing created qsvggenerator </desc> <defs> </defs> <g fill="#000000" fill-opacity="1" stroke="none" transform="matrix(20,0,0,20,32,32)" font-family="helvetica" font-size="12" font-weight="400" font-style="normal" > <g fill="none" stroke="black" stroke-width="0.2" fill-rule="evenodd" stroke-linecap="square" stroke-linejoin="bevel" > <path vector-effect="non-scaling-stroke" fill-rule="evenodd" d="m-0.224514,-0.309017 l-0.951057,-0.309017 l-0.363271,0.118034 l-0.587785,0.809017 l0,0.381966 l0.587785,0.809017 l0.363271,0.118034 l0.951057,-0.309017 l0.224514,-0.309017 l0,-1 l-0.224514,-0.309017"/> </g> </g> </svg>
you have nested <g>
elements each <g>
element defines both fill , stroke. fill , stroke of inner <g>
element take priority. in example, inner <g>
element has fill="none" , stroke="black". thus, no fill painted (as robert longson pointed out in comments). if reversed order of <g>
elements inner element have fill="#000000" , stroke="none". in case, no stroke painted.
if want define fill , stroke @ different levels of <g>
elements remove "none" setting on inner <g>
element not on write corresponding setting on outer <g>
element. example...
<?xml version="1.0" encoding="utf-8" standalone="no"?> <svg width="22.5778mm" height="22.5778mm" viewbox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.2" baseprofile="tiny"> <title>svg vector primitive</title> <desc>an svg drawing created qsvggenerator </desc> <defs> </defs> <g fill="#000000" fill-opacity="1" stroke="none" transform="matrix(20,0,0,20,32,32)" font-family="helvetica" font-size="12" font-weight="400" font-style="normal" > <g stroke="black" stroke-width="0.2" fill-rule="evenodd" stroke-linecap="square" stroke-linejoin="bevel" > <path vector-effect="non-scaling-stroke" fill-rule="evenodd" d="m-0.224514,-0.309017 l-0.951057,-0.309017 l-0.363271,0.118034 l-0.587785,0.809017 l0,0.381966 l0.587785,0.809017 l0.363271,0.118034 l0.951057,-0.309017 l0.224514,-0.309017 l0,-1 l-0.224514,-0.309017"/> </g> </g> </svg>
Comments
Post a Comment