[Rdkit-devel] SVG font size problem
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Cyrus H. <cyr...@gm...> - 2015-05-16 17:58:46
|
So (now that I've gotten the basics working on MacOS) I have a little
python program that generates an image from a SMILES string:
#!/usr/bin/env python
import argparse, sys
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import Draw
from rdkit.Chem.Draw.MolDrawing import MolDrawing
from rdkit.Chem.Draw.MolDrawing import DrawingOptions
parser = argparse.ArgumentParser()
parser.add_argument('-s', "--smiles", nargs='?', help="input smiles")
parser.add_argument('-o', "--output", type=str, default=sys.stdout)
args = parser.parse_args()
smiles = args.smiles
mol = AllChem.MolFromSmiles(smiles)
options = DrawingOptions()
options.atomLabelFontSize = 18
options.atomLabelFontFace = "sans"
Draw.MolToFile(mol,args.output,size=(300,300),options=options)
Everything works as expected for PDF and PNG files:
e.g.
./draw-test.py -s "N[C@@H](C(C)C)C(O)=O" -o ~/tmp/valine.pdf
looks fine. But if I try that as a PDF, I get a big mess where the font
size is enormous (>100 pt) and the glyph isn't placed right.
This sounds similar to the problem described here:
http://sourceforge.net/p/rdkit/mailman/message/26208338/
although that seems to be some sort of Adobe problem.
I've tried a similar example (a couple of weeks, on a slightly earlier
version of Rdkit) on a different computer (running linux) and things look
good. Perhaps this is once again some library installation/configuration
issue, but I'm not sure what would be causing the problem.
Any ideas?
thanks,
Cyrus
|