Re: [Rdkit-discuss] Font size when drawing molecules

2022-02-09 Thread David Cosgrove
To help further, I'm just implementing an option
drawOptions().fixedFontSize to allow you to insist on a font size, in
pixels.  I will remember to expose it to Python!
Layout is a different department, I'm afraid I can't help there.  It would
probably be better to start a new thread with that, so as to catch the
attention of the right people.


On Wed, Feb 9, 2022 at 3:58 PM Tim Dudgeon  wrote:

> Thanks Dave. Understood.
> A related question - is it possible to make the layout aware of the amount
> of space that is available? I'm stuck with a very wide and short aspect
> ratio and it would be helpful if the layout engine could optimise the
> layout to fit in that unconventional space.
> Tim
>
> On Wed, Feb 9, 2022 at 11:40 AM David Cosgrove 
> wrote:
>
>> Hi Tim,
>> Sorry, the font size setting both within the code and in the public
>> interface has been a fraught matter since Freetype was introduced for the
>> font drawing and it isn't currently as controllable as one might wish.  The
>> font is chosen based on baseFontSize and the drawing scale.  The size of
>> the font relative to the bond lengths is therefore fixed, unless it hits
>> the minFontSize or maxFontSize.  So for a large molecule in a small canvas,
>> it is likely that the font size will be larger relative to the bonds as
>> minFontSize has an effect, and vice versa with a small molecule in a large
>> canvas.  To achieve what you want, you need to increase bastFontSize,
>> which, as Paolo mentioned, isn't currently exposed to Python.  Apologies
>> for that, which was an oversight.  It does work with the current release,
>> though, so if you don't mind rebuilding RDKit you can use it now.
>> Add
>> ```
>>
>>   .def_readwrite(
>>
>>   "baseFontSize", ::MolDrawOptions::baseFontSize,
>>
>>   "relative size of font.  Defaults to 0.6.  -1 means use
>> default.")
>> ```
>> to $RDBASE/Code/GraphMol/MolDraw2D/Wrap/rdMolDraw2D.cpp immediately after
>> the analogous minFontSize entry
>> HTH,
>> Dave
>>
>>
>>
>> On Wed, Feb 9, 2022 at 10:31 AM Tim Dudgeon 
>> wrote:
>>
>>> OK, thanks. That's great to hear.
>>> In the meantime could someone explain how the font is currently chosen?
>>> e.g. if I specify 10 as min and 14 as max what is actually used?
>>> Tim
>>>
>>> On Wed, Feb 9, 2022 at 10:11 AM Paolo Tosco 
>>> wrote:
>>>
 Hi Tim,

 Dave Cosgrove is currently working at a PR which, among other things,
 addresses exactly the need that you describe through the baseFontSize
 parameter, which is currently not exposed to Python. The PR is almost ready
 for merging and it should become part of the March release.

 Cheers,
 p.

 On Wed, Feb 9, 2022 at 10:57 AM Tim Dudgeon 
 wrote:

> I'm confused over how the font is chosen when drawing molecules.
> There are MolDrawOptions.minFontSize and MolDrawOptions.maxFontSize
> properties, and if I set them to the same value then that sized font is
> used. But if I set max to a larger size than min then it's not clear what
> font size will be used.
> I'm wanting the font size to adapt to the amount the molecule is
> scaled to fit the space (larger molecules needing a smaller font) but I
> want the font size that is used to be a bit bigger than the default
> that would be used if I don't set anything.
> How do I go about this?
> Thanks
> Tim
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
 ___
>>> Rdkit-discuss mailing list
>>> Rdkit-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>>
>>
>>
>> --
>> David Cosgrove
>> Freelance computational chemistry and chemoinformatics developer
>> http://cozchemix.co.uk
>>
>>

-- 
David Cosgrove
Freelance computational chemistry and chemoinformatics developer
http://cozchemix.co.uk
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Font size when drawing molecules

2022-02-09 Thread Tim Dudgeon
Thanks Dave. Understood.
A related question - is it possible to make the layout aware of the amount
of space that is available? I'm stuck with a very wide and short aspect
ratio and it would be helpful if the layout engine could optimise the
layout to fit in that unconventional space.
Tim

On Wed, Feb 9, 2022 at 11:40 AM David Cosgrove 
wrote:

