Closed DiamondJim87 closed 8 months ago
My recollection is this needs to be studied on many different platforms. Many of the fonts seem to have incorrect metrics. I don't see what I was referring to with "em/5", but the way, do you? Clearly the top of the legend should be the top of the GrannyTextRenderer, so it's probably the GrannyTextRenderer which needs tweaking.
Could you post screenshots, and id the platform (Java version too)?
Thanks for the rapid response!
Java version is 1.8. I'm running on a Mac. These are Larry's "StatusLineRenderer" plots, where the only significant axis is the X axis. The Y is just 0 to 1 and we suppress the axis and color it just to show whether there are data in that time range (red) or not (white).
The idea of emsize / 5 doesn't make sense to me either. Maybe it was something different and when the code got changed the comment didn't?
Here's a screen shot. You can most easily see the effect on the bottom two legends, where the C and S in SpaceCraftEngineering and CorruptPacket are cut off. The level of zoom or the size of the canvas do not affect the cut-off effect.
They definitely look a little high to me. The goal is to line up top of an M or T with the DasRow top. I do remember experimenting a lot here, so much that I have no idea what the final solution was. Another thought would be to have a legendLabel position which is OutsideSE, since it's very easy to know the baseline for a font. I think I'll look into this now, and I'll let you know what I find out.
You can see here how the title ends up low on Linux:
And those are legend labels, not annotations, right? You must have found my kludge which lets you turn off the symbol drawing, right? Note with annotations you would have a lot more control, but it would also be quite a bit more code. Do you add things in a loop?
Yes, legend labels, not annotations. Yes, it's in a loop, the number of plots on any given canvas is arbitrary.
I think the best solution is for me to add OutsideSE to the legendPosition property.
That probably would do the trick for this case.
Give it a pull and let me know how that looks. On Linux it's actually 1-2 pixels too high, and I need to set the bounding box since there may be a descender (y or p).
Ah, much better. Thanks again, this meets my needs perfectly!
I need to play with this on a mac. It still draws 4-5 pixels too high with this font, even though it's not clipping now. I'm going to reopen the ticket, just so I remember to look at this on different platforms. (But I'm happy this takes care of the clipping problem you were seeing.)
I've added a .vap which demos the problem where multi-line legend is incorrectly positioned. See https://github.com/autoplot/dev/blob/master/bugs/ghdas2/0066/demoBug.vap
Multi-line, outsideSE legends are fixed.
In DasPlot.java around line 476 is a block for computing the space necessary for legends for the case "OutsideNE". The vertical space is set as follows:
I am finding that the tops of larger letters, like capital C, are slightly cut off with this rectangle size. Just to confirm this is the source of my problem, I added 5 pixels to this vertical extent, and voila, the letters look fine.
Is there a different way to set this spacing, perhaps somehow based on font metrics?