bugBKChem - Bugs: bug #30729, Feature Request: Make BKchem...

 
 

bug #30729: Feature Request: Make BKchem output more compatible with wikimedia's librsvg

Submitter:  David Eccles (gringer) <gringer>
Submitted:  Tue 10 Aug 2010 03:31:59 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  export Status:  In Progress
Privacy:  Public Assigned to:  abadar
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 11 Aug 2010 02:24:20 PM UTC, comment #1: 

Hi!

Thank you for this report! Already for some time I intended to make SVG files to render properly. Although at this point it is not very clear whether these changes just account for deficiencies in SVG engines or are really required by the spec. Whatever the case, these changes indeed make them render as expected in all the cases I've tested.

Some comments on your points:
1. 1) This probably is a bug in SVG engine. Firefox and Inkscape do well without this, but Gnome Image Viewer exhibits the same behavior as you describe.

2. 2) - again, probably a bug in engine. Firefox and Inkscape works as expected, but Gnome Image Viewer fails to find the correct reference size and the font turns out huge.

3. Vertical character shifts seems to be working in all of the applications I looked at, but it is kind of manual way of sub-/superscripting which has to be coupled with font size change. (Gives the best result)

4. Baseline shifts are not implemented in most of them (it is coming in Inkscape 0.48) and where it is, different values for shifts and font scaling are used, because it is not strictly defined in the SVG specification.

So basically it should work already as it is, but because of the lacking SVG support in different applications it makes sense to make some compromise. This probably should be optional feature, which users can enable in file settings. I'll be looking into this.

You should probably report this also as bug to developers of librsvg if there isn't already such a report.


Cheers,
Reinis

Reinis Danne <abadar>
Group administrator
Tue 10 Aug 2010 03:31:59 PM UTC, original submission:  

I drew the attached SVG file in BKchem, but needed to modify it slightly in order to get it to display properly in wikimedia. A script has been written to fix this (see attached perl script), but I think it would be nice to find some way to make the modifications from within BKchem. I was led to this script by Leyo on wikipedia:

http://en.wikipedia.org/wiki/User_talk:DMacks#Re:_Image_Problem

The modifications I needed to make were as follows:
1) Put &lt;tspan&gt; blocks around any text that followed a font change.
2) Change relative font sizes (75%) into absolute font sizes (16pt) for subscript.
3) Use vertical character shifts (+4) rather than baseline shifts (baseline-shift="sub") for subscript, and then do the inverse shift for the next text element (-4).

Notes on the above:

1) It seems like wikimedia's librsvg (and Emacs', FWIW) puts all the &lt;tspan&gt;s after the other text, so if you have CH_3CH_2COOH, it appears as CHCHCOOH_3_2 when converted. I notice that the git version I downloaded just before submitting this report puts a &lt;tspan&gt; around all the text, but that doesn't seem to change anything.

2-3) It looks like the same is also necessary for superscripts as well.

The script does font substitutions as well (which are merely a template adjustment away, so no code changes necessary), and "removes redundant groups", which doesn't seem all that useful except to save a few bytes in file size.

BTW, it's really excellent that I am able to do this -- change output, but keep the source file compatible with BKchem.

Cheers,

David Eccles (gringer)

David Eccles (gringer) <gringer>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #21182:  bkchem2wkikpedia.pl added by gringer (2KiB - text/x-perl - Example SVG, and perl script to make changes for better viewing on wikipedia)
file #21183:  De-epoxidation.svg added by gringer (16KiB - image/svg+xml - Example SVG, and perl script to make changes for better viewing on wikipedia)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by abadar (Updated the item)
  • -email is unavailable- added by gringer (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-08-11 abadar StatusNone In Progress
    2010-08-11 abadar Assigned toNone abadar
    2010-08-10 gringer Attached File- Added bkchem2wkikpedia.pl, #21182
        Attached File- Added De-epoxidation.svg, #21183

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code