MTextBox- autosize / fixed sized behaviour

User c1499b3d95

23-02-2012 18:06:19

Hello,


Ruchir here from IDBS.


I am trying to read and write MTextBox to and from MRV in CML format. The issues that I am getting are with the size of the bounding boxes of the text box not being accurate when reading or writing and then displaying it in our IDBS Chemistry Java Renderer:





Writing to MRV: The above text box or attached Figure 1.png, has Arial 10 as font size, is displayed and wrapped correctly at 100% zoom . I then wrote this file out into MRV format which have the below metioned MPoints (attached as Text1 - IDBS.MRV):


      <MPoint x="-18.6412" y="12.0101" />
      <MPoint x="-3.71645" y="12.0101" />
      <MPoint x="-3.71645" y="1.15207" />
      <MPoint x="-18.6412" y="1.15207" />


If I opened this file in MarvinSketch - the text is cut off:



As you can see, the text has now been cut off! Everything after valin till the end is in the text box but not displayed - you would have to resize it again. These are the text box sizes / font size that we also write out for CDX and SKC file formats and they render correctly in Symyx Draw &  ChemDraw, however I cannot get the size to be accurate such that when autosize=false, the full text box is displayed - I cannot see what I have done wrong. Also note that the width is also not accurate, it is smaller when displayed in MarvinSketch. Is there a factor that you add/remove in the bounds?


Also note that if you manually resize text from Symyx Draw & ChemDraw and paste it into MarvinSketch, they also don't render accurately as they were in their respective editors before. Symyx ones do not have the width property accurately shown, and ChemDraw ones that have a fixed width, are actually fully autosized, so they do not wrap at all.


 







Reading MRV:








Similarly, if I create a nicely sized text box in MarvinSketch and try to read and render, I am finding that the size of the bounding box is too big, both width and height (height is bigger). If I open Text1.mrv, and render the size given with the valid font size, I get the below (attached as  Figure 3.png): 


I think whilst reading and writing, maybe there is a different scale factor or padding that is being added by MarvinSketch?



Any help is much appreciated.



Many thanks,

Ruchir Sanghavi

IDBS

ChemAxon 5433b8e56b

02-03-2012 16:12:57

Hi Ruchir,


I can confirm, there is an issue with the rendering of text boxes, i have filed a bug report to our issue tracking system. Can you please also send us the cdx and skc format of this test case generated by Chemdraw and SymyxDraw, to validate marvin against them also?


Please also inform us, how important and urgent to have this fix for you.


Thank you for the report.


Regards,
Istvan

User c1499b3d95

02-03-2012 17:03:08

Hi Istvan,


Thank you for your reply. Please find attached the CDX & SKC file formats as requested.


After speaking to Ahmed & Nathan, I realise there are few fixes coming in for 5.9 releases that they have raised, and ideally we would like this one to be in 5.9 as well.


The concerns are text being cut off when manually sized, and when resized correctly in MarvinSketch, the bounding is box is too big. This is going to be visible to users in our renderer when they use MarvinSketch. I understand that the sizes aren't going to be exactly accurate, and the wrapping of the text might be different - this is not a big issue, but as long as the bounds are roughly correct both reading and writing to MRV, we should be okay.


Thanks,


Ruchir Sanghavi
IDBS

ChemAxon 5433b8e56b

02-03-2012 19:33:25

Hi,


Unfortunatelly, we can not push this into 5.9.0 in any ways, since it is in release candidate phase now, i will talk about this issue within the company, and see what we can do for you early next week.


Regards,
Istvan

ChemAxon 12eab24e0a

06-03-2012 11:12:55

Hi Ruchir,


Could you please explain how did you get that Text1-IDBS.mrv? I can not reproduce the steps, and since I've got that mrv, MarvinSketch does everything all right. As I see the problem is with those MPoint-s. I don't get how they are generated. As the bounding points are given, MarvinSketch starts to paint the text, it does the line-breaking itself, and it paints as much as it can do into the given rectangle. I've also recognized, that there can be also a problem with line-breaking, but I can not do anything further until I don't get the reproduction of the problem. If you set autoSize to "true", than it becomes a very wide text-box, cause there is no break in the text.


