In NatTable version 2 an autoscale was added while the tables are being created, supported by default DPI converters: DefaultHorizontalDpiConverter, DefaultVerticalDpiConverter. In version 1 everything under 96 DPI was not scaled down, however, now in version 2 for lower DPIs NatTables are scaled down hence images look ugly, fonts are ok:
72dpi - not ok:
96dpi - ok:
What would be the simplest way to prevent default scaling under 96 DPI?






The feature that was added with NatTable 2.0 is a complete dynamic scaling and the full support for all DPI. The following blog post should give some more details NatTable – dynamic scaling enhancements
Actually I wonder what is "ugly" with lower DPIs. At least on modern displays it should not be an issue. The only thing I could think of are the images. But typically downscaling doesn't make images ugly. So it would be really interesting to know what the issue is.
You have two options to handle that:
As you can scale NatTable dynamically at runtime, you can simply execute the
ConfigureScalingCommandto force the scaling you want. Note that this needs to be done AFTERNatTable#configure().If you even want to block lower scalings on the dynamic scaling, you can implement a custom
ConfigureScalingCommandHandlerthat checks for the dpiFactor in theIDpiConverterand if that is lower than 1 register aFixedScalingDpiConverteron theSizeConfigs. That customConfigureScalingCommandHandlerthen needs to be registered on theDataLayerto replace the default.The second approach is probably a bit more complicated and needs a better understanding of NatTable internals. And it blocks the dynamic scaling feature to really zoom out on huge tables. So it depends on your use cases which approach to use. Typically the first option should be sufficient.
BTW, if the images are the issue, changing the scaling at runtime without re-registering the images could also cause a rendering issue. The reason for this is that images are stored in the
ImageRegistryand they need to be updated there in case of scaling changes. For approach 1. that means to register all images in theConfigRegistryagain after theConfigureScalingCommand. At least if you are not using themes or CSS styling.