Wikipedia talk:WikiProject Chemistry/Structure drawing workgroup/Mysid's script

From Wikipedia, the free encyclopedia

This is a script originally written by User:Mysid and hacked by me (User:Slashme) to re-write the SVGs produced by BKchem for use by librsvg. It is still rough around the edges in the implementation, but I have used it for a few drawings already, and all of them have come out of the script in a form that is immediately uploadable and properly interpreted by librsvg. Sometimes the text is slightly misplaced, because BKchem can't know exactly what font will be used on the server, so you might have to adjust label positions with inkscape after drawing the structure.

What it does is:

  • Changes all text in "Helvetica" to "Sans", because that's a generic font that should work everywhere
  • Rounds off dimensions to save space (this can make a very noticeable difference to file-size and readability. It is easy to tweak the script to round off more or less if required.)
  • Changes subscripts and superscripts to <tspan> elements to work around a librsvg bug
  • Lumps some drawing elements into the same group where easily detectible to save space.

I removed the code that auto-crops the image, because there is a setting in BKchem that does that (under "File -> File properties")

The script should be phased out in the medium term, as the incompatibilities between BKchem and librsvg are purely due to librsvg's still incomplete implementation of the svg standard, and the cropping and boundaries can actually be done in BKchem; they're just done by the script for convenience. --Slashme 08:25, 25 October 2007 (UTC)