Note, that I can not deal with the given png-s, MarvinSketch can not open those.


Thank you in advance,


Eva

User c1499b3d95

07-03-2012 11:16:06

Hi Eva,


Regarding your questions:


 


"Could you please explain how did you get that
Text1-IDBS.mrv?"


- We are writing out to MRV format from our chemistry renderer. I am assuming that the bounds/MPoints that we write out in MRV are correct because we are doing the same for Molecules, arrows and other graphic shapes as well. All of these are sizing correctly in MarvinSketch, but for Text boxes, it is too small as a result the text is cut off if autoSize = false.


"I can not reproduce the steps, and since I've got that
mrv, MarvinSketch does everything all right."


- MarvinSketch is cutting of the text, only half of it is displayed because the bounds are not big enough according to MarvinSketch (even though at the same font size / scaling we display it correctly).


"As I see the problem is
with those MPoint-s. I don't get how they are generated. As the bounding
points are given, MarvinSketch starts to paint the text, it does the
line-breaking itself, and it paints as much as it can do into the given
rectangle."


- For the text bounds that we have, we render our text within the same bounds that we are writing out to MRV as MPoints. However, these bounds are proving to NOT be big enough to display the whole of the text in MRV, as a result, as you can see when you open the Text1-IDBS.mrv - there is a lot of text that is cut off.


- So how come when we write out similar bounds for molecules and other graphic shapes, the size we are writing out is correctly displayed in MarvinSketch, but for text boxes, the bounds are too small? Is MarvinSketch doing some sort of scaling that we need to consider when writing out the bounds? And do the reverse when reading it back in (because we are finding that the text bounds given to us by MarvinSketch are too big). Also note that these same text bounds when we read/write it out to SKC and CDX formats, are displayed correctly in their respective 3rd party applications - this is why I do not think we are writing out the bounds incorrectly to MRV, when the same works correctly for other formats.


"I've also recognized, that there can be also a problem with
line-breaking, but I can not do anything further until I don't get the
reproduction of the problem. If you set autoSize to "true", than it
becomes a very wide text-box, cause there is no break in the text."


- I am not sure if there is a problem with line-breaking in our scenario. In the case of Text1-IDBS.mrv, I have set autoSize to be FALSE, because in our system, the user has set a fixed width and height of the text box, which as I mentioned earlier, even with the same font size and scaling, it is not being rendered correctly in MarvinSketch, i.e. text is being cut off.


Hope this helps. Also note that the urgency on this matter is now a low as we understand your position regarding 5.9, but eventually we would like this to be corrected. It may be that there is a different scaling / text rendering that MarvinSketch is using, and we need to figure out what it is?


Kind regards,
Ruchir Sanghavi


IDBS

ChemAxon 12eab24e0a

09-03-2012 10:09:06

Hi,


Thank you for the detailed description. I understand the problem, and I have some idea about the solutions. There are several things. First, there is a bug in the calculation of the bounds of the MTextbox, of course we'll fix that. But! this won't fix all the problems. As I see, there is a problem with the font sizes. If you look at the pictures, you can see that MarvinSketch fonts are  much bigger, than fonts in your text, even they have the same size-theoretically.


"It may be that there is a different scaling / text rendering that MarvinSketch is using, and we need to figure out what it is?"


Probably yes, or it is rather sure. I have to discuss also with my colleagues (who are on holiday now) about the fixes.


Thank you for your patience


Eva

User 00d8fa0569

26-10-2012 08:54:30


Hi,


Using MarvinSketch 5.11 I am still seeing the issue regarding the text bounds - can I please confirm that there is not a fix in the currently released code?


Thanks,


Nathan


ChemAxon 12eab24e0a

27-10-2012 15:40:51

Hi Nathan,


That's true; there is no fix for the textbox problem yet. I can assure you that it is a high priority bug in our system, but we refactor and reorganize our code, and this fix is part of this work.


Thank you for your patience,


Eva