Re: [Rdkit-discuss] svg differences and rendering in Browser
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
From: hari j. <ha...@gm...> - 2013-11-16 17:13:42
|
Thanks to Vasiliy Faronov on Stack Overflow, I was able to understand whats going on. It seems that on OSX the version of cairo I have with RDKIT from head(69cf6af68554e83) produces xhtm-ized svg. On Ubuntu the cairo produces de-xhtml-ized svg. De-xhtml-ized svg <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="300pt" height="300pt" viewBox="0 0 300 300" version="1.1"><defs><g><symbol overflow="visible" id="glyph0-0"><path style="stroke:none;" d="M 0.40625 1.421875 L 0.40625 -5.640625 L 4.40625 -5.640625 L 4.40625 1.421875 Z M 0.84375 0.96875 L 3.953125 0.96875 L 3.953125 -5.1875 L 0.84375 -5.1875 Z "/></symbol><symbol overflow="visible" id="glyph0-1"><path style="stroke:none;" d="M 0.78125 -5.828125 L 1.84375 -5.828125 L 4.4375 -0.953125 L 4.4375 -5.828125 L 5.203125 -5.828125 L 5.203125 0 L 4.140625 0 L 1.546875 -4.875 L 1.546875 0 L 0.78125 0 Z "/></symbol><symbol overflow="visible" id="glyph0-2"><path style="stroke:none;" d="M 0.78125 -5.828125 L 1.578125 xhtml-ized-svg <svg:svg version="1.1" baseProfile="full" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="300px" height="300px" ><svg:line x1="114.41" y1="132.42" x2="130.03" y2="146.44" stroke="rgb(0,0,0)" stroke-width="1"></svg:line><svg:line x1="113.56" y1="136.50" x2="126.06" y2="147.72" stroke="rgb(0,0,0)" stroke-width="1"></svg:line> <svg:line x1="87.26" y1="137.68" x2="96.45" Since I am trying to use the svg inline with an html document with content-type:text/html The browsers were not able to handle the namespace switching required. Vasiliy suggested a hack or an elegant switch with an xml library. svg_string = svg_string.replace(u'svg:', u'').replace(u'xmlns:svg', u'xmlns') I will have to handle the namespace change externally in my code. Thanks Hari On Sat, Nov 16, 2013 at 9:16 AM, hari jayaram <ha...@gm...> wrote: > Hi all > Sorry to redirect to a stackoverflow question . > > > http://stackoverflow.com/questions/20017780/django-dev-server-does-not-serve-svg-only-text-alphabets-show-up > > Briefly: different versions of rdkit give different looking svg, One works > and One doesnt ..inline in a web page and I want to know why > > Thanks for your help > > Hari > |