Column label top-align inaccurate

Issue #548 new
Robert Leach created an issue

USE CASE: WHAT DO YOU WANT TO DO?

Align column labels to the top

STEPS TO REPRODUCE AN ISSUE (OR TRIGGER A NEW FEATURE)

  1. Run treeview on Ubuntu 16.04
  2. Top-align the labels in any file (most notably small_133x133.cdt)

CURRENT BEHAVIOR

top_align_messed_up.png

EXPECTED BEHAVIOR

Using the same font, on a Mac, the labels look like this (as they should on Ubuntu):

top_align_mac.png

DEVELOPERS ONLY SECTION

SUGGESTED CHANGE (Pseudocode optional)

none

FILES AFFECTED (where the changes will be implemented) - developers only

unknown

LEVEL OF EFFORT - developers only

major

COMMENTS

Comments (2)

  1. Robert Leach reporter

    Seems to only affect Debian & RedHat Linux. I tried Mac & Windows and could not reproduce this there. Trying RedHat now.

  2. Robert Leach reporter

    Currently, the code is using FontMetrics.stringWidth(). It's only when Graphics2D.rotate is called on Linux where that ends up being inaccurate. Trying another method to compute the string length in pixels when the OS is linux, might be the way to go.

    There is SwingUtilities.computeStringWidth() and FontMetrics.getStringBounds(). I believe that in the past, we had used getStringBounds(), but found it to be inaccurate on Mac/Windows, so I'm hoping that will work well for linux...

    https://stackoverflow.com/questions/19582502/how-to-get-the-correct-string-width-from-fontmetrics-in-java

  3. Log in to comment