> Hi Tim,
> Sorry, the font size setting both within the code and in the public
> interface has been a fraught matter since Freetype was introduced for the
> font drawing and it isn't currently as controllable as one might wish.  The
> font is chosen based on baseFontSize and the drawing scale.  The size of
> the font relative to the bond lengths is therefore fixed, unless it hits
> the minFontSize or maxFontSize.  So for a large molecule in a small canvas,
> it is likely that the font size will be larger relative to the bonds as
> minFontSize has an effect, and vice versa with a small molecule in a large
> canvas.  To achieve what you want, you need to increase bastFontSize,
> which, as Paolo mentioned, isn't currently exposed to Python.  Apologies
> for that, which was an oversight.  It does work with the current release,
> though, so if you don't mind rebuilding RDKit you can use it now.
> Add
> ```
>
>   .def_readwrite(
>
>   "baseFontSize", ::MolDrawOptions::baseFontSize,
>
>   "relative size of font.  Defaults to 0.6.  -1 means use
> default.")
> ```
> to $RDBASE/Code/GraphMol/MolDraw2D/Wrap/rdMolDraw2D.cpp immediately after
> the analogous minFontSize entry
> HTH,
> Dave
>
>
>
> On Wed, Feb 9, 2022 at 10:31 AM Tim Dudgeon  wrote:
>
>> OK, thanks. That's great to hear.
>> In the meantime could someone explain how the font is currently chosen?
>> e.g. if I specify 10 as min and 14 as max what is actually used?
>> Tim
>>
>> On Wed, Feb 9, 2022 at 10:11 AM Paolo Tosco 
>> wrote:
>>
>>> Hi Tim,
>>>
>>> Dave Cosgrove is currently working at a PR which, among other things,
>>> addresses exactly the need that you describe through the baseFontSize
>>> parameter, which is currently not exposed to Python. The PR is almost ready
>>> for merging and it should become part of the March release.
>>>
>>> Cheers,
>>> p.
>>>
>>> On Wed, Feb 9, 2022 at 10:57 AM Tim Dudgeon 
>>> wrote:
>>>
 I'm confused over how the font is chosen when drawing molecules.
 There are MolDrawOptions.minFontSize and MolDrawOptions.maxFontSize
 properties, and if I set them to the same value then that sized font is
 used. But if I set max to a larger size than min then it's not clear what
 font size will be used.
 I'm wanting the font size to adapt to the amount the molecule is scaled
 to fit the space (larger molecules needing a smaller font) but I want the
 font size that is used to be a bit bigger than the default that would be
 used if I don't set anything.
 How do I go about this?
 Thanks
 Tim
 ___
 Rdkit-discuss mailing list
 Rdkit-discuss@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

>>> ___
>> Rdkit-discuss mailing list
>> Rdkit-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
>
>
> --
> David Cosgrove
> Freelance computational chemistry and chemoinformatics developer
> http://cozchemix.co.uk
>
>
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Font size when drawing molecules

2022-02-09 Thread David Cosgrove
Hi Tim,
Sorry, the font size setting both within the code and in the public
interface has been a fraught matter since Freetype was introduced for the
font drawing and it isn't currently as controllable as one might wish.  The
font is chosen based on baseFontSize and the drawing scale.  The size of
the font relative to the bond lengths is therefore fixed, unless it hits
the minFontSize or maxFontSize.  So for a large molecule in a small canvas,
it is likely that the font size will be larger relative to the bonds as
minFontSize has an effect, and vice versa with a small molecule in a large
canvas.  To achieve what you want, you need to increase bastFontSize,
which, as Paolo mentioned, isn't currently exposed to Python.  Apologies
for that, which was an oversight.  It does work with the current release,
though, so if you don't mind rebuilding RDKit you can use it now.
Add
```

  .def_readwrite(

  "baseFontSize", ::MolDrawOptions::baseFontSize,

  "relative size of font.  Defaults to 0.6.  -1 means use default.")
```
to $RDBASE/Code/GraphMol/MolDraw2D/Wrap/rdMolDraw2D.cpp immediately after
the analogous minFontSize entry
HTH,
Dave



On Wed, Feb 9, 2022 at 10:31 AM Tim Dudgeon  wrote:

