From: Rajarshi G. <rg...@in...> - 2008-09-26 13:50:44
|
On Sep 26, 2008, at 9:47 AM, gilleain torrance wrote: > True, but the problem will /really/ go away if the code does something > like this (pseudocode): > > at = getAffineTransform() > graphics.setTransform(at) > x, y = atom.point2d() > if (shouldDrawLabel(atom)): g.drawString(a.getLabel(), x, y) > else: // well, actually nothing, since this is a normal carbon > > this way, the font is scaled /by the graphics transform/. In tests on > osx, this works just fine. Of course, you also have to paint the > backing for the label, to cover any lines, and there is the mass > number, charge, etc. But the principle is the same. > > As a side-effect, the renderer would be much easier to read :) Can you send a patch for me to check on Linux? ------------------------------------------------------------------- Rajarshi Guha <rg...@in...> GPG Fingerprint: D070 5427 CC5B 7938 929C DD13 66A1 922C 51E7 9E84 ------------------------------------------------------------------- A committee is a life form with six or more legs and no brain. -- Lazarus Long, "Time Enough For Love" |
From: Rajarshi G. <rg...@in...> - 2008-09-26 13:54:08
|
On Sep 26, 2008, at 9:29 AM, gilleain torrance wrote: > Hi, > > It's even weirder than that, it reverses the order of the string - so > this is not noticable for single letters, but "Cl" comes out as "lC" > (el-cee). :( But the problem will go away I think, if in Java2DRenderer.paintAtomSymbols(...), you do not apply the affine transform to fontAtom via deriveFont (line 287). But then the behavior on Linux will break. As far as I can tell, this is an issue with Apple's Java ------------------------------------------------------------------- Rajarshi Guha <rg...@in...> GPG Fingerprint: D070 5427 CC5B 7938 929C DD13 66A1 922C 51E7 9E84 ------------------------------------------------------------------- Every nonzero finite dimensional inner product space has an orthonormal basis. It makes sense, when you don't think about it. |
From: gilleain t. <gil...@gm...> - 2008-09-26 13:47:48
|
True, but the problem will /really/ go away if the code does something like this (pseudocode): at = getAffineTransform() graphics.setTransform(at) x, y = atom.point2d() if (shouldDrawLabel(atom)): g.drawString(a.getLabel(), x, y) else: // well, actually nothing, since this is a normal carbon this way, the font is scaled /by the graphics transform/. In tests on osx, this works just fine. Of course, you also have to paint the backing for the label, to cover any lines, and there is the mass number, charge, etc. But the principle is the same. As a side-effect, the renderer would be much easier to read :) gilleain On Fri, Sep 26, 2008 at 2:37 PM, Rajarshi Guha <rg...@in...> wrote: > > On Sep 26, 2008, at 9:29 AM, gilleain torrance wrote: > >> Hi, >> >> It's even weirder than that, it reverses the order of the string - so >> this is not noticable for single letters, but "Cl" comes out as "lC" >> (el-cee). :( > > But the problem will go away I think, if in > Java2DRenderer.paintAtomSymbols(...), you do not apply the affine transform > to fontAtom via deriveFont (line 287). But then the behavior on Linux will > break. > > As far as I can tell, this is an issue with Apple's Java > > ------------------------------------------------------------------- > Rajarshi Guha <rg...@in...> > GPG Fingerprint: D070 5427 CC5B 7938 929C DD13 66A1 922C 51E7 9E84 > ------------------------------------------------------------------- > Every nonzero finite dimensional inner product > space has an orthonormal basis. > It makes sense, when you don't think about it. > > > |
From: Rajarshi G. <rg...@in...> - 2008-09-26 14:10:48
|
On Sep 26, 2008, at 5:58 AM, gilleain torrance wrote: > Hi, > > I tried the code you have on your site with the patched Java2DRenderer > on OSX (quite a specific situation!) and you are right, it doesn't > show the atom labels. However, if you comment out the line: > > GeometryTools.scaleMolecule(molecule, getPreferredSize(), > this.scale); > > then it does work. Neatly enough, this was the line that 'fixed' it > for me in the non-patched renderer. I sense a pattern here... Hmm, with the patched renderer and removing the above line of code - it works quite nicely on Linux. But for OS X I get atom labels - but they are flipped about the X-axis and translated left of their expected positions. I'm running OS X Tiger (10.4.11) with JDK 1.5.0_16 (i.e., the Apple version) ------------------------------------------------------------------- Rajarshi Guha <rg...@in...> GPG Fingerprint: D070 5427 CC5B 7938 929C DD13 66A1 922C 51E7 9E84 ------------------------------------------------------------------- If you don't get a good night kiss, you get Kafka dreams." -Hobbes |
From: gilleain t. <gil...@gm...> - 2008-09-26 14:10:40
|
Ha! I would, if I had such a patch. I will have to re-write the renderer first :) I'll give it a go over the weekend, as I need to understand what it is doing in the paintAtomSymbol method anyway. At the moment, my refactoring has 3 temporary methods with 15-17 arguments each... gilleain On Fri, Sep 26, 2008 at 2:50 PM, Rajarshi Guha <rg...@in...> wrote: > > On Sep 26, 2008, at 9:47 AM, gilleain torrance wrote: > >> True, but the problem will /really/ go away if the code does something >> like this (pseudocode): >> >> at = getAffineTransform() >> graphics.setTransform(at) >> x, y = atom.point2d() >> if (shouldDrawLabel(atom)): g.drawString(a.getLabel(), x, y) >> else: // well, actually nothing, since this is a normal carbon >> >> this way, the font is scaled /by the graphics transform/. In tests on >> osx, this works just fine. Of course, you also have to paint the >> backing for the label, to cover any lines, and there is the mass >> number, charge, etc. But the principle is the same. >> >> As a side-effect, the renderer would be much easier to read :) > > Can you send a patch for me to check on Linux? > > ------------------------------------------------------------------- > Rajarshi Guha <rg...@in...> > GPG Fingerprint: D070 5427 CC5B 7938 929C DD13 66A1 922C 51E7 9E84 > ------------------------------------------------------------------- > A committee is a life form with six or more legs and no brain. > -- Lazarus Long, "Time Enough For Love" > > > |