How to prevent automatic scaling under 96 dpi - nattable

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 ConfigureScalingCommand to force the scaling you want. Note that this needs to be done AFTER NatTable#configure().
if (Display.getDefault().getDPI().x < 96) {
natTable.doCommand(
new ConfigureScalingCommand(new FixedScalingDpiConverter(96)));
}
If you even want to block lower scalings on the dynamic scaling, you can implement a custom ConfigureScalingCommandHandler that checks for the dpiFactor in the IDpiConverter and if that is lower than 1 register a FixedScalingDpiConverter on the SizeConfigs. That custom ConfigureScalingCommandHandlerthen needs to be registered on the DataLayer to 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 ImageRegistry and they need to be updated there in case of scaling changes. For approach 1. that means to register all images in the ConfigRegistry again after the ConfigureScalingCommand. At least if you are not using themes or CSS styling.

Related

NSTextStorage easily / background attribute change

I'm finishing a nice app with a relatively small text editor. During implementation of the syntax highlight I found myself in need to change foreground colour attribute of recognized tokens. I noticed that there is a property of NSTextStorage:
var fixesAttributesLazily: Bool { get }
The documentation, regarding it is:
A Boolean value indicating whether the text storage object fixes attributes lazily. (read-only)
Discussion
When subclassing, the default value of this property is NO, meaning that your subclass fixes attributes immediately when they are changed. The system’s concrete subclass overrides this property and sets it to YES.
I really don't know how to interpret this ... but this is what I did:
I'm changing the attributes of th recognised tokens inside textStorage(textStorage: NSTextStorage, didProcessEditing editedMask: NSTextStorageEditActions, range editedRange: NSRange, changeInLength delta: Int) (which is a delegate method of NSTextStorage). Here I'm checking the value of this property - it's FALSE.
I subclassed NSTextStorage exactly as Apple suggest (https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/TextStorageLayer/Tasks/Subclassing.html) and overrode the property. The text view started to behave very strange. Actually with small text it performs OK, but as soon as I open a 4 Mbytes file - it hangs and ... well ... bad things start to happen to my mac. Actually this behaviour doesn't depend on the value of the fixesAttributesLazily property. Maybe my implementation of NSTextStorage is bad or at least not sophisticated.
Any trick of applying attributes in background or lazily or ... something like this is welcomed.
In additional: I know that there are many ways to optimise a syntax highlighted. It may highlight partially, use some kind of logic, based on the changed range ... etc. What I'm looking for is a way to process attribute changes in background. For example currently when I paste 4 Mbyte file to the text view, it first highlights it (which takes 2-3 seconds) and then it visualises it. The effect I'm looking for is the text to appear right away and after time - the colors.
The project I'm working on is written in Swift.
Thanks to everyone in advance for the help. You may reach me via ivailon at gmail dot com for specifics, since I don't want to expose the app here ... at least not yet ;-)

Can Doxygen/Graphviz generate a PNG larger than 32766px?

I am trying to generate a doxygen package with one enormous class hierarchy. (It's for QuickFIX, FWIW). No matter what I do, it seems to be capping the height of the image at 32766:
$ file html/inherit__graph__23.png
html/inherit__graph__23.png: PNG image data, 307 x 32766, 8-bit/color RGBA, non-interlaced
It's not clipping; it's scaling. The result is that at only 307px wide, the class boxes are scaled so small that the text inside them is not readable, and the HTML map doesn't work, either.
Neither the dot nor the doxygen documentation mention this limit, though it seems clear something is doing it, and I can't find any directives to override it. (And yes, I realize an image that big has its own problems in browsers, but I'll deal with that later.) That number seems suspicious due to its proximity to 2^15, and I believe PNG uses a 32-bit size field, so something bigger should be possible.
Anyone know where that limit is coming from and how to bypass it?
Edited to add: doxygen version = 1.6.1, graphviz = 2.26.0. Maybe too old?
Looks like I'm screwed. The 32K limit is imposed by cairo, which is what graphviz uses underneath the hood to render PNG.
Reference: http://comments.gmane.org/gmane.comp.lib.cairo/21068
Unfortunately, you're correct. It's too old; you're not going to be able to exceed that limit unless you manage to upgrade to a newer version.

Customising Zurb Foundation 5 Grid, Gutter and Max width

I've only been able to find one or two references to the maximum allowed column we can add to a customized version of Foundation5 and these claim the number is 16. However I can find no official documentation of this.
In the Foundation 5 download customizer there are input fields for '# of Columns', 'Gutter (em)', and 'Max-Width (em)'.
I have tested with a value of up to 24 columns and the CSS output has classes included for up to 24 columns, so I'd assume the 16 column restriction no longer applies (or only applies to older versions of Foundation).
So my questions are:
Does anyone know what the max number of columns allowed is / or if others are using a particular number successfully?
If I custom download Foundation5 with more columns, how do I know what gutter width and Max-Width values will work out correctly or can I just use anything (the downloader doesn't give any indication of incorrect values or out of range values)?
Having a custom download, how would I best manage Foundation updates if I wanted to upgrade the CSS to future newer versions?
PS: Im not using SASS or other pre-processor tools.
I am afraid that the only way I can see doing this easily is by using Sass.
If you look on the grid docs page you can adjust the _setting.scss thus:
$row-width: rem-calc(1000);
$column-gutter: rem-calc(30);
$total-columns: 12 ;
Foundation Grid docs
When you say upgrade the CSS to future newer versions do you mean newer versions of Foundation? If you did a customised version download then you would probably need to do it again. If you are also do other styling changes on your site outside of the Foundation stuff and you are not going to use Sass, I think your best option would be to keep them on a separate stylesheet.
Without sounding like a Sass evangelist...it is really worth your while to use it. Makes life so much easier!
There is a CSS customizer that lets you choose up to 100 columns http://foundation.zurb.com/develop/download.html
Also you can change it in Sass to any number.

Purpose of secondary dependent styles?

I'm just going through the GWT Tutorial and one point which just don't understand is when and why to use dependent secondary styles. If I define a style in the .css stylesheet, and use the addStyleName method it seems to have the same effect.
E.g. applying a secondary dependent style to a button or applying the it as a non-dependant style seems to yield the exact same results.
Basically the dependent name is more general, since it's calculated at runtime. You can add a dependent name of "highlighted" to any Widget without knowing what it is, and GWT will come up with the appropriate css class name for you. You don't have to hard code button-highlighted, select-highlighted, mycustomthing-highlighted in GWT this way (you do still need to create them all in your css code).

Why does Unity get stuck when it bakes resources?

I am trying to open a project in Unity but it is very slow and it says it is "baking resources". How can I make it faster?
Depends what do you want to achieve.
If the building while doing changes is problematic go to "Window/Ligthing/Scene" and turn the Bake build auto OFF.
If you are making the finall product you may turn the quality of the shadows and light maping down for less details better performance and building time.
"Window/Ligthing/Scene"
1 Turn off "Precomputed Realtime GI" or turn it down to 1.
2 Play with "Baked GI" Resolution.
3 Window/Ligthing/Object select the biggest complexed objects (like terrain) and set the "Scale In lightmap' down a little
4 If you have a lot of static complex items like trees turn the "static" off. A static forrest could build in to 1GB map or a nonstatic one in to 100MB :)
Its always something in exchange, performance/quality/building time/memory...