> OK, thanks. That's great to hear.
> In the meantime could someone explain how the font is currently chosen?
> e.g. if I specify 10 as min and 14 as max what is actually used?
> Tim
>
> On Wed, Feb 9, 2022 at 10:11 AM Paolo Tosco 
> wrote:
>
>> Hi Tim,
>>
>> Dave Cosgrove is currently working at a PR which, among other things,
>> addresses exactly the need that you describe through the baseFontSize
>> parameter, which is currently not exposed to Python. The PR is almost ready
>> for merging and it should become part of the March release.
>>
>> Cheers,
>> p.
>>
>> On Wed, Feb 9, 2022 at 10:57 AM Tim Dudgeon 
>> wrote:
>>
>>> I'm confused over how the font is chosen when drawing molecules.
>>> There are MolDrawOptions.minFontSize and MolDrawOptions.maxFontSize
>>> properties, and if I set them to the same value then that sized font is
>>> used. But if I set max to a larger size than min then it's not clear what
>>> font size will be used.
>>> I'm wanting the font size to adapt to the amount the molecule is scaled
>>> to fit the space (larger molecules needing a smaller font) but I want the
>>> font size that is used to be a bit bigger than the default that would be
>>> used if I don't set anything.
>>> How do I go about this?
>>> Thanks
>>> Tim
>>> ___
>>> Rdkit-discuss mailing list
>>> Rdkit-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>>
>> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>


-- 
David Cosgrove
Freelance computational chemistry and chemoinformatics developer
http://cozchemix.co.uk
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Font size when drawing molecules

2022-02-09 Thread Tim Dudgeon
OK, thanks. That's great to hear.
In the meantime could someone explain how the font is currently chosen?
e.g. if I specify 10 as min and 14 as max what is actually used?
Tim

On Wed, Feb 9, 2022 at 10:11 AM Paolo Tosco 
wrote:

> Hi Tim,
>
> Dave Cosgrove is currently working at a PR which, among other things,
> addresses exactly the need that you describe through the baseFontSize
> parameter, which is currently not exposed to Python. The PR is almost ready
> for merging and it should become part of the March release.
>
> Cheers,
> p.
>
> On Wed, Feb 9, 2022 at 10:57 AM Tim Dudgeon  wrote:
>
>> I'm confused over how the font is chosen when drawing molecules.
>> There are MolDrawOptions.minFontSize and MolDrawOptions.maxFontSize
>> properties, and if I set them to the same value then that sized font is
>> used. But if I set max to a larger size than min then it's not clear what
>> font size will be used.
>> I'm wanting the font size to adapt to the amount the molecule is scaled
>> to fit the space (larger molecules needing a smaller font) but I want the
>> font size that is used to be a bit bigger than the default that would be
>> used if I don't set anything.
>> How do I go about this?
>> Thanks
>> Tim
>> ___
>> Rdkit-discuss mailing list
>> Rdkit-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
>
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Font size when drawing molecules

2022-02-09 Thread Paolo Tosco
Hi Tim,

Dave Cosgrove is currently working at a PR which, among other things,
addresses exactly the need that you describe through the baseFontSize
parameter, which is currently not exposed to Python. The PR is almost ready
for merging and it should become part of the March release.

Cheers,
p.

On Wed, Feb 9, 2022 at 10:57 AM Tim Dudgeon  wrote:

> I'm confused over how the font is chosen when drawing molecules.
> There are MolDrawOptions.minFontSize and MolDrawOptions.maxFontSize
> properties, and if I set them to the same value then that sized font is
> used. But if I set max to a larger size than min then it's not clear what
> font size will be used.
> I'm wanting the font size to adapt to the amount the molecule is scaled to
> fit the space (larger molecules needing a smaller font) but I want the font
> size that is used to be a bit bigger than the default that would be used if
> I don't set anything.
> How do I go about this?
> Thanks
> Tim
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Font size when drawing molecules

2022-02-09 Thread Tim Dudgeon
I'm confused over how the font is chosen when drawing molecules.
There are MolDrawOptions.minFontSize and MolDrawOptions.maxFontSize
properties, and if I set them to the same value then that sized font is
used. But if I set max to a larger size than min then it's not clear what
font size will be used.
I'm wanting the font size to adapt to the amount the molecule is scaled to
fit the space (larger molecules needing a smaller font) but I want the font
size that is used to be a bit bigger than the default that would be used if
I don't set anything.
How do I go about this?
Thanks
Tim
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss