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

 
 

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

Submitted by:  David Eccles (gringer) <gringer>
Submitted on:  Tue 10 Aug 2010 03:31:59 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: exportStatus: In Progress
Privacy: PublicAssigned to: Reinis Danne <abadar>
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project AdministratorIn charge of this item.
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 File(s):
   
   
Comment:
   

Attached Files
file #21182:  bkchem2wkikpedia.pl added by gringer (2kB - text/x-perl - Example SVG, and perl script to make changes for better viewing on wikipedia)
file #21183:  De-epoxidation.svg added by gringer (16kB - 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
  • -unavailable- added by abadar (Updated the item)
  • -unavailable- added by gringer (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 11 Aug 2010 02:24:20 PM UTCabadarStatusNone=>In Progress
    Wed 11 Aug 2010 10:43:34 AM UTCabadarAssigned toNone=>abadar
    Tue 10 Aug 2010 03:31:59 PM UTCgringerAttached File-=>Added bkchem2wkikpedia.pl, #21182
      Attached File-=>Added De-epoxidation.svg, #21183

    Back to the top


    Powered by Savane 3.1-cleanup